Compare commits
2 Commits
78ad350ec1
...
231dd87f7d
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
231dd87f7d | ||
|
|
b94a5d36d9 |
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user