赞
踩
- data() {
- treeNodeMap: new Map(), // 用于存储所有懒加载节点的数据
- }
-
- methods: {
- //懒加载时,将该节点的信息存入map集合
- loadExpandData(tree, treeNode, resolve) {
- this.treeNodeMap.set(tree.id,{tree, treeNode, resolve})
- getFgAssetTypeMain(tree.id).then(res => { // 删除节点时,如果此节点没有为空时,走else
- if(res.data.list.length != 0) {
- resolve(res.data.list)
- }else {
- this.$set(this.$refs.refTable.$refs.JNPFTable.store.states.lazyTreeNodeMap, tree.id, {})
- getFgAssetTypeMain(tree.parent).then(res => {
- // 这里对el-table进行了二次封装,this.$refs可根据自己需求来改变
- this.$set(this.$refs.refTable.$refs.JNPFTable.store.states.lazyTreeNodeMap, tree.parent, res.data.list)
- })
- }
- })
- },
- //删除或修改某个节点时,调用该方法,并传入对应的节点id
- refreshRow(id) {
- const node = this.treeNodeMap.get(id)
- if(node != undefined) {
- const {tree, treeNode, resolve} = node
- this.loadExpandData(tree, treeNode, resolve)
- }
- },
-
- }
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。