<template>
  <div>
    <!-- 组庭界面 -->
    <el-dialog
      title="仲裁员信息"
      :visible="showformateCourt"
      width="800px"
      @close="cancel"
      :destroy-on-close="true"
    >
      <!-- <el-form ref="form"> -->
      <el-table
        :data="dataList"
        style="width: 100%"
        @selection-change="handleSelectionChange"
      >
        <el-table-column type="selection" width="55"> </el-table-column>
        <el-table-column
          label="仲裁员姓名"
          align="center"
          prop="arbitratorName"
          :show-overflow-tooltip="true"
        />
        <el-table-column
          label="专业分类"
          align="center"
          prop="professiClassifi"
          :show-overflow-tooltip="true"
        />
        <el-table-column
          label="当前案件数量"
          align="center"
          prop="currentCaseNum"
          :show-overflow-tooltip="true"
        />
        <el-table-column
          label="已结案数量"
          align="center"
          prop="closedCaseNum"
          :show-overflow-tooltip="true"
        />
      </el-table>
      <pagination
        v-show="total > 0"
        :total="total"
        :page.sync="queryParams.pageNum"
        :limit.sync="queryParams.pageSize"
        @pagination="getarbitrAtor"
      />
      <!-- </el-form> -->
      <div slot="footer" class="dialog-footer">
        <el-button
          type="primary"
          @click="submitForm"
          :disabled="!this.arbitrators.length > 0"
          >确 定</el-button
        >
        <el-button @click="cancel">取 消</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import { arbitrAtor, pendTral } from "@/api/formationCourt/formationCourt";
export default {
  props: [
    "showformateCourt",
    "formateCourtData",
  ],
  data() {
    return {
      dataList: [],
      total: 0,
      queryParams: {
        pageNum: 1,
        pageSize: 10,
      },
      arbitrators: [],
    };
  },
  created() {
    this.getarbitrAtor();
  },
  methods: {
    // 获取仲裁员信息
    getarbitrAtor() {
      arbitrAtor({}).then((res) => {
        this.dataList = res.rows;
        this.total = res.total;
      });
    },
    // 勾选仲裁员
    handleSelectionChange(val) {
      this.arbitrators = [];
      val.forEach((item) => {
        this.arbitrators.push({
          id: item.id,
          arbitratorName: item.arbitratorName,
        });
      });
    },
    // 确认
    submitForm() {
      if (this.arbitrators.length > 0) {
        let params = {
          id: this.formateCourtData.id,
          arbitrators: this.arbitrators,
        };
        pendTral(params).then((res) => {
          this.cancel();
          this.$modal.msgSuccess("组庭成功");
          this.$emit("getformationData");
        });
      }
    },
    // 取消
    cancel() {
      this.$emit("cancelcourtDialog");
      this.arbitrators = [];
    },
  },
};
</script>

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