Administrator
2021-08-05 d6a7b12ae982494c8f45008e14cf95125ee9b9db
题库导入实现
3 files modified
83 ■■■■ changed files
src/styles/element-ui.scss 6 ●●●● patch | view | raw | blame | history
src/views/exam/addsubject.vue 8 ●●●● patch | view | raw | blame | history
src/views/exam/subject.vue 69 ●●●● patch | view | raw | blame | history
src/styles/element-ui.scss
@@ -20,7 +20,7 @@
}
.el-menu--display,
.el-menu--display .el-submenu__icon-arrow {
.el-menu--display+.el-submenu__icon-arrow {
    display: none;
}
@@ -160,8 +160,8 @@
}
.morpheus-box .el-card.is-never-shadow.avue-crud__search {
    width: calc(100% - 490px) !important;
    left: 320px !important;
    width: calc(100% - 590px) !important;
    left: 420px !important;
}
.morpheus-box-exam .el-card.is-never-shadow.avue-crud__search {
src/views/exam/addsubject.vue
@@ -70,7 +70,7 @@
      choicesType:"0",
      loading: true,
      form:{
        score:2
        score:1
      },
      option: {
        height: "auto",
@@ -91,6 +91,7 @@
            label: "题目名称",
            prop: "subjectName",
            search: true,
            type:"textarea",
            rules: [
              {
                required: true,
@@ -241,7 +242,7 @@
        
      },
      formCheckbox:{
        score:2
        score:1
      },
      optionCheckbox: {
        height: "auto",
@@ -262,6 +263,7 @@
            label: "题目名称",
            prop: "subjectName",
            search: true,
            type:"textarea",
            rules: [
              {
                required: true,
@@ -433,6 +435,7 @@
            label: "题目名称",
            prop: "subjectName",
            search: true,
            type:"textarea",
            rules: [
              {
                required: true,
@@ -556,6 +559,7 @@
          {
            label: "题目名称",
            prop: "subjectName",
            type:"textarea",
            search: true,
            rules: [
              {
src/views/exam/subject.vue
@@ -34,14 +34,14 @@
                                       icon="el-icon-plus"
                                       @click="questionBankHandleAdd">新 增
                            </el-button>
                            <!-- <el-button
                            <el-button
                                type="success"
                                size="small"
                                plain
                                icon="el-icon-upload2"
                                @click="handleImport"
                                >导入
                            </el-button> -->
                                >题库导入
                            </el-button>
                            <el-button type="danger"
                                       size="small"
                                       icon="el-icon-delete"
@@ -65,7 +65,7 @@
                    </avue-crud>
                    <el-dialog
                        title="题目导入"
                        title="题库导入"
                        append-to-body
                        :visible.sync="excelBox"
                        width="555px"
@@ -106,21 +106,44 @@
    },
    data () {
        return {
            excelBox:false,
            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/examSubjectChoices/import-examSubject",
                },
                {
                    label: "模板下载",
                    prop: "excelTemplate",
                    formslot: true,
                    span: 24,
                },
                ],
            },
            questionBankOption: {
                // 操作栏多余按钮去除
                delBtn: false,
                editBtn: false,
                addBtn: false,
                selection: true,
                menu: true,
                // 导出按钮
                excelBtn: true,
                excelBtnText: '题库导出',
                // title: '题库',
                align: 'center',
                height: 'auto',
                calcHeight: 80,
@@ -134,11 +157,11 @@
                dialogClickModal: false,
                // 操作栏宽度
                menuWidth: 226,
                column: [
                    {
                        label: "题目名称",
                        prop: "subjectName",
                        search: true,
                        slot: true,
                    },
@@ -311,6 +334,34 @@
                    this.$refs.questionBankCrud.toggleSelection();
                });
        },
        //导出数据
        handleExport() {
            this.$confirm("是否导出清册数据?", "提示", {
                confirmButtonText: "确定",
                cancelButtonText: "取消",
                type: "warning",
            }).then(() => {
                window.open(`/api/apply/export-apply?examId=${this.$route.query.id}`);
            });
        },
        handleImport() {
            this.excelBox = true;
        },
        handleTemplate() {
            window.open(
                `/api/examSubjectChoices/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>