fix(admin): open measurement detail after review

This commit is contained in:
2026-09-01 20:49:04 +08:00
parent 73b229bb95
commit 2f26760135
4 changed files with 149 additions and 9 deletions
@@ -45,6 +45,9 @@ const warehouseOptions = ref<Array<{ label: string; value: string }>>([])
const selectedInbound = ref<InboundOrderSummary | null>(null)
const measurementDialogOpen = ref(false)
const reviewDialogOpen = ref(false)
const reviewNavigationLoading = ref(false)
const reviewApproved = ref(false)
const reviewNavigationError = ref<ApiErrorDetails | null>(null)
const relationshipDialogOpen = ref(false)
const relationshipDialogInboundCode = ref('')
const batchReviewLoading = ref(false)
@@ -184,7 +187,11 @@ function resetFilters() {
function openTask(row: InboundOrderSummary) {
selectedInbound.value = row
if (isReview.value) reviewDialogOpen.value = true
if (isReview.value) {
reviewApproved.value = false
reviewNavigationError.value = null
reviewDialogOpen.value = true
}
else measurementDialogOpen.value = true
}
@@ -200,10 +207,47 @@ function openRelationship(row: InboundOrderSummary) {
relationshipDialogOpen.value = true
}
function handleTaskChanged() {
reviewDialogOpen.value = false
selectedInbound.value = null
void loadTasks()
async function handleTaskChanged() {
const target = selectedInbound.value
if (!isReview.value) {
reviewDialogOpen.value = false
selectedInbound.value = null
void loadTasks()
return
}
if (!target || reviewNavigationLoading.value) return
reviewApproved.value = true
reviewNavigationError.value = null
const inboundCode = target.inboundCode?.trim()
const orderId = target.orderId?.trim()
if (!inboundCode && !orderId) {
reviewNavigationError.value = { message: '审核已通过,但未找到对应订单,请关闭弹框后刷新列表重试' }
return
}
reviewNavigationLoading.value = true
try {
if (inboundCode) {
await router.push({
name: 'unified-order-detail-by-inbound-code',
params: { inboundCode },
query: { tab: 'measurement', from: 'measurement-review' },
})
} else {
await router.push({
name: 'unified-order-detail',
params: { orderId },
query: { tenantId: target.tenantId, tab: 'measurement', from: 'measurement-review' },
})
}
reviewDialogOpen.value = false
selectedInbound.value = null
} catch (error) {
reviewNavigationError.value = getApiErrorDetails(error, '订单详情打开失败,请重试')
} finally {
reviewNavigationLoading.value = false
}
}
function handleReviewSelectionChange(rows: InboundOrderSummary[]) {
@@ -266,6 +310,9 @@ function handleMeasurementSubmitted() {
function clearSelectedInbound() {
selectedInbound.value = null
reviewApproved.value = false
reviewNavigationError.value = null
reviewNavigationLoading.value = false
}
watch([page, pageSize], () => { void loadTasks() })
@@ -367,9 +414,16 @@ onBeforeUnmount(() => { disposed = true; requestSerial += 1; optionsRequestSeria
top="4vh"
destroy-on-close
append-to-body
:close-on-click-modal="!reviewNavigationLoading"
:close-on-press-escape="!reviewNavigationLoading"
class="inbound-task-dialog"
@closed="clearSelectedInbound"
>
<el-alert v-if="reviewNavigationError" type="error" :closable="false" show-icon class="review-navigation-error">
<template #title>{{ reviewNavigationError.message }}</template>
<ApiErrorMeta :details="reviewNavigationError" />
<el-button v-if="selectedInbound?.inboundCode || selectedInbound?.orderId" link type="danger" :loading="reviewNavigationLoading" @click="handleTaskChanged">重新打开订单详情</el-button>
</el-alert>
<MeasurementReviewPanel
v-if="selectedInbound"
:tenant-id="selectedInbound.tenantId"
@@ -377,6 +431,8 @@ onBeforeUnmount(() => { disposed = true; requestSerial += 1; optionsRequestSeria
:customer-name="selectedInbound.customerName || selectedInbound.companyName"
:channel-name="selectedInbound.channelName"
:channel-code="selectedInbound.channelCode"
:post-approve-loading="reviewNavigationLoading"
:approval-completed="reviewApproved"
@changed="handleTaskChanged"
/>
</el-dialog>
@@ -398,6 +454,7 @@ onBeforeUnmount(() => { disposed = true; requestSerial += 1; optionsRequestSeria
<style scoped>
.inbound-task-page { min-width: 0; }
.state-stack { display: grid; gap: 12px; }
.review-navigation-error { margin-bottom: 14px; }
.row-actions { display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.row-actions .el-button { margin: 0; }
.primary-cell { display: grid; gap: 3px; min-width: 0; }