Commit 98689726fd03c0317efdbd7a0700e444d0994703
1 parent
e491df85
业务线 小程序不用写死,从后端接口获取
Showing
7 changed files
with
78 additions
and
12 deletions
common/utils/common.js
| ... | ... | @@ -284,4 +284,34 @@ export const translateRoles = (roles = []) => { |
| 284 | 284 | .filter(role => role && roleMap[role]) |
| 285 | 285 | .map(role => roleMap[role]) |
| 286 | 286 | .join(','); |
| 287 | +} | |
| 288 | + | |
| 289 | +/** | |
| 290 | + * 跳转「作业填报」页(养护员实施) | |
| 291 | + * | |
| 292 | + * 实施动作除了处理情况,还要选作业类型、填数据中心配置的动态字段(业务类型+作业类型)、 | |
| 293 | + * 上传开始/进行中/结束/人员/材料五组照片,统一动作弹窗只有原因+单个附件,承载不了, | |
| 294 | + * 因此实施动作固定进「作业填报」页。 | |
| 295 | + * | |
| 296 | + * 工单数据存本地缓存,URL 只带临时 key,避免参数过长。 | |
| 297 | + * @param {Object} item 待办行数据,需包含 id(工单ID)与 taskId(流程任务ID) | |
| 298 | + * @returns {Boolean} 是否成功跳转 | |
| 299 | + */ | |
| 300 | +export const toWorkerImplementPage = (item) => { | |
| 301 | + if (!item || !item.id || !item.taskId) { | |
| 302 | + uni.showToast({ title: '工单信息异常,无法实施', icon: 'none' }); | |
| 303 | + return false; | |
| 304 | + } | |
| 305 | + const tempKey = `maintain_order_${Date.now()}_${Math.floor(Math.random() * 10000)}`; | |
| 306 | + try { | |
| 307 | + uni.setStorageSync(tempKey, item); | |
| 308 | + } catch (error) { | |
| 309 | + console.error('存储养护工单数据失败:', error); | |
| 310 | + uni.showToast({ title: '数据存储异常,无法跳转', icon: 'none' }); | |
| 311 | + return false; | |
| 312 | + } | |
| 313 | + uni.navigateTo({ | |
| 314 | + url: `/pages-sub/problem/work-order-manage/add-maintain-order?tempKey=${tempKey}` | |
| 315 | + }); | |
| 316 | + return true; | |
| 287 | 317 | } |
| 288 | 318 | \ No newline at end of file | ... | ... |
pages-sub/problem/ai-manage/index.vue
| ... | ... | @@ -276,7 +276,7 @@ import { |
| 276 | 276 | } from '@/api/regional-order-manage/regional-order-manage' |
| 277 | 277 | import { getTaskActions } from '@/api/work-order-manage/work-order-manage' |
| 278 | 278 | import { useUserStore } from '@/pinia/user'; |
| 279 | -import { nextStepMap, buzStatusMap, getActionButtonType } from '@/common/utils/common' | |
| 279 | +import { nextStepMap, buzStatusMap, getActionButtonType, toWorkerImplementPage } from '@/common/utils/common' | |
| 280 | 280 | import { useUploadImgs } from '@/common/utils/useUploadImgs' |
| 281 | 281 | |
| 282 | 282 | // ========== 全局实例 & 常量 ========== |
| ... | ... | @@ -516,8 +516,14 @@ const handleUnifiedProcess = async (item, action = null) => { |
| 516 | 516 | ? item.configuredActions |
| 517 | 517 | : await queryUnifiedActions(item) |
| 518 | 518 | if (actions) { |
| 519 | + const target = action || actions[0] | |
| 520 | + // 实施动作要选作业类型、填动态字段、传五组照片,统一动作弹窗承载不了,进「作业填报」页 | |
| 521 | + if (target?.code === 'HANDLE') { | |
| 522 | + toWorkerImplementPage(item) | |
| 523 | + return | |
| 524 | + } | |
| 519 | 525 | // 传入的动作即用户点击的配置按钮,直接执行该动作,不再弹「请选择操作」二次选择 |
| 520 | - unifiedActionsRef.value?.open(item, [action || actions[0]]) | |
| 526 | + unifiedActionsRef.value?.open(item, [target]) | |
| 521 | 527 | return |
| 522 | 528 | } |
| 523 | 529 | handleProcess(item) | ... | ... |
pages-sub/problem/regional-order-manage/index.vue
| ... | ... | @@ -241,7 +241,7 @@ import { |
| 241 | 241 | } from '@/api/regional-order-manage/regional-order-manage' |
| 242 | 242 | import { getTaskActions } from '@/api/work-order-manage/work-order-manage' |
| 243 | 243 | import { useUserStore } from '@/pinia/user'; |
| 244 | -import { nextStepMap, buzStatusMap, getActionButtonType } from '@/common/utils/common' | |
| 244 | +import { nextStepMap, buzStatusMap, getActionButtonType, toWorkerImplementPage } from '@/common/utils/common' | |
| 245 | 245 | import { useUploadImgs } from '@/common/utils/useUploadImgs' |
| 246 | 246 | |
| 247 | 247 | // ========== 全局实例 & 常量 ========== |
| ... | ... | @@ -497,8 +497,14 @@ const handleUnifiedProcess = async (item, action = null) => { |
| 497 | 497 | ? item.configuredActions |
| 498 | 498 | : await queryUnifiedActions(item) |
| 499 | 499 | if (actions) { |
| 500 | + const target = action || actions[0] | |
| 501 | + // 实施动作要选作业类型、填动态字段、传五组照片,统一动作弹窗承载不了,进「作业填报」页 | |
| 502 | + if (target?.code === 'HANDLE') { | |
| 503 | + toWorkerImplementPage(item) | |
| 504 | + return | |
| 505 | + } | |
| 500 | 506 | // 传入的动作即用户点击的配置按钮,直接执行该动作,不再弹「请选择操作」二次选择 |
| 501 | - unifiedActionsRef.value?.open(item, [action || actions[0]]) | |
| 507 | + unifiedActionsRef.value?.open(item, [target]) | |
| 502 | 508 | return |
| 503 | 509 | } |
| 504 | 510 | handleProcess(item) | ... | ... |
pages-sub/problem/regional-order-manage/list-detail.vue
| ... | ... | @@ -337,7 +337,7 @@ import { timeFormat } from '@/uni_modules/uview-plus' |
| 337 | 337 | import { getApprovalDetail,workOrderDetailByID } from '@/api/regional-order-manage/regional-order-manage' |
| 338 | 338 | import { getTaskActions } from '@/api/work-order-manage/work-order-manage' |
| 339 | 339 | |
| 340 | -import { nextStepMap, calculateFormatTimeDiff, getActionButtonType } from '@/common/utils/common' | |
| 340 | +import { nextStepMap, calculateFormatTimeDiff, getActionButtonType, toWorkerImplementPage } from '@/common/utils/common' | |
| 341 | 341 | import { useUploadImgs } from '@/common/utils/useUploadImgs' |
| 342 | 342 | import { useUserStore } from '@/pinia/user' |
| 343 | 343 | |
| ... | ... | @@ -552,8 +552,14 @@ const handleUnifiedProcess = async (item: any, action: any = null) => { |
| 552 | 552 | ? configuredActions.value |
| 553 | 553 | : await queryUnifiedActions(item?.taskId) |
| 554 | 554 | if (actions) { |
| 555 | + const target = action || actions[0] | |
| 556 | + // 实施动作要选作业类型、填动态字段、传五组照片,统一动作弹窗承载不了,进「作业填报」页 | |
| 557 | + if (target?.code === 'HANDLE') { | |
| 558 | + toWorkerImplementPage(item) | |
| 559 | + return | |
| 560 | + } | |
| 555 | 561 | // 传入的动作即用户点击的配置按钮,直接执行该动作,不再弹「请选择操作」二次选择 |
| 556 | - unifiedActionsRef.value?.open(item, [action || actions[0]]) | |
| 562 | + unifiedActionsRef.value?.open(item, [target]) | |
| 557 | 563 | return |
| 558 | 564 | } |
| 559 | 565 | handleProcess(item) | ... | ... |
pages-sub/problem/regional-order-manage/order-detail.vue
| ... | ... | @@ -381,7 +381,7 @@ import { |
| 381 | 381 | dcyUniversalApproval, |
| 382 | 382 | aiUniversalApproval |
| 383 | 383 | } from '@/api/regional-order-manage/regional-order-manage'; |
| 384 | -import {nextStepMap, buzStatusMap, calculateFormatTimeDiff, getActionButtonType} from '@/common/utils/common' | |
| 384 | +import {nextStepMap, buzStatusMap, calculateFormatTimeDiff, getActionButtonType, toWorkerImplementPage} from '@/common/utils/common' | |
| 385 | 385 | import {getTaskActions} from '@/api/work-order-manage/work-order-manage'; |
| 386 | 386 | import {useUploadImgs} from '@/common/utils/useUploadImgs' |
| 387 | 387 | import { useUserStore } from '@/pinia/user'; |
| ... | ... | @@ -622,8 +622,14 @@ const handleUnifiedProcess = async (item: any, action: any = null) => { |
| 622 | 622 | ? configuredActions.value |
| 623 | 623 | : await queryUnifiedActions(item?.taskId) |
| 624 | 624 | if (actions) { |
| 625 | + const target = action || actions[0] | |
| 626 | + // 实施动作要选作业类型、填动态字段、传五组照片,统一动作弹窗承载不了,进「作业填报」页 | |
| 627 | + if (target?.code === 'HANDLE') { | |
| 628 | + toWorkerImplementPage(item) | |
| 629 | + return | |
| 630 | + } | |
| 625 | 631 | // 传入的动作即用户点击的配置按钮,直接执行该动作,不再弹「请选择操作」二次选择 |
| 626 | - unifiedActionsRef.value?.open(item, [action || actions[0]]) | |
| 632 | + unifiedActionsRef.value?.open(item, [target]) | |
| 627 | 633 | return |
| 628 | 634 | } |
| 629 | 635 | handleProcess(item) | ... | ... |
pages-sub/problem/work-order-manage/index.vue
| ... | ... | @@ -298,7 +298,7 @@ import { |
| 298 | 298 | } from '@/api/work-order-manage/work-order-manage' |
| 299 | 299 | // 从用户store获取角色信息 |
| 300 | 300 | import { useUserStore } from '@/pinia/user'; |
| 301 | -import { nextStepMap, buzStatusMap, getActionButtonType } from '@/common/utils/common' | |
| 301 | +import { nextStepMap, buzStatusMap, getActionButtonType, toWorkerImplementPage } from '@/common/utils/common' | |
| 302 | 302 | // 引入图片上传组合式函数(与参考页面一致) |
| 303 | 303 | import { useUploadImgs } from '@/common/utils/useUploadImgs' |
| 304 | 304 | |
| ... | ... | @@ -556,8 +556,14 @@ const handleUnifiedProcess = async (item, action = null) => { |
| 556 | 556 | ? item.configuredActions |
| 557 | 557 | : await queryUnifiedActions(item) |
| 558 | 558 | if (actions) { |
| 559 | + const target = action || actions[0] | |
| 560 | + // 实施动作要选作业类型、填动态字段、传五组照片,统一动作弹窗承载不了,进「作业填报」页 | |
| 561 | + if (target?.code === 'HANDLE') { | |
| 562 | + toWorkerImplementPage(item) | |
| 563 | + return | |
| 564 | + } | |
| 559 | 565 | // 传入的动作即用户点击的配置按钮,直接执行该动作,不再弹「请选择操作」二次选择 |
| 560 | - unifiedActionsRef.value?.open(item, [action || actions[0]]) | |
| 566 | + unifiedActionsRef.value?.open(item, [target]) | |
| 561 | 567 | return |
| 562 | 568 | } |
| 563 | 569 | handleProcess(item) | ... | ... |
pages-sub/problem/work-order-manage/order-detail.vue
| ... | ... | @@ -418,7 +418,7 @@ import { |
| 418 | 418 | getTaskActions |
| 419 | 419 | } from '@/api/work-order-manage/work-order-manage'; |
| 420 | 420 | import {getWorkRecordValues} from '@/api/common' |
| 421 | -import {nextStepMap, buzStatusMap, calculateFormatTimeDiff, getActionButtonType} from '@/common/utils/common' | |
| 421 | +import {nextStepMap, buzStatusMap, calculateFormatTimeDiff, getActionButtonType, toWorkerImplementPage} from '@/common/utils/common' | |
| 422 | 422 | // 引入图片上传组合式函数 |
| 423 | 423 | import {useUploadImgs} from '@/common/utils/useUploadImgs' |
| 424 | 424 | |
| ... | ... | @@ -853,8 +853,14 @@ const handleUnifiedProcess = async (item: any, action: any = null) => { |
| 853 | 853 | ? configuredActions.value |
| 854 | 854 | : await queryUnifiedActions(item) |
| 855 | 855 | if (actions) { |
| 856 | + const target = action || actions[0] | |
| 857 | + // 实施动作要选作业类型、填动态字段、传五组照片,统一动作弹窗承载不了,进「作业填报」页 | |
| 858 | + if (target?.code === 'HANDLE') { | |
| 859 | + toWorkerImplementPage(item) | |
| 860 | + return | |
| 861 | + } | |
| 856 | 862 | // 传入的动作即用户点击的配置按钮,直接执行该动作,不再弹「请选择操作」二次选择 |
| 857 | - unifiedActionsRef.value?.open(item, [action || actions[0]]) | |
| 863 | + unifiedActionsRef.value?.open(item, [target]) | |
| 858 | 864 | return |
| 859 | 865 | } |
| 860 | 866 | handleProcess(item) | ... | ... |