liuyg
2021-11-05 d297132aba417a5cc5ea4330d9134341738184dc
冲突
28 files modified
4 files added
11424 ■■■■■ changed files
src/api/accreditationRecords/accreditationRecords.js 11 ●●●●● patch | view | raw | blame | history
src/api/examapi/modifiedGrades.js 29 ●●●●● patch | view | raw | blame | history
src/api/examapi/performance.js 49 ●●●●● patch | view | raw | blame | history
src/api/system/user.js 9 ●●●●● patch | view | raw | blame | history
src/assets/js/print.js 123 ●●●●● patch | view | raw | blame | history
src/components/Subjects/Choices/index.vue 5 ●●●●● patch | view | raw | blame | history
src/components/Subjects/PracticalOperation/index.vue 4 ●●●● patch | view | raw | blame | history
src/main.js 5 ●●●●● patch | view | raw | blame | history
src/page/index/tags.vue 1 ●●●● patch | view | raw | blame | history
src/page/login/codelogin.vue 2 ●●●●● patch | view | raw | blame | history
src/router/views/index.js 25 ●●●●● patch | view | raw | blame | history
src/views/accreditationRecords/accreditationRecords.vue 140 ●●●● patch | view | raw | blame | history
src/views/applydetailed/index.vue 3 ●●●● patch | view | raw | blame | history
src/views/applydetailed/papers.vue 3 ●●●● patch | view | raw | blame | history
src/views/applyexam/index.vue 2111 ●●●● patch | view | raw | blame | history
src/views/dispatch/dispatch.vue 8 ●●●● patch | view | raw | blame | history
src/views/dispatch/dispatchChildoperable.vue 12 ●●●● patch | view | raw | blame | history
src/views/dispatch/dispatchChildoperableSee.vue 11 ●●●● patch | view | raw | blame | history
src/views/dispatchChild/index.vue 11 ●●●● patch | view | raw | blame | history
src/views/exam/addsubject.vue 4 ●●● patch | view | raw | blame | history
src/views/exam/examSubjects.vue 4 ●●● patch | view | raw | blame | history
src/views/exam/examination.vue 3 ●●●● patch | view | raw | blame | history
src/views/exam/papers.vue 3 ●●●● patch | view | raw | blame | history
src/views/exam/performance.vue 1 ●●●● patch | view | raw | blame | history
src/views/securityGuard/baoanz.vue 238 ●●●● patch | view | raw | blame | history
src/views/securityGuard/certificateOfPrint.vue 65 ●●●●● patch | view | raw | blame | history
src/views/securityGuard/data.js 1245 ●●●● patch | view | raw | blame | history
src/views/securityGuard/securityCertificate.vue 439 ●●●● patch | view | raw | blame | history
src/views/securityGuard/securityGuard.vue 3492 ●●●● patch | view | raw | blame | history
src/views/securityGuard/securityGuardDetail.vue 985 ●●●● patch | view | raw | blame | history
src/views/trainExam/modifiedGrades.vue 629 ●●●●● patch | view | raw | blame | history
src/views/trainExam/performance.vue 1754 ●●●● patch | view | raw | blame | history
src/api/accreditationRecords/accreditationRecords.js
@@ -13,6 +13,17 @@
    })
}
export const getAccreditationRecords = (id) => {
    return request({
        url: '/api/accreditationRecords/details',
        method: 'get',
        params: {
            id,
        }
    })
}
export const remove = (ids) => {
    return request({
        url: '/api/accreditationRecords/remove',
src/api/examapi/modifiedGrades.js
New file
@@ -0,0 +1,29 @@
import request from '@/router/axios';
export const getList = (current, size, params) => {
    return request({
        url: '/api/scoreAuditRecords/page',
        method: 'get',
        params: {
            ...params,
            current,
            size
        }
    })
}
export const update = (row) => {
    return request({
        url: '/api/scoreAuditRecords/update',
        method: 'post',
        data: row
    })
}
export const applyAudit = (row) => {
    return request({
        url: '/api/scoreAuditRecords/applyAudit',
        method: 'post',
        data: row
    })
}
src/api/examapi/performance.js
@@ -1,30 +1,37 @@
import request from '@/router/axios';
export const getList = (current, size, params) => {
    return request({
        url: '/api/examScore/page',
        method: 'get',
        params: {
            ...params,
            current,
            size
        }
    })
  return request({
    url: '/api/examScore/page',
    method: 'get',
    params: {
      ...params,
      current,
      size
    }
  })
}
export const update = (row) => {
    return request({
        url: '/api/examScore/updateExamScore',
        method: 'post',
        data: row
    })
  return request({
    url: '/api/examScore/updateExamScore',
    method: 'post',
    data: row
  })
}
export const updateAbsent = (row) => {
    return request({
        url: '/api/examScore/updateAbsent',
        method: 'post',
        data: row
    })
}
  return request({
    url: '/api/examScore/updateAbsent',
    method: 'post',
    data: row
  })
}
export const updateGrade = (row) => {
  return request({
    url: '/api/scoreAuditRecords/scoreUpdateApply',
    method: 'post',
    data: row
  })
}
src/api/system/user.js
@@ -80,6 +80,15 @@
}
export const updatePaperTime = (row) => {
    return request({
        url: '/api/blade-user/updatePaperTime',
        method: 'post',
        data: row
    })
}
export const saveOrUpdateUserPractitionersInfo = (row) => {
    return request({
        url: '/api/experience/saveOrUpdate',
src/assets/js/print.js
New file
@@ -0,0 +1,123 @@
const Print = function (dom, options) {
    if (!(this instanceof Print)) return new Print(dom, options);
    this.options = this.extend({
        noPrint: '.no-print',
        onStart: function () {},
        onEnd: function () {}
    }, options);
    if ((typeof dom) === "string") {
        this.dom = document.querySelector(dom);
    } else {
        this.dom = dom;
    }
    this.init();
};
Print.prototype = {
    init: function () {
        let content = this.getStyle() + this.getHtml();
        this.writeIframe(content);
    },
    extend: function (obj, obj2) {
        for (let k in obj2) {
            obj[k] = obj2[k];
        }
        return obj;
    },
    getStyle: function () {
        let str = "";
        let styles = document.querySelectorAll('style,link');
        for (let i = 0; i < styles.length; i++) {
            str += styles[i].outerHTML;
        }
        str += "<style>" + (this.options.noPrint ? this.options.noPrint : '.no-print') + "{display:none;}</style>";
        return str;
    },
    getHtml: function () {
        let inputs = document.querySelectorAll('input');
        let textareas = document.querySelectorAll('textarea');
        let selects = document.querySelectorAll('select');
        for (let k in inputs) {
            if (inputs[k].type === "checkbox" || inputs[k].type === "radio") {
                if (inputs[k].checked === true) {
                    inputs[k].setAttribute('checked', "checked");
                } else {
                    inputs[k].removeAttribute('checked');
                }
            } else if (inputs[k].type === "text") {
                inputs[k].setAttribute('value', inputs[k].value);
            }
        }
        for (let k2 in textareas) {
            if (textareas[k2].type === 'textarea') {
                textareas[k2].innerHTML = textareas[k2].value;
            }
        }
        for (let k3 in selects) {
            if (selects[k3].type === 'select-one') {
                let child = selects[k3].children;
                for (let i in child) {
                    if (child[i].tagName === 'OPTION') {
                        if (child[i].selected === true) {
                            child[i].setAttribute('selected', "selected");
                        } else {
                            child[i].removeAttribute('selected');
                        }
                    }
                }
            }
        }
        return this.dom.outerHTML;
    },
    writeIframe: function (content) {
        let w;
        let doc;
        let iframe = document.createElement('iframe');
        let f = document.body.appendChild(iframe);
        iframe.id = "myIframe";
        iframe.style = "position:absolute;width:0;height:0;top:-10px;left:-10px;";
        w = f.contentWindow || f.contentDocument;
        doc = f.contentDocument || f.contentWindow.document;
        doc.open();
        doc.write(content);
        doc.close();
        this.toPrint(w, function () {
            document.body.removeChild(iframe);
        });
    },
    toPrint: function (w, cb) {
        let _this = this;
        w.onload = function () {
            try {
                setTimeout(function () {
                    w.focus();
                    typeof _this.options.onStart === 'function' && _this.options.onStart();
                    if (!w.document.execCommand('print', false, null)) {
                        w.print();
                    }
                    typeof _this.options.onEnd === 'function' && _this.options.onEnd();
                    w.close();
                    cb && cb();
                });
            } catch (err) {
                console.log('err', err);
            }
        };
    }
};
const MyPlugin = {};
MyPlugin.install = function (Vue, options) {
    // 4. 添加实例方法
    Vue.prototype.$print = Print;
};
export default MyPlugin;
src/components/Subjects/Choices/index.vue
@@ -57,16 +57,11 @@
            this.subjectInfo = subject
            if (subject.hasOwnProperty('examSubjectOptions')) {
                this.options = subject.examSubjectOptions
                console.log(this.options)
            }
            if (subject.hasOwnProperty('answer')) {
                console.log(subject.answer);
                this.setAnswer(subject.answer)
            }
            this.index = index + '.'
            console.log(subject, subjectCount, index, this.options, 5656565656)
        },
        getSubjectInfo () {
            this.subjectInfo.options = this.options
src/components/Subjects/PracticalOperation/index.vue
@@ -54,7 +54,6 @@
            return this.userAnswer
        },
        setAnswer (answer, option) {
            console.log(answer);
            if (answer != '') {
                this.userAnswer = answer
@@ -136,9 +135,6 @@
                    }
                })
            }
            console.log(this.userAnswer)
        },
src/main.js
@@ -23,6 +23,11 @@
import website from '@/config/website';
import crudCommon from '@/mixins/crud';
import Print from '@/assets/js/print';
Vue.use(Print);
import Map from './components/map/main';
Vue.component('Map', Map);
src/page/index/tags.vue
@@ -98,7 +98,6 @@
          path = "";
        for (var k in d) {
          if (d[k].peixun == true) {
            // console.log(d[k]);
            path = d[k].path;
          }
        }
src/page/login/codelogin.vue
@@ -166,7 +166,6 @@
  mounted() {
    var that = this;
    ss().then((res) => {
      console.log(that.ergodicData(res.data.data), 898989);
      that.dic = that.ergodicData(res.data.data);
    });
  },
@@ -236,7 +235,6 @@
    },
    async allmedia() {
      ss().then((res) => {
        console.log(res, 1323);
        res.data.data.forEach((element) => {
          this.options.push({
            deptname: element.dept_name,
src/router/views/index.js
@@ -970,6 +970,15 @@
    }]
},
{
    path: 'modifiedGrades',
    name: '修改成绩管理',
    meta: {
        i18n: 'modifiedGrades'
    },
    component: () =>
        import( /* webpackChunkName: "views" */ '@/views/trainExam/modifiedGrades')
},
{
    path: '/accreditationRecords',
    component: Layout,
    redirect: '/accreditationRecords/accreditationRecords',
@@ -982,5 +991,19 @@
        component: () =>
            import( /* webpackChunkName: "views" */ '@/views/accreditationRecords/accreditationRecords')
    }]
}
},
{
    path: '/certificateOfPrint',
    component: Layout,
    redirect: '/certificateOfPrint/index',
    children: [{
        path: 'index',
        name: '纸质证书制作',
        meta: {
            i18n: 'index'
        },
        component: () =>
            import( /* webpackChunkName: "views" */ '@/views/securityGuard/certificateOfPrint')
    }]
},
]
src/views/accreditationRecords/accreditationRecords.vue
@@ -9,6 +9,7 @@
      @row-del="rowDel"
      v-model="form"
      :permission="permissionList"
      :search.sync="questionBankSearch"
      @row-update="rowUpdate"
      @row-save="rowSave"
      :before-open="beforeOpen"
@@ -31,6 +32,15 @@
          plain
          @click="handleDelete"
          >删 除
        </el-button>
        <el-button
          type="warning"
          size="small"
          plain
          icon="el-icon-download"
          v-if="permission.accreditationRecords_export"
          @click="handleExport"
          >保安员证信息导出
        </el-button>
        <!-- v-if="permission.notice_delete" -->
      </template>
@@ -70,16 +80,18 @@
  remove,
  update,
  add,
  getAccreditationRecords
} from "@/api/accreditationRecords/accreditationRecords";
import { getDept } from "@/api/system/dept";
import { mapGetters } from "vuex";
import { mapState } from "vuex";
import Qs from "qs";
export default {
  data() {
    return {
      form: {},
      query: {},
      questionBankSearch: {},
      loading: true,
      deptCategory: "",
      deptId: "",
@@ -105,7 +117,7 @@
        index: true,
        stripe: true,
        viewBtn: true,
        selection: true,
        // selection: true,
        excelBtn: false,
        addBtnText: "发布",
        addTitle: "发布",
@@ -114,13 +126,34 @@
        dialogClickModal: false,
        column: [
          {
            label: "申请时间",
            prop: "releaseTimeRange",
            type: "datetime",
            format: "yyyy-MM-dd",
            valueFormat: "yyyy-MM-dd",
            searchRange: true,
            hide: true,
            addDisplay: false,
            editDisplay: false,
            viewDisplay: false,
            search: true,
            searchSpan:6,
            rules: [
              {
                required: true,
                message: "请输入申请时间",
                trigger: "blur",
              },
            ],
          },
          {
            label: "姓名",
            prop: "realName",
            search: true,
            searchSpan: 3,
            width:100,
            searchLabelWidth: 50,
            display: false,
            // display: false,
          },
          // {
          //   label: "所属保安公司",
@@ -153,8 +186,8 @@
              // },
              slot: true,
              searchSpan: 5,
              display: false,
              search: true,
              overHidden: true,
              minWidth: 200
          },
          {
@@ -170,12 +203,16 @@
            search: true,
            searchLabelWidth: 90,
            searchSpan: 5,
            display: false,
          },
          {
            label: "年龄",
            prop: "age",
            display: false,
          },
          {
            label: "照片",
            prop: "avatar",
            type: "upload",
            listType: "picture-img",
          },
          {
            label: "保安证编号",
@@ -188,6 +225,7 @@
            editDisplay: false,
            // hide: true,
          },
          // {
          //   label: "申请人",
          //   prop: "createUser",
@@ -210,6 +248,33 @@
            editDisplay: false,
            // hide: true,
          },
          {
            label: "有无照片",
            prop: "isAvatar",
            type: "select",
            search:true,
            searchLabelWidth: 90,
            minWidth: 105,
            searchSpan: 3,
            addDisplay: false,
            editDisplay: false,
            hide: true,
            display: false,
            dicData:[
              {
                label:"全部",
                value:3
              },
              {
                label:"有",
                value:1
              },
              {
                label:"无",
                value:2
              }
            ]
          },
        ],
      },
      data: [],
@@ -220,7 +285,7 @@
    permissionList() {
      return {
        addBtn: this.vaildData(null, false),
        viewBtn: this.vaildData(this.permission.notice_view, false),
        viewBtn: this.vaildData(this.permission.accreditationRecords_view, false),
        delBtn: this.vaildData(null, false),
        editBtn: this.vaildData(null, false),
      };
@@ -363,7 +428,7 @@
    },
    beforeOpen(done, type) {
      if (["edit", "view"].includes(type)) {
        getNotice(this.form.id).then((res) => {
        getAccreditationRecords(this.form.id).then((res) => {
          this.form = res.data.data;
        });
      }
@@ -391,21 +456,21 @@
          ? (that.deptCategory = true)
          : (that.deptCategory = false);
        // const { releaseTimeRange } = this.query;
        const { releaseTimeRange } = this.query;
        params["jurisdiction"] = this.jurisdiction;
        params["type"] = 1;
        let values = {
          ...params,
        };
        // if (releaseTimeRange) {
        //   values = {
        //     ...params,
        //     startTime: releaseTimeRange[0],
        //     endTime: releaseTimeRange[1],
        //     ...this.query,
        //   };
        //   values.releaseTimeRange = null;
        // }
        if (releaseTimeRange) {
          values = {
            ...params,
            startTime: releaseTimeRange[0],
            endTime: releaseTimeRange[1],
            ...this.query,
          };
          values.releaseTimeRange = null;
        }
        this.loading = true;
        getList(page.currentPage, page.pageSize, values).then((res) => {
          const data = res.data.data;
@@ -416,6 +481,45 @@
        });
      });
    },
    //保安员证信息导出
    handleExport() {
      this.$confirm("是否导出保安员证信息数据?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      }).then(() => {
        //获取查询条件
        const { releaseTimeRange } = this.questionBankSearch;
        if (releaseTimeRange) {
            this.questionBankSearch['startTime'] = releaseTimeRange[0];
            this.questionBankSearch['endTime'] = releaseTimeRange[1];
        }
        var data = {
          deptName: this.questionBankSearch.deptName,
          idCardNo: this.questionBankSearch.idCardNo,
          realName: this.questionBankSearch.realName,
          securityNumber: this.questionBankSearch.securityNumber,
          startTime: this.questionBankSearch.startTime,
          endTime: this.questionBankSearch.endTime,
        };
        //导出
        // if (
        //   this.userInfo.role_name == "保安公司管理员" ||
        //   this.userInfo.role_name == "保安"
        // ) {
        //   //如果是保安公司管理员
        //   data["deptId"] = this.userInfo.dept_id;
        // }
        if (this.userInfo.role_name == "培训公司管理员") {
          //如果是培训公司管理员
          data["trainUnitId"] = this.userInfo.dept_id;
        }
        // data["examType"] = 2;
        //序列号url形式,用&拼接
        data = Qs.stringify(data);
        window.open(`/api/accreditationRecords/export-security-paper?` + data);
      });
    },
  },
};
</script>
src/views/applydetailed/index.vue
@@ -2,7 +2,7 @@
 * @Author: Morpheus
 * @Date: 2021-07-05 16:31:54
 * @Last Modified by: Morpheus
 * @Last Modified time: 2021-07-19 19:39:45
 * @Last Modified time: 2021-11-05 12:02:28
 * menu-name 报名考试
 */
<template>
@@ -475,7 +475,6 @@
    };
  },
  created() {
    console.log(this.userInfo);
    // if (this.userInfo.role_name.indexOf("ksxtadmin") != -1) {
    //   this.questionBankOption.column[0].dicUrl =
src/views/applydetailed/papers.vue
@@ -14,7 +14,6 @@
  created(){
      var d = this.$route.query;
      this.url += "?data=" + JSON.stringify(d);
      console.log(d,11);
  },
  mounted() {
    var flag = false,
@@ -37,4 +36,4 @@
</script>
<style>
</style>
</style>
src/views/applyexam/index.vue
@@ -2,34 +2,33 @@
 * @Author: Morpheus
 * @Date: 2021-07-05 16:31:54
 * @Last Modified by: Morpheus
 * @Last Modified time: 2021-07-19 19:39:45
 * @Last Modified time: 2021-11-05 12:02:26
 * menu-name 报名考试
 */
<template>
  <el-row class="morpheus-box-apply-exam">
    <el-col :span="24" class="hasButOne">
      <el-card>
        <div class="exam-card-body">
          <avue-crud
            v-model="obj"
            class="company-box"
            :option="questionBankOption"
            :search.sync="questionBankSearch"
            :table-loading="questionBankLoading"
            :data="questionBankData"
            ref="questionBankCrud"
            :page.sync="questionBankPage"
            @on-load="questionBankOnLoad"
            @selection-change="questionBankSelectionChange"
            @search-change="questionBankSearchChange"
            @search-reset="questionBankSearchReset"
            @current-change="questionBankCurrentChange"
            @size-change="questionBankSizeChange"
            @row-save="questionBankRowSave"
            @row-del="questionBankRowDel"
          >
            <!-- 自定义按钮 -->
            <!-- <template slot="menuLeft">
    <el-row class="morpheus-box-apply-exam">
        <el-col :span="24"
                class="hasButOne">
            <el-card>
                <div class="exam-card-body">
                    <avue-crud v-model="obj"
                               class="company-box"
                               :option="questionBankOption"
                               :search.sync="questionBankSearch"
                               :table-loading="questionBankLoading"
                               :data="questionBankData"
                               ref="questionBankCrud"
                               :page.sync="questionBankPage"
                               @on-load="questionBankOnLoad"
                               @selection-change="questionBankSelectionChange"
                               @search-change="questionBankSearchChange"
                               @search-reset="questionBankSearchReset"
                               @current-change="questionBankCurrentChange"
                               @size-change="questionBankSizeChange"
                               @row-save="questionBankRowSave"
                               @row-del="questionBankRowDel">
                        <!-- 自定义按钮 -->
                        <!-- <template slot="menuLeft">
                            <el-button type="danger"
                                       size="mini"
                                       icon="el-icon-delete"
@@ -50,1091 +49,1071 @@
                            </el-button>
                        </template> -->
            <!-- <template slot="menuLeft">
                        <!-- <template slot="menuLeft">
                            <el-button type="danger"
                                       size="small"
                                       icon="el-icon-delete"
                                       @click="questionBankHandleDelete">删 除
                            </el-button>
                        </template> -->
            <!-- 自定义按钮 -->
            <template slot="menuLeft">
              <el-button
                type="primary"
                size="small"
                plain
                icon="el-icon-folder-checked"
                @click="handleBatchExam"
                v-if="permission.applyexam_exam"
                >生成考试
              </el-button>
              <!-- v-if="examPersission" -->
              <el-button
                type="primary"
                size="small"
                plain
                icon="el-icon-folder-checked"
                v-if="permission.applyexam_import"
               @click="handleImport"
                >批量报名
              </el-button>
            </template>
                        <!-- 自定义按钮 -->
                        <template slot="menuLeft">
                            <el-button type="primary"
                                       size="small"
                                       plain
                                       icon="el-icon-folder-checked"
                                       @click="handleBatchExam"
                                       v-if="permission.applyexam_exam">生成考试
                            </el-button>
                            <!-- v-if="examPersission" -->
                            <el-button type="primary"
                                       size="small"
                                       plain
                                       icon="el-icon-folder-checked"
                                       v-if="permission.applyexam_import"
                                       @click="handleImport">批量报名
                            </el-button>
                        </template>
            <template slot-scope="{ type, row }" slot="menu">
              <el-button
                :type="type"
                size="small"
                icon="el-icon-refresh-left"
                v-if="permission.applyexam_cancel"
                :disabled="row.isApply == 2"
                @click="handleCancel(row)"
                >取消报名
              </el-button>
              <el-button
                style="display: none"
                :type="type"
                size="small"
                icon="el-icon-folder-checked"
                :disabled="row.applyStatus == 4"
                @click="handleAudit(row)"
                >审核
              </el-button>
              <el-button
                :type="type"
                size="small"
                icon="el-icon-receiving"
                v-if="permission.applyexam_print && row.candidateNo!=''"
                @click="handlePrint(row)"
                >准考证打印
              </el-button>
            </template>
                        <template slot-scope="{ type, row }"
                                  slot="menu">
                            <el-button :type="type"
                                       size="small"
                                       icon="el-icon-refresh-left"
                                       v-if="permission.applyexam_cancel"
                                       :disabled="row.isApply == 2"
                                       @click="handleCancel(row)">取消报名
                            </el-button>
                            <el-button style="display: none"
                                       :type="type"
                                       size="small"
                                       icon="el-icon-folder-checked"
                                       :disabled="row.applyStatus == 4"
                                       @click="handleAudit(row)">审核
                            </el-button>
                            <el-button :type="type"
                                       size="small"
                                       icon="el-icon-receiving"
                                       v-if="permission.applyexam_print && row.candidateNo!=''"
                                       @click="handlePrint(row)">准考证打印
                            </el-button>
                        </template>
            <template slot-scope="{ row }" slot="age">
              {{ row.age == -1 ? "" : row.age }}
            </template>
          </avue-crud>
                        <template slot-scope="{ row }"
                                  slot="age">
                            {{ row.age == -1 ? "" : row.age }}
                        </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>
                    <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>
          <el-dialog
            title="批量报名导入"
            append-to-body
            :visible.sync="excelBox"
            width="555px"
          >
            <avue-form
              :option="excelOption"
              v-model="excelForm"
              :upload-after="uploadAfter"
            >
              <template slot="excelTemplate">
                <el-button type="primary" @click="handleTemplate">
                  点击下载<i class="el-icon-download el-icon--right"></i>
                </el-button>
              </template>
            </avue-form>
          </el-dialog>
                    <el-dialog title="批量报名导入"
                               append-to-body
                               :visible.sync="excelBox"
                               width="555px">
                        <avue-form :option="excelOption"
                                   v-model="excelForm"
                                   :upload-after="uploadAfter">
                            <template slot="excelTemplate">
                                <el-button type="primary"
                                           @click="handleTemplate">
                                    点击下载<i class="el-icon-download el-icon--right"></i>
                                </el-button>
                            </template>
                        </avue-form>
                    </el-dialog>
          <el-dialog
            title="考试生成"
            append-to-body
            :visible.sync="dialogExamFormVisible"
            width="900px"
            @close="closeDialog"
          >
            <avue-form
              ref="formExamApply"
              v-model="examApply"
              :option="optionExamApply"
              @reset-change="emptytChange"
              @submit="submitExamApply"
            ></avue-form>
          </el-dialog>
        </div>
      </el-card>
    </el-col>
  </el-row>
                    <el-dialog title="考试生成"
                               append-to-body
                               :visible.sync="dialogExamFormVisible"
                               width="900px"
                               @close="closeDialog">
                        <avue-form ref="formExamApply"
                                   v-model="examApply"
                                   :option="optionExamApply"
                                   @reset-change="emptytChange"
                                   @submit="submitExamApply"></avue-form>
                    </el-dialog>
                </div>
            </el-card>
        </el-col>
    </el-row>
</template>
<script>
import {
  getApplyList,
  addApply,
  cancelApply,
  remove,
  addExam,
    getApplyList,
    addApply,
    cancelApply,
    remove,
    addExam,
} from "@/api/examapi/applyexam";
import { mapState } from "vuex";
import { mapGetters } from "vuex";
import { getRoleDetail } from "@/api/system/role";
var DIC = {
  applyStatus: [
    {
      label: "已报名",
      value: 2,
    },
    {
      label: "已取消",
      value: 4,
    },
  ],
    applyStatus: [
        {
            label: "已报名",
            value: 2,
        },
        {
            label: "已取消",
            value: 4,
        },
    ],
};
export default {
  data() {
    return {
      dialogFormVisible: false,
      dialogExamFormVisible: false,
      examPersission: false,
      applyExport: false,
      excelBox: false,
      Audit: {},
      excelForm: {},
      excelOption: {
        submitBtn: false,
        emptyBtn: false,
        column: [
          {
            label: "模板上传",
            prop: "excelFile",
            type: "upload",
            drag: true,
            loadText: "模板上传中,请稍等",
            span: 24,
            propsHttp: {
              res: "data",
    data () {
        return {
            dialogFormVisible: false,
            dialogExamFormVisible: false,
            examPersission: false,
            applyExport: false,
            excelBox: false,
            Audit: {},
            excelForm: {},
            excelOption: {
                submitBtn: false,
                emptyBtn: false,
                column: [
                    {
                        label: "模板上传",
                        prop: "excelFile",
                        type: "upload",
                        drag: true,
                        loadText: "模板上传中,请稍等",
                        span: 24,
                        propsHttp: {
                            res: "data",
                        },
                        tip: "请上传 .xls,.xlsx 标准格式文件",
                        action: "/api/apply/import-apply",
                    },
                    {
                        label: "模板下载",
                        prop: "excelTemplate",
                        formslot: true,
                        span: 24,
                    },
                ],
            },
            tip: "请上传 .xls,.xlsx 标准格式文件",
            action: "/api/apply/import-apply",
          },
          {
            label: "模板下载",
            prop: "excelTemplate",
            formslot: true,
            span: 24,
          },
        ],
      },
      optionAudit: {
        height: "auto",
        calcHeight: 30,
        dialogWidth: 1000,
        tip: false,
        searchShow: true,
        searchMenuSpan: 6,
        border: true, //liu
        index: true,
        stripe: true,
        viewBtn: true,
        addBtn: true,
        selection: true,
        excelBtn: false,
        menuWidth: 230,
        dialogClickModal: false,
        column: [
          {
            label: "审核状态",
            search: true,
            searchSpan: 5,
            span: 24,
            prop: "auditStatus",
            slot: true,
            editDisplay: false,
            addDisplay: false,
            type: "select",
            rules: [
              {
                required: true,
                message: "请选择审核类型",
                trigger: "blur",
              },
            ],
            dicData: [
              {
                label: "审核通过",
                value: 2,
              },
              {
                label: "不通过",
                value: 3,
              },
            ],
          },
          {
            label: "审核明细",
            span: 24,
            type: "textarea",
            prop: "auditDetail",
          },
        ],
      },
      optionExamApply: {
        height: "auto",
        filterBtn: true,
        calcHeight: 30,
        dialogWidth: 950,
        tip: false,
        searchShow: true,
        searchMenuSpan: 6,
        border: true, //liu
        index: true,
        stripe: true,
        viewBtn: true,
        selection: true,
        excelBtn: false,
        menuWidth: 380,
        dialogClickModal: false,
        column: [
          {
            label: "考试人数",
            prop: "number",
            type: 'number',
            span: 12,
            precision:0,
            step:50,
            mock:{
              type:'number',
              max:1000,
              min:0,
              precision:0
            optionAudit: {
                height: "auto",
                calcHeight: 30,
                dialogWidth: 1000,
                tip: false,
                searchShow: true,
                searchMenuSpan: 6,
                border: true, //liu
                index: true,
                stripe: true,
                viewBtn: true,
                addBtn: true,
                selection: true,
                excelBtn: false,
                menuWidth: 230,
                dialogClickModal: false,
                column: [
                    {
                        label: "审核状态",
                        search: true,
                        searchSpan: 5,
                        span: 24,
                        prop: "auditStatus",
                        slot: true,
                        editDisplay: false,
                        addDisplay: false,
                        type: "select",
                        rules: [
                            {
                                required: true,
                                message: "请选择审核类型",
                                trigger: "blur",
                            },
                        ],
                        dicData: [
                            {
                                label: "审核通过",
                                value: 2,
                            },
                            {
                                label: "不通过",
                                value: 3,
                            },
                        ],
                    },
                    {
                        label: "审核明细",
                        span: 24,
                        type: "textarea",
                        prop: "auditDetail",
                    },
                ],
            },
            rules: [
              {
                required: true,
                message: "请输入考试人数",
                trigger: "blur",
              },
            ],
            minRows: 0,
            maxRows: 1000,
            value:50,
          },
          {
            label: "序号开始",
            prop: "serialStart",
            span: 6,
            value:1,
            mock:{
              type:'number',
              max:1000,
              min:1,
              precision:0
            optionExamApply: {
                height: "auto",
                filterBtn: true,
                calcHeight: 30,
                dialogWidth: 950,
                tip: false,
                searchShow: true,
                searchMenuSpan: 6,
                border: true, //liu
                index: true,
                stripe: true,
                viewBtn: true,
                selection: true,
                excelBtn: false,
                menuWidth: 380,
                dialogClickModal: false,
                column: [
                    {
                        label: "考试人数",
                        prop: "number",
                        type: 'number',
                        span: 12,
                        precision: 0,
                        step: 50,
                        mock: {
                            type: 'number',
                            max: 1000,
                            min: 0,
                            precision: 0
                        },
                        rules: [
                            {
                                required: true,
                                message: "请输入考试人数",
                                trigger: "blur",
                            },
                        ],
                        minRows: 0,
                        maxRows: 1000,
                        value: 50,
                    },
                    {
                        label: "序号开始",
                        prop: "serialStart",
                        span: 6,
                        value: 1,
                        mock: {
                            type: 'number',
                            max: 1000,
                            min: 1,
                            precision: 0
                        },
                        minRows: 1,
                        maxRows: 1000,
                        type: "number",
                        rules: [
                            {
                                required: true,
                                message: "请输入序号",
                                trigger: "blur",
                            },
                        ],
                    },
                    {
                        label: "序号结束",
                        prop: "serialEnd",
                        span: 6,
                        value: 50,
                        mock: {
                            type: 'number',
                            max: 1000,
                            min: 1,
                            precision: 0
                        },
                        minRows: 1,
                        maxRows: 1000,
                        type: "number",
                        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: true,
                        // 表单新增时是否为查看模式
                        addDetail: false,
                        // 表单编辑时是否禁止
                        editDisabled: false,
                        // 表单编辑时是否可见
                        editDisplay: true,
                        // 表单编辑时是否为查看模式
                        editDetail: false,
                        rules: [
                            {
                                required: true,
                                message: "请选择考试时间",
                                trigger: "blur",
                            },
                        ],
                        span: 12,
                    },
                    {
                        label: "截止时间",
                        prop: "endTime",
                        type: "datetime",
                        format: "yyyy-MM-dd HH:mm",
                        valueFormat: "yyyy-MM-dd HH:mm",
                        // 表单新增时是否禁止
                        addDisabled: false,
                        // 表单新增时是否可见
                        addDisplay: true,
                        // 表单新增时是否为查看模式
                        addDetail: false,
                        // 表单编辑时是否禁止
                        editDisabled: false,
                        // 表单编辑时是否可见
                        editDisplay: true,
                        // 表单编辑时是否为查看模式
                        editDetail: false,
                        rules: [
                            {
                                required: true,
                                message: "请选择考试时间",
                                trigger: "blur",
                            },
                        ],
                        span: 12,
                    },
                ],
            },
            minRows: 1,
            maxRows: 1000,
            type:"number",
            rules: [
              {
                required: true,
                message: "请输入序号",
                trigger: "blur",
              },
            ],
          },
          {
            label: "序号结束",
            prop: "serialEnd",
            span: 6,
            value:50,
            mock:{
              type:'number',
              max:1000,
              min:1,
              precision:0
            questionBankOption: {
                // 操作栏多余按钮去除
                delBtn: false,
                editBtn: false,
                addBtn: false,
                selection: false,
                menu: true,
                // 导出按钮
                // excelBtn: true,
                viewBtn: true,
                // title: '题库',
                align: "center",
                height: "auto",
                calcHeight: 80,
                tip: false,
                searchShow: true,
                searchMenuSpan: 4,
                index: true,
                indexLabel: "#",
                //dialogType: 'drawer',
                dialogClickModal: false,
                //tree 默认展开
                defaultExpandAll: true,
                // 操作栏宽度
                menuWidth: 250,
                column: [
                    {
                        label: "保安姓名",
                        prop: "userId",
                        type: "tree",
                        dicUrl: "",
                        hide: true,
                        slot: true,
                        searchSpan: 4,
                        // 表单新增时是否禁止
                        addDisabled: false,
                        // 表单新增时是否可见
                        addDisplay: true,
                        // 表单新增时是否为查看模式
                        addDetail: false,
                        // 表单编辑时是否禁止
                        editDisabled: true,
                        viewDisabled: false,
                        // 表单编辑时是否可见
                        editDisplay: true,
                        viewDisplay: false,
                        // 表单编辑时是否为查看模式
                        editDetail: false,
                        props: {
                            label: "title",
                            value: "id",
                        },
                        rules: [
                            {
                                required: true,
                                message: "请选择保安姓名",
                                trigger: "blur",
                            },
                        ],
                        width: 80,
                    },
                    {
                        label: "保安姓名",
                        prop: "realName",
                        searchSpan: 4,
                        search: true,
                        // 表单新增时是否禁止
                        addDisabled: false,
                        // 表单新增时是否可见
                        addDisplay: false,
                        // 表单新增时是否为查看模式
                        addDetail: false,
                        // 表单编辑时是否禁止
                        editDisabled: false,
                        // 表单编辑时是否可见
                        editDisplay: false,
                        // 表单编辑时是否为查看模式
                        editDetail: false,
                        viewDisplay: true,
                        props: {
                            label: "title",
                            value: "id",
                        },
                        rules: [
                            {
                                required: true,
                                message: "请选择保安姓名",
                                trigger: "blur",
                            },
                        ],
                    },
                    {
                        label: "年龄",
                        prop: "age",
                        slot: true,
                        // 表单新增时是否禁止
                        addDisabled: false,
                        // 表单新增时是否可见
                        addDisplay: false,
                        // 表单新增时是否为查看模式
                        addDetail: false,
                        // 表单编辑时是否禁止
                        editDisabled: false,
                        // 表单编辑时是否可见
                        editDisplay: false,
                        // 表单编辑时是否为查看模式
                        editDetail: false,
                        viewDisplay: true,
                    },
                    // {
                    //   label: "考试名称",
                    //   prop: "examName",
                    //   type: "tree",
                    //   dicUrl: "/api/exampaper/page-tree?examType=1",
                    //   // search: true,
                    //   slot: true,
                    //   // 表单新增时是否禁止
                    //   addDisabled: false,
                    //   // 表单新增时是否可见
                    //   addDisplay: true,
                    //   // 表单新增时是否为查看模式
                    //   addDetail: false,
                    //   // 表单编辑时是否禁止
                    //   editDisabled: true,
                    //   // 表单编辑时是否可见
                    //   editDisplay: true,
                    //   // 表单编辑时是否为查看模式
                    //   editDetail: false,
                    //   props: {
                    //     label: "examName",
                    //     value: "id",
                    //   },
                    //   rules: [
                    //     {
                    //       required: true,
                    //       message: "请选择试卷名称",
                    //       trigger: "blur",
                    //     },
                    //   ],
                    //   width: 220,
                    // },
                    {
                        label: "所属公司",
                        prop: "deptName",
                        search: true,
                        slot: true,
                        searchSpan: 6,
                        // 表单新增时是否禁止
                        addDisabled: false,
                        // 表单新增时是否可见
                        addDisplay: false,
                        // 表单新增时是否为查看模式
                        addDetail: false,
                        // 表单编辑时是否禁止
                        editDisabled: true,
                        // 表单编辑时是否可见
                        editDisplay: true,
                        // 表单编辑时是否为查看模式
                        editDetail: false,
                        rules: [
                            {
                                required: true,
                                message: "请选择所属公司",
                                trigger: "blur",
                            },
                        ],
                        width: 220,
                    },
                    {
                        label: "准考证号",
                        prop: "candidateNo",
                        slot: true,
                        // 表单新增时是否禁止
                        addDisabled: false,
                        // 表单新增时是否可见
                        addDisplay: false,
                        // 表单新增时是否为查看模式
                        addDetail: false,
                        // 表单编辑时是否禁止
                        editDisabled: false,
                        // 表单编辑时是否可见
                        editDisplay: true,
                        // 表单编辑时是否为查看模式
                        editDetail: false,
                        rules: [
                            {
                                required: true,
                                message: "请选择准考证号",
                                trigger: "blur",
                            },
                        ],
                        width: 100,
                    },
                    {
                        label: "身份证号",
                        prop: "idCardNo",
                        slot: true,
                        // 表单新增时是否禁止
                        addDisabled: false,
                        // 表单新增时是否可见
                        addDisplay: false,
                        // 表单新增时是否为查看模式
                        addDetail: false,
                        // 表单编辑时是否禁止
                        editDisabled: false,
                        // 表单编辑时是否可见
                        editDisplay: true,
                        // 表单编辑时是否为查看模式
                        editDetail: false,
                        rules: [
                            {
                                required: true,
                                message: "请选择准考证号",
                                trigger: "blur",
                            },
                        ],
                        width: 150,
                    },
                    {
                        label: "报考证件",
                        prop: "applyCard",
                        slot: true,
                        // 表单新增时是否禁止
                        addDisabled: false,
                        // 表单新增时是否可见
                        addDisplay: false,
                        // 表单新增时是否为查看模式
                        addDetail: false,
                        // 表单编辑时是否禁止
                        editDisabled: false,
                        // 表单编辑时是否可见
                        editDisplay: true,
                        // 表单编辑时是否为查看模式
                        editDetail: false,
                        rules: [
                            {
                                required: true,
                                message: "请选择准考证号",
                                trigger: "blur",
                            },
                        ],
                    },
                    // {
                    //     label: "试卷分数",
                    //     prop: "paperScore",
                    //     slot: true,
                    //     // 表单新增时是否禁止
                    //     addDisabled: false,
                    //     // 表单新增时是否可见
                    //     addDisplay: false,
                    //     // 表单新增时是否为查看模式
                    //     addDetail: false,
                    //     // 表单编辑时是否禁止
                    //     editDisabled: true,
                    //     // 表单编辑时是否可见
                    //     editDisplay: true,
                    //     // 表单编辑时是否为查看模式
                    //     editDetail: false
                    // },
                    {
                        label: "报名时间",
                        prop: "applyTime",
                        type: "datetime",
                        // span: 24,
                        format: "yyyy-MM-dd HH:mm:ss",
                        valueFormat: "yyyy-MM-dd HH:mm:ss",
                        // 表单新增时是否禁止
                        addDisabled: true,
                        // 表单新增时是否可见
                        addDisplay: false,
                        // 表单新增时是否为查看模式
                        addDetail: false,
                        // 表单编辑时是否禁止
                        editDisabled: true,
                        // 表单编辑时是否可见
                        editDisplay: true,
                        // 表单编辑时是否为查看模式
                        editDetail: false,
                        value:
                            new Date().getFullYear() +
                            "-" +
                            (new Date().getMonth() + 1 < 10
                                ? "0" + (new Date().getMonth() + 1)
                                : new Date().getMonth() + 1) +
                            "-" +
                            (new Date().getDate() < 10
                                ? "0" + new Date().getDate()
                                : new Date().getDate()) +
                            " " +
                            (new Date().getHours() < 10
                                ? "0" + new Date().getHours()
                                : new Date().getHours()) +
                            ":" +
                            (new Date().getMinutes() < 10
                                ? "0" + new Date().getMinutes()
                                : new Date().getMinutes()) +
                            ":" +
                            (new Date().getSeconds() < 10
                                ? "0" + new Date().getSeconds()
                                : new Date().getSeconds()),
                        width: 150,
                    },
                    // {
                    //   label: "考试时间",
                    //   prop: "examTime",
                    //   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: true,
                    //   // 表单编辑时是否为查看模式
                    //   editDetail: false,
                    //   width: 150,
                    // },
                    // {
                    //   label: "审查状态",
                    //   prop: "examinationType",
                    //   slot: true,
                    //   searchSpan: 5,
                    //   // 表单新增时是否禁止
                    //   addDisabled: false,
                    //   // 表单新增时是否可见
                    //   addDisplay: false,
                    //   // 表单新增时是否为查看模式
                    //   addDetail: false,
                    //   // 表单编辑时是否禁止
                    //   editDisabled: false,
                    //   // 表单编辑时是否可见
                    //   editDisplay: true,
                    //   // 表单编辑时是否为查看模式
                    //   editDetail: false,
                    //   dicData: [
                    //     {
                    //       label: "正常",
                    //       value: "1",
                    //     },
                    //     {
                    //       label: "异常",
                    //       value: "2",
                    //     },
                    //   ],
                    //   search: true,
                    //   type: "select",
                    // },
                    // {
                    //   label: "审查明细",
                    //   prop: "examinationMx",
                    //   slot: true,
                    //   // 表单新增时是否禁止
                    //   addDisabled: false,
                    //   // 表单新增时是否可见
                    //   addDisplay: false,
                    //   // 表单新增时是否为查看模式
                    //   addDetail: false,
                    //   // 表单编辑时是否禁止
                    //   editDisabled: false,
                    //   // 表单编辑时是否可见
                    //   editDisplay: true,
                    //   // 表单编辑时是否为查看模式
                    //   editDetail: false,
                    //   overHidden: true,
                    //   width: 150,
                    // },
                    //   {
                    //     label: "报名状态",
                    //     search: true,
                    //     type: "select",
                    //     searchSpan: 4,
                    //     prop: "applyStatus",
                    //     searchValue: 2,
                    //     dicData: [{
                    //             label: '全部',
                    //             value: 0,
                    //         },
                    //         {
                    //             label: '已报名',
                    //             value: 2,
                    //         },
                    //         {
                    //             label: '已取消',
                    //             value: 4,
                    //         }
                    //     ],
                    //     props: {
                    //         label: "label",
                    //         value: "value"
                    //     },
                    //     editDisplay: false,
                    //     addDisplay: false,
                    //     width: 100,
                    // },
                ],
            },
            minRows: 1,
            maxRows: 1000,
            type:"number",
            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: true,
            // 表单新增时是否为查看模式
            addDetail: false,
            // 表单编辑时是否禁止
            editDisabled: false,
            // 表单编辑时是否可见
            editDisplay: true,
            // 表单编辑时是否为查看模式
            editDetail: false,
            rules: [
              {
                required: true,
                message: "请选择考试时间",
                trigger: "blur",
              },
            ],
            span: 12,
          },
          {
            label: "截止时间",
            prop: "endTime",
            type: "datetime",
            format: "yyyy-MM-dd HH:mm",
            valueFormat: "yyyy-MM-dd HH:mm",
            // 表单新增时是否禁止
            addDisabled: false,
            // 表单新增时是否可见
            addDisplay: true,
            // 表单新增时是否为查看模式
            addDetail: false,
            // 表单编辑时是否禁止
            editDisabled: false,
            // 表单编辑时是否可见
            editDisplay: true,
            // 表单编辑时是否为查看模式
            editDetail: false,
            rules: [
              {
                required: true,
                message: "请选择考试时间",
                trigger: "blur",
              },
            ],
            span: 12,
          },
        ],
      },
      questionBankOption: {
        // 操作栏多余按钮去除
        delBtn: false,
        editBtn: false,
        addBtn: false,
        selection: false,
        menu: true,
        // 导出按钮
        // excelBtn: true,
        viewBtn: true,
        // title: '题库',
        align: "center",
        height: "auto",
        calcHeight: 80,
        tip: false,
        searchShow: true,
        searchMenuSpan: 4,
        index: true,
        indexLabel: "#",
        //dialogType: 'drawer',
        dialogClickModal: false,
        //tree 默认展开
        defaultExpandAll: true,
        // 操作栏宽度
        menuWidth: 250,
        column: [
          {
            label: "保安姓名",
            prop: "userId",
            type: "tree",
            dicUrl: "",
            hide: true,
            slot: true,
            searchSpan: 4,
            // 表单新增时是否禁止
            addDisabled: false,
            // 表单新增时是否可见
            addDisplay: true,
            // 表单新增时是否为查看模式
            addDetail: false,
            // 表单编辑时是否禁止
            editDisabled: true,
            viewDisabled: false,
            // 表单编辑时是否可见
            editDisplay: true,
            viewDisplay: false,
            // 表单编辑时是否为查看模式
            editDetail: false,
            props: {
              label: "title",
              value: "id",
            questionBankSearch: {},
            questionBankLoading: true,
            questionBankData: [],
            questionBankPage: {
                pageSize: 10,
                currentPage: 1,
                total: 16,
            },
            rules: [
              {
                required: true,
                message: "请选择保安姓名",
                trigger: "blur",
              },
            ],
            width: 80,
          },
          {
            label: "保安姓名",
            prop: "realName",
            searchSpan: 4,
            search: true,
            // 表单新增时是否禁止
            addDisabled: false,
            // 表单新增时是否可见
            addDisplay: false,
            // 表单新增时是否为查看模式
            addDetail: false,
            // 表单编辑时是否禁止
            editDisabled: false,
            // 表单编辑时是否可见
            editDisplay: false,
            // 表单编辑时是否为查看模式
            editDetail: false,
            viewDisplay: true,
            props: {
              label: "title",
              value: "id",
            questionBankQuery: {},
            questionBankSelectionList: [],
        };
    },
    watch: {
        "form.examname": {
            // form是表单或者表格绑定的数据集,v-model='form'
            handler (val) {
                if (val) {
                    //地址截取,从县/区开始截取,并且取从县区第一个出现的位置开始
                    var address = val.formattedAddress.toString();
                    if (address.search("县") != -1) {
                        this.form.address = address.substring(
                            address.indexOf("县") + 1,
                            address.length
                        );
                    }
                    if (address.search("区") != -1) {
                        this.form.address = address.substring(
                            address.indexOf("区") + 1,
                            address.length
                        );
                    }
                }
            },
            rules: [
              {
                required: true,
                message: "请选择保安姓名",
                trigger: "blur",
              },
            ],
          },
          {
            label: "年龄",
            prop: "age",
            slot: true,
            // 表单新增时是否禁止
            addDisabled: false,
            // 表单新增时是否可见
            addDisplay: false,
            // 表单新增时是否为查看模式
            addDetail: false,
            // 表单编辑时是否禁止
            editDisabled: false,
            // 表单编辑时是否可见
            editDisplay: false,
            // 表单编辑时是否为查看模式
            editDetail: false,
            viewDisplay: true,
          },
          // {
          //   label: "考试名称",
          //   prop: "examName",
          //   type: "tree",
          //   dicUrl: "/api/exampaper/page-tree?examType=1",
          //   // search: true,
          //   slot: true,
          //   // 表单新增时是否禁止
          //   addDisabled: false,
          //   // 表单新增时是否可见
          //   addDisplay: true,
          //   // 表单新增时是否为查看模式
          //   addDetail: false,
          //   // 表单编辑时是否禁止
          //   editDisabled: true,
          //   // 表单编辑时是否可见
          //   editDisplay: true,
          //   // 表单编辑时是否为查看模式
          //   editDetail: false,
          //   props: {
          //     label: "examName",
          //     value: "id",
          //   },
          //   rules: [
          //     {
          //       required: true,
          //       message: "请选择试卷名称",
          //       trigger: "blur",
          //     },
          //   ],
          //   width: 220,
          // },
          {
            label: "所属公司",
            prop: "deptName",
            search: true,
            slot: true,
            searchSpan: 6,
            // 表单新增时是否禁止
            addDisabled: false,
            // 表单新增时是否可见
            addDisplay: false,
            // 表单新增时是否为查看模式
            addDetail: false,
            // 表单编辑时是否禁止
            editDisabled: true,
            // 表单编辑时是否可见
            editDisplay: true,
            // 表单编辑时是否为查看模式
            editDetail: false,
            rules: [
              {
                required: true,
                message: "请选择所属公司",
                trigger: "blur",
              },
            ],
            width: 220,
          },
          {
            label: "准考证号",
            prop: "candidateNo",
            slot: true,
            // 表单新增时是否禁止
            addDisabled: false,
            // 表单新增时是否可见
            addDisplay: false,
            // 表单新增时是否为查看模式
            addDetail: false,
            // 表单编辑时是否禁止
            editDisabled: false,
            // 表单编辑时是否可见
            editDisplay: true,
            // 表单编辑时是否为查看模式
            editDetail: false,
            rules: [
              {
                required: true,
                message: "请选择准考证号",
                trigger: "blur",
              },
            ],
            width: 100,
          },
          {
            label: "身份证号",
            prop: "idCardNo",
            slot: true,
            // 表单新增时是否禁止
            addDisabled: false,
            // 表单新增时是否可见
            addDisplay: false,
            // 表单新增时是否为查看模式
            addDetail: false,
            // 表单编辑时是否禁止
            editDisabled: false,
            // 表单编辑时是否可见
            editDisplay: true,
            // 表单编辑时是否为查看模式
            editDetail: false,
            rules: [
              {
                required: true,
                message: "请选择准考证号",
                trigger: "blur",
              },
            ],
            width: 150,
          },
          {
            label: "报考证件",
            prop: "applyCard",
            slot: true,
            // 表单新增时是否禁止
            addDisabled: false,
            // 表单新增时是否可见
            addDisplay: false,
            // 表单新增时是否为查看模式
            addDetail: false,
            // 表单编辑时是否禁止
            editDisabled: false,
            // 表单编辑时是否可见
            editDisplay: true,
            // 表单编辑时是否为查看模式
            editDetail: false,
            rules: [
              {
                required: true,
                message: "请选择准考证号",
                trigger: "blur",
              },
            ],
          },
          // {
          //     label: "试卷分数",
          //     prop: "paperScore",
          //     slot: true,
          //     // 表单新增时是否禁止
          //     addDisabled: false,
          //     // 表单新增时是否可见
          //     addDisplay: false,
          //     // 表单新增时是否为查看模式
          //     addDetail: false,
          //     // 表单编辑时是否禁止
          //     editDisabled: true,
          //     // 表单编辑时是否可见
          //     editDisplay: true,
          //     // 表单编辑时是否为查看模式
          //     editDetail: false
          // },
          {
            label: "报名时间",
            prop: "applyTime",
            type: "datetime",
            // span: 24,
            format: "yyyy-MM-dd HH:mm:ss",
            valueFormat: "yyyy-MM-dd HH:mm:ss",
            // 表单新增时是否禁止
            addDisabled: true,
            // 表单新增时是否可见
            addDisplay: false,
            // 表单新增时是否为查看模式
            addDetail: false,
            // 表单编辑时是否禁止
            editDisabled: true,
            // 表单编辑时是否可见
            editDisplay: true,
            // 表单编辑时是否为查看模式
            editDetail: false,
            value:
              new Date().getFullYear() +
              "-" +
              (new Date().getMonth() + 1 < 10
                ? "0" + (new Date().getMonth() + 1)
                : new Date().getMonth() + 1) +
              "-" +
              (new Date().getDate() < 10
                ? "0" + new Date().getDate()
                : new Date().getDate()) +
              " " +
              (new Date().getHours() < 10
                ? "0" + new Date().getHours()
                : new Date().getHours()) +
              ":" +
              (new Date().getMinutes() < 10
                ? "0" + new Date().getMinutes()
                : new Date().getMinutes()) +
              ":" +
              (new Date().getSeconds() < 10
                ? "0" + new Date().getSeconds()
                : new Date().getSeconds()),
            immediate: true,
        },
    },
    created () {
            width: 150,
          },
          // {
          //   label: "考试时间",
          //   prop: "examTime",
          //   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: true,
          //   // 表单编辑时是否为查看模式
          //   editDetail: false,
          //   width: 150,
          // },
          // {
          //   label: "审查状态",
          //   prop: "examinationType",
          //   slot: true,
          //   searchSpan: 5,
          //   // 表单新增时是否禁止
          //   addDisabled: false,
          //   // 表单新增时是否可见
          //   addDisplay: false,
          //   // 表单新增时是否为查看模式
          //   addDetail: false,
          //   // 表单编辑时是否禁止
          //   editDisabled: false,
          //   // 表单编辑时是否可见
          //   editDisplay: true,
          //   // 表单编辑时是否为查看模式
          //   editDetail: false,
          //   dicData: [
          //     {
          //       label: "正常",
          //       value: "1",
          //     },
          //     {
          //       label: "异常",
          //       value: "2",
          //     },
          //   ],
          //   search: true,
          //   type: "select",
          // },
          // {
          //   label: "审查明细",
          //   prop: "examinationMx",
          //   slot: true,
          //   // 表单新增时是否禁止
          //   addDisabled: false,
          //   // 表单新增时是否可见
          //   addDisplay: false,
          //   // 表单新增时是否为查看模式
          //   addDetail: false,
          //   // 表单编辑时是否禁止
          //   editDisabled: false,
          //   // 表单编辑时是否可见
          //   editDisplay: true,
          //   // 表单编辑时是否为查看模式
          //   editDetail: false,
          //   overHidden: true,
          //   width: 150,
          // },
          //   {
          //     label: "报名状态",
          //     search: true,
          //     type: "select",
          //     searchSpan: 4,
          //     prop: "applyStatus",
          //     searchValue: 2,
          //     dicData: [{
          //             label: '全部',
          //             value: 0,
          //         },
          //         {
          //             label: '已报名',
          //             value: 2,
          //         },
          //         {
          //             label: '已取消',
          //             value: 4,
          //         }
          //     ],
          //     props: {
          //         label: "label",
          //         value: "value"
          //     },
          //     editDisplay: false,
          //     addDisplay: false,
          //     width: 100,
          // },
        ],
      },
      questionBankSearch: {},
      questionBankLoading: true,
      questionBankData: [],
      questionBankPage: {
        pageSize: 10,
        currentPage: 1,
        total: 16,
      },
      questionBankQuery: {},
      questionBankSelectionList: [],
    };
  },
  watch: {
    "form.examname": {
      // form是表单或者表格绑定的数据集,v-model='form'
      handler(val) {
        if (val) {
          //地址截取,从县/区开始截取,并且取从县区第一个出现的位置开始
          var address = val.formattedAddress.toString();
          if (address.search("县") != -1) {
            this.form.address = address.substring(
              address.indexOf("县") + 1,
              address.length
            );
          }
          if (address.search("区") != -1) {
            this.form.address = address.substring(
              address.indexOf("区") + 1,
              address.length
            );
          }
        if (this.userInfo.role_name.indexOf("ksxtadmin") != -1) {
            this.examPersission = true;
        }
      },
      immediate: true,
    },
  },
  created() {
    console.log(this.userInfo);
    if (this.userInfo.role_name.indexOf("ksxtadmin") != -1) {
      this.examPersission = true;
    }
        this.questionBankSearch['applyStatus'] = 2;
    },
    mounted () { },
    computed: {
        ...mapState({
            userInfo: (state) => state.user.userInfo,
        }),
        ...mapGetters(["userInfo", "permission"]),
        permissionList () {
            return {
                addBtn: this.vaildData(null, false),
                viewBtn: this.vaildData(this.permission.applyexam_view, false),
                delBtn: this.vaildData(null, false),
                editBtn: this.vaildData(null, false),
            };
        },
        ids () {
            let ids = [];
            this.questionBankSelectionList.forEach((ele) => {
                ids.push(ele.id);
            });
            return ids.join(",");
        },
    },
    methods: {
        //准考证查看
        handlePrint (row) {
            var obj = row;
            obj["name"] = "准考证信息";
            this.$router.push({
                path: `/applyexam/papers`,
                query: obj,
            });
        },
        questionBankOnLoad (page, params = {}) {
            params = this.questionBankSearch;
            this.questionBankLoading = false;
            this.loading = true;
            //判断角色,如果是保安公司管理员或保安,只能查看当前公司的报名信息
            var that = this;
            //获取当前登录人员的角色信息
            var roleIds = this.userInfo.role_id.split(",");
            roleIds.forEach((roleId) => {
                getRoleDetail(roleId).then((res) => {
                    var roleAlias = res.data.data.roleAlias;
                    if (
                        roleAlias == "保安公司管理员" ||
                        roleAlias == "保安"
                    ) {
                        //如果是保安公司管理员
                        params["deptId"] = that.userInfo.dept_id;
                    }
                    getApplyList(
                        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.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;
        },
    this.questionBankSearch['applyStatus'] = 2;
  },
  mounted() {},
  computed: {
    ...mapState({
      userInfo: (state) => state.user.userInfo,
    }),
    ...mapGetters(["userInfo", "permission"]),
    permissionList() {
      return {
        addBtn: this.vaildData(null, false),
        viewBtn: this.vaildData(this.permission.applyexam_view, false),
        delBtn: this.vaildData(null, false),
        editBtn: this.vaildData(null, false),
      };
    },
    ids() {
      let ids = [];
      this.questionBankSelectionList.forEach((ele) => {
        ids.push(ele.id);
      });
      return ids.join(",");
    },
  },
  methods: {
    //准考证查看
    handlePrint(row) {
      var obj = row;
      obj["name"] = "准考证信息";
      this.$router.push({
        path: `/applyexam/papers`,
        query: obj,
      });
    },
    questionBankOnLoad(page, params = {}) {
      params = this.questionBankSearch;
      this.questionBankLoading = false;
      this.loading = true;
      //判断角色,如果是保安公司管理员或保安,只能查看当前公司的报名信息
      var that = this;
      //获取当前登录人员的角色信息
      var roleIds = this.userInfo.role_id.split(",");
      roleIds.forEach((roleId) => {
        getRoleDetail(roleId).then((res) => {
            var roleAlias = res.data.data.roleAlias;
            if (
              roleAlias == "保安公司管理员" ||
              roleAlias == "保安"
            ) {
              //如果是保安公司管理员
              params["deptId"] = that.userInfo.dept_id;
        // 新增
        questionBankRowSave (row, done, loading) {
            // debugger;
            addApply({
                userId: row.userId,
                examId: row.examName,
                applyTime: row.applyTime,
            }).then(
                (res) => {
                    this.questionBankOnLoad(this.questionBankPage);
                    if (res.data.data == 201) {
                        this.$message({
                            type: "warning",
                            message: "已报名,不能重复报名",
                        });
                    } else if (res.data.data == 201) {
                        this.$message({
                            type: "warning",
                            message: "报名失败",
                        });
                    } else {
                        this.$message({
                            type: "success",
                            message: "报名成功",
                        });
                    }
                    done();
                },
                (error) => {
                    window.console.log(error);
                    loading();
                }
            );
        },
        //生成考试弹窗
        handleBatchExam () {
            this.dialogExamFormVisible = true;
            if (this.questionBankSelectionList.length === 0) {
                this.ids = "";
            }
            getApplyList(
              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.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;
    },
    // 新增
    questionBankRowSave(row, done, loading) {
      // debugger;
      addApply({
        userId: row.userId,
        examId: row.examName,
        applyTime: row.applyTime,
      }).then(
        (res) => {
          this.questionBankOnLoad(this.questionBankPage);
          if (res.data.data == 201) {
            this.$message({
              type: "warning",
              message: "已报名,不能重复报名",
            });
          } else if (res.data.data == 201) {
            this.$message({
              type: "warning",
              message: "报名失败",
            });
          } else {
            this.$message({
              type: "success",
              message: "报名成功",
            });
          }
          done();
        },
        (error) => {
          window.console.log(error);
          loading();
        }
      );
    },
        //生成考试
        submitExamApply (row, done, loading) {
            var that = this;
            row.startTime = row.startTime + ":00";
            row.endTime = row.endTime + ":00";
            if (row.number != ((row.serialEnd - row.serialStart) + 1)) {
                this.$message({
                    type: "error",
                    message: "考试人数与序号不匹配!",
                });
                done();
                return;
            }
    //生成考试弹窗
    handleBatchExam() {
      this.dialogExamFormVisible = true;
      if (this.questionBankSelectionList.length === 0) {
        this.ids = "";
      }
    },
    //生成考试
    submitExamApply(row, done, loading) {
      var that = this;
      row.startTime = row.startTime + ":00";
      row.endTime = row.endTime + ":00";
      if(row.number!=((row.serialEnd-row.serialStart)+1)){
          this.$message({
            type: "error",
            message: "考试人数与序号不匹配!",
          });
         done();
         return;
      }
      var s = new Date(row.startTime);
      var e = new Date(row.endTime);
      if(s>e){
        this.$message({
            type: "error",
            message: "截止时间不能早于考试考试开始时间!",
          });
         done();
         return;
      }
      addExam(Object.assign(row, this.questionBankSearch)).then(
        () => {
          this.questionBankOnLoad(this.questionBankPage);
          this.$message({
            type: "success",
            message: "操作成功!",
          });
          that.$refs.formExamApply.resetFields();
          that.dialogExamFormVisible = false;
          done();
            var s = new Date(row.startTime);
            var e = new Date(row.endTime);
            if (s > e) {
                this.$message({
                    type: "error",
                    message: "截止时间不能早于考试考试开始时间!",
                });
                done();
                return;
            }
            addExam(Object.assign(row, this.questionBankSearch)).then(
                () => {
                    this.questionBankOnLoad(this.questionBankPage);
                    this.$message({
                        type: "success",
                        message: "操作成功!",
                    });
                    that.$refs.formExamApply.resetFields();
                    that.dialogExamFormVisible = false;
                    done();
                },
                (error) => {
                    window.console.log(error);
                    loading();
                }
            );
        },
        (error) => {
          window.console.log(error);
          loading();
        }
      );
    },
    //关闭窗口清除数据
    closeDialog() {
      this.$refs.formExamApply.resetFields();
    },
        //关闭窗口清除数据
        closeDialog () {
            this.$refs.formExamApply.resetFields();
        },
    questionBankRowDel(row) {
      this.$confirm("确定将选择数据删除?", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      })
        .then(() => {
          return remove(row.id);
        })
        .then(() => {
          this.questionBankOnLoad(this.questionBankPage);
          this.$message({
            type: "success",
            message: "操作成功!",
          });
        });
    },
        questionBankRowDel (row) {
            this.$confirm("确定将选择数据删除?", {
                confirmButtonText: "确定",
                cancelButtonText: "取消",
                type: "warning",
            })
                .then(() => {
                    return remove(row.id);
                })
                .then(() => {
                    this.questionBankOnLoad(this.questionBankPage);
                    this.$message({
                        type: "success",
                        message: "操作成功!",
                    });
                });
        },
    //取消报名
    handleCancel(row) {
      this.$confirm("确定取消报名?", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      })
        .then(() => {
          row.applyStatus = 4;
          return cancelApply(row);
        })
        .then(() => {
          this.questionBankOnLoad(this.questionBankPage);
          this.$message({
            type: "success",
            message: "操作成功!",
          });
        });
    },
        //取消报名
        handleCancel (row) {
            this.$confirm("确定取消报名?", {
                confirmButtonText: "确定",
                cancelButtonText: "取消",
                type: "warning",
            })
                .then(() => {
                    row.applyStatus = 4;
                    return cancelApply(row);
                })
                .then(() => {
                    this.questionBankOnLoad(this.questionBankPage);
                    this.$message({
                        type: "success",
                        message: "操作成功!",
                    });
                });
        },
    questionBankHandleDelete() {
      if (this.questionBankSelectionList.length === 0) {
        this.$message.warning("请选择至少一条数据");
        return;
      }
      this.$confirm("确定将选择数据删除?", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      })
        .then(() => {
          return remove(this.ids);
        })
        .then(() => {
          this.questionBankOnLoad(this.questionBankPage);
          this.$message({
            type: "success",
            message: "操作成功!",
          });
          this.$refs.questionBankCrud.toggleSelection();
        });
    },
    handleAudit(row) {
      this.dialogFormVisible = true;
      this.Audit = row;
    },
        questionBankHandleDelete () {
            if (this.questionBankSelectionList.length === 0) {
                this.$message.warning("请选择至少一条数据");
                return;
            }
            this.$confirm("确定将选择数据删除?", {
                confirmButtonText: "确定",
                cancelButtonText: "取消",
                type: "warning",
            })
                .then(() => {
                    return remove(this.ids);
                })
                .then(() => {
                    this.questionBankOnLoad(this.questionBankPage);
                    this.$message({
                        type: "success",
                        message: "操作成功!",
                    });
                    this.$refs.questionBankCrud.toggleSelection();
                });
        },
        handleAudit (row) {
            this.dialogFormVisible = true;
            this.Audit = row;
        },
    handleImport() {
      this.excelBox = true;
    },
        handleImport () {
            this.excelBox = true;
        },
    handleTemplate() {
      window.open(`/api/apply/export-template`);
    },
    uploadAfter(res, done, loading, column) {
      window.console.log(column);
      this.excelBox = false;
      this.refreshChange();
      done();
    },
        handleTemplate () {
            window.open(`/api/apply/export-template`);
        },
        uploadAfter (res, done, loading, column) {
            window.console.log(column);
            this.excelBox = false;
            this.refreshChange();
            done();
        },
    refreshChange() {
      this.questionBankOnLoad(this.page, this.query);
        refreshChange () {
            this.questionBankOnLoad(this.page, this.query);
        },
    },
  },
};
</script>
src/views/dispatch/dispatch.vue
@@ -95,7 +95,7 @@
      <!-- <span v-else-if="typeTABS.prop === 'tab3'">选项卡内容3</span> -->
    </div>
  </basic-container>
</template>
</template>
<script>
import {
@@ -615,7 +615,6 @@
      this.onLoad(this.page, this.query);
    },
    rowClick(row) {
      // console.log(row);
      window.localStorage.setItem("paqiandata", JSON.stringify(row));
      this.$router.push({
        path: "/dispatchChild",
@@ -668,18 +667,15 @@
      if (this.useifid != 266) {
        values["deptId"] = this.useifid;
      }
      // console.log(values);
      if (this.userInfo.role_name == "公安管理员") {
        values["jurisdiction"] = that.userInfo.jurisdiction;
      }
      console.log(params);
      getdata(
        page.currentPage,
        page.pageSize,
        // Object.assign(params, this.query)
        values
      ).then((res) => {
        // console.log(res);
        const data = res.data.data;
        this.page.total = data.total;
        this.data = data.records;
@@ -729,4 +725,4 @@
.el-collapse-item {
  padding-top: 15px !important;
}
</style>
</style>
src/views/dispatch/dispatchChildoperable.vue
@@ -20,7 +20,7 @@
      </avue-crud>
    </div>
  </basic-container>
</template>
</template>
<script>
import {
@@ -281,7 +281,6 @@
  created() {
    var that = this;
    if (this.userInfo.role_name == "保安公司管理员") {
      console.log("保安公司管理员登入");
      const deptColumn = this.findObject(this.option1.column, "deptId");
      deptColumn.search = false;
      deptColumn.hide = true;
@@ -329,7 +328,6 @@
        // this.onLoad(this.page);
      } else if (column.prop == "tab2") {
        // this.loading = false;
        console.log(document.getElementsByClassName("el-card__body")[0]);
        this.onLoad1(this.page1); //第二个表格不会自动执行
      }
      // this.$message.success(JSON.stringify(column));
@@ -423,10 +421,8 @@
    },
    selectionChange1(list) {
      this.selectionList1 = list;
      // console.log(this.selectionList1.length);
    },
    handleDelete1() {
      console.log(this.selectionList1);
      if (this.selectionList1.length === 0) {
        this.$message.warning("请选择至少一条数据");
        return;
@@ -449,7 +445,6 @@
        });
    },
    refreshChange1() {
      // console.log(4534)
      this.onLoad1(this.page1, this.query1);
    },
@@ -527,7 +522,6 @@
        this.data1 = data.records;
        this.loading1 = false;
        // this.$nextTick(() => this.$refs.crudrec1.dicInit("cascader"));
        console.log(this.form, 111111);
      });
    },
    initData(type) {
@@ -538,7 +532,6 @@
            this.option1.column,
            "dispatcherUnitId"
          );
          // console.log(res.data.data, 111);
          dispatcherUnitIdColumn.dicData = res.data.data;
        });
      }
@@ -562,7 +555,6 @@
  //   //   this.initData();
  //   // }
  //   deps(){
  //     console.log(this.deps,5646646)
  //   }
  // },
  mounted() {
@@ -581,4 +573,4 @@
.el-collapse-item {
  padding-top: 15px !important;
}
</style>
</style>
src/views/dispatch/dispatchChildoperableSee.vue
@@ -20,7 +20,7 @@
      </avue-crud>
    </div>
  </basic-container>
</template>
</template>
<script>
import {
@@ -281,12 +281,10 @@
    };
  },
  created() {
    console.log(this.userInfo);
    this.option1.column[1]["value"] = this.userInfo.dept_id;
    this.option1.column[3]["value"] = this.userInfo.Id;
    this.option1.column[4]["value"] = this.userInfo.nick_name;
    if (this.userInfo.role_name == "保安公司管理员") {
      console.log("保安公司管理员登入");
      const deptColumn = this.findObject(this.option1.column, "deptId");
      deptColumn.search = false;
    } else {
@@ -411,10 +409,8 @@
    },
    selectionChange1(list) {
      this.selectionList1 = list;
      // console.log(this.selectionList1.length);
    },
    handleDelete1() {
      console.log(this.selectionList1);
      if (this.selectionList1.length === 0) {
        this.$message.warning("请选择至少一条数据");
        return;
@@ -437,7 +433,6 @@
        });
    },
    refreshChange1() {
      // console.log(4534)
      this.onLoad1(this.page1, this.query1);
    },
@@ -520,7 +515,6 @@
            this.option1.column,
            "dispatcherUnitId"
          );
          // console.log(res.data.data, 111);
          dispatcherUnitIdColumn.dicData = res.data.data;
        });
      }
@@ -544,7 +538,6 @@
  //   //   this.initData();
  //   // }
  //   deps(){
  //     console.log(this.deps,5646646)
  //   }
  // },
  mounted() {
@@ -563,4 +556,4 @@
.el-collapse-item {
  padding-top: 15px !important;
}
</style>
</style>
src/views/dispatchChild/index.vue
@@ -63,7 +63,7 @@
    </span>
    <!-- <span v-else-if="typeTABS.prop === 'tab3'">选项卡内容3</span> -->
  </div>
</template>
</template>
<script>
import { column, column1 } from "./data";
@@ -164,7 +164,6 @@
        // this.onLoad(this.page);
      } else if (column.prop == "tab2") {
        // this.loading = false;
        // console.log(document.getElementsByClassName("el-card__body")[0]);
        this.onLoad1(this.page1); //第二个表格不会自动执行
      }
      // this.$message.success(JSON.stringify(column));
@@ -285,7 +284,6 @@
        });
    },
    refreshChange1() {
      // console.log(4534)
      this.onLoad1(this.page1, this.query1);
    },
@@ -296,13 +294,11 @@
      // params["name"] = this.name;
      // params["dispatcherCompany"] = this.dispatcherCompany;
      params["dispatcherUnitId"] = this.id;
      // console.log(params, "get");
      getdata1(
        page.currentPage,
        page.pageSize,
        Object.assign(params, this.query)
      ).then((res) => {
        // console.log(res);
        const data = res.data.data;
        this.page1.total = data.total;
        this.data1 = data.records;
@@ -310,7 +306,6 @@
        //   this.data1[k].securityName = this.data1[k].securityName.split(",");
        //   this.data1[k].securityName = this.data1[k].securityName.join(" | ");
        // }
        console.log(this.data1, 1);
        this.loading1 = false;
      });
    },
@@ -344,7 +339,6 @@
        if (i == 1) {
          // console.log("存在");
        } else {
          // console.log("已删除");
          this.obj0 = {};
          this.obj0.name = row.name + " 该派遣单位已删除";
@@ -353,7 +347,6 @@
        }
      }
    } else {
      // console.log("no");
      this.obj0.name = " 未选择派遣单位";
    }
  },
@@ -370,4 +363,4 @@
.el-collapse-item {
  padding-top: 15px !important;
}
</style>
</style>
src/views/exam/addsubject.vue
@@ -787,8 +787,6 @@
        data: this.index,
      });
      this.inputs[`input${this.index + 1}`] = "";
      console.log(this.inputs);
      console.log(this.list, 111);
    },
    //减一行
    deleteRows(index) {
@@ -1019,4 +1017,4 @@
.optionContent-suffix .optionContent-botton {
  margin-left: 10px;
}
</style>
</style>
src/views/exam/examSubjects.vue
@@ -2,7 +2,7 @@
 * @Author: Morpheus
 * @Date: 2021-07-05 16:31:54
 * @Last Modified by: Morpheus
 * @Last Modified time: 2021-07-18 15:47:06
 * @Last Modified time: 2021-11-05 12:02:20
 * menu-name 题目管理
 */
<template>
@@ -88,7 +88,6 @@
    data () {
        var validatePass = (rule, value, callback) => {
            console.log(value)
            if (value == undefined || value == '') {
                callback(new Error('请输入分数'));
                return;
@@ -291,7 +290,6 @@
        },
        questionBankRowSave (row, done, loading) {
            console.log(row, 898989);
            add(row).then(() => {
                this.initFlag = false;
src/views/exam/examination.vue
@@ -2,7 +2,7 @@
 * @Author: Morpheus
 * @Date: 2021-07-05 16:31:54
 * @Last Modified by: Morpheus
 * @Last Modified time: 2021-07-18 17:11:18
 * @Last Modified time: 2021-11-05 12:02:20
 * menu-name 试卷管理
 */
<template>
@@ -96,7 +96,6 @@
    data () {
        var validatePass = (rule, value, callback) => {
            console.log(value)
            if (value == undefined || value == '') {
                callback(new Error('请输入分数'));
                return;
src/views/exam/papers.vue
@@ -16,7 +16,6 @@
  created(){
      var d = this.$route.query;
      this.url += "?data=" + JSON.stringify(d);
      console.log(d,11);
  },
  mounted() {
    var flag = false,
@@ -39,4 +38,4 @@
</script>
<style>
</style>
</style>
src/views/exam/performance.vue
@@ -120,7 +120,6 @@
export default {
  data() {
    var validatePass = (rule, value, callback) => {
      console.log(value);
      if (value == undefined || value == "") {
        callback(new Error("请输入实操成绩"));
        return;
src/views/securityGuard/baoanz.vue
@@ -1,35 +1,44 @@
<template>
  <div class="baoanzheng-1" id="baoanzheng-1">
    <div class="baz-main-1" ref="baoanzheng1">
      <img class="baz-main-img1" :src="data.avatar" alt="" />
      <div class="baz-main-img1-2">
        <img class="baz-main-img1-2-i" :src="erweima" alt="" />
      </div>
      <div class="b-m-ups-1">
        {{ data.realName }}
      </div>
      <div class="b-m-ups-1">
        {{ data.$sex }}
      </div>
      <div class="b-m-ups-1 securitynumber-1">
        {{ data.securitynumber }}
      </div>
      <div class="b-m-ups-1 b-m-ups-2">
        <!-- {{ data.securitynumber }} -->南昌市公安局
      </div>
      <div class="b-m-ups-1 b-m-ups-2">
        {{ data.paperTime || "---" }}
      </div>
    <div class="baoanzheng-1"
         id="baoanzheng-1">
        <div class="baz-main-1"
             ref="baoanzheng1">
            <img class="baz-main-img1"
                 :src="data.avatar"
                 alt="" />
            <div class="baz-main-img1-2"
                 v-if='permission.securityGuard_workLicense'>
                <img class="baz-main-img1-2-i"
                     :src="erweima"
                     alt="" />
            </div>
            <div class="b-m-ups-1">
                {{ data.realName }}
            </div>
            <div class="b-m-ups-1">
                {{ data.$sex }}
            </div>
            <div class="b-m-ups-1 securitynumber-1">
                {{ data.securitynumber }}
            </div>
            <div class="b-m-ups-1 b-m-ups-2">
                <!-- {{ data.securitynumber }} -->南昌市公安局
            </div>
            <div class="b-m-ups-1 b-m-ups-2">
                {{ data.paperTime || "---" }}
            </div>
        </div>
        <span slot="footer"
              class="dialog-footer no-print PrintBut">
            <!-- v-show="closePrint != 1" -->
            <el-button v-show='false'
                       type="primary"
                       @click="Print">打 印</el-button>
            <el-button type="primary"
                       @click="closeME"
                       v-show="close == 1">返 回</el-button>
        </span>
    </div>
    <span slot="footer" class="dialog-footer no-print PrintBut">
      <el-button type="primary" @click="Print" v-show="closePrint != 1"
        >打 印</el-button
      >
      <el-button type="primary" @click="closeME" v-show="close == 1"
        >返 回</el-button
      >
    </span>
  </div>
</template>
<script>
@@ -42,97 +51,104 @@
//         }
//     })
// }
import { mapGetters } from "vuex";
import { getER } from "@/api/performance/performance";
export default {
  props: ["data", "close", "closePrint"],
  data() {
    return {
      erweima: "",
    };
  },
  mounted() {
    getER(this.data.securitynumber).then((res) => {
      this.erweima = res.data;
      // console.log(res.data);
    });
  },
  methods: {
    Print() {
      var printDom = document.getElementById("baoanzheng-1");
      printDom.style.position = "fixed";
      printDom.style.left = "-10%";
      printDom.style.width = "120%";
      printDom.style.height = "100%";
      this.$Print(this.$refs.baoanzheng1);
      printDom.style.position = "relative";
      printDom.style.left = "0";
      printDom.style.width = "100%";
      printDom.style.height = "calc(100% - 100px)";
    props: ["data", "close", "closePrint"],
    data () {
        return {
            erweima: "",
        };
    },
    closeME() {
      this.$emit("close");
    computed: {
        ...mapGetters(["userInfo", "permission"]),
    },
  },
    created () {
    },
    mounted () {
        getER(this.data.securitynumber).then((res) => {
            this.erweima = res.data;
            // console.log(res.data);
        });
    },
    methods: {
        Print () {
            var printDom = document.getElementById("baoanzheng-1");
            printDom.style.position = "fixed";
            printDom.style.left = "-10%";
            printDom.style.width = "120%";
            printDom.style.height = "100%";
            this.$Print(this.$refs.baoanzheng1);
            printDom.style.position = "relative";
            printDom.style.left = "0";
            printDom.style.width = "100%";
            printDom.style.height = "calc(100% - 100px)";
        },
        closeME () {
            this.$emit("close");
        },
    },
};
</script>
<style lang="scss" scoped>
//保安证
.baoanzheng-1 {
  width: 100%;
  height: 90%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  .baz-main-1 {
    background-image: url("/img/register/bazbj2.png");
    background-size: 100% 100%;
    width: calc(1274px * 0.5) !important;
    height: calc(828px * 0.5) !important;
    position: relative;
    margin-bottom: 10px;
    .baz-main-img1 {
      width: 170px;
      position: absolute;
      left: 51px;
      top: 57px;
      height: 237px;
    }
    .baz-main-img1-2 {
      width: 91px;
      position: absolute;
      left: 474px;
      // top: 120px;
      top: 78px;
      height: 93px;
      overflow: hidden;
      .baz-main-img1-2-i {
        width: 115px;
        height: 115px;
    width: 100%;
    height: 90%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    .baz-main-1 {
        background-image: url('/img/register/bazbj2.png');
        background-size: 100% 100%;
        width: calc(1274px * 0.5) !important;
        height: calc(828px * 0.5) !important;
        position: relative;
        top: -10px;
        left: -11px;
      }
        margin-bottom: 10px;
        .baz-main-img1 {
            width: 170px;
            position: absolute;
            left: 51px;
            top: 57px;
            height: 237px;
        }
        .baz-main-img1-2 {
            width: 91px;
            position: absolute;
            left: 474px;
            // top: 120px;
            top: 78px;
            height: 93px;
            overflow: hidden;
            .baz-main-img1-2-i {
                width: 115px;
                height: 115px;
                position: relative;
                top: -10px;
                left: -11px;
            }
        }
        .b-m-ups-1 {
            width: 50%;
            height: 30px;
            font-size: 22px;
            font-weight: 400;
            position: relative;
            top: 91px;
            left: 320px;
            margin-bottom: 21px;
        }
        // .securitynumber-1 {
        //   font-size: 22px;
        //   margin-bottom: 18px;
        // }
        .b-m-ups-2 {
            left: 358px;
        }
    }
    .b-m-ups-1 {
      width: 50%;
      height: 30px;
      font-size: 22px;
      font-weight: 400;
      position: relative;
      top: 91px;
      left: 320px;
      margin-bottom: 21px;
    }
    // .securitynumber-1 {
    //   font-size: 22px;
    //   margin-bottom: 18px;
    // }
    .b-m-ups-2 {
      left: 358px;
    }
  }
}
</style>
</style>
src/views/securityGuard/certificateOfPrint.vue
New file
@@ -0,0 +1,65 @@
<template>
    <el-row class='securityGuard'>
        <el-col :span="24">
            <basic-container>
                <securityCertificate :data="obj0"
                                     v-if="hold == 1"></securityCertificate>
                <div v-else
                     style="width: 100%; text-align: center; padding-top: 20px">
                    无保安员证
                </div>
            </basic-container>
        </el-col>
    </el-row>
</template>
<script>
import securityCertificate from "./securityCertificate.vue";
import baoanz from "./baoanz.vue";
export default {
    components: {
        securityCertificate: securityCertificate,
        baoanz,
    },
    data () {
        return {
            obj0: {
                title: "我是头部标题",
            },
            hold: "",
        };
    },
    mounted () {
        var data = JSON.parse(this.$route.query.row);
        if (data) {
            var row = data;
            for (var k in row) {
                this.obj0[k] = row[k];
            }
            this.obj0.title = "";
            this.hold = row.hold;
        }
        var flag = false,
            i = 0,
            ind = null;
        this.$store.state.tags.tagList.forEach((item, index) => {
            if (item.label == "纸质证书制作") {
                if (flag == false) {
                    ind = index;
                    flag = true;
                }
                i++;
            }
        });
        if (i > 1) {
            this.$store.state.tags.tagList.splice(ind, 1);
        }
    },
};
</script>
<style lang="scss">
</style>
src/views/securityGuard/data.js
@@ -1,314 +1,314 @@
//保安员基本信息
export var securityBaseInfoColumn = [{
    label: "",
    labelWidth: "20",
    type: 'title',
    prop: "title",
    span: 24,
    styles: {
        fontSize: '24px'
    }
},
{
    label: "所属保安公司",
    prop: "deptId",
    type: "tree",
    dicUrl: "/api/blade-system/dept/security_lazy-tree?parentId=1413470343230877697",
    // dicUrl: "/api/blade-system/dept/lazy-tree?parentId=0",
    props: {
        label: "title",
        value: "id",
    },
    disabled: true,
    span: 24,
},
{
    label: "登录账号",
    prop: "account",
    disabled: true
},
{
    label: "用户姓名",
    prop: "realName",
    disabled: true,
},
{
    label: "用户昵称",
    prop: "name",
    disabled: true
},
{
    label: "手机号码",
    prop: "phone",
    disabled: true
},
{
    label: "电子邮箱",
    prop: "email",
    disabled: true
},
{
    label: "身份证号",
    prop: "cardid",
    disabled: true
},
{
    label: "籍贯",
    prop: "nativeplace",
    disabled: true
},
{
    label: "民族",
    prop: "nation",
    disabled: true
},
{
    label: "是否持证",
    prop: "hold",
    dicUrl: "/api/blade-system/dict-biz/dictionary?code=equipage",
    props: {
        label: "dictValue",
        value: "dictKey",
    },
    type: "select",
    disabled: true
},
{
    label: "保安员证编号",
    prop: "securitynumber",
    disabled: true
},
{
    label: "所属辖区",
    prop: "jurisdiction",
    // multiple: true,
    type: "tree",
    dicUrl: "/api/jurisdiction/lazy-tree",
    props: {
        label: "title",
        value: "id",
    },
    disabled: true
},
{
    label: "最高学历",
    prop: "education",
    type: "select",
    dicUrl: "/api/blade-system/dict-biz/dictionary?code=educationType",
    props: {
        label: "dictValue",
        value: "dictKey"
    },
    dataType: "number",
    slot: true,
    disabled: true
},
{
    label: "政治面貌",
    prop: "politicaloutlook",
    disabled: true
},
{
    label: "身高",
    prop: "height",
    disabled: true
},
{
    label: "联系地址",
    prop: "address",
    disabled: true
},
{
    label: "户口所在地",
    prop: "registered",
    disabled: true
},
{
    label: "入职时间",
    prop: "rtime",
    type: 'date',
    format: "yyyy-MM-dd",
    valueFormat: "yyyy-MM-dd",
    disabled: true
},
{
    label: "用户性别",
    prop: "sex",
    type: "select",
    dicData: [{
        label: "男",
        value: 1
        label: "",
        labelWidth: "20",
        type: 'title',
        prop: "title",
        span: 24,
        styles: {
            fontSize: '24px'
        }
    },
    {
        label: "女",
        value: 2
        label: "所属保安公司",
        prop: "deptId",
        type: "tree",
        dicUrl: "/api/blade-system/dept/security_lazy-tree?parentId=1413470343230877697",
        // dicUrl: "/api/blade-system/dept/lazy-tree?parentId=0",
        props: {
            label: "title",
            value: "id",
        },
        disabled: true,
        span: 24,
    },
    {
        label: "未知",
        value: 3
        label: "登录账号",
        prop: "account",
        disabled: true
    },
    {
        label: "用户姓名",
        prop: "realName",
        disabled: true,
    },
    {
        label: "用户昵称",
        prop: "name",
        disabled: true
    },
    {
        label: "手机号码",
        prop: "phone",
        disabled: true
    },
    {
        label: "电子邮箱",
        prop: "email",
        disabled: true
    },
    {
        label: "身份证号",
        prop: "cardid",
        disabled: true
    },
    {
        label: "籍贯",
        prop: "nativeplace",
        disabled: true
    },
    {
        label: "民族",
        prop: "nation",
        disabled: true
    },
    {
        label: "是否持证",
        prop: "hold",
        dicUrl: "/api/blade-system/dict-biz/dictionary?code=equipage",
        props: {
            label: "dictValue",
            value: "dictKey",
        },
        type: "select",
        disabled: true
    },
    {
        label: "保安员证编号",
        prop: "securitynumber",
        disabled: true
    },
    {
        label: "所属辖区",
        prop: "jurisdiction",
        // multiple: true,
        type: "tree",
        dicUrl: "/api/jurisdiction/lazy-tree",
        props: {
            label: "title",
            value: "id",
        },
        disabled: true
    },
    {
        label: "最高学历",
        prop: "education",
        type: "select",
        dicUrl: "/api/blade-system/dict-biz/dictionary?code=educationType",
        props: {
            label: "dictValue",
            value: "dictKey"
        },
        dataType: "number",
        slot: true,
        disabled: true
    },
    {
        label: "政治面貌",
        prop: "politicaloutlook",
        disabled: true
    },
    {
        label: "身高",
        prop: "height",
        disabled: true
    },
    {
        label: "联系地址",
        prop: "address",
        disabled: true
    },
    {
        label: "户口所在地",
        prop: "registered",
        disabled: true
    },
    {
        label: "入职时间",
        prop: "rtime",
        type: 'date',
        format: "yyyy-MM-dd",
        valueFormat: "yyyy-MM-dd",
        disabled: true
    },
    {
        label: "用户性别",
        prop: "sex",
        type: "select",
        dicData: [{
                label: "男",
                value: 1
            },
            {
                label: "女",
                value: 2
            },
            {
                label: "未知",
                value: 3
            }
        ],
        disabled: true
    },
    {
        label: "用户生日",
        type: "date",
        prop: "birthday",
        disabled: true
    }
    ],
    disabled: true
},
{
    label: "用户生日",
    type: "date",
    prop: "birthday",
    disabled: true
}
]
export var securityBaseInfoColumns = [{
    label: "所属保安单位",
    prop: "tenantId",
    type: "tree",
    dicUrl: "/api/blade-system/tenant/select",
    props: {
        label: "tenantName",
        value: "tenantId"
    },
    disabled: true,
    span: 24,
},
{
    label: "登录账号",
    prop: "account",
    disabled: true
},
{
    label: "用户姓名",
    prop: "realName",
    rules: [{
        required: true,
        message: "请输入用户姓名",
        trigger: "blur"
    }, {
        min: 2,
        max: 5,
        message: '姓名长度在2到5个字符'
    }]
},
{
    label: "用户昵称",
    prop: "name"
},
{
    label: "手机号码",
    prop: "phone",
    overHidden: true,
    rules: [{
        required: true,
        message: "请输入手机号",
        trigger: "blur"
    }]
},
{
    label: "电子邮箱",
    prop: "email",
    hide: true,
    overHidden: true
},
{
    label: "身份证号",
    prop: "cardid",
    hide: true,
    overHidden: true,
    rules: [{
        required: true,
        message: "请输入身份证号",
        trigger: "blur"
    }]
},
{
    label: "籍贯",
    prop: "nativeplace",
    hide: true,
    overHidden: true
},
{
    label: "民族",
    prop: "nation",
    hide: true,
    overHidden: true
},
{
    label: "最高学历",
    prop: "education",
    type: "select",
    dicUrl: "/api/blade-system/dict-biz/dictionary?code=educationType",
    props: {
        label: "dictValue",
        value: "dictKey"
    },
    dataType: "number",
    slot: true,
    rules: [{
        required: true,
        message: "请选择学历",
        trigger: "blur"
    }]
},
{
    label: "政治面貌",
    prop: "politicaloutlook",
    hide: true,
    overHidden: true
},
{
    label: "身高",
    prop: "height",
    hide: true,
    overHidden: true
},
{
    label: "联系地址",
    prop: "address",
    hide: true,
    overHidden: true
},
{
    label: "户口所在地",
    prop: "registered",
    hide: true,
    overHidden: true
},
{
    label: "入职时间",
    prop: "rtime",
    type: 'date',
    format: "yyyy-MM-dd",
    valueFormat: "yyyy-MM-dd",
    hide: true,
    overHidden: true
},
{
    label: "用户性别",
    prop: "sex",
    type: "select",
    dicData: [{
        label: "男",
        value: 1
        label: "所属保安单位",
        prop: "tenantId",
        type: "tree",
        dicUrl: "/api/blade-system/tenant/select",
        props: {
            label: "tenantName",
            value: "tenantId"
        },
        disabled: true,
        span: 24,
    },
    {
        label: "女",
        value: 2
        label: "登录账号",
        prop: "account",
        disabled: true
    },
    {
        label: "未知",
        value: 3
        label: "用户姓名",
        prop: "realName",
        rules: [{
            required: true,
            message: "请输入用户姓名",
            trigger: "blur"
        }, {
            min: 2,
            max: 5,
            message: '姓名长度在2到5个字符'
        }]
    },
    {
        label: "用户昵称",
        prop: "name"
    },
    {
        label: "手机号码",
        prop: "phone",
        overHidden: true,
        rules: [{
            required: true,
            message: "请输入手机号",
            trigger: "blur"
        }]
    },
    {
        label: "电子邮箱",
        prop: "email",
        hide: true,
        overHidden: true
    },
    {
        label: "身份证号",
        prop: "cardid",
        hide: true,
        overHidden: true,
        rules: [{
            required: true,
            message: "请输入身份证号",
            trigger: "blur"
        }]
    },
    {
        label: "籍贯",
        prop: "nativeplace",
        hide: true,
        overHidden: true
    },
    {
        label: "民族",
        prop: "nation",
        hide: true,
        overHidden: true
    },
    {
        label: "最高学历",
        prop: "education",
        type: "select",
        dicUrl: "/api/blade-system/dict-biz/dictionary?code=educationType",
        props: {
            label: "dictValue",
            value: "dictKey"
        },
        dataType: "number",
        slot: true,
        rules: [{
            required: true,
            message: "请选择学历",
            trigger: "blur"
        }]
    },
    {
        label: "政治面貌",
        prop: "politicaloutlook",
        hide: true,
        overHidden: true
    },
    {
        label: "身高",
        prop: "height",
        hide: true,
        overHidden: true
    },
    {
        label: "联系地址",
        prop: "address",
        hide: true,
        overHidden: true
    },
    {
        label: "户口所在地",
        prop: "registered",
        hide: true,
        overHidden: true
    },
    {
        label: "入职时间",
        prop: "rtime",
        type: 'date',
        format: "yyyy-MM-dd",
        valueFormat: "yyyy-MM-dd",
        hide: true,
        overHidden: true
    },
    {
        label: "用户性别",
        prop: "sex",
        type: "select",
        dicData: [{
                label: "男",
                value: 1
            },
            {
                label: "女",
                value: 2
            },
            {
                label: "未知",
                value: 3
            }
        ],
        hide: true
    },
    {
        label: "用户生日",
        type: "date",
        prop: "birthday",
        hide: true
    }
    ],
    hide: true
},
{
    label: "用户生日",
    type: "date",
    prop: "birthday",
    hide: true
}
]
@@ -400,62 +400,62 @@
//表现
export var trackRecordColumn = [{
    label: "id",
    prop: "id",
    hide: true,
    editDisplay: false,
    addDisplay: false
}, {
    label: '时间',
    type: 'date',
    format: "yyyy-MM-dd",
    valueFormat: "yyyy-MM-dd",
    prop: "time",
    formslot: true,
},
// {
//     label: '工作态度',
//     prop: "workingattitude",
//     formslot: true,
// },
{
    label: '工作表现',
    prop: "achievements",
    formslot: true,
}, {
    label: '表现评定',
    prop: "score",
    type: "select",
    // dicUrl: "/api/blade-system/dict-biz/dictionary?code=scoreType",
    // props: {
    //     label: "dictValue",
    //     value: "dictKey"
        label: "id",
        prop: "id",
        hide: true,
        editDisplay: false,
        addDisplay: false
    }, {
        label: '时间',
        type: 'date',
        format: "yyyy-MM-dd",
        valueFormat: "yyyy-MM-dd",
        prop: "time",
        formslot: true,
    },
    // {
    //     label: '工作态度',
    //     prop: "workingattitude",
    //     formslot: true,
    // },
    dicData: [{
        label: "优秀",
        value: 0
    },
    {
        label: "良好",
        value: 1
    },
    {
        label: "一般",
        value: 2
    },
    {
        label: "差",
        value: 3
    },
    ],
    dataType: "number",
    slot: true,
    rules: [{
        required: true,
        message: "请选择表现",
        trigger: "blur"
    }]
}
        label: '工作表现',
        prop: "achievements",
        formslot: true,
    }, {
        label: '表现评定',
        prop: "score",
        type: "select",
        // dicUrl: "/api/blade-system/dict-biz/dictionary?code=scoreType",
        // props: {
        //     label: "dictValue",
        //     value: "dictKey"
        // },
        dicData: [{
                label: "优秀",
                value: 0
            },
            {
                label: "良好",
                value: 1
            },
            {
                label: "一般",
                value: 2
            },
            {
                label: "差",
                value: 3
            },
        ],
        dataType: "number",
        slot: true,
        rules: [{
            required: true,
            message: "请选择表现",
            trigger: "blur"
        }]
    }
    // {
    //     label: '服务公司',
    //     prop: "departmentName",
@@ -465,274 +465,303 @@
export var securityFormPageColumn = [{
    label: "姓名",
    prop: "realName",
    search: true,
    searchSpan: 3,
    width: 60,
    searchLabelWidth: 50,
    display: false
},
// {
//     label: "温馨提示",
//     prop: "realName1",
//     hide: true,
//     addDisplay: true,
//     editDisplay: false,
//     span: 24,
//     value: "账号为身份证号码,密码为身份证后六位",
//     addDisabled: true
//     // search: true,
//     // searchSpan: 3,
//     // width: 60,
//     // searchLabelWidth: 50,
// },
{
    label: "所属保安公司",
    searchLabelWidth: "110",
    // prop: "deptName",
    prop: "deptId",
    type: "tree",
    dicUrl: "/api/blade-system/dept/security_lazy-tree?parentId=1413470343230877697",
    props: {
        label: "title",
        value: "id",
        label: "姓名",
        prop: "realName",
        search: true,
        searchSpan: 3,
        width: 60,
        searchLabelWidth: 50,
        display: false
    },
    // hide: true,
    slot: true,
    searchSpan: 5,
    display: false,
    search: true,
    minWidth: 260
},
// {
//     label: "所属保安公司",
//     searchLabelWidth: "110",
//     prop: "deptName",
//     // type: "tree",
//     // dicUrl: "/api/blade-system/dept/security_lazy-tree?parentId=1413470343230877697",
//     // props: {
//     //     label: "title",
//     //     value: "id",
//     // },
//     // slot: true,
//     // searchSpan: 5,
//     display: false,
//     // search: true,
//     minWidth: 260
// },
{
    label: "性别",
    prop: "sex",
    width: 80,
    type: "select",
    dicData: [{
        label: "男",
        value: 1,
    // {
    //     label: "温馨提示",
    //     prop: "realName1",
    //     hide: true,
    //     addDisplay: true,
    //     editDisplay: false,
    //     span: 24,
    //     value: "账号为身份证号码,密码为身份证后六位",
    //     addDisabled: true
    //     // search: true,
    //     // searchSpan: 3,
    //     // width: 60,
    //     // searchLabelWidth: 50,
    // },
    {
        label: "所属保安公司",
        searchLabelWidth: "110",
        // prop: "deptName",
        prop: "deptId",
        type: "tree",
        dicUrl: "/api/blade-system/dept/security_lazy-tree?parentId=1413470343230877697",
        props: {
            label: "title",
            value: "id",
        },
        // hide: true,
        slot: true,
        searchSpan: 5,
        display: false,
        search: true,
        minWidth: 260
    },
    // {
    //     label: "所属保安公司",
    //     searchLabelWidth: "110",
    //     prop: "deptName",
    //     // type: "tree",
    //     // dicUrl: "/api/blade-system/dept/security_lazy-tree?parentId=1413470343230877697",
    //     // props: {
    //     //     label: "title",
    //     //     value: "id",
    //     // },
    //     // slot: true,
    //     // searchSpan: 5,
    //     display: false,
    //     // search: true,
    //     minWidth: 260
    // },
    {
        label: "性别",
        prop: "sex",
        width: 80,
        type: "select",
        dicData: [{
                label: "男",
                value: 1,
            },
            {
                label: "女",
                value: 2,
            },
            // {
            //     label: "未知",
            //     value: 3,
            // },
        ],
        display: false
    },
    {
        label: "女",
        value: 2,
        label: "身份证号码",
        prop: "cardid",
        search: true,
        searchLabelWidth: 90,
        searchSpan: 5,
        minWidth: 140,
        display: false
    },
        // {
        //     label: "未知",
        //     value: 3,
        // },
    ],
    display: false
},
{
    label: "身份证号码",
    prop: "cardid",
    search: true,
    searchLabelWidth: 90,
    searchSpan: 5,
    minWidth: 140,
    display: false
},
{
    label: "籍贯",
    prop: "nativeplace",
    hide: true,
    display: false
},
{
    label: "民族",
    prop: "nation",
    hide: true,
    width: 55,
    display: false
},
{
    label: "出生日期",
    prop: "birthday",
    type: "date",
    format: "yyyy-MM-dd",
    valueFormat: "yyyy-MM-dd",
    display: false,
    hide: true,
},
{
    label: "年龄",
    prop: "age",
    width: 55,
    display: false
},
{
    label: "学历",
    prop: "education",
    display: false,
    width: 90,
    dicUrl: "/api/blade-system/dict-biz/dictionary?code=educationType",
    props: {
        label: "dictValue",
        value: "dictKey"
    {
        label: "籍贯",
        prop: "nativeplace",
        hide: true,
        display: false
    },
    type: "select",
    // hide: true,
    rules: [{
        required: true,
        message: "请选择学历",
        trigger: "blur"
    }],
},
{
    label: "联系电话",
    prop: "phone",
    minWidth: 100,
    display: false
},
{
    label: "健康状态",
    prop: "healstats",
    hide: true,
    display: false
},
{
    label: "保安证编号",
    prop: "securitynumber",
    search: true,
    searchLabelWidth: 90,
    minWidth: 105,
    searchSpan: 4,
    addDisplay: false,
    editDisplay: false,
    // hide: true,
},
{
    label: "入职时间",
    prop: "rtime",
    hide: true,
    display: false
},
// {
//     label: "是否派遣",
//     prop: "dispatch",
//     // hide: true,
//     type: 'select',
//     // display: false,
//     dicData: [
//         {
//             label: '未派遣',
//             value: 1
//         }, {
//             label: '已派遣',
//             value: 0
//         }
//     ]
// },
{
    label: '是否派遣',
    prop: 'dispatch',
    type: 'select',
    editDisplay: false,
    addDisplay: false,
    dicData: [{
        label: '未派遣',
        value: '1'
    }, {
        label: '已派遣',
        value: '0'
    }]
},
{
    label: "是否持证",
    prop: "hold",
    slot: true,
    search: true,
    searchSpan: 3,
    width: 69,
    type: "select",
    dicData: [
        {
            label: "是",
            value: "1",
    {
        label: "民族",
        prop: "nation",
        hide: true,
        width: 55,
        display: false
    },
    {
        label: "出生日期",
        prop: "birthday",
        type: "date",
        format: "yyyy-MM-dd",
        valueFormat: "yyyy-MM-dd",
        display: false,
        hide: true,
    },
    {
        label: "年龄",
        prop: "age",
        width: 55,
        display: false
    },
    {
        label: "学历",
        prop: "education",
        display: false,
        width: 90,
        dicUrl: "/api/blade-system/dict-biz/dictionary?code=educationType",
        props: {
            label: "dictValue",
            value: "dictKey"
        },
        {
            label: "否",
            value: "2",
        },
        {
            label: "已吊销",
            value: "3",
        },
    ],
    display: false,
    // dicUrl: "/api/blade-system/dict-biz/dictionary?code=equipage",
    // props: {
    //     label: "dictValue",
    //     value: "dictKey"
        type: "select",
        // hide: true,
        rules: [{
            required: true,
            message: "请选择学历",
            trigger: "blur"
        }],
    },
    {
        label: "联系电话",
        prop: "phone",
        minWidth: 100,
        display: false
    },
    {
        label: "健康状态",
        prop: "healstats",
        hide: true,
        display: false
    },
    {
        label: "保安证编号",
        prop: "securitynumber",
        search: true,
        searchLabelWidth: 90,
        minWidth: 105,
        searchSpan: 4,
        addDisplay: false,
        editDisplay: false,
        // hide: true,
    },
    {
        label: "入职时间",
        prop: "rtime",
        hide: true,
        display: false
    },
    // {
    //     label: "是否派遣",
    //     prop: "dispatch",
    //     // hide: true,
    //     type: 'select',
    //     // display: false,
    //     dicData: [
    //         {
    //             label: '未派遣',
    //             value: 1
    //         }, {
    //             label: '已派遣',
    //             value: 0
    //         }
    //     ]
    // },
    // type: "select",
    rules: [{
        required: true,
        message: "请选择",
        trigger: "blur"
    }],
},
// {
//     label: "发证日期",
//     prop: "papertime",
//     type: "date",
//     format: "yyyy-MM-dd",
//     valueFormat: "yyyy-MM-dd",
//     // searchRange: true,
//     // searchSpan: 6,
//     // hide: true,
//     // addDisplay: false,
//     // editDisplay: false,
//     // viewDisplay: false,
//     // search: true,
//     // rules: [{
//     //     required: true,
//     //     message: "请输入时间",
//     //     trigger: "blur"
//     // }]
// },
{
    label: "在职状态",
    prop: "status",
    type: "select",
    dicUrl: "/api/blade-system/dict-biz/dictionary?code=workerState",
    props: {
        label: "dictValue",
        value: "dictKey"
    {
        label: '是否派遣',
        prop: 'dispatch',
        type: 'select',
        editDisplay: false,
        addDisplay: false,
        dicData: [{
            label: '未派遣',
            value: '1'
        }, {
            label: '已派遣',
            value: '0'
        }]
    },
    dataType: "number",
    searchValue: 1,
    display: false,
    hide: true,
    searchSpan: 3,
    width: 80,
    search: true,
    rules: [{
        required: true,
        message: "请选择在职状态",
        trigger: "blur"
    }]
},
    {
        label: "是否持证",
        prop: "hold",
        slot: true,
        search: true,
        searchSpan: 3,
        width: 69,
        type: "select",
        dicData: [{
                label: "是",
                value: "1",
            },
            {
                label: "否",
                value: "2",
            },
            {
                label: "已吊销",
                value: "3",
            },
        ],
        display: false,
        // dicUrl: "/api/blade-system/dict-biz/dictionary?code=equipage",
        // props: {
        //     label: "dictValue",
        //     value: "dictKey"
        // },
        // type: "select",
        rules: [{
            required: true,
            message: "请选择",
            trigger: "blur"
        }],
    },
    {
        label: "是否制证",
        prop: "userType",
        // dicUrl: "/api/blade-system/dict-biz/dictionary?code=equipage",
        // props: {
        //   label: "dictValue",
        //   value: "dictKey",
        // },
        type: "select",
        slot: true,
        search: true,
        // searchValue: 7,
        searchSpan: 3,
        width: 69,
        dicData: [{
                label: "已制证",
                value: 6,
            },
            {
                label: "未制证",
                value: 7,
            }
        ],
        rules: [{
            required: true,
            message: "请选择",
            trigger: "blur",
        }, ],
    },
    // {
    //     label: "发证日期",
    //     prop: "papertime",
    //     type: "date",
    //     format: "yyyy-MM-dd",
    //     valueFormat: "yyyy-MM-dd",
    //     // searchRange: true,
    //     // searchSpan: 6,
    //     // hide: true,
    //     // addDisplay: false,
    //     // editDisplay: false,
    //     // viewDisplay: false,
    //     // search: true,
    //     // rules: [{
    //     //     required: true,
    //     //     message: "请输入时间",
    //     //     trigger: "blur"
    //     // }]
    // },
    {
        label: "在职状态",
        prop: "status",
        type: "select",
        dicUrl: "/api/blade-system/dict-biz/dictionary?code=workerState",
        props: {
            label: "dictValue",
            value: "dictKey"
        },
        dataType: "number",
        searchValue: 1,
        display: false,
        hide: true,
        searchSpan: 3,
        width: 80,
        search: true,
        rules: [{
            required: true,
            message: "请选择在职状态",
            trigger: "blur"
        }]
    },
]
src/views/securityGuard/securityCertificate.vue
@@ -1,131 +1,190 @@
<template>
  <div class="securityCertificate" id="securityCertificate">
    <div class="security_main" ref="securityCertificate">
      <!-- 标题 -->
      <div class="security_main_backImge no-print"></div>
      <div class="security_main-title no-print">
        &nbsp;&nbsp;&nbsp;
        <span style="letter-spacing: 0px">____________</span>
        经国家<br />保安员考试审查合格。<br />特颁此证。
      </div>
      <div class="security_m_l_center no-print">
        发证公安机关&nbsp;(印章)<br />
        发证日期
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;年&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;月
      </div>
      <div class="security_m_l_down no-print">证件编号</div>
      <div class="security_m_r_a no-print">姓名</div>
      <div class="security_m_r_b no-print">出生年月</div>
      <div class="security_m_r_c no-print">地址</div>
      <div class="security_m_r_d no-print">公民身份<br />号码</div>
      <!-- 内容 -->
      <div class="security_m_r_imgs no-print">
        <div v-if="!data.avatar">暂无照片</div>
        <img :src="data.avatar" alt="" v-else />
      </div>
      <div class="security_m_l_titleName widt">{{ data.realName }}</div>
      <div class="security_m_l_titlepaperTimenian widt">
        {{ data.paperTime.slice(0, 4) }}
      </div>
      <div class="security_m_l_titlepaperTimeyue widt">
        {{ data.paperTime.slice(5, 7) }}
      </div>
      <!-- <div class="security_m_l_titlepaperTimeri">
    <div class="securityCertificate"
         id="securityCertificate">
        <div class="security_main"
             ref="securityCertificate">
            <!-- 标题 -->
            <div class="security_main_backImge no-print"></div>
            <div class="security_main-title no-print">
                &nbsp;&nbsp;&nbsp;
                <span style="letter-spacing: 0px">____________</span>
                经国家<br />保安员考试审查合格。<br />特颁此证。
            </div>
            <div class="security_m_l_center no-print">
                发证公安机关&nbsp;(印章)<br />
                发证日期
                &nbsp;&nbsp;年&nbsp;月
            </div>
            <div class="security_m_l_down no-print">证件编号</div>
            <div class="security_m_r_a no-print">姓名</div>
            <div class="security_m_r_b no-print">出生年月</div>
            <div class="security_m_r_c no-print">地址</div>
            <div class="security_m_r_d no-print">公民身份<br />号码</div>
            <!-- 内容 -->
            <div class="security_m_r_imgs no-print">
                <div v-if="!data.avatar">暂无照片</div>
                <img :src="data.avatar"
                     alt=""
                     v-else />
            </div>
            <div class="security_m_l_titleName widt">{{ data.realName }}</div>
            <div class="security_m_l_titlepaperTimenian widt">
                {{ year }}
            </div>
            <div class="security_m_l_titlepaperTimeyue widt">
                {{ month }}
            </div>
            <!-- <div class="security_m_l_titlepaperTimeri">
        {{ data.paperTime.slice(8, 10) }}
      </div> -->
      <div class="security_m_l_downsecuritynumber widt">
        {{ data.securitynumber }}
      </div>
      <div class="security_m_r_o_right widt">{{ data.realName }}</div>
      <div class="security_m_r_o_rightbirthday widt">
        {{ data.cardid.slice(6, 10) }}. {{ data.cardid.slice(10, 12) }}.
        {{ data.cardid.slice(12, 14) }}
      </div>
      <div class="security_m_r_o_rightaddress security_m_r_o_l_r widt">
        {{ data.address }}
      </div>
      <div class="security_m_r_o_rightcardid">{{ data.cardid }}</div>
            <div class="security_m_l_downsecuritynumber widt">
                {{ data.securitynumber }}
            </div>
            <div class="security_m_r_o_right widt">{{ data.realName }}</div>
            <div class="security_m_r_o_rightbirthday widt">
                {{ data.cardid.slice(6, 10) }}.{{ data.cardid.slice(10, 12) }}.{{ data.cardid.slice(12, 14) }}
            </div>
            <div class="security_m_r_o_rightaddress security_m_r_o_l_r widt">
                {{ data.registered }}
            </div>
            <div class="security_m_r_o_rightcardid">{{ data.cardid }}</div>
        </div>
        <span slot="footer"
              class="dialog-footer no-print PrintBut"
              v-if='permission.securityGuard_securityCertificate'>
            <el-button type="primary"
                       @click="Print">打 印</el-button>
        </span>
    </div>
    <span slot="footer" class="dialog-footer no-print PrintBut">
      <el-button type="primary" @click="Print">打 印</el-button>
    </span>
  </div>
</template>
<script>
import { mapGetters } from "vuex";
import dictVertical from "../util/demo/dict-vertical.vue";
import {
  updatePaperTime
} from "@/api/system/user";
export default {
  components: { dictVertical },
  props: ["data"],
  methods: {
    Print() {
      var printDom = document.getElementById("securityCertificate");
      printDom.style.position = "fixed";
      printDom.style.top = "-26%";
      printDom.style.left = "-12%";
      printDom.style.width = "120%";
      printDom.style.height = "100%";
      this.$Print(this.$refs.securityCertificate);
      printDom.style.position = "relative";
      printDom.style.left = "0";
      printDom.style.width = "100%";
      printDom.style.height = "auto";
    data () {
        return {
            year: null,
            month: null
        }
    },
  },
    components: { dictVertical },
    props: ["data"],
    created () {
        var time = this.getNewTime()
        this.year = time[0]
        this.month = time[1]
    },
    computed: {
        ...mapGetters(["userInfo", "permission"]),
    },
    methods: {
        Print () {
            if (this.data.registered == '' || this.data.registered == null) {
                this.$message({ message: '请完善住址信息', type: 'warning' })
                return
            }
            //更新发证时间
            this.updateUserInfo();
            var printDom = document.getElementById("securityCertificates");
            console.log(printDom)
            printDom.style.position = "fixed";
            printDom.style.top = "-28.5%";
            printDom.style.left = "-23%";
            printDom.style.width = "120%";
            printDom.style.height = "100%";
            printDom.style.fontFamily = "SimSun";
            this.$Print(this.$refs.securityCertificate);
            printDom.style.position = "relative";
            printDom.style.left = "0";
            printDom.style.width = "100%";
            printDom.style.height = "auto";
        },
        getNewTime () {
            var nowTime = new Date()
            var oneHoursAgo = new Date(new Date(nowTime).getTime() - 1 * 60 * 60 * 1000)
            var oneHoursAgoY = oneHoursAgo.getFullYear()
            var oneHoursAgoM = oneHoursAgo.getMonth() + 1 < 10 ? '0' + (oneHoursAgo.getMonth() + 1) : oneHoursAgo.getMonth() + 1
            /**
             * @return 返回1小时,2小时,3小时,4小时,24小时
             */
            return [oneHoursAgoY, oneHoursAgoM]
        },
        //更新用户发证时间
        updateUserInfo () {
            var nowTime = new Date()
            var oneHoursAgo = new Date(new Date(nowTime).getTime() - 1 * 60 * 60 * 1000)
            var oneHoursAgoY = oneHoursAgo.getFullYear()
            var oneHoursAgoM = oneHoursAgo.getMonth() + 1 < 10 ? '0' + (oneHoursAgo.getMonth() + 1) : oneHoursAgo.getMonth() + 1
            var day = oneHoursAgo.getDay();
            var date = oneHoursAgoY + "-" + oneHoursAgoM + "-" + day;
            const data = {
                id:this.data.id,
                rtime:this.data.rtime,
                userType:6,
                paperTime:date
            }
            updatePaperTime(data);
        }
    },
};
</script>
<style lang="scss" scoped>
//保安证  本子
.securityCertificate {
  width: 100%;
  height: 90%;
  background-color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
    width: 100%;
    height: 90%;
    background-color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    font: bold 18px 'SimSun' !important;
}
.security_main {
  width: 630px;
  height: 512px;
  //   border: 1px solid rgba($color: #a5a5a5, $alpha: 0.5);
  // display: flex;
  // align-items: center;
  // justify-content: space-around;
  // background-image: url(/img/securityCertificate/bazsss.png);
  // background-size: 100% 100%;
  // background-repeat: no-repeat;
  position: relative;
    width: 630px;
    height: 512px;
    //   border: 1px solid rgba($color: #a5a5a5, $alpha: 0.5);
    // display: flex;
    // align-items: center;
    // justify-content: space-around;
    // background-image: url(/img/securityCertificate/bazsss.png);
    // background-size: 100% 100%;
    // background-repeat: no-repeat;
    position: relative;
}
// 标题
$upTop: 55px;
$downTop: 228px; //整体高度
$upTop: 45px;
$downTop: 265px; //整体高度
//经国家保安员考试审查合格。<br />特颁此证。
.security_main-title {
  position: absolute;
  top: $upTop;
  left: 39px;
  line-height: 45px;
  font-size: 22px;
  font-weight: 300;
  letter-spacing: 3px;
    position: absolute;
    top: $upTop;
    left: 34px;
    line-height: 45px;
    letter-spacing: 3px;
}
//发证公安机关&nbsp;(印章)
.security_m_l_center {
  position: absolute;
  top: $downTop;
  left: 32px;
  font-size: 16px;
  line-height: 40px;
    position: absolute;
    top: 267px;
    left: 30px;
    line-height: 40px;
}
//证件编号 &nbsp;
.security_m_l_down {
  position: absolute;
  top: 421px;
  left: 32px;
  font-size: 24px;
  font-weight: 500;
    position: absolute;
    top: 370px;
    left: 32px;
}
$rightLeft: 343px;
@@ -135,156 +194,134 @@
$lineHigeht: 30px;
//姓名
.security_m_r_a {
  position: absolute;
  top: $downTop;
  left: $rightLeft;
  font-size: $rightFontSize;
  width: $rightWidth;
  text-align: justify;
  text-align-last: justify;
  font-weight: 500;
    position: absolute;
    top: $downTop;
    left: $rightLeft;
    width: $rightWidth;
    text-align: justify;
    text-align-last: justify;
}
//出生年月
.security_m_r_b {
  position: absolute;
  top: $downTop + $lineHigeht * 1;
  left: $rightLeft;
  font-size: $rightFontSize;
  width: $rightWidth;
  text-align: justify;
  text-align-last: justify;
    position: absolute;
    top: $downTop + $lineHigeht * 1;
    left: $rightLeft;
    width: $rightWidth;
    text-align: justify;
    text-align-last: justify;
}
//地址
.security_m_r_c {
  position: absolute;
  top: $downTop + $lineHigeht * 2;
  left: $rightLeft;
  font-size: $rightFontSize;
  width: $rightWidth;
  text-align: justify;
  text-align-last: justify;
    position: absolute;
    top: $downTop + $lineHigeht * 2;
    left: $rightLeft;
    width: $rightWidth;
    text-align: justify;
    text-align-last: justify;
}
//公民身份证
.security_m_r_d {
  position: absolute;
  top: $downTop + $lineHigeht * 4;
  left: $rightLeft;
  font-size: $rightFontSize;
  width: $rightWidth;
  text-align: justify;
  text-align-last: justify;
    position: absolute;
    top: 382px;
    left: $rightLeft;
    width: $rightWidth;
    text-align: justify;
    text-align-last: justify;
}
//照片
// width: calc(358px / 22px);
// height: calc(441px / 22px);
.security_m_r_imgs {
  width: calc(358px / 3);
  height: calc(441px / 3);
  position: absolute;
  top: $upTop;
  left: 421px;
  img {
    width: 100%;
    height: 100%;
  }
    width: calc(358px / 3);
    height: calc(441px / 3);
    position: absolute;
    top: $upTop;
    left: 421px;
    img {
        width: 100%;
        height: 100%;
    }
}
// 内容
// 抬头名字
.security_m_l_titleName {
  position: absolute;
  top: 13px;
  left: 44px;
  line-height: 45px;
  font-size: 17px;
  font-weight: 300;
  letter-spacing: 3px;
    position: absolute;
    top: 45px;
    left: 121px;
    line-height: 45px;
    letter-spacing: 3px;
}
//发证时间
$timeTop: 280px; //整体高度
$timeTop: 306px; //整体高度
//年
.security_m_l_titlepaperTimenian {
  position: absolute;
  top: $timeTop;
  left: 25px;
  font-size: 18px;
  line-height: 40px;
  // font-weight: 500;
    position: absolute;
    top: $timeTop;
    left: 107px;
    line-height: 40px;
}
//月
.security_m_l_titlepaperTimeyue {
  position: absolute;
  top: $timeTop;
  left: 75px;
  font-size: 18px;
  line-height: 40px;
  // font-weight: 500;
    position: absolute;
    top: $timeTop;
    left: 166px;
    line-height: 40px;
}
//日
.security_m_l_titlepaperTimeri {
  position: absolute;
  top: $timeTop;
  left: 164px;
  font-size: 18px;
  line-height: 40px;
  // font-weight: 500;
    position: absolute;
    top: $timeTop;
    left: 159px;
    line-height: 40px;
}
//证件编号
.security_m_l_downsecuritynumber {
  position: absolute;
  top: 357px; //整体高度
  left: 54px;
  font-size: 17px;
    position: absolute;
    top: 370px; //整体高度
    left: 145px;
}
//内容
// 姓名
$centerLeft: 365px;
$centerLeft: 458px;
.security_m_r_o_right {
  position: absolute;
  top: $downTop + 2px;
  left: $centerLeft;
  font-size: $rightFontSize;
  // width: $rightWidth;
  // font-weight: 500;
    position: absolute;
    top: $downTop + $lineHigeht * 0-2px;
    left: $centerLeft;
    // width: $rightWidth;
}
// 生日
.security_m_r_o_rightbirthday {
  position: absolute;
  top: $downTop + $lineHigeht * 1;
  left: $centerLeft;
  font-size: $rightFontSize;
  // width: $rightWidth;
  // font-weight: 500;
    position: absolute;
    top: $downTop + $lineHigeht * 1-4px;
    left: $centerLeft;
    // width: $rightWidth;
}
// 地址
.security_m_r_o_rightaddress {
  position: absolute;
  top: $downTop + $lineHigeht * 2 -5px;
  left: $centerLeft;
  font-size: 15px;
  width: 160px;
  // font-weight: 500;
    position: absolute;
    top: $downTop + $lineHigeht * 2 -6px;
    left: $centerLeft;
    width: 160px;
    font: bold 16px 'SimSun' !important;
}
// 身份证
.security_m_r_o_rightcardid {
  position: absolute;
  top: $downTop + $lineHigeht * 4 +8px;
  left: $centerLeft;
  font-size: $rightFontSize;
  // width: $rightWidth;
  // font-weight: 500;
    position: absolute;
    top: $downTop + $lineHigeht * 4+6px;
    left: $centerLeft;
    // width: $rightWidth;
}
//背景图
.security_main_backImge {
  position: absolute;
  width: 100%;
  height: 100%;
  background-image: url(/img/securityCertificate/bazsss.png);
  background-size: 100% 100%;
  background-repeat: no-repeat;
    position: absolute;
    width: 100%;
    height: 100%;
    background-image: url(/img/securityCertificate/bazsss.png);
    background-size: 100% 100%;
    background-repeat: no-repeat;
}
// .widt{
//   font-weight: 550;
// }
</style>
</style>
src/views/securityGuard/securityGuard.vue
@@ -1,316 +1,328 @@
<template>
  <el-row :class="{ securityGuard: isSecurity }">
    <el-col :span="0" style="display: none">
      <div class="box">
        <el-scrollbar>
          <basic-container>
            <avue-tree
              :option="treeOption"
              :data="treeData"
              @node-click="nodeClick"
            />
          </basic-container>
        </el-scrollbar>
      </div>
    </el-col>
    <el-col :span="24">
      <basic-container>
        <avue-crud
          :option="option"
          :search.sync="search"
          :table-loading="loading"
          :data="data"
          ref="crud"
          v-model="form"
          :permission="permissionList"
          @row-del="rowDel"
          :row-style="rowStyle"
          @row-save="rowSave"
          @row-update="rowUpdate"
          :before-open="beforeOpen"
          :page.sync="page"
          @search-change="searchChange"
          @search-reset="searchReset"
          @selection-change="selectionChange"
          @current-change="currentChange"
          @size-change="sizeChange"
          @refresh-change="refreshChange"
          @on-load="onLoad"
        >
          <!-- @row-update="rowUpdate" -->
          <template slot="menuLeft">
            <el-button
              type="success"
              size="small"
              plain
              icon="el-icon-upload2"
              v-if="permission.securityGuard_import"
              @click="handleImport1"
              >保安员批量导入
            </el-button>
            <el-button
              type="success"
              size="small"
              plain
              icon="el-icon-upload2"
              v-if="permission.securityGuard_import"
              @click="handleImport2"
              >个人照片批量上传
            </el-button>
            <el-button
              style="display:none"
              type="primary"
              size="small"
              plain
              v-if="permission.securityGuard_security_apply"
              icon="el-icon-s-promotion"
              @click="handleSecurityApply"
              >制证申请
            </el-button>
            <el-button
              type="danger"
              style="display: none"
              size="small"
              plain
              icon="el-icon-delete"
              @click="handleDelete"
              >注 销
            </el-button>
            <el-button
              type="info"
              style="display: none"
              size="small"
              plain
              v-if="permission.user_role"
              icon="el-icon-user"
              @click="handleGrant"
              >角色配置
            </el-button>
            <el-button
              type="info"
              style="display: none"
              size="small"
              plain
              v-if="permission.user_reset"
              icon="el-icon-refresh"
              @click="handleReset"
              >密码重置
            </el-button>
            <el-button
              type="info"
              style="display: none"
              size="small"
              plain
              v-if="userInfo.role_name.includes('admin')"
              icon="el-icon-setting"
              @click="handlePlatform"
              >平台配置
            </el-button>
            <el-button
              type="success"
              style="display: none"
              size="small"
              plain
              v-if="userInfo.role_name.includes('admin')"
              icon="el-icon-upload2"
              @click="handleImport"
              >导入
            </el-button>
            <el-button
              type="warning"
              style="display: none"
              size="small"
              plain
              v-if="userInfo.role_name.includes('admin')"
              icon="el-icon-download"
              @click="handleExport"
              >导出
            </el-button>
          </template>
    <el-row :class="{ securityGuard: isSecurity }">
          <template slot-scope="{ type, size, row }" slot="menu">
            <el-button
              icon="el-icon-s-custom"
              :size="size"
              :type="type"
              @click.stop="rowClick(row)"
              >查看
            </el-button>
            <el-button
              icon="el-icon-edit"
              :size="size"
              :type="type"
              v-if="permission.securityGuard_delete && row.status != 2"
              @click.stop="rowStatus(row)"
              >离职登记
            </el-button>
            <el-button
              icon="el-icon-edit"
              :size="size"
              :type="type"
              v-if="row.status == 2"
              @click.stop="rowDellook(row)"
              >离职查询
            </el-button>
            <el-button
              icon="el-icon-edit"
              :size="size"
              :type="type"
              v-if="permission.securityGuard_check"
              @click.stop="rowCheck(row)"
              >异常
            </el-button>
          </template>
        <el-col :span="0"
                style="display: none">
            <div class="box">
                <el-scrollbar>
                    <basic-container>
                        <avue-tree :option="treeOption"
                                   :data="treeData"
                                   @node-click="nodeClick" />
                    </basic-container>
                </el-scrollbar>
            </div>
        </el-col>
        <el-col :span="24">
            <basic-container>
                <avue-crud :option="option"
                           :search.sync="search"
                           :table-loading="loading"
                           :data="data"
                           ref="crud"
                           v-model="form"
                           :permission="permissionList"
                           @row-del="rowDel"
                           :row-style="rowStyle"
                           @row-save="rowSave"
                           @row-update="rowUpdate"
                           :before-open="beforeOpen"
                           :page.sync="page"
                           @search-change="searchChange"
                           @search-reset="searchReset"
                           @selection-change="selectionChange"
                           @current-change="currentChange"
                           @size-change="sizeChange"
                           @refresh-change="refreshChange"
                           @on-load="onLoad">
                    <!-- @row-update="rowUpdate" -->
                    <template slot="menuLeft">
                        <el-button type="success"
                                   size="small"
                                   plain
                                   icon="el-icon-upload2"
                                   v-if="permission.securityGuard_import"
                                   @click="handleImport1">保安员批量导入
                        </el-button>
                        <el-button type="success"
                                   size="small"
                                   plain
                                   icon="el-icon-upload2"
                                   v-if="permission.securityGuard_import"
                                   @click="handleImport2">个人照片批量上传
                        </el-button>
                        <el-button type="primary"
                                   size="small"
                                   plain
                                   v-if="permission.securityGuard_security_apply"
                                   icon="el-icon-s-promotion"
                                   @click="handleSecurityApply">上岗证制证申请
                        </el-button>
          <template slot-scope="{ row }" slot="sex">
            <el-tag v-if="row.sex == 1">男</el-tag>
            <el-tag v-if="row.sex == 2">女</el-tag>
          </template>
          <template slot-scope="{ row }" slot="deptId">
            <el-tag
              class="rowClickSelf"
              title="点击查看所属公司情况"
              @click="rowClickSelf(row.deptId)"
              >{{ row.deptName }}</el-tag
            >
          </template>
          <template slot-scope="{ row }" slot="tenantName">
            <el-tag>{{ row.tenantName }}</el-tag>
          </template>
          <template slot-scope="{ row }" slot="roleName">
            <el-tag>{{ row.roleName }}</el-tag>
          </template>
          <template slot-scope="{ row }" slot="deptName">
            <el-tag>{{ row.deptName }}</el-tag>
          </template>
          <template slot-scope="{ row }" slot="userTypeName">
            <el-tag>{{ row.userTypeName }}</el-tag>
          </template>
        </avue-crud>
        <el-dialog
          title="用户角色配置"
          append-to-body
          :visible.sync="roleBox"
          width="345px"
        >
          <el-tree
            :data="roleGrantList"
            show-checkbox
            check-strictly
            default-expand-all
            node-key="id"
            ref="treeRole"
            :default-checked-keys="roleTreeObj"
            :props="props"
          >
          </el-tree>
                        <el-button type="danger"
                                   style="display: none"
                                   size="small"
                                   plain
                                   icon="el-icon-delete"
                                   @click="handleDelete">注 销
                        </el-button>
                        <el-button type="info"
                                   style="display: none"
                                   size="small"
                                   plain
                                   v-if="permission.user_role"
                                   icon="el-icon-user"
                                   @click="handleGrant">角色配置
                        </el-button>
                        <el-button type="info"
                                   style="display: none"
                                   size="small"
                                   plain
                                   v-if="permission.user_reset"
                                   icon="el-icon-refresh"
                                   @click="handleReset">密码重置
                        </el-button>
                        <el-button type="info"
                                   style="display: none"
                                   size="small"
                                   plain
                                   v-if="userInfo.role_name.includes('admin')"
                                   icon="el-icon-setting"
                                   @click="handlePlatform">平台配置
                        </el-button>
                        <el-button type="success"
                                   style="display: none"
                                   size="small"
                                   plain
                                   v-if="userInfo.role_name.includes('admin')"
                                   icon="el-icon-upload2"
                                   @click="handleImport">导入
                        </el-button>
                        <el-button type="warning"
                                   style="display: none"
                                   size="small"
                                   plain
                                   v-if="userInfo.role_name.includes('admin')"
                                   icon="el-icon-download"
                                   @click="handleExport">导出
                        </el-button>
                    </template>
          <span slot="footer" class="dialog-footer">
            <el-button @click="roleBox = false">取 消</el-button>
            <el-button type="primary" @click="submitRole">确 定</el-button>
          </span>
        </el-dialog>
        <el-dialog
          title="用户数据导入"
          append-to-body
          :visible.sync="excelBox"
          width="555px"
        >
          <avue-form
            :option="excelOption"
            v-model="excelForm"
            :upload-after="uploadAfter"
          >
            <template slot="excelTemplate">
              <el-button type="primary" @click="handleTemplate">
                点击下载<i class="el-icon-download el-icon--right"></i>
              </el-button>
            </template>
          </avue-form>
        </el-dialog>
        <el-dialog
          title="用户平台配置"
          append-to-body
          :visible.sync="platformBox"
        >
          <avue-crud
            :option="platformOption"
            :table-loading="platformLoading"
            :data="platformData"
            ref="platformCrud"
            v-model="platformForm"
            :before-open="platformBeforeOpen"
            :page.sync="platformPage"
            :permission="platformPermissionList"
            @row-update="platformRowUpdate"
            @search-change="platformSearchChange"
            @search-reset="platformSearchReset"
            @selection-change="platformSelectionChange"
            @current-change="platformCurrentChange"
            @size-change="platformSizeChange"
            @refresh-change="platformRefreshChange"
            @on-load="platformOnLoad"
          >
            <template slot-scope="{ row }" slot="tenantName">
              <el-tag>{{ row.tenantName }}</el-tag>
            </template>
            <template slot-scope="{ row }" slot="userTypeName">
              <el-tag>{{ row.userTypeName }}</el-tag>
            </template>
          </avue-crud>
        </el-dialog>
        <el-dialog
          title="保安员导入"
          append-to-body
          :visible.sync="excelBox1"
          width="555px"
        >
          <avue-form
            :option="excelOption1"
            v-model="excelForm1"
            :upload-after="uploadAfter1"
          >
            <template slot="excelTemplate">
              <el-button type="primary" @click="handleTemplate1">
                点击下载<i class="el-icon-download el-icon--right"></i>
              </el-button>
            </template>
          </avue-form>
        </el-dialog>
        <el-dialog
          title="个人照片批量上传"
          append-to-body
          :visible.sync="excelBox2"
          width="555px"
        >
          <avue-form
            :option="excelOption2"
            v-model="excelForm2"
            :upload-after="uploadAfter2"
          >
          </avue-form>
        </el-dialog>
      </basic-container>
    </el-col>
  </el-row>
                    <template slot-scope="{ type, size, row }"
                              slot="menu">
                        <el-button icon="el-icon-s-custom"
                                   :size="size"
                                   :type="type"
                                   @click.stop="rowClick(row)">查看
                        </el-button>
                        <el-button icon="el-icon-edit"
                                   :size="size"
                                   :type="type"
                                   v-if="permission.securityGuard_delete && row.status != 2"
                                   @click.stop="rowStatus(row)">离职登记
                        </el-button>
                        <el-button icon="el-icon-edit"
                                   :size="size"
                                   :type="type"
                                   v-if="row.status == 2"
                                   @click.stop="rowDellook(row)">离职查询
                        </el-button>
                        <el-button icon="el-icon-edit"
                                   :size="size"
                                   :type="type"
                                   v-if="permission.securityGuard_check"
                                   @click.stop="rowCheck(row)">异常
                        </el-button>
                        <el-button icon="el-icon-edit"
                                   :size="size"
                                   :type="type"
                                   v-if="permission.securityGuard_paper"
                                   @click.stop="certificateClick(row)">纸质证书制作
                        </el-button>
                    </template>
                    <template slot-scope="{ row }"
                              slot="sex">
                        <el-tag v-if="row.sex == 1">男</el-tag>
                        <el-tag v-if="row.sex == 2">女</el-tag>
                    </template>
                    <template slot-scope="{ row }"
                              slot="deptId">
                        <el-tag class="rowClickSelf"
                                title="点击查看所属公司情况"
                                @click="rowClickSelf(row.deptId)">{{ row.deptName }}</el-tag>
                    </template>
                    <template slot-scope="{ row }"
                              slot="tenantName">
                        <el-tag>{{ row.tenantName }}</el-tag>
                    </template>
                    <template slot-scope="{ row }"
                              slot="roleName">
                        <el-tag>{{ row.roleName }}</el-tag>
                    </template>
                    <template slot-scope="{ row }"
                              slot="deptName">
                        <el-tag>{{ row.deptName }}</el-tag>
                    </template>
                    <template slot-scope="{ row }"
                              slot="userTypeName">
                        <el-tag>{{ row.userTypeName }}</el-tag>
                    </template>
                    <template slot-scope="{ row }"
                              slot="userType">
                        {{
                                row.userType == 6 ? '已制证' : row.userType == 7 ? '未制证' : ''
                              }}
                    </template>
                </avue-crud>
                <el-dialog title="用户角色配置"
                           append-to-body
                           :visible.sync="roleBox"
                           width="345px">
                    <el-tree :data="roleGrantList"
                             show-checkbox
                             check-strictly
                             default-expand-all
                             node-key="id"
                             ref="treeRole"
                             :default-checked-keys="roleTreeObj"
                             :props="props">
                    </el-tree>
                    <span slot="footer"
                          class="dialog-footer">
                        <el-button @click="roleBox = false">取 消</el-button>
                        <el-button type="primary"
                                   @click="submitRole">确 定</el-button>
                    </span>
                </el-dialog>
                <el-dialog title="用户数据导入"
                           append-to-body
                           :visible.sync="excelBox"
                           width="555px">
                    <avue-form :option="excelOption"
                               v-model="excelForm"
                               :upload-after="uploadAfter">
                        <template slot="excelTemplate">
                            <el-button type="primary"
                                       @click="handleTemplate">
                                点击下载<i class="el-icon-download el-icon--right"></i>
                            </el-button>
                        </template>
                    </avue-form>
                </el-dialog>
                <el-dialog title="用户平台配置"
                           append-to-body
                           :visible.sync="platformBox">
                    <avue-crud :option="platformOption"
                               :table-loading="platformLoading"
                               :data="platformData"
                               ref="platformCrud"
                               v-model="platformForm"
                               :before-open="platformBeforeOpen"
                               :page.sync="platformPage"
                               :permission="platformPermissionList"
                               @row-update="platformRowUpdate"
                               @search-change="platformSearchChange"
                               @search-reset="platformSearchReset"
                               @selection-change="platformSelectionChange"
                               @current-change="platformCurrentChange"
                               @size-change="platformSizeChange"
                               @refresh-change="platformRefreshChange"
                               @on-load="platformOnLoad">
                        <template slot-scope="{ row }"
                                  slot="tenantName">
                            <el-tag>{{ row.tenantName }}</el-tag>
                        </template>
                        <template slot-scope="{ row }"
                                  slot="userTypeName">
                            <el-tag>{{ row.userTypeName }}</el-tag>
                        </template>
                    </avue-crud>
                </el-dialog>
                <el-dialog title="保安员导入"
                           append-to-body
                           :visible.sync="excelBox1"
                           width="555px">
                    <avue-form :option="excelOption1"
                               v-model="excelForm1"
                               :upload-after="uploadAfter1">
                        <template slot="excelTemplate">
                            <el-button type="primary"
                                       @click="handleTemplate1">
                                点击下载<i class="el-icon-download el-icon--right"></i>
                            </el-button>
                        </template>
                    </avue-form>
                </el-dialog>
                <el-dialog title="个人照片批量上传"
                           append-to-body
                           :visible.sync="excelBox2"
                           width="555px">
                    <avue-form :option="excelOption2"
                               v-model="excelForm2"
                               :upload-after="uploadAfter2">
                    </avue-form>
                </el-dialog>
                <div style="position: fixed; top: 9999px; width: 100%; height: 100%; ">
                    <div class="certificate_box"
                         id="certificateDom">
                        <div class="security_main"
                             ref="certificateBox">
                            <div class="security_m_l_titleName widt">
                                {{ certificateObj.realName }}
                            </div>
                            <div class="security_m_r_o_jg widt">
                                南昌市公安局
                            </div>
                            <div class="security_m_l_titlepaperTimenian widt">
                                {{ certificateYear }}
                            </div>
                            <div class="security_m_l_titlepaperTimeyue widt">
                                {{ certificateMonth }}
                            </div>
                            <div class="security_m_l_downsecuritynumber widt">
                                {{ certificateObj.securitynumber }}
                            </div>
                            <div class="security_m_r_o_right widt">
                                {{ certificateObj.realName }}
                            </div>
                            <div class="security_m_r_o_rightbirthday widt">
                                {{ certificateObj.cardid ? (certificateObj.cardid.slice(6, 10) +'.'+ certificateObj.cardid.slice(10, 12) +'.'+ certificateObj.cardid.slice(12, 14)) : '' }}
                            </div>
                            <div class="security_m_r_o_rightaddress security_m_r_o_l_r widt">
                                {{ certificateObj.registered }}
                            </div>
                            <div class="security_m_r_o_rightcardid">
                                {{ certificateObj.cardid }}
                            </div>
                        </div>
                    </div>
                </div>
            </basic-container>
        </el-col>
    </el-row>
</template>
<script>
import {
  getUser,
  getUserPlatform,
  remove,
  update,
  updatePlatform,
  add,
  securitySave,
  grant,
  resetPassword,
  getUserPractitionersInfo,
  saveOrUpdateUserPractitionersInfo,
    getUser,
    getUserPlatform,
    remove,
    update,
    updatePlatform,
    add,
    securitySave,
    grant,
    resetPassword,
    getUserPractitionersInfo,
    updatePaperTime,
    saveOrUpdateUserPractitionersInfo,
} from "@/api/system/user";
import {securityApply} from '@/api/accreditationRecords/accreditationRecords'
import { securityApply } from '@/api/accreditationRecords/accreditationRecords'
import { getList } from "@/api/securityGuard/securityGuard";
import { getDeptLazyTree } from "@/api/system/dept";
import { getRoleTree, getRoleDetail } from "@/api/system/role";
@@ -322,1321 +334,1601 @@
import { mapState } from "vuex";
export default {
  data() {
    // const validatePass = (rule, value, callback) => {
    //   if (value === "") {
    //     callback(new Error("请输入密码"));
    //   } else {
    //     callback();
    //   }
    // };
    // const validatePass2 = (rule, value, callback) => {
    //   if (value === "") {
    //     callback(new Error("请再次输入密码"));
    //   } else if (value !== this.form.password) {
    //     callback(new Error("两次输入密码不一致!"));
    //   } else {
    //     callback();
    //   }
    // };
    // const validatePassNumber = (rule, value, callback) => {
    //   var test = /^[0-9]*$/gm;
    //   if (!test.test(value)) {
    //     callback(new Error("请输入数字"));
    //   } else {
    //     callback();
    //   }
    // };
    var date = new Date();
    let year = date.getFullYear(),
      mouth = date.getMonth() + 1,
      day = date.getDate(),
      oldy,
      oldm,
      oldd,
      ok = false;
    data () {
        // const validatePass = (rule, value, callback) => {
        //   if (value === "") {
        //     callback(new Error("请输入密码"));
        //   } else {
        //     callback();
        //   }
        // };
        // const validatePass2 = (rule, value, callback) => {
        //   if (value === "") {
        //     callback(new Error("请再次输入密码"));
        //   } else if (value !== this.form.password) {
        //     callback(new Error("两次输入密码不一致!"));
        //   } else {
        //     callback();
        //   }
        // };
        // const validatePassNumber = (rule, value, callback) => {
        //   var test = /^[0-9]*$/gm;
        //   if (!test.test(value)) {
        //     callback(new Error("请输入数字"));
        //   } else {
        //     callback();
        //   }
        // };
        var date = new Date();
        let year = date.getFullYear(),
            mouth = date.getMonth() + 1,
            day = date.getDate(),
            oldy,
            oldm,
            oldd,
            ok = false;
    const validatePassCardid = (rule, value, callback) => {
      // console.log(oldy, oldm, oldd, year - oldy, mouth, day);
      var test =
        /^[1-9]\d{7}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}$|^[1-9]\d{5}[1-9]\d{3}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}([0-9]|X)$/;
      if (!test.test(value)) {
        callback(new Error("请输入正确身份证号码"));
      } else {
        //加入校验18岁到60岁的
        oldy = +value.slice(6, 10);
        oldm = +value.slice(10, 12);
        oldd = +value.slice(12, 14);
        ok =
          year - oldy < 18 || year - oldy > 60
            ? false
            : year - oldy == 18
            ? mouth < oldm
              ? false
              : mouth > oldm
              ? true
              : day < oldd
              ? false
              : true
            : year - oldy == 60
            ? mouth < oldm
              ? true
              : mouth > oldm
              ? false
              : day <= oldd
              ? false
              : true
            : true;
        if (ok) {
          callback();
        } else {
          // callback(new Error("根据国家要求,需在18岁至60岁"));
          callback(new Error("年龄不符"));
        }
      }
    };
    const validatePassPhone = (rule, value, callback) => {
      var test = /^(13[0-9]|14[0-9]|15[0-9]|17[0-9]|18[0-9]|19[0-9])\d{8}$/g;
      if (!test.test(value)) {
        callback(new Error("请输入正确手机号码"));
      } else {
        callback();
      }
    };
    console.log(this.userInfo, 123);
    return {
      securityid: "",
      excelBox1: false,
      excelBox2: false,
      isSecurity: true,
      excelForm1: {},
      excelOption1: {
        submitBtn: false,
        emptyBtn: false,
        column: [
          {
            label: "文件上传",
            prop: "excelFile",
            type: "upload",
            drag: true,
            loadText: "文件上传中,请稍等",
            span: 24,
            propsHttp: {
              res: "data",
            },
            tip: "请上传 .xls,.xlsx 标准格式文件",
            action: "/api/blade-user/import-user?deptId=" + this.deptIds,
          },
          {
            label: "模板下载",
            prop: "excelTemplate",
            formslot: true,
            span: 24,
          },
        ],
      },
      excelForm2: {},
      excelOption2: {
        submitBtn: false,
        emptyBtn: false,
        column: [
          {
            label: "文件上传",
            prop: "file",
            type: "upload",
            drag: true,
            loadText: "文件上传中,请稍等",
            span: 24,
            propsHttp: {
              res: "data",
            },
            tip: "请上传 zip 压缩文件,照片文件名以身份证号码命名",
            action: "/api/blade-resource/oss/endpoint/put-file-zip",
          },
        ],
      },
      form: {},
      search: {},
      roleBox: false,
      excelBox: false,
      platformBox: false,
      initFlag: true,
      selectionList: [],
      query: {},
      loading: true,
      platformLoading: false,
      page: {
        pageSize: 10,
        currentPage: 1,
        total: 0,
      },
      roleId: "1412226235153731586",
      deptId: "1413470343230877697",
      deptIds: "",
      platformPage: {
        pageSize: 10,
        currentPage: 1,
        total: 0,
      },
      init: {
        roleTree: [],
        deptTree: [],
      },
      props: {
        label: "title",
        value: "key",
      },
      roleGrantList: [],
      roleTreeObj: [],
      treeDeptId: "",
      treeData: [],
      treeOption: {
        nodeKey: "id",
        lazy: true,
        treeLoad: function (node, resolve) {
          const parentId = node.level === 0 ? 0 : node.data.id;
          getDeptLazyTree(parentId).then((res) => {
            resolve(
              res.data.data.map((item) => {
                return {
                  ...item,
                  leaf: !item.hasChildren,
                };
              })
            );
          });
        },
        addBtn: false,
        menu: false,
        size: "small",
        props: {
          labelText: "标题",
          label: "title",
          value: "value",
          children: "children",
        },
      },
      choiceList: [],
      option: {
        height: "auto",
        calcHeight: 80,
        tip: true,
        searchShow: true,
        reserveSelection:true,
        selectable: (row) => {
          if (row.hold!=="1") {
            return false;
          } else {
            return true;
          }
        },
        indexWidth: 55,
        searchMenuSpan: 6,
        stripe: true,
        border: true,
        delBtn: true,
        align: "center",
        index: true,
        delBtnText: "注销",
        menuWidth: 327,
        selection: true,
        viewBtn: true,
        defaultExpandAll: true,
        //dialogType: 'drawer',
        dialogClickModal: false,
        column: securityFormPageColumn,
        group: [
          {
            label: "基础信息",
            labelWidth: "110",
            prop: "baseInfo",
            icon: "el-icon-user-solid",
            column: [
              {
                label: "所属保安公司",
                prop: "deptId",
                type: "tree",
                // dicUrl:
                // "/api/blade-system/dept/security_lazy-tree?parentId=1413470343230877697",
                // dicUrl: "/api/blade-system/dept/lazy-tree?parentId=0",
                props: {
                  label: "title",
                  value: "id",
                },
                // disabled: true,
                rules: [
                  {
                    required: true,
                    message: "请选择保安公司",
                    trigger: "blur",
                  },
                ],
              },
              {
                label: "姓名",
                prop: "realName",
                rules: [
                  {
                    required: true,
                    message: "请输入姓名",
                    trigger: "blur",
                  },
                  {
                    min: 2,
                    max: 5,
                    message: "姓名长度在2到5个字符",
                  },
                ],
              },
              // {
              //   label: "登录账号",
              //   prop: "account",
              //   editDisabled: true,
              //   rules: [
              //     {
              //       required: true,
              //       message: "请输入登录账号",
              //       trigger: "blur",
              //     },
              //   ],
              //   // disabled: true,
              // },
              // {
              //   label: "密码",
              //   prop: "password",
              //   type: "password",
              //   hide: true,
              //   editDisplay: false,
              //   viewDisplay: false,
              //   rules: [
              //     { required: true, validator: validatePass, trigger: "blur" },
              //   ],
              // },
              // {
              //   label: "确认密码",
              //   prop: "password2",
              //   type: "password",
              //   hide: true,
              //   editDisplay: false,
              //   viewDisplay: false,
              //   rules: [
              //     { required: true, validator: validatePass2, trigger: "blur" },
              //   ],
              // },
            ],
          },
          {
            label: "详细信息",
            prop: "detailInfo",
            labelWidth: "110",
            icon: "el-icon-s-order",
            column: [
              {
                label: "身份证号",
                prop: "cardid",
                hide: true,
                overHidden: true,
                rules: [
                  {
                    required: true,
                    message: "请输入身份证号",
                    trigger: "blur",
                  },
                  {
                    required: true,
                    validator: validatePassCardid,
                    trigger: "blur",
                  },
                ],
              },
              {
                label: "手机号码",
                prop: "phone",
                overHidden: true,
                rules: [
                  {
                    required: true,
                    message: "请输入手机号",
                    trigger: "blur",
                  },
                  {
                    required: true,
                    validator: validatePassPhone,
                    trigger: "blur",
                  },
                ],
              },
              // {
              //   label: "昵称",
              //   prop: "name",
              // },
              {
                label: "个人照片",
                type: "upload",
                listType: "picture-img",
                propsHttp: {
                  res: "data",
                  url: "url",
                },
                canvasOption: {
                  text: " ",
                  ratio: 0.1,
                },
                action: "/api/blade-resource/oss/endpoint/put-files",
                tip: "上传二代身份证一寸近期彩色正面免冠图象, (358像素(宽) × 441像素(高)、分辨率350dpi)且不超过500kb",
                span: 12,
                // row: true,
                prop: "avatar",
              },
              {
                label: "指纹信息",
                type: "upload",
                listType: "picture-img",
                propsHttp: {
                  res: "data",
                  url: "url",
                },
                canvasOption: {
                  text: " ",
                  ratio: 0.1,
                },
                action: "/api/blade-resource/oss/endpoint/put-files",
                tip: "只能上传jpg/png指纹信息,且不超过500kb",
                span: 12,
                // row: true,
                prop: "fingerprint",
              },
              {
                label: "是否持证",
                prop: "hold",
                // dicUrl: "/api/blade-system/dict-biz/dictionary?code=equipage",
                // props: {
                //   label: "dictValue",
                //   value: "dictKey",
                // },
                type: "select",
                dicData: [
                  {
                    label: "是",
                    value: "1",
                  },
                  {
                    label: "否",
                    value: "2",
                  },
                  {
                    label: "已吊销",
                    value: "3",
                  },
                ],
                rules: [
                  {
                    required: true,
                    message: "请选择",
                    trigger: "blur",
                  },
                ],
              },
              {
                label: "保安员证编号",
                prop: "securitynumber",
                hide: true,
              },
              // {
              //   label: "发证日期",
              //   prop: "paperTime",
              //   hide: true,
              //   type: "date",
              //   format: "yyyy-MM-dd",
              //   valueFormat: "yyyy-MM-dd",
              // },
              {
                label: "电子邮箱",
                prop: "email",
              },
              {
                label: "籍贯",
                prop: "nativeplace",
              },
              {
                label: "民族",
                prop: "nation",
              },
              {
                label: "最高学历",
                prop: "education1",
                type: "select",
                dicUrl:
                  "/api/blade-system/dict-biz/dictionary?code=educationType",
                props: {
                  label: "dictValue",
                  value: "dictKey",
                },
                dataType: "number",
                slot: true,
              },
              {
                label: "政治面貌",
                prop: "politicaloutlook",
              },
              {
                label: "健康状态",
                prop: "healstats",
              },
              {
                label: "身高",
                prop: "height",
              },
              {
                label: "联系地址",
                prop: "address",
              },
              {
                label: "户口所在地",
                prop: "registered",
              },
              {
                label: "所属辖区",
                prop: "jurisdiction",
                // multiple: true,
                type: "tree",
                dicUrl: "/api/jurisdiction/lazy-tree",
                props: {
                  label: "title",
                  value: "id",
                },
                checkStrictly: true,
                slot: true,
                rules: [
                  {
                    required: false,
                    message: "请选择所属辖区",
                    trigger: "click",
                  },
                ],
              },
              {
                label: "入职时间",
                prop: "rtime",
                type: "date",
                format: "yyyy-MM-dd",
                valueFormat: "yyyy-MM-dd",
                rules: [
                  {
                    required: true,
                    message: "请输入入职时间",
                    trigger: "click",
                  },
                ],
              },
              {
                label: "性别",
                prop: "sex",
                type: "select",
                slot: true,
                dicData: [
                  {
                    label: "男",
                    value: 1,
                  },
                  {
                    label: "女",
                    value: 2,
                  },
                  // {
                  //   label: "未知",
                  //   value: 3,
                  // },
                ],
                rules: [
                  {
                    required: true,
                    message: "请选择性别",
                    trigger: "blur",
                  },
                ],
              },
              // {
              //   label: "生日",
              //   type: "date",
              //   prop: "birthday",
              //   format: "yyyy-MM-dd",
              //   valueFormat: "yyyy-MM-dd",
              // },
            ],
          },
        ],
      },
      data: [],
      platformQuery: {},
      platformSelectionList: [],
      platformData: [],
      platformForm: {},
      platformOption: {
        tip: false,
        searchShow: true,
        searchMenuSpan: 6,
        border: true,
        index: true,
        selection: true,
        viewBtn: true,
        dialogClickModal: false,
        menuWidth: 120,
        editBtnText: "配置",
        column: [
          {
            label: "登录账号",
            prop: "account",
            search: true,
            display: false,
          },
          {
            label: "所属保安单位",
            prop: "tenantName",
            slot: true,
            display: false,
          },
          {
            label: "姓名",
            prop: "realName",
            search: true,
            display: false,
          },
          {
            label: "平台",
            prop: "userTypeName",
            slot: true,
            display: false,
          },
          {
            label: "平台",
            type: "select",
            dicUrl: "/api/blade-system/dict/dictionary?code=user_type",
            props: {
              label: "dictValue",
              value: "dictKey",
            },
            dataType: "number",
            search: true,
            hide: true,
            display: false,
            prop: "userType",
            rules: [
              {
                required: true,
                message: "请选择平台",
                trigger: "blur",
              },
            ],
          },
          {
            label: "拓展",
            prop: "userExt",
            type: "textarea",
            minRows: 8,
            span: 24,
            overHidden: true,
            row: true,
            hide: true,
          },
        ],
      },
      excelForm: {},
      excelOption: {
        submitBtn: false,
        emptyBtn: false,
        column: [
          {
            label: "模板上传",
            prop: "excelFile",
            type: "upload",
            drag: true,
            loadText: "模板上传中,请稍等",
            span: 24,
            propsHttp: {
              res: "data",
            },
            tip: "请上传 .xls,.xlsx 标准格式文件",
            action: "/api/blade-user/import-user",
          },
          // {
          //   label: "数据覆盖",
          //   prop: "isCovered",
          //   type: "switch",
          //   align: "center",
          //   width: 80,
          //   dicData: [
          //     {
          //       label: "否",
          //       value: 0,
          //     },
          //     {
          //       label: "是",
          //       value: 1,
          //     },
          //   ],
          //   value: 0,
          //   slot: true,
          //   rules: [
          //     {
          //       required: true,
          //       message: "请选择是否覆盖",
          //       trigger: "blur",
          //     },
          //   ],
          // },
          {
            label: "模板下载",
            prop: "excelTemplate",
            formslot: true,
            span: 24,
          },
        ],
      },
    };
  },
  watch: {
    "form.tenantId"() {
      if (this.form.tenantId !== "" && this.initFlag) {
        this.initData(this.form.tenantId);
      }
    },
    "form.deptId"() {
      this.initData(this.form.tenantId);
    },
    "excelForm.isCovered"() {
      if (this.excelForm.isCovered !== "") {
        const column = this.findObject(this.excelOption.column, "excelFile");
        column.action = `/api/blade-user/import-user?isCovered=${this.excelForm.isCovered}`;
      }
    },
  },
  computed: {
    ...mapGetters(["userInfo", "permission"]),
    permissionList() {
      return {
        addBtn: this.vaildData(this.permission.securityGuard_add, false),
        viewBtn: this.vaildData(null, false),
        delBtn: this.vaildData(this.permission.securityGuard_delete, false),
        editBtn: this.vaildData(this.permission.securityGuard_edit, false),
      };
    },
    platformPermissionList() {
      return {
        addBtn: false,
        viewBtn: false,
        delBtn: false,
        editBtn: this.vaildData(this.permission.user_edit, false),
      };
    },
    ids() {
      let ids = [];
      this.selectionList.forEach((ele) => {
        ids.push(ele.id);
      });
      return ids.join(",");
    },
    ...mapState({
      userInfo: (state) => state.user.userInfo,
    }),
  },
  beforeCreate() {},
  created() {},
  mounted() {
    // this.option.column[0].hide = true
    // 非保安单位模式默认加载管理组数据
    if (!website.tenantMode) {
      this.initData(website.tenantId);
    }
    console.log(this.search, 111);
    this.search["status"] = 1;
    this.deptIds = this.userInfo.dept_id;
  },
  methods: {
    handleImport1() {
      this.excelBox1 = true;
    },
    uploadAfter1(res, done, loading, column) {
      window.console.log(column);
      this.excelBox1 = false;
      this.refreshChange();
      done();
    },
    handleTemplate1() {
      window.open(`/api/blade-user/export-template-security`);
    },
    handleImport2() {
      this.excelBox2 = true;
    },
    uploadAfter2(res, done, loading, column) {
      window.console.log(column);
      this.excelBox2 = false;
      this.refreshChange();
      done();
    },
    //行点击事件
    rowClick(row) {
      // console.log(row, 111);
      this.$router.push({
        path: "/securityGuardDetail",
        query: { row: JSON.stringify(row) },
      });
    },
    rowClickSelf(row) {
      console.log(row, "baoan");
      this.$router.push({
        path: "/securityUnitChild",
        query: { fromSecunityGuardId: row },
      });
    },
    nodeClick(data) {
      this.treeDeptId = data.id;
      this.page.currentPage = 1;
      this.onLoad(this.page);
    },
    initData(tenantId) {
      // getRoleTree(tenantId).then((res) => {
      //   const column = this.findObject(this.option.group, "roleId");
      //   column.dicData = res.data.data;
      // });
      // getDeptTree(tenantId).then((res) => {
      //   const column = this.findObject(this.option.group, "deptId");
      //   column.dicData = res.data.data;
      // });
      // getPostList(tenantId).then((res) => {
      //   const column = this.findObject(this.option.group, "postId");
      //   column.dicData = res.data.data;
      // });
    },
    submitRole() {
      const roleList = this.$refs.treeRole.getCheckedKeys().join(",");
      grant(this.ids, roleList).then(() => {
        this.roleBox = false;
        this.$message({
          type: "success",
          message: "操作成功!",
        });
        this.onLoad(this.page);
      });
    },
    //制证申请
    handleSecurityApply(){
      if (this.choiceList.length === 0) {
        this.$message.warning("请勾选至少一位持证保安员");
        return;
      }
        this.$confirm("共选择制证申请人数"+this.choiceList.length+"人,确定申请制证?", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      })
        .then(() => {
          let cho = this.choiceList;
          console.log(this.choiceList,14521);
          let str = "";
          for (let k in cho) {
            str += cho[k].id;
            if (k != cho.length - 1) {
              str += ",";
        const validatePassCardid = (rule, value, callback) => {
            // console.log(oldy, oldm, oldd, year - oldy, mouth, day);
            var test =
                /^[1-9]\d{7}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}$|^[1-9]\d{5}[1-9]\d{3}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}([0-9]|X)$/;
            if (!test.test(value)) {
                callback(new Error("请输入正确身份证号码"));
            } else {
                //加入校验18岁到60岁的
                oldy = +value.slice(6, 10);
                oldm = +value.slice(10, 12);
                oldd = +value.slice(12, 14);
                ok =
                    year - oldy < 18 || year - oldy > 60
                        ? false
                        : year - oldy == 18
                            ? mouth < oldm
                                ? false
                                : mouth > oldm
                                    ? true
                                    : day < oldd
                                        ? false
                                        : true
                            : year - oldy == 60
                                ? mouth < oldm
                                    ? true
                                    : mouth > oldm
                                        ? false
                                        : day <= oldd
                                            ? false
                                            : true
                                : true;
                if (ok) {
                    callback();
                } else {
                    // callback(new Error("根据国家要求,需在18岁至60岁"));
                    callback(new Error("年龄不符"));
                }
            }
          }
          console.log(str,1132);
          const data = {
            ids:str,
            createUser:this.userInfo.user_id
          }
          return securityApply(data);
        })
        .then(() => {
          // this.$refs.crud.toggleSelection();
          this.$message({
            type: "success",
            message: "操作成功!",
          });
        });
    },
    rowSave(row, done, loading) {
      if (row.deptId) {
        row.deptId = row.deptId;
      }
      if (row.roleId) {
        row.roleId = row.roleId.join(",");
      }
      if (row.postId) {
        row.postId = row.postId.join(",");
      }
      const userMap = {
        user: {
          account: row.account,
          avatar: row.avatar,
          fingerprint: row.fingerprint,
          healstats: row.healstats,
          address: row.address,
          birthday: row.birthday,
          cardid: row.cardid,
          deptId: row.deptId,
          education: row.education1,
          email: row.email,
          height: row.height,
          hold: row.hold,
          jurisdiction: row.jurisdiction,
          myPicture: row.myPicture,
          name: row.name,
          nation: row.nation,
          nativeplace: row.nativeplace,
          password: row.password,
          password2: row.password2,
          phone: row.phone,
          politicaloutlook: row.politicaloutlook,
          realName: row.realName,
          registered: row.registered,
          rtime: row.rtime,
          securitynumber: row.securitynumber,
          sex: row.sex,
        },
      };
      securitySave(userMap).then(
        () => {
          this.initFlag = false;
          this.$alert("账号为身份证号码,密码为身份证后六位", "温馨提示", {
            confirmButtonText: "确定",
            callback: (action) => {
              this.$message({
                type: "success",
                message: `操作成功`,
              });
              this.onLoad(this.page);
              done();
            },
          });
        },
        (error) => {
          window.console.log(error);
          loading();
        }
      );
    },
    rowUpdate(row, index, done, loading) {
      row.deptId = row.deptId;
      row.roleId = row.roleId.join(",");
      row.postId = row.postId.join(",");
      //值替换,education 放在页面会卡死
      row.education = row.education1;
      update(row).then(
        () => {
          this.initFlag = false;
          this.onLoad(this.page);
          this.$message({
            type: "success",
            message: "操作成功!",
          });
          done();
        },
        (error) => {
          window.console.log(error);
          loading();
        }
      );
    },
    rowDellook(row) {
      // console.log(row.reasonForLeav);
      this.$alert(
        row.reasonForLeav == "" ? "未填写" : row.reasonForLeav,
        "离职原因",
        {
          confirmButtonText: "确定",
          callback: (action) => {},
        }
      );
    },
    rowStatus(row) {
      this.$prompt("离职原因", "提示", {
        confirmButtonText: "确定离职",
        cancelButtonText: "取消",
        inputErrorMessage: "",
      })
        .then(({ value }) => {
          console.log(value);
          row.reasonForLeav = value;
          row.status = "2";
          // console.log(update);
          // return;
          update(row).then((res) => {
            this.$message({
              type: "success",
              message: "操作成功",
            });
          });
          this.refreshChange();
        })
        .catch(() => {});
    },
    rowDel(row) {
      this.$confirm("确定注销当前用户?", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      })
        .then(() => {
          return remove(row.id);
        })
        .then(() => {
          this.onLoad(this.page);
          this.$message({
            type: "success",
            message: "操作成功!",
          });
        });
    },
    rowCheck(row) {
      this.$confirm("确定审查异常标记?", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      })
        .then(() => {
          row.examinationType = "1";
          return update(row);
        })
        .then(() => {
          this.onLoad(this.page);
          this.$message({
            type: "success",
            message: "操作成功!",
          });
        });
    },
    searchReset() {
      this.query = {};
      this.treeDeptId = "";
      this.onLoad(this.page);
    },
    searchChange(params, done) {
      this.query = params;
      this.page.currentPage = 1;
      this.onLoad(this.page, params);
      done();
    },
    selectionChange(list) {
      // this.selectionList = list;
      this.choiceList = [];
      for (let k in list) {
        this.choiceList.push({
          id: list[k].id,
        });
      }
    },
    selectionClear() {
      // this.selectionList = [];
      // this.$refs.crud.toggleSelection();
    },
    handleDelete() {
      if (this.selectionList.length === 0) {
        this.$message.warning("请选择至少一条数据");
        return;
      }
      this.$confirm("确定将选择保安注销?", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      })
        .then(() => {
          return remove(this.ids);
        })
        .then(() => {
          this.onLoad(this.page);
          this.$message({
            type: "success",
            message: "操作成功!",
          });
          this.$refs.crud.toggleSelection();
        });
    },
    handleReset() {
      if (this.selectionList.length === 0) {
        this.$message.warning("请选择至少一条数据");
        return;
      }
      this.$confirm("确定将选择账号密码重置为123456?", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      })
        .then(() => {
          return resetPassword(this.ids);
        })
        .then(() => {
          this.$message({
            type: "success",
            message: "操作成功!",
          });
          this.$refs.crud.toggleSelection();
        });
    },
    handleGrant() {
      if (this.selectionList.length === 0) {
        this.$message.warning("请选择至少一条数据");
        return;
      }
      this.roleTreeObj = [];
      if (this.selectionList.length === 1) {
        this.roleTreeObj = this.selectionList[0].roleId.split(",");
      }
      getRoleTree().then((res) => {
        this.roleGrantList = res.data.data;
        this.roleBox = true;
      });
    },
    handlePlatform() {
      this.platformBox = true;
    },
    handleImport() {
      this.excelBox = true;
    },
    uploadAfter(res, done, loading, column) {
      window.console.log(column);
      this.excelBox = false;
      this.refreshChange();
      done();
    },
    handleExport() {
      this.$confirm("是否导出保安数据?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      }).then(() => {
        window.open(
          `/api/blade-user/export-user?${
            this.website.tokenHeader
          }=${getToken()}&account=${this.search.account}&realName=${
            this.search.realName
          }`
        );
      });
    },
    handleTemplate() {
      window.open(
        `/api/blade-user/export-template?${
          this.website.tokenHeader
        }=${getToken()}`
      );
    },
    beforeOpen(done, type) {
      var that = this;
      if (["edit", "view"].includes(type)) {
        getUser(this.form.id).then((res) => {
          this.form = res.data.data;
          var d = {
            education1: res.data.data.education,
          };
          this.form = {
            ...this.form,
            ...d,
          };
          // this.from["education1"] = res.data.data.education;
          if (this.form.hasOwnProperty("deptId")) {
            this.form.deptId = this.form.deptId;
          }
          if (this.form.hasOwnProperty("roleId")) {
            this.form.roleId = this.form.roleId.split(",");
          }
          if (this.form.hasOwnProperty("postId")) {
            this.form.postId = this.form.postId.split(",");
          }
          var userInfo = res.data.data;
          //获取用户从业信息
          getUserPractitionersInfo(userInfo.id).then((res1) => {
            that.form.UserPractitionersInfo = res1.data.data;
          });
        });
      }
      this.initFlag = true;
      done();
    },
    currentChange(currentPage) {
      this.page.currentPage = currentPage;
    },
    //行样式调整
    rowStyle({ row, column, rowIndex }) {
      if (row.examinationType == "1") {
        return {
          color: "#ff2727",
        };
      }
    },
    sizeChange(pageSize) {
      this.page.pageSize = pageSize;
    },
    refreshChange() {
      this.onLoad(this.page, this.query);
    },
    onLoad(page, params = {}) {
      params = this.search;
      var that = this;
      //获取当前登录人员的角色信息
      var roleIds = this.userInfo.role_id.split(",");
      roleIds.forEach((roleId) => {
        getRoleDetail(roleId).then((res) => {
          var roleAlias = res.data.data.roleAlias;
          if (roleAlias == "保安公司管理员" || roleAlias == "保安") {
            //去除保安公司查询
            const column = that.findObject(that.option.column, "deptId");
            column.search = false;
            const deptColumn = that.findObject(that.option.group, "deptId");
            deptColumn.dicUrl =
              "/api/blade-system/dept/security_lazy-tree?parentId=1413470343230877697";
            //禁止编辑
            deptColumn.disabled = true;
            deptColumn.value = that.userInfo.dept_id;
            that.isSecurity = false;
            //如果是保安公司管理员
            params["deptId"] = that.userInfo.dept_id;
            //导入action 修改
            const importColumn = that.findObject(
              that.excelOption1.column,
              "excelFile"
            );
            importColumn.action =
              "/api/blade-user/import-user?deptId=" + this.deptIds;
          } else if (roleAlias == "公安管理员") {
            params["jurisdiction"] = that.userInfo.jurisdiction;
            var columnDept = that.findObject(that.option.column, "deptId");
            columnDept.dicUrl =
              "/api/blade-system/dept/security_lazy-tree?parentId=1413470343230877697&jurisdiction=" +
              that.userInfo.jurisdiction;
            var ColumnDeptUpdate = that.findObject(that.option.group, "deptId");
            ColumnDeptUpdate.dicUrl =
              "/api/blade-system/dept/security_lazy-tree?parentId=1413470343230877697&jurisdiction=" +
              that.userInfo.jurisdiction;
          } else {
            var columnDept1 = that.findObject(that.option.column, "deptId");
            columnDept1.dicUrl =
              "/api/blade-system/dept/security_lazy-tree?parentId=1413470343230877697";
            var ColumnDeptUpdate1 = that.findObject(
              that.option.group,
              "deptId"
            );
            ColumnDeptUpdate1.dicUrl =
              "/api/blade-system/dept/security_lazy-tree?parentId=1413470343230877697";
          }
          let values = {
            ...params,
          };
          values = {
            ...params,
            roleAlias: "111",
            ...that.query,
          };
          that.loading = true;
          getList(page.currentPage, page.pageSize, values).then((res) => {
            const data = res.data.data;
            that.page.total = data.total;
            var d = data.records;
            var date = new Date();
            var datayear = date.getFullYear();
            for (const key in d) {
              var year = d[key].cardid.slice(6, 10);
              d[key]["age"] = +datayear - +year;
              // d[key].securitynumber = "赣洪202100009";
        const validatePassPhone = (rule, value, callback) => {
            var test = /^(13[0-9]|14[0-9]|15[0-9]|17[0-9]|18[0-9]|19[0-9])\d{8}$/g;
            if (!test.test(value)) {
                callback(new Error("请输入正确手机号码"));
            } else {
                callback();
            }
            that.data = data.records;
            that.loading = false;
            that.selectionClear();
          });
        });
      });
        };
        return {
            certificateYear: null,
            certificateMonth: null,
            certificateFlag: false,
            certificateObj: {
                realName: '',
                securitynumber: '',
                cardid: '',
                registered: ''
            },
            securityid: "",
            excelBox1: false,
            excelBox2: false,
            isSecurity: true,
            excelForm1: {},
            excelOption1: {
                submitBtn: false,
                emptyBtn: false,
                column: [
                    {
                        label: "文件上传",
                        prop: "excelFile",
                        type: "upload",
                        drag: true,
                        loadText: "文件上传中,请稍等",
                        span: 24,
                        propsHttp: {
                            res: "data",
                        },
                        tip: "请上传 .xls,.xlsx 标准格式文件",
                        action: "/api/blade-user/import-user?deptId=" + this.deptIds,
                    },
                    {
                        label: "模板下载",
                        prop: "excelTemplate",
                        formslot: true,
                        span: 24,
                    },
                ],
            },
            excelForm2: {},
            excelOption2: {
                submitBtn: false,
                emptyBtn: false,
                column: [
                    {
                        label: "文件上传",
                        prop: "file",
                        type: "upload",
                        drag: true,
                        loadText: "文件上传中,请稍等",
                        span: 24,
                        propsHttp: {
                            res: "data",
                        },
                        tip: "请上传 zip 压缩文件,照片文件名以身份证号码命名",
                        action: "/api/blade-resource/oss/endpoint/put-file-zip",
                    },
                ],
            },
            form: {},
            search: {},
            roleBox: false,
            excelBox: false,
            platformBox: false,
            initFlag: true,
            selectionList: [],
            query: {},
            loading: true,
            platformLoading: false,
            page: {
                pageSize: 10,
                currentPage: 1,
                total: 0,
            },
            roleId: "1412226235153731586",
            deptId: "1413470343230877697",
            deptIds: "",
            platformPage: {
                pageSize: 10,
                currentPage: 1,
                total: 0,
            },
            init: {
                roleTree: [],
                deptTree: [],
            },
            props: {
                label: "title",
                value: "key",
            },
            roleGrantList: [],
            roleTreeObj: [],
            treeDeptId: "",
            treeData: [],
            treeOption: {
                nodeKey: "id",
                lazy: true,
                treeLoad: function (node, resolve) {
                    const parentId = node.level === 0 ? 0 : node.data.id;
                    getDeptLazyTree(parentId).then((res) => {
                        resolve(
                            res.data.data.map((item) => {
                                return {
                                    ...item,
                                    leaf: !item.hasChildren,
                                };
                            })
                        );
                    });
                },
                addBtn: false,
                menu: false,
                size: "small",
                props: {
                    labelText: "标题",
                    label: "title",
                    value: "value",
                    children: "children",
                },
            },
            choiceList: [],
            option: {
                height: "auto",
                calcHeight: 80,
                tip: true,
                searchShow: true,
                reserveSelection: true,
                selectable: (row) => {
                    if (row.hold !== "1") {
                        return false;
                    } else {
                        return true;
                    }
                },
                indexWidth: 55,
                searchMenuSpan: 6,
                stripe: true,
                border: true,
                delBtn: true,
                align: "center",
                index: true,
                delBtnText: "注销",
                menuWidth: 327,
                selection: true,
                viewBtn: true,
                defaultExpandAll: true,
                //dialogType: 'drawer',
                dialogClickModal: false,
                column: securityFormPageColumn,
                group: [
                    {
                        label: "基础信息",
                        labelWidth: "110",
                        prop: "baseInfo",
                        icon: "el-icon-user-solid",
                        column: [
                            {
                                label: "所属保安公司",
                                prop: "deptId",
                                type: "tree",
                                // dicUrl:
                                // "/api/blade-system/dept/security_lazy-tree?parentId=1413470343230877697",
                                // dicUrl: "/api/blade-system/dept/lazy-tree?parentId=0",
                                props: {
                                    label: "title",
                                    value: "id",
                                },
                                // disabled: true,
                                rules: [
                                    {
                                        required: true,
                                        message: "请选择保安公司",
                                        trigger: "blur",
                                    },
                                ],
                            },
                            {
                                label: "姓名",
                                prop: "realName",
                                rules: [
                                    {
                                        required: true,
                                        message: "请输入姓名",
                                        trigger: "blur",
                                    },
                                    {
                                        min: 2,
                                        max: 5,
                                        message: "姓名长度在2到5个字符",
                                    },
                                ],
                            },
                            // {
                            //   label: "登录账号",
                            //   prop: "account",
                            //   editDisabled: true,
                            //   rules: [
                            //     {
                            //       required: true,
                            //       message: "请输入登录账号",
                            //       trigger: "blur",
                            //     },
                            //   ],
                            //   // disabled: true,
                            // },
                            // {
                            //   label: "密码",
                            //   prop: "password",
                            //   type: "password",
                            //   hide: true,
                            //   editDisplay: false,
                            //   viewDisplay: false,
                            //   rules: [
                            //     { required: true, validator: validatePass, trigger: "blur" },
                            //   ],
                            // },
                            // {
                            //   label: "确认密码",
                            //   prop: "password2",
                            //   type: "password",
                            //   hide: true,
                            //   editDisplay: false,
                            //   viewDisplay: false,
                            //   rules: [
                            //     { required: true, validator: validatePass2, trigger: "blur" },
                            //   ],
                            // },
                        ],
                    },
                    {
                        label: "详细信息",
                        prop: "detailInfo",
                        labelWidth: "110",
                        icon: "el-icon-s-order",
                        column: [
                            {
                                label: "身份证号",
                                prop: "cardid",
                                hide: true,
                                overHidden: true,
                                rules: [
                                    {
                                        required: true,
                                        message: "请输入身份证号",
                                        trigger: "blur",
                                    },
                                    {
                                        required: true,
                                        validator: validatePassCardid,
                                        trigger: "blur",
                                    },
                                ],
                            },
                            {
                                label: "手机号码",
                                prop: "phone",
                                overHidden: true,
                                rules: [
                                    {
                                        required: true,
                                        message: "请输入手机号",
                                        trigger: "blur",
                                    },
                                    {
                                        required: true,
                                        validator: validatePassPhone,
                                        trigger: "blur",
                                    },
                                ],
                            },
                            // {
                            //   label: "昵称",
                            //   prop: "name",
                            // },
                            {
                                label: "个人照片",
                                type: "upload",
                                listType: "picture-img",
                                propsHttp: {
                                    res: "data",
                                    url: "url",
                                },
                                canvasOption: {
                                    text: " ",
                                    ratio: 0.1,
                                },
                                action: "/api/blade-resource/oss/endpoint/put-files",
                                tip: "上传二代身份证一寸近期彩色正面免冠图象, (358像素(宽) × 441像素(高)、分辨率350dpi)且不超过500kb",
                                span: 12,
                                // row: true,
                                prop: "avatar",
                            },
                            {
                                label: "指纹信息",
                                type: "upload",
                                listType: "picture-img",
                                propsHttp: {
                                    res: "data",
                                    url: "url",
                                },
                                canvasOption: {
                                    text: " ",
                                    ratio: 0.1,
                                },
                                action: "/api/blade-resource/oss/endpoint/put-files",
                                tip: "只能上传jpg/png指纹信息,且不超过500kb",
                                span: 12,
                                // row: true,
                                prop: "fingerprint",
                            },
                            {
                                label: "是否持证",
                                prop: "hold",
                                // dicUrl: "/api/blade-system/dict-biz/dictionary?code=equipage",
                                // props: {
                                //   label: "dictValue",
                                //   value: "dictKey",
                                // },
                                type: "select",
                                dicData: [
                                    {
                                        label: "是",
                                        value: "1",
                                    },
                                    {
                                        label: "否",
                                        value: "2",
                                    },
                                    {
                                        label: "已吊销",
                                        value: "3",
                                    },
                                ],
                                rules: [
                                    {
                                        required: true,
                                        message: "请选择",
                                        trigger: "blur",
                                    },
                                ],
                            },
                            {
                                label: "保安员证编号",
                                prop: "securitynumber",
                                hide: true,
                            },
                            // {
                            //   label: "发证日期",
                            //   prop: "paperTime",
                            //   hide: true,
                            //   type: "date",
                            //   format: "yyyy-MM-dd",
                            //   valueFormat: "yyyy-MM-dd",
                            // },
                            {
                                label: "电子邮箱",
                                prop: "email",
                            },
                            // {
                            //     label: "籍贯",
                            //     prop: "nativeplace",
                            // },
                            {
                                label: "民族",
                                prop: "nation",
                            },
                            {
                                label: "最高学历",
                                prop: "education1",
                                type: "select",
                                dicUrl:
                                    "/api/blade-system/dict-biz/dictionary?code=educationType",
                                props: {
                                    label: "dictValue",
                                    value: "dictKey",
                                },
                                dataType: "number",
                                slot: true,
                            },
                            {
                                label: "政治面貌",
                                prop: "politicaloutlook",
                            },
                            {
                                label: "健康状态",
                                prop: "healstats",
                            },
                            {
                                label: "身高",
                                prop: "height",
                            },
                            {
                                label: "联系地址",
                                prop: "address"
                            },
                            {
                                label: "住址",
                                prop: "registered",
                                rules: [
                                    {
                                        required: true,
                                        message: "请输入住址",
                                        trigger: "click",
                                    },
                                ],
                            },
                            {
                                label: "所属辖区",
                                prop: "jurisdiction",
                                // multiple: true,
                                type: "tree",
                                dicUrl: "/api/jurisdiction/lazy-tree",
                                props: {
                                    label: "title",
                                    value: "id",
                                },
                                checkStrictly: true,
                                slot: true,
                                rules: [
                                    {
                                        required: false,
                                        message: "请选择所属辖区",
                                        trigger: "click",
                                    },
                                ],
                            },
                            {
                                label: "入职时间",
                                prop: "rtime",
                                type: "date",
                                format: "yyyy-MM-dd",
                                valueFormat: "yyyy-MM-dd",
                                rules: [
                                    {
                                        required: true,
                                        message: "请输入入职时间",
                                        trigger: "click",
                                    },
                                ],
                            },
                            {
                                label: "性别",
                                prop: "sex",
                                type: "select",
                                slot: true,
                                dicData: [
                                    {
                                        label: "男",
                                        value: 1,
                                    },
                                    {
                                        label: "女",
                                        value: 2,
                                    },
                                    // {
                                    //   label: "未知",
                                    //   value: 3,
                                    // },
                                ],
                                rules: [
                                    {
                                        required: true,
                                        message: "请选择性别",
                                        trigger: "blur",
                                    },
                                ],
                            },
                            // {
                            //   label: "生日",
                            //   type: "date",
                            //   prop: "birthday",
                            //   format: "yyyy-MM-dd",
                            //   valueFormat: "yyyy-MM-dd",
                            // },
                        ],
                    },
                ],
            },
            data: [],
            platformQuery: {},
            platformSelectionList: [],
            platformData: [],
            platformForm: {},
            platformOption: {
                tip: false,
                searchShow: true,
                searchMenuSpan: 6,
                border: true,
                index: true,
                selection: true,
                viewBtn: true,
                dialogClickModal: false,
                menuWidth: 120,
                editBtnText: "配置",
                column: [
                    {
                        label: "登录账号",
                        prop: "account",
                        search: true,
                        display: false,
                    },
                    {
                        label: "所属保安单位",
                        prop: "tenantName",
                        slot: true,
                        display: false,
                    },
                    {
                        label: "姓名",
                        prop: "realName",
                        search: true,
                        display: false,
                    },
                    {
                        label: "平台",
                        prop: "userTypeName",
                        slot: true,
                        display: false,
                    },
                    {
                        label: "平台",
                        type: "select",
                        dicUrl: "/api/blade-system/dict/dictionary?code=user_type",
                        props: {
                            label: "dictValue",
                            value: "dictKey",
                        },
                        dataType: "number",
                        search: true,
                        hide: true,
                        display: false,
                        prop: "userType",
                        rules: [
                            {
                                required: true,
                                message: "请选择平台",
                                trigger: "blur",
                            },
                        ],
                    },
                    {
                        label: "拓展",
                        prop: "userExt",
                        type: "textarea",
                        minRows: 8,
                        span: 24,
                        overHidden: true,
                        row: true,
                        hide: true,
                    },
                ],
            },
            excelForm: {},
            excelOption: {
                submitBtn: false,
                emptyBtn: false,
                column: [
                    {
                        label: "模板上传",
                        prop: "excelFile",
                        type: "upload",
                        drag: true,
                        loadText: "模板上传中,请稍等",
                        span: 24,
                        propsHttp: {
                            res: "data",
                        },
                        tip: "请上传 .xls,.xlsx 标准格式文件",
                        action: "/api/blade-user/import-user",
                    },
                    // {
                    //   label: "数据覆盖",
                    //   prop: "isCovered",
                    //   type: "switch",
                    //   align: "center",
                    //   width: 80,
                    //   dicData: [
                    //     {
                    //       label: "否",
                    //       value: 0,
                    //     },
                    //     {
                    //       label: "是",
                    //       value: 1,
                    //     },
                    //   ],
                    //   value: 0,
                    //   slot: true,
                    //   rules: [
                    //     {
                    //       required: true,
                    //       message: "请选择是否覆盖",
                    //       trigger: "blur",
                    //     },
                    //   ],
                    // },
                    {
                        label: "模板下载",
                        prop: "excelTemplate",
                        formslot: true,
                        span: 24,
                    },
                ],
            },
        };
    },
    platformRowUpdate(row, index, done, loading) {
      updatePlatform(row.id, row.userType, row.userExt).then(
        () => {
          this.platformOnLoad(this.platformPage);
          this.$message({
            type: "success",
            message: "操作成功!",
          });
          done();
    watch: {
        "form.tenantId" () {
            if (this.form.tenantId !== "" && this.initFlag) {
                this.initData(this.form.tenantId);
            }
        },
        (error) => {
          window.console.log(error);
          loading();
        "form.deptId" () {
            this.initData(this.form.tenantId);
        },
        "excelForm.isCovered" () {
            if (this.excelForm.isCovered !== "") {
                const column = this.findObject(this.excelOption.column, "excelFile");
                column.action = `/api/blade-user/import-user?isCovered=${this.excelForm.isCovered}`;
            }
        },
    },
    computed: {
        ...mapGetters(["userInfo", "permission"]),
        permissionList () {
            return {
                addBtn: this.vaildData(this.permission.securityGuard_add, false),
                viewBtn: this.vaildData(null, false),
                delBtn: this.vaildData(this.permission.securityGuard_delete, false),
                editBtn: this.vaildData(this.permission.securityGuard_edit, false),
            };
        },
        platformPermissionList () {
            return {
                addBtn: false,
                viewBtn: false,
                delBtn: false,
                editBtn: this.vaildData(this.permission.user_edit, false),
            };
        },
        ids () {
            let ids = [];
            this.selectionList.forEach((ele) => {
                ids.push(ele.id);
            });
            return ids.join(",");
        },
        ...mapState({
            userInfo: (state) => state.user.userInfo,
        }),
    },
    beforeCreate () { },
    created () {
      console.log(this.userInfo.role_name,123541);
        if(this.userInfo.role_name=="办证管理员"){
          console.log(this.userInfo.role_name,5555225);
            this.search["userType"] = 7;
        }
      );
    },
    platformBeforeOpen(done, type) {
      if (["edit", "view"].includes(type)) {
        getUserPlatform(this.platformForm.id).then((res) => {
          this.platformForm = res.data.data;
        });
      }
      done();
    mounted () {
        // this.option.column[0].hide = true
        // 非保安单位模式默认加载管理组数据
        if (!website.tenantMode) {
            this.initData(website.tenantId);
        }
        this.search["status"] = 1;
        if(this.userInfo.roleName=="办证管理员"){
            this.search["userType"] = 7;
        }
        this.deptIds = this.userInfo.dept_id;
    },
    platformSearchReset() {
      this.platformQuery = {};
      this.platformOnLoad(this.platformPage);
    methods: {
        handleImport1 () {
            this.excelBox1 = true;
        },
        uploadAfter1 (res, done, loading, column) {
            window.console.log(column);
            this.excelBox1 = false;
            this.refreshChange();
            done();
        },
        handleTemplate1 () {
            window.open(`/api/blade-user/export-template-security`);
        },
        handleImport2 () {
            this.excelBox2 = true;
        },
        uploadAfter2 (res, done, loading, column) {
            window.console.log(column);
            this.excelBox2 = false;
            this.refreshChange();
            done();
        },
        //行点击事件
        rowClick (row) {
            this.$router.push({
                path: "/securityGuardDetail",
                query: { row: JSON.stringify(row) },
            });
        },
        //行点击事件
        certificateClick (row) {
            if (row) {
                var time = this.getNewTime()
                this.certificateYear = time[0]
                this.certificateMonth = time[1]
                this.certificateObj = row
                setTimeout(() => {
                    this.Print();
                }, 500);
            }
        },
        Print () {
            if (this.certificateObj.registered == '' || this.certificateObj.registered == null) {
                this.$message({ message: '请完善住址信息', type: 'warning' })
                return
            }
            //更新发证时间
            var printDom = document.getElementById("certificateDom");
            printDom.style.position = "absolute";
            printDom.style.top = "-27.5%";
            printDom.style.left = "-23%";
            printDom.style.width = "120%";
            printDom.style.height = "100%";
            printDom.style.fontFamily = "SimSun";
            this.$print('#certificateDom', {
                noPrint: '.noPrint',
                onStart: () => {
                    // console.log('打印开始', Date.parse(new Date()));
                },
                onEnd: () => {
                    this.updateUserInfo();
                    // console.log('打印完成', Date.parse(new Date()));
                }
            });
        },
        getNewTime () {
            var nowTime = new Date()
            var oneHoursAgo = new Date(new Date(nowTime).getTime() - 1 * 60 * 60 * 1000)
            var oneHoursAgoY = oneHoursAgo.getFullYear()
            var oneHoursAgoM = oneHoursAgo.getMonth() + 1 < 10 ? '0' + (oneHoursAgo.getMonth() + 1) : oneHoursAgo.getMonth() + 1
            /**
             * @return 返回1小时,2小时,3小时,4小时,24小时
             */
            return [oneHoursAgoY, oneHoursAgoM]
        },
        //更新用户发证时间
        updateUserInfo () {
            var nowTime = new Date()
            var oneHoursAgo = new Date(new Date(nowTime).getTime() - 1 * 60 * 60 * 1000)
            var oneHoursAgoY = oneHoursAgo.getFullYear()
            var oneHoursAgoM = oneHoursAgo.getMonth() + 1 < 10 ? '0' + (oneHoursAgo.getMonth() + 1) : oneHoursAgo.getMonth() + 1
            var day = oneHoursAgo.getDay();
            var date = oneHoursAgoY + "-" + oneHoursAgoM + "-" + day;
            const data = {
                id: this.certificateObj.id,
                userType: 6,
                paperTime: date
            }
            updatePaperTime(data);
        },
        rowClickSelf (row) {
            this.$router.push({
                path: "/securityUnitChild",
                query: { fromSecunityGuardId: row },
            });
        },
        nodeClick (data) {
            this.treeDeptId = data.id;
            this.page.currentPage = 1;
            this.onLoad(this.page);
        },
        initData (tenantId) {
            // getRoleTree(tenantId).then((res) => {
            //   const column = this.findObject(this.option.group, "roleId");
            //   column.dicData = res.data.data;
            // });
            // getDeptTree(tenantId).then((res) => {
            //   const column = this.findObject(this.option.group, "deptId");
            //   column.dicData = res.data.data;
            // });
            // getPostList(tenantId).then((res) => {
            //   const column = this.findObject(this.option.group, "postId");
            //   column.dicData = res.data.data;
            // });
        },
        submitRole () {
            const roleList = this.$refs.treeRole.getCheckedKeys().join(",");
            grant(this.ids, roleList).then(() => {
                this.roleBox = false;
                this.$message({
                    type: "success",
                    message: "操作成功!",
                });
                this.onLoad(this.page);
            });
        },
        //制证申请
        handleSecurityApply () {
            if (this.choiceList.length === 0) {
                this.$message.warning("请勾选至少一位持证保安员");
                return;
            }
            this.$confirm("共选择制证申请人数" + this.choiceList.length + "人,确定申请制证?", {
                confirmButtonText: "确定",
                cancelButtonText: "取消",
                type: "warning",
            })
                .then(() => {
                    let cho = this.choiceList;
                    let str = "";
                    for (let k in cho) {
                        str += cho[k].id;
                        if (k != cho.length - 1) {
                            str += ",";
                        }
                    }
                    const data = {
                        ids: str,
                        createUser: this.userInfo.user_id
                    }
                    return securityApply(data);
                })
                .then(() => {
                    // this.$refs.crud.toggleSelection();
                    this.$message({
                        type: "success",
                        message: "操作成功!",
                    });
                });
        },
        rowSave (row, done, loading) {
            if (row.deptId) {
                row.deptId = row.deptId;
            }
            if (row.roleId) {
                row.roleId = row.roleId.join(",");
            }
            if (row.postId) {
                row.postId = row.postId.join(",");
            }
            const userMap = {
                user: {
                    account: row.account,
                    avatar: row.avatar,
                    fingerprint: row.fingerprint,
                    healstats: row.healstats,
                    address: row.address,
                    birthday: row.birthday,
                    cardid: row.cardid,
                    deptId: row.deptId,
                    education: row.education1,
                    email: row.email,
                    height: row.height,
                    hold: row.hold,
                    jurisdiction: row.jurisdiction,
                    myPicture: row.myPicture,
                    name: row.name,
                    nation: row.nation,
                    nativeplace: row.nativeplace,
                    password: row.password,
                    password2: row.password2,
                    phone: row.phone,
                    politicaloutlook: row.politicaloutlook,
                    realName: row.realName,
                    registered: row.registered,
                    rtime: row.rtime,
                    securitynumber: row.securitynumber,
                    sex: row.sex,
                },
            };
            securitySave(userMap).then(
                () => {
                    this.initFlag = false;
                    this.$alert("账号为身份证号码,密码为身份证后六位", "温馨提示", {
                        confirmButtonText: "确定",
                        callback: (action) => {
                            this.$message({
                                type: "success",
                                message: `操作成功`,
                            });
                            this.onLoad(this.page);
                            done();
                        },
                    });
                },
                (error) => {
                    window.console.log(error);
                    loading();
                }
            );
        },
        rowUpdate (row, index, done, loading) {
            row.deptId = row.deptId;
            row.roleId = row.roleId.join(",");
            row.postId = row.postId.join(",");
            //值替换,education 放在页面会卡死
            row.education = row.education1;
            update(row).then(
                () => {
                    this.initFlag = false;
                    this.onLoad(this.page);
                    this.$message({
                        type: "success",
                        message: "操作成功!",
                    });
                    done();
                },
                (error) => {
                    window.console.log(error);
                    loading();
                }
            );
        },
        rowDellook (row) {
            this.$alert(
                row.reasonForLeav == "" ? "未填写" : row.reasonForLeav,
                "离职原因",
                {
                    confirmButtonText: "确定",
                    callback: (action) => { },
                }
            );
        },
        rowStatus (row) {
            this.$prompt("离职原因", "提示", {
                confirmButtonText: "确定离职",
                cancelButtonText: "取消",
                inputErrorMessage: "",
            })
                .then(({ value }) => {
                    row.reasonForLeav = value;
                    row.status = "2";
                    // return;
                    update(row).then((res) => {
                        this.$message({
                            type: "success",
                            message: "操作成功",
                        });
                    });
                    this.refreshChange();
                })
                .catch(() => { });
        },
        rowDel (row) {
            this.$confirm("确定注销当前用户?", {
                confirmButtonText: "确定",
                cancelButtonText: "取消",
                type: "warning",
            })
                .then(() => {
                    return remove(row.id);
                })
                .then(() => {
                    this.onLoad(this.page);
                    this.$message({
                        type: "success",
                        message: "操作成功!",
                    });
                });
        },
        rowCheck (row) {
            this.$confirm("确定审查异常标记?", {
                confirmButtonText: "确定",
                cancelButtonText: "取消",
                type: "warning",
            })
                .then(() => {
                    row.examinationType = "1";
                    return update(row);
                })
                .then(() => {
                    this.onLoad(this.page);
                    this.$message({
                        type: "success",
                        message: "操作成功!",
                    });
                });
        },
        searchReset () {
            this.query = {};
            this.treeDeptId = "";
            this.onLoad(this.page);
        },
        searchChange (params, done) {
            this.query = params;
            this.page.currentPage = 1;
            this.onLoad(this.page, params);
            done();
        },
        selectionChange (list) {
            // this.selectionList = list;
            this.choiceList = [];
            for (let k in list) {
                this.choiceList.push({
                    id: list[k].id,
                });
            }
        },
        selectionClear () {
            // this.selectionList = [];
            // this.$refs.crud.toggleSelection();
        },
        handleDelete () {
            if (this.selectionList.length === 0) {
                this.$message.warning("请选择至少一条数据");
                return;
            }
            this.$confirm("确定将选择保安注销?", {
                confirmButtonText: "确定",
                cancelButtonText: "取消",
                type: "warning",
            })
                .then(() => {
                    return remove(this.ids);
                })
                .then(() => {
                    this.onLoad(this.page);
                    this.$message({
                        type: "success",
                        message: "操作成功!",
                    });
                    this.$refs.crud.toggleSelection();
                });
        },
        handleReset () {
            if (this.selectionList.length === 0) {
                this.$message.warning("请选择至少一条数据");
                return;
            }
            this.$confirm("确定将选择账号密码重置为123456?", {
                confirmButtonText: "确定",
                cancelButtonText: "取消",
                type: "warning",
            })
                .then(() => {
                    return resetPassword(this.ids);
                })
                .then(() => {
                    this.$message({
                        type: "success",
                        message: "操作成功!",
                    });
                    this.$refs.crud.toggleSelection();
                });
        },
        handleGrant () {
            if (this.selectionList.length === 0) {
                this.$message.warning("请选择至少一条数据");
                return;
            }
            this.roleTreeObj = [];
            if (this.selectionList.length === 1) {
                this.roleTreeObj = this.selectionList[0].roleId.split(",");
            }
            getRoleTree().then((res) => {
                this.roleGrantList = res.data.data;
                this.roleBox = true;
            });
        },
        handlePlatform () {
            this.platformBox = true;
        },
        handleImport () {
            this.excelBox = true;
        },
        uploadAfter (res, done, loading, column) {
            window.console.log(column);
            this.excelBox = false;
            this.refreshChange();
            done();
        },
        handleExport () {
            this.$confirm("是否导出保安数据?", "提示", {
                confirmButtonText: "确定",
                cancelButtonText: "取消",
                type: "warning",
            }).then(() => {
                window.open(
                    `/api/blade-user/export-user?${this.website.tokenHeader
                    }=${getToken()}&account=${this.search.account}&realName=${this.search.realName
                    }`
                );
            });
        },
        handleTemplate () {
            window.open(
                `/api/blade-user/export-template?${this.website.tokenHeader
                }=${getToken()}`
            );
        },
        beforeOpen (done, type) {
            var that = this;
            if (["edit", "view"].includes(type)) {
                getUser(this.form.id).then((res) => {
                    this.form = res.data.data;
                    var d = {
                        education1: res.data.data.education,
                    };
                    this.form = {
                        ...this.form,
                        ...d,
                    };
                    // this.from["education1"] = res.data.data.education;
                    if (this.form.hasOwnProperty("deptId")) {
                        this.form.deptId = this.form.deptId;
                    }
                    if (this.form.hasOwnProperty("roleId")) {
                        this.form.roleId = this.form.roleId.split(",");
                    }
                    if (this.form.hasOwnProperty("postId")) {
                        this.form.postId = this.form.postId.split(",");
                    }
                    var userInfo = res.data.data;
                    //获取用户从业信息
                    getUserPractitionersInfo(userInfo.id).then((res1) => {
                        that.form.UserPractitionersInfo = res1.data.data;
                    });
                });
            }
            this.initFlag = true;
            done();
        },
        currentChange (currentPage) {
            this.page.currentPage = currentPage;
        },
        //行样式调整
        rowStyle ({ row, column, rowIndex }) {
            if (row.examinationType == "1") {
                return {
                    color: "#ff2727",
                };
            }
        },
        sizeChange (pageSize) {
            this.page.pageSize = pageSize;
        },
        refreshChange () {
            this.onLoad(this.page, this.query);
        },
        onLoad (page, params = {}) {
            params = this.search;
            var that = this;
            //获取当前登录人员的角色信息
            var roleIds = this.userInfo.role_id.split(",");
            roleIds.forEach((roleId) => {
                getRoleDetail(roleId).then((res) => {
                    var roleAlias = res.data.data.roleAlias;
                    if (roleAlias == "保安公司管理员" || roleAlias == "保安") {
                        //去除保安公司查询
                        const column = that.findObject(that.option.column, "deptId");
                        column.search = false;
                        const deptColumn = that.findObject(that.option.group, "deptId");
                        deptColumn.dicUrl =
                            "/api/blade-system/dept/security_lazy-tree?parentId=1413470343230877697";
                        //禁止编辑
                        deptColumn.disabled = true;
                        deptColumn.value = that.userInfo.dept_id;
                        that.isSecurity = false;
                        //如果是保安公司管理员
                        params["deptId"] = that.userInfo.dept_id;
                        //导入action 修改
                        const importColumn = that.findObject(
                            that.excelOption1.column,
                            "excelFile"
                        );
                        importColumn.action =
                            "/api/blade-user/import-user?deptId=" + this.deptIds;
                    } else if (roleAlias == "公安管理员") {
                        params["jurisdiction"] = that.userInfo.jurisdiction;
                        var columnDept = that.findObject(that.option.column, "deptId");
                        columnDept.dicUrl =
                            "/api/blade-system/dept/security_lazy-tree?parentId=1413470343230877697&jurisdiction=" +
                            that.userInfo.jurisdiction;
                        var ColumnDeptUpdate = that.findObject(that.option.group, "deptId");
                        ColumnDeptUpdate.dicUrl =
                            "/api/blade-system/dept/security_lazy-tree?parentId=1413470343230877697&jurisdiction=" +
                            that.userInfo.jurisdiction;
                    } else if (roleAlias == "培训公司管理员") {
                        //如果是保安公司管理员
                        params["trainingUnitId"] = that.userInfo.dept_id;
                        var columnDept2 = that.findObject(that.option.column, "deptId");
                        columnDept2.dicUrl =
                            "/api/blade-system/dept/security_lazy-tree?parentId=1413470343230877697";
                        var ColumnDeptUpdate2 = that.findObject(
                            that.option.group,
                            "deptId"
                        );
                        ColumnDeptUpdate2.dicUrl =
                            "/api/blade-system/dept/security_lazy-tree?parentId=1413470343230877697";
                    } else {
                        var columnDept1 = that.findObject(that.option.column, "deptId");
                        columnDept1.dicUrl =
                            "/api/blade-system/dept/security_lazy-tree?parentId=1413470343230877697";
                        var ColumnDeptUpdate1 = that.findObject(
                            that.option.group,
                            "deptId"
                        );
                        ColumnDeptUpdate1.dicUrl =
                            "/api/blade-system/dept/security_lazy-tree?parentId=1413470343230877697";
                    }
                    let values = {
                        ...params,
                    };
                    values = {
                        ...params,
                        roleAlias: "111",
                        ...that.query,
                    };
                    that.loading = true;
                    getList(page.currentPage, page.pageSize, values).then((res) => {
                        const data = res.data.data;
                        that.page.total = data.total;
                        var d = data.records;
                        var date = new Date();
                        var datayear = date.getFullYear();
                        for (const key in d) {
                            var year = d[key].cardid.slice(6, 10);
                            d[key]["age"] = +datayear - +year;
                            // d[key].securitynumber = "赣洪202100009";
                        }
                        that.data = data.records;
                        that.loading = false;
                        that.selectionClear();
                    });
                });
            });
        },
        platformRowUpdate (row, index, done, loading) {
            updatePlatform(row.id, row.userType, row.userExt).then(
                () => {
                    this.platformOnLoad(this.platformPage);
                    this.$message({
                        type: "success",
                        message: "操作成功!",
                    });
                    done();
                },
                (error) => {
                    window.console.log(error);
                    loading();
                }
            );
        },
        platformBeforeOpen (done, type) {
            if (["edit", "view"].includes(type)) {
                getUserPlatform(this.platformForm.id).then((res) => {
                    this.platformForm = res.data.data;
                });
            }
            done();
        },
        platformSearchReset () {
            this.platformQuery = {};
            this.platformOnLoad(this.platformPage);
        },
        platformSearchChange (params, done) {
            this.platformQuery = params;
            this.platformPage.currentPage = 1;
            this.platformOnLoad(this.platformPage, params);
            done();
        },
        platformSelectionChange (list) {
            this.platformSelectionList = list;
        },
        platformSelectionClear () {
            this.platformSelectionList = [];
            this.$refs.platformCrud.toggleSelection();
        },
        platformCurrentChange (currentPage) {
            this.platformPage.currentPage = currentPage;
        },
        platformSizeChange (pageSize) {
            this.platformPage.pageSize = pageSize;
        },
        platformRefreshChange () {
            this.platformOnLoad(this.platformPage, this.platformQuery);
        },
        platformOnLoad (page, params = {}) {
            this.platformLoading = true;
            getList(
                page.currentPage,
                page.pageSize,
                Object.assign(params, this.query),
                this.treeDeptId
            ).then((res) => {
                const data = res.data.data;
                this.platformPage.total = data.total;
                this.platformData = data.records;
                this.platformLoading = false;
                this.selectionClear();
            });
        },
    },
    platformSearchChange(params, done) {
      this.platformQuery = params;
      this.platformPage.currentPage = 1;
      this.platformOnLoad(this.platformPage, params);
      done();
    },
    platformSelectionChange(list) {
      this.platformSelectionList = list;
    },
    platformSelectionClear() {
      this.platformSelectionList = [];
      this.$refs.platformCrud.toggleSelection();
    },
    platformCurrentChange(currentPage) {
      this.platformPage.currentPage = currentPage;
    },
    platformSizeChange(pageSize) {
      this.platformPage.pageSize = pageSize;
    },
    platformRefreshChange() {
      this.platformOnLoad(this.platformPage, this.platformQuery);
    },
    platformOnLoad(page, params = {}) {
      this.platformLoading = true;
      getList(
        page.currentPage,
        page.pageSize,
        Object.assign(params, this.query),
        this.treeDeptId
      ).then((res) => {
        const data = res.data.data;
        this.platformPage.total = data.total;
        this.platformData = data.records;
        this.platformLoading = false;
        this.selectionClear();
      });
    },
  },
};
</script>
<style lang="scss" scoped>
.box {
  height: 800px;
    height: 800px;
}
.el-scrollbar {
  height: 100%;
    height: 100%;
}
.box .el-scrollbar__wrap {
  overflow: scroll;
    overflow: scroll;
}
.rowClickSelf {
  &:hover {
    cursor: pointer;
  }
    &:hover {
        cursor: pointer;
    }
}
</style>
//保安证  本子
.certificate_box {
    width: 100%;
    height: 90%;
    background-color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    font: normal 18px 'SimSuncss' !important;
}
.security_main {
    width: 630px;
    height: 512px;
    //   border: 1px solid rgba($color: #a5a5a5, $alpha: 0.5);
    // display: flex;
    // align-items: center;
    // justify-content: space-around;
    // background-size: 100% 100%;
    // background-repeat: no-repeat;
    position: relative;
}
// 标题
$upTop: 45px;
$downTop: 265px; //整体高度
//经国家保安员考试审查合格。<br />特颁此证。
.security_main-title {
    position: absolute;
    top: $upTop;
    left: 34px;
    line-height: 45px;
    letter-spacing: 3px;
}
//发证公安机关&nbsp;(印章)
.security_m_l_center {
    position: absolute;
    top: 270px;
    left: 30px;
    line-height: 40px;
}
//证件编号 &nbsp;
.security_m_l_down {
    position: absolute;
    top: 379px;
    left: 32px;
}
$rightLeft: 343px;
$rightFontSize: 18px;
$rightWidth: 77px;
$lineHigeht: 30px;
//姓名
.security_m_r_a {
    position: absolute;
    top: $downTop;
    left: $rightLeft;
    width: $rightWidth;
    text-align: justify;
    text-align-last: justify;
}
//出生年月
.security_m_r_b {
    position: absolute;
    top: $downTop + $lineHigeht * 1;
    left: $rightLeft;
    width: $rightWidth;
    text-align: justify;
    text-align-last: justify;
}
//地址
.security_m_r_c {
    position: absolute;
    top: $downTop + $lineHigeht * 2;
    left: $rightLeft;
    width: $rightWidth;
    text-align: justify;
    text-align-last: justify;
}
//公民身份证
.security_m_r_d {
    position: absolute;
    top: 363px;
    left: $rightLeft;
    width: $rightWidth;
    text-align: justify;
    text-align-last: justify;
}
//照片
// width: calc(358px / 22px);
// height: calc(441px / 22px);
.security_m_r_imgs {
    width: calc(358px / 3);
    height: calc(441px / 3);
    position: absolute;
    top: $upTop;
    left: 421px;
    img {
        width: 100%;
        height: 100%;
    }
}
// 内容
// 抬头名字
.security_m_l_titleName {
    position: absolute;
    top: 35px;
    left: 121px;
    right: 0;
    line-height: 45px;
    letter-spacing: 3px;
}
//发证时间
$timeTop: 304px; //整体高度
//年
.security_m_l_titlepaperTimenian {
    position: absolute;
    top: $timeTop;
    left: 107px;
    line-height: 40px;
}
//月
.security_m_l_titlepaperTimeyue {
    position: absolute;
    top: $timeTop;
    left: 166px;
    line-height: 40px;
}
//日
.security_m_l_titlepaperTimeri {
    position: absolute;
    top: $timeTop;
    left: 159px;
    line-height: 40px;
}
//证件编号
.security_m_l_downsecuritynumber {
    position: absolute;
    top: 379px; //整体高度
    left: 145px;
}
//内容
// 姓名
$centerLeft: 458px;
.security_m_r_o_right {
    position: absolute;
    top: $downTop + $lineHigeht * 0-2px;
    left: $centerLeft;
    // width: $rightWidth;
}
// 生日
.security_m_r_o_rightbirthday {
    position: absolute;
    top: $downTop + $lineHigeht * 1-4px;
    left: $centerLeft;
    // width: $rightWidth;
}
// 地址
.security_m_r_o_rightaddress {
    position: absolute;
    top: $downTop + $lineHigeht * 2 -6px;
    left: $centerLeft;
    width: 160px;
}
// 身份证
.security_m_r_o_rightcardid {
    position: absolute;
    top: $downTop + $lineHigeht * 4 -2px;
    left: $centerLeft;
    // width: $rightWidth;
}
//背景图
.security_main_backImge {
    position: absolute;
    width: 100%;
    height: 100%;
    background-image: url(/img/securityCertificate/bazsss.png);
    background-size: 100% 100%;
    background-repeat: no-repeat;
}
.security_m_r_o_jg{
   position: absolute;
    top: 260px;
    left: 230px;
    line-height: 40px;
    letter-spacing: 2px;
}
</style>
src/views/securityGuard/securityGuardDetail.vue
@@ -1,42 +1,41 @@
<template>
  <div class="dispatch">
    <avue-tabs :option="optionTABS" @change="handleChangeTABS"></avue-tabs>
    <span v-if="typeTABS.prop === 'tab1'">
      <avue-form ref="form" v-model="obj0" :option="option0"> </avue-form>
    </span>
    <span v-else-if="typeTABS.prop === 'tab2'">
      <avue-crud
        :option="option1"
        :data="data1"
        :page.sync="page1"
        :table-loading="loading1"
        @row-save="rowSave1"
        @row-update="rowUpdate1"
        @row-del="rowDel1"
        @current-change="CurrentChange1"
        @refresh-change="refreshchange1"
        @size-change="SizeChange1"
      >
      </avue-crud>
    </span>
    <span v-else-if="typeTABS.prop === 'tab3'">
      <avue-crud
        :option="option2"
        :data="data2"
        :page.sync="page2"
        @row-save="rowSave2"
        @row-update="rowUpdate2"
        @row-del="rowDel2"
        :table-loading="loading2"
        @current-change="CurrentChange2"
        @size-change="SizeChange2"
        @refresh-change="refreshchange2"
      >
      </avue-crud>
    </span>
    <span v-else-if="typeTABS.prop === 'tab4'">
      <!-- 保安员证 -->
      <!-- <div class="baoanzheng" id="baoanzheng" v-if="hold == 1">
    <div class="dispatch">
        <avue-tabs :option="optionTABS"
                   @change="handleChangeTABS"></avue-tabs>
        <span v-if="typeTABS.prop === 'tab1'">
            <avue-form ref="form"
                       v-model="obj0"
                       :option="option0"> </avue-form>
        </span>
        <span v-else-if="typeTABS.prop === 'tab2'">
            <avue-crud :option="option1"
                       :data="data1"
                       :page.sync="page1"
                       :table-loading="loading1"
                       @row-save="rowSave1"
                       @row-update="rowUpdate1"
                       @row-del="rowDel1"
                       @current-change="CurrentChange1"
                       @refresh-change="refreshchange1"
                       @size-change="SizeChange1">
            </avue-crud>
        </span>
        <span v-else-if="typeTABS.prop === 'tab3'">
            <avue-crud :option="option2"
                       :data="data2"
                       :page.sync="page2"
                       @row-save="rowSave2"
                       @row-update="rowUpdate2"
                       @row-del="rowDel2"
                       :table-loading="loading2"
                       @current-change="CurrentChange2"
                       @size-change="SizeChange2"
                       @refresh-change="refreshchange2">
            </avue-crud>
        </span>
        <span v-else-if="typeTABS.prop === 'tab4'">
            <!-- 保安员证 -->
            <!-- <div class="baoanzheng" id="baoanzheng" v-if="hold == 1">
        <div class="baz-main">
          <div class="baz-m-body" ref="baoanzheng">
            <div class="bmb-heard">保安员证</div>
@@ -72,41 +71,43 @@
          </span>
        </div>
      </div> -->
      <baoanz :data="obj0" v-if="hold == 1"></baoanz>
      <div v-else style="width: 100%; text-align: center; padding-top: 20px">
        无上岗证
      </div>
    </span>
    <span v-else-if="typeTABS.prop === 'tab5'">
      <securityCertificate :data="obj0" v-if="hold == 1"></securityCertificate>
      <div v-else style="width: 100%; text-align: center; padding-top: 20px">
        无保安员证
      </div>
    </span>
  </div>
</template>
            <baoanz :data="obj0"
                    v-if="hold == 1"></baoanz>
            <div v-else
                 style="width: 100%; text-align: center; padding-top: 20px">
                无上岗证
            </div>
        </span>
        <span v-else-if="typeTABS.prop === 'tab5'">
            <securityCertificate :data="obj0"
                                 v-if="hold == 1"></securityCertificate>
            <div v-else
                 style="width: 100%; text-align: center; padding-top: 20px">
                无保安员证
            </div>
        </span>
    </div>
</template>
<script>
import {
  securityBaseInfoColumn,
  practitionersColumn,
  trackRecordColumn,
    securityBaseInfoColumn,
    practitionersColumn,
    trackRecordColumn,
} from "./data";
import {
  addExperience,
  updateExperience,
  getExperienceDetail,
  experienceRemove,
  getExperienceList,
    addExperience,
    updateExperience,
    experienceRemove,
    getExperienceList,
} from "@/api/experience/experience";
import {
  getPerformanceInfo,
  add,
  update,
  getpage,
  remove,
  getER,
    add,
    update,
    getpage,
    remove,
    getER,
} from "@/api/performance/performance";
// import vueQr from "vue-qr";
@@ -114,364 +115,364 @@
import baoanz from "./baoanz.vue";
export default {
  components: {
    securityCertificate: securityCertificate,
    baoanz,
  },
  data() {
    return {
      typeTABS: {}, //标签页
      row: {}, //数据
      optionTABS: {
        column: [
          {
            // icon: "el-icon-info",
            label: "保安员基本信息",
            prop: "tab1",
          },
          {
            // icon: "el-icon-info",
            label: "从业记录",
            prop: "tab2",
          },
          {
            // icon: "el-icon-info",
            label: "现实表现记录",
            prop: "tab3",
          },
          {
            // icon: "el-icon-info",
            label: "上岗证",
            prop: "tab4",
          },
          {
            // icon: "el-icon-info",
            label: "保安员证",
            prop: "tab5",
          },
        ],
      },
      current: 1,
      size: 10,
      cardid: "",
      name: "",
      dispatcherCompany: "",
      id: "",
      obj0: {
        title: "我是头部标题",
      },
      option0: {
        emptyBtn: false,
        submitBtn: false,
        labelWidth: "110",
        gutter: 30,
        column: securityBaseInfoColumn,
      },
      loading1: true,
      loading2: true,
      selectionList1: [],
      page1: {
        pageSize: 10,
        currentPage: 1,
        total: 0,
      },
      page2: {
        pageSize: 10,
        currentPage: 1,
        total: 0,
      },
      query1: {},
      query2: {},
      data1: [],
      data2: [],
      option1: {
        card: true,
        menu: true,
        height: "auto",
        widtd: "auto",
        calcHeight: 54,
        border: true, //liu
        stripe: true,
        tip: false,
        index: true,
        dialogClickModal: false,
        headerAlign: "center",
        align: "center",
        column: practitionersColumn,
      },
      option2: {
        card: true,
        menu: true,
        height: "auto",
        widtd: "auto",
        calcHeight: 54,
        border: true, //liu
        stripe: true,
        tip: false,
        index: true,
        dialogClickModal: false,
        headerAlign: "center",
        align: "center",
        column: trackRecordColumn,
      },
      erweima: "",
      hold: "",
    };
  },
  // components: {
  //   vueQr,
  // },
  computed: {
    ids1() {
      let ids1 = [];
      this.selectionList1.forEach((ele) => {
        ids1.push(ele.id);
      });
      return ids1.join(",");
    components: {
        securityCertificate: securityCertificate,
        baoanz,
    },
    // goToUrl() {
    //   var url =
    //     "http://s16s652780.51mypc.cn/securityInfo/securityInfo.html?securityNumber=" +
    //     this.obj0.securitynumber;
    //   return url;
    data () {
        return {
            typeTABS: {}, //标签页
            row: {}, //数据
            optionTABS: {
                column: [
                    {
                        // icon: "el-icon-info",
                        label: "保安员基本信息",
                        prop: "tab1",
                    },
                    {
                        // icon: "el-icon-info",
                        label: "从业记录",
                        prop: "tab2",
                    },
                    {
                        // icon: "el-icon-info",
                        label: "现实表现记录",
                        prop: "tab3",
                    },
                    {
                        // icon: "el-icon-info",
                        label: "上岗证",
                        prop: "tab4",
                    },
                    {
                        // icon: "el-icon-info",
                        label: "保安员证",
                        prop: "tab5",
                    },
                ],
            },
            current: 1,
            size: 10,
            cardid: "",
            name: "",
            dispatcherCompany: "",
            id: "",
            obj0: {
                title: "我是头部标题",
            },
            option0: {
                emptyBtn: false,
                submitBtn: false,
                labelWidth: "110",
                gutter: 30,
                column: securityBaseInfoColumn,
            },
            loading1: true,
            loading2: true,
            selectionList1: [],
            page1: {
                pageSize: 10,
                currentPage: 1,
                total: 0,
            },
            page2: {
                pageSize: 10,
                currentPage: 1,
                total: 0,
            },
            query1: {},
            query2: {},
            data1: [],
            data2: [],
            option1: {
                card: true,
                menu: true,
                height: "auto",
                widtd: "auto",
                calcHeight: 54,
                border: true, //liu
                stripe: true,
                tip: false,
                index: true,
                dialogClickModal: false,
                headerAlign: "center",
                align: "center",
                column: practitionersColumn,
            },
            option2: {
                card: true,
                menu: true,
                height: "auto",
                widtd: "auto",
                calcHeight: 54,
                border: true, //liu
                stripe: true,
                tip: false,
                index: true,
                dialogClickModal: false,
                headerAlign: "center",
                align: "center",
                column: trackRecordColumn,
            },
            erweima: "",
            hold: "",
        };
    },
    // components: {
    //   vueQr,
    // },
  },
  methods: {
    Print() {
      var printDom = document.getElementById("baoanzheng");
      printDom.style.position = "fixed";
      printDom.style.left = "-10%";
      printDom.style.width = "120%";
      printDom.style.height = "100%";
      this.$Print(this.$refs.baoanzheng);
      printDom.style.position = "relative";
      printDom.style.left = "0";
      printDom.style.width = "100%";
      printDom.style.height = "calc(100% - 100px)";
    computed: {
        ids1 () {
            let ids1 = [];
            this.selectionList1.forEach((ele) => {
                ids1.push(ele.id);
            });
            return ids1.join(",");
        },
        // goToUrl() {
        //   var url =
        //     "http://s16s652780.51mypc.cn/securityInfo/securityInfo.html?securityNumber=" +
        //     this.obj0.securitynumber;
        //   return url;
        // },
    },
    handleChangeTABS(column) {
      this.typeTABS = column;
      if (column.prop == "tab1") {
        this.loading1 = false;
      } else if (column.prop == "tab2") {
    methods: {
        Print () {
            var printDom = document.getElementById("baoanzheng");
            printDom.style.position = "fixed";
            printDom.style.left = "-10%";
            printDom.style.width = "120%";
            printDom.style.height = "100%";
            this.$Print(this.$refs.baoanzheng);
            printDom.style.position = "relative";
            printDom.style.left = "0";
            printDom.style.width = "100%";
            printDom.style.height = "calc(100% - 100px)";
        },
        handleChangeTABS (column) {
            this.typeTABS = column;
            if (column.prop == "tab1") {
                this.loading1 = false;
            } else if (column.prop == "tab2") {
                //查询当前保安员的从业记录信息
                this.getPractitionersPageInfo(this.page1);
                this.loading1 = false;
            } else if (column.prop == "tab3") {
                //查询当前保安员的现实表现记录
                this.getPerformancePageInfo(this.page2);
                this.loading2 = false;
            } else if (column.prop == "tab4") {
                getER(this.obj0.securitynumber).then((res) => {
                    this.erweima = res.data;
                    // console.log(res.data);
                });
            }
        },
        refreshchange1 () {
            this.getPractitionersPageInfo(this.page1, this.query1);
        },
        //查询当前保安员的从业记录信息
        this.getPractitionersPageInfo(this.page1);
        this.loading1 = false;
      } else if (column.prop == "tab3") {
        //查询当前保安员的现实表现记录
        this.getPerformancePageInfo(this.page2);
        this.loading2 = false;
      } else if (column.prop == "tab4") {
        getER(this.obj0.securitynumber).then((res) => {
          this.erweima = res.data;
          // console.log(res.data);
        });
      }
    },
    refreshchange1() {
      this.getPractitionersPageInfo(this.page1, this.query1);
    },
    //查询当前保安员的从业记录信息
    getPractitionersPageInfo(page, param = {}) {
      param["securityid"] = this.id;
      //获取用户从业信息
      // console.log(this.id, "cid");
        getPractitionersPageInfo (page, param = {}) {
            param["securityid"] = this.id;
            //获取用户从业信息
            // console.log(this.id, "cid");
      getExperienceList(page.currentPage, page.pageSize, param).then((res1) => {
        const data = res1.data.data;
        this.page1.total = data.total;
        this.data1 = data.records;
        this.loading1 = false;
      });
    },
    refreshchange2() {
      this.getPerformancePageInfo(this.page2, this.query2);
    },
    //查询当前保安员的现实表现记录信息
    getPerformancePageInfo(page, param = {}) {
      //获取现实表现信息
      param["securityid"] = this.id;
      getpage(page.currentPage, page.pageSize, param).then((res2) => {
        const data = res2.data.data;
        this.page2.total = data.total;
        this.data2 = data.records;
        console.log(this.data2, 1);
        this.loading2 = false;
      });
    },
    CurrentChange1(currentPage) {
      this.page1.currentPage = currentPage;
      this.refreshchange1();
    },
    SizeChange1(pageSize) {
      this.page1.pageSize = pageSize;
      this.refreshchange1();
    },
    CurrentChange2(currentPage) {
      this.page2.currentPage = currentPage;
      this.refreshchange2();
    },
    SizeChange2(pageSize) {
      this.page2.pageSize = pageSize;
      this.refreshchange2();
    },
    // refreshChange1() {
    //   this.getPractitionersPageInfo();
    // },
    // refreshChange2() {
    //   this.getPerformancePageInfo();
    // },
            getExperienceList(page.currentPage, page.pageSize, param).then((res1) => {
                const data = res1.data.data;
                this.page1.total = data.total;
                this.data1 = data.records;
                this.loading1 = false;
            });
        },
        refreshchange2 () {
            this.getPerformancePageInfo(this.page2, this.query2);
        },
        //查询当前保安员的现实表现记录信息
        getPerformancePageInfo (page, param = {}) {
            //获取现实表现信息
            param["securityid"] = this.id;
            getpage(page.currentPage, page.pageSize, param).then((res2) => {
                const data = res2.data.data;
                this.page2.total = data.total;
                this.data2 = data.records;
                console.log(this.data2, 1);
                this.loading2 = false;
            });
        },
        CurrentChange1 (currentPage) {
            this.page1.currentPage = currentPage;
            this.refreshchange1();
        },
        SizeChange1 (pageSize) {
            this.page1.pageSize = pageSize;
            this.refreshchange1();
        },
        CurrentChange2 (currentPage) {
            this.page2.currentPage = currentPage;
            this.refreshchange2();
        },
        SizeChange2 (pageSize) {
            this.page2.pageSize = pageSize;
            this.refreshchange2();
        },
        // refreshChange1() {
        //   this.getPractitionersPageInfo();
        // },
        // refreshChange2() {
        //   this.getPerformancePageInfo();
        // },
    rowSave2(form, done, loading) {
      form.securityid = this.id;
      add(form).then(
        (res) => {
          this.getPerformancePageInfo(this.page2);
          this.$message({
            type: "success",
            message: "操作成功!",
          });
          done();
        rowSave2 (form, done, loading) {
            form.securityid = this.id;
            add(form).then(
                (res) => {
                    this.getPerformancePageInfo(this.page2);
                    this.$message({
                        type: "success",
                        message: "操作成功!",
                    });
                    done();
                },
                (error) => {
                    window.console.log(error);
                    loading();
                }
            );
            // }
        },
        (error) => {
          window.console.log(error);
          loading();
        }
      );
      // }
    },
    //从业记录新增
    rowSave1(form, done, loading) {
      form.securityid = this.id;
      addExperience(form).then(
        (res) => {
          this.getPractitionersPageInfo(this.page1);
          this.$message({
            type: "success",
            message: "操作成功!",
          });
          done();
        //从业记录新增
        rowSave1 (form, done, loading) {
            form.securityid = this.id;
            addExperience(form).then(
                (res) => {
                    this.getPractitionersPageInfo(this.page1);
                    this.$message({
                        type: "success",
                        message: "操作成功!",
                    });
                    done();
                },
                (error) => {
                    window.console.log(error);
                    loading();
                }
            );
            // }
        },
        (error) => {
          window.console.log(error);
          loading();
        }
      );
      // }
    },
    rowUpdate2(row, index, done, loading) {
      row.securityid = this.id;
      update(row).then(
        () => {
          this.getPerformancePageInfo(this.page2);
          this.$message({
            type: "success",
            message: "操作成功!",
          });
          done();
        rowUpdate2 (row, index, done, loading) {
            row.securityid = this.id;
            update(row).then(
                () => {
                    this.getPerformancePageInfo(this.page2);
                    this.$message({
                        type: "success",
                        message: "操作成功!",
                    });
                    done();
                },
                (error) => {
                    window.console.log(error);
                    loading();
                }
            );
        },
        (error) => {
          window.console.log(error);
          loading();
        }
      );
    },
    rowUpdate1(row, index, done, loading) {
      row.securityid = this.id;
      updateExperience(row).then(
        () => {
          this.getPractitionersPageInfo(this.page1);
          this.$message({
            type: "success",
            message: "操作成功!",
          });
          done();
        rowUpdate1 (row, index, done, loading) {
            row.securityid = this.id;
            updateExperience(row).then(
                () => {
                    this.getPractitionersPageInfo(this.page1);
                    this.$message({
                        type: "success",
                        message: "操作成功!",
                    });
                    done();
                },
                (error) => {
                    window.console.log(error);
                    loading();
                }
            );
        },
        (error) => {
          window.console.log(error);
          loading();
        rowDel2 (row) {
            this.$confirm("确定将选择数据删除?", {
                confirmButtonText: "确定",
                cancelButtonText: "取消",
                type: "warning",
            })
                .then(() => {
                    return remove(row.id);
                })
                .then(() => {
                    this.getPerformancePageInfo(this.page2);
                    this.$message({
                        type: "success",
                        message: "操作成功!",
                    });
                });
        },
        rowDel1 (row) {
            this.$confirm("确定将选择数据删除?", {
                confirmButtonText: "确定",
                cancelButtonText: "取消",
                type: "warning",
            })
                .then(() => {
                    return experienceRemove(row.id);
                })
                .then(() => {
                    this.getPractitionersPageInfo(this.page1);
                    this.$message({
                        type: "success",
                        message: "操作成功!",
                    });
                });
        },
    },
    mounted () {
        this.typeTABS = this.optionTABS.column[0];
        var data = JSON.parse(this.$route.query.row);
        // console.log(data);
        if (data) {
            var row = data;
            // var row = this.$route.query.row;
            for (var k in row) {
                this.obj0[k] = row[k];
            }
            this.obj0.title = "";
            this.cardid = row.id;
            this.name = row.name;
            this.dispatcherCompany = row.dispatcherCompany;
            this.id = row.id;
            this.hold = row.hold;
            console.log(this.obj0);
        }
      );
    },
    rowDel2(row) {
      this.$confirm("确定将选择数据删除?", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      })
        .then(() => {
          return remove(row.id);
        })
        .then(() => {
          this.getPerformancePageInfo(this.page2);
          this.$message({
            type: "success",
            message: "操作成功!",
          });
        });
    },
    rowDel1(row) {
      this.$confirm("确定将选择数据删除?", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      })
        .then(() => {
          return experienceRemove(row.id);
        })
        .then(() => {
          this.getPractitionersPageInfo(this.page1);
          this.$message({
            type: "success",
            message: "操作成功!",
          });
        });
    },
  },
  mounted() {
    this.typeTABS = this.optionTABS.column[0];
    var data = JSON.parse(this.$route.query.row);
    // console.log(data);
    if (data) {
      var row = data;
      // var row = this.$route.query.row;
      for (var k in row) {
        this.obj0[k] = row[k];
      }
      this.obj0.title = "";
      this.cardid = row.id;
      this.name = row.name;
      this.dispatcherCompany = row.dispatcherCompany;
      this.id = row.id;
      this.hold = row.hold;
      console.log(this.obj0);
    }
    var flag = false,
      i = 0,
      ind = null;
    this.$store.state.tags.tagList.forEach((item, index) => {
      if (item.label == "保安员详情") {
        if (flag == false) {
          ind = index;
          flag = true;
        var flag = false,
            i = 0,
            ind = null;
        this.$store.state.tags.tagList.forEach((item, index) => {
            if (item.label == "保安员详情") {
                if (flag == false) {
                    ind = index;
                    flag = true;
                }
                i++;
            }
        });
        if (i > 1) {
            this.$store.state.tags.tagList.splice(ind, 1);
        }
        i++;
      }
    });
    if (i > 1) {
      this.$store.state.tags.tagList.splice(ind, 1);
    }
  },
    },
};
</script>
<style lang="scss">
.dispatch {
  width: 100%;
  height: 100%;
  //   border: 1px solid #000;
  box-sizing: border-box;
    width: 100%;
    height: 100%;
    //   border: 1px solid #000;
    box-sizing: border-box;
}
// .el-card__body {
//   padding-bottom: 5px !important;
@@ -483,100 +484,100 @@
// }
.baoanzheng {
  // position: fixed;
  position: relative;
  // top: 0;
  top: 0;
  // left: -10%;
  left: 0;
  // height: 0;
  width: 100%;
  height: calc(100% - 100px);
  // background-color: rgba(0, 0, 0, 0.5);
  background-color: #fff;
  z-index: 9000;
  display: flex;
  align-items: center;
  justify-content: center;
    // position: fixed;
    position: relative;
    // top: 0;
    top: 0;
    // left: -10%;
    left: 0;
    // height: 0;
    width: 100%;
    height: calc(100% - 100px);
    // background-color: rgba(0, 0, 0, 0.5);
    background-color: #fff;
    z-index: 9000;
    display: flex;
    align-items: center;
    justify-content: center;
}
.baz-main {
  position: relative;
  top: 15px;
  // width: 441px;
  // height: 358px;
  width: 750px;
  height: 550px;
  // background-color: #004ca7;
  background-color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
    position: relative;
    top: 15px;
    // width: 441px;
    // height: 358px;
    width: 750px;
    height: 550px;
    // background-color: #004ca7;
    background-color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
}
.baz-m-body {
  width: 750px;
  height: 550px;
  background-image: url("/img/register/bazbj1.png");
  background-size: 100% 100%;
  .bmb-heard {
    font-size: 4rem;
    width: 100%;
    text-align: center;
    letter-spacing: 1.4rem;
    margin-bottom: 40px;
    padding-left: 10px;
    position: relative;
    top: 20px;
  }
  .img {
    width: 358px;
    height: 441px;
    border-radius: 10px;
    position: absolute;
    // border: 1px solid rgba($color: #888888, $alpha: 0.5);
    top: 110px;
    right: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    img {
      width: 100%;
      height: 100%;
    width: 750px;
    height: 550px;
    background-image: url('/img/register/bazbj1.png');
    background-size: 100% 100%;
    .bmb-heard {
        font-size: 4rem;
        width: 100%;
        text-align: center;
        letter-spacing: 1.4rem;
        margin-bottom: 40px;
        padding-left: 10px;
        position: relative;
        top: 20px;
    }
  }
  .imgs {
    width: 110px;
    height: 110px;
    border-radius: 10px;
    position: absolute;
    // border: 1px solid rgba($color: #888888, $alpha: 0.5);
    top: 330px;
    right: 103px;
    display: flex;
    align-items: center;
    justify-content: center;
    img {
      width: 100%;
      height: 100%;
    .img {
        width: 358px;
        height: 441px;
        border-radius: 10px;
        position: absolute;
        // border: 1px solid rgba($color: #888888, $alpha: 0.5);
        top: 110px;
        right: 80px;
        display: flex;
        align-items: center;
        justify-content: center;
        img {
            width: 100%;
            height: 100%;
        }
    }
  }
  .bmb-b {
    padding-left: 20px;
    box-sizing: border-box;
    height: 3.9rem;
    margin-left: 3rem;
    width: 100%;
    font-size: 2rem;
    font-weight: 300;
    .bmb-b-s {
      display: inline-block;
      width: 20rem;
      font-size: 2rem;
      font-weight: 300;
    .imgs {
        width: 110px;
        height: 110px;
        border-radius: 10px;
        position: absolute;
        // border: 1px solid rgba($color: #888888, $alpha: 0.5);
        top: 330px;
        right: 103px;
        display: flex;
        align-items: center;
        justify-content: center;
        img {
            width: 100%;
            height: 100%;
        }
    }
  }
    .bmb-b {
        padding-left: 20px;
        box-sizing: border-box;
        height: 3.9rem;
        margin-left: 3rem;
        width: 100%;
        font-size: 2rem;
        font-weight: 300;
        .bmb-b-s {
            display: inline-block;
            width: 20rem;
            font-size: 2rem;
            font-weight: 300;
        }
    }
}
.PrintBut {
  margin-top: 15px;
    margin-top: 15px;
}
</style>
</style>
src/views/trainExam/modifiedGrades.vue
New file
@@ -0,0 +1,629 @@
/*
 * @Author: Morpheus
 * @Date: 2021-07-05 16:31:54
 * @Last Modified by: Morpheus
 * @Last Modified time: 2021-11-04 18:54:44
 * menu-name 成绩修改管理
 */
<template>
    <el-row class="morpheus-box">
        <el-col :span="24"
                class="recruitmentManagement">
            <el-card>
                <div class="exam-card-body">
                    <avue-crud v-model="obj"
                               class="company-box"
                               :option="questionBankOption"
                               :search.sync="questionBankSearch"
                               :table-loading="questionBankLoading"
                               :data="questionBankData"
                               :permission="permissionList"
                               ref="questionBankCrud"
                               :page.sync="questionBankPage"
                               @on-load="questionBankOnLoad"
                               @selection-change="questionBankSelectionChange"
                               @search-change="questionBankSearchChange"
                               @search-reset="questionBankSearchReset"
                               @current-change="questionBankCurrentChange"
                               @size-change="questionBankSizeChange"
                               @row-update="questionBankRowUpdate"
                               @refresh-change="refreshChange">
                        <!-- 自定义按钮 -->
                        <template slot="menuLeft">
                            <!-- <el-button type="danger"
                                       size="mini"
                                       icon="el-icon-delete"
                                       plain
                                       @click="handleDelete">新增
                            </el-button> -->
                            <!-- <el-button type="danger"
                                       size="mini"
                                       icon="el-icon-delete"
                                       plain
                                       @click="handleDelete">删除
                            </el-button> -->
                        </template>
                        <template slot-scope="{ type, size, row }"
                                  slot="menu">
                            <el-button :type="type"
                                       :size="size"
                                       icon="el-icon-folder-checked"
                                       v-if="permission.score_audit_check"
                                       @click="handleAudit(row)">审核
                            </el-button>
                        </template>
                    </avue-crud>
                </div>
            </el-card>
        </el-col>
        <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>
    </el-row>
</template>
<script>
import { getList, update,applyAudit } from "@/api/examapi/modifiedGrades";
import { mapGetters } from "vuex";
import { getRoleDetail } from "@/api/system/role";
export default {
    data () {
        return {
            Audit: {},
            dialogFormVisible: false,
            optionAudit: {
                height: "auto",
                calcHeight: 30,
                dialogWidth: 1000,
                tip: false,
                searchShow: true,
                searchMenuSpan: 6,
                border: true, //liu
                index: true,
                stripe: true,
                viewBtn: false,
                addBtn: false,
                editBtn: false,
                selection: true,
                excelBtn: false,
                menuWidth: 230,
                dialogClickModal: false,
                column: [{
                    label: "审核状态",
                    search: true,
                    searchSpan: 5,
                    span: 24,
                    prop: "status",
                    slot: true,
                    editDisplay: false,
                    addDisplay: false,
                    type: "select",
                    rules: [{
                        required: true,
                        message: "请选择审核类型",
                        trigger: "blur"
                    }],
                    dicData: [{
                        label: "待审核",
                        value: 1,
                    },
                    {
                        label: "审核通过",
                        value: 2,
                    },
                    {
                        label: "审核不通过",
                        value: 3,
                    }
                    ]
                },
                {
                    label: "审核明细",
                    span: 24,
                    type: "textarea",
                    prop: "auditDetail"
                }
                ],
            },
            obj: {
                name: "张三",
            },
            questionBankOption: {
                // 操作栏多余按钮去除
                delBtn: false,
                editBtn: true,
                addBtn: false,
                selection: false,
                // 导出按钮
                // excelBtn: true,
                // excelBtnText: "成绩导出",
                viewBtn: true,
                // title: '成绩',
                align: "center",
                height: "auto",
                calcHeight: 80,
                tip: false,
                searchShow: true,
                searchMenuSpan: 4,
                index: true,
                indexLabel: "序号",
                //dialogType: 'drawer',
                dialogClickModal: false,
                // 操作栏宽度
                menu: true,
                menuWidth: 295,
                labelWidth: 120,
                column: [
                    {
                        label: "考试名称",
                        prop: "examName",
                        search: true,
                        searchSpan: 5,
                        slot: true,
                        viewDisplay: true,
                        // 表单新增时是否禁止
                        addDisabled: false,
                        // 表单新增时是否可见
                        addDisplay: true,
                        // 表单新增时是否为查看模式
                        addDetail: false,
                        // 表单编辑时是否禁止
                        editDisabled: true,
                        viewDisabled: true,
                        // 表单编辑时是否可见
                        editDisplay: true,
                        // 表单编辑时是否为查看模式
                        editDetail: false,
                        rules: [
                            {
                                required: true,
                                message: "请输入试卷名称",
                                trigger: "blur",
                            },
                        ],
                        width: 210,
                        // overHidden:true,
                    },
                    {
                        label: "姓名",
                        prop: "realName",
                        search: true,
                        searchSpan: 3,
                        slot: true,
                        viewDisplay: true,
                        // 表单新增时是否禁止
                        addDisabled: false,
                        // 表单新增时是否可见
                        addDisplay: true,
                        // 表单新增时是否为查看模式
                        addDetail: false,
                        // 表单编辑时是否禁止
                        editDisabled: true,
                        viewDisabled: true,
                        // 表单编辑时是否可见
                        editDisplay: true,
                        // 表单编辑时是否为查看模式
                        editDetail: false,
                        rules: [
                            {
                                required: true,
                                message: "请输入试卷名称",
                                trigger: "blur",
                            },
                        ],
                        width: 80,
                        // overHidden:true,
                    },
                    {
                        label: "所属公司",
                        prop: "deptName",
                        search: true,
                        searchSpan: 4,
                        // dicUrl: '/api/blade-system/dept/tree',
                        // props: {
                        //     label: "title",
                        //     value: "id",
                        // },
                        slot: true,
                        // 表单新增时是否禁止
                        addDisabled: false,
                        // 表单新增时是否可见
                        addDisplay: true,
                        // 表单新增时是否为查看模式
                        addDetail: false,
                        // 表单编辑时是否禁止
                        editDisabled: true,
                        // 表单编辑时是否可见
                        editDisplay: true,
                        // 表单编辑时是否为查看模式
                        editDetail: false,
                        rules: [
                            {
                                required: true,
                                message: "请输入所属公司",
                                trigger: "blur",
                            },
                        ],
                        width: 230,
                    },
                    {
                        label: "身份证号",
                        prop: "idCardNo",
                        search: true,
                        searchSpan: 4,
                        slot: true,
                        // 表单新增时是否禁止
                        addDisabled: false,
                        // 表单新增时是否可见
                        addDisplay: true,
                        // 表单新增时是否为查看模式
                        addDetail: false,
                        // 表单编辑时是否禁止
                        editDisabled: true,
                        // 表单编辑时是否可见
                        editDisplay: true,
                        // 表单编辑时是否为查看模式
                        editDetail: false,
                        rules: [
                            {
                                required: true,
                                message: "请输入保安姓名",
                                trigger: "blur",
                            },
                        ],
                        width: 140,
                    },
                    {
                        label: "原理论成绩",
                        prop: "oldScore",
                        slot: true,
                        // 表单新增时是否禁止
                        addDisabled: false,
                        // 表单新增时是否可见
                        addDisplay: true,
                        // 表单新增时是否为查看模式
                        addDetail: false,
                        // 表单编辑时是否禁止
                        editDisabled: true,
                        // 表单编辑时是否可见
                        editDisplay: true,
                        // 表单编辑时是否为查看模式
                        editDetail: false,
                        width: 88
                    },
                    {
                        label: "修改后理论成绩",
                        prop: "newScore",
                        slot: true,
                        // 表单新增时是否禁止
                        addDisabled: false,
                        // 表单新增时是否可见
                        addDisplay: true,
                        // 表单新增时是否为查看模式
                        addDetail: false,
                        // 表单编辑时是否禁止
                        editDisabled: false,
                        // 表单编辑时是否可见
                        editDisplay: true,
                        // 表单编辑时是否为查看模式
                        editDetail: false,
                        width: 88
                    },
                    {
                        label: "申请理由",
                        prop: "applyCause",
                        slot: true,
                        // 表单新增时是否禁止
                        addDisabled: false,
                        // 表单新增时是否可见
                        addDisplay: true,
                        // 表单新增时是否为查看模式
                        addDetail: false,
                        // 表单编辑时是否禁止
                        editDisabled: true,
                        // 表单编辑时是否可见
                        editDisplay: true,
                        // 表单编辑时是否为查看模式
                        editDetail: false,
                    },
                    {
                        label: "修改申请时间",
                        prop: "createTime",
                        type: "date",
                        format: "yyyy-MM-dd",
                        valueFormat: "yyyy-MM-dd",
                        slot: true,
                        searchSpan: 4,
                        // 表单新增时是否禁止
                        addDisabled: false,
                        // 表单新增时是否可见
                        addDisplay: false,
                        // 表单新增时是否为查看模式
                        addDetail: false,
                        // 表单编辑时是否禁止
                        editDisabled: false,
                        // 表单编辑时是否可见
                        editDisplay: false,
                        // 表单编辑时是否为查看模式
                        editDetail: false,
                        viewDisplay: false,
                        width: 120
                    },
                    {
                        label: "审核时间",
                        prop: "auditTime",
                        type: "date",
                        format: "yyyy-MM-dd",
                        valueFormat: "yyyy-MM-dd",
                        slot: true,
                        searchSpan: 4,
                        // 表单新增时是否禁止
                        addDisabled: false,
                        // 表单新增时是否可见
                        addDisplay: false,
                        // 表单新增时是否为查看模式
                        addDetail: false,
                        // 表单编辑时是否禁止
                        editDisabled: false,
                        // 表单编辑时是否可见
                        editDisplay: false,
                        // 表单编辑时是否为查看模式
                        editDetail: false,
                        viewDisplay: false,
                        width: 120
                    },
                    {
                        label: "审核状态",
                        prop: "status",
                        type: "select",
                        slot: true,
                        search: true,
                        searchSpan: 3,
                        dicData: [
                            {
                                label: "待审核",
                                value: 1,
                            },
                            {
                                label: "审核通过",
                                value: 2,
                            },
                            {
                                label: "审核不通过",
                                value: 3,
                            }
                        ],
                        // 表单新增时是否禁止
                        addDisabled: false,
                        // 表单新增时是否可见
                        addDisplay: true,
                        // 表单新增时是否为查看模式
                        addDetail: false,
                        // 表单编辑时是否禁止
                        editDisabled: true,
                        // 表单编辑时是否可见
                        editDisplay: true,
                        // 表单编辑时是否为查看模式
                        editDetail: false,
                        width: 96
                    },
                    {
                        label: "审核明细",
                        prop: "auditDetail",
                        slot: true,
                        // 表单新增时是否禁止
                        addDisabled: false,
                        // 表单新增时是否可见
                        addDisplay: true,
                        // 表单新增时是否为查看模式
                        addDetail: false,
                        // 表单编辑时是否禁止
                        editDisabled: true,
                        // 表单编辑时是否可见
                        editDisplay: true,
                        // 表单编辑时是否为查看模式
                        editDetail: false,
                        width: 68,
                    }
                ],
            },
            questionBankSearch: {},
            questionBankLoading: true,
            questionBankData: [],
            questionBankPage: {
                pageSize: 10,
                currentPage: 1,
                total: 16,
            },
            questionBankQuery: {},
            questionBankSelectionList: [],
        };
    },
    created () { },
    mounted () { },
    computed: {
        ...mapGetters(["userInfo", "permission"]),
        permissionList () {
            return {
                addBtn: this.vaildData(null, false),
                viewBtn: this.vaildData(
                    this.permission.score_audit_view,
                    false
                ),
                delBtn: this.vaildData(null, false),
                editBtn: this.vaildData(
                    this.permission.score_audit_edit,
                    false
                ),
            };
        },
    },
    methods: {
        getNewTime () {
            var nowTime = new Date()
            var oneHoursAgo = new Date(new Date(nowTime).getTime() - 1 * 60 * 60 * 1000)
            var oneHoursAgoY = oneHoursAgo.getFullYear()
            var oneHoursAgoM = oneHoursAgo.getMonth() + 1 < 10 ? '0' + (oneHoursAgo.getMonth() + 1) : oneHoursAgo.getMonth() + 1
            var oneHoursAgoD = oneHoursAgo.getDate() < 10 ? '0' + oneHoursAgo.getDate() : oneHoursAgo.getDate()
            var oneHoursAgoH = oneHoursAgo.getHours() < 10 ? '0' + oneHoursAgo.getHours() : oneHoursAgo.getHours()
            var oneHoursAgom = oneHoursAgo.getMinutes() < 10 ? '0' + oneHoursAgo.getMinutes() : oneHoursAgo.getMinutes()
            var oneHoursAgos = oneHoursAgo.getSeconds() < 10 ? '0' + oneHoursAgo.getSeconds() : oneHoursAgo.getSeconds()
            /**
             * @return 返回1小时,2小时,3小时,4小时,24小时
             */
            return oneHoursAgoY + '-' + oneHoursAgoM + '-' + oneHoursAgoD + ' ' + oneHoursAgoH + ':' + oneHoursAgom + ':' + oneHoursAgos
        },
        handleAudit (row) {
            this.dialogFormVisible = true;
            this.Audit = row;
        },
        //审核
        submit (row, done, loading) {
            row.auditTime = this.getNewTime()
            const data  = {
                id:row.id,
                status:row.status,
                auditDetail:row.auditDetail,
                auditUser:this.userInfo.Id
            }
            applyAudit(data).then(
                () => {
                    this.dialogFormVisible = false;
                    this.questionBankOnLoad(this.questionBankPage);
                    this.$message({
                        type: "success",
                        message: "操作成功!",
                    });
                    done();
                },
                (error) => {
                    window.console.log(error);
                    loading();
                }
            );
        },
        questionBankOnLoad (page, params = {}) {
            //判断角色,如果是保安公司管理员或保安,只能查看当前公司的考试成绩
            var that = this;
            //获取当前登录人员的角色信息
            var roleIds = this.userInfo.role_id.split(",");
            roleIds.forEach((roleId) => {
                getRoleDetail(roleId).then((res) => {
                    var roleAlias = res.data.data.roleAlias;
                    if (roleAlias == "保安公司管理员" || roleAlias == "保安") {
                        //如果是保安公司管理员
                        params["deptId"] = that.userInfo.dept_id;
                    }
                    if (roleAlias == "培训公司管理员") {
                        //如果是培训公司管理员
                        params["trainUnitId"] = that.userInfo.dept_id;
                    }
                    that.questionBankLoading = false;
                    params["examType"] = 2;
                    getList(
                        page.currentPage,
                        page.pageSize,
                        Object.assign(params, this.questionBankQuery)
                    ).then((res) => {
                        const data = res.data.data;
                        that.questionBankPage.total = data.total;
                        that.questionBankData = data.records;
                        that.questionBankLoading = false;
                        that.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;
        },
        questionBankRowUpdate (row, index, done, loading) {
            update({
                id: row.id,
                newScore: row.newScore
            }).then(
                () => {
                    this.questionBankOnLoad(this.questionBankPage);
                    this.$message({
                        type: "success",
                        message: "操作成功!",
                    });
                    done();
                },
                (error) => {
                    window.console.log(error);
                    loading();
                }
            );
        },
        refreshChange () {
            this.questionBankOnLoad(this.questionBankPage, this.questionBankQuery);
        },
    },
};
</script>
<style lang="scss" scoped>
.morpheus-box {
    position: relative;
}
</style>
src/views/trainExam/performance.vue
@@ -1,46 +1,49 @@
/*
 * @Author: Morpheus
 * @Date: 2021-07-05 16:31:54
 * @Last Modified by: liu
 * @Last Modified time: 2021-10-26 15:44:52
 * @Last Modified by: Morpheus
 * @Last Modified time: 2021-11-04 16:18:32
 * menu-name 成绩管理
 */
<template>
  <el-row class="morpheus-box">
    <el-col :span="24" class="recruitmentManagement">
      <el-card>
        <div class="exam-card-body">
          <avue-crud
            v-model="obj"
            class="company-box"
            :option="questionBankOption"
            :search.sync="questionBankSearch"
            :table-loading="questionBankLoading"
            :data="questionBankData"
            :permission="permissionList"
            ref="questionBankCrud"
            :page.sync="questionBankPage"
            @on-load="questionBankOnLoad"
            @selection-change="questionBankSelectionChange"
            @search-change="questionBankSearchChange"
            @search-reset="questionBankSearchReset"
            @current-change="questionBankCurrentChange"
            @size-change="questionBankSizeChange"
            @row-update="questionBankRowUpdate"
            @refresh-change="refreshChange"
          >
            <template slot-scope="{ row }" slot="theoryGrade">
              {{ row.theoryGrade == -1 ? "" : row.theoryGrade }}
            </template>
            <template slot-scope="{ row }" slot="learnGrade">
              {{ row.learnGrade == -1 ? "暂未录入" : row.learnGrade }}
            </template>
            <template slot-scope="{ row }" slot="allGrade">
              {{ row.allGrade == -1 ? "" : row.allGrade }}
            </template>
            <template slot-scope="{ row }" slot="qualified">
              {{
                row.qualified == -1
    <el-row class="morpheus-box">
        <el-col :span="24"
                class="recruitmentManagement">
            <el-card>
                <div class="exam-card-body">
                    <avue-crud v-model="obj"
                               class="company-box"
                               :option="questionBankOption"
                               :search.sync="questionBankSearch"
                               :table-loading="questionBankLoading"
                               :data="questionBankData"
                               :permission="permissionList"
                               ref="questionBankCrud"
                               :page.sync="questionBankPage"
                               @on-load="questionBankOnLoad"
                               @selection-change="questionBankSelectionChange"
                               @search-change="questionBankSearchChange"
                               @search-reset="questionBankSearchReset"
                               @current-change="questionBankCurrentChange"
                               @size-change="questionBankSizeChange"
                               @row-update="questionBankRowUpdate"
                               @refresh-change="refreshChange">
                        <template slot-scope="{ row }"
                                  slot="theoryGrade">
                            {{ row.theoryGrade }}
                        </template>
                        <template slot-scope="{ row }"
                                  slot="learnGrade">
                            {{ row.learnGrade == '' ? "暂未录入" : row.learnGrade }}
                        </template>
                        <template slot-scope="{ row }"
                                  slot="allGrade">
                            {{ row.allGrade == -1 ? "" : row.allGrade }}
                        </template>
                        <template slot-scope="{ row }"
                                  slot="qualified">
                            {{
                row.qualified == ''
                  ? ""
                  : row.qualified == 0
                  ? "合格"
@@ -50,794 +53,963 @@
                  ? "缺考,成绩无效"
                  : ""
              }}
            </template>
                        </template>
            <!-- 自定义按钮 -->
            <template slot="menuLeft">
              <!-- <el-button type="danger"
                        <!-- 自定义按钮 -->
                        <template slot="menuLeft">
                            <!-- <el-button type="danger"
                                       size="mini"
                                       icon="el-icon-delete"
                                       plain
                                       @click="handleDelete">新增
                            </el-button> -->
              <!-- <el-button type="danger"
                            <!-- <el-button type="danger"
                                       size="mini"
                                       icon="el-icon-delete"
                                       plain
                                       @click="handleDelete">删除
                            </el-button> -->
              <el-button
                type="success"
                size="small"
                plain
                icon="el-icon-upload2"
                v-if="permission.trainExam_performance_import"
                @click="handleImport"
                >实操成绩导入
              </el-button>
              <el-button
                type="warning"
                size="small"
                plain
                icon="el-icon-download"
                v-if="permission.trainExam_performance_export"
                @click="handleExport"
                >成绩导出
              </el-button>
            </template>
                            <el-button type="success"
                                       size="small"
                                       plain
                                       icon="el-icon-upload2"
                                       v-if="permission.trainExam_performance_import"
                                       @click="handleImport">实操成绩导入
                            </el-button>
                            <el-button type="warning"
                                       size="small"
                                       plain
                                       icon="el-icon-download"
                                       v-if="permission.trainExam_performance_export"
                                       @click="handleExport">成绩导出
                            </el-button>
                        </template>
            <template slot-scope="{ type, size, row }" slot="menu">
              <el-button
                icon="el-icon-s-flag"
                @click="absent(row)"
                :size="size"
                :type="type"
                >缺考标记</el-button
              >
              <el-button
                icon="el-icon-s-promotion"
                @click="openzhengjian(row)"
                :disabled="row.qualified != 0"
                :size="size"
                :type="type"
                >查看证件</el-button
              >
            </template>
          </avue-crud>
                        <template slot-scope="{ type, size, row }"
                                  slot="menu">
                            <el-button icon="el-icon-s-flag"
                                       @click="absent(row)"
                                       :size="size"
                                       :type="type">缺考标记</el-button>
                            <el-button icon="el-icon-s-promotion"
                                       @click="openzhengjian(row)"
                                       :disabled="row.qualified != 0"
                                       :size="size"
                                       :type="type">查看证件</el-button>
                            <el-button icon="el-icon-edit"
                                       @click="modifiedGrades(row)"
                                       :size="size"
                                       :type="type">申请修改成绩</el-button>
                        </template>
          <el-dialog
            title="实操成绩导入"
            append-to-body
            :visible.sync="excelBox"
            width="555px"
          >
            <avue-form
              :option="excelOption"
              v-model="excelForm"
              :upload-after="uploadAfter"
            >
              <template slot="excelTemplate">
                <el-button type="primary" @click="handleTemplate">
                  点击下载<i class="el-icon-download el-icon--right"></i>
                </el-button>
              </template>
            </avue-form>
          </el-dialog>
        </div>
      </el-card>
    </el-col>
    <!-- <el-dialog
                    </avue-crud>
                    <el-dialog title="实操成绩导入"
                               append-to-body
                               :visible.sync="excelBox"
                               width="555px">
                        <avue-form :option="excelOption"
                                   v-model="excelForm"
                                   :upload-after="uploadAfter">
                            <template slot="excelTemplate">
                                <el-button type="primary"
                                           @click="handleTemplate">
                                    点击下载<i class="el-icon-download el-icon--right"></i>
                                </el-button>
                            </template>
                        </avue-form>
                    </el-dialog>
                </div>
            </el-card>
        </el-col>
        <el-dialog title="申请修改成绩"
                   :visible.sync="gradeBoxVisible"
                   width="width"
                   :modal='true'
                   :modal-append-to-body='true'
                   :append-to-body='true'
                   :close-on-click-modal='false'
                   :close-on-press-escape='false'
                   :before-close="dialogBeforeClose">
            <div>
                <el-form ref="gradeForm"
                         :model="gradeForm"
                         :rules="rules"
                         label-width="80px"
                         label-position="left">
                    <el-row :gutter="24">
                        <el-col :span="12">
                            <el-form-item label="考试名称"
                                          label-width="108px">
                                <el-input v-model="gradeForm.examName"
                                          disabled></el-input>
                            </el-form-item>
                        </el-col>
                        <el-col :span="12">
                            <el-form-item label="姓名"
                                          label-width="108px">
                                <el-input v-model="gradeForm.securityName"
                                          disabled></el-input>
                            </el-form-item>
                        </el-col>
                    </el-row>
                    <el-row :gutter="24">
                        <el-col :span="12">
                            <el-form-item label="身份证号"
                                          label-width="108px">
                                <el-input v-model="gradeForm.account"
                                          disabled></el-input>
                            </el-form-item>
                        </el-col>
                        <el-col :span="12">
                            <el-form-item label="准考证号"
                                          label-width="108px">
                                <el-input v-model="gradeForm.candidateNo"
                                          disabled></el-input>
                            </el-form-item>
                        </el-col>
                    </el-row>
                    <el-row :gutter="24">
                        <el-col :span="12">
                            <el-form-item label="原理论成绩"
                                          label-width="108px">
                                <el-input v-model="gradeForm.theoryGrade"
                                          disabled></el-input>
                            </el-form-item>
                        </el-col>
                        <el-col :span="12">
                            <el-form-item label="修改考试成绩"
                                          label-width="108px"
                                          prop='editGrades'>
                                <el-input v-model.number="gradeForm.editGrades"
                                          autocomplete="off"></el-input>
                            </el-form-item>
                        </el-col>
                    </el-row>
                    <el-row :gutter="24">
                        <el-col :span="12">
                            <el-form-item label="实操成绩"
                                          label-width="108px">
                                <el-input v-model="gradeForm.learnGrade"
                                          disabled></el-input>
                            </el-form-item>
                        </el-col>
                        <el-col :span="12">
                            <el-form-item label="总成绩"
                                          label-width="108px">
                                <el-input v-model="gradeForm.allGrade"
                                          disabled></el-input>
                            </el-form-item>
                        </el-col>
                    </el-row>
                    <el-form-item label="修改理由"
                                  label-width="108px">
                        <el-input type='textarea'
                                  :rows="3"
                                  placeholder="请输入修改理由"
                                  resize='none'
                                  v-model="gradeForm.editReason"></el-input>
                    </el-form-item>
                    <el-form-item style="text-align: center;"
                                  label-width="0">
                        <el-button type="primary"
                                   @click="uploadGrade('gradeForm')">确 定</el-button>
                        <el-button @click="gradeBoxVisible = false">取 消</el-button>
                    </el-form-item>
                </el-form>
            </div>
        </el-dialog>
        <!-- <el-dialog
      title="打印证件"
      :visible.sync="dialogVisiblezhengjian"
      :modal-append-to-body="false"
    > -->
    <div class="dialogVisiblezhengjian" v-if="dialogVisiblezhengjian">
      <baoanz
        :data="baoanzdata"
        :close="1"
        @close="closezhengjian"
        :closePrint="1"
      ></baoanz>
    </div>
    <!-- </el-dialog> -->
  </el-row>
        <div class="dialogVisiblezhengjian"
             v-if="dialogVisiblezhengjian">
            <baoanz :data="baoanzdata"
                    :close="1"
                    @close="closezhengjian"
                    :closePrint="1"></baoanz>
        </div>
        <!-- </el-dialog> -->
    </el-row>
</template>
<script>
import baoanz from "../securityGuard/baoanz.vue";
import { getList, update, updateAbsent } from "@/api/examapi/performance";
import { getList, update, updateAbsent, updateGrade } from "@/api/examapi/performance";
import { mapGetters } from "vuex";
import { getRoleDetail } from "@/api/system/role";
import Qs from "qs";
export default {
  components: {
    baoanz,
  },
  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 if (value > 100) {
        callback(new Error("分数设置请小于100"));
      } else {
        callback();
      }
    };
    return {
      dialogVisiblezhengjian: false,
      baoanzdata: {},
      obj: {
        name: "张三",
      },
      excelBox: false,
      questionBankOption: {
        // 操作栏多余按钮去除
        delBtn: false,
        editBtn: true,
        addBtn: false,
        selection: false,
        // 导出按钮
        // excelBtn: true,
        // excelBtnText: "成绩导出",
        viewBtn: true,
        // title: '成绩',
        align: "center",
        height: "auto",
        calcHeight: 80,
        tip: false,
        searchShow: true,
        searchMenuSpan: 4,
        index: true,
        indexLabel: "序号",
        //dialogType: 'drawer',
        dialogClickModal: false,
        // 操作栏宽度
        menu: true,
        menuWidth: 295,
        labelWidth: 120,
        column: [
          {
            label: "考试时间",
            prop: "examDate",
            type: "date",
            hide: true,
            format: "yyyy-MM-dd",
            valueFormat: "yyyy-MM-dd",
            width: 140,
            slot: true,
            search: true,
            searchSpan: 4,
            // 表单新增时是否禁止
            addDisabled: false,
            // 表单新增时是否可见
            addDisplay: false,
            // 表单新增时是否为查看模式
            addDetail: false,
            // 表单编辑时是否禁止
            editDisabled: false,
            // 表单编辑时是否可见
            editDisplay: false,
            // 表单编辑时是否为查看模式
            editDetail: false,
            viewDisplay: false,
          },
          {
            label: "考试名称",
            prop: "examName",
            search: true,
            searchSpan: 5,
            slot: true,
            viewDisplay: true,
            // 表单新增时是否禁止
            addDisabled: false,
            // 表单新增时是否可见
            addDisplay: true,
            // 表单新增时是否为查看模式
            addDetail: false,
            // 表单编辑时是否禁止
            editDisabled: true,
            viewDisabled: true,
            // 表单编辑时是否可见
            editDisplay: true,
            // 表单编辑时是否为查看模式
            editDetail: false,
            rules: [
              {
                required: true,
                message: "请输入试卷名称",
                trigger: "blur",
              },
            ],
            width: 210,
            // overHidden:true,
          },
          {
            label: "姓名",
            prop: "securityName",
            search: true,
            searchSpan: 3,
            slot: true,
            viewDisplay: true,
            // 表单新增时是否禁止
            addDisabled: false,
            // 表单新增时是否可见
            addDisplay: true,
            // 表单新增时是否为查看模式
            addDetail: false,
            // 表单编辑时是否禁止
            editDisabled: true,
            viewDisabled: true,
            // 表单编辑时是否可见
            editDisplay: true,
            // 表单编辑时是否为查看模式
            editDetail: false,
            rules: [
              {
                required: true,
                message: "请输入试卷名称",
                trigger: "blur",
              },
            ],
            width: 80,
            // overHidden:true,
          },
          {
            label: "身份证号",
            prop: "account",
            search: true,
            searchSpan: 4,
            slot: true,
            // 表单新增时是否禁止
            addDisabled: false,
            // 表单新增时是否可见
            addDisplay: true,
            // 表单新增时是否为查看模式
            addDetail: false,
            // 表单编辑时是否禁止
            editDisabled: true,
            // 表单编辑时是否可见
            editDisplay: true,
            // 表单编辑时是否为查看模式
            editDetail: false,
            rules: [
              {
                required: true,
                message: "请输入保安姓名",
                trigger: "blur",
              },
            ],
            width: 140,
          },
          {
            label: "准考证号",
            prop: "candidateNo",
            search: true,
            searchSpan: 4,
            slot: true,
            // 表单新增时是否禁止
            addDisabled: false,
            // 表单新增时是否可见
            addDisplay: true,
            // 表单新增时是否为查看模式
            addDetail: false,
            // 表单编辑时是否禁止
            editDisabled: true,
            // 表单编辑时是否可见
            editDisplay: true,
            // 表单编辑时是否为查看模式
            editDetail: false,
            rules: [
              {
                required: true,
                message: "请输入保安姓名",
                trigger: "blur",
              },
            ],
            width: 140,
          },
          {
            label: "所属公司",
            prop: "companyName",
            search: true,
            searchSpan: 4,
            // dicUrl: '/api/blade-system/dept/tree',
            // props: {
            //     label: "title",
            //     value: "id",
            // },
            slot: true,
            // 表单新增时是否禁止
            addDisabled: false,
            // 表单新增时是否可见
            addDisplay: true,
            // 表单新增时是否为查看模式
            addDetail: false,
            // 表单编辑时是否禁止
            editDisabled: true,
            // 表单编辑时是否可见
            editDisplay: true,
            // 表单编辑时是否为查看模式
            editDetail: false,
            rules: [
              {
                required: true,
                message: "请输入所属公司",
                trigger: "blur",
              },
            ],
            width: 230,
          },
          {
            label: "考试开始时间",
            prop: "examTime",
            type: "datetime",
            // span: 24,
            format: "yyyy-MM-dd HH:mm:ss",
            valueFormat: "yyyy-MM-dd HH:mm:ss",
            width: 140,
            slot: true,
            // 表单新增时是否禁止
            addDisabled: false,
            // 表单新增时是否可见
            addDisplay: true,
            // 表单新增时是否为查看模式
            addDetail: false,
            // 表单编辑时是否禁止
            editDisabled: true,
            // 表单编辑时是否可见
            editDisplay: true,
            // 表单编辑时是否为查看模式
            editDetail: false,
          },
          {
            label: "考试结束时间",
            prop: "examEndTime",
            type: "datetime",
            // span: 24,
            format: "yyyy-MM-dd HH:mm:ss",
            valueFormat: "yyyy-MM-dd HH:mm:ss",
            width: 140,
            slot: true,
            // 表单新增时是否禁止
            addDisabled: false,
            // 表单新增时是否可见
            addDisplay: true,
            // 表单新增时是否为查看模式
            addDetail: false,
            // 表单编辑时是否禁止
            editDisabled: true,
            // 表单编辑时是否可见
            editDisplay: true,
            // 表单编辑时是否为查看模式
            editDetail: false,
          },
          {
            label: "状态",
            prop: "isExam",
            type: "select",
            slot: true,
            search: true,
            searchSpan: 3,
            width: 60,
            dicData: [
              {
                label: "发布成绩",
                value: 2,
              },
              {
                label: "考试中",
                value: 3,
              },
            ],
            // 表单新增时是否禁止
            addDisabled: false,
            // 表单新增时是否可见
            addDisplay: true,
            // 表单新增时是否为查看模式
            addDetail: false,
            // 表单编辑时是否禁止
            editDisabled: true,
            // 表单编辑时是否可见
            editDisplay: true,
            // 表单编辑时是否为查看模式
            editDetail: false,
            rules: [
              {
                required: true,
                message: "请输入考试名称",
                trigger: "blur",
              },
            ],
          },
          {
            label: "理论成绩",
            prop: "theoryGrade",
            slot: true,
            // 表单新增时是否禁止
            addDisabled: false,
            // 表单新增时是否可见
            addDisplay: true,
            // 表单新增时是否为查看模式
            addDetail: false,
            // 表单编辑时是否禁止
            editDisabled: true,
            // 表单编辑时是否可见
            editDisplay: true,
            // 表单编辑时是否为查看模式
            editDetail: false,
            width: 68,
          },
          {
            label: "实操成绩",
            prop: "learnGrade",
            slot: true,
            // 表单新增时是否禁止
            addDisabled: false,
            // 表单新增时是否可见
            addDisplay: true,
            // 表单新增时是否为查看模式
            addDetail: false,
            // 表单编辑时是否禁止
            editDisabled: false,
            // 表单编辑时是否可见
            editDisplay: true,
            // 表单编辑时是否为查看模式
            editDetail: false,
            width: 68,
            rules: [
              { validator: validatePass, required: true, trigger: "blur" },
            ],
          },
          {
            label: "总成绩",
            prop: "allGrade",
            slot: true,
            // 表单新增时是否禁止
            addDisabled: false,
            // 表单新增时是否可见
            addDisplay: true,
            // 表单新增时是否为查看模式
            addDetail: false,
            // 表单编辑时是否禁止
            editDisabled: true,
            // 表单编辑时是否可见
            editDisplay: true,
            // 表单编辑时是否为查看模式
            editDetail: false,
            width: 58,
            rules: [
              {
                required: true,
                message: "请输入考试名称",
                trigger: "blur",
              },
            ],
          },
          {
            label: "是否合格",
            prop: "qualified",
            type: "select",
            slot: true,
            search: true,
            searchSpan: 3,
            width: 68,
            dicData: [
              {
                label: "合格",
                value: 0,
              },
              {
                label: "不合格",
                value: 1,
              },
              {
                label: "暂未录实操成绩",
                value: 2,
              },
              {
                label: "缺考,成绩无效",
                value: 3,
              },
            ],
            // 表单新增时是否禁止
            addDisabled: false,
            // 表单新增时是否可见
            addDisplay: true,
            // 表单新增时是否为查看模式
            addDetail: false,
            // 表单编辑时是否禁止
            editDisabled: true,
            // 表单编辑时是否可见
            editDisplay: true,
            // 表单编辑时是否为查看模式
            editDetail: false,
            rules: [
              {
                required: true,
                message: "请输入考试名称",
                trigger: "blur",
              },
            ],
          },
        ],
      },
      questionBankSearch: {},
      questionBankLoading: true,
      questionBankData: [],
      questionBankPage: {
        pageSize: 10,
        currentPage: 1,
        total: 16,
      },
      questionBankQuery: {},
      questionBankSelectionList: [],
      excelForm: {},
      excelOption: {
        submitBtn: false,
        emptyBtn: false,
        column: [
          {
            label: "模板上传",
            prop: "excelFile",
            type: "upload",
            drag: true,
            loadText: "模板上传中,请稍等",
            span: 24,
            propsHttp: {
              res: "data",
            },
            tip: "请上传 .xls,.xlsx 标准格式文件",
            action: "/api/examScore/import-examScore",
          },
          // {
          //     label: "数据覆盖",
          //     prop: "isCovered",
          //     type: "switch",
          //     align: "center",
          //     width: 80,
          //     dicData: [
          //     {
          //         label: "否",
          //         value: 0,
          //     },
          //     {
          //         label: "是",
          //         value: 1,
          //     },
          //     ],
          //     value: 0,
          //     slot: true,
          //     rules: [
          //     {
          //         required: true,
          //         message: "请选择是否覆盖",
          //         trigger: "blur",
          //     },
          //     ],
          // },
          {
            label: "模板下载",
            prop: "excelTemplate",
            formslot: true,
            span: 24,
          },
        ],
      },
    };
  },
  created() {},
  mounted() {},
  computed: {
    ...mapGetters(["userInfo", "permission"]),
    permissionList() {
      return {
        addBtn: this.vaildData(null, false),
        viewBtn: this.vaildData(
          this.permission.trainExam_performance_view,
          false
        ),
        delBtn: this.vaildData(null, false),
        editBtn: this.vaildData(
          this.permission.trainExam_performance_edit,
          false
        ),
        excelBtn: this.vaildData(
          this.permission.trainExam_performance_export,
          false
        ),
      };
    components: {
        baoanz,
    },
  },
  methods: {
    openzhengjian(row) {
      this.baoanzdata = {
        realName: row.securityName,
        $sex: row.sex == 1 ? "男" : "女",
        securitynumber: row.securityNumber,
        paperTime: row.paperTime,
        avatar: row.avatar,
      };
      this.dialogVisiblezhengjian = true;
    },
    closezhengjian() {
      this.dialogVisiblezhengjian = false;
    },
    questionBankOnLoad(page, params = {}) {
      //判断角色,如果是保安公司管理员或保安,只能查看当前公司的考试成绩
      var that = this;
      //获取当前登录人员的角色信息
      var roleIds = this.userInfo.role_id.split(",");
      roleIds.forEach((roleId) => {
        getRoleDetail(roleId).then((res) => {
          var roleAlias = res.data.data.roleAlias;
          if (roleAlias == "保安公司管理员" || roleAlias == "保安") {
            //如果是保安公司管理员
            params["deptId"] = that.userInfo.dept_id;
          }
          if (roleAlias == "培训公司管理员") {
            //如果是培训公司管理员
            params["trainUnitId"] = that.userInfo.dept_id;
          }
          that.questionBankLoading = false;
          params["examType"] = 2;
          getList(
            page.currentPage,
            page.pageSize,
            Object.assign(params, this.questionBankQuery)
          ).then((res) => {
            const data = res.data.data;
            that.questionBankPage.total = data.total;
            that.questionBankData = data.records;
            that.questionBankLoading = false;
            that.questionBankSelectionClear();
          });
        });
      });
    },
    //缺考标记
    absent(row, done, loading) {
      this.$confirm("确定缺考标记?", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      }).then(() => {
        row.qualified = 3;
        updateAbsent(row).then(
          () => {
            this.onLoad(this.page);
            this.$message({
              type: "success",
              message: "操作成功!",
            });
            done();
          },
          (error) => {
            window.console.log(error);
            loading();
          }
        );
      });
    },
    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;
    },
    questionBankRowUpdate(row, index, done, loading) {
      update({
        theoryGrade: row.theoryGrade,
        learnGrade: row.learnGrade,
        examId: row.examId,
        id: row.id,
      }).then(
        () => {
          this.questionBankOnLoad(this.questionBankPage);
          this.$message({
            type: "success",
            message: "操作成功!",
          });
          done();
        },
        (error) => {
          window.console.log(error);
          loading();
        }
      );
    },
    handleTemplate() {
      window.open(`/api/examScore/export-template`);
    },
    handleImport() {
      this.excelBox = true;
    },
    uploadAfter(res, done, loading, column) {
      window.console.log(column);
      this.excelBox = false;
      // this.$message({
      //   type: "success",
      //   message: "操作成功!",
      // });
      this.refreshChange();
      done();
    },
    refreshChange() {
      this.questionBankOnLoad(this.questionBankPage, this.questionBankQuery);
    },
    //成绩导出
    handleExport() {
      this.$confirm("是否导出成绩数据?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      }).then(() => {
        //获取查询条件
        console.log(this.questionBankSearch, 456);
        var data = {
          account: this.questionBankSearch.account,
          companyName: this.questionBankSearch.companyName,
          examDate: this.questionBankSearch.examDate,
          isExam: this.questionBankSearch.isExam,
          qualified: this.questionBankSearch.qualified,
          securityName: this.questionBankSearch.securityName,
          examName: this.questionBankSearch.examName,
    data () {
        var validatePass = (rule, value, callback) => {
            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 if (value > 100) {
                callback(new Error("分数设置请小于100"));
            } else {
                callback();
            }
        };
        //导出
        if (
          this.userInfo.role_name == "保安公司管理员" ||
          this.userInfo.role_name == "保安"
        ) {
          //如果是保安公司管理员
          data["deptId"] = this.userInfo.dept_id;
        }
        if (this.userInfo.role_name == "培训公司管理员") {
          //如果是培训公司管理员
          data["trainUnitId"] = this.userInfo.dept_id;
        }
        data["examType"] = 2;
        //序列号url形式,用&拼接
        data = Qs.stringify(data);
        window.open(`/api/examScore/export-examScore?` + data);
      });
        return {
            rules: {
                editGrades: [
                    { validator: validatePass, required: true, trigger: "blur" },
                ]
            },
            gradeForm: {
                id: null,
                examName: '',
                securityName: '',
                account: '',
                candidateNo: '',
                theoryGrade: '',
                learnGrade: '',
                allGrade: '',
                editGrades: '',
                editReason: ''
            },
            gradeBoxVisible: false,
            dialogVisiblezhengjian: false,
            baoanzdata: {},
            obj: {
                name: "张三",
            },
            excelBox: false,
            questionBankOption: {
                // 操作栏多余按钮去除
                delBtn: false,
                editBtn: true,
                addBtn: false,
                selection: false,
                // 导出按钮
                // excelBtn: true,
                // excelBtnText: "成绩导出",
                viewBtn: true,
                // title: '成绩',
                align: "center",
                height: "auto",
                calcHeight: 80,
                tip: false,
                searchShow: true,
                searchMenuSpan: 4,
                index: true,
                indexLabel: "序号",
                //dialogType: 'drawer',
                dialogClickModal: false,
                // 操作栏宽度
                menu: true,
                menuWidth: 295,
                labelWidth: 120,
                column: [
                    {
                        label: "考试时间",
                        prop: "examDate",
                        type: "date",
                        hide: true,
                        format: "yyyy-MM-dd",
                        valueFormat: "yyyy-MM-dd",
                        width: 140,
                        slot: true,
                        search: true,
                        searchSpan: 4,
                        // 表单新增时是否禁止
                        addDisabled: false,
                        // 表单新增时是否可见
                        addDisplay: false,
                        // 表单新增时是否为查看模式
                        addDetail: false,
                        // 表单编辑时是否禁止
                        editDisabled: false,
                        // 表单编辑时是否可见
                        editDisplay: false,
                        // 表单编辑时是否为查看模式
                        editDetail: false,
                        viewDisplay: false,
                    },
                    {
                        label: "考试名称",
                        prop: "examName",
                        search: true,
                        searchSpan: 5,
                        slot: true,
                        viewDisplay: true,
                        // 表单新增时是否禁止
                        addDisabled: false,
                        // 表单新增时是否可见
                        addDisplay: true,
                        // 表单新增时是否为查看模式
                        addDetail: false,
                        // 表单编辑时是否禁止
                        editDisabled: true,
                        viewDisabled: true,
                        // 表单编辑时是否可见
                        editDisplay: true,
                        // 表单编辑时是否为查看模式
                        editDetail: false,
                        rules: [
                            {
                                required: true,
                                message: "请输入试卷名称",
                                trigger: "blur",
                            },
                        ],
                        width: 210,
                        // overHidden:true,
                    },
                    {
                        label: "姓名",
                        prop: "securityName",
                        search: true,
                        searchSpan: 3,
                        slot: true,
                        viewDisplay: true,
                        // 表单新增时是否禁止
                        addDisabled: false,
                        // 表单新增时是否可见
                        addDisplay: true,
                        // 表单新增时是否为查看模式
                        addDetail: false,
                        // 表单编辑时是否禁止
                        editDisabled: true,
                        viewDisabled: true,
                        // 表单编辑时是否可见
                        editDisplay: true,
                        // 表单编辑时是否为查看模式
                        editDetail: false,
                        rules: [
                            {
                                required: true,
                                message: "请输入试卷名称",
                                trigger: "blur",
                            },
                        ],
                        width: 80,
                        // overHidden:true,
                    },
                    {
                        label: "身份证号",
                        prop: "account",
                        search: true,
                        searchSpan: 4,
                        slot: true,
                        // 表单新增时是否禁止
                        addDisabled: false,
                        // 表单新增时是否可见
                        addDisplay: true,
                        // 表单新增时是否为查看模式
                        addDetail: false,
                        // 表单编辑时是否禁止
                        editDisabled: true,
                        // 表单编辑时是否可见
                        editDisplay: true,
                        // 表单编辑时是否为查看模式
                        editDetail: false,
                        rules: [
                            {
                                required: true,
                                message: "请输入保安姓名",
                                trigger: "blur",
                            },
                        ],
                        width: 140,
                    },
                    {
                        label: "准考证号",
                        prop: "candidateNo",
                        search: true,
                        searchSpan: 4,
                        slot: true,
                        // 表单新增时是否禁止
                        addDisabled: false,
                        // 表单新增时是否可见
                        addDisplay: true,
                        // 表单新增时是否为查看模式
                        addDetail: false,
                        // 表单编辑时是否禁止
                        editDisabled: true,
                        // 表单编辑时是否可见
                        editDisplay: true,
                        // 表单编辑时是否为查看模式
                        editDetail: false,
                        rules: [
                            {
                                required: true,
                                message: "请输入保安姓名",
                                trigger: "blur",
                            },
                        ],
                        width: 140,
                    },
                    {
                        label: "所属公司",
                        prop: "companyName",
                        search: true,
                        searchSpan: 4,
                        // dicUrl: '/api/blade-system/dept/tree',
                        // props: {
                        //     label: "title",
                        //     value: "id",
                        // },
                        slot: true,
                        // 表单新增时是否禁止
                        addDisabled: false,
                        // 表单新增时是否可见
                        addDisplay: true,
                        // 表单新增时是否为查看模式
                        addDetail: false,
                        // 表单编辑时是否禁止
                        editDisabled: true,
                        // 表单编辑时是否可见
                        editDisplay: true,
                        // 表单编辑时是否为查看模式
                        editDetail: false,
                        rules: [
                            {
                                required: true,
                                message: "请输入所属公司",
                                trigger: "blur",
                            },
                        ],
                        width: 230,
                    },
                    {
                        label: "考试开始时间",
                        prop: "examTime",
                        type: "datetime",
                        // span: 24,
                        format: "yyyy-MM-dd HH:mm:ss",
                        valueFormat: "yyyy-MM-dd HH:mm:ss",
                        width: 140,
                        slot: true,
                        // 表单新增时是否禁止
                        addDisabled: false,
                        // 表单新增时是否可见
                        addDisplay: true,
                        // 表单新增时是否为查看模式
                        addDetail: false,
                        // 表单编辑时是否禁止
                        editDisabled: true,
                        // 表单编辑时是否可见
                        editDisplay: true,
                        // 表单编辑时是否为查看模式
                        editDetail: false,
                    },
                    {
                        label: "考试结束时间",
                        prop: "examEndTime",
                        type: "datetime",
                        // span: 24,
                        format: "yyyy-MM-dd HH:mm:ss",
                        valueFormat: "yyyy-MM-dd HH:mm:ss",
                        width: 140,
                        slot: true,
                        // 表单新增时是否禁止
                        addDisabled: false,
                        // 表单新增时是否可见
                        addDisplay: true,
                        // 表单新增时是否为查看模式
                        addDetail: false,
                        // 表单编辑时是否禁止
                        editDisabled: true,
                        // 表单编辑时是否可见
                        editDisplay: true,
                        // 表单编辑时是否为查看模式
                        editDetail: false,
                    },
                    {
                        label: "状态",
                        prop: "isExam",
                        type: "select",
                        slot: true,
                        search: true,
                        searchSpan: 3,
                        width: 60,
                        dicData: [
                            {
                                label: "发布成绩",
                                value: 2,
                            },
                            {
                                label: "考试中",
                                value: 3,
                            },
                        ],
                        // 表单新增时是否禁止
                        addDisabled: false,
                        // 表单新增时是否可见
                        addDisplay: true,
                        // 表单新增时是否为查看模式
                        addDetail: false,
                        // 表单编辑时是否禁止
                        editDisabled: true,
                        // 表单编辑时是否可见
                        editDisplay: true,
                        // 表单编辑时是否为查看模式
                        editDetail: false,
                        rules: [
                            {
                                required: true,
                                message: "请输入考试名称",
                                trigger: "blur",
                            },
                        ],
                    },
                    {
                        label: "理论成绩",
                        prop: "theoryGrade",
                        slot: true,
                        // 表单新增时是否禁止
                        addDisabled: false,
                        // 表单新增时是否可见
                        addDisplay: true,
                        // 表单新增时是否为查看模式
                        addDetail: false,
                        // 表单编辑时是否禁止
                        editDisabled: true,
                        // 表单编辑时是否可见
                        editDisplay: true,
                        // 表单编辑时是否为查看模式
                        editDetail: false,
                        width: 68,
                    },
                    {
                        label: "实操成绩",
                        prop: "learnGrade",
                        slot: true,
                        // 表单新增时是否禁止
                        addDisabled: false,
                        // 表单新增时是否可见
                        addDisplay: true,
                        // 表单新增时是否为查看模式
                        addDetail: false,
                        // 表单编辑时是否禁止
                        editDisabled: false,
                        // 表单编辑时是否可见
                        editDisplay: true,
                        // 表单编辑时是否为查看模式
                        editDetail: false,
                        width: 68,
                        rules: [
                            { validator: validatePass, required: true, trigger: "blur" },
                        ],
                    },
                    {
                        label: "总成绩",
                        prop: "allGrade",
                        slot: true,
                        // 表单新增时是否禁止
                        addDisabled: false,
                        // 表单新增时是否可见
                        addDisplay: true,
                        // 表单新增时是否为查看模式
                        addDetail: false,
                        // 表单编辑时是否禁止
                        editDisabled: true,
                        // 表单编辑时是否可见
                        editDisplay: true,
                        // 表单编辑时是否为查看模式
                        editDetail: false,
                        width: 58
                    },
                    {
                        label: "是否合格",
                        prop: "qualified",
                        type: "select",
                        slot: true,
                        search: true,
                        searchSpan: 3,
                        width: 68,
                        dicData: [
                            {
                                label: "合格",
                                value: 0,
                            },
                            {
                                label: "不合格",
                                value: 1,
                            },
                            {
                                label: "暂未录实操成绩",
                                value: 2,
                            },
                            {
                                label: "缺考,成绩无效",
                                value: 3,
                            },
                        ],
                        // 表单新增时是否禁止
                        addDisabled: false,
                        // 表单新增时是否可见
                        addDisplay: true,
                        // 表单新增时是否为查看模式
                        addDetail: false,
                        // 表单编辑时是否禁止
                        editDisabled: true,
                        // 表单编辑时是否可见
                        editDisplay: true,
                        // 表单编辑时是否为查看模式
                        editDetail: false
                    },
                ],
            },
            questionBankSearch: {},
            questionBankLoading: true,
            questionBankData: [],
            questionBankPage: {
                pageSize: 10,
                currentPage: 1,
                total: 16,
            },
            questionBankQuery: {},
            questionBankSelectionList: [],
            excelForm: {},
            excelOption: {
                submitBtn: false,
                emptyBtn: false,
                column: [
                    {
                        label: "模板上传",
                        prop: "excelFile",
                        type: "upload",
                        drag: true,
                        loadText: "模板上传中,请稍等",
                        span: 24,
                        propsHttp: {
                            res: "data",
                        },
                        tip: "请上传 .xls,.xlsx 标准格式文件",
                        action: "/api/examScore/import-examScore",
                    },
                    // {
                    //     label: "数据覆盖",
                    //     prop: "isCovered",
                    //     type: "switch",
                    //     align: "center",
                    //     width: 80,
                    //     dicData: [
                    //     {
                    //         label: "否",
                    //         value: 0,
                    //     },
                    //     {
                    //         label: "是",
                    //         value: 1,
                    //     },
                    //     ],
                    //     value: 0,
                    //     slot: true,
                    //     rules: [
                    //     {
                    //         required: true,
                    //         message: "请选择是否覆盖",
                    //         trigger: "blur",
                    //     },
                    //     ],
                    // },
                    {
                        label: "模板下载",
                        prop: "excelTemplate",
                        formslot: true,
                        span: 24,
                    },
                ],
            },
        };
    },
  },
    created () { },
    mounted () { },
    computed: {
        ...mapGetters(["userInfo", "permission"]),
        permissionList () {
            return {
                addBtn: this.vaildData(null, false),
                viewBtn: this.vaildData(
                    this.permission.trainExam_performance_view,
                    false
                ),
                delBtn: this.vaildData(null, false),
                editBtn: this.vaildData(
                    this.permission.trainExam_performance_edit,
                    false
                ),
                excelBtn: this.vaildData(
                    this.permission.trainExam_performance_export,
                    false
                ),
            };
        },
    },
    methods: {
        openzhengjian (row) {
            this.baoanzdata = {
                realName: row.securityName,
                $sex: row.sex == 1 ? "男" : "女",
                securitynumber: row.securityNumber,
                paperTime: row.paperTime,
                avatar: row.avatar,
            };
            this.dialogVisiblezhengjian = true;
        },
        closezhengjian () {
            this.dialogVisiblezhengjian = false;
        },
        questionBankOnLoad (page, params = {}) {
            //判断角色,如果是保安公司管理员或保安,只能查看当前公司的考试成绩
            var that = this;
            //获取当前登录人员的角色信息
            var roleIds = this.userInfo.role_id.split(",");
            roleIds.forEach((roleId) => {
                getRoleDetail(roleId).then((res) => {
                    var roleAlias = res.data.data.roleAlias;
                    if (roleAlias == "保安公司管理员" || roleAlias == "保安") {
                        //如果是保安公司管理员
                        params["deptId"] = that.userInfo.dept_id;
                    }
                    if (roleAlias == "培训公司管理员") {
                        //如果是培训公司管理员
                        params["trainUnitId"] = that.userInfo.dept_id;
                    }
                    that.questionBankLoading = false;
                    params["examType"] = 2;
                    getList(
                        page.currentPage,
                        page.pageSize,
                        Object.assign(params, this.questionBankQuery)
                    ).then((res) => {
                        const data = res.data.data;
                        data.records.forEach(item => {
                            if (item.theoryGrade == null && item.learnGrade == -1) {
                                item.qualified = ''
                            }
                            item.theoryGrade == null ? item.theoryGrade = '' : item.theoryGrade
                            item.learnGrade == -1 ? item.learnGrade = '' : item.learnGrade
                        })
                        that.questionBankPage.total = data.total;
                        that.questionBankData = data.records;
                        that.questionBankLoading = false;
                        that.questionBankSelectionClear();
                    });
                });
            });
        },
        //缺考标记
        absent (row, done, loading) {
            this.$confirm("确定缺考标记?", {
                confirmButtonText: "确定",
                cancelButtonText: "取消",
                type: "warning",
            }).then(() => {
                row.qualified = 3;
                updateAbsent(row).then(
                    () => {
                        this.questionBankOnLoad(this.questionBankPage);
                        this.$message({
                            type: "success",
                            message: "操作成功!",
                        });
                        done();
                    },
                    (error) => {
                        window.console.log(error);
                        loading();
                    }
                );
            });
        },
        // 修改考试成绩
        modifiedGrades (row) {
            var { id, examName, securityName, account, candidateNo, theoryGrade, learnGrade, allGrade } = row
            this.gradeForm.examName = examName
            this.gradeForm.securityName = securityName
            this.gradeForm.account = account
            this.gradeForm.candidateNo = candidateNo
            this.gradeForm.theoryGrade = theoryGrade
            this.gradeForm.learnGrade = learnGrade
            this.gradeForm.allGrade = allGrade
            this.gradeForm.editGrades = ''
            this.gradeForm.editReason = ''
            this.gradeForm.id = id
            this.gradeBoxVisible = true
        },
        uploadGrade (formName) {
            var that = this
            this.$refs[formName].validate((valid) => {
                if (valid) {
                    var obj = {}
                    obj.oldScore = this.gradeForm.theoryGrade
                    obj.newScore = this.gradeForm.editGrades
                    obj.applyCause = this.gradeForm.editReason
                    obj.examScoreId = this.gradeForm.id
                    obj.createUser = this.userInfo.Id
                    updateGrade(obj).then(
                        () => {
                            that.questionBankOnLoad(that.questionBankPage)
                            that.$message({
                                type: "success",
                                message: "操作成功!",
                            })
                            that.gradeBoxVisible = false
                        },
                        (error) => {
                            window.console.log(error)
                        }
                    );
                }
            })
        },
        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;
        },
        questionBankRowUpdate (row, index, done, loading) {
            update({
                theoryGrade: row.theoryGrade,
                learnGrade: row.learnGrade,
                examId: row.examId,
                id: row.id,
            }).then(
                () => {
                    this.questionBankOnLoad(this.questionBankPage);
                    this.$message({
                        type: "success",
                        message: "操作成功!",
                    });
                    done();
                },
                (error) => {
                    window.console.log(error);
                    loading();
                }
            );
        },
        handleTemplate () {
            window.open(`/api/examScore/export-template`);
        },
        handleImport () {
            this.excelBox = true;
        },
        uploadAfter (res, done, loading, column) {
            window.console.log(column);
            this.excelBox = false;
            // this.$message({
            //   type: "success",
            //   message: "操作成功!",
            // });
            this.refreshChange();
            done();
        },
        refreshChange () {
            this.questionBankOnLoad(this.questionBankPage, this.questionBankQuery);
        },
        //成绩导出
        handleExport () {
            this.$confirm("是否导出成绩数据?", "提示", {
                confirmButtonText: "确定",
                cancelButtonText: "取消",
                type: "warning",
            }).then(() => {
                //获取查询条件
                // console.log(this.questionBankSearch, 456);
                var data = {
                    account: this.questionBankSearch.account,
                    companyName: this.questionBankSearch.companyName,
                    examDate: this.questionBankSearch.examDate,
                    isExam: this.questionBankSearch.isExam,
                    qualified: this.questionBankSearch.qualified,
                    securityName: this.questionBankSearch.securityName,
                    examName: this.questionBankSearch.examName,
                };
                //导出
                if (
                    this.userInfo.role_name == "保安公司管理员" ||
                    this.userInfo.role_name == "保安"
                ) {
                    //如果是保安公司管理员
                    data["deptId"] = this.userInfo.dept_id;
                }
                if (this.userInfo.role_name == "培训公司管理员") {
                    //如果是培训公司管理员
                    data["trainUnitId"] = this.userInfo.dept_id;
                }
                data["examType"] = 2;
                //序列号url形式,用&拼接
                data = Qs.stringify(data);
                window.open(`/api/examScore/export-examScore?` + data);
            });
        },
    },
};
</script>
<style lang="scss" scoped>
.morpheus-box {
  position: relative;
    position: relative;
}
.dialogVisiblezhengjian {
  position: absolute;
  background-color: #fff;
  width: 100%;
  height: 100%;
  z-index: 10000 !important;
    position: absolute;
    background-color: #fff;
    width: 100%;
    height: 100%;
    z-index: 10000 !important;
}
</style>