From bf0d17303691e7c2483e7cfa325a7ef3d8a7b322 Mon Sep 17 00:00:00 2001
From: liuyg <376836862@qq.com>
Date: Fri, 06 Aug 2021 16:17:34 +0800
Subject: [PATCH] Merge branch 'master' of http://192.168.0.105:10010/r/zhba_enterprises

---
 src/views/exam/subject.vue |  121 ++++++++++++++++++++++++++++++++++++++--
 1 files changed, 114 insertions(+), 7 deletions(-)

diff --git a/src/views/exam/subject.vue b/src/views/exam/subject.vue
index 22c054e..e228337 100644
--- a/src/views/exam/subject.vue
+++ b/src/views/exam/subject.vue
@@ -6,6 +6,7 @@
  * menu-name 题库查询
  */
 <template>
+    <div>
     <el-row class="morpheus-box">
         <el-col :span="24">
             <el-card>
@@ -28,6 +29,19 @@
                                @row-del="questionBankHandleDel">
 
                         <template slot="menuLeft">
+                            <el-button type="primary"
+                                       size="small"
+                                       icon="el-icon-plus"
+                                       @click="questionBankHandleAdd">新 增
+                            </el-button>
+                            <el-button
+                                type="success"
+                                size="small"
+                                plain
+                                icon="el-icon-upload2"
+                                @click="handleImport"
+                                >题库导入
+                            </el-button>
                             <el-button type="danger"
                                        size="small"
                                        icon="el-icon-delete"
@@ -35,13 +49,47 @@
                             </el-button>
                         </template>
 
+                        <template slot-scope="{row}" slot="menu">
+                            <el-button type="text"
+                                       size="mini"
+                                       icon="el-icon-edit"
+                                       @click="questionBankHandleAdd(row)">编辑
+                            </el-button>
+                            <el-button type="text"
+                                       size="mini"
+                                       icon="el-icon-delete"
+                                       @click="questionBankHandleDel(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>
 
             </el-card>
         </el-col>
     </el-row>
+    <addsubject ref="addsubject"></addsubject>
+</div>
 </template>
 
 <script>
@@ -50,25 +98,52 @@
     remove,
 } from "@/api/examapi/subject";
 
+import addsubject from "./addsubject.vue";
 
 export default {
+    components:{
+        addsubject
+    },
     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: true,
-
+                delBtn: false,
                 editBtn: false,
-
                 addBtn: false,
-
                 selection: true,
                 menu: true,
                 // 导出按钮
                 excelBtn: true,
                 excelBtnText: '题库导出',
                 // title: '题库',
-
                 align: 'center',
                 height: 'auto',
                 calcHeight: 80,
@@ -82,11 +157,11 @@
                 dialogClickModal: false,
                 // 操作栏宽度
                 menuWidth: 226,
-
                 column: [
                     {
                         label: "题目名称",
                         prop: "subjectName",
+                        
                         search: true,
                         slot: true,
                     },
@@ -104,6 +179,9 @@
                         }, {
                             label: '判断题',
                             value: 2,
+                        }, {
+                            label: '实操题',
+                            value: 3,
                         }],
                         slot: true,
                         width: 96,
@@ -178,6 +256,9 @@
         },
     },
     methods: {
+        questionBankHandleAdd(row){
+            this.$refs.addsubject.inits(row.id);
+        },
         questionBankOnLoad (page, params = {}) {
             this.questionBankLoading = false;
             getList(page.currentPage, page.pageSize, Object.assign(params, this.query)).then(res => {
@@ -254,7 +335,33 @@
                 });
         },
 
-
+        //导出数据
+        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>

--
Gitblit v1.9.3