wyq 3 years ago
parent
commit
f5ae619d39
1 changed files with 28 additions and 22 deletions
  1. 28 22
      src/components/knowledgeExtra/AddTermSet.vue

+ 28 - 22
src/components/knowledgeExtra/AddTermSet.vue

@@ -288,7 +288,7 @@
       </div>
     </div>
     <el-dialog
-      title="请输入要添加到关联的标准术语(每行一个)"
+      :title="'请输入要添加到关联的标准术语(每行一个)'+'共'+len+'行'"
       :visible.sync="dialogVisible"
       width="30%"
       @close="cancel"
@@ -332,7 +332,6 @@ export default {
       leftList: [],
       multipleSelection: [],
       sign: 1,
-      len: 0,
       searchtext: '',
       searchtext2: '',
       dialogVisible: false,
@@ -356,7 +355,10 @@ export default {
         collectionLibName: [
           { required: true, message: '请选择术语集合名称', trigger: 'change' }
         ]
-      }
+      },
+      Math: 88,
+      English: 77,
+      chemistry: 99
     };
   },
   created() {
@@ -507,7 +509,7 @@ export default {
         conceptLibName: row.conceptName
       };
       this.excludedConceptIds.push(row.conceptId);
-      this.leftList.push(concepts);
+      this.form.concepts.push(concepts);
       this.conceptList = [];
       this.$nextTick(() => {
         setTimeout(() => {
@@ -519,17 +521,22 @@ export default {
       this.multipleSelection = val;
     },
     add() {
+      this.processing(this.multipleSelection);
+    },
+    //处理数据
+    processing(arr) {
       if (this.whether) {
         return;
       }
-      this.multipleSelection.forEach(it => {
+      arr.forEach(it => {
         let concepts = {
           conceptId: it.conceptId,
-          conceptLibType: it.libType,
+          conceptLibType: it.libType ? it.libType : it.conceptLibType,
           conceptLibName: it.conceptName
         };
         this.excludedConceptIds.push(it.conceptId);
         this.leftList.push(concepts);
+        this.form.concepts.push(concepts);
       });
       this.conceptList = [];
       this.$nextTick(() => {
@@ -554,14 +561,10 @@ export default {
         if (item.conceptId == row.conceptId) {
           this.form.concepts.splice(index, 1);
           this.excludedConceptIds.splice(index, 1);
-          this.leftList.splice(index, 1);
         }
       });
       this.getTreeSearchList();
     },
-    getchk(num) {
-      return num % 2 == 0 ? '偶数' : '奇数'; //判断是否能整除2
-    },
     saveSet() {
       let params = {
         ...this.form,
@@ -598,14 +601,17 @@ export default {
             const data = res.data.data;
             let text = '';
             if (data.unMatchList.length > 0) {
+              console.log(65);
               data.unMatchList.forEach(it => {
                 text += it.conceptLibName + '\n';
               });
+            } else if (data.matchList.length > 0) {
+              console.log(123);
+              this.processing(data.matchList);
+              this.dialogVisible = false;
             }
             this.$refs.msg.innerHTML = text;
             this.innerText = text;
-          } else {
-            this.dialogVisible = true;
           }
         })
         .catch(error => {
@@ -620,16 +626,6 @@ export default {
       this.getTreeSearchList();
     }
   },
-  computed: {
-    conceptCollectionVO() {
-      let conceptCollectionVO = [];
-      this.innerText.forEach(it => {
-        console.log(123);
-        conceptCollectionVO.push(it);
-      });
-      return conceptCollectionVO;
-    }
-  },
   watch: {
     form: {
       handler(newName, oldName) {
@@ -665,6 +661,16 @@ export default {
       return (
         this.form.collectionLibType != '' && this.form.collectionLibName != ''
       );
+    },
+    len() {
+      let arr = this.innerText.split('\n');
+      let len = 0;
+      arr.forEach(it => {
+        if (it != '') {
+          len++;
+        }
+      });
+      return len;
     }
   }
 };