浏览代码

loading样式修改

wyq 3 年之前
父节点
当前提交
94001b293a
共有 1 个文件被更改,包括 17 次插入10 次删除
  1. 17 10
      src/components/knowledgeExtra/AddTermSet.vue

+ 17 - 10
src/components/knowledgeExtra/AddTermSet.vue

@@ -153,7 +153,7 @@
 <template>
   <div>
     <crumbs :title="title" :param="$route.params" linkTo="TermSet"></crumbs>
-    <div id="AddRuleContent" v-loading="loading2" element-loading-text="拼命加载中">
+    <div id="AddRuleContent">
       <div class="table_form">
         <el-form
           size="mini"
@@ -310,8 +310,6 @@
       width="30%"
       :close-on-click-modal="false"
       :showClose="false"
-      v-loading="loading"
-      element-loading-text="拼命加载中"
     >
       <div
         class="test_box"
@@ -376,8 +374,6 @@ export default {
           { required: true, message: '请选择术语集合名称', trigger: 'change' }
         ]
       },
-      loading: false,
-      loading2: false
     };
   },
   created() {
@@ -642,8 +638,14 @@ export default {
         ...this.form,
         relationId: 0
       };
-      this.loading2 = true;
+     const loading = this.$loading({
+        lock: true,
+        text: 'Loading',
+        spinner: 'el-icon-loading',
+        background: 'rgba(0, 0, 0, 0.7)'
+      });
       api.saveOrUpdateRecord(params).then(res => {
+        loading.close();
         if (res.data.code == 0) {
           this.$message({
             message: '操作成功',
@@ -660,7 +662,7 @@ export default {
             message: res.data.msg,
             type: 'error'
           });
-          this.loading2 = false;
+          loading.close();
         }
       });
     },
@@ -672,7 +674,12 @@ export default {
         });
         return;
       }
-      this.loading = true;
+      const loading = this.$loading({
+        lock: true,
+        text: 'Loading',
+        spinner: 'el-icon-loading',
+        background: 'rgba(0, 0, 0, 0.7)'
+      });
       let params = {
         conceptLibNames: this.innerText,
         conceptLibType: this.form.conceptLibType
@@ -680,6 +687,7 @@ export default {
       api
         .collectionMatch(params)
         .then(res => {
+          loading.close();
           if (res.data.code == '0') {
             const data = res.data.data;
             let text = '';
@@ -705,12 +713,11 @@ export default {
             }
             this.$refs.msg.innerHTML = text;
             this.innerText = text;
-            this.loading = false;
           }
         })
         .catch(error => {
           console.log(error);
-          this.loading = false;
+          loading.close();
         });
     },
     clearData() {