Quellcode durchsuchen

元素库搜索框修改

duy vor 2 Jahren
Ursprung
Commit
3b07d78cd5
2 geänderte Dateien mit 77 neuen und 15 gelöschten Zeilen
  1. 24 2
      src/views/manager/projectinfo/independent.vue
  2. 53 13
      src/views/manager/wbsinfo/element.vue

+ 24 - 2
src/views/manager/projectinfo/independent.vue

@@ -470,7 +470,7 @@ export default {
     },
      searchChange(){
          if(this.treeId){
-            this.onLoad1()
+            this.onLoad2()
           }else{
              this.$message.warning("请先选择左侧节点");  
           }
@@ -478,7 +478,7 @@ export default {
     clearinput(){
       this.searchChange()
     },
-    onLoad1(){
+    onLoad2(){
    
            if(this.curTreeData.hasChildren){
             this.tabloading=true;
@@ -504,6 +504,28 @@ export default {
             this.page.total=0
         }
      
+    },
+    onLoad1(){
+      if(this.curNode.level===1&&this.curNode.data.hasChildren){
+        this.tabloading=true;
+         this.tabTypeLazyTree(this.curTreeData.id, this.projectid, this.page.current,this.page.size,this.input3).then((res)=>{
+          this.loadData=res.records
+           this.page.total=res.total
+           this.tabloading=false
+        })
+      }else{
+        
+          this.tabTypeLazyTree(this.curTreeData.id, this.projectid, this.page.current,this.page.size,this.input3).then((res)=>{
+           let faArr=res.records;
+           this.loadData=faArr.filter((item)=>{
+             if(item.id===this.treeId){
+               return item
+             }
+           })
+          })
+      }
+     
+
     },
      onLoad(page){
       if(this.treeId){

+ 53 - 13
src/views/manager/wbsinfo/element.vue

@@ -77,6 +77,7 @@
                   :page.sync="page"
                   @on-load="onLoad"
                   @selection-change="selectionChange"
+                  :table-loading="tabloading"
                   >
 
                   <template slot="menuRight">
@@ -98,7 +99,7 @@
                         </el-button>
                   </template>
                   <template slot="menuLeft" slot-scope="{size}">
-                     <el-input placeholder="请输入你想搜索的表单名称" v-model="input3" :size="size" >
+                     <el-input placeholder="请输入你想搜索的表单名称" v-model="input3" :size="size"  @clear="clearinput" clearable>
                          <i  class="el-icon-search" slot="append" @click="searchChange"></i>
                     </el-input>
                 </template>
@@ -513,6 +514,7 @@ export default {
     return {
       input3:'',
       editElementFormTag:false,//编辑元素
+      tabloading:false,
       formDatass: [],
       selectionList:[],
       tableTypelist:[],
@@ -854,24 +856,33 @@ export default {
     nodeClick(data,node){
           console.log(data,node,'treedata');
           this.curNode=node
+          this.curTreeData=data
+          this.treeId=data.id
+
           if(data.hasChildren){
+            this.tabloading=true;
                 this.tabTypeLazyTreeAll(data.id, this.page.current,this.page.size).then((res)=>{
                 this.loadData=res.records
                 this.page.total=res.total
+                this.tabloading=false;
               })
           }
         if(data.hasChildren===false&&node.level==2){
+           this.tabloading=true;
           let arr=[]
             arr.push(data)
             this.loadData=arr
             this.page.total=1
+            setTimeout(() => {
+              this.tabloading=false
+              
+            }, 1000);
         }else{
            this.loadData=[]
             this.page.total=0
+          
         }
-          this.curTreeData=data
-          this.treeId=data.id
-
+          
       },
 
 
@@ -889,15 +900,17 @@ export default {
       }
     },
     //编辑后刷新
-    onLoad1(page){
-      // console.log(this.level,'1111111111');
+    onLoad1(){
       if(this.curNode.level===1&&this.curNode.data.hasChildren){
-         this.tabTypeLazyTreeAll(this.treeId, page.currentPage,page.pageSize).then((res)=>{
+        this.tabloading=true;
+         this.tabTypeLazyTreeAll(this.treeId, this.page.current,this.page.size,this.input3).then((res)=>{
           this.loadData=res.records
            this.page.total=res.total
+           this.tabloading=false
         })
       }else{
-          this.tabTypeLazyTreeAll(this.curNode.data.parentId, page.currentPage,page.pageSize).then((res)=>{
+        
+          this.tabTypeLazyTreeAll(this.curNode.data.parentId,this.page.current,this.page.size,this.input3).then((res)=>{
            let faArr=res.records;
            this.loadData=faArr.filter((item)=>{
              if(item.id===this.treeId){
@@ -906,21 +919,48 @@ export default {
            })
           })
       }
-      // this.refreshTreeData()
+     
+
     },
         //搜索
     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.tabloading=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.tabloading=false;
+              })
+          }
+        if(this.curTreeData.hasChildren===false&&this.curNode.level==2){
+           this.tabloading=true;
+          let arr=[]
+            arr.push(this.curTreeData)
+            this.loadData=arr
+            this.page.total=1;
+               setTimeout(() => {
+              this.tabloading=false
+              
+            }, 1000);
+        }else{
+           this.loadData=[]
+            this.page.total=0
+            setTimeout(() => {
+              this.tabloading=false
+              
+            }, 1000);
+        }
+         
 
-        })
       }else{
          this.$message.warning("请选选择左侧节点");
       }
 
     },
+    clearinput(){
+      this.searchChange()
+    },
     resetChange(item){
       console.log(item);
         this.tabTypeLazyTreeAll(this.treeId, this.page.current,this.page.size).then((res)=>{