liuyg
2021-09-27 8c6cf205affbbc8ada74f00a7ca25ebca867e9ed
src/views/trainApply/index.vue
@@ -6,7 +6,7 @@
 * menu-name 报名考试
 */
<template>
    <el-row class="morpheus-box-apply-exam">
    <el-row class="morpheus-box-apply-exam-1">
        <el-col :span="24" class="hasButOne">
            <el-card>
                <div class="exam-card-body">
@@ -31,12 +31,29 @@
                        <!-- 自定义按钮 -->
                        <template slot="menuLeft">
                            <el-button
                                style="display:none"
                                type="warning"
                                size="small"
                                plain
                                icon="el-icon-download"
                                @click="handleExport"
                                >导出
                            </el-button>
                            <el-button
                                type="warning"
                                size="small"
                                plain
                                icon="el-icon-receiving"
                                @click="handleExport"
                                >清册打印
                            </el-button>
                            <el-button
                                type="success"
                                size="small"
                                plain
                                icon="el-icon-download"
                                @click="handleImport"
                                >清册导入
                            </el-button>
                        </template>
@@ -45,12 +62,48 @@
                            :type="type"
                            size="small"
                            icon="el-icon-receiving"
                            :disabled="row.candidateNo=='' || row.cancel==2"
                            @click="handlePrint(row)"
                            >准考证打印
                            </el-button>
                            <el-button
                            :type="type"
                            size="small"
                            icon="el-icon-refresh-left"
                            :disabled="row.cancel==2  || row.isExam==2  || row.isExam==3"
                            @click="revoke(row)"
                            >取消报名
                            </el-button>
                            <el-button
                            :type="type"
                            size="small"
                            icon="el-icon-circle-check"
                            :disabled="row.auditStatus==1"
                            @click="auditSucess(row)"
                            >审核通过
                            </el-button>
                        </template>
                    </avue-crud>
                     <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>
                </div>
@@ -61,20 +114,27 @@
<script>
import {getdata,adddata,remove} from "@/api/trainingRegistration/trainingRegistration";
import {getdata,adddata,  cancelTrainAudit,auditSucess,remove} from "@/api/trainingRegistration/trainingRegistration";
import { mapState } from 'vuex'
var DIC = {
    cancel: [{
        label: '已报名',
        value: 1
    }, {
        label: '已取消',
        value: 2
    }]
}
export default {
    data () {
        var examId = this.$route.query.id;
        return {
            obj: {
                name: '张三',
            },
            excelBox: false,
            questionBankOption: {
                // 操作栏多余按钮去除
                delBtn: false,
@@ -104,10 +164,11 @@
                column: [
                    {
                        label: "保安姓名",
                        prop: "realName",
                        prop: "userId",
                        type: 'tree',
                        dicUrl: '',
                        search: true,
                        hide:true,
                        slot: true,
                        // 表单新增时是否禁止
                        addDisabled: false,
@@ -121,6 +182,33 @@
                        editDisplay: true,
                        // 表单编辑时是否为查看模式
                        editDetail: false,
                        props: {
                            label: "title",
                            value: "id",
                        },
                        rules: [{
                            required: true,
                            message: "请选择保安姓名",
                            trigger: "blur"
                        }]
                    },
                    {
                        label: "保安姓名",
                        prop: "realName",
                        // 表单新增时是否禁止
                        addDisabled: false,
                        // 表单新增时是否可见
                        addDisplay: false,
                        search: true,
                        // 表单新增时是否为查看模式
                        addDetail: false,
                        // 表单编辑时是否禁止
                        editDisabled: false,
                        // 表单编辑时是否可见
                        editDisplay: false,
                        // 表单编辑时是否为查看模式
                        editDetail: false,
                        viewDisplay:true,
                        props: {
                            label: "title",
                            value: "id",
@@ -186,6 +274,24 @@
                        width: 220
                    },
                    {
                        label: "报名状态",
                        prop: "cancel",
                        type:"select",
                        search:true,
                        hide:true,
                        searchSpan:4,
                        searchValue:1,
                        dicData:[
                            {
                                label: '已报名',
                                value: 1
                            }, {
                                label: '已取消',
                                value: 2
                            }
                        ]
                    },
                    {
                        label: "准考证号",
                        prop: "candidateNo",
                        slot: true,
@@ -205,7 +311,8 @@
                            required: true,
                            message: "请选择准考证号",
                            trigger: "blur"
                        }]
                        }],
                        width:100,
                    },
                    {
                        label: "身份证号",
@@ -300,7 +407,7 @@
                                            ? "0" + new Date().getSeconds()
                                            : new Date().getSeconds())),
                        width: 180
                        width: 150
                    },
                    {
                        label: "考试时间",
@@ -321,8 +428,65 @@
                        editDisplay: true,
                        // 表单编辑时是否为查看模式
                        editDetail: false,
                        width: 180
                    }
                        width: 150
                    },
                    {
                        label: "审核状态",
                        search: true,
                        searchLabelWidth: 110,
                        type: "select",
                        searchSpan: 4,
                        prop: "auditStatus",
                        searchValue: 4,
                        dicData: [{
                                label: '全部',
                                value: 0,
                            },
                            {
                                label: '审核通过',
                                value: 1,
                            },
                            {
                                label: '审核不通过',
                                value: 2,
                            },
                            {
                                label: '已提交审核',
                                value: 3,
                            },
                            {
                                label: '未提交审核',
                                value: 4,
                            }
                        ],
                        props: {
                            label: "label",
                            value: "value"
                        },
                        editDisplay: false,
                        addDisplay: false,
                        width: 100,
                    },
                    // {
                    //     label: "报名状态",
                    //     prop: "cancel",
                    //     slot: true,
                    //     // 表单新增时是否禁止
                    //     addDisabled: false,
                    //     // 表单新增时是否可见
                    //     addDisplay: false,
                    //     // 表单新增时是否为查看模式
                    //     addDetail: false,
                    //     // 表单编辑时是否禁止
                    //     editDisabled: false,
                    //     // 表单编辑时是否可见
                    //     editDisplay: true,
                    //     // 表单编辑时是否为查看模式
                    //     editDetail: false,
                    //     dicData:DIC.cancel,
                    //     search:true,
                    //     type:"select"
                    // },
                ]
            },
            questionBankSearch: {},
@@ -337,6 +501,32 @@
            },
            questionBankQuery: {},
            questionBankSelectionList: [],
            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/trainingRegistration/import-trainingRegistration?examId="+examId,
                },
                {
                    label: "模板下载",
                    prop: "excelTemplate",
                    formslot: true,
                    span: 24,
                },
                ],
            },
        }
    },
@@ -375,11 +565,8 @@
        this.questionBankOption.column[0].dicUrl = "/api/blade-system/dept/lazy-tree-user?parentId=" + this.userInfo.dept_id
      }
      this.questionBankSearch['cancel'] = 1;
      this.questionBankSearch['auditStatus'] = 0;
    },
    mounted() {
        var flag = false,
@@ -421,7 +608,7 @@
            });
        },
        questionBankOnLoad (page, params = {}) {
            // debugger;
            params = this.questionBankSearch;
            params['examId'] = this.$route.query.id;
            this.questionBankLoading = false;
            getdata(page.currentPage, page.pageSize, Object.assign(params, this.questionBankQuery)).then(res => {
@@ -454,6 +641,54 @@
        },
        questionBankSizeChange (pageSize) {
            this.questionBankPage.pageSize = pageSize;
        },
        //取消报名
        revoke(row, done, loading) {
            this.$confirm("确定取消报名?", {
                confirmButtonText: "确定",
                cancelButtonText: "取消",
                type: "warning",
            }).then(() => {
                row.cancel = 2;
                cancelTrainAudit(row).then(
                () => {
                    this.onLoad(this.page);
                    this.$message({
                    type: "success",
                    message: "取消报名成功!",
                    });
                    done();
                },
                (error) => {
                    window.console.log(error);
                    loading();
                }
                );
            });
        },
        //审核通过
        auditSucess(row, done, loading) {
            this.$confirm("确定审核通过?", {
                confirmButtonText: "确定",
                cancelButtonText: "取消",
                type: "warning",
            }).then(() => {
                row.cancel = 1;
                auditSucess(row).then(
                () => {
                    this.onLoad(this.page);
                    this.$message({
                    type: "success",
                    message: "操作成功!",
                    });
                    done();
                },
                (error) => {
                    window.console.log(error);
                    loading();
                }
                );
            });
        },
        // 新增
@@ -512,16 +747,43 @@
                    this.$refs.questionBankCrud.toggleSelection();
                });
        },
        //清册生成
        handleExport() {
            var obj ={};
            obj["name"] = "报名清册信息";
            obj["examId"] = this.$route.query.id;
            this.$router.push({
                path: `/applydetailed/papers`,
                query: obj,
            });
        },
        //导出数据
        handleExport() {
            this.$confirm("是否导出清册数据?", "提示", {
                confirmButtonText: "确定",
                cancelButtonText: "取消",
                type: "warning",
            }).then(() => {
                window.open(`/api/trainingRegistration/export-apply?examId=${this.$route.query.id}`);
            });
        // handleExport() {
        //     this.$confirm("是否导出清册数据?", "提示", {
        //         confirmButtonText: "确定",
        //         cancelButtonText: "取消",
        //         type: "warning",
        //     }).then(() => {
        //         window.open(`/api/trainingRegistration/export-apply?examId=${this.$route.query.id}`);
        //     });
        // },
        handleImport() {
            this.excelBox = true;
        },
        handleTemplate() {
            window.open(
                `/api/trainingRegistration/export-template`
            );
        },
        uploadAfter(res, done, loading, column) {
            window.console.log(column);
            this.excelBox = false;
            this.refreshChange();
            done();
        },
        refreshChange() {
            this.questionBankOnLoad(this.page, this.query);
        },
    }
}