From c4e67a8942e514b65ab41bb19781d50576c15725 Mon Sep 17 00:00:00 2001
From: liuyg <376836862@qq.com>
Date: Fri, 24 Sep 2021 19:56:52 +0800
Subject: [PATCH] 用户
---
src/views/applyexam/index.vue | 612 ++++++++++++++++++++++++++++++++++++++++++++----------
1 files changed, 493 insertions(+), 119 deletions(-)
diff --git a/src/views/applyexam/index.vue b/src/views/applyexam/index.vue
index c7c9488..bf9a8f8 100644
--- a/src/views/applyexam/index.vue
+++ b/src/views/applyexam/index.vue
@@ -57,13 +57,36 @@
@click="questionBankHandleDelete">删 除
</el-button>
</template> -->
+ <!-- 自定义按钮 -->
+ <template slot="menuLeft">
+ <el-button
+ type="primary"
+ size="small"
+ plain
+ icon="el-icon-folder-checked"
+ @click="handleBatchExam"
+ 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>
<template slot-scope="{ type, row }" slot="menu">
<el-button
:type="type"
size="small"
icon="el-icon-refresh-left"
- :disabled="row.applyStatus == 4"
+ v-if="permission.applyexam_cancel"
+ :disabled="row.isApply == 2"
@click="handleCancel(row)"
>取消报名
</el-button>
@@ -80,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>
@@ -102,6 +129,41 @@
@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>
+ </el-dialog>
+
+ <el-dialog
+ title="考试生成"
+ append-to-body
+ :visible.sync="dialogExamFormVisible"
+ width="900px"
+ @close="closeDialog"
+ >
+ <avue-form
+ ref="formExamApply"
+ v-model="examApply"
+ :option="optionExamApply"
+ @reset-change="emptytChange"
+ @submit="submitExamApply"
+ ></avue-form>
+ </el-dialog>
</div>
</el-card>
</el-col>
@@ -112,11 +174,13 @@
import {
getApplyList,
addApply,
- updateApply,
+ cancelApply,
remove,
+ addExam,
} from "@/api/examapi/applyexam";
import { mapState } from "vuex";
-
+import { mapGetters } from "vuex";
+import { getRoleDetail } from "@/api/system/role";
var DIC = {
applyStatus: [
{
@@ -134,7 +198,37 @@
data() {
return {
dialogFormVisible: false,
+ dialogExamFormVisible: false,
+ examPersission: false,
+ applyExport: false,
+ excelBox: false,
Audit: {},
+ excelForm: {},
+ excelOption: {
+ submitBtn: false,
+ emptyBtn: false,
+ column: [
+ {
+ label: "模板上传",
+ prop: "excelFile",
+ type: "upload",
+ drag: true,
+ loadText: "模板上传中,请稍等",
+ span: 24,
+ propsHttp: {
+ res: "data",
+ },
+ tip: "请上传 .xls,.xlsx 标准格式文件",
+ action: "/api/apply/import-apply",
+ },
+ {
+ label: "模板下载",
+ prop: "excelTemplate",
+ formslot: true,
+ span: 24,
+ },
+ ],
+ },
optionAudit: {
height: "auto",
calcHeight: 30,
@@ -142,7 +236,7 @@
tip: false,
searchShow: true,
searchMenuSpan: 6,
- border: false,
+ border: true, //liu
index: true,
stripe: true,
viewBtn: true,
@@ -188,16 +282,157 @@
},
],
},
+ optionExamApply: {
+ height: "auto",
+ filterBtn: true,
+ calcHeight: 30,
+ dialogWidth: 950,
+ tip: false,
+ searchShow: true,
+ searchMenuSpan: 6,
+ border: true, //liu
+ index: true,
+ stripe: true,
+ viewBtn: true,
+ selection: true,
+ excelBtn: false,
+ menuWidth: 380,
+ dialogClickModal: false,
+ column: [
+ {
+ label: "考试人数",
+ prop: "number",
+ type: 'number',
+ span: 12,
+ precision:0,
+ step:50,
+ mock:{
+ type:'number',
+ max:1000,
+ min:0,
+ precision:0
+ },
+ rules: [
+ {
+ required: true,
+ message: "请输入考试人数",
+ trigger: "blur",
+ },
+ ],
+ minRows: 0,
+ maxRows: 1000,
+ value:50,
+ },
+ {
+ label: "序号开始",
+ prop: "serialStart",
+ span: 6,
+ value:1,
+ mock:{
+ type:'number',
+ max:1000,
+ min:1,
+ precision:0
+ },
+ minRows: 1,
+ maxRows: 1000,
+ type:"number",
+ rules: [
+ {
+ required: true,
+ message: "请输入序号",
+ trigger: "blur",
+ },
+ ],
+ },
+ {
+ label: "序号结束",
+ prop: "serialEnd",
+ span: 6,
+ value:50,
+ mock:{
+ type:'number',
+ max:1000,
+ min:1,
+ precision:0
+ },
+ minRows: 1,
+ maxRows: 1000,
+ type:"number",
+ rules: [
+ {
+ required: true,
+ message: "请输入序号",
+ trigger: "blur",
+ },
+ ],
+ },
+ {
+ label: "考试时间",
+ prop: "startTime",
+ type: "datetime",
+ format: "yyyy-MM-dd HH:mm",
+ valueFormat: "yyyy-MM-dd HH:mm",
+ // 表单新增时是否禁止
+ addDisabled: false,
+ // 表单新增时是否可见
+ addDisplay: true,
+ // 表单新增时是否为查看模式
+ addDetail: false,
+ // 表单编辑时是否禁止
+ editDisabled: false,
+ // 表单编辑时是否可见
+ editDisplay: true,
+ // 表单编辑时是否为查看模式
+ editDetail: false,
+ rules: [
+ {
+ required: true,
+ message: "请选择考试时间",
+ trigger: "blur",
+ },
+ ],
+ span: 12,
+ },
+ {
+ label: "截止时间",
+ prop: "endTime",
+ type: "datetime",
+ format: "yyyy-MM-dd HH:mm",
+ valueFormat: "yyyy-MM-dd HH:mm",
+ // 表单新增时是否禁止
+ addDisabled: false,
+ // 表单新增时是否可见
+ addDisplay: true,
+ // 表单新增时是否为查看模式
+ addDetail: false,
+ // 表单编辑时是否禁止
+ editDisabled: false,
+ // 表单编辑时是否可见
+ editDisplay: true,
+ // 表单编辑时是否为查看模式
+ editDetail: false,
+ rules: [
+ {
+ required: true,
+ message: "请选择考试时间",
+ trigger: "blur",
+ },
+ ],
+ span: 12,
+ },
+ ],
+ },
questionBankOption: {
// 操作栏多余按钮去除
delBtn: false,
editBtn: false,
- addBtn: true,
- selection: true,
+ addBtn: false,
+ selection: false,
menu: true,
// 导出按钮
// excelBtn: true,
- viewBtn: false,
+ viewBtn: true,
// title: '题库',
@@ -214,7 +449,7 @@
//tree 默认展开
defaultExpandAll: true,
// 操作栏宽度
- menuWidth: 200,
+ menuWidth: 250,
column: [
{
@@ -222,7 +457,6 @@
prop: "userId",
type: "tree",
dicUrl: "",
- search: true,
hide: true,
slot: true,
searchSpan: 4,
@@ -234,8 +468,10 @@
addDetail: false,
// 表单编辑时是否禁止
editDisabled: true,
+ viewDisabled: false,
// 表单编辑时是否可见
editDisplay: true,
+ viewDisplay: false,
// 表单编辑时是否为查看模式
editDetail: false,
props: {
@@ -253,7 +489,9 @@
},
{
label: "保安姓名",
- prop: "name",
+ prop: "realName",
+ searchSpan: 4,
+ search: true,
// 表单新增时是否禁止
addDisabled: false,
// 表单新增时是否可见
@@ -280,43 +518,61 @@
],
},
{
- 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",
search: true,
slot: true,
- searchSpan: 4,
+ searchSpan: 6,
// 表单新增时是否禁止
addDisabled: false,
// 表单新增时是否可见
@@ -473,81 +729,104 @@
width: 150,
},
- {
- label: "考试时间",
- prop: "examTime",
- 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: true,
- // 表单编辑时是否为查看模式
- editDetail: false,
- width: 150,
- },
- {
- label: "报名状态",
- prop: "applyStatus",
- slot: true,
- searchSpan: 4,
- // 表单新增时是否禁止
- addDisabled: false,
- // 表单新增时是否可见
- addDisplay: false,
- // 表单新增时是否为查看模式
- addDetail: false,
- // 表单编辑时是否禁止
- editDisabled: false,
- // 表单编辑时是否可见
- editDisplay: true,
- // 表单编辑时是否为查看模式
- editDetail: false,
- dicData: DIC.applyStatus,
- 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: "考试时间",
+ // prop: "examTime",
+ // 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: true,
+ // // 表单编辑时是否为查看模式
+ // editDetail: false,
+ // width: 150,
+ // },
+
+ // {
+ // 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",
+ // },
+ // ],
+ // 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,
+ // },
+ // {
+ // label: "报名状态",
+ // search: true,
+ // type: "select",
+ // searchSpan: 4,
+ // prop: "applyStatus",
+ // searchValue: 2,
+ // dicData: [{
+ // label: '全部',
+ // value: 0,
// },
// {
- // label: '审核通过',
- // value: "2"
+ // label: '已报名',
+ // value: 2,
// },
// {
- // label: '审核不通过',
- // value: "3"
+ // label: '已取消',
+ // value: 4,
// }
- // ],
- // search:true,
- // type:"select"
+ // ],
+ // props: {
+ // label: "label",
+ // value: "value"
+ // },
+ // editDisplay: false,
+ // addDisplay: false,
+ // width: 100,
// },
],
},
@@ -592,19 +871,25 @@
console.log(this.userInfo);
if (this.userInfo.role_name.indexOf("ksxtadmin") != -1) {
- this.questionBankOption.column[0].dicUrl =
- "/api/blade-system/dept/lazy-tree-user?parentId=";
- } else {
- this.questionBankOption.column[0].dicUrl =
- "/api/blade-system/dept/lazy-tree-user?parentId=" +
- this.userInfo.dept_id;
+ this.examPersission = true;
}
+
+ this.questionBankSearch['applyStatus'] = 2;
},
mounted() {},
computed: {
...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) => {
@@ -624,18 +909,36 @@
});
},
questionBankOnLoad(page, params = {}) {
+ params = this.questionBankSearch;
this.questionBankLoading = false;
- getApplyList(
- page.currentPage,
- page.pageSize,
- Object.assign(params, this.questionBankQuery)
- ).then((res) => {
- const data = res.data.data;
- this.questionBankPage.total = data.total;
- this.questionBankData = data.records;
- this.questionBankLoading = false;
- this.questionBankSelectionClear();
- });
+ this.loading = true;
+ //判断角色,如果是保安公司管理员或保安,只能查看当前公司的报名信息
+ var that = this;
+ //获取当前登录人员的角色信息
+ var roleIds = this.userInfo.role_id.split(",");
+ roleIds.forEach((roleId) => {
+ getRoleDetail(roleId).then((res) => {
+ var roleAlias = res.data.data.roleAlias;
+ if (
+ roleAlias == "保安公司管理员" ||
+ roleAlias == "保安"
+ ) {
+ //如果是保安公司管理员
+ params["deptId"] = that.userInfo.dept_id;
+ }
+ getApplyList(
+ page.currentPage,
+ page.pageSize,
+ Object.assign(params, this.questionBankQuery)
+ ).then((res) => {
+ const data = res.data.data;
+ this.questionBankPage.total = data.total;
+ this.questionBankData = data.records;
+ this.questionBankLoading = false;
+ this.questionBankSelectionClear();
+ });
+ })
+ })
},
questionBankSelectionClear() {
this.questionBankSelectionList = [];
@@ -696,6 +999,59 @@
);
},
+ //生成考试弹窗
+ handleBatchExam() {
+ this.dialogExamFormVisible = true;
+ if (this.questionBankSelectionList.length === 0) {
+ this.ids = "";
+ }
+ },
+ //生成考试
+ submitExamApply(row, done, loading) {
+ var that = this;
+ row.startTime = row.startTime + ":00";
+ row.endTime = row.endTime + ":00";
+ if(row.number!=((row.serialEnd-row.serialStart)+1)){
+ this.$message({
+ type: "error",
+ message: "考试人数与序号不匹配!",
+ });
+ done();
+ return;
+ }
+
+ var s = new Date(row.startTime);
+ var e = new Date(row.endTime);
+ if(s>e){
+ this.$message({
+ type: "error",
+ message: "截止时间不能早于考试考试开始时间!",
+ });
+ done();
+ return;
+ }
+ addExam(Object.assign(row, this.questionBankSearch)).then(
+ () => {
+ this.questionBankOnLoad(this.questionBankPage);
+ this.$message({
+ type: "success",
+ message: "操作成功!",
+ });
+ that.$refs.formExamApply.resetFields();
+ that.dialogExamFormVisible = false;
+ done();
+ },
+ (error) => {
+ window.console.log(error);
+ loading();
+ }
+ );
+ },
+ //关闭窗口清除数据
+ closeDialog() {
+ this.$refs.formExamApply.resetFields();
+ },
+
questionBankRowDel(row) {
this.$confirm("确定将选择数据删除?", {
confirmButtonText: "确定",
@@ -723,7 +1079,7 @@
})
.then(() => {
row.applyStatus = 4;
- return updateApply(row);
+ return cancelApply(row);
})
.then(() => {
this.questionBankOnLoad(this.questionBankPage);
@@ -760,6 +1116,24 @@
this.dialogFormVisible = true;
this.Audit = row;
},
+
+ handleImport() {
+ this.excelBox = true;
+ },
+
+ handleTemplate() {
+ window.open(`/api/apply/export-template`);
+ },
+ uploadAfter(res, done, loading, column) {
+ window.console.log(column);
+ this.excelBox = false;
+ this.refreshChange();
+ done();
+ },
+
+ refreshChange() {
+ this.questionBankOnLoad(this.page, this.query);
+ },
},
};
</script>
--
Gitblit v1.9.3