feat: 待处理列表新增批量库内拦截确定(order.recheckOrder.confirmIntercept)
This commit is contained in:
parent
1b7025a1e8
commit
f9495211d0
@ -405,6 +405,15 @@ export const ORDER_TOOLBAR_BUTTONS: Record<string, ToolbarButtonConfig> = {
|
||||
cancelOrder: { key: 'cancelOrder', label: '取消订单', size: 'small', category: 'cancel', loadingKey: 'actionLoading', disabledKey: 'hasNoSelection', action: 'handleCancelOrder' },
|
||||
batchIntercept: { key: 'batchIntercept', label: '批量拦截', size: 'small', category: 'cancel', loadingKey: 'batchAsyncTaskLoading', disabledKey: 'hasNoSelection', action: 'handleBatchIntercept' },
|
||||
batchUnintercept: { key: 'batchUnintercept', label: '解除拦截', size: 'small', category: 'action', loadingKey: 'batchAsyncTaskLoading', disabledKey: 'hasNoSelection', action: 'handleBatchUnintercept' },
|
||||
confirmIntercept: {
|
||||
key: 'confirmIntercept',
|
||||
label: '库内拦截确定',
|
||||
size: 'small',
|
||||
category: 'action',
|
||||
loadingKey: 'confirmInterceptLoading',
|
||||
disabledKey: 'noInterceptSelection',
|
||||
action: 'handleConfirmInterceptBatch'
|
||||
},
|
||||
batchLock: { key: 'batchLock', label: '批量锁定', size: 'small', category: 'action', loadingKey: 'batchAsyncTaskLoading', disabledKey: 'hasNoSelection', action: 'handleBatchLock' },
|
||||
batchUnlock: { key: 'batchUnlock', label: '批量解锁', size: 'small', category: 'action', loadingKey: 'batchAsyncTaskLoading', disabledKey: 'hasNoSelection', action: 'handleBatchUnlock' },
|
||||
batchPrint: { key: 'batchPrint', label: '批量打印', size: 'small', category: 'action', loadingKey: 'batchPrintLoading', disabledKey: 'hasNoSelection', action: 'handleBatchPrint' },
|
||||
@ -1963,6 +1972,7 @@ export const pendingToolbarButtonKeys = [
|
||||
'cloneOrder',
|
||||
'syncOrderIds',
|
||||
'batchUnintercept',
|
||||
'confirmIntercept',
|
||||
'batchLock',
|
||||
'batchUnlock',
|
||||
'batchPrint',
|
||||
|
||||
@ -381,6 +381,7 @@ import UpperTable from '@/components/UpperTable/index.vue'
|
||||
import TaskProgressDialog from '@/components/TaskProgressDialog.vue'
|
||||
import { orderPendingOrder } from '@/api/order.pendingorder/orderpendingOrder'
|
||||
import { orderExpectionOrder } from '@/api/order.expectionorder/orderexpectionorder'
|
||||
import { confirmIntercept } from '@/api/order.recheckorder/recheckOrder'
|
||||
import * as indexApi from '@/api/index/index'
|
||||
|
||||
import {
|
||||
@ -416,7 +417,7 @@ import AllocateSubOrderNumberForm from './form/AllocateSubOrderNumberForm.vue'
|
||||
import ExpressWaybillPanel from './component/ExpressWaybillPanel.vue'
|
||||
import OrderExportProgressDialog from './component/OrderExportProgressDialog.vue'
|
||||
import { createOrderPageExport } from './utils/order-page-export'
|
||||
import { buildOrderWhereConditions, parseOrderListResponse, resolveOrderInterceptStatus, resolveOrderRecheckStatus } from './utils/order-index-helpers'
|
||||
import { buildOrderWhereConditions, parseOrderListResponse, resolveOrderInterceptStatus, resolveOrderRecheckStatus, isActiveInterceptStatus } from './utils/order-index-helpers'
|
||||
import { useOrderListPageCleanup } from './utils/use-order-list-page-cleanup'
|
||||
import { useOrderBatchPrint } from './utils/use-order-batch-print'
|
||||
import { useSubWaybillPrint } from './utils/use-sub-waybill-print'
|
||||
@ -448,6 +449,7 @@ const detailDisplayMode = ref<OrderDetailDisplayMode>('compact')
|
||||
const list = ref<any[]>([])
|
||||
const loading = ref(false)
|
||||
const actionLoading = ref(false)
|
||||
const confirmInterceptLoading = ref(false)
|
||||
const queryTime = ref(0)
|
||||
|
||||
const pagination = reactive({ currentPage: 1, pageSize: 20, total: 0 })
|
||||
@ -737,9 +739,17 @@ function toggleDetailVisible() {
|
||||
detailVisible.value = !detailVisible.value
|
||||
}
|
||||
|
||||
/** 勾选的订单是否全部处于拦截状态(intercept_status 非 none / 空) */
|
||||
const allSelectedIntercept = computed(() => {
|
||||
const rows = selectionRows.value
|
||||
if (!rows.length) return false
|
||||
return rows.every((row: any) => isActiveInterceptStatus(resolveOrderInterceptStatus(row)))
|
||||
})
|
||||
|
||||
const buttonDisabledMap = computed<Record<string, boolean>>(() => ({
|
||||
hasNoSelection: !hasSelection.value,
|
||||
notSingleSelection: selectionRows.value.length !== 1
|
||||
notSingleSelection: selectionRows.value.length !== 1,
|
||||
noInterceptSelection: !allSelectedIntercept.value
|
||||
}))
|
||||
|
||||
const allocateExpressProgressStatusLabel = computed(() => {
|
||||
@ -875,6 +885,7 @@ const {
|
||||
toolbarActionMap['openResolveExceptionDialog'] = openResolveExceptionDialog
|
||||
toolbarActionMap['handleBatchPrint'] = handleBatchPrint
|
||||
toolbarActionMap['handleSubWaybillPrint'] = handleSubWaybillPrint
|
||||
toolbarActionMap['handleConfirmInterceptBatch'] = handleConfirmInterceptBatch
|
||||
|
||||
const buttonLoadingMap = computed<Record<string, boolean>>(() => ({
|
||||
exportLoading: exportLoading.value,
|
||||
@ -893,7 +904,8 @@ const buttonLoadingMap = computed<Record<string, boolean>>(() => ({
|
||||
waveSingleFetchLoading: waveSingleFetchLoading.value,
|
||||
batchPrintLoading: batchPrintLoading.value,
|
||||
allocateSubOrderNumberLoading: allocateSubOrderNumberLoading.value,
|
||||
subWaybillPrintLoading: subWaybillPrintLoading.value
|
||||
subWaybillPrintLoading: subWaybillPrintLoading.value,
|
||||
confirmInterceptLoading: confirmInterceptLoading.value
|
||||
}))
|
||||
|
||||
const toolbarLayoutKey = computed(() =>
|
||||
@ -1009,6 +1021,66 @@ function getSelectedIds(): number[] {
|
||||
}
|
||||
return ids
|
||||
}
|
||||
|
||||
/** 批量库内拦截确定(order.recheckOrder.confirmIntercept),仅勾选拦截状态订单时可用 */
|
||||
async function handleConfirmInterceptBatch() {
|
||||
const rows = selectionRows.value
|
||||
if (!rows.length) {
|
||||
ElMessage.warning('请先勾选需要确认库内拦截的订单')
|
||||
return
|
||||
}
|
||||
const nonIntercept = rows.filter(
|
||||
(row: any) => !isActiveInterceptStatus(resolveOrderInterceptStatus(row))
|
||||
)
|
||||
if (nonIntercept.length) {
|
||||
ElMessage.warning('选中的订单中存在非拦截状态订单,请取消勾选后再操作')
|
||||
return
|
||||
}
|
||||
const ids = getSelectedIds()
|
||||
if (!ids.length) {
|
||||
ElMessage.error('选中行缺少有效订单 id,请刷新后重试')
|
||||
return
|
||||
}
|
||||
if (confirmInterceptLoading.value) return
|
||||
try {
|
||||
await ElMessageBox.confirm(
|
||||
`确定对选中的 ${ids.length} 条订单执行库内拦截确定吗?`,
|
||||
'库内拦截确定',
|
||||
{ type: 'warning' }
|
||||
)
|
||||
} catch {
|
||||
return
|
||||
}
|
||||
|
||||
confirmInterceptLoading.value = true
|
||||
try {
|
||||
const results = await Promise.allSettled(
|
||||
ids.map((id) => confirmIntercept({ order_id: id }))
|
||||
)
|
||||
const successCount = results.filter((r) => {
|
||||
if (r.status !== 'fulfilled') return false
|
||||
const res = r.value as any
|
||||
return res && (res.code === 1 || res.code === 200 || res.flag === 'success')
|
||||
}).length
|
||||
const failedCount = results.length - successCount
|
||||
if (successCount === results.length) {
|
||||
ElMessage.success(`库内拦截确定成功 ${successCount} 条`)
|
||||
} else if (successCount > 0) {
|
||||
ElMessage.warning(`库内拦截确定成功 ${successCount} 条,失败 ${failedCount} 条`)
|
||||
} else {
|
||||
ElMessage.error('库内拦截确定失败')
|
||||
return
|
||||
}
|
||||
upperTable.value?.clearSelection?.()
|
||||
selectionRows.value = []
|
||||
hasSelection.value = false
|
||||
await loadData()
|
||||
} catch {
|
||||
ElMessage.error('库内拦截确定失败')
|
||||
} finally {
|
||||
confirmInterceptLoading.value = false
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user