Browse Source

添加loading效果

wyq 3 years ago
parent
commit
e3e7a885b4
1 changed files with 39 additions and 16 deletions
  1. 39 16
      src/components/knowledgeExtra/AddTermSet.vue

+ 39 - 16
src/components/knowledgeExtra/AddTermSet.vue

@@ -127,7 +127,9 @@
   /deep/ .el-table th.gutter {
   /deep/ .el-table th.gutter {
     display: table-cell !important;
     display: table-cell !important;
   }
   }
-  /deep/.el-table--column--selection .cell {
+  /deep/.el-table .cell,
+  .el-table--border td:first-child .cell,
+  .el-table--border th:first-child .cell {
     padding-right: 14px;
     padding-right: 14px;
   }
   }
 }
 }
@@ -151,7 +153,7 @@
 <template>
 <template>
   <div>
   <div>
     <crumbs :title="title" :param="$route.params" linkTo="TermSet"></crumbs>
     <crumbs :title="title" :param="$route.params" linkTo="TermSet"></crumbs>
-    <div id="AddRuleContent">
+    <div id="AddRuleContent" v-loading="loading2" element-loading-text="拼命加载中">
       <div class="table_form">
       <div class="table_form">
         <el-form
         <el-form
           size="mini"
           size="mini"
@@ -308,6 +310,8 @@
       width="30%"
       width="30%"
       :close-on-click-modal="false"
       :close-on-click-modal="false"
       :showClose="false"
       :showClose="false"
+      v-loading="loading"
+      element-loading-text="拼命加载中"
     >
     >
       <div
       <div
         class="test_box"
         class="test_box"
@@ -372,9 +376,8 @@ export default {
           { required: true, message: '请选择术语集合名称', trigger: 'change' }
           { required: true, message: '请选择术语集合名称', trigger: 'change' }
         ]
         ]
       },
       },
-      Math: 88,
-      English: 77,
-      chemistry: 99
+      loading: false,
+      loading2: false
     };
     };
   },
   },
   created() {
   created() {
@@ -562,6 +565,17 @@ export default {
       }, []);
       }, []);
       return arr;
       return arr;
     },
     },
+    //过滤数组去重
+    unique2(arr) {
+      let obj = {};
+      arr = arr.reduce(function(item, next) {
+        obj[next]
+          ? ''
+          : (obj[next] = true && item.push(next));
+        return item;
+      }, []);
+      return arr;
+    },
     //处理数据
     //处理数据
     processing(arr) {
     processing(arr) {
       if (this.whether) {
       if (this.whether) {
@@ -576,8 +590,9 @@ export default {
         this.excludedConceptIds.push(it.conceptId);
         this.excludedConceptIds.push(it.conceptId);
         this.form.concepts.push(concepts);
         this.form.concepts.push(concepts);
       });
       });
+      
       this.form.concepts = this.unique(this.form.concepts);
       this.form.concepts = this.unique(this.form.concepts);
-      this.excludedConceptIds = this.unique(this.excludedConceptIds);
+      this.excludedConceptIds = this.unique2(this.excludedConceptIds);
       this.leftList = this.form.concepts;
       this.leftList = this.form.concepts;
       this.conceptList = [];
       this.conceptList = [];
       this.multipleSelection = [];
       this.multipleSelection = [];
@@ -627,12 +642,14 @@ export default {
         ...this.form,
         ...this.form,
         relationId: 0
         relationId: 0
       };
       };
+      this.loading2 = true;
       api.saveOrUpdateRecord(params).then(res => {
       api.saveOrUpdateRecord(params).then(res => {
         if (res.data.code == 0) {
         if (res.data.code == 0) {
           this.$message({
           this.$message({
             message: '操作成功',
             message: '操作成功',
             type: 'success'
             type: 'success'
           });
           });
+          this.loading2 = false;
           this.isSaveSuccess = true;
           this.isSaveSuccess = true;
           this.$router.push({
           this.$router.push({
             name: 'TermSet',
             name: 'TermSet',
@@ -643,6 +660,7 @@ export default {
             message: res.data.msg,
             message: res.data.msg,
             type: 'error'
             type: 'error'
           });
           });
+          this.loading2 = false;
         }
         }
       });
       });
     },
     },
@@ -654,6 +672,7 @@ export default {
         });
         });
         return;
         return;
       }
       }
+      this.loading = true;
       let params = {
       let params = {
         conceptLibNames: this.innerText,
         conceptLibNames: this.innerText,
         conceptLibType: this.form.conceptLibType
         conceptLibType: this.form.conceptLibType
@@ -664,16 +683,6 @@ export default {
           if (res.data.code == '0') {
           if (res.data.code == '0') {
             const data = res.data.data;
             const data = res.data.data;
             let text = '';
             let text = '';
-            if (data.unMatchList.length > 0 || data.disableList.length > 0) {
-              let arr = data.unMatchList.concat(data.disableList);
-              arr.forEach(it => {
-                text += it.conceptLibName + '\n';
-              });
-              this.$message({
-                message: '列表中存在非标准术语或禁用术语',
-                type: 'error'
-              });
-            }
             if (data.matchList.length > 0) {
             if (data.matchList.length > 0) {
               this.processing(data.matchList);
               this.processing(data.matchList);
               if (
               if (
@@ -683,12 +692,26 @@ export default {
                 this.dialogVisible = false;
                 this.dialogVisible = false;
               }
               }
             }
             }
+            if (data.unMatchList.length > 0 || data.disableList.length > 0) {
+              this.$message({
+                message: '列表中存在非标准术语或禁用术语',
+                type: 'error',
+                duration:"99999999"
+              });
+              let arr = data.unMatchList.concat(data.disableList);
+              arr.forEach(it => {
+                text += it.conceptLibName + '\n';
+              });
+              
+            }
             this.$refs.msg.innerHTML = text;
             this.$refs.msg.innerHTML = text;
             this.innerText = text;
             this.innerText = text;
+            this.loading = false;
           }
           }
         })
         })
         .catch(error => {
         .catch(error => {
           console.log(error);
           console.log(error);
+          this.loading = false;
         });
         });
     },
     },
     clearData() {
     clearData() {