| | |
| | | return [...detail.items, summaryRow] |
| | | }) |
| | | |
| | | const taskId = computed(() => { |
| | | return String(route.params.taskId || '') |
| | | }) |
| | | |
| | | // 状态映射(后端中文 -> 前端枚举) |
| | | const statusServerToUi: Record<string, string> = { |
| | | '待上传文件': 'WAIT_UPLOAD', |
| | |
| | | |
| | | onMounted(async () => { |
| | | const orderId = String(route.params.id || '') |
| | | console.log(route.params.taskId) |
| | | if (!orderId) return |
| | | |
| | | try { |
| | |
| | | }) |
| | | |
| | | const orderId = String(route.params.id || '') |
| | | console.log(String(route.params.taskId || '')) |
| | | const taskId1 = taskId.value |
| | | const userId = userStore.getUserId ? Number(userStore.getUserId) : undefined |
| | | const comments = approvalForm.comments.trim() |
| | | |
| | |
| | | // 调用审批通过API |
| | | const result = await approveOrder({ |
| | | orderId: orderId, |
| | | taskId: taskId1, |
| | | approvalOpinion: comments, |
| | | approverId: userId, |
| | | approverName: userStore.getUserDetail || '管理员', |
| | | approvalType: isAgreementOrder.value ? '审批' : '授权', |
| | | approvalResult: '通过' |
| | | approvalResult: '通过', |
| | | orderDetails: form.items.map((item: any) => ({ |
| | | id: item.id, |
| | | remarks: item.remark || '' // 使用表单中的备注 |
| | | })) |
| | | }) |
| | | |
| | | if (result && result.code === 200) { |
| | | // 更新交易信息备注(只更新remarks,不更新订单状态) |
| | | const updateData = { |
| | | orderId: orderId, |
| | | orderDetails: form.items.map((item: any) => ({ |
| | | id: item.id, |
| | | remarks: item.remark || '' // 使用表单中的备注 |
| | | })) |
| | | } |
| | | |
| | | await orderApi.updateOrderDetailRemarksOnly(updateData) |
| | | |
| | | // 审批通过后,使用新的API接口更新订单状态到下一个状态 |
| | | await orderApi.updateOrderStatusToNext(orderId) |
| | | // const updateData = { |
| | | // orderId: orderId, |
| | | // orderDetails: form.items.map((item: any) => ({ |
| | | // id: item.id, |
| | | // remarks: item.remark || '' // 使用表单中的备注 |
| | | // })) |
| | | // } |
| | | // |
| | | // await orderApi.updateOrderDetailRemarksOnly(updateData) |
| | | // |
| | | // // 审批通过后,使用新的API接口更新订单状态到下一个状态 |
| | | // await orderApi.updateOrderStatusToNext(orderId) |
| | | ElMessage.success('审批通过成功') |
| | | if(!detail.workflowId.value){ |
| | | ElMessage.error("工作流id为空不能进行工作流任务提交") |
| | | return |
| | | } |
| | | // 调用工作流 |
| | | const wfRes: any = await workFlowApi.completeWorkflow({ |
| | | taskId: String(detail.workflowId.value), |
| | | userid: userStore.getUserId, |
| | | commponet: '审核通过' |
| | | }) |
| | | if (wfRes?.code === 200 && wfRes.data?.processinstId) { |
| | | console.log('工作流提交成功') |
| | | } |
| | | // if(!detail.workflowId.value){ |
| | | // ElMessage.error("工作流id为空不能进行工作流任务提交") |
| | | // return |
| | | // } |
| | | // // 调用工作流 |
| | | // const wfRes: any = await workFlowApi.completeWorkflow({ |
| | | // taskId: String(detail.workflowId.value), |
| | | // userid: userStore.getUserId, |
| | | // commponet: '审核通过' |
| | | // }) |
| | | // if (wfRes?.code === 200 && wfRes.data?.processinstId) { |
| | | // console.log('工作流提交成功') |
| | | // } |
| | | router.back() |
| | | } else { |
| | | ElMessage.error(result?.msg || '审批通过失败') |
| | |
| | | const orderId = String(route.params.id || '') |
| | | const userId = userStore.getUserId ? Number(userStore.getUserId) : undefined |
| | | const comments = approvalForm.comments.trim() |
| | | const taskId1 = String(route.params.taskId || '') |
| | | |
| | | if (!orderId || !userId) { |
| | | ElMessage.error('订单ID或用户ID不能为空') |
| | |
| | | orderId: orderId, |
| | | approvalOpinion: comments, |
| | | approverId: userId, |
| | | taskId: taskId1, |
| | | approverName: userStore.getUserDetail || '管理员', |
| | | approvalType: isAgreementOrder.value ? '审批' : '授权', |
| | | approvalResult: '驳回' |
| | |
| | | |
| | | if (result && result.code === 200) { |
| | | // 驳回订单,更新订单状态到上一个状态 |
| | | await orderApi.updateOrderStatusToPrevious(orderId) |
| | | // await orderApi.updateOrderStatusToPrevious(orderId) |
| | | ElMessage.success('驳回成功') |
| | | // 调用工作流 |
| | | const wfRes: any = await workFlowApi.rejectStartNodeWorkflow({ |
| | | taskId: String(detail.workflowId.value), |
| | | userid: userStore.getUserId, |
| | | commponet: '驳回' |
| | | }) |
| | | if (wfRes?.code === 200 && wfRes.data?.processinstId) { |
| | | console.log('工作流驳回成功') |
| | | } |
| | | // const wfRes: any = await workFlowApi.rejectStartNodeWorkflow({ |
| | | // taskId: String(detail.workflowId.value), |
| | | // userid: userStore.getUserId, |
| | | // commponet: '驳回' |
| | | // }) |
| | | // if (wfRes?.code === 200 && wfRes.data?.processinstId) { |
| | | // console.log('工作流驳回成功') |
| | | // } |
| | | router.back() |
| | | } else { |
| | | ElMessage.error(result?.msg || '驳回失败') |