Commit dc218e9c authored by rockyl's avatar rockyl

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

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