<template>
  <div class="app-container">
    <el-form
      :model="queryParams"
      ref="queryForm"
      size="small"
      :inline="true"
      label-width="88px"
    >
      <el-form-item label="仲裁员姓名" prop="arbitratorName">
        <el-input
          v-model="queryParams.arbitratorName"
          placeholder="请输入仲裁员姓名"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item>
        <el-button
          type="primary"
          icon="el-icon-search"
          size="mini"
          @click="handleQuery"
          >搜索</el-button
        >
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
          >重置</el-button
        >
      </el-form-item>
    </el-form>
    <el-row :gutter="10" class="mb8">
      <el-col :span="1.5">
        <el-button
          type="primary"
          plain
          icon="el-icon-plus"
          size="mini"
          @click="addArbitrator"
          v-hasPermi="['monitor:job:add']"
          >新增仲裁员</el-button
        >
      </el-col>
    </el-row>
    <el-table v-loading="loading" :data="dataList" style="width: 100%">
      <el-table-column label="序号" type="index" align="center">
        <template slot-scope="scope">
          <span>{{
            (queryParams.pageNum - 1) * queryParams.pageSize + scope.$index + 1
          }}</span>
        </template>
      </el-table-column>
      <el-table-column
        label="仲裁员姓名"
        align="center"
        prop="arbitratorName"
        :show-overflow-tooltip="true"
      />
      <el-table-column
        label="职业"
        align="center"
        prop="career"
        :show-overflow-tooltip="true"
      />
      <el-table-column
        label="专业分类"
        align="center"
        prop="professiClassifi"
        :show-overflow-tooltip="true"
      />
      <el-table-column
        label="学历"
        align="center"
        prop="education"
        :show-overflow-tooltip="true"
      />
      <el-table-column
        label="所在地区"
        align="center"
        prop="area"
        :show-overflow-tooltip="true"
      />
      <el-table-column
        label="联系电话"
        align="center"
        prop="telephone"
        :show-overflow-tooltip="true"
      />
      <el-table-column
        label="操作"
        align="center"
        class-name="small-padding fixed-width"
      >
        <template slot-scope="scope">
          <el-button
            size="mini"
            type="text"
            icon="el-icon-zoom-in"
            @click="detailRow(scope.row)"
            v-hasPermi="['monitor:online:forceLogout']"
            >详情</el-button
          >
          <el-button
            size="mini"
            type="text"
            icon="el-icon-edit"
            @click="editRow(scope.row)"
            v-hasPermi="['monitor:online:forceLogout']"
            >修改</el-button
          >
          <el-button
            size="mini"
            type="text"
            icon="el-icon-delete"
            @click="deleteRow(scope.row)"
            v-hasPermi="['monitor:online:forceLogout']"
            >删除</el-button
          >
        </template>
      </el-table-column>
    </el-table>
    <pagination
      v-show="total > 0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getArbitratorList"
    />
    <arbitrator-dialog
      :showarbitrator="showarbitrator"
      :dialogTitle="dialogTitle"
      @closeArbitratorDialog="closeArbitratorDialog"
      :formData="formData"
      :flag="flag"
    ></arbitrator-dialog>
  </div>
</template>

<script>
import arbitratorDialog from "./components/arbitratorDialog.vue";
export default {
  components: { arbitratorDialog },
  data() {
    return {
      // 遮罩层
      loading: true,
      // 查询参数
      queryParams: {
        arbitratorName: null,
        pageNum: 1,
        pageSize: 10,
      },
      formData: {}, // 弹框数据
      dataList: [],
      showarbitrator: false, //显示弹框
      dialogTitle: "", //弹框标题
      flag: null,
    };
  },
  created() {
    this.getArbitratorList(this.queryParams);
  },
  methods: {
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getArbitratorList(this.queryParams);
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm");
      this.getArbitratorList(this.queryParams);
    },
    // 获取仲裁员列表数据
    getArbitratorList() {
      this.dataList.push({
        id: "1",
        arbitratorName: "刘某",
        career: "律师",
        professiClassifi: "经济管理",
        education: "本科",
        area: "西安",
        telephone: "18547451263",
      });
      this.total = this.dataList.length;
      this.loading = false;
    },
    // 新增仲裁员
    addArbitrator() {
      this.showarbitrator = true;
      this.dialogTitle = "新增";
      this.flag = 0;
      this.formData = {};
    },
    // 详情
    detailRow(row) {
      this.showarbitrator = true;
      this.dialogTitle = "详情";
      this.flag = 1;
      this.formData = row;
    },
    // 修改
    editRow(row) {
      this.showarbitrator = true;
      this.dialogTitle = "修改";
      this.flag = 2;
      this.formData = row;
    },
    // 关闭弹框
    closeArbitratorDialog() {
      this.showarbitrator = false;
    },
    // 删除
    deleteRow() {
      this.$modal
        .confirm("是否确认删除？")
        .then(function () {
          // return removeCaseApply({ id: row.id });
        })
        .then((res) => {
          this.getArbitratorList(this.queryParams);
          this.$modal.msgSuccess("删除成功");
        })
        .catch(() => {});
    },
  },
};
</script>

<style lang="scss" scoped>
</style>