fix:修复仿真执行流程bug
This commit is contained in:
@@ -440,11 +440,11 @@ const changeCurrentFlowNodeFun = (info: any) => {
|
||||
onlineFileParam.value = {
|
||||
processDefinitionId: process.processDefinitionId,
|
||||
runId: data.runId,
|
||||
nodeId: data.uuid,
|
||||
nodeId: data.nodeId,
|
||||
beforeNodeId: flowNodeParamData.value?.beforeNodeId,
|
||||
regexConfig: {
|
||||
masterFileRegularStr: '^aa\\.xml$',
|
||||
inputFilesRegularStr: '^.+\\.json$',
|
||||
masterFileRegularStr: base64ToStrFun(flowNodeParamData.value?.inputFormat) || '',
|
||||
inputFilesRegularStr: base64ToStrFun(flowNodeParamData.value?.outputFormat) || '',
|
||||
},
|
||||
};
|
||||
const params = data.userParams;
|
||||
|
||||
@@ -29,7 +29,6 @@ const emits = defineEmits(['change', 'update', 'execute']);
|
||||
const contentLoading = ref(false);
|
||||
|
||||
const graph = ref<any>();
|
||||
const flowName = ref<any>();
|
||||
|
||||
const nodeDataList = ref<any>([]);
|
||||
const runProcessInfo = ref<any>({});
|
||||
@@ -48,98 +47,108 @@ const querLlistSimulationFlowNode = async (id: any) => {
|
||||
|
||||
const getFlowDetail = async (uuid: string) => {
|
||||
contentLoading.value = true;
|
||||
const res: any = await queryFlowTemplateDetailApi({ uuid: uuid, status: 1 });
|
||||
if (res.code === 200) {
|
||||
if (res.data.viewContent.length > 50) {
|
||||
const dataJson = JSON.parse(res.data.viewContent);
|
||||
// // 过滤起始节点和结束节点
|
||||
const beginandend = dataJson.cells.filter((item: any) => {
|
||||
return (
|
||||
item.type === 'local' ||
|
||||
item?.data?.label === '起始节点' ||
|
||||
item?.data?.label === '结束节点'
|
||||
);
|
||||
});
|
||||
const ids = beginandend.map((item: any) => {
|
||||
return item.id;
|
||||
});
|
||||
dataJson.cells = dataJson.cells.filter((item: any) => {
|
||||
return (
|
||||
!ids.includes(item.id) &&
|
||||
!ids.includes(item?.source?.cell) &&
|
||||
!ids.includes(item?.target?.cell)
|
||||
);
|
||||
});
|
||||
const nodes = dataJson.cells.filter((item: any) => {
|
||||
return item?.type;
|
||||
});
|
||||
|
||||
// // 改变各个节点之间的距离
|
||||
let position = nodes.map((item: any) => {
|
||||
return item?.position?.x;
|
||||
});
|
||||
position = objectTypeArrayRemovesDuplicates(position, 2);
|
||||
let viewContent: any = props.runInfo?.viewContent || '';
|
||||
|
||||
// const num = dataJson.cells.length;
|
||||
position.sort((a: any, b: any) => {
|
||||
return a - b;
|
||||
});
|
||||
|
||||
// // 避免两个节点重合了
|
||||
for (let i = 0; i < dataJson.cells.length; i++) {
|
||||
if (dataJson.cells[i].type) {
|
||||
dataJson.cells[i].size.width = 220;
|
||||
const index = position.indexOf(dataJson.cells[i].position.x);
|
||||
|
||||
dataJson.cells[i].position.x = dataJson.cells[i].position.x + index * 70;
|
||||
// num > 5 ? dataJson.cells[i].position.x : dataJson.cells[i].position.x + i * 20;
|
||||
|
||||
for (let j = 0; j < nodeDataList.value.length; j++) {
|
||||
if (dataJson.cells[i].id === nodeDataList.value[j].nodeId) {
|
||||
dataJson.cells[i].data.flowNodeInfo = nodeDataList.value[j];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const paramNode = dataJson.cells.filter((item: any) => {
|
||||
return item.type;
|
||||
});
|
||||
|
||||
const nodeConfigList: any = {};
|
||||
for (let i = 0; i < paramNode.length; i++) {
|
||||
nodeConfigList[paramNode[i].data.label] = paramNode[i].data.pageConfigList;
|
||||
}
|
||||
|
||||
const userDetaileParams: any = {};
|
||||
|
||||
for (let i = 0; i < nodeDataList.value.length; i++) {
|
||||
userDetaileParams[nodeDataList.value[i].nodeName] = nodeDataList.value[i].userParams;
|
||||
}
|
||||
|
||||
emits('update', {
|
||||
list: nodeConfigList,
|
||||
param: userDetaileParams,
|
||||
nodeDatas: nodeDataList.value,
|
||||
flowNodeInfos: paramNode,
|
||||
});
|
||||
|
||||
setTimeout(() => {
|
||||
graph.value.fromJSON(dataJson);
|
||||
graph.value.centerContent();
|
||||
contentLoading.value = false;
|
||||
|
||||
if (graph.value) {
|
||||
setCurrentNodeFun();
|
||||
}
|
||||
}, 1000);
|
||||
} else {
|
||||
contentLoading.value = false;
|
||||
}
|
||||
flowName.value = res.data.templateName;
|
||||
if (viewContent?.length > 50) {
|
||||
setGraphNodeInfFun(viewContent);
|
||||
} else {
|
||||
ElMessage.error(res.message);
|
||||
const res: any = await queryFlowTemplateDetailApi({ uuid: uuid, status: 1 });
|
||||
if (res.code === 200) {
|
||||
if (res.data.viewContent.length > 50) {
|
||||
viewContent = res.data.viewContent;
|
||||
setGraphNodeInfFun(viewContent);
|
||||
} else {
|
||||
contentLoading.value = false;
|
||||
}
|
||||
} else {
|
||||
ElMessage.error(res.message);
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
const setGraphNodeInfFun = (viewContent: any) => {
|
||||
const dataJson = JSON.parse(viewContent);
|
||||
// // 过滤起始节点和结束节点
|
||||
const beginandend = dataJson.cells.filter((item: any) => {
|
||||
return (
|
||||
item.type === 'local' || item?.data?.label === '起始节点' || item?.data?.label === '结束节点'
|
||||
);
|
||||
});
|
||||
const ids = beginandend.map((item: any) => {
|
||||
return item.id;
|
||||
});
|
||||
dataJson.cells = dataJson.cells.filter((item: any) => {
|
||||
return (
|
||||
!ids.includes(item.id) &&
|
||||
!ids.includes(item?.source?.cell) &&
|
||||
!ids.includes(item?.target?.cell)
|
||||
);
|
||||
});
|
||||
const nodes = dataJson.cells.filter((item: any) => {
|
||||
return item?.type;
|
||||
});
|
||||
|
||||
// // 改变各个节点之间的距离
|
||||
let position = nodes.map((item: any) => {
|
||||
return item?.position?.x;
|
||||
});
|
||||
position = objectTypeArrayRemovesDuplicates(position, 2);
|
||||
|
||||
// const num = dataJson.cells.length;
|
||||
position.sort((a: any, b: any) => {
|
||||
return a - b;
|
||||
});
|
||||
|
||||
// // 避免两个节点重合了
|
||||
for (let i = 0; i < dataJson.cells.length; i++) {
|
||||
if (dataJson.cells[i].type) {
|
||||
dataJson.cells[i].size.width = 220;
|
||||
const index = position.indexOf(dataJson.cells[i].position.x);
|
||||
|
||||
dataJson.cells[i].position.x = dataJson.cells[i].position.x + index * 70;
|
||||
// num > 5 ? dataJson.cells[i].position.x : dataJson.cells[i].position.x + i * 20;
|
||||
|
||||
for (let j = 0; j < nodeDataList.value.length; j++) {
|
||||
if (dataJson.cells[i].id === nodeDataList.value[j].nodeId) {
|
||||
dataJson.cells[i].data.flowNodeInfo = nodeDataList.value[j];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const paramNode = dataJson.cells.filter((item: any) => {
|
||||
return item.type;
|
||||
});
|
||||
|
||||
const nodeConfigList: any = {};
|
||||
for (let i = 0; i < paramNode.length; i++) {
|
||||
nodeConfigList[paramNode[i].data.label] = paramNode[i].data.pageConfigList;
|
||||
}
|
||||
|
||||
const userDetaileParams: any = {};
|
||||
|
||||
for (let i = 0; i < nodeDataList.value.length; i++) {
|
||||
userDetaileParams[nodeDataList.value[i].nodeName] = nodeDataList.value[i].userParams;
|
||||
}
|
||||
|
||||
emits('update', {
|
||||
list: nodeConfigList,
|
||||
param: userDetaileParams,
|
||||
nodeDatas: nodeDataList.value,
|
||||
flowNodeInfos: paramNode,
|
||||
});
|
||||
|
||||
setTimeout(() => {
|
||||
graph.value.fromJSON(dataJson);
|
||||
graph.value.centerContent();
|
||||
contentLoading.value = false;
|
||||
|
||||
if (graph.value) {
|
||||
setCurrentNodeFun();
|
||||
}
|
||||
}, 1000);
|
||||
};
|
||||
|
||||
const selectNode = ref<any>({});
|
||||
|
||||
Reference in New Issue
Block a user