Tang 3 سال پیش
والد
کامیت
5f9bbd8ed7

+ 8 - 6
src/store/modules/tagsView.js

@@ -176,13 +176,15 @@ const actions = {
         })
       }
       if (state.alertPage.includes(view.name)) {
-        MessageBox.confirm('当前正在编辑内容,确认是否退出?', '提示', {
-          confirmButtonText: '确认',
-          cancelButtonText: '取消',
-          type: 'warning'
-        }).then(() => {
+        MessageBox.alert('<p style="color:red;">请检测清楚是否保存页面内容,再关闭页面,避免数据丢失!</p>', '当前正在编辑内容!', {
+          dangerouslyUseHTMLString: true,
+          confirmButtonText: '确认关闭',
+          cancelButtonText: '暂不关闭',
+          iconClass:"el-icon-warning",
+          showCancelButton: true,
+        }).then(res => {
           func()
-        }).catch(() => { });
+        }).catch(() => { })
       } else {
         func()
       }

+ 62 - 2
src/views/resource/bankManagement/testPaperManagement/addPaper/topicAddPaper/index.vue

@@ -7,14 +7,20 @@
     <div>
       <table-list
         :tableSets="tableSet"
-        :tableData="tableData"
+        :tableData="computedData(tableData)"
         :navText="navText"
         @addClick="openActiveBox"
         :loading="loading"
         @editInfo="editInfo"
         @emitData="emitData"
+        ref="tableList"
       >
         <template slot="customize">
+          <el-input
+            placeholder="请输入题目内容"
+            v-model="keyValue"
+            style="margin-right: 10px"
+          ></el-input>
           <el-button
             size="medium"
             @click="$refs.wordpop.dialogDRword = true"
@@ -22,6 +28,8 @@
             >Word批量导入</el-button
           ><el-button size="medium" @click="openExcel" type="success"
             >Excel批量导入</el-button
+          ><el-button size="medium" @click="delAll" type="danger"
+            >批量删除</el-button
           >
         </template>
         <template slot="btn" slot-scope="props">
@@ -681,6 +689,7 @@ export default {
   },
   data() {
     return {
+      keyValue: "",
       dialogDRword: false,
       disabledBtn: false,
       dialogDRexcel: false,
@@ -779,7 +788,7 @@ export default {
         ch: "条",
         num: false,
         border: true,
-        choice: false,
+        choice: true,
         addHide: false,
         dontNum: true,
         backFatherBtn: {
@@ -954,6 +963,19 @@ export default {
       });
       return num;
     },
+    computedData: function () {
+      return function (data) {
+        var arr = [];
+        if (this.keyValue) {
+          arr = data.filter((item) => {
+            return item.content.search(this.keyValue) !== -1;
+          });
+        } else {
+          arr = data;
+        }
+        return arr;
+      };
+    },
   },
   watch: {
     djTime: {
@@ -1049,6 +1071,39 @@ export default {
         );
       }, 1500);
     },
+    /**
+     * 批量删除
+     */
+    delAll() {
+      if (this.$refs.tableList.allCheckData.length) {
+        this.$confirm(
+          `此操作将删除已选中的${this.$refs.tableList.allCheckData.length}条题目, 是否继续?`,
+          "提示",
+          {
+            confirmButtonText: "确定",
+            cancelButtonText: "取消",
+            type: "warning",
+          }
+        )
+          .then(() => {
+            const dataIndedx = this.$refs.tableList.allCheckData.map((item) => {
+              return item.index;
+            });
+            this.tableData = this.tableData.filter((item) => {
+              return !dataIndedx.includes(item.index);
+            });
+            this.$refs.tableList.clearMoreActive()
+            this.$message({
+              type: "success",
+              message: "删除成功!",
+            });
+          })
+          .catch(() => {});
+      } else {
+        this.$message.warning("请勾选需要删除的题目");
+        return;
+      }
+    },
     getInfos() {
       this.$api.obtainbankexam(this.$route.query.id).then((res) => {
         this.businObj = {
@@ -1105,6 +1160,11 @@ export default {
             return item.index === v.index;
           });
           this.tableData.splice(index, 1);
+          if(this.$refs.tableList.allCheckData.length){
+            this.$refs.tableList.allCheckData = this.$refs.tableList.allCheckData.filter(item => {
+              return item.index !== v.index
+            })
+          }
         })
         .catch(() => {
           this.$message({

+ 4 - 3
src/views/resource/bankManagement/testPaperManagement/editPaper/baseEditPaper/index.vue

@@ -431,9 +431,10 @@ export default {
               .dispatch("tagsView/exitView", this.$route)
               .then((res) => {
                 if (this.$store.getters.testPaperPage) {
-                  this.$router.push({
-                    path: this.$store.getters.testPaperPage.name,
-                  });
+                  // this.$router.push({
+                  //   path: this.$store.getters.testPaperPage.name,
+                  // });
+                  return
                 } else {
                   this.$router.push({
                     path: "testPaperManagement",

+ 69 - 5
src/views/resource/bankManagement/testPaperManagement/editPaper/topicEditPaper/index.vue

@@ -3,13 +3,19 @@
     <div>
       <table-list
         :tableSets="tableSet"
-        :tableData="tableData"
+        :tableData="computedData(tableData)"
         :navText="navText"
         @addClick="openActiveBox"
         :loading="loading"
         @emitData="emitData"
+        ref="tableList"
       >
         <template slot="customize">
+          <el-input
+            placeholder="请输入题目内容"
+            v-model="keyValue"
+            style="margin-right: 10px"
+          ></el-input>
           <el-button
             size="medium"
             @click="$refs.wordpop.dialogDRword = true"
@@ -17,6 +23,8 @@
             >Word批量导入</el-button
           ><el-button size="medium" @click="openExcel" type="success"
             >Excel批量导入</el-button
+          ><el-button size="medium" @click="delAll" type="danger"
+            >批量删除</el-button
           >
         </template>
         <template slot="btn" slot-scope="props">
@@ -684,6 +692,7 @@ export default {
   },
   data() {
     return {
+      keyValue: "",
       dialogDRword: false,
       disabledBtn: false,
       dialogDRexcel: false,
@@ -742,7 +751,7 @@ export default {
           prop: "type",
           hidden: true,
           scope: "topic",
-          width:"140px"
+          width: "140px",
         },
         {
           label: "标题前缀",
@@ -770,7 +779,7 @@ export default {
           prop: "publishStatus",
           hidden: true,
           scope: "fabStatus",
-          width:"140px"
+          width: "140px",
         },
       ],
       tableData: [],
@@ -781,7 +790,7 @@ export default {
         ch: "条",
         num: false,
         border: true,
-        choice: false,
+        choice: true,
         addHide: false,
         dontNum: true,
         backFatherBtn: {
@@ -963,6 +972,19 @@ export default {
       });
       return num;
     },
+    computedData: function () {
+      return function (data) {
+        var arr = [];
+        if (this.keyValue) {
+          arr = data.filter((item) => {
+            return item.content.search(this.keyValue) !== -1;
+          });
+        } else {
+          arr = data;
+        }
+        return arr;
+      };
+    },
   },
   watch: {
     djTime: {
@@ -1113,6 +1135,42 @@ export default {
       });
     },
     // --------------------------分割线---------------------------
+    editInfo(v) {
+      this.addClick(v, 0);
+    },
+    /**
+     * 批量删除
+     */
+    delAll() {
+      if (this.$refs.tableList.allCheckData.length) {
+        this.$confirm(
+          `此操作将删除已选中的${this.$refs.tableList.allCheckData.length}条题目, 是否继续?`,
+          "提示",
+          {
+            confirmButtonText: "确定",
+            cancelButtonText: "取消",
+            type: "warning",
+          }
+        )
+          .then(() => {
+            const dataIndedx = this.$refs.tableList.allCheckData.map((item) => {
+              return item.index;
+            });
+            this.tableData = this.tableData.filter((item) => {
+              return !dataIndedx.includes(item.index);
+            });
+            this.$refs.tableList.clearMoreActive();
+            this.$message({
+              type: "success",
+              message: "删除成功!",
+            });
+          })
+          .catch(() => {});
+      } else {
+        this.$message.warning("请勾选需要删除的题目");
+        return;
+      }
+    },
     search(v) {
       this.loading = true;
       this.$api
@@ -1147,6 +1205,12 @@ export default {
             return item.index === v.index;
           });
           this.tableData.splice(index, 1);
+          if (this.$refs.tableList.allCheckData.length) {
+            this.$refs.tableList.allCheckData =
+              this.$refs.tableList.allCheckData.filter((item) => {
+                return item.index !== v.index;
+              });
+          }
         })
         .catch(() => {
           this.$message({
@@ -1674,7 +1738,7 @@ export default {
         return;
       }
       var arrs = [];
-      for (let i = this.tableData.length-1; i >= 0; i--) {
+      for (let i = this.tableData.length - 1; i >= 0; i--) {
         if (self.tableData[i].questionId && self.tableData[i].diff) {
           await self.uploadApis(self.tableData[i]);
         }

+ 9 - 0
src/views/resource/bankManagement/testPaperManagement/excelPop.vue

@@ -84,6 +84,15 @@ export default {
     importMobleadd(e) {
       var self = this;
       var file = e.target.files[0];
+      if (file === undefined) {
+        e.target.value = ""
+        return;
+      }
+      var type = e.target.value.toLowerCase().split(".").splice(-1);
+      if (type[0] != "xlsx") {
+        self.$message.error("请上传excel文件,且上传格式需为:.xlsx");
+        return;
+      }
       let formData = new FormData();
       formData.append("file", file);
       this.$api

+ 9 - 0
src/views/resource/bankManagement/testPaperManagement/wordPop.vue

@@ -123,6 +123,15 @@ export default {
       var self = this;
       let arr = this.$parent.businObj;
       var file = e.target.files[0];
+      if (file === undefined) {
+        e.target.value = ""
+        return;
+      }
+      var type = e.target.value.toLowerCase().split(".").splice(-1);
+      if (type[0] != "docx") {
+        self.$message.error("请上传word文件,且上传格式需为:.docx");
+        return;
+      }
       let formData = new FormData();
       formData.append("file", file);
       formData.append("eduId", arr.educationTypeId);

+ 13 - 3
src/views/resource/bankManagement/topicManagement/excelPop.vue

@@ -36,8 +36,9 @@ export default {
   methods: {
     getDowm() {
       let url =
-        baseUrls.BASE_IMG_URL + "/oss/images/file/20220307/1646623385198.xlsx" +
-        `?time=${this.$methodsTools.getNewTime()}`;;
+        baseUrls.BASE_IMG_URL +
+        "/oss/images/file/20220307/1646623385198.xlsx" +
+        `?time=${this.$methodsTools.getNewTime()}`;
       let link = document.createElement("a");
       let fileName = "导入模板" + ".xlsx";
       document.body.appendChild(link);
@@ -49,6 +50,15 @@ export default {
     importMobleadd(e) {
       var self = this;
       var file = e.target.files[0];
+      if (file === undefined) {
+        e.target.value = ""
+        return;
+      }
+      var type = e.target.value.toLowerCase().split(".").splice(-1);
+      if (type[0] != "xlsx") {
+        self.$message.error("请上传excel文件,且上传格式需为:.xlsx");
+        return;
+      }
       let formData = new FormData();
       formData.append("file", file);
       this.$api
@@ -70,7 +80,7 @@ export default {
         })
         .finally(() => {
           e.target.value = "";
-          self.$emit("search",2)
+          self.$emit("search", 2);
         });
     },
   },

+ 12 - 3
src/views/resource/bankManagement/topicManagement/wordPop.vue

@@ -170,8 +170,9 @@ export default {
     },
     getDowm() {
       let url =
-        baseUrls.BASE_IMG_URL + "/oss/images/file/20220324/1648102107588.docx" +
-        `?time=${this.$methodsTools.getNewTime()}`;;
+        baseUrls.BASE_IMG_URL +
+        "/oss/images/file/20220324/1648102107588.docx" +
+        `?time=${this.$methodsTools.getNewTime()}`;
       let link = document.createElement("a");
       let fileName = "导入模板" + ".docx";
       document.body.appendChild(link);
@@ -183,6 +184,15 @@ export default {
     importMobleadd(e) {
       var self = this;
       var file = e.target.files[0];
+      if (file === undefined) {
+        e.target.value = ""
+        return;
+      }
+      var type = e.target.value.toLowerCase().split(".").splice(-1);
+      if (type[0] != "docx") {
+        self.$message.error("请上传word文件,且上传格式需为:.docx");
+        return;
+      }
       let formData = new FormData();
       formData.append("file", file);
       formData.append("eduId", this.formData.eduId);
@@ -212,7 +222,6 @@ export default {
 </script>
 
 <style lang="less" scoped>
-
 /deep/.el-button {
   border-radius: 8px;
 }