liuyg
2021-08-03 05150461ca543e3eff7f869a24f4813e47bd4d8c
src/views/applyexam/index.vue
@@ -50,19 +50,28 @@
                            </el-button>
                        </template> -->
                        <template slot="menuLeft">
                        <!-- <template slot="menuLeft">
                            <el-button type="danger"
                                       size="small"
                                       icon="el-icon-delete"
                                       @click="questionBankHandleDelete">删 除
                            </el-button>
                        </template>
                        </template> -->
                        <template slot-scope="{ type,row }" slot="menu">
                            <el-button
                            :type="type"
                            size="small"
                            icon="el-icon-refresh-left"
                            :disabled="row.applyStatus==4"
                            @click="handleCancel(row)"
                            >取消报名
                            </el-button>
                            <el-button
                            :type="type"
                            size="small"
                            icon="el-icon-receiving"
                            :disabled="row.applyStatus==4"
                            @click="handlePrint(row)"
                            >准考证打印
                            </el-button>
@@ -82,10 +91,21 @@
import {
    getApplyList,
    addApply,
    updateApply,
    remove
} from "@/api/examapi/applyexam";
import { mapState } from 'vuex'
var DIC = {
    applyStatus: [{
        label: '已报名',
        value: 2
    }, {
        label: '已取消',
        value: 4
    }]
}
@@ -93,18 +113,15 @@
    data () {
        return {
            obj: {
                name: '张三',
            },
            questionBankOption: {
                // 操作栏多余按钮去除
                delBtn: true,
                delBtn: false,
                editBtn: false,
                addBtn: true,
                selection: true,
                menu: true,
                // 导出按钮
                excelBtn: true,
                // excelBtn: true,
                viewBtn: false,
                // title: '题库',
@@ -119,16 +136,19 @@
                indexLabel: '序号',
                //dialogType: 'drawer',
                dialogClickModal: false,
                //tree 默认展开
                defaultExpandAll:true,
                // 操作栏宽度
                menuWidth: 200,
                column: [
                    {
                        label: "保安姓名",
                        prop: "name",
                        prop: "userId",
                        type: 'tree',
                        dicUrl: '',
                        search: true,
                        hide:true,
                        slot: true,
                        // 表单新增时是否禁止
                        addDisabled: false,
@@ -153,7 +173,33 @@
                        }]
                    },
                    {
                        label: "试卷名称",
                        label: "保安姓名",
                        prop: "name",
                        // 表单新增时是否禁止
                        addDisabled: false,
                        // 表单新增时是否可见
                        addDisplay: false,
                        // 表单新增时是否为查看模式
                        addDetail: false,
                        // 表单编辑时是否禁止
                        editDisabled: false,
                        // 表单编辑时是否可见
                        editDisplay: false,
                        // 表单编辑时是否为查看模式
                        editDetail: false,
                        viewDisplay:true,
                        props: {
                            label: "title",
                            value: "id",
                        },
                        rules: [{
                            required: true,
                            message: "请选择保安姓名",
                            trigger: "blur"
                        }]
                    },
                    {
                        label: "考试名称",
                        prop: "examName",
                        type: 'tree',
                        dicUrl: '/api/exampaper/page-tree',
@@ -226,7 +272,8 @@
                            required: true,
                            message: "请选择准考证号",
                            trigger: "blur"
                        }]
                        }],
                        width: 100
                    },
                    {
                        label: "身份证号",
@@ -300,7 +347,7 @@
                        // 表单新增时是否禁止
                        addDisabled: true,
                        // 表单新增时是否可见
                        addDisplay: true,
                        addDisplay: false,
                        // 表单新增时是否为查看模式
                        addDetail: false,
                        // 表单编辑时是否禁止
@@ -321,7 +368,7 @@
                                            ? "0" + new Date().getSeconds()
                                            : new Date().getSeconds())),
                        width: 180
                        width: 160
                    },
                    {
                        label: "考试时间",
@@ -342,8 +389,27 @@
                        editDisplay: true,
                        // 表单编辑时是否为查看模式
                        editDetail: false,
                        width: 180
                    }
                        width: 160
                    },{
                        label: "报名状态",
                        prop: "applyStatus",
                        slot: true,
                        // 表单新增时是否禁止
                        addDisabled: false,
                        // 表单新增时是否可见
                        addDisplay: false,
                        // 表单新增时是否为查看模式
                        addDetail: false,
                        // 表单编辑时是否禁止
                        editDisabled: false,
                        // 表单编辑时是否可见
                        editDisplay: true,
                        // 表单编辑时是否为查看模式
                        editDetail: false,
                        dicData:DIC.applyStatus,
                        search:true,
                        type:"select"
                    },
                ]
            },
            questionBankSearch: {},
@@ -461,8 +527,8 @@
        // 新增
        questionBankRowSave (row, done, loading) {
            addApply({ userId: row.name, examId: row.examName, applyTime: row.applyTime }).then(() => {
            // debugger;
            addApply({ userId: row.userId, examId: row.examName, applyTime: row.applyTime }).then(() => {
                this.questionBankOnLoad(this.questionBankPage);
                this.$message({
                    type: "success",
@@ -493,6 +559,26 @@
                });
        },
        //取消报名
        handleCancel(row){
            this.$confirm("确定取消报名?", {
                confirmButtonText: "确定",
                cancelButtonText: "取消",
                type: "warning"
            })
                .then(() => {
                    row.applyStatus = 4;
                    return updateApply(row);
                })
                .then(() => {
                    this.questionBankOnLoad(this.questionBankPage);
                    this.$message({
                        type: "success",
                        message: "操作成功!"
                    });
                });
        },
        questionBankHandleDelete () {
            if (this.questionBankSelectionList.length === 0) {
                this.$message.warning("请选择至少一条数据");