2 Commits

Author SHA1 Message Date
weibl
231dd87f7d Merge branch 'hotfix' of http://carsafe.uicp.cn/Front_Team/SPDM into hotfix 2026-03-13 17:45:25 +08:00
weibl
b94a5d36d9 调整仿真策划同名导入逻辑 2026-03-13 17:45:21 +08:00

View File

@@ -558,7 +558,20 @@ const transferTask = async () => {
rightSelection[0].nodeType === leftMultipleSelection[index].nodeType ||
canAddChild(rightSelection[0], leftMultipleSelection[index].nodeType)
) {
await leftInsertToRight([leftMultipleSelection[index]], rightSelection[0]);
let sameNode = null;
if (rightSelection[0].nodeType !== leftMultipleSelection[index].nodeType) {
rightSelection[0].children.forEach((item: any) => {
if (leftMultipleSelection[index].nodeName === item.nodeName) {
sameNode = item;
}
});
}
// 右边选中的节点的子节点中有与左边选中元素相同的类型和名称时,将左侧选中元素覆盖到右侧同名节点中,而非插入到右侧
if (sameNode) {
await leftInsertToRight([leftMultipleSelection[index]], sameNode);
} else {
await leftInsertToRight([leftMultipleSelection[index]], rightSelection[0]);
}
} else {
ElMessage.warning('左右表格选中的数据不符合导入逻辑,无法导入!');
return;
@@ -666,7 +679,8 @@ const mergeArrays = async (
insertArr.push(...leftInsertArr);
} else {
const newObj = { ...rightList[foundIndex] };
const updateRow = getRightVxeRef().getRowById(rightList[foundIndex].fakeId);
// updateRow通过ref获取修改updateRow属性会直接修改树里的属性值
// const updateRow = getRightVxeRef().getRowById(rightList[foundIndex].fakeId);
// 如果nodeName存在更新rightArr中的其他属性除了children
Object.keys(leftList[index]).forEach((key) => {
if (
@@ -677,12 +691,16 @@ const mergeArrays = async (
key !== 'pid' &&
key !== '_X_ROW_CHILD'
) {
// if (updateRow.hasOwnProperty(key)) {
if (updateRow.hasOwnProperty(key)) {
updateRow[key] = leftList[index][key];
// 但是getRowById方法未生效(╯°︵°)╯采用newObj去修改
if (newObj.hasOwnProperty(key)) {
newObj[key] = leftList[index][key];
}
// if (updateRow.hasOwnProperty(key)) {
// updateRow[key] = leftList[index][key];
// }
}
});
// 貌似也没有生效 (╯°□°)╯
await getRightVxeRef().setRow(rightList[foundIndex], newObj);
// 如果nodeName存在递归处理children