Explorar o código

删除表单刷新树形控件

duy %!s(int64=2) %!d(string=hai) anos
pai
achega
4c9aa1dcd5
Modificáronse 1 ficheiros con 17 adicións e 5 borrados
  1. 17 5
      src/views/manager/projectinfo/independent.vue

+ 17 - 5
src/views/manager/projectinfo/independent.vue

@@ -16,6 +16,7 @@
             node-key="id"
             :expand-on-click-node="false"
             v-show="!allTreeShow"
+            :default-expanded-keys="defaultExpandKey"
           >
             <span
               class="custom-tree-node"
@@ -327,6 +328,7 @@ export default {
           },
         ],
       },
+      defaultExpandKey:[],//默认展开的节点
       selectionList:[],
       GLExcelFrom: {
           id: "",
@@ -359,7 +361,8 @@ export default {
       id: "",
       curTreeData: {},
       projectid:'',
-      treeId:""
+      treeId:"",
+      curNode:{}
 
 
 
@@ -438,8 +441,9 @@ export default {
           
         })
     },
-    nodeClick (data) {//外层树结构
-        console.log(data,'treedata');
+    nodeClick (data,node) {//外层树结构
+        console.log(data,node,'treedata');
+        this.curNode=node
         this.treeId=data.id
         if(data.hasChildren){
            this.tabTypeLazyTree(data.id, this.projectid,this.page.current,this.page.size).then((res)=>{
@@ -485,12 +489,20 @@ export default {
           
         })
         .then(() => {
+          //刷新表格数据
          this.tabTypeLazyTree(this.treeId, this.projectid,this.page.current,this.page.size).then((res)=>{
           console.log(res,'res');
           this.page.total=res.total;
-          this.loadData=res.records
+          this.loadData=res.records;
          })
-
+        //刷新左边树形数据
+        const parentId =12345678910 
+          tabTypeLazyTree({parentId,projectId:this.projectid,current:1,size:200}).then(res => {
+            this.data=res.data.data.records;
+             this.$nextTick(()=>{
+            this.defaultExpandKey.push(this.curNode.data.parentId)
+            })
+          });
           this.$message({
             type: "success",
             message: "操作成功!"