Selaa lähdekoodia

引用元素表搜索框修改

duy 2 vuotta sitten
vanhempi
commit
6996521989
1 muutettua tiedostoa jossa 43 lisäystä ja 12 poistoa
  1. 43 12
      src/views/manager/projectinfo/qutediaolog/qute1.vue

+ 43 - 12
src/views/manager/projectinfo/qutediaolog/qute1.vue

@@ -27,10 +27,12 @@
                   :page.sync="page"
                   @on-load="quteonLoad"
                   @selection-change="selectionChange"
+                  :table-loading="loading"
                   ref="crud">
                     <template slot="menuLeft" slot-scope="{size}">
-                          <el-input placeholder="请输入你想搜索的表单名称" v-model="input3" :size="size"  clearable>
-                              <i  class="el-icon-search" slot="append" @click="searchChange"></i>
+                          <el-input placeholder="请输入你想搜索的表单名称" v-model="input3" :size="size"  clearable @clear="clearinput">
+                              <i  class="el-icon-search" type="primary" slot="append" @click="searchChange" ></i>
+                             
                           </el-input>
                     </template>
                   </avue-crud>
@@ -84,6 +86,7 @@ export default {
         },
       selectionList:[],
       loadData:[],
+      loading:false,
       loadOption: {
           height: 'auto',
           calcHeight: 30,
@@ -167,7 +170,9 @@ export default {
           size:10,
           total:10
         },
-        treeId:''
+        treeId:'',
+        curTreedata:[],
+        curTreeNode:{},
         
      }
     },
@@ -195,15 +200,17 @@ export default {
     quteonLoad(page){
       console.log(page,'page');
       if(this.treeId){
+        this.loading=true;
          this.tabTypeLazyTreeAll(this.treeId, page.currentPage,page.pageSize).then((res)=>{
           this.loadData=res.records
-           this.page.total=res.total
+           this.page.total=res.total;
+           this.loading=false
         })
       }
     },
     selectionChange (list) {
       this.selectionList = list;
-      },
+    },
     selectionClear () {
         this.selectionList = [];
         this.$refs.crud.toggleSelection();
@@ -211,15 +218,35 @@ export default {
       //搜索
     searchChange(){
       if(this.treeId){
-       this.tabTypeLazyTreeAll(this.treeId, this.page.current,this.page.size,this.input3).then((res)=>{
-          this.loadData=res.records
-          this.page.total=res.total
-          
-        })
+            if(this.curTreedata.hasChildren){
+            this.loading=true
+             this.tabTypeLazyTreeAll(this.curTreedata.id, this.page.current,this.page.size,this.input3).then((res)=>{
+              this.loadData=res.records
+              this.page.total=res.total
+              this.loading=false
+            })
+          }
+        if(this.curTreedata.hasChildren===false&&this.curTreeNode.level==2){
+           this.loading=true
+          let arr=[]
+            arr.push(this.curTreedata);
+            this.loadData=arr
+            this.page.total=1
+            setTimeout(() => {
+            this.loading=false
+              
+            }, 1000);
+        }else{
+           this.loadData=[]
+            this.page.total=0
+        }
       }else{
          this.$message.warning("请先选择左侧节点");  
       }
-     
+  
+    },
+    clearinput(){
+      this.searchChange()
     },
     resetChange(item){
       console.log(item);
@@ -240,11 +267,15 @@ export default {
     },
       nodeClick(data,node){
           console.log(data,'treedata');
-          this.treeId=data.id
+          this.treeId=data.id;
+          this.curTreedata=data;
+          this.curTreeNode=node
           if(data.hasChildren){
+            this.loading=true
              this.tabTypeLazyTreeAll(data.id, this.page.current,this.page.size).then((res)=>{
               this.loadData=res.records
               this.page.total=res.total
+              this.loading=false
             })
           }
         if(data.hasChildren===false&&node.level==2){