wyq 4 年之前
父节点
当前提交
317334e1d4
共有 1 个文件被更改,包括 21 次插入5 次删除
  1. 21 5
      src/components/knowledgeExtra/AddTermSet.vue

+ 21 - 5
src/components/knowledgeExtra/AddTermSet.vue

@@ -291,6 +291,7 @@
 <script type="text/javascript">
 import api from '@api/knowledgeLib.js';
 import AddNewRuleTable from './AddNewRuleTable';
+import axios from 'axios';
 export default {
   name: 'AddRule',
   data() {
@@ -319,6 +320,7 @@ export default {
       editCount: -1, // 页面会否被编辑 >0被编辑   =0 未编辑
       startCount: -1,
       isSaveSuccess: false, // 是否保存成功
+      timeout: null,
       rules: {
         collectionLibType: [
           { required: true, message: '请选择术语集合类型', trigger: 'change' }
@@ -353,6 +355,11 @@ export default {
     }, 500);
   },
   methods: {
+    cancelRequest() {
+      if (typeof this.source === 'function') {
+        this.source('终止请求');
+      }
+    },
     getDict() {
       api
         .zskgetDict()
@@ -414,14 +421,23 @@ export default {
       });
     },
     // 基础术语
-    async searchConcept() {
+    searchConcept(e) {
+      this.conceptText = e.target.value
+      if (this.timeout) {
+        clearTimeout(this.timeout);
+      }
+      this.timeout = setTimeout(() => {
+        this.getTreeSearchList()
+      }, 800);
+    },
+    async getTreeSearchList(){
       this.whether = true;
       const params = {
         typeId: this.form.conceptLibType,
         name: this.conceptText,
         excludedConceptIds: this.excludedConceptIds
       };
-      const data = await api.getTreeSearchList(params);
+      const data = await api.getTreeSearchList(params)
       if (data.data.code == '0') {
         this.conceptList = data.data.data;
         this.whether = false;
@@ -442,7 +458,7 @@ export default {
       this.getList(this.form.concepts);
       this.$nextTick(() => {
         setTimeout(() => {
-          this.searchConcept();
+          this.getTreeSearchList();
         }, 150);
       });
     },
@@ -464,7 +480,7 @@ export default {
           this.excludedConceptIds.splice(index, 1);
         }
       });
-      this.searchConcept();
+      this.getTreeSearchList();
       if (this.searchtext != '') {
         this.searchList(this.searchtext);
       } else {
@@ -515,7 +531,7 @@ export default {
       this.ruleTermTypeList = [];
       this.form.concepts = [];
       this.getList(this.form.concepts);
-      this.searchConcept();
+      this.getTreeSearchList();
     }
   },
   watch: {