Commit dc218e9c authored by rockyl's avatar rockyl

修复选择远程和本地导致丢失的问题

parent e55c563d
......@@ -138,13 +138,14 @@
let remoteStr = remote ? JSON.stringify(remote) : '';
let localStr = local ? JSON.stringify(local) : '';
let compare = {
key,
resolved: !((!remote || !local) || remoteStr !== localStr),
};
if (remote) {
compare.remote = {name: remote[name], key, data: remoteStr, obj: remote};
compare.remote = {name: remote[name], data: remoteStr, obj: remote};
}
if (local) {
compare.local = {name: local[name], key, data: localStr, obj: local};
compare.local = {name: local[name], data: localStr, obj: local};
}
compares.push(compare);
......@@ -194,17 +195,24 @@
delete this.localObj[category];
}
} else {
if (conflict.local) {
data.some((item, index) => {
if (item[categoryConfig.key] === conflict.local.key) {
if (resultData) {
data[index] = resultData;
} else {
data.splice(index, 1);
}
return true;
let matched = false;
data.some((item, index) => {
if (item[categoryConfig.key] === conflict.key) {
if (resultData) {
data[index] = resultData;
} else {
data.splice(index, 1);
}
});
matched = true;
return true;
}
});
if (!matched) {
if (resultData) {
data.push(resultData);
} else {
}
}
}
this.$set(conflict, 'resolved', true);
......
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