Skip to content

Commit

Permalink
fix [Bug]: 树形结构列表视图自动展开功能效果失效了 #6098
Browse files Browse the repository at this point in the history
  • Loading branch information
baozhoutao committed Jan 4, 2024
1 parent 27c32e1 commit e10e045
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -482,14 +482,6 @@ export async function lookupToAmisPicker(field, readonly, ctx){
}
});
payload.data.rows = treeRecords;
try{
setTimeout(() => {
$('.amis-dialog-widget.antd-Modal .antd-Table-content .antd-Table-table thead .antd-Table-expandBtn')[0]?.click();
}, 600);
}
catch(ex){
console.error("tree数据格式展开异常:", ex);
}
}
return payload;
`;
Expand Down Expand Up @@ -524,6 +516,7 @@ export async function lookupToAmisPicker(field, readonly, ctx){
labelFieldName,
top: top,
isLookup: true,
enable_tree: refObjectConfig.enable_tree,
...ctx
})

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1033,6 +1033,14 @@ export async function getTableSchema(fields, options){

}

const treeConfig = {};

if(options.enable_tree){
treeConfig.expandConfig = {
expand: 'first'
}
}

return {
mode: "table",
perPageAvailable: [5, 10, 20, 50, 100, 500],
Expand All @@ -1048,6 +1056,7 @@ export async function getTableSchema(fields, options){
labelTpl: `\${${options.labelFieldName}}`,
autoFillHeight: false, // 自动高度效果不理想,先关闭
columnsTogglable: false,
...treeConfig
}
}

Expand Down Expand Up @@ -1364,17 +1373,6 @@ export async function getTableApi(mainObject, fields, options){
payload.data.rows = getTreeOptions(records,{"valueField":"_id"});
assignIndexToTreeRecords(payload.data.rows, '');
}
try{
setTimeout(() => {
let expandBtn = $('.steedos-object-listview-content .antd-Table-content .antd-Table-table thead .antd-Table-expandBtn');
if(expandBtn && expandBtn.length > 0 && !expandBtn.hasClass("is-active")){
expandBtn[0].click();
}
}, 600);
}
catch(ex){
console.error("tree数据格式展开异常:", ex);
}
}
Expand Down

0 comments on commit e10e045

Please sign in to comment.