liuyg
2021-08-04 746bdcb49d537de9f1654bc365c3f12bbeaa54a0
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">
@@ -38,6 +38,14 @@
                                @click="handleExport"
                                >导出
                            </el-button>
                            <el-button
                                type="success"
                                size="small"
                                plain
                                icon="el-icon-upload2"
                                @click="handleImport"
                                >导入
                            </el-button>
                        </template>
                        <template slot-scope="{ type,row }" slot="menu">
@@ -52,6 +60,25 @@
                        </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>
@@ -82,6 +109,7 @@
    data () {
        return {
            excelBox: false,
            questionBankOption: {
                // 操作栏多余按钮去除
                delBtn: false,
@@ -239,7 +267,8 @@
                            required: true,
                            message: "请选择准考证号",
                            trigger: "blur"
                        }]
                        }],
                        width:100,
                    },
                    {
                        label: "身份证号",
@@ -390,6 +419,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",
                },
                {
                    label: "模板下载",
                    prop: "excelTemplate",
                    formslot: true,
                    span: 24,
                },
                ],
            },
        }
    },
@@ -576,6 +631,23 @@
                window.open(`/api/trainingRegistration/export-apply?examId=${this.$route.query.id}`);
            });
        },
        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>