Commit 792aba24 authored by tyn's avatar tyn

fix

parent 7cdd772c
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
<dsk-skeleton v-if="tableLoading"></dsk-skeleton> <dsk-skeleton v-if="tableLoading"></dsk-skeleton>
<el-form :model="dataForm" ref="costSummaryForm" :show-message="false" v-else-if="!tableLoading" class="feed-summary-form"> <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" <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"> :paging="false" :cell-class-name="cellClassName">
</custom-table> </custom-table>
</el-form> </el-form>
...@@ -351,9 +351,15 @@ export default { ...@@ -351,9 +351,15 @@ export default {
} else { } else {
// 有children // 有children
item.hasChildren = true; item.hasChildren = true;
if (item?.children?.length) {
item.children = item.children.map(childItem => {
childItem.hasChildren = childItem.hasChildren ? true : false;
return childItem;
});
}
}; };
// 储存将子级储存到map 主动调用展开菜单 // 储存将子级储存到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; delete item.children;
return item; return item;
}); });
...@@ -367,11 +373,7 @@ export default { ...@@ -367,11 +373,7 @@ export default {
const tableIns = this.$refs["costSummaryTable"].$refs["customTableRef"]; const tableIns = this.$refs["costSummaryTable"].$refs["customTableRef"];
if (tableIns) { if (tableIns) {
_mapList.forEach((child, id) => { _mapList.forEach((child, id) => {
child = child.map(item => { // 打开一级目录
item.hasChildren = item.hasChildren ? true : false;
return item;
});
// 打开一级菜单
this.customResolve(id, child, tableIns); this.customResolve(id, child, tableIns);
}); });
} }
...@@ -382,7 +384,7 @@ export default { ...@@ -382,7 +384,7 @@ export default {
} }
}, },
// 模拟 resolve 懒加载 // 模拟 resolve 懒加载
customResolve(id, child, tableIns, level = 1) { customResolve(id, child, tableIns) {
let children = child; let children = child;
let newKey = id; let newKey = id;
let treeNodeMap = tableIns.store.states.lazyTreeNodeMap; let treeNodeMap = tableIns.store.states.lazyTreeNodeMap;
...@@ -392,16 +394,17 @@ export default { ...@@ -392,16 +394,17 @@ export default {
let metaInfo = { let metaInfo = {
children: childrenids, children: childrenids,
display: true, display: true,
expanded: true,//这里设置展开 expanded: true,
lazy: true, lazy: true,
level, level: "",
loaded: true, loaded: true,
loading: false loading: false
}; };
this.$set(treeData, newKey, metaInfo); this.$set(treeData, newKey, metaInfo);
//lazyTreeNodeMap中 添加数据 //lazyTreeNodeMap中 添加数据
this.$set(treeNodeMap, newKey, children); this.$set(treeNodeMap, newKey, children);
console.log(treeData); console.log(treeData, "treeData");
console.log(treeNodeMap, "treeNodeMap");
}, },
async getCostSummaryListLazy(params = {}) { async getCostSummaryListLazy(params = {}) {
try { try {
...@@ -429,7 +432,6 @@ export default { ...@@ -429,7 +432,6 @@ export default {
// 列表懒加载 // 列表懒加载
async tableLazyLoad(row, treeNode, resolve) { async tableLazyLoad(row, treeNode, resolve) {
try { try {
console.log(treeNode);
const { id } = row; const { id } = row;
const { cbType, expenseDate } = this.createRequestConditions(); const { cbType, expenseDate } = this.createRequestConditions();
const params = { 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