Administrator
2021-08-28 e4100ecc3a88273dcdbc2c1452d4e9f00736f3db
src/views/applyexam/index.vue
@@ -65,16 +65,18 @@
                plain
                icon="el-icon-folder-checked"
                @click="handleBatchExam"
                v-if="examPersission"
                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>
@@ -83,6 +85,7 @@
                :type="type"
                size="small"
                icon="el-icon-refresh-left"
                v-if="permission.applyexam_cancel"
                :disabled="row.isApply == 2"
                @click="handleCancel(row)"
                >取消报名
@@ -100,10 +103,14 @@
                :type="type"
                size="small"
                icon="el-icon-receiving"
                :disabled="row.applyStatus == 4"
                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>
@@ -121,35 +128,33 @@
              @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>
            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="1000px"
            @close='closeDialog'
            width="900px"
            @close="closeDialog"
          >
            <avue-form
              ref="formExamApply"
@@ -169,12 +174,12 @@
import {
  getApplyList,
  addApply,
  updateApply,
  cancelApply,
  remove,
  addExam
  addExam,
} from "@/api/examapi/applyexam";
import { mapState } from "vuex";
import { mapGetters } from "vuex";
var DIC = {
  applyStatus: [
    {
@@ -193,35 +198,35 @@
    return {
      dialogFormVisible: false,
      dialogExamFormVisible: false,
      examPersission:false,
      applyExport:false,
      excelBox:false,
      examPersission: false,
      applyExport: false,
      excelBox: false,
      Audit: {},
      excelForm: {},
      excelOption: {
          submitBtn: false,
          emptyBtn: false,
          column: [
        submitBtn: false,
        emptyBtn: false,
        column: [
          {
              label: "模板上传",
              prop: "excelFile",
              type: "upload",
              drag: true,
              loadText: "模板上传中,请稍等",
              span: 24,
              propsHttp: {
            label: "模板上传",
            prop: "excelFile",
            type: "upload",
            drag: true,
            loadText: "模板上传中,请稍等",
            span: 24,
            propsHttp: {
              res: "data",
              },
              tip: "请上传 .xls,.xlsx 标准格式文件",
              action: "/api/apply/import-apply",
            },
            tip: "请上传 .xls,.xlsx 标准格式文件",
            action: "/api/apply/import-apply",
          },
          {
              label: "模板下载",
              prop: "excelTemplate",
              formslot: true,
              span: 24,
            label: "模板下载",
            prop: "excelTemplate",
            formslot: true,
            span: 24,
          },
          ],
        ],
      },
      optionAudit: {
        height: "auto",
@@ -230,7 +235,7 @@
        tip: false,
        searchShow: true,
        searchMenuSpan: 6,
        border: false,
        border: true, //liu
        index: true,
        stripe: true,
        viewBtn: true,
@@ -284,7 +289,7 @@
        tip: false,
        searchShow: true,
        searchMenuSpan: 6,
        border: false,
        border: true, //liu
        index: true,
        stripe: true,
        viewBtn: true,
@@ -295,10 +300,10 @@
        column: [
          {
            label: "考试时间",
            prop: "examTime",
            type: "daterange",
            format: "yyyy-MM-dd HH:mm:ss",
            valueFormat: "yyyy-MM-dd HH:mm:ss",
            prop: "startTime",
            type: "datetime",
            format: "yyyy-MM-dd HH:mm",
            valueFormat: "yyyy-MM-dd HH:mm",
            startPlaceholder: "考试开始时间",
            endPlaceholder: "考试结束时间",
            // 表单新增时是否禁止
@@ -350,7 +355,7 @@
        //tree 默认展开
        defaultExpandAll: true,
        // 操作栏宽度
        menuWidth: 300,
        menuWidth: 250,
        column: [
          {
@@ -419,37 +424,55 @@
            ],
          },
          {
            label: "考试名称",
            prop: "examName",
            type: "tree",
            dicUrl: "/api/exampaper/page-tree?examType=1",
            // search: true,
            label: "年龄",
            prop: "age",
            slot: true,
            // 表单新增时是否禁止
            addDisabled: false,
            // 表单新增时是否可见
            addDisplay: true,
            addDisplay: false,
            // 表单新增时是否为查看模式
            addDetail: false,
            // 表单编辑时是否禁止
            editDisabled: true,
            editDisabled: false,
            // 表单编辑时是否可见
            editDisplay: true,
            editDisplay: false,
            // 表单编辑时是否为查看模式
            editDetail: false,
            props: {
              label: "examName",
              value: "id",
            },
            rules: [
              {
                required: true,
                message: "请选择试卷名称",
                trigger: "blur",
              },
            ],
            width: 220,
            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",
@@ -633,11 +656,12 @@
          //   editDetail: false,
          //   width: 150,
          // },
          // {
          //   label: "报名状态",
          //   prop: "applyStatus",
          //   label: "审查状态",
          //   prop: "examinationType",
          //   slot: true,
          //   searchSpan: 4,
          //   searchSpan: 5,
          //   // 表单新增时是否禁止
          //   addDisabled: false,
          //   // 表单新增时是否可见
@@ -650,43 +674,37 @@
          //   editDisplay: true,
          //   // 表单编辑时是否为查看模式
          //   editDetail: false,
          //   dicData: DIC.applyStatus,
          //   dicData: [
          //     {
          //       label: "正常",
          //       value: "1",
          //     },
          //     {
          //       label: "异常",
          //       value: "2",
          //     },
          //   ],
          //   search: true,
          //   type: "select",
          // },
          // {
          //     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"
          //         },
          //         {
          //             label: '审核不通过',
          //             value: "3"
          //         }
          //         ],
          //     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,
          // },
        ],
      },
@@ -731,7 +749,7 @@
    console.log(this.userInfo);
    if (this.userInfo.role_name.indexOf("ksxtadmin") != -1) {
        this.examPersission = true;
      this.examPersission = true;
    }
  },
  mounted() {},
@@ -739,6 +757,15 @@
    ...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) => {
@@ -831,20 +858,20 @@
    },
    //生成考试弹窗
    handleBatchExam(){
    handleBatchExam() {
      this.dialogExamFormVisible = true;
      if (this.questionBankSelectionList.length === 0) {
        this.ids = "";
      }
    },
    //生成考试
    submitExamApply(row, done, loading){
    submitExamApply(row, done, loading) {
      var that = this;
      var startTime = row.examTime[0];
      var endTime = row.examTime[1];
      var examTime = JSON.stringify(row.examTime);
      console.log(this.ids,111);
      addExam(this.ids, examTime, startTime, endTime).then(
      var startTime = row.startTime + ":00";
      // var endTime = row.examTime[1];
      // var examTime = JSON.stringify(row.examTime);
      // console.log(this.ids,111);
      addExam(this.ids, null, startTime, null).then(
        () => {
          this.questionBankOnLoad(this.questionBankPage);
          this.$message({
@@ -862,7 +889,7 @@
      );
    },
    //关闭窗口清除数据
    closeDialog(){
    closeDialog() {
      this.$refs.formExamApply.resetFields();
    },
@@ -893,7 +920,7 @@
      })
        .then(() => {
          row.applyStatus = 4;
          return updateApply(row);
          return cancelApply(row);
        })
        .then(() => {
          this.questionBankOnLoad(this.questionBankPage);
@@ -936,19 +963,17 @@
    },
    handleTemplate() {
        window.open(
            `/api/apply/export-template`
        );
      window.open(`/api/apply/export-template`);
    },
    uploadAfter(res, done, loading, column) {
        window.console.log(column);
        this.excelBox = false;
        this.refreshChange();
        done();
      window.console.log(column);
      this.excelBox = false;
      this.refreshChange();
      done();
    },
    refreshChange() {
        this.questionBankOnLoad(this.page, this.query);
      this.questionBankOnLoad(this.page, this.query);
    },
  },
};