wyq 3 lat temu
rodzic
commit
81c87265fe
1 zmienionych plików z 47 dodań i 25 usunięć
  1. 47 25
      src/components/knowledgeExtra/AddTermSet.vue

+ 47 - 25
src/components/knowledgeExtra/AddTermSet.vue

@@ -50,18 +50,15 @@
     min-height: 200px;
     height: calc(100vh - 264px);
     margin-top: 10px;
-    display: flex;
-    justify-content: space-between;
     .table_left {
-      flex: 1;
+      width: 45%;
+      float: left;
       margin-right: 10px;
       background: #ffffff;
-      padding: 0 50px;
-
+      padding: 0 2%;
       .left_box {
         margin: 30px 0;
         overflow: hidden;
-        overflow-y: auto;
         height: calc(100vh - 410px);
       }
       .tabs {
@@ -71,16 +68,17 @@
       .form_btn {
         display: flex;
         justify-content: flex-end;
+        padding-bottom: 15px;
       }
     }
     .table_right {
-      flex: 1;
+      width: 45%;
+      float: right;
       background: #ffffff;
-      padding: 0 50px;
+      padding: 0 2%;
       .right_box {
         margin: 30px 0;
         overflow: hidden;
-        overflow-y: auto;
         height: calc(100vh - 410px);
       }
       .tabs {
@@ -100,6 +98,7 @@
       .form_btn {
         display: flex;
         justify-content: space-between;
+        padding-bottom: 15px;
       }
     }
   }
@@ -126,6 +125,9 @@
   /deep/ .el-form-item.is-success .el-textarea__inner {
     border-color: #c9c9c9 !important;
   }
+  /deep/ .el-table th.gutter{
+    display: table-cell!important;
+  }
 }
 .test_box {
   min-height: 300px;
@@ -141,6 +143,9 @@
   margin-top: 6px;
   padding: 10px 15px;
 }
+</style>
+<style scoped>
+
 </style>
 <template>
   <div>
@@ -210,7 +215,8 @@
             <el-table
               :data="leftList"
               border
-              height="520"
+              min-height="200"
+              max-height="520"
               class="tabs"
               :header-row-style="{height:'40px'}"
               :header-cell-style="{height:'40px',padding:'0',background:'#f7f7f7'}"
@@ -246,21 +252,21 @@
             <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>
@@ -269,7 +275,8 @@
             <el-table
               :data="conceptList"
               border
-              height="520"
+              min-height="200"
+              max-height="520"
               class="tabs"
               @row-click="btn"
               :header-row-style="{height:'40px'}"
@@ -281,7 +288,7 @@
             </el-table>
           </div>
           <div class="form_btn">
-            <el-button size="medium " @click="add" icon="el-icon-arrow-left">添加</el-button>
+            <el-button size="medium " @click="add" icon="el-icon-caret-left">添加</el-button>
             <el-button size="medium " @click="dialogVisible = true">文本批量添加</el-button>
           </div>
         </div>
@@ -292,6 +299,7 @@
       :visible.sync="dialogVisible"
       width="30%"
       @close="collectcancel"
+      :close-on-click-modal="false"
     >
       <div
         class="test_box"
@@ -388,7 +396,7 @@ export default {
   methods: {
     handleInput(event) {
       let text = event.target.innerText;
-      this.innerText = text.replace(/(^\s*)|(\s*$)/g, ""); 
+      this.innerText = text.replace(/(^\s*)|(\s*$)/g, '');
     },
     cancel() {
       this.$refs.msg.innerHTML = '';
@@ -504,11 +512,9 @@ export default {
       }
     },
     btn(row) {
-      
       if (this.whether) {
         return;
       }
-      
       let concepts = {
         conceptId: row.conceptId,
         conceptLibType: row.libType,
@@ -518,8 +524,8 @@ export default {
       this.form.concepts.push(concepts);
       this.leftList = this.form.concepts;
       this.conceptList = [];
-      this.searchtext = '' 
-      this.searchtext2 = ''
+      this.searchtext = '';
+      this.searchtext2 = '';
       this.$nextTick(() => {
         setTimeout(() => {
           this.getTreeSearchList();
@@ -531,11 +537,24 @@ export default {
     },
     add() {
       if (this.multipleSelection.length == 0) {
+        this.$message({
+          message: '数据不能为空',
+          type: 'error'
+        });
         return;
       }
       this.processing(this.multipleSelection);
-      this.searchtext = '' 
-      this.searchtext2 = ''
+      this.searchtext = '';
+      this.searchtext2 = '';
+    },
+    //去重
+    unique(arr) {
+      let obj = {};
+      arr = arr.reduce(function(item, next) {
+        obj[next.conceptId] ? '' : (obj[next.conceptId] = true && item.push(next));
+        return item;
+      }, []);
+      return arr
     },
     //处理数据
     processing(arr) {
@@ -550,8 +569,8 @@ export default {
         };
         this.excludedConceptIds.push(it.conceptId);
         this.form.concepts.push(concepts);
-        this.leftList = this.form.concepts;
       });
+      this.leftList =  this.unique(this.form.concepts);;
       this.conceptList = [];
       this.multipleSelection = [];
       this.$nextTick(() => {
@@ -630,9 +649,12 @@ export default {
                 message: '列表中存在非标准术语',
                 type: 'error'
               });
-            } else if (data.matchList.length > 0) {
+            }
+            if (data.matchList.length > 0) {
               this.processing(data.matchList);
-              this.dialogVisible = false;
+              if (data.unMatchList.length == 0) {
+                this.dialogVisible = false;
+              }
             }
             this.$refs.msg.innerHTML = text;
             this.innerText = text;