Administrator
2021-12-09 d1b058faa19088838b668d6c03dd71c2bcc7d5d3
src/views/trainExam/index.vue
@@ -1,15 +1,20 @@
/*
 * @Author: Morpheus
 * @Date: 2021-07-05 16:31:54
 * @Last Modified by: Morpheus
 * @Last Modified time: 2021-07-18 17:09:52
 * @Last Modified by: liu
 * @Last Modified time: 2021-11-23 14:12:55
 * menu-name 考试管理
 */
<template>
  <el-row class="morpheus-box-paper">
    <el-col :span="24">
      <el-card>
        <div class="exam-card-body">
        <div
          :class="[
            'exam-card-body',
            $store.state.control.windowWidth >= 1024 ? 'oneRowSearch' : '',
          ]"
        >
          <avue-crud
            v-model="form"
            class="company-box"
@@ -53,6 +58,7 @@
            <template slot="menuLeft">
              <el-button
                style="display: none"
                type="danger"
                size="small"
                icon="el-icon-delete"
@@ -71,6 +77,7 @@
                size="mini"
                icon="el-icon-collection"
                class="start-kaoshi"
                v-if="permission.trainExam_trainPapers"
                @click="startExam(row)"
                >报名清册
              </el-button>
@@ -78,8 +85,17 @@
                type="text"
                size="mini"
                icon="el-icon-folder-checked"
                v-if="permission.trainExam_check"
                @click="handleAudit(row)"
                >审核
              </el-button>
              <el-button
                type="text"
                size="mini"
                icon="el-icon-folder-checked"
                v-if="permission.trainExam_index_examScoreViews"
                @click="examScoreViews(row)"
                >成绩查看
              </el-button>
            </template>
          </avue-crud>
@@ -106,8 +122,15 @@
</template>
<script>
import { getList, add, remove, update,updateAudit } from "@/api/examapi/examination";
import {
  getList,
  add,
  remove,
  update,
  updateAudit,
} from "@/api/examapi/examination";
import { auditColumn } from "./data";
import { mapGetters } from "vuex";
export default {
  data() {
    var validatePass = (rule, value, callback) => {
@@ -135,27 +158,29 @@
        tip: false,
        searchShow: true,
        searchMenuSpan: 6,
        border: false,
        border: true, //liu
        index: true,
        stripe: true,
        viewBtn: true,
        addBtn: true,
        viewBtn: false,
        addBtn: false,
        editBtn: false,
        selection: true,
        excelBtn: false,
        menuWidth: 230,
        dialogClickModal: false,
        column: auditColumn,
        ...this.$store.state.control.clearOtherBut,
      },
      questionBankOption: {
        // 操作栏多余按钮去除
        delBtn: true,
        delBtn: false,
        editBtn: true,
        addBtn: true,
        addBtn: false,
        selection: true,
        menu: true,
        // 导出按钮
        excelBtn: false,
        viewBtn: true,
        viewBtn: false,
        // title: '题库',
@@ -171,15 +196,13 @@
        dialogClickModal: false,
        // 操作栏宽度
        menuWidth: 280,
        labelWidth: 140,
        ...this.$store.state.control.clearOtherBut,
        column: [
          {
            label: "考试名称",
            prop: "examName",
            search: true,
            searchSpan: 4,
            slot: true,
            // 表单新增时是否禁止
            addDisabled: false,
@@ -200,7 +223,8 @@
                trigger: "blur",
              },
            ],
            width:200,
            span: 24,
            width: 200,
          },
          // {
          //     label: "试卷分数",
@@ -224,13 +248,11 @@
          // },
          {
            label: "考试时间",
            prop: "examTime",
            type: "daterange",
            // span: 24,
            format: "yyyy-MM-dd HH:mm:ss",
            valueFormat: "yyyy-MM-dd HH:mm:ss",
            startPlaceholder: "考试开始时间",
            endPlaceholder: "考试结束时间",
            prop: "startTime",
            type: "datetime",
            format: "yyyy-MM-dd HH:mm",
            valueFormat: "yyyy-MM-dd HH:mm",
            hide: true,
            // 表单新增时是否禁止
            addDisabled: false,
            // 表单新增时是否可见
@@ -243,8 +265,6 @@
            editDisplay: true,
            // 表单编辑时是否为查看模式
            editDetail: false,
            // display: false,
            hide: true,
            rules: [
              {
                required: true,
@@ -252,15 +272,14 @@
                trigger: "blur",
              },
            ],
            width: 160,
          },
          {
            label: "考试开始时间",
            prop: "startTime",
            type: "datetime",
            // span: 24,
            format: "yyyy-MM-dd HH:mm:ss",
            valueFormat: "yyyy-MM-dd HH:mm:ss",
            format: "yyyy-MM-dd HH:mm",
            valueFormat: "yyyy-MM-dd HH:mm",
            // 表单新增时是否禁止
            addDisabled: false,
            // 表单新增时是否可见
@@ -273,15 +292,15 @@
            editDisplay: false,
            // 表单编辑时是否为查看模式
            editDetail: false,
            width: 160,
            width: 140,
          },
          {
            label: "考试结束时间",
            label: "考试开始截止时间",
            prop: "endTime",
            type: "datetime",
            // span: 24,
            format: "yyyy-MM-dd HH:mm:ss",
            valueFormat: "yyyy-MM-dd HH:mm:ss",
            format: "yyyy-MM-dd HH:mm",
            valueFormat: "yyyy-MM-dd HH:mm",
            // 表单新增时是否禁止
            addDisabled: false,
            // 表单新增时是否可见
@@ -291,14 +310,14 @@
            // 表单编辑时是否禁止
            editDisabled: false,
            // 表单编辑时是否可见
            editDisplay: false,
            editDisplay: true,
            // 表单编辑时是否为查看模式
            editDetail: false,
            width: 160,
            width: 140,
          },
          {
            label: "创建人",
            prop: "creator",
            label: "申请人",
            prop: "realName",
            slot: true,
            // 表单新增时是否禁止
            addDisabled: true,
@@ -312,14 +331,34 @@
            editDisplay: false,
            // 表单编辑时是否为查看模式
            editDetail: false,
            hide: true,
            // hide: true,
            display: false,
            width: 80,
          },
          {
            label: "申请人所属学校",
            prop: "deptName",
            slot: true,
            // 表单新增时是否禁止
            addDisabled: true,
            // 表单新增时是否可见
            addDisplay: false,
            // 表单新增时是否为查看模式
            addDetail: false,
            // 表单编辑时是否禁止
            editDisabled: true,
            // 表单编辑时是否可见
            editDisplay: false,
            // 表单编辑时是否为查看模式
            editDetail: false,
            // hide: true,
            display: false,
          },
          {
            label: "备注",
            prop: "remark",
            span: 24,
            hide:true,
            hide: true,
            slot: true,
            // 表单新增时是否禁止
            addDisabled: false,
@@ -330,13 +369,34 @@
            // 表单编辑时是否禁止
            editDisabled: false,
            // 表单编辑时是否可见
            editDisplay: true,
            editDisplay: false,
            // 表单编辑时是否为查看模式
            editDetail: false,
          },
          {
            label: "注意事项",
            prop: "examAttention",
            type: "textarea",
            span: 24,
            slot: true,
            hide: true,
            // 表单新增时是否禁止
            addDisabled: false,
            // 表单新增时是否可见
            addDisplay: true,
            // 表单新增时是否为查看模式
            addDetail: false,
            // 表单编辑时是否禁止
            editDisabled: false,
            // 表单编辑时是否可见
            editDisplay: false,
            // 表单编辑时是否为查看模式
            editDetail: false,
            width: 150,
          },
          {
            label: "报名人数",
            prop: "num",
            type: "textarea",
            span: 24,
            slot: true,
@@ -349,16 +409,36 @@
            // 表单编辑时是否禁止
            editDisabled: false,
            // 表单编辑时是否可见
            editDisplay: true,
            editDisplay: false,
            // 表单编辑时是否为查看模式
            editDetail: false,
            width: 150,
            width: 80,
          },
          {
            label: "考试人数",
            prop: "examNum",
            type: "textarea",
            span: 24,
            slot: true,
            // 表单新增时是否禁止
            addDisabled: false,
            // 表单新增时是否可见
            addDisplay: true,
            // 表单新增时是否为查看模式
            addDetail: false,
            // 表单编辑时是否禁止
            editDisabled: false,
            // 表单编辑时是否可见
            editDisplay: false,
            // 表单编辑时是否为查看模式
            editDetail: false,
            width: 80,
          },
          {
            label: "申请时间",
            prop: "createTime",
            prop: "creatorDate",
            type: "datetime",
            width: 160,
            width: 150,
            editDisplay: false,
            addDisplay: false,
            format: "yyyy-MM-dd HH:mm:ss",
@@ -375,7 +455,7 @@
            label: "审核时间",
            prop: "auditTime",
            type: "datetime",
            width: 160,
            width: 150,
            editDisplay: false,
            addDisplay: false,
            format: "yyyy-MM-dd HH:mm:ss",
@@ -418,6 +498,7 @@
                value: 3,
              },
            ],
            width: 80,
          },
          {
            label: "审核明细",
@@ -434,12 +515,12 @@
        pageSize: 10,
        currentPage: 1,
        total: 16,
        ...this.$store.state.control.changePageSize,
      },
      questionBankQuery: {},
      questionBankSelectionList: [],
    };
  },
  created() {},
  mounted() {},
  computed: {
    ids() {
@@ -449,12 +530,25 @@
      });
      return ids.join(",");
    },
    ...mapGetters(["userInfo", "permission"]),
    permissionList() {
      return {
        addBtn: this.vaildData(null, false),
        viewBtn: this.vaildData(this.permission.trainExam_edit, false),
        delBtn: this.vaildData(null, false),
        editBtn: this.vaildData(null, false),
      };
    },
  },
  watch: {},
  methods: {
    questionBankOnLoad(page, params = {}) {
      this.questionBankLoading = false;
      params["examType"] = 2;
      //如果是培训公司管理员,则只能看到当前培训公司申请的考试
      if (this.userInfo.role_name == "培训公司管理员") {
        params["deptId"] = this.userInfo.dept_id;
      }
      getList(
        page.currentPage,
        page.pageSize,
@@ -491,7 +585,7 @@
      this.questionBankPage.pageSize = pageSize;
    },
    //审核
    submit(row,done,loading){
    submit(row, done, loading) {
      updateAudit(row).then(
        () => {
          this.dialogFormVisible = false;
@@ -525,11 +619,21 @@
        });
      }
    },
    examScoreViews(row) {
      //模拟考试
      if (row.examType == 2) {
        this.$router.push({
          path: `/trainExam/singleperformance`,
          query: row,
        });
      }
    },
    // 新增
    questionBankRowSave(row, done, loading) {
      row.startTime = row.examTime[0];
      row.endTime = row.examTime[1];
      row.examTime = JSON.stringify(row.examTime);
      row.startTime = row.startTime + ":00";
      row["examType"] = 2;
      // row.endTime = row.examTime[1];
      // row.examTime = JSON.stringify(row.examTime);
      add(row).then(
        () => {
          this.questionBankOnLoad(this.questionBankPage);
@@ -546,13 +650,19 @@
      );
    },
    questionBankRowUpdate(row, index, done, loading) {
      if (Array.isArray(row.examTime) != true) {
        row.examTime = row.examTime.split(",");
      }
      row.startTime = row.examTime[0];
      row.endTime = row.examTime[1];
      row.examTime = JSON.stringify(row.examTime);
      update(row).then(
      // if (Array.isArray(row.examTime) != true) {
      //   row.examTime = row.examTime.split(",");
      // }
      const data = {
        id: row.id,
        startTime: row.startTime + ":00",
        endTime: row.endTime + ":00",
      };
      // row.startTime = row.startTime + ":00";
      // row.endTime = row.endTime + ":00";
      // row.endTime = row.examTime[1];
      // row.examTime = JSON.stringify(row.examTime);
      update(data).then(
        () => {
          this.questionBankOnLoad(this.questionBankPage);
          this.$message({