diff --git a/common/utils/common.js b/common/utils/common.js index 8217e6c..ee33750 100644 --- a/common/utils/common.js +++ b/common/utils/common.js @@ -284,4 +284,34 @@ export const translateRoles = (roles = []) => { .filter(role => role && roleMap[role]) .map(role => roleMap[role]) .join(','); +} + +/** + * 跳转「作业填报」页(养护员实施) + * + * 实施动作除了处理情况,还要选作业类型、填数据中心配置的动态字段(业务类型+作业类型)、 + * 上传开始/进行中/结束/人员/材料五组照片,统一动作弹窗只有原因+单个附件,承载不了, + * 因此实施动作固定进「作业填报」页。 + * + * 工单数据存本地缓存,URL 只带临时 key,避免参数过长。 + * @param {Object} item 待办行数据,需包含 id(工单ID)与 taskId(流程任务ID) + * @returns {Boolean} 是否成功跳转 + */ +export const toWorkerImplementPage = (item) => { + if (!item || !item.id || !item.taskId) { + uni.showToast({ title: '工单信息异常,无法实施', icon: 'none' }); + return false; + } + const tempKey = `maintain_order_${Date.now()}_${Math.floor(Math.random() * 10000)}`; + try { + uni.setStorageSync(tempKey, item); + } catch (error) { + console.error('存储养护工单数据失败:', error); + uni.showToast({ title: '数据存储异常,无法跳转', icon: 'none' }); + return false; + } + uni.navigateTo({ + url: `/pages-sub/problem/work-order-manage/add-maintain-order?tempKey=${tempKey}` + }); + return true; } \ No newline at end of file diff --git a/pages-sub/problem/ai-manage/index.vue b/pages-sub/problem/ai-manage/index.vue index 9acad73..a0a908a 100644 --- a/pages-sub/problem/ai-manage/index.vue +++ b/pages-sub/problem/ai-manage/index.vue @@ -276,7 +276,7 @@ import { } from '@/api/regional-order-manage/regional-order-manage' import { getTaskActions } from '@/api/work-order-manage/work-order-manage' import { useUserStore } from '@/pinia/user'; -import { nextStepMap, buzStatusMap, getActionButtonType } from '@/common/utils/common' +import { nextStepMap, buzStatusMap, getActionButtonType, toWorkerImplementPage } from '@/common/utils/common' import { useUploadImgs } from '@/common/utils/useUploadImgs' // ========== 全局实例 & 常量 ========== @@ -516,8 +516,14 @@ const handleUnifiedProcess = async (item, action = null) => { ? item.configuredActions : await queryUnifiedActions(item) if (actions) { + const target = action || actions[0] + // 实施动作要选作业类型、填动态字段、传五组照片,统一动作弹窗承载不了,进「作业填报」页 + if (target?.code === 'HANDLE') { + toWorkerImplementPage(item) + return + } // 传入的动作即用户点击的配置按钮,直接执行该动作,不再弹「请选择操作」二次选择 - unifiedActionsRef.value?.open(item, [action || actions[0]]) + unifiedActionsRef.value?.open(item, [target]) return } handleProcess(item) diff --git a/pages-sub/problem/regional-order-manage/index.vue b/pages-sub/problem/regional-order-manage/index.vue index bf3f2bc..cc9792e 100644 --- a/pages-sub/problem/regional-order-manage/index.vue +++ b/pages-sub/problem/regional-order-manage/index.vue @@ -241,7 +241,7 @@ import { } from '@/api/regional-order-manage/regional-order-manage' import { getTaskActions } from '@/api/work-order-manage/work-order-manage' import { useUserStore } from '@/pinia/user'; -import { nextStepMap, buzStatusMap, getActionButtonType } from '@/common/utils/common' +import { nextStepMap, buzStatusMap, getActionButtonType, toWorkerImplementPage } from '@/common/utils/common' import { useUploadImgs } from '@/common/utils/useUploadImgs' // ========== 全局实例 & 常量 ========== @@ -497,8 +497,14 @@ const handleUnifiedProcess = async (item, action = null) => { ? item.configuredActions : await queryUnifiedActions(item) if (actions) { + const target = action || actions[0] + // 实施动作要选作业类型、填动态字段、传五组照片,统一动作弹窗承载不了,进「作业填报」页 + if (target?.code === 'HANDLE') { + toWorkerImplementPage(item) + return + } // 传入的动作即用户点击的配置按钮,直接执行该动作,不再弹「请选择操作」二次选择 - unifiedActionsRef.value?.open(item, [action || actions[0]]) + unifiedActionsRef.value?.open(item, [target]) return } handleProcess(item) diff --git a/pages-sub/problem/regional-order-manage/list-detail.vue b/pages-sub/problem/regional-order-manage/list-detail.vue index 36fbcd9..de878f4 100644 --- a/pages-sub/problem/regional-order-manage/list-detail.vue +++ b/pages-sub/problem/regional-order-manage/list-detail.vue @@ -337,7 +337,7 @@ import { timeFormat } from '@/uni_modules/uview-plus' import { getApprovalDetail,workOrderDetailByID } from '@/api/regional-order-manage/regional-order-manage' import { getTaskActions } from '@/api/work-order-manage/work-order-manage' -import { nextStepMap, calculateFormatTimeDiff, getActionButtonType } from '@/common/utils/common' +import { nextStepMap, calculateFormatTimeDiff, getActionButtonType, toWorkerImplementPage } from '@/common/utils/common' import { useUploadImgs } from '@/common/utils/useUploadImgs' import { useUserStore } from '@/pinia/user' @@ -552,8 +552,14 @@ const handleUnifiedProcess = async (item: any, action: any = null) => { ? configuredActions.value : await queryUnifiedActions(item?.taskId) if (actions) { + const target = action || actions[0] + // 实施动作要选作业类型、填动态字段、传五组照片,统一动作弹窗承载不了,进「作业填报」页 + if (target?.code === 'HANDLE') { + toWorkerImplementPage(item) + return + } // 传入的动作即用户点击的配置按钮,直接执行该动作,不再弹「请选择操作」二次选择 - unifiedActionsRef.value?.open(item, [action || actions[0]]) + unifiedActionsRef.value?.open(item, [target]) return } handleProcess(item) diff --git a/pages-sub/problem/regional-order-manage/order-detail.vue b/pages-sub/problem/regional-order-manage/order-detail.vue index 81348e3..851dfc6 100644 --- a/pages-sub/problem/regional-order-manage/order-detail.vue +++ b/pages-sub/problem/regional-order-manage/order-detail.vue @@ -381,7 +381,7 @@ import { dcyUniversalApproval, aiUniversalApproval } from '@/api/regional-order-manage/regional-order-manage'; -import {nextStepMap, buzStatusMap, calculateFormatTimeDiff, getActionButtonType} from '@/common/utils/common' +import {nextStepMap, buzStatusMap, calculateFormatTimeDiff, getActionButtonType, toWorkerImplementPage} from '@/common/utils/common' import {getTaskActions} from '@/api/work-order-manage/work-order-manage'; import {useUploadImgs} from '@/common/utils/useUploadImgs' import { useUserStore } from '@/pinia/user'; @@ -622,8 +622,14 @@ const handleUnifiedProcess = async (item: any, action: any = null) => { ? configuredActions.value : await queryUnifiedActions(item?.taskId) if (actions) { + const target = action || actions[0] + // 实施动作要选作业类型、填动态字段、传五组照片,统一动作弹窗承载不了,进「作业填报」页 + if (target?.code === 'HANDLE') { + toWorkerImplementPage(item) + return + } // 传入的动作即用户点击的配置按钮,直接执行该动作,不再弹「请选择操作」二次选择 - unifiedActionsRef.value?.open(item, [action || actions[0]]) + unifiedActionsRef.value?.open(item, [target]) return } handleProcess(item) diff --git a/pages-sub/problem/work-order-manage/index.vue b/pages-sub/problem/work-order-manage/index.vue index da4909c..9a32a79 100644 --- a/pages-sub/problem/work-order-manage/index.vue +++ b/pages-sub/problem/work-order-manage/index.vue @@ -298,7 +298,7 @@ import { } from '@/api/work-order-manage/work-order-manage' // 从用户store获取角色信息 import { useUserStore } from '@/pinia/user'; -import { nextStepMap, buzStatusMap, getActionButtonType } from '@/common/utils/common' +import { nextStepMap, buzStatusMap, getActionButtonType, toWorkerImplementPage } from '@/common/utils/common' // 引入图片上传组合式函数(与参考页面一致) import { useUploadImgs } from '@/common/utils/useUploadImgs' @@ -556,8 +556,14 @@ const handleUnifiedProcess = async (item, action = null) => { ? item.configuredActions : await queryUnifiedActions(item) if (actions) { + const target = action || actions[0] + // 实施动作要选作业类型、填动态字段、传五组照片,统一动作弹窗承载不了,进「作业填报」页 + if (target?.code === 'HANDLE') { + toWorkerImplementPage(item) + return + } // 传入的动作即用户点击的配置按钮,直接执行该动作,不再弹「请选择操作」二次选择 - unifiedActionsRef.value?.open(item, [action || actions[0]]) + unifiedActionsRef.value?.open(item, [target]) return } handleProcess(item) diff --git a/pages-sub/problem/work-order-manage/order-detail.vue b/pages-sub/problem/work-order-manage/order-detail.vue index d115782..e96919e 100644 --- a/pages-sub/problem/work-order-manage/order-detail.vue +++ b/pages-sub/problem/work-order-manage/order-detail.vue @@ -418,7 +418,7 @@ import { getTaskActions } from '@/api/work-order-manage/work-order-manage'; import {getWorkRecordValues} from '@/api/common' -import {nextStepMap, buzStatusMap, calculateFormatTimeDiff, getActionButtonType} from '@/common/utils/common' +import {nextStepMap, buzStatusMap, calculateFormatTimeDiff, getActionButtonType, toWorkerImplementPage} from '@/common/utils/common' // 引入图片上传组合式函数 import {useUploadImgs} from '@/common/utils/useUploadImgs' @@ -853,8 +853,14 @@ const handleUnifiedProcess = async (item: any, action: any = null) => { ? configuredActions.value : await queryUnifiedActions(item) if (actions) { + const target = action || actions[0] + // 实施动作要选作业类型、填动态字段、传五组照片,统一动作弹窗承载不了,进「作业填报」页 + if (target?.code === 'HANDLE') { + toWorkerImplementPage(item) + return + } // 传入的动作即用户点击的配置按钮,直接执行该动作,不再弹「请选择操作」二次选择 - unifiedActionsRef.value?.open(item, [action || actions[0]]) + unifiedActionsRef.value?.open(item, [target]) return } handleProcess(item)