wyq 3 年之前
父節點
當前提交
053daf4a71
共有 1 個文件被更改,包括 38 次插入19 次删除
  1. 38 19
      src/components/knowledgeExtra/AddTermSet.vue

+ 38 - 19
src/components/knowledgeExtra/AddTermSet.vue

@@ -200,17 +200,17 @@
           <div class="left_header">
             <h4 class="tips">关联的术语({{form.concepts.length}})</h4>
             <div style="display:flex">
-              <el-input v-model="searchtext" @input="searchList" placeholder="标准术语关键词" class="inp"></el-input>
+              <el-input v-model="searchtext" @input="searchList" placeholder="关键词" class="inp"></el-input>
               <span style="display:flex;align-items: center;margin:0 5px">-</span>
-              <el-input v-model="searchtext2" @input="searchList" placeholder="标准术语关键词" class="inp"></el-input>
+              <el-input v-model="searchtext2" @input="searchList" placeholder="关键词" class="inp"></el-input>
             </div>
           </div>
 
           <div class="left_box">
             <el-table
-              v-if="leftList.length>0"
               :data="leftList"
               border
+              height="520"
               class="tabs"
               :header-row-style="{height:'40px'}"
               :header-cell-style="{height:'40px',padding:'0',background:'#f7f7f7'}"
@@ -246,30 +246,30 @@
             <el-input
               v-model="formInline.name1"
               @input="searchConcept"
-              placeholder="标准术语关键字"
+              placeholder="关键字"
               class="inp"
             ></el-input>
             <span style="display:flex;align-items: center;margin:0 5px">-</span>
             <el-input
               v-model="formInline.name2"
               @input="searchConcept"
-              placeholder="标准术语关键字"
+              placeholder="关键字"
               class="inp"
             ></el-input>
             <span style="display:flex;align-items: center;margin:0 5px">-</span>
             <el-input
               v-model="formInline.name3"
               @input="searchConcept"
-              placeholder="标准术语关键字"
+              placeholder="关键字"
               class="inp"
             ></el-input>
           </div>
 
           <div class="right_box">
             <el-table
-              v-if="conceptList.length>0"
               :data="conceptList"
               border
+              height="520"
               class="tabs"
               @row-click="btn"
               :header-row-style="{height:'40px'}"
@@ -281,8 +281,8 @@
             </el-table>
           </div>
           <div class="form_btn">
-            <el-button type="primary" size="medium " @click="add">添加</el-button>
-            <el-button type="primary" size="medium " @click="dialogVisible = true">文本批量添加</el-button>
+            <el-button size="medium " @click="add" icon="el-icon-arrow-left">添加</el-button>
+            <el-button size="medium " @click="dialogVisible = true">文本批量添加</el-button>
           </div>
         </div>
       </div>
@@ -291,7 +291,7 @@
       :title="'请输入要添加到关联的标准术语(每行一个)'+'共'+len+'行'"
       :visible.sync="dialogVisible"
       width="30%"
-      @close="cancel"
+      @close="collectcancel"
     >
       <div
         class="test_box"
@@ -303,6 +303,7 @@
       <span slot="footer" class="dialog-footer">
         <el-button @click="cancel">取 消</el-button>
         <el-button type="primary" @click="collectionMatch">确 定</el-button>
+        <el-button @click="collectcancel">保存并关闭</el-button>
       </span>
     </el-dialog>
   </div>
@@ -387,13 +388,16 @@ export default {
   methods: {
     handleInput(event) {
       let text = event.target.innerText;
-      this.innerText = text;
+      this.innerText = text.replace(/(^\s*)|(\s*$)/g, ""); 
     },
     cancel() {
       this.$refs.msg.innerHTML = '';
       this.innerText = '';
       this.dialogVisible = false;
     },
+    collectcancel() {
+      this.dialogVisible = false;
+    },
     cancelRequest() {
       if (typeof this.source === 'function') {
         this.source('终止请求');
@@ -500,9 +504,11 @@ export default {
       }
     },
     btn(row) {
+      
       if (this.whether) {
         return;
       }
+      
       let concepts = {
         conceptId: row.conceptId,
         conceptLibType: row.libType,
@@ -510,8 +516,10 @@ export default {
       };
       this.excludedConceptIds.push(row.conceptId);
       this.form.concepts.push(concepts);
-      this.leftList = this.form.concepts
+      this.leftList = this.form.concepts;
       this.conceptList = [];
+      this.searchtext = '' 
+      this.searchtext2 = ''
       this.$nextTick(() => {
         setTimeout(() => {
           this.getTreeSearchList();
@@ -522,10 +530,12 @@ export default {
       this.multipleSelection = val;
     },
     add() {
-      if(this.multipleSelection.length == 0){
-        return
+      if (this.multipleSelection.length == 0) {
+        return;
       }
       this.processing(this.multipleSelection);
+      this.searchtext = '' 
+      this.searchtext2 = ''
     },
     //处理数据
     processing(arr) {
@@ -536,14 +546,14 @@ export default {
         let concepts = {
           conceptId: it.conceptId,
           conceptLibType: it.libType ? it.libType : it.conceptLibType,
-          conceptLibName: it.conceptName? it.conceptName : it.conceptLibName,
+          conceptLibName: it.conceptName ? it.conceptName : it.conceptLibName
         };
         this.excludedConceptIds.push(it.conceptId);
         this.form.concepts.push(concepts);
-        this.leftList = this.form.concepts
+        this.leftList = this.form.concepts;
       });
       this.conceptList = [];
-      this.multipleSelection = []
+      this.multipleSelection = [];
       this.$nextTick(() => {
         setTimeout(() => {
           this.getTreeSearchList();
@@ -595,6 +605,13 @@ export default {
       });
     },
     collectionMatch() {
+      if (this.innerText.length == 0) {
+        this.$message({
+          message: '术语名称不能为空',
+          type: 'error'
+        });
+        return;
+      }
       let params = {
         conceptLibNames: this.innerText,
         conceptLibType: this.form.conceptLibType
@@ -606,12 +623,14 @@ 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';
               });
+              this.$message({
+                message: '列表中存在非标准术语',
+                type: 'error'
+              });
             } else if (data.matchList.length > 0) {
-              console.log(123);
               this.processing(data.matchList);
               this.dialogVisible = false;
             }