Explorar o código

fix:试卷题目搜索功能

Tang %!s(int64=3) %!d(string=hai) anos
pai
achega
adf27b5454

+ 20 - 1
src/views/resource/bankManagement/testPaperManagement/addPaper/topicAddPaper/index.vue

@@ -7,7 +7,7 @@
     <div>
       <table-list
         :tableSets="tableSet"
-        :tableData="tableData"
+        :tableData="computedData(tableData)"
         :navText="navText"
         @addClick="openActiveBox"
         :loading="loading"
@@ -16,6 +16,11 @@
         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"
@@ -684,6 +689,7 @@ export default {
   },
   data() {
     return {
+      keyValue: "",
       dialogDRword: false,
       disabledBtn: false,
       dialogDRexcel: false,
@@ -955,6 +961,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: {

+ 26 - 6
src/views/resource/bankManagement/testPaperManagement/editPaper/topicEditPaper/index.vue

@@ -3,7 +3,7 @@
     <div>
       <table-list
         :tableSets="tableSet"
-        :tableData="tableData"
+        :tableData="computedData(tableData)"
         :navText="navText"
         @addClick="openActiveBox"
         :loading="loading"
@@ -12,6 +12,11 @@
         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"
@@ -687,6 +692,7 @@ export default {
   },
   data() {
     return {
+      keyValue: "",
       dialogDRword: false,
       disabledBtn: false,
       dialogDRexcel: false,
@@ -965,6 +971,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: {
@@ -1139,7 +1158,7 @@ export default {
             this.tableData = this.tableData.filter((item) => {
               return !dataIndedx.includes(item.index);
             });
-            this.$refs.tableList.clearMoreActive()
+            this.$refs.tableList.clearMoreActive();
             this.$message({
               type: "success",
               message: "删除成功!",
@@ -1185,10 +1204,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
-            })
+          if (this.$refs.tableList.allCheckData.length) {
+            this.$refs.tableList.allCheckData =
+              this.$refs.tableList.allCheckData.filter((item) => {
+                return item.index !== v.index;
+              });
           }
         })
         .catch(() => {