From 79d9fc857559982b00b68b2d709807bdc4cd286f Mon Sep 17 00:00:00 2001
From: Administrator <admin>
Date: Mon, 11 Apr 2022 10:58:17 +0800
Subject: [PATCH] minio 地址修改

---
 src/views/exam/subject.vue |  292 ++++++++++++++++++++++++++++++++--------------------------
 1 files changed, 160 insertions(+), 132 deletions(-)

diff --git a/src/views/exam/subject.vue b/src/views/exam/subject.vue
index 69aadae..7e992a7 100644
--- a/src/views/exam/subject.vue
+++ b/src/views/exam/subject.vue
@@ -1,109 +1,110 @@
-/*
- * @Author: Morpheus
- * @Date: 2021-07-05 16:31:54
- * @Last Modified by: Morpheus
- * @Last Modified time: 2021-07-18 16:04:26
- * menu-name 题库查询
- */
+/* * @Author: Morpheus * @Date: 2021-07-05 16:31:54 * @Last Modified by: liu *
+@Last Modified time: 2021-11-23 14:14:38 * menu-name 题库查询 */
 <template>
-  <div>
-    <el-row class="morpheus-box">
-      <el-col :span="24">
-        <el-card>
-          <div class="exam-card-body">
-            <avue-crud
-              class="company-box"
-              :option="questionBankOption"
-              :search.sync="questionBankSearch"
-              :table-loading="questionBankLoading"
-              :data="questionBankData"
-              ref="questionBankCrud"
-              :page.sync="questionBankPage"
-              @on-load="questionBankOnLoad"
-              @selection-change="questionBankSelectionChange"
-              @search-change="questionBankSearchChange"
-              @search-reset="questionBankSearchReset"
-              @current-change="questionBankCurrentChange"
-              @size-change="questionBankSizeChange"
-              @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"
-                  @click="questionBankHandleDelete"
-                  >删 除
-                </el-button>
-              </template>
+  <basic-container
+    :class="[
+      'exam-card-body',
+      $store.state.control.screenSize == 1366 ? 'smallSize' : 'normalSize',
+      $store.state.control.windowWidth >= 1024 ? 'tooRowSearch1' : ''
+    ]"
+  >
+    <avue-crud
+      class="company-box tablesss"
+      :option="questionBankOption"
+      :search.sync="questionBankSearch"
+      :table-loading="questionBankLoading"
+      :data="questionBankData"
+      ref="questionBankCrud"
+      :permission="permissionList"
+      :page.sync="questionBankPage"
+      @on-load="questionBankOnLoad"
+      @selection-change="questionBankSelectionChange"
+      @search-change="questionBankSearchChange"
+      @search-reset="questionBankSearchReset"
+      @current-change="questionBankCurrentChange"
+      @size-change="questionBankSizeChange"
+      @row-del="questionBankHandleDel"
+    >
+      <template slot="menuLeft">
+        <el-button
+          type="primary"
+          size="small"
+          icon="el-icon-plus"
+          v-if="permission.subject_add"
+          @click="questionBankHandleAdd"
+          >新 增
+        </el-button>
+        <el-button
+          type="success"
+          size="small"
+          plain
+          icon="el-icon-upload2"
+          v-if="permission.subject_import"
+          @click="handleImport"
+          >题库导入
+        </el-button>
+        <el-button
+          type="danger"
+          size="small"
+          icon="el-icon-delete"
+          v-if="permission.subject_delete"
+          @click="questionBankHandleDelete"
+          >删 除
+        </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>
+      <template slot-scope="{ row }" slot="menu">
+        <el-button
+          type="text"
+          size="mini"
+          icon="el-icon-edit"
+          v-if="permission.subject_edit"
+          @click="questionBankHandleAdd(row)"
+          >编辑
+        </el-button>
+        <el-button
+          type="text"
+          size="mini"
+          icon="el-icon-delete"
+          v-if="permission.subject_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>
+    <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>
+    <addsubject ref="addsubject" v-on:refreshPage="refreshPage"></addsubject>
+  </basic-container>
 </template>
 
 <script>
 import { getList, remove } from "@/api/examapi/subject";
 
 import addsubject from "./addsubject.vue";
-
+import { mapGetters, mapState } from "vuex";
+import Qs from "qs";
+import { getToken } from "@/util/auth";
 export default {
   components: {
-    addsubject,
+    addsubject
   },
   data() {
     return {
@@ -121,18 +122,18 @@
             loadText: "模板上传中,请稍等",
             span: 24,
             propsHttp: {
-              res: "data",
+              res: "data"
             },
             tip: "请上传 .xls,.xlsx 标准格式文件",
-            action: "/api/examSubjectChoices/import-examSubject",
+            action: "/api/examSubjectChoices/import-examSubject"
           },
           {
             label: "模板下载",
             prop: "excelTemplate",
             formslot: true,
-            span: 24,
-          },
-        ],
+            span: 24
+          }
+        ]
       },
       questionBankOption: {
         // 操作栏多余按钮去除
@@ -158,13 +159,15 @@
         dialogClickModal: false,
         // 操作栏宽度
         menuWidth: 226,
+        ...this.$store.state.control.clearOtherBut,
+        ...this.$store.state.control.searchOpen,
         column: [
           {
             label: "题目名称",
             prop: "subjectName",
             searchSpan: 4,
             search: true,
-            slot: true,
+            slot: true
           },
           {
             label: "题目类型",
@@ -175,61 +178,61 @@
             dicData: [
               {
                 label: "单选题",
-                value: 0,
+                value: 0
               },
               {
                 label: "多选题",
-                value: 1,
+                value: 1
               },
               {
                 label: "判断题",
-                value: 2,
+                value: 2
               },
               {
                 label: "实操题",
-                value: 3,
-              },
+                value: 3
+              }
             ],
             slot: true,
-            width: 96,
+            width: 96
           },
           {
             label: "题目分值",
             prop: "score",
             slot: true,
-            width: 96,
+            width: 96
           },
           {
             label: "参考答案",
             prop: "answer",
             slot: true,
-            width: 96,
+            width: 96
           },
           {
             label: "创建人",
             prop: "creator",
             slot: true,
-            width: 96,
+            width: 96
           },
           {
             label: "创建时间",
             prop: "createDate",
             slot: true,
-            width: 130,
+            width: 130
           },
           {
             label: "修改人",
             prop: "modifier",
             slot: true,
-            width: 96,
+            width: 96
           },
           {
             label: "修改时间",
             prop: "modifyDate",
             slot: true,
-            width: 130,
-          },
-        ],
+            width: 130
+          }
+        ]
       },
       questionBankSearch: {},
       questionBankLoading: true,
@@ -238,37 +241,55 @@
         pageSize: 10,
         currentPage: 1,
         total: 16,
+        ...this.$store.state.control.changePageSize
       },
       questionBankQuery: {},
-      questionBankSelectionList: [],
+      questionBankSelectionList: []
     };
   },
-  created() {},
-  mounted() {},
+  mounted() {
+    this.$store.commit("setWindowSizeHeightAdd");
+  },
   computed: {
+    ...mapGetters(["userInfo", "permission"]),
+    permissionList() {
+      return {
+        addBtn: this.vaildData(this.permission.subject_add, false),
+        viewBtn: this.vaildData(this.permission.subject_view, false),
+        delBtn: this.vaildData(this.permission.subject_delete, false),
+        editBtn: this.vaildData(this.permission.subject_edit, false),
+        excelBtn: this.vaildData(this.permission.subject_report, false)
+      };
+    },
     ids() {
       let ids = [];
-      this.questionBankSelectionList.forEach((ele) => {
+      this.questionBankSelectionList.forEach(ele => {
         ids.push(ele.id);
       });
       return ids.join(",");
-    },
+    }
   },
   methods: {
+    //触发页面刷新
+    refreshPage() {
+      this.questionBankOnLoad(this.questionBankPage);
+    },
     questionBankHandleAdd(row) {
       this.$refs.addsubject.inits(row.id);
     },
     questionBankOnLoad(page, params = {}) {
+      params = this.questionBankSearch;
       this.questionBankLoading = false;
       getList(
         page.currentPage,
         page.pageSize,
         Object.assign(params, this.query)
-      ).then((res) => {
+      ).then(res => {
         const data = res.data.data;
         this.questionBankPage.total = data.total;
         this.questionBankData = data.records;
         this.questionBankLoading = false;
+        this.$store.commit("setWindowSizeHeightAdd");
         this.questionBankSelectionClear();
       });
     },
@@ -300,7 +321,7 @@
       this.$confirm("确定将选择数据删除?", {
         confirmButtonText: "确定",
         cancelButtonText: "取消",
-        type: "warning",
+        type: "warning"
       })
         .then(() => {
           return remove(row.id);
@@ -309,7 +330,7 @@
           this.questionBankOnLoad(this.questionBankPage);
           this.$message({
             type: "success",
-            message: "操作成功!",
+            message: "操作成功!"
           });
         });
     },
@@ -322,7 +343,7 @@
       this.$confirm("确定将选择数据删除?", {
         confirmButtonText: "确定",
         cancelButtonText: "取消",
-        type: "warning",
+        type: "warning"
       })
         .then(() => {
           return remove(this.ids);
@@ -331,7 +352,7 @@
           this.questionBankOnLoad(this.questionBankPage);
           this.$message({
             type: "success",
-            message: "操作成功!",
+            message: "操作成功!"
           });
           this.$refs.questionBankCrud.toggleSelection();
         });
@@ -342,16 +363,24 @@
       this.$confirm("是否导出清册数据?", "提示", {
         confirmButtonText: "确定",
         cancelButtonText: "取消",
-        type: "warning",
+        type: "warning"
       }).then(() => {
-        window.open(`/api/apply/export-apply?examId=${this.$route.query.id}`);
+        window.open(
+          `/api/apply/export-apply?examId=${this.$route.query.id}&${
+            this.website.tokenHeader
+          }=${getToken()}`
+        );
       });
     },
     handleImport() {
       this.excelBox = true;
     },
     handleTemplate() {
-      window.open(`/api/examSubjectChoices/export-template`);
+      window.open(
+        `/api/examSubjectChoices/export-template?${
+          this.website.tokenHeader
+        }=${getToken()}`
+      );
     },
     uploadAfter(res, done, loading, column) {
       window.console.log(column);
@@ -361,10 +390,9 @@
     },
     refreshChange() {
       this.questionBankOnLoad(this.page, this.query);
-    },
-  },
+    }
+  }
 };
 </script>
 
-<style lang="scss" scoped>
-</style>
+<style lang="scss" scoped></style>

--
Gitblit v1.9.3