src/views/exam/startexam.vue
@@ -1,42 +1,35 @@
/*
 * @Author: Morpheus
 * @Date: 2021-07-05 16:31:54
 * @Last Modified by: liu
 * @Last Modified time: 2021-11-23 14:16:42
 * menu-name 考试管理
 */
/* * @Author: Morpheus * @Date: 2021-07-05 16:31:54 * @Last Modified by: liu *
@Last Modified time: 2021-11-23 14:16:42 * menu-name 考试管理 */
<template>
  <el-row class="morpheus-box-paper">
    <el-col :span="24">
      <el-card>
        <div
          :class="[
            'exam-card-body',
            $store.state.control.windowWidth >= 1024 ? 'oneRowSearch' : '',
          ]"
        >
          <avue-crud
            v-model="form"
            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-save="questionBankRowSave"
            @row-update="questionBankRowUpdate"
            @row-del="questionBankRowDel"
          >
            <!-- 自定义按钮 -->
            <!-- <template slot="menuLeft">
  <basic-container
    :class="[
      'exam-card-body',
      $store.state.control.screenSize == 1366 ? 'smallSize' : 'normalSize',
      $store.state.control.windowWidth >= 1024 ? 'tooRowSearch1' : ''
    ]"
  >
    <avue-crud
      v-model="form"
      class="company-box tablesss"
      :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-save="questionBankRowSave"
      @row-update="questionBankRowUpdate"
      @row-del="questionBankRowDel"
    >
      <!-- 自定义按钮 -->
      <!-- <template slot="menuLeft">
                            <el-button type="danger"
                                       size="mini"
                                       icon="el-icon-delete"
@@ -57,38 +50,35 @@
                            </el-button>
                        </template> -->
            <template slot="menuLeft">
              <el-button
                style="display: none"
                type="danger"
                size="small"
                icon="el-icon-delete"
                v-if="permission.startexam_delete"
                @click="questionBankHandleDelete"
                >删 除
              </el-button>
            </template>
      <template slot="menuLeft">
        <el-button
          style="display: none"
          type="danger"
          size="small"
          icon="el-icon-delete"
          v-if="permission.startexam_delete"
          @click="questionBankHandleDelete"
          >删 除
        </el-button>
      </template>
            <template slot-scope="{ row }" slot="examStatus">
              <el-tag>{{ row.examStatus == 0 ? "已发布" : "草稿" }}</el-tag>
            </template>
      <template slot-scope="{ row }" slot="examStatus">
        <el-tag>{{ row.examStatus == 0 ? "已发布" : "草稿" }}</el-tag>
      </template>
            <template slot-scope="{ row }" slot="menu">
              <el-button
                type="text"
                size="mini"
                icon="el-icon-collection"
                class="start-kaoshi"
                v-if="permission.startexam_applyPapers"
                @click="startExam(row)"
                >报名清册
              </el-button>
            </template>
          </avue-crud>
        </div>
      </el-card>
    </el-col>
  </el-row>
      <template slot-scope="{ row }" slot="menu">
        <el-button
          type="text"
          size="mini"
          icon="el-icon-collection"
          class="start-kaoshi"
          v-if="permission.startexam_applyPapers"
          @click="startExam(row)"
          >报名清册
        </el-button>
      </template>
    </avue-crud>
  </basic-container>
</template>
<script>
@@ -140,6 +130,7 @@
        labelWidth: 140,
        ...this.$store.state.control.clearOtherBut,
        ...this.$store.state.control.searchOpen,
        column: [
          {
            label: "考试名称",
@@ -163,9 +154,9 @@
              {
                required: true,
                message: "请输入试卷名称",
                trigger: "blur",
              },
            ],
                trigger: "blur"
              }
            ]
          },
          // {
          //     label: "试卷分数",
@@ -241,9 +232,9 @@
              {
                required: true,
                message: "请选择考试时间",
                trigger: "blur",
              },
            ],
                trigger: "blur"
              }
            ]
          },
          // {
          //   label: "考试结束时间",
@@ -283,7 +274,7 @@
            // 表单编辑时是否为查看模式
            editDetail: false,
            hide: true,
            display: false,
            display: false
          },
          {
            label: "备注",
@@ -301,7 +292,7 @@
            // 表单编辑时是否可见
            editDisplay: true,
            // 表单编辑时是否为查看模式
            editDetail: false,
            editDetail: false
          },
          {
            label: "注意事项",
@@ -321,9 +312,9 @@
            editDisplay: true,
            // 表单编辑时是否为查看模式
            editDetail: false,
            width: 240,
          },
        ],
            width: 240
          }
        ]
      },
      questionBankSearch: {},
      questionBankLoading: true,
@@ -332,18 +323,20 @@
        pageSize: 10,
        currentPage: 1,
        total: 16,
        ...this.$store.state.control.changePageSize,
        ...this.$store.state.control.changePageSize
      },
      questionBankQuery: {},
      questionBankSelectionList: [],
      questionBankSelectionList: []
    };
  },
  created() {},
  mounted() {},
  mounted() {
    this.$store.commit("setWindowSizeHeightAdd");
  },
  computed: {
    ids() {
      let ids = [];
      this.questionBankSelectionList.forEach((ele) => {
      this.questionBankSelectionList.forEach(ele => {
        ids.push(ele.id);
      });
      return ids.join(",");
@@ -354,9 +347,9 @@
        addBtn: this.vaildData(this.permission.startexam_add, false),
        viewBtn: this.vaildData(this.permission.startexam_view, false),
        delBtn: this.vaildData(this.permission.startexam_delete, false),
        editBtn: this.vaildData(this.permission.startexam_edit, false),
        editBtn: this.vaildData(this.permission.startexam_edit, false)
      };
    },
    }
  },
  watch: {},
  methods: {
@@ -367,11 +360,12 @@
        page.currentPage,
        page.pageSize,
        Object.assign(params, this.questionBankQuery)
      ).then((res) => {
      ).then(res => {
        const data = res.data.data;
        this.questionBankPage.total = data.total;
        this.questionBankData = data.records;
        this.questionBankLoading = false;
        this.$store.commit("setWindowSizeHeightAdd");
        this.questionBankSelectionClear();
      });
    },
@@ -404,7 +398,7 @@
      if (row.examType == 1) {
        this.$router.push({
          path: `/applydetailed`,
          query: row,
          query: row
        });
      }
@@ -412,7 +406,7 @@
      if (row.examType == 2) {
        this.$router.push({
          path: `/trainApply`,
          query: row,
          query: row
        });
      }
    },
@@ -427,11 +421,11 @@
          this.questionBankOnLoad(this.questionBankPage);
          this.$message({
            type: "success",
            message: "操作成功!",
            message: "操作成功!"
          });
          done();
        },
        (error) => {
        error => {
          window.console.log(error);
          loading();
        }
@@ -449,11 +443,11 @@
          this.questionBankOnLoad(this.questionBankPage);
          this.$message({
            type: "success",
            message: "操作成功!",
            message: "操作成功!"
          });
          done();
        },
        (error) => {
        error => {
          window.console.log(error);
          loading();
        }
@@ -463,7 +457,7 @@
      this.$confirm("确定将选择数据删除?", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
        type: "warning"
      })
        .then(() => {
          return remove(row.id);
@@ -472,7 +466,7 @@
          this.questionBankOnLoad(this.questionBankPage);
          this.$message({
            type: "success",
            message: "操作成功!",
            message: "操作成功!"
          });
        });
    },
@@ -484,7 +478,7 @@
      this.$confirm("确定将选择数据删除?", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
        type: "warning"
      })
        .then(() => {
          return remove(this.ids);
@@ -493,14 +487,13 @@
          this.questionBankOnLoad(this.questionBankPage);
          this.$message({
            type: "success",
            message: "操作成功!",
            message: "操作成功!"
          });
          this.$refs.questionBankCrud.toggleSelection();
        });
    },
  },
    }
  }
};
</script>
<style lang="scss" scoped>
</style>
<style lang="scss" scoped></style>