فهرست منبع

左侧目录树显示子节点

duy 2 سال پیش
والد
کامیت
3e766d8b1b
1فایلهای تغییر یافته به همراه23 افزوده شده و 46 حذف شده
  1. 23 46
      src/views/manager/wbsinfo/element.vue

+ 23 - 46
src/views/manager/wbsinfo/element.vue

@@ -442,7 +442,7 @@
 </template>
 
 <script>
-import { detailExcel, excelType, tabLazytree,  wbstree, getWbsTypeList,} from '@/api/exctab/excelmodel';
+import { detailExcel, excelType,wbstree, getWbsTypeList,} from '@/api/exctab/excelmodel';
 import {updateBatchNodeTableInfo,selectByNodeTable,selectFormElements} from "@/api/manager/wbstree";
 import {tabTypeLazyTreeAll,delTabInfoAll} from "@/api/manager/wbsprivate";
 import {saveElement, remove as removeElement, updateBatchElements, getTemplate,importWbsElement} from "@/api/manager/wbsformelement";
@@ -638,7 +638,7 @@ export default {
       curTreeData:{},
       loadData:[],
       treeOption:{
-        defaultExpandAll:true,
+       
         filter:false,
         addBtn:false,
         props:{
@@ -646,7 +646,22 @@ export default {
           label:'title',
           value:'id',
           children:'children'
-        }
+        },
+        lazy: true,
+        treeLoad: function (node, resolve) {
+          console.log(node);
+           const parentId = (node.level === 0) ? 12345678910 : node.data.id;
+         
+          tabTypeLazyTreeAll({parentId}).then(res => {
+            resolve(res.data.data.records.map(item => {
+              return {
+                ...item,
+                leaf: !item.hasChildren
+              }
+            }))
+          });
+        },
+ 
       },
       treeData:'',
       projectid:""
@@ -1040,15 +1055,7 @@ export default {
         this.tableTypelist = res.data.data;
       });
     },
-    formatTableType(row, column, cellValue) {
-      for (let i = 0; i < this.tableTypelist.length; i++) {
-        if (this.tableTypelist[i].dictKey == cellValue) {
-          return this.tableTypelist[i].dictValue;
-        }
-      }
-      return cellValue;
-      //console.log(cellValue)
-    },
+ 
     editeditElementFormMF () {//保存按钮
       let da = []
       let tag = true
@@ -1087,17 +1094,6 @@ export default {
          this.onLoad(this.page);
       }
     },
-  
-
-
-    //#region 接口
-    async tabLazytree (parentId, modeId) {//清表树
-      const { data: res } = await tabLazytree({ parentId, modeId })
-      console.log(res);
-      if (res.code === 200) {
-        return res.data
-      }
-    },
 
   
     async excelType () {//清表类型
@@ -1110,25 +1106,6 @@ export default {
         this.exceltypeData = res.data
       }
     },
-    // async wbstree () {//wbs树懒加载
-    //   this.loading = true;
-    //   const { data: res } = await wbstree({ parentId: 0, wbsId: this.excelForm.wbsId, wbsType: this.excelForm.wbsType })
-    //   console.log(res);
-    //   this.loading = false
-    //   if (res.code === 200) {
-    //     res.data.forEach((val) => {
-    //       if (!val.hasChildren) {
-    //         val.leaf = true
-    //       }
-    //     })
-    //     this.wbsdata = res.data
-    //   }
-    // },
-
-
-    
- 
-
 
     
     //查看节点下已关联的元素表信息
@@ -1152,10 +1129,10 @@ export default {
 
   },
   created () {
-    let id=12345678910
-    this.tabTypeLazyTreeAll(id).then((res)=>{
-            this.treeData=res.records;
-        });
+    // let id=12345678910
+    // this.tabTypeLazyTreeAll(id).then((res)=>{
+    //         this.treeData=res.records;
+    //     });
      this.getTableTypelist();
      this.getOwnerTypelist();
      this.getDataTypelist();