Administrator
2022-04-11 79d9fc857559982b00b68b2d709807bdc4cd286f
src/views/trainExam/index.vue
@@ -1,288 +1,913 @@
/* * @Author: Morpheus * @Date: 2021-07-05 16:31:54 * @Last Modified by: liu *
@Last Modified time: 2021-11-23 14:12:55 * menu-name 考试管理 */
<template>
  <basic-container class="hasButOne">
  <basic-container
    :class="[
      'exam-card-body',
      $store.state.control.screenSize == 1366 ? 'smallSize' : 'normalSize',
      $store.state.control.windowWidth >= 1024 ? 'tooRowSearch1' : ''
    ]"
  >
    <avue-crud
      :option="option"
      :table-loading="loading"
      :data="data"
      :page.sync="page"
      ref="crud"
      @row-del="rowDel"
      v-model="form"
      :permission="permissionList"
      @row-update="rowUpdate"
      @row-save="rowSave"
      class="company-box tablesss"
      :option="questionBankOption"
      :search.sync="questionBankSearch"
      :table-loading="questionBankLoading"
      :data="questionBankData"
      ref="questionBankCrud"
      :page.sync="questionBankPage"
      @on-load="questionBankOnLoad"
      :before-open="beforeOpen"
      @filter="filterChange"
      @search-change="searchChange"
      @search-reset="searchReset"
      @selection-change="selectionChange"
      @current-change="currentChange"
      @size-change="sizeChange"
      @refresh-change="refreshChange"
      @on-load="onLoad"
      @selection-change="questionBankSelectionChange"
      @search-change="questionBankSearchChange"
      @search-reset="questionBankSearchReset"
      @current-change="questionBankCurrentChange"
      @size-change="questionBankSizeChange"
      @row-save="questionBankRowSave"
      @row-update="questionBankRowUpdate"
      @row-del="questionBankRowDel"
    >
      <template slot-scope="{ type,row }" slot="menu">
      <template slot-scope="{ row }" slot="auditStatus">
        <el-tag class="dtype">
          {{
            row.auditStatus == 1
              ? "审核通过"
              : row.auditStatus == 2
              ? "审核不通过"
              : "待审核"
          }}
          <i class="zc" v-if="row.auditStatus == 1"></i>
          <i class="yj" v-if="row.auditStatus == 2"></i>
          <i class="gz" v-if="row.auditStatus == 3"></i>
        </el-tag>
      </template>
      <template slot="menuLeft">
        <el-button
          :type="type"
          style="display: none"
          type="danger"
          size="small"
          icon="el-icon-delete"
          @click="questionBankHandleDelete"
          >删 除
        </el-button>
        <!--图例 components-->
        <span>
          <Legend :datas="datalistLIU"></Legend>
        </span>
      </template>
      <template slot-scope="{ row }" slot="examStatus">
        <el-tag>{{ row.examStatus == 0 ? "已发布" : "草稿" }}</el-tag>
      </template>
      <template slot-scope="{ row }" slot="menu">
        <el-button
          type="text"
          size="mini"
          icon="el-icon-collection"
          class="start-kaoshi"
          v-if="permission.trainExam_trainPapers"
          @click="startExam(row)"
          >报名清册
        </el-button>
        <el-button
          type="text"
          size="mini"
          icon="el-icon-folder-checked"
          v-if="permission.trainExam_check"
          @click="handleAudit(row)"
          >审核
        </el-button>
        <el-button
          type="text"
          size="mini"
          icon="el-icon-circle-check"
          v-if="permission.trainExam_confirm"
          @click="handleConfirm(row)"
          >考试名单确认
        </el-button>
        <el-button
          type="text"
          size="mini"
          icon="el-icon-search"
          v-if="permission.trainExam_index_examScoreViews"
          @click="examScoreViews(row)"
          >成绩查看
        </el-button>
      </template>
    </avue-crud>
    <el-dialog title="考试申请审核"
      :visible.sync="dialogFormVisible"
      modal-append-to-body='false'
      append-to-body='true'
      :close-on-click-model="true">
      <avue-form ref="formAudit" v-model="Audit" :option="optionAudit" @reset-change="emptytChange" @submit="submit"></avue-form>
    <el-dialog
      title="考试申请审核"
      :visible.sync="dialogFormVisible"
      modal-append-to-body="false"
      append-to-body="true"
      :close-on-click-model="true"
    >
      <avue-form
        ref="formAudit"
        v-model="Audit"
        :option="optionAudit"
        @reset-change="emptytChange"
        @submit="submit"
      ></avue-form>
    </el-dialog>
  </basic-container>
</template>
<script>
import { infoColumn,auditColumn } from "./data";
import {
  getList,
  add,
  remove,
  update,
  updateAudit,
  add,
  getDetail,
} from "@/api/trainExam/trainExam";
  applyConfirm
} from "@/api/examapi/examination";
import { auditColumn } from "./data";
import { mapGetters } from "vuex";
import Legend from "@/components/liu-legend/Legend";
export default {
  components: {
    Legend
  },
  data() {
    var validatePass = (rule, value, callback) => {
      console.log(value);
      if (value == undefined || value == "") {
        callback(new Error("请输入分数"));
        return;
      } else if (value !== "" && isNaN(value) == true) {
        callback(new Error("请输入数字"));
      } else if (value <= 0) {
        callback(new Error("分数设置请大于0"));
      } else {
        callback();
      }
    };
    return {
      form: {},
      Audit:{},
      query: {},
      loading: true,
      deptCategory: "",
      deptId: "",
      userId: "",
      //legend-liu数据
      datalistLIU: [
        {
          color: "#29C093",
          text: "审核通过"
        },
        {
          color: "#F34A4A",
          text: "审核不通过"
        },
        {
          color: "#F48F57",
          text: "待审核"
        }
      ],
      Audit: {},
      dialogFormVisible: false,
      page: {
        pageSize: 10,
        currentPage: 1,
        total: 0,
      },
      selectionList: [],
      optionAudit:{
      optionAudit: {
        height: "auto",
        calcHeight: 30,
        dialogWidth: 1000,
        tip: false,
        searchShow: true,
        searchMenuSpan: 6,
        border: false,
        border: true, //liu
        index: true,
        stripe: true,
        viewBtn: true,
        addBtn: true,
        viewBtn: false,
        addBtn: false,
        editBtn: false,
        selection: true,
        excelBtn: false,
        menuWidth: 230,
        dialogClickModal: false,
        column: auditColumn,
        ...this.$store.state.control.clearOtherBut
      },
      option: {
      questionBankOption: {
        // 操作栏多余按钮去除
        delBtn: false,
        editBtn: true,
        addBtn: false,
        // selection: true,
        menu: true,
        // 导出按钮
        excelBtn: false,
        viewBtn: false,
        // title: '题库',
        align: "center",
        height: "auto",
        calcHeight: 30,
        dialogWidth: 1000,
        calcHeight: 80,
        tip: false,
        searchShow: true,
        searchMenuSpan: 6,
        border: false,
        searchMenuSpan: 4,
        index: true,
        stripe: true,
        viewBtn: true,
        addBtn: true,
        selection: true,
        excelBtn: false,
        menuWidth: 230,
        labelWidth: "120",
        indexLabel: "序号",
        //dialogType: 'drawer',
        dialogClickModal: false,
        column: infoColumn,
        // 操作栏宽度
        menuWidth: 320,
        labelWidth: 140,
        ...this.$store.state.control.clearOtherBut,
        column: [
          {
            label: "培训学校名称",
            prop: "deptName",
            slot: true,
            search: true,
            searchSpan: 5,
            searchLabelWidth: 110,
            // 表单新增时是否禁止
            addDisabled: true,
            // 表单新增时是否可见
            addDisplay: false,
            // 表单新增时是否为查看模式
            addDetail: false,
            // 表单编辑时是否禁止
            editDisabled: true,
            // 表单编辑时是否可见
            editDisplay: false,
            // 表单编辑时是否为查看模式
            editDetail: false,
            // hide: true,
            display: false,
            overHidden: true
          },
          // {
          //   label: "考试名称",
          //   prop: "examName",
          //   search: true,
          //   slot: true,
          //   // 表单新增时是否禁止
          //   addDisabled: false,
          //   // 表单新增时是否可见
          //   addDisplay: true,
          //   // 表单新增时是否为查看模式
          //   addDetail: false,
          //   // 表单编辑时是否禁止
          //   editDisabled: true,
          //   // 表单编辑时是否可见
          //   editDisplay: true,
          //   // 表单编辑时是否为查看模式
          //   editDetail: false,
          //   rules: [
          //     {
          //       required: true,
          //       message: "请输入试卷名称",
          //       trigger: "blur",
          //     },
          //   ],
          //   span: 24,
          //   width: 200,
          //   overHidden: true,
          // },
          {
            label: "考试时间",
            prop: "examTime",
            type: "date",
            format: "yyyy-MM-dd",
            valueFormat: "yyyy-MM-dd",
            search: true,
            searchSpan: 4,
            hide: true,
            // 表单新增时是否禁止
            addDisabled: false,
            // 表单新增时是否可见
            addDisplay: true,
            // 表单新增时是否为查看模式
            addDetail: false,
            // 表单编辑时是否禁止
            editDisabled: false,
            // 表单编辑时是否可见
            editDisplay: false,
            // 表单编辑时是否为查看模式
            editDetail: false,
            rules: [
              {
                required: true,
                message: "请选择考试时间",
                trigger: "blur"
              }
            ]
          },
          {
            label: "考试时间",
            prop: "startTime",
            type: "datetime",
            format: "yyyy-MM-dd HH:mm",
            valueFormat: "yyyy-MM-dd HH:mm",
            hide: true,
            // 表单新增时是否禁止
            addDisabled: false,
            // 表单新增时是否可见
            addDisplay: true,
            // 表单新增时是否为查看模式
            addDetail: false,
            // 表单编辑时是否禁止
            editDisabled: false,
            // 表单编辑时是否可见
            editDisplay: true,
            // 表单编辑时是否为查看模式
            editDetail: false,
            rules: [
              {
                required: true,
                message: "请选择考试时间",
                trigger: "blur"
              }
            ]
          },
          {
            label: "考试开始时间",
            prop: "startTime",
            type: "datetime",
            format: "yyyy-MM-dd HH:mm",
            valueFormat: "yyyy-MM-dd HH:mm",
            // 表单新增时是否禁止
            addDisabled: false,
            // 表单新增时是否可见
            addDisplay: false,
            // 表单新增时是否为查看模式
            addDetail: false,
            // 表单编辑时是否禁止
            editDisabled: false,
            // 表单编辑时是否可见
            editDisplay: false,
            // 表单编辑时是否为查看模式
            editDetail: false,
            width: 120
          },
          {
            label: "考试开始截止时间",
            prop: "endTime",
            type: "datetime",
            // span: 24,
            format: "yyyy-MM-dd HH:mm",
            valueFormat: "yyyy-MM-dd HH:mm",
            // 表单新增时是否禁止
            addDisabled: false,
            // 表单新增时是否可见
            addDisplay: false,
            // 表单新增时是否为查看模式
            addDetail: false,
            // 表单编辑时是否禁止
            editDisabled: false,
            // 表单编辑时是否可见
            editDisplay: true,
            // 表单编辑时是否为查看模式
            editDetail: false,
            width: 120
          },
          // {
          //   label: "申请人",
          //   prop: "realName",
          //   slot: true,
          //   // 表单新增时是否禁止
          //   addDisabled: true,
          //   // 表单新增时是否可见
          //   addDisplay: false,
          //   // 表单新增时是否为查看模式
          //   addDetail: false,
          //   // 表单编辑时是否禁止
          //   editDisabled: true,
          //   // 表单编辑时是否可见
          //   editDisplay: false,
          //   // 表单编辑时是否为查看模式
          //   editDetail: false,
          //   // hide: true,
          //   display: false,
          //   width: 70,
          // },
          // {
          //   label: "申请人所属学校",
          //   prop: "deptName",
          //   slot: true,
          //   // 表单新增时是否禁止
          //   addDisabled: true,
          //   // 表单新增时是否可见
          //   addDisplay: false,
          //   // 表单新增时是否为查看模式
          //   addDetail: false,
          //   // 表单编辑时是否禁止
          //   editDisabled: true,
          //   // 表单编辑时是否可见
          //   editDisplay: false,
          //   // 表单编辑时是否为查看模式
          //   editDetail: false,
          //   // hide: true,
          //   display: false,
          //   overHidden: true,
          // },
          {
            label: "备注",
            prop: "remark",
            span: 24,
            hide: true,
            slot: true,
            // 表单新增时是否禁止
            addDisabled: false,
            // 表单新增时是否可见
            addDisplay: true,
            // 表单新增时是否为查看模式
            addDetail: false,
            // 表单编辑时是否禁止
            editDisabled: false,
            // 表单编辑时是否可见
            editDisplay: false,
            // 表单编辑时是否为查看模式
            editDetail: false
          },
          {
            label: "注意事项",
            prop: "examAttention",
            type: "textarea",
            span: 24,
            slot: true,
            hide: true,
            // 表单新增时是否禁止
            addDisabled: false,
            // 表单新增时是否可见
            addDisplay: true,
            // 表单新增时是否为查看模式
            addDetail: false,
            // 表单编辑时是否禁止
            editDisabled: false,
            // 表单编辑时是否可见
            editDisplay: false,
            // 表单编辑时是否为查看模式
            editDetail: false,
            width: 150
          },
          {
            label: "报名人数",
            prop: "num",
            type: "textarea",
            span: 24,
            slot: true,
            // 表单新增时是否禁止
            addDisabled: false,
            // 表单新增时是否可见
            addDisplay: true,
            // 表单新增时是否为查看模式
            addDetail: false,
            // 表单编辑时是否禁止
            editDisabled: false,
            // 表单编辑时是否可见
            editDisplay: false,
            // 表单编辑时是否为查看模式
            editDetail: false,
            width: 70
          },
          {
            label: "考试人数",
            prop: "examNum",
            type: "textarea",
            span: 24,
            slot: true,
            // 表单新增时是否禁止
            addDisabled: false,
            // 表单新增时是否可见
            addDisplay: true,
            // 表单新增时是否为查看模式
            addDetail: false,
            // 表单编辑时是否禁止
            editDisabled: false,
            // 表单编辑时是否可见
            editDisplay: false,
            // 表单编辑时是否为查看模式
            editDetail: false,
            width: 70
          },
          {
            label: "申请时间",
            prop: "creatorDate",
            type: "datetime",
            width: 130,
            editDisplay: false,
            addDisplay: false,
            format: "yyyy-MM-dd HH:mm:ss",
            valueFormat: "yyyy-MM-dd HH:mm:ss",
            rules: [
              {
                required: true,
                message: "请选择结束时间",
                trigger: "click"
              }
            ]
          },
          {
            label: "审核时间",
            prop: "auditTime",
            type: "datetime",
            width: 130,
            editDisplay: false,
            addDisplay: false,
            format: "yyyy-MM-dd HH:mm:ss",
            valueFormat: "yyyy-MM-dd HH:mm:ss",
            rules: [
              {
                required: true,
                message: "请选择结束时间",
                trigger: "click"
              }
            ]
          },
          {
            label: "审核状态",
            search: true,
            searchSpan: 4,
            prop: "auditStatus",
            slot: true,
            editDisplay: false,
            addDisplay: false,
            type: "select",
            rules: [
              {
                required: true,
                message: "请选择审核类型",
                trigger: "blur"
              }
            ],
            dicData: [
              {
                label: "审核通过",
                value: 1
              },
              {
                label: "不通过",
                value: 2
              },
              {
                label: "待审核",
                value: 3
              }
            ],
            width: 110
          },
          {
            label: "审核明细",
            editDisplay: false,
            addDisplay: false,
            prop: "auditDetail",
            width: 90,
            overHidden: true
          },
          {
            label: "距考试开始时间",
            editDisplay: false,
            addDisplay: false,
            prop: "deadline",
            width: 110,
            overHidden: true
          },
          {
            label: "考试名单确认人",
            prop: "confirmUserName",
            slot: true,
            // 表单新增时是否禁止
            addDisabled: true,
            // 表单新增时是否可见
            addDisplay: false,
            // 表单新增时是否为查看模式
            addDetail: false,
            // 表单编辑时是否禁止
            editDisabled: true,
            // 表单编辑时是否可见
            editDisplay: false,
            // 表单编辑时是否为查看模式
            editDetail: false,
            // hide: true,
            display: false,
            width: 110
          },
          {
            label: "确认时间",
            prop: "confirmTime",
            type: "datetime",
            // span: 24,
            format: "yyyy-MM-dd HH:mm:ss",
            valueFormat: "yyyy-MM-dd HH:mm:ss",
            // 表单新增时是否禁止
            addDisabled: false,
            // 表单新增时是否可见
            addDisplay: false,
            // 表单新增时是否为查看模式
            addDetail: false,
            // 表单编辑时是否禁止
            editDisabled: false,
            // 表单编辑时是否可见
            editDisplay: false,
            // 表单编辑时是否为查看模式
            editDetail: false,
            width: 130
          }
        ]
      },
      data: [],
      questionBankSearch: {},
      questionBankLoading: true,
      questionBankData: [],
      questionBankPage: {
        pageSize: 10,
        currentPage: 1,
        total: 16,
        ...this.$store.state.control.changePageSize
      },
      questionBankQuery: {},
      questionBankSelectionList: []
    };
  },
  mounted() {
    this.$store.commit("setWindowSizeHeightAdd");
  },
  computed: {
    ...mapGetters(["permission"]),
    permissionList() {
      return {
        addBtn: this.vaildData(this.permission.notice_add, false),
        viewBtn: this.vaildData(this.permission.notice_view, false),
        delBtn: this.vaildData(null, false),
        editBtn: this.vaildData(this.permission.notice_edit, false),
      };
    },
    ids() {
      let ids = [];
      this.selectionList.forEach((ele) => {
      this.questionBankSelectionList.forEach(ele => {
        ids.push(ele.id);
      });
      return ids.join(",");
    },
    ...mapGetters(["userInfo", "permission"]),
    permissionList() {
      return {
        addBtn: this.vaildData(null, false),
        viewBtn: this.vaildData(this.permission.trainExam_edit, false),
        delBtn: this.vaildData(null, false),
        editBtn: this.vaildData(null, false)
      };
    }
  },
  mounted() {},
  watch: {},
  methods: {
    rowSave(row, done, loading) {
      row.category = 1;
      row.deptId = this.deptId;
    questionBankOnLoad(page, params = {}) {
      this.questionBankLoading = false;
      params["examType"] = 2;
      //如果是培训公司管理员,则只能看到当前培训公司申请的考试
      if (this.userInfo.role_name == "培训公司管理员") {
        params["deptId"] = this.userInfo.dept_id;
      }
      getList(
        page.currentPage,
        page.pageSize,
        Object.assign(params, this.questionBankQuery)
      ).then(res => {
        const data = res.data.data;
        this.questionBankPage.total = data.total;
        this.questionBankData = data.records;
        this.questionBankLoading = false;
        this.$store.commit("setWindowSizeHeightAdd");
        this.questionBankSelectionClear();
      });
    },
    questionBankSelectionClear() {
      this.questionBankSelectionList = [];
      this.$refs.questionBankCrud.toggleSelection();
    },
    questionBankSelectionChange(list) {
      this.questionBankSelectionList = list;
    },
    questionBankSearchChange(params, done) {
      this.questionBankQuery = params;
      this.questionBankPage.currentPage = 1;
      this.questionBankOnLoad(this.questionBankPage, params);
      done();
    },
    questionBankSearchReset() {
      this.questionBankQuery = {};
      this.questionBankOnLoad(this.questionBankPage);
    },
    questionBankCurrentChange(currentPage) {
      this.questionBankPage.currentPage = currentPage;
    },
    questionBankSizeChange(pageSize) {
      this.questionBankPage.pageSize = pageSize;
    },
    //审核
    submit(row, done, loading) {
      // console.log(row,123456);
      // var data = {
      //   id:row.id,
      //   auditStatus:this.Audit.auditStatus,
      //   auditDetail:this.Audit.auditDetail,
      // }
      // console.log(data,654321);
      updateAudit(row).then(
        () => {
          this.dialogFormVisible = false;
          this.questionBankOnLoad(this.questionBankPage);
          this.$message({
            type: "success",
            message: "操作成功!"
          });
          done();
        },
        error => {
          window.console.log(error);
          done();
        }
      );
    },
    beforeOpen(done, type) {
      if (this.userInfo.role_name == "培训公司管理员") {
        if (["edit"].includes(type)) {
          if (this.form.auditStatus == 1) {
            this.$message({
              type: "warning",
              message: "当前考试申请已审核通过,无法再修改考试申请信息!"
            });
            return;
          }
        }
      }
      done();
    },
    startExam(row) {
      //正式考试
      if (row.examType == 1) {
        this.$router.push({
          path: `/applydetailed`,
          query: row
        });
      }
      //模拟考试
      if (row.examType == 2) {
        this.$router.push({
          path: `/trainApply`,
          query: row
        });
      }
    },
    examScoreViews(row) {
      //模拟考试
      if (row.examType == 2) {
        this.$router.push({
          path: `/trainExam/singleperformance`,
          query: row
        });
      }
    },
    // 新增
    questionBankRowSave(row, done, loading) {
      row.startTime = row.startTime + ":00";
      row["examType"] = 2;
      // row.endTime = row.examTime[1];
      // row.examTime = JSON.stringify(row.examTime);
      add(row).then(
        () => {
          this.onLoad(this.page);
          this.questionBankOnLoad(this.questionBankPage);
          this.$message({
            type: "success",
            message: "操作成功!",
            message: "操作成功!"
          });
          done();
        },
        (error) => {
        error => {
          window.console.log(error);
          loading();
        }
      );
    },
    rowUpdate(row, index, done, loading) {
      update(row).then(
    questionBankRowUpdate(row, index, done, loading) {
      // if (Array.isArray(row.examTime) != true) {
      //   row.examTime = row.examTime.split(",");
      // }
      const data = {
        id: row.id,
        startTime: row.startTime + ":00",
        endTime: row.endTime + ":00"
      };
      // row.startTime = row.startTime + ":00";
      // row.endTime = row.endTime + ":00";
      // row.endTime = row.examTime[1];
      // row.examTime = JSON.stringify(row.examTime);
      update(data).then(
        () => {
          this.onLoad(this.page);
          this.questionBankOnLoad(this.questionBankPage);
          this.$message({
            type: "success",
            message: "操作成功!",
            message: "操作成功!"
          });
          done();
        },
        (error) => {
        error => {
          window.console.log(error);
          loading();
        }
      );
    },
    rowDel(row) {
    questionBankRowDel(row) {
      this.$confirm("确定将选择数据删除?", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
        type: "warning"
      })
        .then(() => {
          return remove(row.id);
        })
        .then(() => {
          this.onLoad(this.page);
          this.questionBankOnLoad(this.questionBankPage);
          this.$message({
            type: "success",
            message: "操作成功!",
            message: "操作成功!"
          });
        });
    },
    searchReset() {
      this.query = {};
      this.onLoad(this.page);
    handleConfirm(row) {
      this.$confirm("已确认当前考试申请人员名单无误?", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning"
      })
        .then(() => {
          row["confirmUser"] = this.userInfo.Id;
          return applyConfirm(row);
        })
        .then(() => {
          this.questionBankOnLoad(this.questionBankPage);
          this.$message({
            type: "success",
            message: "操作成功!"
          });
        });
    },
    searchChange(params, done) {
      this.query = params;
      this.page.currentPage = 1;
      this.onLoad(this.page, params);
      done();
    },
    selectionChange(list) {
      this.selectionList = list;
    },
    selectionClear() {
      this.selectionList = [];
      this.$refs.crud.toggleSelection();
    },
    handleDelete() {
      if (this.selectionList.length === 0) {
    questionBankHandleDelete() {
      if (this.questionBankSelectionList.length === 0) {
        this.$message.warning("请选择至少一条数据");
        return;
      }
      this.$confirm("确定将选择数据删除?", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
        type: "warning"
      })
        .then(() => {
          return remove(this.ids);
        })
        .then(() => {
          this.onLoad(this.page);
          this.questionBankOnLoad(this.questionBankPage);
          this.$message({
            type: "success",
            message: "操作成功!",
            message: "操作成功!"
          });
          this.$refs.crud.toggleSelection();
          this.$refs.questionBankCrud.toggleSelection();
        });
    },
    //审核
    submit(row,done,loading){
      updateAudit(row).then(
        () => {
          this.dialogFormVisible = false;
          this.onLoad(this.page);
          this.$message({
            type: "success",
            message: "操作成功!",
          });
          done();
        },
        (error) => {
          window.console.log(error);
          loading();
        }
      );
    },
    handleAudit(row){
        this.dialogFormVisible = true;
        this.Audit = row;
    },
    beforeOpen(done, type) {
      if (["edit", "view"].includes(type)) {
        getDetail(this.form.id).then((res) => {
          this.form = res.data.data;
        });
      }
      done();
    },
    currentChange(currentPage) {
      this.page.currentPage = currentPage;
    },
    sizeChange(pageSize) {
      this.page.pageSize = pageSize;
    },
    refreshChange() {
      this.onLoad(this.page, this.query);
    },
    onLoad(page, params = {}) {
      this.deptId = JSON.parse(
        window.localStorage.getItem("saber-userInfo")
      ).content.dept_id;
      this.userId = JSON.parse(
        window.localStorage.getItem("saber-userInfo")
      ).content.user_id;
        this.loading = true;
        getList(page.currentPage, page.pageSize, params).then(
            (res) => {
            const data = res.data.data;
            this.page.total = data.total;
            this.data = data.records;
            this.loading = false;
            this.selectionClear();
            }
        );
    },
  },
    handleAudit(row) {
      this.dialogFormVisible = true;
      this.Audit = row;
    }
  }
};
</script>
<style>
<style lang="scss" scoped>
.dtype {
  width: 100%;
  padding-left: 0px;
}
.dx {
  position: absolute;
  top: 50%;
  margin-top: -5px;
  margin-left: 6px;
  width: 10px;
  height: 10px;
  border-radius: 30%;
  background: #dfdfdf;
}
.zc {
  position: absolute;
  top: 50%;
  margin-top: -5px;
  margin-left: 4px;
  width: 10px;
  height: 10px;
  border-radius: 30%;
  background: #29c093;
}
.yj {
  position: absolute;
  top: 50%;
  margin-top: -5px;
  margin-left: 4px;
  width: 10px;
  height: 10px;
  border-radius: 30%;
  background: #f34a4a;
}
.gz {
  position: absolute;
  top: 50%;
  margin-top: -5px;
  margin-left: 4px;
  width: 10px;
  height: 10px;
  border-radius: 30%;
  background: #f48f57;
}
</style>