<template>
  <el-dialog
    :title="$t2('查看候选人', 'components.wf.setCandidateTitle')"
    :close-on-click-modal="falseValue"
    :visible.sync="showDialog"
    :modal="falseValue"
    custom-class="dialog-style list-dialog dialog-checkbox pd_0"
    width="1200px"
    @close="closeWin"
    v-el-drag-dialog
    v-el-dialog-center
    :append-to-body="true"
  >
    <template #title>
      <span class="el-dialog__title">
        {{ $t2("查看候选人", "components.wf.setCandidateTitle") }}
      </span>
    </template>
    <div class="cont" style="height: 450px">
      <vxe-grid
        ref="table-m1"
        :data="tableData"
        v-bind="vxeOption"
        @resizable-change="$vxeTableUtil.onColumnWitchChange"
        @custom="$vxeTableUtil.customHandle"
      >
        <template #form>
          <div class="clearfix screen-btns" v-show="showPreWfNodesButton && showModifyButton">
            <div class="fl" v-show="showModifyButton">
              <vxe-button
                icon="el-icon-user"
                class="button-sty"
                @click="fillCandidates()"
                type="text"
                status="primary"
                plain
                >{{ $t1("获取上次候选人") }}
              </vxe-button>
            </div>
          </div>
        </template>
        <template #wfTaskCandidates="{ row }">
          {{ getUsernames(row) }}
        </template>
        <template #operate="{ row, rowIndex }">
          <a
            @click="openUserDialig(row, rowIndex)"
            class="a-link"
            v-if="row.modifyCandidates"
          >
            <el-tooltip
              :enterable="false"
              effect="dark"
              :content="$t2('设置候选人', 'components.wf.modifyCandidate')"
              placement="top"
              popper-class="tooltip-skin"
            >
              <div>
                <i class="el-icon-edit"></i
                ><span>{{ $t2("设置候选人", "components.wf.modifyCandidate") }}</span>
              </div>
            </el-tooltip>
          </a>
        </template>
      </vxe-grid>
    </div>
    <span slot="footer" class="dialog-footer">
      <el-button type="primary" plain class="button-sty" @click="closeWin">
        <i class="el-icon-close el-icon"></i>
        {{ $t2("取 消", "system.button.cancel2") }}
      </el-button>
      <el-button type="primary" @click="confirmDialog" class="button-sty">
        <i class="el-icon-check el-icon"></i>
        {{ $t2("确 定", "system.button.confirm2") }}
      </el-button>
    </span>
    <user-dialog
      v-if="showUserDialog"
      :visiable.sync="showUserDialog"
      @close="showUserDialog = false"
      @confirm="userConfirm"
      multi="true"
      :rows="userRows"
    ></user-dialog>
    <wfTaskUserRangeDialog
      v-if="showWfTaskUserRangeDialog"
      :visiable.sync="showWfTaskUserRangeDialog"
      @close="showWfTaskUserRangeDialog = false"
      @confirm="confirmWfTaskUserRangeDialog"
      multi="true"
      :rows="userRangeRows"
      :rangeTableDatas="rangeTableDatas"
      :current_prefix="current_prefix"
    ></wfTaskUserRangeDialog>
  </el-dialog>
</template>

<script>
import mixin from "../../components/wf/mixins/setCandidateDialog2";
import { selectDialogMixins } from "../../mixins/selectDialog/index.js";

export default {
  mixins: [selectDialogMixins, mixin],
};
</script>
