Commit 792aba24 authored by tyn's avatar tyn

fix

parent 7cdd772c
......@@ -35,7 +35,7 @@
<dsk-skeleton v-if="tableLoading"></dsk-skeleton>
<el-form :model="dataForm" ref="costSummaryForm" :show-message="false" v-else-if="!tableLoading" class="feed-summary-form">
<custom-table ref="costSummaryTable" :tableData="dataForm.tableDataList" :formColum="formColum" :max-height="true" :row-key="rowKey"
:lazy="true" :load-fn="tableLazyLoad" :tree-options="treeOptions" :default-expand-all="true" :indent="8" :tableDataTotal="total"
:lazy="true" :load-fn="tableLazyLoad" :tree-options="treeOptions" :default-expand-all="false" :indent="8" :tableDataTotal="total"
:paging="false" :cell-class-name="cellClassName">
</custom-table>
</el-form>
......@@ -351,9 +351,15 @@ export default {
} else {
// 有children
item.hasChildren = true;
if (item?.children?.length) {
item.children = item.children.map(childItem => {
childItem.hasChildren = childItem.hasChildren ? true : false;
return childItem;
});
}
};
// 储存将子级储存到map 主动调用展开菜单
_mapList.set(item.id, item.children ? cloneDeep(item.children) : []);
item.hasChildren ? _mapList.set(item.id, item.children ? cloneDeep(item.children) : []) : null;
delete item.children;
return item;
});
......@@ -367,11 +373,7 @@ export default {
const tableIns = this.$refs["costSummaryTable"].$refs["customTableRef"];
if (tableIns) {
_mapList.forEach((child, id) => {
child = child.map(item => {
item.hasChildren = item.hasChildren ? true : false;
return item;
});
// 打开一级菜单
// 打开一级目录
this.customResolve(id, child, tableIns);
});
}
......@@ -382,7 +384,7 @@ export default {
}
},
// 模拟 resolve 懒加载
customResolve(id, child, tableIns, level = 1) {
customResolve(id, child, tableIns) {
let children = child;
let newKey = id;
let treeNodeMap = tableIns.store.states.lazyTreeNodeMap;
......@@ -392,16 +394,17 @@ export default {
let metaInfo = {
children: childrenids,
display: true,
expanded: true,//这里设置展开
expanded: true,
lazy: true,
level,
level: "",
loaded: true,
loading: false
};
this.$set(treeData, newKey, metaInfo);
//lazyTreeNodeMap中 添加数据
this.$set(treeNodeMap, newKey, children);
console.log(treeData);
console.log(treeData, "treeData");
console.log(treeNodeMap, "treeNodeMap");
},
async getCostSummaryListLazy(params = {}) {
try {
......@@ -429,7 +432,6 @@ export default {
// 列表懒加载
async tableLazyLoad(row, treeNode, resolve) {
try {
console.log(treeNode);
const { id } = row;
const { cbType, expenseDate } = this.createRequestConditions();
const params = {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment