Commit 7542350ba813d2b621703f96545d6b56e294f722
1 parent
397b30ae
业务线 小程序不用写死,从后端接口获取
Showing
6 changed files
with
159 additions
and
17 deletions
pages-sub/problem/ai-manage/index.vue
| @@ -96,9 +96,11 @@ | @@ -96,9 +96,11 @@ | ||
| 96 | </view> | 96 | </view> |
| 97 | <!-- 操作按钮行 --> | 97 | <!-- 操作按钮行 --> |
| 98 | <view class="u-body-item u-flex u-body-item-btn-wrap common-justify-between common-item-center mt-20"> | 98 | <view class="u-body-item u-flex u-body-item-btn-wrap common-justify-between common-item-center mt-20"> |
| 99 | -<!-- <up-button type="warning" size="mini" @click="handleReject(item)" v-show="nextStepMap[item.taskKey].backShow">回退</up-button>--> | ||
| 100 | <!-- <up-button type="success" size="mini" @click="handleRenew(item)" v-show="nextStepMap[item.taskKey].renewShow">重新提交</up-button>--> | 99 | <!-- <up-button type="success" size="mini" @click="handleRenew(item)" v-show="nextStepMap[item.taskKey].renewShow">重新提交</up-button>--> |
| 101 | - <up-button type="primary" size="large" @click="handleUnifiedProcess(item)">{{ nextStepMap[item.taskKey].btnText }}</up-button> | 100 | + <up-button type="warning" size="large" @click="handleUnifiedReject(item)" |
| 101 | + v-show="showRejectButton(item)">回退 | ||
| 102 | + </up-button> | ||
| 103 | + <up-button type="primary" size="large" @click="handleUnifiedProcess(item)">{{ getProcessButtonText(item) }}</up-button> | ||
| 102 | <!-- <up-button type="primary" size="large" @click="handleProcess(item)" v-show="nextStepMap[item.taskKey].ysShow">验收</up-button>--> | 104 | <!-- <up-button type="primary" size="large" @click="handleProcess(item)" v-show="nextStepMap[item.taskKey].ysShow">验收</up-button>--> |
| 103 | 105 | ||
| 104 | <up-button type="info" size="large" @click="handleDetail(item)">详情</up-button> | 106 | <up-button type="info" size="large" @click="handleDetail(item)">详情</up-button> |
| @@ -395,7 +397,12 @@ const queryList = async (pageNo, pageSize) => { | @@ -395,7 +397,12 @@ const queryList = async (pageNo, pageSize) => { | ||
| 395 | if (activeTab.value === 0) res = await todoBuzSimplePage(params); | 397 | if (activeTab.value === 0) res = await todoBuzSimplePage(params); |
| 396 | else if (activeTab.value === 2) res = await myBuzSimplePage(params); | 398 | else if (activeTab.value === 2) res = await myBuzSimplePage(params); |
| 397 | else res = await doneBuzSimplePage(params); | 399 | else res = await doneBuzSimplePage(params); |
| 398 | - pagingRef.value.complete(res?.list || [], res?.total || 0); | 400 | + const list = res?.list || []; |
| 401 | + // 待办列表预取统一动作配置,供按钮文案与显隐复用 | ||
| 402 | + if (activeTab.value === 0) { | ||
| 403 | + await attachConfiguredActions(list); | ||
| 404 | + } | ||
| 405 | + pagingRef.value.complete(list, res?.total || 0); | ||
| 399 | } catch (error) { | 406 | } catch (error) { |
| 400 | console.error('加载工单失败:', error); | 407 | console.error('加载工单失败:', error); |
| 401 | pagingRef.value?.complete(false); | 408 | pagingRef.value?.complete(false); |
| @@ -464,9 +471,37 @@ const queryUnifiedActions = async (item) => { | @@ -464,9 +471,37 @@ const queryUnifiedActions = async (item) => { | ||
| 464 | return null | 471 | return null |
| 465 | } | 472 | } |
| 466 | 473 | ||
| 474 | +/** 驳回类动作编码:只有配置了这些动作,才展示「回退」按钮 */ | ||
| 475 | +const REJECT_ACTION_CODES = ['REJECT', 'RETURN', 'RETURN_PREV'] | ||
| 476 | + | ||
| 477 | +/** 待办列表:批量预取统一动作配置,挂在行数据上供按钮显隐复用 */ | ||
| 478 | +const attachConfiguredActions = async (list) => { | ||
| 479 | + if (!Array.isArray(list) || list.length === 0) return | ||
| 480 | + await Promise.all(list.map(async (item) => { | ||
| 481 | + item.configuredActions = await queryUnifiedActions(item) | ||
| 482 | + })) | ||
| 483 | +} | ||
| 484 | + | ||
| 485 | +/** 回退按钮显隐:AI 工单仅当节点配置了回退类动作时才展示 */ | ||
| 486 | +const showRejectButton = (item) => { | ||
| 487 | + return Array.isArray(item?.configuredActions) | ||
| 488 | + && item.configuredActions.some((action) => REJECT_ACTION_CODES.includes(action.code)) | ||
| 489 | +} | ||
| 490 | + | ||
| 491 | +/** 主按钮文案:已配置统一动作时取配置的动作名称,未配置时沿用原有节点规则 */ | ||
| 492 | +const getProcessButtonText = (item) => { | ||
| 493 | + const actions = item?.configuredActions | ||
| 494 | + if (Array.isArray(actions) && actions.length > 0) { | ||
| 495 | + return actions[0].name || actions[0].code | ||
| 496 | + } | ||
| 497 | + return nextStepMap[item.taskKey]?.btnText || '处理' | ||
| 498 | +} | ||
| 499 | + | ||
| 467 | /** 待办-处理工单:已配置统一动作时走新逻辑,否则回退原有处理 */ | 500 | /** 待办-处理工单:已配置统一动作时走新逻辑,否则回退原有处理 */ |
| 468 | const handleUnifiedProcess = async (item) => { | 501 | const handleUnifiedProcess = async (item) => { |
| 469 | - const actions = await queryUnifiedActions(item) | 502 | + const actions = Array.isArray(item?.configuredActions) |
| 503 | + ? item.configuredActions | ||
| 504 | + : await queryUnifiedActions(item) | ||
| 470 | if (actions) { | 505 | if (actions) { |
| 471 | unifiedActionsRef.value?.open(item, actions) | 506 | unifiedActionsRef.value?.open(item, actions) |
| 472 | return | 507 | return |
| @@ -474,6 +509,23 @@ const handleUnifiedProcess = async (item) => { | @@ -474,6 +509,23 @@ const handleUnifiedProcess = async (item) => { | ||
| 474 | handleProcess(item) | 509 | handleProcess(item) |
| 475 | } | 510 | } |
| 476 | 511 | ||
| 512 | +/** 回退:已配置统一动作时走新逻辑,否则回退原有弹窗 */ | ||
| 513 | +const handleUnifiedReject = async (item) => { | ||
| 514 | + const actions = Array.isArray(item?.configuredActions) | ||
| 515 | + ? item.configuredActions | ||
| 516 | + : await queryUnifiedActions(item) | ||
| 517 | + if (actions) { | ||
| 518 | + const rejectActions = actions.filter((action) => REJECT_ACTION_CODES.includes(action.code)) | ||
| 519 | + if (rejectActions.length > 0) { | ||
| 520 | + unifiedActionsRef.value?.open(item, rejectActions) | ||
| 521 | + } else { | ||
| 522 | + uni.showToast({ title: '当前节点未配置回退动作', icon: 'none' }) | ||
| 523 | + } | ||
| 524 | + return | ||
| 525 | + } | ||
| 526 | + handleReject(item) | ||
| 527 | +} | ||
| 528 | + | ||
| 477 | /** 统一动作执行成功后刷新列表 */ | 529 | /** 统一动作执行成功后刷新列表 */ |
| 478 | const handleUnifiedSuccess = () => { | 530 | const handleUnifiedSuccess = () => { |
| 479 | pagingRef.value && pagingRef.value.reload() | 531 | pagingRef.value && pagingRef.value.reload() |
pages-sub/problem/regional-order-manage/index.vue
| @@ -109,7 +109,7 @@ | @@ -109,7 +109,7 @@ | ||
| 109 | <!-- 待办工单(0) 保留原来的操作按钮区 不变 --> | 109 | <!-- 待办工单(0) 保留原来的操作按钮区 不变 --> |
| 110 | <view v-if="activeTab === 0" class="u-body-item u-body-item-btn-wrap u-flex common-justify-between common-item-center mt-20"> | 110 | <view v-if="activeTab === 0" class="u-body-item u-body-item-btn-wrap u-flex common-justify-between common-item-center mt-20"> |
| 111 | <up-button type="warning" size="large" @click="handleUnifiedReject(item)" v-show="showRejectButton(item)">回退</up-button> | 111 | <up-button type="warning" size="large" @click="handleUnifiedReject(item)" v-show="showRejectButton(item)">回退</up-button> |
| 112 | - <up-button type="success" size="large" @click="handleRenew(item)" v-show="nextStepMap[item.taskKey].renewShow">重新提交</up-button> | 112 | + <up-button type="success" size="large" @click="handleRenew(item)" v-show="nextStepMap[item.taskKey]?.renewShow">重新提交</up-button> |
| 113 | <up-button type="primary" size="large" @click="handleUnifiedProcess(item)">{{ getProcessButtonText(item) }}</up-button> | 113 | <up-button type="primary" size="large" @click="handleUnifiedProcess(item)">{{ getProcessButtonText(item) }}</up-button> |
| 114 | <up-button type="info" size="large" @click="handleDetail(item)">详情</up-button> | 114 | <up-button type="info" size="large" @click="handleDetail(item)">详情</up-button> |
| 115 | </view> | 115 | </view> |
pages-sub/problem/regional-order-manage/list-detail.vue
| @@ -223,26 +223,29 @@ | @@ -223,26 +223,29 @@ | ||
| 223 | </view> | 223 | </view> |
| 224 | 224 | ||
| 225 | <!-- 底部操作按钮 --> | 225 | <!-- 底部操作按钮 --> |
| 226 | - <view v-if="activeTab === '0' && nextStepMap[orderDetail.taskKey]" class="fixed-bottom-btn-wrap"> | 226 | + <view v-if="activeTab === '0' && (configuredActions || nextStepMap[orderDetail.taskKey])" class="fixed-bottom-btn-wrap"> |
| 227 | <view class="u-body-item u-flex common-justify-between common-item-center"> | 227 | <view class="u-body-item u-flex common-justify-between common-item-center"> |
| 228 | <up-button | 228 | <up-button |
| 229 | type="warning" | 229 | type="warning" |
| 230 | size="normal" | 230 | size="normal" |
| 231 | - @click="handleReject(orderDetail)" | 231 | + @click="handleUnifiedReject(orderDetail)" |
| 232 | v-show="showRejectButton" | 232 | v-show="showRejectButton" |
| 233 | >回退</up-button> | 233 | >回退</up-button> |
| 234 | <up-button | 234 | <up-button |
| 235 | type="success" | 235 | type="success" |
| 236 | size="normal" | 236 | size="normal" |
| 237 | @click="handleRenew(orderDetail)" | 237 | @click="handleRenew(orderDetail)" |
| 238 | - v-show="nextStepMap[orderDetail.taskKey].renewShow" | 238 | + v-show="nextStepMap[orderDetail.taskKey]?.renewShow" |
| 239 | >重新提交</up-button> | 239 | >重新提交</up-button> |
| 240 | - <up-button type="primary" size="normal" @click="handleProcess(orderDetail)"> | 240 | + <up-button type="primary" size="normal" @click="handleUnifiedProcess(orderDetail)"> |
| 241 | {{ processButtonText }} | 241 | {{ processButtonText }} |
| 242 | </up-button> | 242 | </up-button> |
| 243 | </view> | 243 | </view> |
| 244 | </view> | 244 | </view> |
| 245 | 245 | ||
| 246 | + <!-- 统一节点动作弹窗(工作流配置化) --> | ||
| 247 | + <unified-task-actions ref="unifiedActionsRef" @success="handleUnifiedSuccess" /> | ||
| 248 | + | ||
| 246 | <!-- 回退弹窗 --> | 249 | <!-- 回退弹窗 --> |
| 247 | <up-modal | 250 | <up-modal |
| 248 | :show="rejectModalShow" | 251 | :show="rejectModalShow" |
| @@ -523,6 +526,48 @@ const processButtonText = computed(() => { | @@ -523,6 +526,48 @@ const processButtonText = computed(() => { | ||
| 523 | return nextStepMap[orderDetail.value.taskKey]?.btnText | 526 | return nextStepMap[orderDetail.value.taskKey]?.btnText |
| 524 | }) | 527 | }) |
| 525 | 528 | ||
| 529 | +/** 统一动作弹窗 */ | ||
| 530 | +const unifiedActionsRef = ref<any>(null) | ||
| 531 | + | ||
| 532 | +/** 处理:已配置统一动作时走统一接口,否则回退原有处理 */ | ||
| 533 | +const handleUnifiedProcess = async (item: any) => { | ||
| 534 | + const actions = Array.isArray(configuredActions.value) | ||
| 535 | + ? configuredActions.value | ||
| 536 | + : await queryUnifiedActions(item?.taskId) | ||
| 537 | + if (actions) { | ||
| 538 | + unifiedActionsRef.value?.open(item, actions) | ||
| 539 | + return | ||
| 540 | + } | ||
| 541 | + handleProcess(item) | ||
| 542 | +} | ||
| 543 | + | ||
| 544 | +/** 回退:已配置统一动作时走统一接口,否则回退原有弹窗 */ | ||
| 545 | +const handleUnifiedReject = async (item: any) => { | ||
| 546 | + const actions = Array.isArray(configuredActions.value) | ||
| 547 | + ? configuredActions.value | ||
| 548 | + : await queryUnifiedActions(item?.taskId) | ||
| 549 | + if (actions) { | ||
| 550 | + const rejectActions = actions.filter((action: any) => | ||
| 551 | + REJECT_ACTION_CODES.includes(action.code) | ||
| 552 | + ) | ||
| 553 | + if (rejectActions.length > 0) { | ||
| 554 | + unifiedActionsRef.value?.open(item, rejectActions) | ||
| 555 | + } else { | ||
| 556 | + uni.showToast({ title: '当前节点未配置回退动作', icon: 'none' }) | ||
| 557 | + } | ||
| 558 | + return | ||
| 559 | + } | ||
| 560 | + handleReject(item) | ||
| 561 | +} | ||
| 562 | + | ||
| 563 | +/** 统一动作执行成功后通知列表刷新并返回 */ | ||
| 564 | +const handleUnifiedSuccess = () => { | ||
| 565 | + if (eventChannel.value) { | ||
| 566 | + eventChannel.value.emit('needRefresh') | ||
| 567 | + } | ||
| 568 | + uni.navigateBack({ delta: 1 }) | ||
| 569 | +} | ||
| 570 | + | ||
| 526 | /** | 571 | /** |
| 527 | * 核心:工单详情接口 workOrderDetailByID | 572 | * 核心:工单详情接口 workOrderDetailByID |
| 528 | * @param id 上一页传递的工单ID | 573 | * @param id 上一页传递的工单ID |
pages-sub/problem/regional-order-manage/order-detail.vue
| @@ -253,17 +253,17 @@ | @@ -253,17 +253,17 @@ | ||
| 253 | </view> | 253 | </view> |
| 254 | 254 | ||
| 255 | <!-- activeTab==0的时候才出现, 也就是待办 --> | 255 | <!-- activeTab==0的时候才出现, 也就是待办 --> |
| 256 | - <view v-if="activeTab==0&&nextStepMap[orderDetail.taskKey]" class="fixed-bottom-btn-wrap"> | 256 | + <view v-if="activeTab==0&&(configuredActions||nextStepMap[orderDetail.taskKey])" class="fixed-bottom-btn-wrap"> |
| 257 | <view class="u-body-item u-flex common-justify-between common-item-center "> | 257 | <view class="u-body-item u-flex common-justify-between common-item-center "> |
| 258 | - <up-button type="warning" size="normal" @click="handleReject(orderDetail)" | 258 | + <up-button type="warning" size="normal" @click="handleUnifiedReject(orderDetail)" |
| 259 | v-show="showRejectButton">回退 | 259 | v-show="showRejectButton">回退 |
| 260 | </up-button> | 260 | </up-button> |
| 261 | 261 | ||
| 262 | <up-button type="success" size="normal" @click="handleRenew(orderDetail)" | 262 | <up-button type="success" size="normal" @click="handleRenew(orderDetail)" |
| 263 | - v-show="nextStepMap[orderDetail.taskKey].renewShow">重新提交 | 263 | + v-show="nextStepMap[orderDetail.taskKey]?.renewShow">重新提交 |
| 264 | </up-button> | 264 | </up-button> |
| 265 | 265 | ||
| 266 | - <up-button type="primary" size="normal" @click="handleProcess(orderDetail)">{{ | 266 | + <up-button type="primary" size="normal" @click="handleUnifiedProcess(orderDetail)">{{ |
| 267 | processButtonText | 267 | processButtonText |
| 268 | }} | 268 | }} |
| 269 | </up-button> | 269 | </up-button> |
| @@ -357,6 +357,9 @@ | @@ -357,6 +357,9 @@ | ||
| 357 | </view> | 357 | </view> |
| 358 | </up-modal> | 358 | </up-modal> |
| 359 | 359 | ||
| 360 | + <!-- 统一节点动作弹窗(工作流配置化) --> | ||
| 361 | + <unified-task-actions ref="unifiedActionsRef" @success="handleUnifiedSuccess" /> | ||
| 362 | + | ||
| 360 | </view> | 363 | </view> |
| 361 | </template> | 364 | </template> |
| 362 | 365 | ||
| @@ -591,6 +594,48 @@ const processButtonText = computed(() => { | @@ -591,6 +594,48 @@ const processButtonText = computed(() => { | ||
| 591 | return nextStepMap[orderDetail.value.taskKey]?.btnText | 594 | return nextStepMap[orderDetail.value.taskKey]?.btnText |
| 592 | }) | 595 | }) |
| 593 | 596 | ||
| 597 | +/** 统一动作弹窗 */ | ||
| 598 | +const unifiedActionsRef = ref<any>(null) | ||
| 599 | + | ||
| 600 | +/** 处理:已配置统一动作时走统一接口,否则回退原有处理 */ | ||
| 601 | +const handleUnifiedProcess = async (item: any) => { | ||
| 602 | + const actions = Array.isArray(configuredActions.value) | ||
| 603 | + ? configuredActions.value | ||
| 604 | + : await queryUnifiedActions(item?.taskId) | ||
| 605 | + if (actions) { | ||
| 606 | + unifiedActionsRef.value?.open(item, actions) | ||
| 607 | + return | ||
| 608 | + } | ||
| 609 | + handleProcess(item) | ||
| 610 | +} | ||
| 611 | + | ||
| 612 | +/** 回退:已配置统一动作时走统一接口,否则回退原有弹窗 */ | ||
| 613 | +const handleUnifiedReject = async (item: any) => { | ||
| 614 | + const actions = Array.isArray(configuredActions.value) | ||
| 615 | + ? configuredActions.value | ||
| 616 | + : await queryUnifiedActions(item?.taskId) | ||
| 617 | + if (actions) { | ||
| 618 | + const rejectActions = actions.filter((action: any) => | ||
| 619 | + REJECT_ACTION_CODES.includes(action.code) | ||
| 620 | + ) | ||
| 621 | + if (rejectActions.length > 0) { | ||
| 622 | + unifiedActionsRef.value?.open(item, rejectActions) | ||
| 623 | + } else { | ||
| 624 | + uni.showToast({ title: '当前节点未配置回退动作', icon: 'none' }) | ||
| 625 | + } | ||
| 626 | + return | ||
| 627 | + } | ||
| 628 | + handleReject(item) | ||
| 629 | +} | ||
| 630 | + | ||
| 631 | +/** 统一动作执行成功后通知列表刷新并返回 */ | ||
| 632 | +const handleUnifiedSuccess = () => { | ||
| 633 | + if (eventChannel.value) { | ||
| 634 | + eventChannel.value.emit('needRefresh') | ||
| 635 | + } | ||
| 636 | + uni.navigateBack({ delta: 1 }) | ||
| 637 | +} | ||
| 638 | + | ||
| 594 | /** | 639 | /** |
| 595 | * 获取工单详情 | 640 | * 获取工单详情 |
| 596 | */ | 641 | */ |
| @@ -902,7 +947,7 @@ const handleAcceptModalConfirm = async () => { | @@ -902,7 +947,7 @@ const handleAcceptModalConfirm = async () => { | ||
| 902 | await callApprovalApi(postData, item.taskKey); | 947 | await callApprovalApi(postData, item.taskKey); |
| 903 | showToast('提交成功', 'success'); | 948 | showToast('提交成功', 'success'); |
| 904 | handleAcceptModalCancel(); | 949 | handleAcceptModalCancel(); |
| 905 | - eventChannel.vlue.emit('needRefresh'); | 950 | + eventChannel.value.emit('needRefresh'); |
| 906 | uni.navigateBack({delta: 1}); | 951 | uni.navigateBack({delta: 1}); |
| 907 | } catch (error: any) { | 952 | } catch (error: any) { |
| 908 | console.error('验收失败:', error); | 953 | console.error('验收失败:', error); |
pages-sub/problem/work-order-manage/index.vue
| @@ -107,7 +107,7 @@ | @@ -107,7 +107,7 @@ | ||
| 107 | </up-button> | 107 | </up-button> |
| 108 | 108 | ||
| 109 | <up-button type="success" size="large" @click="handleRenew(item)" | 109 | <up-button type="success" size="large" @click="handleRenew(item)" |
| 110 | - v-show="nextStepMap[item.taskKey].renewShow">重新提交 | 110 | + v-show="nextStepMap[item.taskKey]?.renewShow">重新提交 |
| 111 | </up-button> | 111 | </up-button> |
| 112 | 112 | ||
| 113 | <up-button type="primary" size="large" @click="handleUnifiedProcess(item)">{{ | 113 | <up-button type="primary" size="large" @click="handleUnifiedProcess(item)">{{ |
pages-sub/problem/work-order-manage/order-detail.vue
| @@ -256,14 +256,14 @@ | @@ -256,14 +256,14 @@ | ||
| 256 | </view> | 256 | </view> |
| 257 | 257 | ||
| 258 | <!-- activeTab==0的时候才出现, 也就是待办 --> | 258 | <!-- activeTab==0的时候才出现, 也就是待办 --> |
| 259 | - <view v-if="activeTab==0&&nextStepMap[orderDetail.taskKey]" class="fixed-bottom-btn-wrap"> | 259 | + <view v-if="activeTab==0&&(configuredActions||nextStepMap[orderDetail.taskKey])" class="fixed-bottom-btn-wrap"> |
| 260 | <view class="u-body-item u-flex common-justify-between common-item-center "> | 260 | <view class="u-body-item u-flex common-justify-between common-item-center "> |
| 261 | <up-button type="warning" size="normal" @click="handleUnifiedReject(orderDetail)" | 261 | <up-button type="warning" size="normal" @click="handleUnifiedReject(orderDetail)" |
| 262 | v-show="showRejectButton">回退 | 262 | v-show="showRejectButton">回退 |
| 263 | </up-button> | 263 | </up-button> |
| 264 | 264 | ||
| 265 | <up-button type="success" size="normal" @click="handleRenew(orderDetail)" | 265 | <up-button type="success" size="normal" @click="handleRenew(orderDetail)" |
| 266 | - v-show="nextStepMap[orderDetail.taskKey].renewShow">重新提交 | 266 | + v-show="nextStepMap[orderDetail.taskKey]?.renewShow">重新提交 |
| 267 | </up-button> | 267 | </up-button> |
| 268 | 268 | ||
| 269 | <up-button type="primary" size="normal" @click="handleUnifiedProcess(orderDetail)">{{ | 269 | <up-button type="primary" size="normal" @click="handleUnifiedProcess(orderDetail)">{{ |