<template>
  <div class="app-container">
    <el-form
      :model="queryParams"
      ref="queryForm"
      size="small"
      :inline="true"
      v-show="showSearch"
      label-width="68px"
    >
      <el-form-item label="姓名" prop="Name">
        <el-input
          v-model="queryParams.Name"
          placeholder="请输入姓名"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>

      <el-form-item label="证书类别" prop="Dept">
        <el-select placeholder="请选择证书类别"></el-select>
      </el-form-item>
      <el-form-item label="身份证号" prop="ShenFenZheng">
        <el-input
          v-model="queryParams.ShenFenZheng"
          placeholder="请输入身份证号"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="证书号" prop="ShenFenZheng">
        <el-input
          v-model="queryParams.ShenFenZheng"
          placeholder="请输入证书号"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="单位名称" prop="Dept">
        <el-input
          v-model="queryParams.Dept"
          placeholder="请输入单位名称"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="发证日期" prop="Dept">
        <el-input
          v-model="queryParams.Dept"
          placeholder="请输入发证日期"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="证书状态" prop="Dept">
        <el-select placeholder="请选择证书状态"></el-select>
      </el-form-item>
      <el-form-item label="不良记录" prop="Dept">
        <el-select
          v-model="queryParams.BljlFlg"
          placeholder="请选择是否有不良记录"
          clearable
        >
          <el-option
            v-for="dict in dict.type.jxjy_bljl"
            :key="dict.value"
            :label="dict.label"
            :value="dict.value"
          />
        </el-select>
      </el-form-item>
      <el-form-item label="处罚类别" prop="Dept">
        <el-select
          v-model="queryParams.BljlFlg"
          placeholder="请选择处罚类别"
          clearable
        >
          <el-option
            v-for="dict in dict.type.jxjy_bljl"
            :key="dict.value"
            :label="dict.label"
            :value="dict.value"
          />
        </el-select>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" @click="handleQuery">查询</el-button>
        <el-button @click="resetQuery">重置</el-button>
      </el-form-item>
    </el-form>

    <el-table v-loading="loading" :data="RenCaiList">
      <el-table-column label="序号" align="center" type="index">
        <template slot-scope="scope">
          <span>{{ handleTableIndex(scope.$index, queryParams) }}</span>
        </template>
      </el-table-column>
      <el-table-column label="姓名" align="center" prop="Name" />
      <el-table-column label="性别" align="center" prop="Sex" />
      <el-table-column
        label="身份证号"
        align="center"
        width="200"
        prop="ShenFenZheng"
      />
      <el-table-column
        label="单位名称"
        align="center"
        prop="Dept"
        width="300"
      />
      <el-table-column
        label="监理员证书号"
        align="center"
        width="300"
        prop="JLYZhengHao"
      >
        <template slot-scope="scope">
          <div>
            {{ scope.row.JLYZhengHao }}

            <span class="supervision" v-if="scope.row.JLYzfFlg == '0'"
              >（作废）</span
            >
          </div>
        </template>
      </el-table-column>

      <el-table-column
        label="监理员发证日期"
        align="center"
        prop="JLYfzrq"
        width="200"
      >
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.JLYfzrq, "{y}-{m}-{d}") }}</span>
        </template>
      </el-table-column>
      <el-table-column
        label="监理工程师证书号"
        align="center"
        width="200"
        prop="JLZhengHao"
      >
        <template slot-scope="scope">
          <div>
            {{ scope.row.JLZhengHao }}
            <span v-if="scope.row.ShenHe == '0'" class="supervision"
              >（禁用）</span
            >
          </div>
        </template>
      </el-table-column>

      <el-table-column
        label="监理工程师证书发证日期"
        align="center"
        prop="JLfzrq"
        width="180"
      >
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.JLfzrq, "{y}-{m}-{d}") }}</span>
        </template>
      </el-table-column>
      <el-table-column
        label="监理工程师证书有效期至"
        align="center"
        prop="JLYxqz"
        width="180"
      >
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.JLYxqz, "{y}-{m}-{d}") }}</span>
        </template>
      </el-table-column>
      <el-table-column
        label="总监证书号"
        align="center"
        width="200"
        prop="ZJZhengHao"
      />
      <el-table-column
        label="总监发证日期"
        align="center"
        prop="ZJfzrq"
        width="180"
      >
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.ZJfzrq, "{y}-{m}-{d}") }}</span>
        </template>
      </el-table-column>
      <el-table-column label="不良记录"></el-table-column>
      <el-table-column label="处罚"></el-table-column>

      <el-table-column align="center" label="审核状态">
        <el-table-column align="center" label="状态">
          <template slot-scope="scope">
            <el-tag
              :type="
                (scope.row.JLYZhengHao != '' && scope.row.JLYzfFlg != 1) ||
                (scope.row.JLZhengHao != '' && scope.row.ShenHe != 0) ||
                (scope.row.ZJZhengHao != '' && scope.row.ZJzfFlg != 1)
                  ? 'primary'
                  : 'danger'
              "
              >{{
                (scope.row.JLYZhengHao != "" && scope.row.JLYzfFlg != 1) ||
                (scope.row.JLZhengHao != "" && scope.row.ShenHe != 0) ||
                (scope.row.ZJZhengHao != "" && scope.row.ZJzfFlg != 1)
                  ? "已审核"
                  : "未审核"
              }}</el-tag
            >
          </template>
        </el-table-column>
        <el-table-column align="center" label="设置">
          <template slot-scope="scope">
            <el-button
              @click="handleSettingAuditState(scope.row)"
              type="text"
              size="mini"
              >设置</el-button
            >
          </template>
        </el-table-column>
      </el-table-column>
      <el-table-column
        label="业绩"
        fixed="right"
        align="center"
        class-name="small-padding fixed-width"
      >
        <template slot-scope="scope">
          <el-button
            size="mini"
            type="text"
            icon="el-icon-edit"
            @click="handleView(scope.row)"
            v-hasPermi="['jlry:RenCai:edit']"
            >查看</el-button
          >
        </template>
      </el-table-column>
      <el-table-column align="center" label="操作" fixed="right" width="120">
        <template slot-scope="scope">
          <el-button
            size="mini"
            type="text"
            icon="el-icon-edit"
            @click="handleUpdate(scope.row)"
            v-hasPermi="['jlry:RenCai:edit']"
            >修改</el-button
          >
          <el-button
            size="mini"
            type="text"
            icon="el-icon-delete"
            @click="handleDelete(scope.row)"
            v-hasPermi="['jlry:RenCai:remove']"
            >删除</el-button
          >
        </template>
      </el-table-column>
    </el-table>

    <pagination
      v-show="total > 0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />

    <el-dialog
      title="业绩/简历"
      :visible.sync="viewDia"
      width="1000px"
      :before-close="
        () => {
          viewDia = false;
        }
      "
    >
      <el-table style="width: 1000px" :data="achievementTableData">
        <el-table-column
          label="序号"
          align="center"
          type="index"
        ></el-table-column>
        <el-table-column
          label="工作单位"
          width="300"
          align="center"
          prop="QYLoginName"
        ></el-table-column>
        <el-table-column width="200" label="添加时间" align="center">
          <template slot-scope="scope">
            {{ parseTime(scope.row.Nian, "{y}-{m}-{d}") }}
          </template>
        </el-table-column>
        <el-table-column align="center" label="内容" width="500">
          <template slot-scope="scope">
            <span v-html="content(scope.row)"></span>
          </template>
        </el-table-column>
      </el-table>
      <span slot="footer" class="dialog-footer">
        <el-button @click="viewDia = false">关 闭</el-button>
      </span>
    </el-dialog>
    <!-- 添加或修改监理人才管理对话框 -->
    <el-dialog
      :title="title"
      :visible.sync="open"
      width="1200px"
      append-to-body
    >
      <el-form
        ref="form"
        :model="form"
        :rules="rules"
        :inline="true"
        label-width="120px"
      >
        <el-form-item label="单位ID" prop="DeptID">
          <el-input v-model="form.DeptID" placeholder="请输入单位ID" />
        </el-form-item>
        <el-form-item label="单位名称" prop="Dept">
          <el-input v-model="form.Dept" placeholder="请输入单位名称" />
        </el-form-item>
        <el-form-item label="姓名" prop="Name">
          <el-input v-model="form.Name" placeholder="请输入姓名" />
        </el-form-item>
        <el-form-item label="身份证" prop="ShenFenZheng">
          <el-input v-model="form.ShenFenZheng" placeholder="请输入身份证" />
        </el-form-item>
        <el-form-item label="监理员证书号" prop="JLYZhengHao">
          <el-input
            v-model="form.JLYZhengHao"
            placeholder="请输入监理员证书号"
          />
        </el-form-item>
        <el-form-item label="监理员证号" prop="JLYZhengHaoNum">
          <el-input
            v-model="form.JLYZhengHaoNum"
            placeholder="请输入监理员证号"
          />
        </el-form-item>
        <el-form-item label="监理员发证日期" prop="JLYfzrq">
          <el-date-picker
            clearable
            v-model="form.JLYfzrq"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="请选择监理员发证日期"
          >
          </el-date-picker>
        </el-form-item>
        <el-form-item label="监理工程师证书号" prop="JLZhengHao">
          <el-input
            v-model="form.JLZhengHao"
            placeholder="请输入监理工程师证书号"
          />
        </el-form-item>
        <el-form-item label="监理工程师证书号(纯数字)" prop="JLZhengHaoNum">
          <el-input
            v-model="form.JLZhengHaoNum"
            placeholder="请输入监理工程师证书号(纯数字)"
          />
        </el-form-item>
        <el-form-item label="监理工程师证书发证日期" prop="JLfzrq">
          <el-date-picker
            clearable
            v-model="form.JLfzrq"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="请选择监理工程师证书发证日期"
          >
          </el-date-picker>
        </el-form-item>
        <el-form-item label="监理工程师证书有效期至" prop="JLYxqz">
          <el-date-picker
            clearable
            v-model="form.JLYxqz"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="请选择监理工程师证书有效期至"
          >
          </el-date-picker>
        </el-form-item>
        <el-form-item label="总监证书号" prop="ZJZhengHao">
          <el-input v-model="form.ZJZhengHao" placeholder="请输入总监证书号" />
        </el-form-item>
        <el-form-item label="总监发证日期" prop="ZJfzrq">
          <el-date-picker
            clearable
            v-model="form.ZJfzrq"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="请选择总监发证日期"
          >
          </el-date-picker>
        </el-form-item>
        <el-form-item label="建设部证书号" prop="JSBZhengHao">
          <el-input
            v-model="form.JSBZhengHao"
            placeholder="请输入建设部证书号"
          />
        </el-form-item>
        <el-form-item label="建设部发证日期" prop="JSBfzrq">
          <el-date-picker
            clearable
            v-model="form.JSBfzrq"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="请选择建设部发证日期"
          >
          </el-date-picker>
        </el-form-item>
        <el-form-item label="生日" prop="Birthday">
          <el-input v-model="form.Birthday" placeholder="请输入生日" />
        </el-form-item>
        <el-form-item label="学历" prop="XueLi">
          <el-input v-model="form.XueLi" placeholder="请输入学历" />
        </el-form-item>
        <el-form-item label="专业" prop="ZhuanYe">
          <el-input v-model="form.ZhuanYe" placeholder="请输入专业" />
        </el-form-item>
        <el-form-item label="职称" prop="ZhiCheng">
          <el-input v-model="form.ZhiCheng" placeholder="请输入职称" />
        </el-form-item>
        <el-form-item label="监理工作年限" prop="NianXian">
          <el-input v-model="form.NianXian" placeholder="请输入监理工作年限" />
        </el-form-item>
        <el-form-item label="联系人" prop="LianXiRen">
          <el-input v-model="form.LianXiRen" placeholder="请输入联系人" />
        </el-form-item>
        <el-form-item label="电话" prop="Tel">
          <el-input v-model="form.Tel" placeholder="请输入电话" />
        </el-form-item>
        <el-form-item label="手机" prop="Phone">
          <el-input v-model="form.Phone" placeholder="请输入手机" />
        </el-form-item>
        <el-form-item label="传真" prop="Fax">
          <el-input v-model="form.Fax" placeholder="请输入传真" />
        </el-form-item>
        <el-form-item label="邮编" prop="PostCode">
          <el-input v-model="form.PostCode" placeholder="请输入邮编" />
        </el-form-item>
        <el-form-item label="地址" prop="Address">
          <el-input v-model="form.Address" placeholder="请输入地址" />
        </el-form-item>
        <el-form-item label="邮件" prop="Email">
          <el-input v-model="form.Email" placeholder="请输入邮件" />
        </el-form-item>
        <el-form-item label="${comment}" prop="wangzhi">
          <el-input v-model="form.wangzhi" placeholder="请输入${comment}" />
        </el-form-item>
        <el-form-item label="处罚" prop="ChuFa">
          <el-input v-model="form.ChuFa" placeholder="请输入处罚" />
        </el-form-item>
        <el-form-item label="处罚时间" prop="ChuFaTime">
          <el-input v-model="form.ChuFaTime" placeholder="请输入处罚时间" />
        </el-form-item>
        <el-form-item label="是否有不良记录" prop="BljlFlg">
          <el-select v-model="form.BljlFlg" placeholder="请选择是否有不良记录">
            <el-option
              v-for="dict in dict.type.jxjy_bljl"
              :key="dict.value"
              :label="dict.label"
              :value="parseInt(dict.value)"
            ></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="不良记录编号" prop="BljlBianhao">
          <el-input
            v-model="form.BljlBianhao"
            placeholder="请输入不良记录编号"
          />
        </el-form-item>
        <el-form-item label="不良记录内容">
          <editor v-model="form.BljlContent" :min-height="192" />
        </el-form-item>
        <el-form-item label="不良记录定性" prop="BljlDingxing">
          <el-input
            v-model="form.BljlDingxing"
            type="textarea"
            placeholder="请输入内容"
          />
        </el-form-item>
        <el-form-item label="不良记录处理依据及决定" prop="BljlClyj">
          <el-input
            v-model="form.BljlClyj"
            type="textarea"
            placeholder="请输入内容"
          />
        </el-form-item>
        <el-form-item label="公布期限开始" prop="BljlGbStart">
          <el-date-picker
            clearable
            v-model="form.BljlGbStart"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="请选择公布期限开始"
          >
          </el-date-picker>
        </el-form-item>
        <el-form-item label="公布期限结束" prop="BljlGbEnd">
          <el-date-picker
            clearable
            v-model="form.BljlGbEnd"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="请选择公布期限结束"
          >
          </el-date-picker>
        </el-form-item>
        <el-form-item label="${comment}" prop="BeiZhu">
          <el-input
            v-model="form.BeiZhu"
            type="textarea"
            placeholder="请输入内容"
          />
        </el-form-item>
        <el-form-item label="监理工程师作废标志,0：作废" prop="ShenHe">
          <el-input
            v-model="form.ShenHe"
            placeholder="请输入监理工程师作废标志,0：作废"
          />
        </el-form-item>
        <el-form-item label="添加日期" prop="SendTime">
          <el-date-picker
            clearable
            v-model="form.SendTime"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="请选择添加日期"
          >
          </el-date-picker>
        </el-form-item>
        <el-form-item label="${comment}" prop="DisplayOrder">
          <el-input
            v-model="form.DisplayOrder"
            placeholder="请输入${comment}"
          />
        </el-form-item>
        <el-form-item label="是否删除" prop="DelFlg">
          <el-input v-model="form.DelFlg" placeholder="请输入是否删除" />
        </el-form-item>
        <el-form-item label="删除时间" prop="DelTime">
          <el-date-picker
            clearable
            v-model="form.DelTime"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="请选择删除时间"
          >
          </el-date-picker>
        </el-form-item>
        <el-form-item label="监理员作废标志,1：作废" prop="JLYzfFlg">
          <el-select
            v-model="form.JLYzfFlg"
            placeholder="请选择监理员作废标志,1：作废"
          >
            <el-option
              v-for="dict in dict.type.jxjy_jlyzfbz"
              :key="dict.value"
              :label="dict.label"
              :value="parseInt(dict.value)"
            ></el-option>
          </el-select>
        </el-form-item>
        <el-form-item
          label="是否可以继续教育审核 1可以报名 0不可报名"
          prop="isJxjyShenheFlg"
        >
          <el-select
            v-model="form.isJxjyShenheFlg"
            placeholder="请选择是否可以继续教育审核 1可以报名 0不可报名"
          >
            <el-option
              v-for="dict in dict.type.jxjy_sfkyjxjy"
              :key="dict.value"
              :label="dict.label"
              :value="parseInt(dict.value)"
            ></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="总监作废标志位：1为作废" prop="ZJzfFlg">
          <el-select
            v-model="form.ZJzfFlg"
            placeholder="请选择总监作废标志位：1为作废"
          >
            <el-option
              v-for="dict in dict.type.jxjy_jlgcszfbz"
              :key="dict.value"
              :label="dict.label"
              :value="parseInt(dict.value)"
            ></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="作废原因" prop="ZfResult">
          <el-input
            v-model="form.ZfResult"
            type="textarea"
            placeholder="请输入内容"
          />
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitForm">确 定</el-button>
        <el-button @click="cancel">取 消</el-button>
      </div>
    </el-dialog>

    <el-dialog
      title="审核设置"
      :visible.sync="auditDia"
      width="500px"
      :before-close="
        () => {
          auditDia = false;
        }
      "
    >
      <el-form
        ref="auditRef"
        :model="auditForm"
        :rules="auditRules"
        label-width="120px"
      >
        <el-form-item label="监理员：" prop="JLYzfFlg">
          <el-radio-group v-model="auditForm.JLYzfFlg">
            <el-radio :label="1">启用</el-radio>
            <el-radio :label="0">作废</el-radio>
          </el-radio-group>
        </el-form-item>
        <el-form-item label="监理工程师：" prop="ZJzfFlg">
          <el-radio-group v-model="auditForm.ZJzfFlg">
            <el-radio :label="1">启用</el-radio>
            <el-radio :label="0">禁用</el-radio>
          </el-radio-group>
        </el-form-item>
        <el-form-item label="总监：" prop="ShenHe">
          <el-radio-group v-model="auditForm.ShenHe">
            <el-radio :label="1">启用</el-radio>
            <el-radio :label="0">禁用</el-radio>
          </el-radio-group>
        </el-form-item>
        <el-form-item label="作废/禁用原因：">
          <el-input
            v-model="auditForm.ZfResult"
            type="textarea"
            :rows="4"
            placeholder="请输入原因"
          >
          </el-input>
        </el-form-item>
      </el-form>
      <span slot="footer" class="dialog-footer">
        <el-button @click="auditDia = false">取 消</el-button>
        <el-button type="primary" @click="onAuditSubmit">确 定</el-button>
      </span>
    </el-dialog>
  </div>
</template>

<script>
import {
  listRenCai,
  getRenCai,
  delRenCai,
  updateRenCai,
  getYeJi,
  saveAuditState,
} from "@/api/xiehui/tjgl/supervisor";

import { handleTableIndex } from "@/utils/index";

export default {
  name: "RenCai",
  dicts: ["jxjy_sfkyjxjy", "jxjy_jlgcszfbz", "jxjy_bljl", "jxjy_jlyzfbz"],
  data() {
    return {
      auditRules: {
        JLYzfFlg: [
          {
            required: true,
            message: "状态不能为空",
            trigger: "blur",
          },
        ],
        ZJzfFlg: [
          {
            required: true,
            message: "状态不能为空",
            trigger: "blur",
          },
        ],
        ShenHe: [
          {
            required: true,
            message: "状态不能为空",
            trigger: "blur",
          },
        ],
        ZfResult: [
          {
            required: true,
            message: "原因不能为空",
            trigger: "blur",
          },
        ],
      },
      activeSetting: {},
      auditDia: false,
      auditForm: {
        JLYzfFlg: null,
        ZJzfFlg: null,
        ShenHe: null,
        ZfResult: null,
        ID: null,
      },
      achievementTableData: [],
      viewDia: false,
      // 遮罩层
      loading: true,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      activeView: {},
      // 监理人才管理表格数据
      RenCaiList: [],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
      },
      // 表单参数
      form: {},
      // 表单校验
      rules: {},
    };
  },
  created() {
    this.getList();
  },
  computed: {
    content() {
      return (row) => {
        return row.zyJianSheYeJi
          .replaceAll("&lt;/p&gt;", "</p>")
          .replaceAll("&lt;p&gt;", "<p>");
      };
    },
  },
  methods: {
    handleSettingAuditState(row) {
      console.log(row);
      this.auditDia = true;
      this.activeSetting = row;

      this.auditForm.JLYzfFlg = row.JLYzfFlg;
      this.auditForm.ZJzfFlg = row.ZJzfFlg;
      this.auditForm.ShenHe = row.ShenHe;
      this.auditForm.ZfResult = row.ZfResult;
      this.auditForm.ID = row.ID;
    },
    //审核提交
    onAuditSubmit() {
      this.$refs["auditRef"].validate((valid) => {
        if (valid) {
          saveAuditState(this.auditForm)
            .then((res) => {
              this.$message({
                type: "success",
                message: "设置成功",
              });
              this.getList();
            })
            .finally(() => {
              this.auditDia = false;
            });
        }
      });
    },
    // 表单重置
    reset() {
      this.form = {
        ID: null,
        DeptID: null,
        Dept: null,
        Name: null,
        ShenFenZheng: null,
        JLYZhengHao: null,
        JLYZhengHaoNum: null,
        JLYfzrq: null,
        JLZhengHao: null,
        JLZhengHaoNum: null,
        JLfzrq: null,
        JLYxqz: null,
        ZJZhengHao: null,
        ZJfzrq: null,
        JSBZhengHao: null,
        JSBfzrq: null,
        Sex: null,
        Birthday: null,
        XueLi: null,
        ZhuanYe: null,
        ZhiCheng: null,
        NianXian: null,
        LianXiRen: null,
        Tel: null,
        Phone: null,
        Fax: null,
        PostCode: null,
        Address: null,
        Email: null,
        wangzhi: null,
        ChuFa: null,
        ChuFaTime: null,
        BljlFlg: null,
        BljlBianhao: null,
        BljlContent: null,
        BljlDingxing: null,
        BljlClyj: null,
        BljlGbStart: null,
        BljlGbEnd: null,
        BeiZhu: null,
        ShenHe: null,
        SendTime: null,
        DisplayOrder: null,
        DelFlg: null,
        DelTime: null,
        JLYzfFlg: null,
        UpdateTime: null,
        isJxjyShenheFlg: null,
        ZJzfFlg: null,
        ZfResult: null,
        createBy: null,
        createTime: null,
        updateBy: null,
        updateTime: null,
      };
      this.resetForm("form");
    },
    /** 提交按钮 */
    submitForm() {
      this.$refs["form"].validate((valid) => {
        if (valid) {
          updateRenCai(this.form).then((response) => {
            this.$modal.msgSuccess("修改成功");
            this.open = false;
            this.getList();
          });
        }
      });
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
      this.reset();
      const ID = row.ID || this.ids;
      getRenCai(ID).then((response) => {
        this.form = response.data;
        this.open = true;
        this.title = "修改监理人才管理";
      });
    },
    /** 删除按钮操作 */
    handleDelete(row) {
      const IDs = row.ID || this.ids;
      this.$modal
        .confirm("是否确认删除选中的数据项？")
        .then(function () {
          return delRenCai(IDs);
        })
        .then(() => {
          this.getList();
          this.$modal.msgSuccess("删除成功");
        })
        .catch(() => {});
    },
    handleTableIndex,
    handleView(row) {
      getYeJi({
        XYusercord: row.ShenFenZheng,
      }).then((res) => {
        this.achievementTableData = res.rows;
      });
      this.viewDia = true;
    },
    /** 查询监理人才管理列表 */
    getList() {
      this.loading = true;
      listRenCai(this.queryParams).then((response) => {
        this.RenCaiList = response.rows;
        this.total = response.total;
        this.loading = false;
      });
    },
    // 取消按钮
    cancel() {
      this.open = false;
      this.reset();
    },

    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm");
      this.handleQuery();
    },
  },
};
</script>
<style scoped lang="scss">
.supervision {
  color: red;
}
</style>
