Skip to content

Commit d82c589

Browse files
committed
click node should not change
1 parent f63a15b commit d82c589

File tree

1 file changed

+33
-1
lines changed

1 file changed

+33
-1
lines changed

web/packages/workflows/module/process/module.vue

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -963,11 +963,43 @@ export default {
963963
change(obj) {
964964
this.json = obj;
965965
this.changeNum++
966-
if (this.changeNum > 2) {
966+
const change = this.checkChange(obj)
967+
this.lastObj = JSON.parse(JSON.stringify(obj))
968+
if (this.changeNum > 2 && change) {
967969
this.heartBeat();
968970
this.jsonChange = true;
969971
}
970972
},
973+
checkChange(obj) {
974+
// 剔除单击节点选中导致的change
975+
const helpFn = function(obj = {}) {
976+
const temp = { nodes: [], edges: [] }
977+
if (obj.nodes) {
978+
obj.nodes.forEach(item => {
979+
const nodeItem = {}
980+
Object.keys(item).forEach(k => {
981+
if(k !== 'selected') {
982+
nodeItem[k] = item[k]
983+
}
984+
})
985+
temp.nodes.push(nodeItem)
986+
})
987+
}
988+
if (obj.edges) {
989+
obj.edges.forEach(item => {
990+
const link = {}
991+
Object.keys(item).forEach(k => {
992+
if(k !== 'selected') {
993+
link[k] = item[k]
994+
}
995+
})
996+
temp.edges.push(link)
997+
})
998+
}
999+
return JSON.stringify(temp)
1000+
}
1001+
return helpFn(obj) !== helpFn(this.lastObj)
1002+
},
9711003
initNode(arg) {
9721004
if(this.clickCurrentNode.id === arg.id) return; // 多出点击时,避免数据初始化
9731005
arg = this.bindNodeBasicInfo(arg);

0 commit comments

Comments
 (0)