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 | 96 | </view> |
| 97 | 97 | <!-- 操作按钮行 --> |
| 98 | 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 | 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 | 104 | <!-- <up-button type="primary" size="large" @click="handleProcess(item)" v-show="nextStepMap[item.taskKey].ysShow">验收</up-button>--> |
| 103 | 105 | |
| 104 | 106 | <up-button type="info" size="large" @click="handleDetail(item)">详情</up-button> |
| ... | ... | @@ -395,7 +397,12 @@ const queryList = async (pageNo, pageSize) => { |
| 395 | 397 | if (activeTab.value === 0) res = await todoBuzSimplePage(params); |
| 396 | 398 | else if (activeTab.value === 2) res = await myBuzSimplePage(params); |
| 397 | 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 | 406 | } catch (error) { |
| 400 | 407 | console.error('加载工单失败:', error); |
| 401 | 408 | pagingRef.value?.complete(false); |
| ... | ... | @@ -464,9 +471,37 @@ const queryUnifiedActions = async (item) => { |
| 464 | 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 | 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 | 505 | if (actions) { |
| 471 | 506 | unifiedActionsRef.value?.open(item, actions) |
| 472 | 507 | return |
| ... | ... | @@ -474,6 +509,23 @@ const handleUnifiedProcess = async (item) => { |
| 474 | 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 | 530 | const handleUnifiedSuccess = () => { |
| 479 | 531 | pagingRef.value && pagingRef.value.reload() | ... | ... |
pages-sub/problem/regional-order-manage/index.vue
| ... | ... | @@ -109,7 +109,7 @@ |
| 109 | 109 | <!-- 待办工单(0) 保留原来的操作按钮区 不变 --> |
| 110 | 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 | 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 | 113 | <up-button type="primary" size="large" @click="handleUnifiedProcess(item)">{{ getProcessButtonText(item) }}</up-button> |
| 114 | 114 | <up-button type="info" size="large" @click="handleDetail(item)">详情</up-button> |
| 115 | 115 | </view> | ... | ... |
pages-sub/problem/regional-order-manage/list-detail.vue
| ... | ... | @@ -223,26 +223,29 @@ |
| 223 | 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 | 227 | <view class="u-body-item u-flex common-justify-between common-item-center"> |
| 228 | 228 | <up-button |
| 229 | 229 | type="warning" |
| 230 | 230 | size="normal" |
| 231 | - @click="handleReject(orderDetail)" | |
| 231 | + @click="handleUnifiedReject(orderDetail)" | |
| 232 | 232 | v-show="showRejectButton" |
| 233 | 233 | >回退</up-button> |
| 234 | 234 | <up-button |
| 235 | 235 | type="success" |
| 236 | 236 | size="normal" |
| 237 | 237 | @click="handleRenew(orderDetail)" |
| 238 | - v-show="nextStepMap[orderDetail.taskKey].renewShow" | |
| 238 | + v-show="nextStepMap[orderDetail.taskKey]?.renewShow" | |
| 239 | 239 | >重新提交</up-button> |
| 240 | - <up-button type="primary" size="normal" @click="handleProcess(orderDetail)"> | |
| 240 | + <up-button type="primary" size="normal" @click="handleUnifiedProcess(orderDetail)"> | |
| 241 | 241 | {{ processButtonText }} |
| 242 | 242 | </up-button> |
| 243 | 243 | </view> |
| 244 | 244 | </view> |
| 245 | 245 | |
| 246 | + <!-- 统一节点动作弹窗(工作流配置化) --> | |
| 247 | + <unified-task-actions ref="unifiedActionsRef" @success="handleUnifiedSuccess" /> | |
| 248 | + | |
| 246 | 249 | <!-- 回退弹窗 --> |
| 247 | 250 | <up-modal |
| 248 | 251 | :show="rejectModalShow" |
| ... | ... | @@ -523,6 +526,48 @@ const processButtonText = computed(() => { |
| 523 | 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 | 572 | * 核心:工单详情接口 workOrderDetailByID |
| 528 | 573 | * @param id 上一页传递的工单ID | ... | ... |
pages-sub/problem/regional-order-manage/order-detail.vue
| ... | ... | @@ -253,17 +253,17 @@ |
| 253 | 253 | </view> |
| 254 | 254 | |
| 255 | 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 | 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 | 259 | v-show="showRejectButton">回退 |
| 260 | 260 | </up-button> |
| 261 | 261 | |
| 262 | 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 | 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 | 267 | processButtonText |
| 268 | 268 | }} |
| 269 | 269 | </up-button> |
| ... | ... | @@ -357,6 +357,9 @@ |
| 357 | 357 | </view> |
| 358 | 358 | </up-modal> |
| 359 | 359 | |
| 360 | + <!-- 统一节点动作弹窗(工作流配置化) --> | |
| 361 | + <unified-task-actions ref="unifiedActionsRef" @success="handleUnifiedSuccess" /> | |
| 362 | + | |
| 360 | 363 | </view> |
| 361 | 364 | </template> |
| 362 | 365 | |
| ... | ... | @@ -591,6 +594,48 @@ const processButtonText = computed(() => { |
| 591 | 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 | 947 | await callApprovalApi(postData, item.taskKey); |
| 903 | 948 | showToast('提交成功', 'success'); |
| 904 | 949 | handleAcceptModalCancel(); |
| 905 | - eventChannel.vlue.emit('needRefresh'); | |
| 950 | + eventChannel.value.emit('needRefresh'); | |
| 906 | 951 | uni.navigateBack({delta: 1}); |
| 907 | 952 | } catch (error: any) { |
| 908 | 953 | console.error('验收失败:', error); | ... | ... |
pages-sub/problem/work-order-manage/index.vue
| ... | ... | @@ -107,7 +107,7 @@ |
| 107 | 107 | </up-button> |
| 108 | 108 | |
| 109 | 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 | 111 | </up-button> |
| 112 | 112 | |
| 113 | 113 | <up-button type="primary" size="large" @click="handleUnifiedProcess(item)">{{ | ... | ... |
pages-sub/problem/work-order-manage/order-detail.vue
| ... | ... | @@ -256,14 +256,14 @@ |
| 256 | 256 | </view> |
| 257 | 257 | |
| 258 | 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 | 260 | <view class="u-body-item u-flex common-justify-between common-item-center "> |
| 261 | 261 | <up-button type="warning" size="normal" @click="handleUnifiedReject(orderDetail)" |
| 262 | 262 | v-show="showRejectButton">回退 |
| 263 | 263 | </up-button> |
| 264 | 264 | |
| 265 | 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 | 267 | </up-button> |
| 268 | 268 | |
| 269 | 269 | <up-button type="primary" size="normal" @click="handleUnifiedProcess(orderDetail)">{{ | ... | ... |