【issues/9593】树表的页面属性中子节点和父节点的属性串了

This commit is contained in:
JEECG 2026-05-06 14:33:27 +08:00
parent 6f00250239
commit 2bf074cdd1

View File

@ -404,37 +404,50 @@
const SYS_BUILT_IN_FIELDS = ['create_by', 'create_time', 'update_by', 'update_time', 'sys_org_code'];
// update-end--author:liaozhiyang---date:20260414---forQQYUN-15128
// update-begin--author:liaozhiyang---date:20260506---for:issues/9593
let onTableAddedQueue: Promise<unknown> = Promise.resolve();
// update-end--author:liaozhiyang---date:20260506---for:issues/9593
/** 当新增了的时候应立即同步 */
async function onTableAdded() {
// update-begin--author:liaozhiyang---date:20260414---forQQYUN-15128退
const dbJVxeRef = tables.dbTable.value?.tableRef;
if (dbJVxeRef) {
const fullData = dbJVxeRef.getXTable().internalData.tableFullData;
const sysIndex = fullData.findIndex((row) => SYS_BUILT_IN_FIELDS.includes(row.dbFieldName));
const lastIndex = fullData.length - 1;
//
if (sysIndex !== -1 && lastIndex > sysIndex && !SYS_BUILT_IN_FIELDS.includes(fullData[lastIndex]?.dbFieldName)) {
const newRowData = { ...fullData[lastIndex] };
// dbTable
await dbJVxeRef.rowResort(lastIndex, sysIndex);
// tables syncAllTableNow
const { pageTable, checkTable, fkTable, queryTable } = tables;
for (const t of [pageTable, checkTable, fkTable, queryTable]) {
const jvxeRef = t.value?.tableRef;
if (!jvxeRef) continue;
const tFullData = jvxeRef.getXTable().internalData.tableFullData;
const tSysIndex = tFullData.findIndex((row) => SYS_BUILT_IN_FIELDS.includes(row.dbFieldName));
if (tSysIndex !== -1) {
jvxeRef.insertRows(newRowData, tSysIndex);
} else {
jvxeRef.addRows(newRowData);
function onTableAdded() {
// update-begin--author:liaozhiyang---date:20260506---for: issues/9593
onTableAddedQueue = onTableAddedQueue.then(async () => {
// update-begin--author:liaozhiyang---date:20260414---forQQYUN-15128退
const dbJVxeRef = tables.dbTable.value?.tableRef;
if (dbJVxeRef) {
const fullData = dbJVxeRef.getXTable().internalData.tableFullData;
const sysIndex = fullData.findIndex((row) => SYS_BUILT_IN_FIELDS.includes(row.dbFieldName));
const lastIndex = fullData.length - 1;
//
if (sysIndex !== -1 && lastIndex > sysIndex && !SYS_BUILT_IN_FIELDS.includes(fullData[lastIndex]?.dbFieldName)) {
const newRowData = { ...fullData[lastIndex] };
// dbTable
await dbJVxeRef.rowResort(lastIndex, sysIndex);
// tables syncAllTableNow
const { pageTable, checkTable, fkTable, queryTable } = tables;
for (const t of [pageTable, checkTable, fkTable, queryTable]) {
const jvxeRef = t.value?.tableRef;
if (!jvxeRef) continue;
const tFullData = jvxeRef.getXTable().internalData.tableFullData;
const tSysIndex = tFullData.findIndex((row) => SYS_BUILT_IN_FIELDS.includes(row.dbFieldName));
// await insertRows/addRows
if (tSysIndex !== -1) {
await jvxeRef.insertRows(newRowData, tSysIndex);
} else {
await jvxeRef.addRows(newRowData);
}
}
return;
}
return;
}
}
// update-end--author:liaozhiyang---date:20260414---forQQYUN-15128退
syncAllTableNow();
// update-end--author:liaozhiyang---date:20260414---forQQYUN-15128退
syncAllTableNow();
});
//
onTableAddedQueue = onTableAddedQueue.catch((e) => {
console.error('[onTableAdded] queue error:', e);
});
// update-end--author:liaozhiyang---date:20260506---for: issues/9593
}
/** 当删除的时候也应立即同步 */
@ -504,8 +517,10 @@
newData.id = uuidTemp;
});
dbTable.value!.tableRef!.addRows(treeFields, { setActive: false });
pageTable.value!.tableRef!.addRows(treeFields, { setActive: false });
checkTable.value!.tableRef!.addRows(treeFields, { setActive: false });
// update-begin--author:liaozhiyang---date:20260506---for: issues/9593
// pageTable.value!.tableRef!.addRows(treeFields, { setActive: false });
// checkTable.value!.tableRef!.addRows(treeFields, { setActive: false });
// update-end--author:liaozhiyang---date:20260506---for: issues/9593
nextTick(() => syncAllTableNow());
treeFieldAdded = true;
}