| | |
| | | /* |
| | | * @Author: Morpheus |
| | | * @Date: 2021-07-05 16:31:54 |
| | | * @Last Modified by: Morpheus |
| | | * @Last Modified time: 2021-07-18 17:09:52 |
| | | * 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"> |
| | | <avue-crud |
| | | v-model="form" |
| | | class="company-box" |
| | | :option="questionBankOption" |
| | | :search.sync="questionBankSearch" |
| | | :table-loading="questionBankLoading" |
| | | :data="questionBankData" |
| | | 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" |
| | |
| | | </el-button> |
| | | </template> --> |
| | | |
| | | <template slot="menuLeft"> |
| | | <el-button |
| | | type="danger" |
| | | size="small" |
| | | icon="el-icon-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" |
| | | @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> |
| | | import { getList, add, remove, update } from "@/api/examapi/examination"; |
| | | |
| | | import { mapGetters } from "vuex"; |
| | | export default { |
| | | data() { |
| | | var validatePass = (rule, value, callback) => { |
| | |
| | | form: {}, |
| | | questionBankOption: { |
| | | // 操作栏多余按钮去除 |
| | | delBtn: true, |
| | | editBtn: true, |
| | | addBtn: true, |
| | | delBtn: false, |
| | | editBtn: false, |
| | | addBtn: false, |
| | | selection: true, |
| | | menu: true, |
| | | // 导出按钮 |
| | | excelBtn: false, |
| | | viewBtn: true, |
| | | viewBtn: false, |
| | | |
| | | // title: '题库', |
| | | |
| | |
| | | menuWidth: 280, |
| | | |
| | | labelWidth: 140, |
| | | |
| | | ...this.$store.state.control.clearOtherBut, |
| | | ...this.$store.state.control.searchOpen, |
| | | column: [ |
| | | { |
| | | label: "考试名称", |
| | |
| | | { |
| | | required: true, |
| | | message: "请输入试卷名称", |
| | | trigger: "blur", |
| | | }, |
| | | ], |
| | | trigger: "blur" |
| | | } |
| | | ] |
| | | }, |
| | | // { |
| | | // label: "试卷分数", |
| | |
| | | // rules: [{ validator: validatePass, required: true, trigger: 'blur' }], |
| | | // width: 100 |
| | | // }, |
| | | // { |
| | | // label: "考试时间", |
| | | // prop: "examTime", |
| | | // type: "daterange", |
| | | // // span: 24, |
| | | // format: "yyyy-MM-dd HH:mm:ss", |
| | | // valueFormat: "yyyy-MM-dd HH:mm:ss", |
| | | // startPlaceholder: "考试开始时间", |
| | | // endPlaceholder: "考试结束时间", |
| | | // // 表单新增时是否禁止 |
| | | // addDisabled: false, |
| | | // // 表单新增时是否可见 |
| | | // addDisplay: true, |
| | | // // 表单新增时是否为查看模式 |
| | | // addDetail: false, |
| | | // // 表单编辑时是否禁止 |
| | | // editDisabled: false, |
| | | // // 表单编辑时是否可见 |
| | | // editDisplay: true, |
| | | // // 表单编辑时是否为查看模式 |
| | | // editDetail: false, |
| | | // // display: false, |
| | | // hide: true, |
| | | // rules: [ |
| | | // { |
| | | // required: true, |
| | | // message: "请选择考试时间", |
| | | // trigger: "blur", |
| | | // }, |
| | | // ], |
| | | // width: 250, |
| | | // }, |
| | | { |
| | | 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", |
| | | // 表单新增时是否禁止 |
| | | addDisabled: false, |
| | | // 表单新增时是否可见 |
| | |
| | | editDisplay: true, |
| | | // 表单编辑时是否为查看模式 |
| | | editDetail: false, |
| | | // display: false, |
| | | hide: true, |
| | | rules: [ |
| | | { |
| | | required: true, |
| | | message: "请选择考试时间", |
| | | trigger: "blur", |
| | | }, |
| | | ], |
| | | width: 250, |
| | | trigger: "blur" |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | label: "考试开始时间", |
| | | prop: "startTime", |
| | | 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: 180, |
| | | }, |
| | | { |
| | | label: "考试结束时间", |
| | | prop: "endTime", |
| | | 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: 180, |
| | | }, |
| | | // { |
| | | // label: "考试结束时间", |
| | | // prop: "endTime", |
| | | // 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: 180, |
| | | // }, |
| | | { |
| | | label: "创建人", |
| | | prop: "creator", |
| | |
| | | // 表单编辑时是否为查看模式 |
| | | editDetail: false, |
| | | hide: true, |
| | | display: false, |
| | | display: false |
| | | }, |
| | | { |
| | | label: "备注", |
| | |
| | | // 表单编辑时是否可见 |
| | | editDisplay: true, |
| | | // 表单编辑时是否为查看模式 |
| | | editDetail: false, |
| | | editDetail: false |
| | | }, |
| | | { |
| | | label: "注意事项", |
| | |
| | | editDisplay: true, |
| | | // 表单编辑时是否为查看模式 |
| | | editDetail: false, |
| | | width: 240, |
| | | }, |
| | | ], |
| | | width: 240 |
| | | } |
| | | ] |
| | | }, |
| | | questionBankSearch: {}, |
| | | questionBankLoading: true, |
| | |
| | | pageSize: 10, |
| | | currentPage: 1, |
| | | total: 16, |
| | | ...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(","); |
| | | }, |
| | | ...mapGetters(["userInfo", "permission"]), |
| | | permissionList() { |
| | | return { |
| | | 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) |
| | | }; |
| | | } |
| | | }, |
| | | watch: {}, |
| | | methods: { |
| | | questionBankOnLoad(page, params = {}) { |
| | | this.questionBankLoading = false; |
| | | params['examType'] = 1; |
| | | params["examType"] = 1; |
| | | getList( |
| | | 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(); |
| | | }); |
| | | }, |
| | |
| | | if (row.examType == 1) { |
| | | this.$router.push({ |
| | | path: `/applydetailed`, |
| | | query: row, |
| | | query: row |
| | | }); |
| | | } |
| | | |
| | |
| | | if (row.examType == 2) { |
| | | this.$router.push({ |
| | | path: `/trainApply`, |
| | | query: row, |
| | | 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"] = 1; |
| | | // row.endTime = row.examTime[1]; |
| | | // row.examTime = JSON.stringify(row.examTime); |
| | | add(row).then( |
| | | () => { |
| | | this.questionBankOnLoad(this.questionBankPage); |
| | | this.$message({ |
| | | type: "success", |
| | | message: "操作成功!", |
| | | message: "操作成功!" |
| | | }); |
| | | done(); |
| | | }, |
| | | (error) => { |
| | | error => { |
| | | window.console.log(error); |
| | | loading(); |
| | | } |
| | | ); |
| | | }, |
| | | 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); |
| | | // if (Array.isArray(row.examTime) != true) { |
| | | // row.examTime = row.examTime.split(","); |
| | | // } |
| | | row.startTime = row.startTime + ":00"; |
| | | // row.endTime = row.examTime[1]; |
| | | // row.examTime = JSON.stringify(row.examTime); |
| | | update(row).then( |
| | | () => { |
| | | this.questionBankOnLoad(this.questionBankPage); |
| | | this.$message({ |
| | | type: "success", |
| | | message: "操作成功!", |
| | | message: "操作成功!" |
| | | }); |
| | | done(); |
| | | }, |
| | | (error) => { |
| | | error => { |
| | | window.console.log(error); |
| | | loading(); |
| | | } |
| | |
| | | this.$confirm("确定将选择数据删除?", { |
| | | confirmButtonText: "确定", |
| | | cancelButtonText: "取消", |
| | | type: "warning", |
| | | type: "warning" |
| | | }) |
| | | .then(() => { |
| | | return remove(row.id); |
| | |
| | | this.questionBankOnLoad(this.questionBankPage); |
| | | this.$message({ |
| | | type: "success", |
| | | message: "操作成功!", |
| | | message: "操作成功!" |
| | | }); |
| | | }); |
| | | }, |
| | |
| | | this.$confirm("确定将选择数据删除?", { |
| | | confirmButtonText: "确定", |
| | | cancelButtonText: "取消", |
| | | type: "warning", |
| | | type: "warning" |
| | | }) |
| | | .then(() => { |
| | | return remove(this.ids); |
| | |
| | | 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> |