From 6ab7059be1fca7a21b2497d6314cab31571b55bd Mon Sep 17 00:00:00 2001 From: weibl Date: Tue, 2 Dec 2025 11:05:35 +0800 Subject: [PATCH 1/5] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E7=AE=AD=E5=A4=B4?= =?UTF-8?q?=E9=80=89=E4=B8=AD=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../creation/components/nodeEvents.ts | 45 ++++++++++++------- 1 file changed, 29 insertions(+), 16 deletions(-) diff --git a/src/views/simulation/creation/components/nodeEvents.ts b/src/views/simulation/creation/components/nodeEvents.ts index 4c90bdb..57a246a 100644 --- a/src/views/simulation/creation/components/nodeEvents.ts +++ b/src/views/simulation/creation/components/nodeEvents.ts @@ -14,16 +14,12 @@ let selectNode: any = null; export const initNodeEvents = (graph: any) => { graph.on('node:mouseenter', () => { const container = document.getElementById(FLOW_CREATE_ID)!; - const ports = container.querySelectorAll( - '.x6-port-body' - ) as NodeListOf; + const ports = container.querySelectorAll('.x6-port-body') as NodeListOf; showPorts(ports, true); }); graph.on('node:mouseleave', () => { const container = document.getElementById(FLOW_CREATE_ID)!; - const ports = container.querySelectorAll( - '.x6-port-body' - ) as NodeListOf; + const ports = container.querySelectorAll('.x6-port-body') as NodeListOf; showPorts(ports, false); }); graph.on('node:selected', () => { @@ -31,21 +27,18 @@ export const initNodeEvents = (graph: any) => { // const flowElement = document.getElementById('flow-create-content') as HTMLElement; // flowElement.tabIndex = -1; // flowElement.focus(); - }); - graph.on('node:unselected', ({ node }:any) => { + graph.on('node:unselected', ({ node }: any) => { console.log('unselected node', node); node.removeTools(); const container = document.getElementById(FLOW_CREATE_ID)!; - const ports = container.querySelectorAll( - '.x6-port-body' - ) as NodeListOf; + const ports = container.querySelectorAll('.x6-port-body') as NodeListOf; showPorts(ports, false); drawerVisible.value = false; selectNode = null; }); - graph.on('node:click', ({ node }:any) => { + graph.on('node:click', ({ node }: any) => { console.log('click node', node, node.data); if (node.data.isApp) { drawerVisible.value = true; @@ -73,6 +66,24 @@ export const initNodeEvents = (graph: any) => { }, }); }); + graph.on('edge:click', ({ edge }: any) => { + // graph.cleanSelection(); + edge.addTools({ + name: 'boundary', + args: { + padding: 5, + attrs: { + // fill: '#7c68fc', + stroke: '#333', + 'stroke-width': 0.5, + 'fill-opacity': 0.2, + }, + }, + }); + }); + graph.on('edge:unselected', ({ edge }: any) => { + edge.removeTools(); + }); }; export const useNodeEvents = () => { @@ -128,12 +139,15 @@ const zoomOutFun = (graph: any) => { const xAlign = (graph: any) => { const nodes = graph.getSelectedCells(); if (nodes.length > 2) { - nodes.sort((a:any, b:any) => { + nodes.sort((a: any, b: any) => { return a.position().x - b.position().x; }); const xLength = nodes[1].position().x - nodes[0].position().x - nodes[0].size().width; for (let index = 2; index < nodes.length; index++) { - nodes[index].position(nodes[index - 1].position().x + nodes[index - 1].size().width + xLength, nodes[index].position().y); + nodes[index].position( + nodes[index - 1].position().x + nodes[index - 1].size().width + xLength, + nodes[index].position().y + ); } } else { ElMessage.warning('请框选超过 2 个节点!'); @@ -185,7 +199,7 @@ export const nodeAttribute = reactive({ pageConfigList: [], }); -export const updateNodeAttribute = (val:any) => { +export const updateNodeAttribute = (val: any) => { for (const key in val) { nodeAttribute[key] = val[key]; } @@ -193,4 +207,3 @@ export const updateNodeAttribute = (val:any) => { selectNode.setData(nodeAttribute); } }; - From db7b8f965bef726dc251379dd2df46ebf09bd5ae Mon Sep 17 00:00:00 2001 From: weibl Date: Tue, 2 Dec 2025 11:06:14 +0800 Subject: [PATCH 2/5] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=88=86=E5=8F=91?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E5=9B=9E=E6=98=BE=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../task/simulationTask/confirmTask/index.vue | 197 ++++++++---------- 1 file changed, 89 insertions(+), 108 deletions(-) diff --git a/src/views/task/simulationTask/confirmTask/index.vue b/src/views/task/simulationTask/confirmTask/index.vue index 53acea6..d82c303 100644 --- a/src/views/task/simulationTask/confirmTask/index.vue +++ b/src/views/task/simulationTask/confirmTask/index.vue @@ -2,12 +2,12 @@
@@ -23,51 +23,11 @@
- - + @@ -105,26 +65,40 @@ - + - + - + @@ -10,13 +9,15 @@ :data="tableList" readonly :loading="tableLoading" - :specialActionList="[{ - title: '查看详情', - type: 'primary', - click: (row: any) => { - openTaskDetailDialogFun(row); + :specialActionList="[ + { + title: '查看详情', + type: 'primary', + click: (row: any) => { + openTaskDetailDialogFun(row); + }, }, - }]" + ]" > --> - - + - + @@ -44,10 +68,16 @@ :projectId="currentProjectInfo.id" :projectUuid="currentProjectInfo.uuid" :projectName="projectName" + freeze /> - + @@ -165,7 +195,11 @@ const openEditNodeDialogFun = () => { const showTaskDialog = ref(false); const openAddTaskDialogFun = () => { - showTaskDialog.value = true; + if (phaseListLength.value === 0) { + ElMessage.warning('请先创建阶段'); + } else { + showTaskDialog.value = true; + } }; const currentProjectInfo = reactive({ id: '', @@ -185,7 +219,7 @@ const currentProjectInfo = reactive({ memberList: [], }); -const updateProjectInfo = (projectInfo:any) => { +const updateProjectInfo = (projectInfo: any) => { for (const key in currentProjectInfo) { currentProjectInfo[key] = projectInfo[key]; } @@ -208,7 +242,7 @@ const updateProjectInfo = (projectInfo:any) => { // } // }; -const updateCurrentProjectBaseInfo = (projectInfo:any) => { +const updateCurrentProjectBaseInfo = (projectInfo: any) => { for (const key in currentProjectInfo) { currentProjectInfo[key] = projectInfo[key]; } @@ -217,7 +251,7 @@ const updateCurrentProjectBaseInfo = (projectInfo:any) => { const loadcaseRef = ref(); -const completeFun = (page:string) => { +const completeFun = (page: string) => { console.log('index completeFun', page); if (page === 'projectBasePage') { basePageRef.value.refresh(); @@ -231,8 +265,10 @@ const completeFun = (page:string) => { } }; -const closeProject = async() => { - const res:any = await editNodeApi({ editNodeList: [{ uuid: props.projectUuid, exeStatus: PROJECT_EXE_STATUS_CODE.CLOSED }] }); +const closeProject = async () => { + const res: any = await editNodeApi({ + editNodeList: [{ uuid: props.projectUuid, exeStatus: PROJECT_EXE_STATUS_CODE.CLOSED }], + }); if (res && res.code === 200) { ElMessage.success('关闭项目成功!'); } else { @@ -240,6 +276,12 @@ const closeProject = async() => { } }; +const phaseListLength = ref(0); + +const getPhaseListFun = (length: number) => { + phaseListLength.value = length; +}; + // if (route.query?.nodeId) { // projectUuid.value = route.query?.nodeId; // projectName.value = route.query?.nodeName; @@ -260,11 +302,11 @@ const closeProject = async() => { .app-container { padding: 16px; } -.select-content{ +.select-content { width: 500px; display: flex; align-items: center; - span{ + span { display: inline-block; width: 100px; white-space: nowrap;