Administrator
2022-01-12 21c7375b7b38ebf2c8a2ca8fbf6fe9fb4f28250f
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"
@@ -29,37 +34,33 @@
            @row-update="questionBankRowUpdate"
            @row-del="questionBankRowDel"
          >
            <!-- 自定义按钮 -->
            <!-- <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>
                            <el-button type="danger"
                                       size="mini"
                                       icon="el-icon-delete"
                                       plain
                                       @click="handleDelete">导出
                            </el-button>
                        </template> -->
            <template slot-scope="{ row }" slot="auditStatus">
              <el-tag class="dtype">
                {{
                  row.auditStatus == 1
                    ? "审核通过"
                    : row.auditStatus == 2
                    ? "审核不通过"
                    : "待审核"
                }}
                <i class="zc" v-if="row.auditStatus == 1"></i>
                <i class="yj" v-if="row.auditStatus == 2"></i>
                <i class="gz" v-if="row.auditStatus == 3"></i>
              </el-tag>
            </template>
            <template slot="menuLeft">
              <el-button
                style="display:none"
                style="display: none"
                type="danger"
                size="small"
                icon="el-icon-delete"
                @click="questionBankHandleDelete"
                >删 除
              </el-button>
              <!--图例 components-->
              <span>
                <Legend :datas="datalistLIU"></Legend>
              </span>
            </template>
            <template slot-scope="{ row }" slot="examStatus">
@@ -87,7 +88,15 @@
              <el-button
                type="text"
                size="mini"
                icon="el-icon-folder-checked"
                icon="el-icon-circle-check"
                v-if="permission.trainExam_confirm"
                @click="handleConfirm(row)"
                >考试名单确认
              </el-button>
              <el-button
                type="text"
                size="mini"
                icon="el-icon-search"
                v-if="permission.trainExam_index_examScoreViews"
                @click="examScoreViews(row)"
                >成绩查看
@@ -123,10 +132,15 @@
  remove,
  update,
  updateAudit,
  applyConfirm,
} from "@/api/examapi/examination";
import { auditColumn } from "./data";
import { mapGetters } from "vuex";
import Legend from "@/components/liu-legend/Legend";
export default {
  components: {
    Legend,
  },
  data() {
    var validatePass = (rule, value, callback) => {
      console.log(value);
@@ -144,6 +158,21 @@
    return {
      form: {},
      //legend-liu数据
      datalistLIU: [
        {
          color: "#29C093",
          text: "审核通过",
        },
        {
          color: "#F34A4A",
          text: "审核不通过",
        },
        {
          color: "#F48F57",
          text: "待审核",
        },
      ],
      Audit: {},
      dialogFormVisible: false,
      optionAudit: {
@@ -164,20 +193,19 @@
        menuWidth: 230,
        dialogClickModal: false,
        column: auditColumn,
        ...this.$store.state.control.clearOtherBut,
      },
      questionBankOption: {
        // 操作栏多余按钮去除
        delBtn: false,
        editBtn: false,
        editBtn: true,
        addBtn: false,
        selection: true,
        // selection: true,
        menu: true,
        // 导出按钮
        excelBtn: false,
        viewBtn: false,
        // title: '题库',
        align: "center",
        height: "auto",
        calcHeight: 80,
@@ -189,10 +217,9 @@
        //dialogType: 'drawer',
        dialogClickModal: false,
        // 操作栏宽度
        menuWidth: 280,
        menuWidth: 260,
        labelWidth: 140,
        ...this.$store.state.control.clearOtherBut,
        column: [
          {
            label: "考试名称",
@@ -218,28 +245,10 @@
                trigger: "blur",
              },
            ],
            span: 24,
            width: 200,
            overHidden: true,
          },
          // {
          //     label: "试卷分数",
          //     prop: "totalScore",
          //     slot: true,
          //     // 表单新增时是否禁止
          //     addDisabled: false,
          //     // 表单新增时是否可见
          //     addDisplay: true,
          //     // 表单新增时是否为查看模式
          //     addDetail: false,
          //     // 表单编辑时是否禁止
          //     editDisabled: false,
          //     // 表单编辑时是否可见
          //     editDisplay: true,
          //     // 表单编辑时是否为查看模式
          //     editDetail: false,
          //     rules: [{ validator: validatePass, required: true, trigger: 'blur' }],
          //     width: 100
          // },
          {
            label: "考试时间",
            prop: "startTime",
@@ -271,7 +280,6 @@
            label: "考试开始时间",
            prop: "startTime",
            type: "datetime",
            // span: 24,
            format: "yyyy-MM-dd HH:mm",
            valueFormat: "yyyy-MM-dd HH:mm",
            // 表单新增时是否禁止
@@ -286,32 +294,53 @@
            editDisplay: false,
            // 表单编辑时是否为查看模式
            editDetail: false,
            width: 160,
            width: 120,
          },
          {
            label: "考试开始截止时间",
            prop: "endTime",
            type: "datetime",
            // span: 24,
            format: "yyyy-MM-dd HH:mm",
            valueFormat: "yyyy-MM-dd HH:mm",
            // 表单新增时是否禁止
            addDisabled: false,
            // 表单新增时是否可见
            addDisplay: false,
            // 表单新增时是否为查看模式
            addDetail: false,
            // 表单编辑时是否禁止
            editDisabled: false,
            // 表单编辑时是否可见
            editDisplay: true,
            // 表单编辑时是否为查看模式
            editDetail: false,
            width: 120,
          },
          // {
          //   label: "考试结束时间",
          //   prop: "endTime",
          //   type: "datetime",
          //   // span: 24,
          //   format: "yyyy-MM-dd HH:mm:ss",
          //   valueFormat: "yyyy-MM-dd HH:mm:ss",
          //   label: "申请人",
          //   prop: "realName",
          //   slot: true,
          //   // 表单新增时是否禁止
          //   addDisabled: false,
          //   addDisabled: true,
          //   // 表单新增时是否可见
          //   addDisplay: false,
          //   // 表单新增时是否为查看模式
          //   addDetail: false,
          //   // 表单编辑时是否禁止
          //   editDisabled: false,
          //   editDisabled: true,
          //   // 表单编辑时是否可见
          //   editDisplay: false,
          //   // 表单编辑时是否为查看模式
          //   editDetail: false,
          //   width: 160,
          //   // hide: true,
          //   display: false,
          //   width: 70,
          // },
          {
            label: "创建人",
            prop: "creator",
            label: "申请人所属学校",
            prop: "deptName",
            slot: true,
            // 表单新增时是否禁止
            addDisabled: true,
@@ -325,8 +354,9 @@
            editDisplay: false,
            // 表单编辑时是否为查看模式
            editDetail: false,
            hide: true,
            // hide: true,
            display: false,
            overHidden: true,
          },
          {
            label: "备注",
@@ -343,13 +373,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,
@@ -362,16 +413,36 @@
            // 表单编辑时是否禁止
            editDisabled: false,
            // 表单编辑时是否可见
            editDisplay: true,
            editDisplay: false,
            // 表单编辑时是否为查看模式
            editDetail: false,
            width: 150,
            width: 70,
          },
          {
            label: "考试人数",
            prop: "examNum",
            type: "textarea",
            span: 24,
            slot: true,
            // 表单新增时是否禁止
            addDisabled: false,
            // 表单新增时是否可见
            addDisplay: true,
            // 表单新增时是否为查看模式
            addDetail: false,
            // 表单编辑时是否禁止
            editDisabled: false,
            // 表单编辑时是否可见
            editDisplay: false,
            // 表单编辑时是否为查看模式
            editDetail: false,
            width: 70,
          },
          {
            label: "申请时间",
            prop: "createTime",
            prop: "creatorDate",
            type: "datetime",
            width: 160,
            width: 130,
            editDisplay: false,
            addDisplay: false,
            format: "yyyy-MM-dd HH:mm:ss",
@@ -388,7 +459,7 @@
            label: "审核时间",
            prop: "auditTime",
            type: "datetime",
            width: 160,
            width: 130,
            editDisplay: false,
            addDisplay: false,
            format: "yyyy-MM-dd HH:mm:ss",
@@ -431,12 +502,64 @@
                value: 3,
              },
            ],
            width: 110,
          },
          {
            label: "审核明细",
            editDisplay: false,
            addDisplay: false,
            prop: "auditDetail",
            width: 90,
            overHidden: true,
          },
          {
            label: "距考试开始时间",
            editDisplay: false,
            addDisplay: false,
            prop: "deadline",
            width: 110,
            overHidden: true,
          },
          {
            label: "考试名单确认人",
            prop: "confirmUserName",
            slot: true,
            // 表单新增时是否禁止
            addDisabled: true,
            // 表单新增时是否可见
            addDisplay: false,
            // 表单新增时是否为查看模式
            addDetail: false,
            // 表单编辑时是否禁止
            editDisabled: true,
            // 表单编辑时是否可见
            editDisplay: false,
            // 表单编辑时是否为查看模式
            editDetail: false,
            // hide: true,
            display: false,
            width: 80,
          },
          {
            label: "确认时间",
            prop: "confirmTime",
            type: "datetime",
            // span: 24,
            format: "yyyy-MM-dd HH:mm:ss",
            valueFormat: "yyyy-MM-dd HH:mm:ss",
            // 表单新增时是否禁止
            addDisabled: false,
            // 表单新增时是否可见
            addDisplay: false,
            // 表单新增时是否为查看模式
            addDetail: false,
            // 表单编辑时是否禁止
            editDisabled: false,
            // 表单编辑时是否可见
            editDisplay: false,
            // 表单编辑时是否为查看模式
            editDetail: false,
            width: 130,
          },
        ],
      },
@@ -447,6 +570,7 @@
        pageSize: 10,
        currentPage: 1,
        total: 16,
        ...this.$store.state.control.changePageSize,
      },
      questionBankQuery: {},
      questionBankSelectionList: [],
@@ -465,7 +589,7 @@
    permissionList() {
      return {
        addBtn: this.vaildData(null, false),
        viewBtn: this.vaildData(null, false),
        viewBtn: this.vaildData(this.permission.trainExam_edit, false),
        delBtn: this.vaildData(null, false),
        editBtn: this.vaildData(null, false),
      };
@@ -476,6 +600,10 @@
    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,
@@ -546,7 +674,7 @@
        });
      }
    },
    examScoreViews(row){
    examScoreViews(row) {
      //模拟考试
      if (row.examType == 2) {
        this.$router.push({
@@ -558,7 +686,7 @@
    // 新增
    questionBankRowSave(row, done, loading) {
      row.startTime = row.startTime + ":00";
       row['examType'] = 2;
      row["examType"] = 2;
      // row.endTime = row.examTime[1];
      // row.examTime = JSON.stringify(row.examTime);
      add(row).then(
@@ -580,10 +708,16 @@
      // if (Array.isArray(row.examTime) != true) {
      //   row.examTime = row.examTime.split(",");
      // }
      row.startTime = row.startTime + ":00";
      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(row).then(
      update(data).then(
        () => {
          this.questionBankOnLoad(this.questionBankPage);
          this.$message({
@@ -606,6 +740,24 @@
      })
        .then(() => {
          return remove(row.id);
        })
        .then(() => {
          this.questionBankOnLoad(this.questionBankPage);
          this.$message({
            type: "success",
            message: "操作成功!",
          });
        });
    },
    handleConfirm(row) {
      this.$confirm("已确认当前考试申请人员名单无误?", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      })
        .then(() => {
          row["confirmUser"] = this.userInfo.Id;
          return applyConfirm(row);
        })
        .then(() => {
          this.questionBankOnLoad(this.questionBankPage);
@@ -646,4 +798,49 @@
</script>
<style lang="scss" scoped>
.dtype {
  width: 100%;
  padding-left: 0px;
}
.dx {
  position: absolute;
  top: 50%;
  margin-top: -5px;
  margin-left: 6px;
  width: 10px;
  height: 10px;
  border-radius: 30%;
  background: #dfdfdf;
}
.zc {
  position: absolute;
  top: 50%;
  margin-top: -5px;
  margin-left: 4px;
  width: 10px;
  height: 10px;
  border-radius: 30%;
  background: #29c093;
}
.yj {
  position: absolute;
  top: 50%;
  margin-top: -5px;
  margin-left: 4px;
  width: 10px;
  height: 10px;
  border-radius: 30%;
  background: #f34a4a;
}
.gz {
  position: absolute;
  top: 50%;
  margin-top: -5px;
  margin-left: 4px;
  width: 10px;
  height: 10px;
  border-radius: 30%;
  background: #f48f57;
}
</style>