保安服务企业管理-验收版本
Administrator
2021-09-13 fe0c2d838e1657dbe3efdf4dfd083cee6cf80de1
src/views/applyexam/index.vue
@@ -75,7 +75,7 @@
                plain
                icon="el-icon-folder-checked"
                v-if="permission.applyexam_import"
               @click="handleImport"
                @click="handleImport"
                >批量报名
              </el-button>
            </template>
@@ -103,7 +103,7 @@
                :type="type"
                size="small"
                icon="el-icon-receiving"
                v-if="permission.applyexam_print && row.candidateNo!=''"
                v-if="permission.applyexam_print && row.candidateNo != ''"
                @click="handlePrint(row)"
                >准考证打印
              </el-button>
@@ -181,6 +181,7 @@
import { mapState } from "vuex";
import { mapGetters } from "vuex";
import { getRoleDetail } from "@/api/system/role";
import { getUserDetails } from "@/api/experience/experience"
var DIC = {
  applyStatus: [
    {
@@ -197,6 +198,9 @@
export default {
  data() {
    return {
      obj:{
        userId:''
      },
      dialogFormVisible: false,
      dialogExamFormVisible: false,
      examPersission: false,
@@ -302,15 +306,15 @@
          {
            label: "考试人数",
            prop: "number",
            type: 'number',
            type: "number",
            span: 12,
            precision:0,
            step:50,
            mock:{
              type:'number',
              max:1000,
              min:0,
              precision:0
            precision: 0,
            step: 50,
            mock: {
              type: "number",
              max: 1000,
              min: 0,
              precision: 0,
            },
            rules: [
              {
@@ -321,22 +325,22 @@
            ],
            minRows: 0,
            maxRows: 1000,
            value:50,
            value: 50,
          },
          {
            label: "序号开始",
            prop: "serialStart",
            span: 6,
            value:1,
            mock:{
              type:'number',
              max:1000,
              min:1,
              precision:0
            value: 1,
            mock: {
              type: "number",
              max: 1000,
              min: 1,
              precision: 0,
            },
            minRows: 1,
            maxRows: 1000,
            type:"number",
            type: "number",
            rules: [
              {
                required: true,
@@ -349,16 +353,16 @@
            label: "序号结束",
            prop: "serialEnd",
            span: 6,
            value:50,
            mock:{
              type:'number',
              max:1000,
              min:1,
              precision:0
            value: 50,
            mock: {
              type: "number",
              max: 1000,
              min: 1,
              precision: 0,
            },
            minRows: 1,
            maxRows: 1000,
            type:"number",
            type: "number",
            rules: [
              {
                required: true,
@@ -427,7 +431,8 @@
        // 操作栏多余按钮去除
        delBtn: false,
        editBtn: false,
        addBtn: false,
        addBtn: true,
        addBtnText: "报名信息新增",
        selection: false,
        menu: true,
        // 导出按钮
@@ -450,13 +455,55 @@
        defaultExpandAll: true,
        // 操作栏宽度
        menuWidth: 250,
        column: [
          {
            label: "报名时间",
            prop: "releaseTimeRange",
            type: "date",
            format: "yyyy-MM-dd",
            valueFormat: "yyyy-MM-dd",
            searchRange: true,
            searchSpan: 5,
            hide: true,
            addDisplay: false,
            editDisplay: false,
            viewDisplay: false,
            search: true,
            rules: [
              {
                required: true,
                message: "请输入时间",
                trigger: "blur",
              },
            ],
          },
          {
            label: "保安公司名称",
            searchLabelWidth: "110",
            labelWidth: 110,
            cascaderItem: ["userId"],
            prop: "deptId",
            type: "tree",
            hide: true,
            viewDisabled:false,
            viewDisplay:false,
            dicUrl:
              "/api/blade-system/dept/security_lazy-tree?parentId=1413470343230877697",
            props: {
              label: "title",
              value: "id",
            },
            slot: true,
            searchSpan: 4,
            search: false,
            width: 260,
          },
          {
            label: "保安姓名",
            prop: "userId",
            type: "tree",
            dicUrl: "",
            dicUrl:
              "/api/blade-user/security-apply-tree?examType=1&deptId={{key}}",
            hide: true,
            slot: true,
            searchSpan: 4,
@@ -475,7 +522,7 @@
            // 表单编辑时是否为查看模式
            editDetail: false,
            props: {
              label: "title",
              label: "name",
              value: "id",
            },
            rules: [
@@ -522,107 +569,17 @@
            prop: "age",
            slot: true,
            // 表单新增时是否禁止
            addDisabled: false,
            addDisabled: true,
            // 表单新增时是否可见
            addDisplay: false,
            // 表单新增时是否为查看模式
            addDetail: false,
            // 表单编辑时是否禁止
            editDisabled: false,
            // 表单编辑时是否可见
            editDisplay: false,
            // 表单编辑时是否为查看模式
            editDetail: false,
            addDisplay: true,
            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,
            search: true,
            searchSpan: 5,
            // 表单新增时是否禁止
            addDisabled: false,
            // 表单新增时是否可见
@@ -645,21 +602,14 @@
            width: 150,
          },
          {
            label: "报考证件",
            prop: "applyCard",
            slot: true,
            label: "身份证号",
            prop: "cardid",
            searchSpan: 5,
            // 表单新增时是否禁止
            addDisabled: false,
            addDisabled: true,
            // 表单新增时是否可见
            addDisplay: false,
            // 表单新增时是否为查看模式
            addDetail: false,
            // 表单编辑时是否禁止
            editDisabled: false,
            // 表单编辑时是否可见
            editDisplay: true,
            // 表单编辑时是否为查看模式
            editDetail: false,
            addDisplay: true,
            hide:true,
            rules: [
              {
                required: true,
@@ -667,23 +617,108 @@
                trigger: "blur",
              },
            ],
            width: 150,
          },
          {
            label: "性别",
            prop: "sex",
            type: "select",
            // 表单新增时是否禁止
            addDisabled: true,
            // 表单新增时是否可见
            addDisplay: true,
            dicData: [
              {
                label: "男",
                value: 1,
              },
              {
                label: "女",
                value: 2,
              },
              {
                label: "未知",
                value: 3,
              },
              {
                label: " ",
                value: -1,
              },
            ],
            display: false,
          },
          {
            label: "籍贯",
            prop: "nativePlace",
            // 表单新增时是否禁止
            addDisabled: true,
            // 表单新增时是否可见
            addDisplay: true,
          },
          {
            label: "联系电话",
            prop: "phone",
            // 表单新增时是否禁止
            addDisabled: true,
            // 表单新增时是否可见
            addDisplay: true,
          },
          {
            label: "保安公司名称",
            labelWidth: "110",
            addDisplay: false,
            prop: "deptName",
            width: 260,
          },
          // {
          //     label: "试卷分数",
          //     prop: "paperScore",
          //     slot: true,
          //     // 表单新增时是否禁止
          //     addDisabled: false,
          //     // 表单新增时是否可见
          //     addDisplay: false,
          //     // 表单新增时是否为查看模式
          //     addDetail: false,
          //     // 表单编辑时是否禁止
          //     editDisabled: true,
          //     // 表单编辑时是否可见
          //     editDisplay: true,
          //     // 表单编辑时是否为查看模式
          //     editDetail: false
          //   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: "applyCard",
          //   slot: true,
          //   // 表单新增时是否禁止
          //   addDisabled: false,
          //   // 表单新增时是否可见
          //   addDisplay: false,
          //   // 表单新增时是否为查看模式
          //   addDetail: false,
          //   // 表单编辑时是否禁止
          //   editDisabled: false,
          //   // 表单编辑时是否可见
          //   editDisplay: true,
          //   // 表单编辑时是否为查看模式
          //   editDetail: false,
          //   rules: [
          //     {
          //       required: true,
          //       message: "请选择准考证号",
          //       trigger: "blur",
          //     },
          //   ],
          // },
          {
            label: "报名时间",
@@ -729,105 +764,39 @@
            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,
          // },
          {
            label: "报名状态",
            prop: "applyStatus",
            search: true,
            searchSpan: 4,
            type: "select",
            // 表单新增时是否禁止
            addDisabled: false,
            // 表单新增时是否可见
            addDisplay: false,
            // 表单新增时是否为查看模式
            addDetail: false,
            // 表单编辑时是否禁止
            editDisabled: true,
            // 表单编辑时是否可见
            editDisplay: true,
            // 表单编辑时是否为查看模式
            editDetail: false,
            dicData: [
              {
                label: "全部",
                value: 1,
              },
              {
                label: "已报名",
                value: 2,
              },
              {
                label: "已取消",
                value: 4,
              },
            ],
          },
        ],
      },
      questionBankSearch: {},
@@ -844,24 +813,18 @@
  },
  watch: {
    "form.examname": {
    "obj.userId": {
      // 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(val){
          //查询用户信息
          getUserDetails(this.userId).then((res)=>{
            var data = res.data.data;
            this.obj.cardid = data.cardid;
            this.obj.age = data.age;
            this.obj.nativeplace = data.nativeplace;
            this.obj.phone = data.phone;
          })
        }
      },
      immediate: true,
@@ -874,17 +837,19 @@
      this.examPersission = true;
    }
    this.questionBankSearch['applyStatus'] = 2;
    this.questionBankSearch["applyStatus"] = 2;
  },
  mounted() {},
  computed: {
    ...mapState({
      userInfo: (state) => state.user.userInfo,
    }),
    ...mapGetters(["userInfo", "permission"]),
    permissionList() {
      return {
        addBtn: this.vaildData(null, false),
        addBtn: this.vaildData(this.permission.applyexam_add, false),
        viewBtn: this.vaildData(this.permission.applyexam_view, false),
        delBtn: this.vaildData(null, false),
        editBtn: this.vaildData(null, false),
@@ -896,6 +861,10 @@
        ids.push(ele.id);
      });
      return ids.join(",");
    },
    userId() {
        var d = this.obj.userId + "";
        return d;
    },
  },
  methods: {
@@ -918,27 +887,46 @@
      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();
            });
          })
      })
          var roleAlias = res.data.data.roleAlias;
          if (roleAlias == "保安公司管理员" || roleAlias == "保安") {
            //如果是保安公司管理员
            params["deptId"] = that.userInfo.dept_id;
          }
          // const { releaseTimeRange } = this.questionBankSearch;
          const { releaseTimeRange } = this.questionBankQuery;
          var values;
          // console.log(releaseTimeRange, 123);
          if (releaseTimeRange) {
            values = {
              ...params,
              beginTime: releaseTimeRange[0],
              overTime: releaseTimeRange[1],
              ...this.questionBankQuery,
            };
            values.releaseTimeRange = null;
          } else {
            values = {
              ...params,
              ...this.questionBankQuery,
            };
          }
          getApplyList(
            page.currentPage,
            page.pageSize,
            // Object.assign(values, this.questionBankQuery)
            values
          ).then((res) => {
            const data = res.data.data;
            this.questionBankPage.total = data.total;
            this.questionBankData = data.records;
            this.questionBankLoading = false;
            this.questionBankSelectionClear();
          });
        });
      });
    },
    questionBankSelectionClear() {
      this.questionBankSelectionList = [];
@@ -954,7 +942,9 @@
      done();
    },
    questionBankSearchReset() {
      this.questionBankQuery = {};
      this.questionBankQuery = {
        applyStatus:1,
      };
      this.questionBankOnLoad(this.questionBankPage);
    },
    questionBankCurrentChange(currentPage) {
@@ -967,11 +957,8 @@
    // 新增
    questionBankRowSave(row, done, loading) {
      // debugger;
      addApply({
        userId: row.userId,
        examId: row.examName,
        applyTime: row.applyTime,
      }).then(
      console.log(row,11111);
      addApply(row).then(
        (res) => {
          this.questionBankOnLoad(this.questionBankPage);
          if (res.data.data == 201) {
@@ -1011,24 +998,24 @@
      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;
      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){
      if (s > e) {
        this.$message({
            type: "error",
            message: "截止时间不能早于考试考试开始时间!",
          });
         done();
         return;
          type: "error",
          message: "截止时间不能早于考试考试开始时间!",
        });
        done();
        return;
      }
      addExam(Object.assign(row, this.questionBankSearch)).then(
        () => {