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