Commit 5f7ce1e46febb7d0b36ea1bc27a7cb3ba301b95a
1 parent
f45d1cb7
业务线 小程序不用写死,从后端接口获取
Showing
7 changed files
with
52 additions
and
13 deletions
components/unified-task-actions/unified-task-actions.vue
| ... | ... | @@ -69,7 +69,8 @@ |
| 69 | 69 | </view> |
| 70 | 70 | |
| 71 | 71 | <view class="unified-action-btns"> |
| 72 | - <up-button type="info" size="large" @click="backToList">返回</up-button> | |
| 72 | + <!-- 只有一个动作时没有选择列表可返回,直接展示确定 --> | |
| 73 | + <up-button v-if="actions.length > 1" type="info" size="large" @click="backToList">返回</up-button> | |
| 73 | 74 | <up-button type="primary" size="large" :loading="submitting" @click="submit">确定</up-button> |
| 74 | 75 | </view> |
| 75 | 76 | </view> |
| ... | ... | @@ -105,15 +106,34 @@ const attachImgs = useUploadImgs({ |
| 105 | 106 | uploadText: '选择附件' |
| 106 | 107 | }) |
| 107 | 108 | |
| 108 | -const reasonRequired = computed(() => { | |
| 109 | - if (!current.value) return false | |
| 109 | +/** 该动作是否必须填写原因/备注 */ | |
| 110 | +const isReasonRequired = (action) => { | |
| 111 | + if (!action) return false | |
| 110 | 112 | return ( |
| 111 | - current.value.requireReason === true || | |
| 112 | - ['REJECT', 'RETURN', 'RETURN_PREV', 'TRANSFER', 'DELEGATE'].includes(current.value.code) | |
| 113 | + action.requireReason === true || | |
| 114 | + ['REJECT', 'RETURN', 'RETURN_PREV', 'TRANSFER', 'DELEGATE'].includes(action.code) | |
| 113 | 115 | ) |
| 114 | -}) | |
| 116 | +} | |
| 117 | + | |
| 118 | +const reasonRequired = computed(() => isReasonRequired(current.value)) | |
| 119 | + | |
| 120 | +/** 动作是否需要用户补充信息(处理人/必填原因/附件),都不需要时直接提交 */ | |
| 121 | +const needsInput = (action) => { | |
| 122 | + if (!action) return false | |
| 123 | + return action.requireAssignee === true | |
| 124 | + || action.requireAttachment === true | |
| 125 | + || isReasonRequired(action) | |
| 126 | +} | |
| 115 | 127 | |
| 116 | -/** 打开动作弹窗 */ | |
| 128 | +/** | |
| 129 | + * 打开动作弹窗 | |
| 130 | + * | |
| 131 | + * 列表页的按钮文案就是动作名称,按钮自身已经限定了动作, | |
| 132 | + * 所以只有一个动作时不再展示「请选择操作」列表: | |
| 133 | + * - 动作无必填内容:直接提交(例如「分配」由后端按道路自动指派); | |
| 134 | + * - 动作需要处理人/原因/附件:直接进入动作表单。 | |
| 135 | + * 只有传入多个动作(需要用户区分)时才展示动作列表。 | |
| 136 | + */ | |
| 117 | 137 | const open = async (item, actionList) => { |
| 118 | 138 | currentItem.value = item |
| 119 | 139 | actions.value = actionList || [] |
| ... | ... | @@ -121,6 +141,19 @@ const open = async (item, actionList) => { |
| 121 | 141 | form.nextAssignee = '' |
| 122 | 142 | form.reason = '' |
| 123 | 143 | attachImgs.clearImgs() |
| 144 | + | |
| 145 | + if (actions.value.length === 1) { | |
| 146 | + const action = actions.value[0] | |
| 147 | + if (needsInput(action)) { | |
| 148 | + visible.value = true | |
| 149 | + await selectAction(action) | |
| 150 | + } else { | |
| 151 | + current.value = action | |
| 152 | + await submit() | |
| 153 | + } | |
| 154 | + return | |
| 155 | + } | |
| 156 | + | |
| 124 | 157 | visible.value = true |
| 125 | 158 | } |
| 126 | 159 | ... | ... |
pages-sub/problem/ai-manage/index.vue
| ... | ... | @@ -503,7 +503,8 @@ const handleUnifiedProcess = async (item) => { |
| 503 | 503 | ? item.configuredActions |
| 504 | 504 | : await queryUnifiedActions(item) |
| 505 | 505 | if (actions) { |
| 506 | - unifiedActionsRef.value?.open(item, actions) | |
| 506 | + // 主按钮文案就是第一个动作,直接执行该动作,不再弹「请选择操作」让用户二次选择 | |
| 507 | + unifiedActionsRef.value?.open(item, actions.slice(0, 1)) | |
| 507 | 508 | return |
| 508 | 509 | } |
| 509 | 510 | handleProcess(item) | ... | ... |
pages-sub/problem/regional-order-manage/index.vue
| ... | ... | @@ -478,7 +478,8 @@ const handleUnifiedProcess = async (item) => { |
| 478 | 478 | ? item.configuredActions |
| 479 | 479 | : await queryUnifiedActions(item) |
| 480 | 480 | if (actions) { |
| 481 | - unifiedActionsRef.value?.open(item, actions) | |
| 481 | + // 主按钮文案就是第一个动作,直接执行该动作,不再弹「请选择操作」让用户二次选择 | |
| 482 | + unifiedActionsRef.value?.open(item, actions.slice(0, 1)) | |
| 482 | 483 | return |
| 483 | 484 | } |
| 484 | 485 | handleProcess(item) | ... | ... |
pages-sub/problem/regional-order-manage/list-detail.vue
| ... | ... | @@ -535,7 +535,8 @@ const handleUnifiedProcess = async (item: any) => { |
| 535 | 535 | ? configuredActions.value |
| 536 | 536 | : await queryUnifiedActions(item?.taskId) |
| 537 | 537 | if (actions) { |
| 538 | - unifiedActionsRef.value?.open(item, actions) | |
| 538 | + // 主按钮文案就是第一个动作,直接执行该动作,不再弹「请选择操作」让用户二次选择 | |
| 539 | + unifiedActionsRef.value?.open(item, actions.slice(0, 1)) | |
| 539 | 540 | return |
| 540 | 541 | } |
| 541 | 542 | handleProcess(item) | ... | ... |
pages-sub/problem/regional-order-manage/order-detail.vue
| ... | ... | @@ -603,7 +603,8 @@ const handleUnifiedProcess = async (item: any) => { |
| 603 | 603 | ? configuredActions.value |
| 604 | 604 | : await queryUnifiedActions(item?.taskId) |
| 605 | 605 | if (actions) { |
| 606 | - unifiedActionsRef.value?.open(item, actions) | |
| 606 | + // 主按钮文案就是第一个动作,直接执行该动作,不再弹「请选择操作」让用户二次选择 | |
| 607 | + unifiedActionsRef.value?.open(item, actions.slice(0, 1)) | |
| 607 | 608 | return |
| 608 | 609 | } |
| 609 | 610 | handleProcess(item) | ... | ... |
pages-sub/problem/work-order-manage/index.vue
| ... | ... | @@ -545,7 +545,8 @@ const handleUnifiedProcess = async (item) => { |
| 545 | 545 | ? item.configuredActions |
| 546 | 546 | : await queryUnifiedActions(item) |
| 547 | 547 | if (actions) { |
| 548 | - unifiedActionsRef.value?.open(item, actions) | |
| 548 | + // 主按钮文案就是第一个动作,直接执行该动作,不再弹「请选择操作」让用户二次选择 | |
| 549 | + unifiedActionsRef.value?.open(item, actions.slice(0, 1)) | |
| 549 | 550 | return |
| 550 | 551 | } |
| 551 | 552 | handleProcess(item) | ... | ... |
pages-sub/problem/work-order-manage/order-detail.vue
| ... | ... | @@ -751,7 +751,8 @@ const handleUnifiedProcess = async (item: any) => { |
| 751 | 751 | ? configuredActions.value |
| 752 | 752 | : await queryUnifiedActions(item) |
| 753 | 753 | if (actions) { |
| 754 | - unifiedActionsRef.value?.open(item, actions) | |
| 754 | + // 主按钮文案就是第一个动作,直接执行该动作,不再弹「请选择操作」让用户二次选择 | |
| 755 | + unifiedActionsRef.value?.open(item, actions.slice(0, 1)) | |
| 755 | 756 | return |
| 756 | 757 | } |
| 757 | 758 | handleProcess(item) | ... | ... |