hookehuyr

fix

Showing 1 changed file with 21 additions and 39 deletions
......@@ -1909,22 +1909,7 @@ export default {
*
* @return {void} No return value.
*/
const saveData = async () => {
// 清空错误提示
let { nodes } = editor.editorState.graph.save();
nodes.forEach((ele: any, idx: number) => {
ele.desc = '';
editor.updateModel(ele); // 更新流程图信息
});
let flow_id = getFlowId(); // flow_id 流程ID
// 未点击任何节点时,提示促使用户点击节点
if (_.isEmpty(state.node_tree)) {
// TAG: 检查节点是否完整
const checkResult = await checkAllFlowNodePropertyAPI({ flow_id: +flow_id })
if (checkResult.code) {
const noticeError = (checkResult) => {
let { nodes, edges } = editor.editorState.graph.save();
let available_keys = _.map(nodes, 'id'); // 画布上存在的有效节点ID
let raw_keys = _.intersection(checkResult.data, available_keys); // 取交集有效ID
......@@ -1945,6 +1930,24 @@ export default {
});
return;
}
}
const saveData = async () => {
// 清空错误提示
let { nodes } = editor.editorState.graph.save();
nodes.forEach((ele: any, idx: number) => {
ele.desc = '';
editor.updateModel(ele); // 更新流程图信息
});
let flow_id = getFlowId(); // flow_id 流程ID
// 未点击任何节点时,提示促使用户点击节点
if (_.isEmpty(state.node_tree)) {
// TAG: 检查节点是否完整
const checkResult = await checkAllFlowNodePropertyAPI({ flow_id: +flow_id })
if (checkResult.code) {
noticeError(checkResult);
} else {
// 保存流程图结构
saveFlowData();
......@@ -1956,32 +1959,11 @@ export default {
return;
}
// TAG: 检查节点是否完整
// 检查点击节点后通过了,但是还有未通过的节点没有点击时
const checkResult = await checkAllFlowNodePropertyAPI({ flow_id: +flow_id })
if (checkResult.code) {
let { nodes, edges } = editor.editorState.graph.save();
let available_keys = _.map(nodes, 'id'); // 画布上存在的有效节点ID
let raw_keys = _.intersection(checkResult.data, available_keys); // 取交集有效ID
let node_keys = Object.keys(state.node_tree); // 现在本地的ID都是有效的值
let result = _.difference(raw_keys, node_keys);
if (result.length) {
ElMessage({
type: 'error',
message: '流程配置不完善,请点击节点红点完善。',
});
let { nodes } = editor.editorState.graph.save();
nodes.forEach((ele: any, idx: number) => {
result.forEach((key: string) => {
if (ele.id === key) {
ele.desc = 'https://cdn.ipadbiz.cn/oa/flow/icons-error1.png';
editor.updateModel(ele); // 更新流程图信息
}
})
});
return;
}
noticeError(checkResult);
}
ElMessageBox.confirm(
......