Commit bd565915 authored by 皮倩雯's avatar 皮倩雯

fix: '解决表字段快速切换表清除数据时界面卡死问题'

parent b5cdabca
Pipeline #50075 skipped with stages
......@@ -533,37 +533,42 @@ const AddModal = props => {
};
const treeSelectOnchange = e => {
setTreeLoading(true);
console.log('切换');
setSelectedRowKeys([]);
setMultiOperate(true);
setTreeSelectValue(e);
console.log(e.substring(0, e.lastIndexOf('@')));
setFormObj(e.substring(0, e.lastIndexOf('@')));
reloadTableFields({
tableName: e.substring(0, e.lastIndexOf('@')),
}).then(res => {
setTreeLoading(false);
if (res.msg === 'Ok') {
let arr = formateArrDataA(res.data.root, 'group');
let newArr = [];
Object.keys(arr).map((item, index) => {
newArr.push({ type: item, key: index, id: index });
});
setAllData(arr);
setSelectGroup(newArr);
setTableData(newArr);
let aa = [];
let bb = [];
Object.keys(arr).forEach((item, index) => {
aa.push({ name: item, key: index, ID: index, children: arr[item] });
bb.push(item);
});
setKeepTreeFirst(bb);
setTreeData(aa);
setSelect(newArr);
}
});
console.log(e);
if (e) {
setTreeLoading(true);
console.log('切换');
setSelectedRowKeys([]);
setMultiOperate(true);
setTreeSelectValue(e);
console.log(e.substring(0, e.lastIndexOf('@')));
setFormObj(e.substring(0, e.lastIndexOf('@')));
reloadTableFields({
tableName: e.substring(0, e.lastIndexOf('@')),
}).then(res => {
setTreeLoading(false);
if (res.msg === 'Ok') {
let arr = formateArrDataA(res.data.root, 'group');
let newArr = [];
Object.keys(arr).map((item, index) => {
newArr.push({ type: item, key: index, id: index });
});
setAllData(arr);
setSelectGroup(newArr);
setTableData(newArr);
let aa = [];
let bb = [];
Object.keys(arr).forEach((item, index) => {
aa.push({ name: item, key: index, ID: index, children: arr[item] });
bb.push(item);
});
setKeepTreeFirst(bb);
setTreeData(aa);
setSelect(newArr);
}
});
} else {
setTreeSelectValue('');
}
};
const mapTree = org => {
const haveChildren = Array.isArray(org.children) && org.children.length > 0;
......
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