From 28781b5b6196d2a0b6d2563f793c61b67eb5086c Mon Sep 17 00:00:00 2001 From: zch Date: Fri, 30 May 2025 16:09:32 +0800 Subject: [PATCH] =?UTF-8?q?change(dms):=20=E6=B6=A6=E6=BB=91=E5=B7=A5?= =?UTF-8?q?=E5=8D=95=E5=88=97=E8=A1=A8=E6=B7=BB=E5=8A=A0=E5=B7=A5=E4=BD=9C?= =?UTF-8?q?=E6=B5=81=E5=90=AF=E5=8A=A8=E5=8A=9F=E8=83=BD=EF=BC=8C=E5=B7=A5?= =?UTF-8?q?=E5=8D=95=E5=AE=9E=E4=BE=8B=E7=95=8C=E9=9D=A2=E7=94=B1=E6=88=91?= =?UTF-8?q?=E7=9A=84=E5=BE=85=E5=8A=9E=E8=B7=B3=E8=BD=AC=E3=80=82=E5=8F=AA?= =?UTF-8?q?=E5=A4=84=E7=90=86=E5=BD=93=E5=89=8D=E6=B5=81=E7=A8=8B=EF=BC=8C?= =?UTF-8?q?=E5=A4=84=E7=90=86=E5=AE=8C=E5=85=B3=E9=97=AD=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在润滑工单列表中添加启动工单按钮 - 实现启动工作流的逻辑,包括确认对话框、工单状态更新和任务变量准备 - 添加工作流处理组件,用于处理第一个节点的审批 --- src/api/dms/dmsBillsLubeInstance/types.ts | 16 + src/views/dms/dmsBillsLubeInstance/index.vue | 102 +- .../dmsBillsLubeInstanceActivity/index.vue | 983 +++++------------- 3 files changed, 394 insertions(+), 707 deletions(-) diff --git a/src/api/dms/dmsBillsLubeInstance/types.ts b/src/api/dms/dmsBillsLubeInstance/types.ts index 8edf270..d7a441d 100644 --- a/src/api/dms/dmsBillsLubeInstance/types.ts +++ b/src/api/dms/dmsBillsLubeInstance/types.ts @@ -68,6 +68,12 @@ export interface DmsBillsLubeInstanceVO { * 润滑工单编号 */ planLubeCode: string; + + /** + * 流程定义ID + */ + wfDefinitionId: string | number; + } export interface DmsBillsLubeInstanceForm extends BaseEntity { @@ -150,6 +156,10 @@ export interface DmsBillsLubeInstanceForm extends BaseEntity { createTime?: string; + /** + * 流程定义ID + */ + wfDefinitionId?: string | number; } @@ -228,6 +238,12 @@ export interface DmsBillsLubeInstanceQuery extends PageQuery { createBy?: string; createTime?: string; + + /** + * 流程定义ID + */ + wfDefinitionId?: string | number; + } diff --git a/src/views/dms/dmsBillsLubeInstance/index.vue b/src/views/dms/dmsBillsLubeInstance/index.vue index 8884c47..53d1e9e 100644 --- a/src/views/dms/dmsBillsLubeInstance/index.vue +++ b/src/views/dms/dmsBillsLubeInstance/index.vue @@ -139,21 +139,36 @@ + + + + @@ -251,6 +266,8 @@ import { listDmsBillsLubeInstance, getDmsBillsLubeInstance, delDmsBillsLubeInstance, addDmsBillsLubeInstance, updateDmsBillsLubeInstance } from '@/api/dms/dmsBillsLubeInstance'; import { DmsBillsLubeInstanceVO, DmsBillsLubeInstanceQuery, DmsBillsLubeInstanceForm } from '@/api/dms/dmsBillsLubeInstance/types'; import { useRouter } from 'vue-router'; +import { startWorkFlow } from '@/api/workflow/task' +import SubmitVerify from '@/components/Process/submitVerify.vue' const { proxy } = getCurrentInstance() as ComponentInternalInstance; const { active_flag, lube_level, lube_status } = toRefs(proxy?.useDict('active_flag', 'lube_level', 'lube_status')); @@ -430,11 +447,92 @@ const handleExport = () => { }, `dmsBillsLubeInstance_${new Date().getTime()}.xlsx`) } +/** 详情按钮 */ const router = useRouter(); const handleShowDetail = (row: DmsBillsLubeInstanceVO) => { router.push('/dms/dmsBillsLubeInstanceActivity/index/' + row.lubeInstanceId) } +// 启动工单工作流 +const handleStartWorkflow = async (row: DmsBillsLubeInstanceVO) => { + try { + const confirmResult = await proxy?.$modal.confirm( + `确认启动润滑工单"${row.billsLubeCode}"的工作流?` + ); + + if (confirmResult) { + buttonLoading.value = true; + + // 启动工作流 + const workflowData = { + businessId: row.lubeInstanceId, + flowCode: 'Lube01', + variables: { + lubeInstanceId: row.lubeInstanceId, + billsLubeCode: row.billsLubeCode, + lubeLevel: row.lubeLevel + } + }; + + const workflowRes = await startWorkFlow(workflowData); + + // 更新工单的工作流定义ID + await updateDmsBillsLubeInstance({ + ...row, + wfDefinitionId: workflowRes.data.taskId, + status: 'waiting' + }); + + // 准备第一个节点的任务变量 + taskVariables.value = { + entity: { + lubeInstanceId: row.lubeInstanceId, + lubeLevel: row.lubeLevel, + lubeGroup: row.lubeGroup, + lubeSupervisor: row.lubeSupervisor, + processStepOrder: 1 + } + }; + + proxy?.$modal.msgSuccess('工单工作流启动成功'); + + // 立即打开审批组件处理第一个节点(工单创建) + if (submitVerifyRef.value && workflowRes.data.taskId) { + submitVerifyRef.value.openDialog(workflowRes.data.taskId); + } + } + } catch (error) { + console.error('启动工作流失败:', error); + proxy?.$modal.msgError('启动工作流失败'); + } finally { + buttonLoading.value = false; + } +}; + +// 查看工单进度 +const handleWorkflowProgress = (row: DmsBillsLubeInstanceVO) => { + // 跳转到审批记录查看页面 + router.push({ + path: '/workflow/process/record', + query: { businessId: row.lubeInstanceId } + }); +}; + +const submitVerifyRef = ref>(); +const taskVariables = ref({}); + +// 提交回调 - 处理工作流节点完成后的逻辑 +const submitCallback = async () => { + try { + // 工作流节点处理完成,刷新列表 + await getList(); + proxy?.$modal.msgSuccess('工单创建节点处理完成,工作流已流转到下一步'); + } catch (error) { + console.error('刷新列表失败:', error); + proxy?.$modal.msgError('刷新列表失败'); + } +}; + onMounted(() => { getList(); }); diff --git a/src/views/dms/dmsBillsLubeInstanceActivity/index.vue b/src/views/dms/dmsBillsLubeInstanceActivity/index.vue index 760111e..94dab35 100644 --- a/src/views/dms/dmsBillsLubeInstanceActivity/index.vue +++ b/src/views/dms/dmsBillsLubeInstanceActivity/index.vue @@ -1,796 +1,369 @@ - - - - + \ No newline at end of file