Commit 8c231f25 authored by 邓超's avatar 邓超

fix: 修改序号重复判断到大保存位置

parent 9110e068
Pipeline #47525 passed with stages
in 7 minutes 3 seconds
......@@ -320,7 +320,6 @@ const FlowChart = props => {
// 节点配置回调
const nodeCallBack = obj => {
let nameIsRepeat;
let numIsRepeat;
let { nodes } = diagram;
let keyArr = [];
// 遍历输出节点对象
......@@ -332,12 +331,6 @@ const FlowChart = props => {
nameIsRepeat = false;
}
}
if (Number(obj.SerialNo) === Number(node.data.SerialNo)) {
numIsRepeat = true;
if (modalType === 'edit' && Number(obj.SerialNo) === Number(editMsg.SerialNo)) {
numIsRepeat = false;
}
}
});
if (nameIsRepeat) {
notification.error({
......@@ -347,14 +340,6 @@ const FlowChart = props => {
});
return;
}
if (numIsRepeat) {
notification.error({
message: '提示',
duration: 3,
description: '序号不能重复',
});
return;
}
if (modalType === 'add') {
// 新增节点
// 新增得key比最大得key值+1
......@@ -414,9 +399,30 @@ const FlowChart = props => {
}
});
};
const isRepeat = (arr, key) => {
let obj = {};
for (let i = 0; i < arr.length; i++) {
if (obj[arr[i][key]]) {
return false;
}
obj[arr[i][key]] = arr[i];
}
return obj;
};
// 保存流程
const saveFlow = () => {
let diagramObj = JSON.parse(diagram.model.toJson());
let list = isRepeat(diagramObj.nodeDataArray, 'SerialNo');
if (!list) {
notification.error({
message: '提示',
duration: 3,
description: '请检查序号是否重复',
});
return;
}
SaveNodeChange({
FlowId: flowID,
DeleteNodes,
......
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