fix: show inquiry return text on dispatch detail

This commit is contained in:
2026-10-11 16:11:58 +08:00
parent 315cb8e663
commit f97cdad353
3 changed files with 7 additions and 4 deletions
@@ -11,6 +11,7 @@ withDefaults(defineProps<{
referenceLabel: string referenceLabel: string
referenceValue: string referenceValue: string
backLabel: string backLabel: string
backText?: string
domain: string domain: string
pending?: boolean pending?: boolean
statusText?: string statusText?: string
@@ -23,13 +24,13 @@ defineEmits<{ back: [] }>()
<AdminPage as="div" class="overseas-detail-page" :class="{ 'admin-density': dense }" :aria-label="title"> <AdminPage as="div" class="overseas-detail-page" :class="{ 'admin-density': dense }" :aria-label="title">
<header v-if="dense" class="density-detail-header"> <header v-if="dense" class="density-detail-header">
<div class="overseas-detail-title density-detail-heading"> <div class="overseas-detail-title density-detail-heading">
<el-button link class="density-back" :aria-label="backLabel" @click="$emit('back')"><ArrowLeft :size="16" />返回列表</el-button> <el-button link class="density-back" :aria-label="backLabel" @click="$emit('back')"><ArrowLeft :size="16" />{{ backText || '返回列表' }}</el-button>
<h1 class="density-detail-title"><slot name="reference">{{ referenceValue }}</slot></h1> <h1 class="density-detail-title"><slot name="reference">{{ referenceValue }}</slot></h1>
<StatusBadge v-if="statusText" :status="statusText" /> <StatusBadge v-if="statusText" :status="statusText" />
</div> </div>
</header> </header>
<header v-else class="overseas-detail-head"> <header v-else class="overseas-detail-head">
<el-button :class="{ 'density-back': dense }" :link="dense" :aria-label="backLabel" @click="$emit('back')"><ArrowLeft :size="16" />返回</el-button> <el-button :class="{ 'density-back': dense }" :link="dense" :aria-label="backLabel" @click="$emit('back')"><ArrowLeft :size="16" />{{ backText || '返回' }}</el-button>
<div class="overseas-detail-title"> <div class="overseas-detail-title">
<h1>{{ title }}</h1> <h1>{{ title }}</h1>
<p>{{ referenceLabel }} <strong><slot name="reference">{{ referenceValue }}</slot></strong></p> <p>{{ referenceLabel }} <strong><slot name="reference">{{ referenceValue }}</slot></strong></p>
@@ -46,7 +46,9 @@ describe('DispatchDetailView', () => {
if (fromInquiry) Object.assign(sourceQuery, { fleetSource: 'inquiry', fleetOfferNo: 'FO-1', fleetBookingNo: 'FB-2' }) if (fromInquiry) Object.assign(sourceQuery, { fleetSource: 'inquiry', fleetOfferNo: 'FO-1', fleetBookingNo: 'FB-2' })
const wrapper = mount(DispatchDetailView, { global: { plugins: [ElementPlus], stubs: { DataTable: DataTableStub } } }) const wrapper = mount(DispatchDetailView, { global: { plugins: [ElementPlus], stubs: { DataTable: DataTableStub } } })
await flushPromises() await flushPromises()
wrapper.findComponent({ name: 'OverseasDetailShell' }).vm.$emit('back') const backButton = wrapper.get('button.density-back')
expect(backButton.text()).toBe(fromInquiry ? '返回原拼车登记' : '返回列表')
await backButton.trigger('click')
expect(routerPush).toHaveBeenCalledWith(fromInquiry ? { name: 'overseas-master-data-capacity-offer-detail', params: { offerNo: 'FO-1' }, query: { inquiry: 'FB-2' } } : { name: 'overseas-dispatches' }) expect(routerPush).toHaveBeenCalledWith(fromInquiry ? { name: 'overseas-master-data-capacity-offer-detail', params: { offerNo: 'FO-1' }, query: { inquiry: 'FB-2' } } : { name: 'overseas-dispatches' })
wrapper.unmount() wrapper.unmount()
}) })
@@ -135,7 +135,7 @@ onMounted(load)
</script> </script>
<template> <template>
<OverseasDetailShell class="admin-density" dense title="排车详情" reference-label="排车单号" :reference-value="detail?.dispatchNo || dispatchNo" :back-label="inquiryReturnTarget(route.query) ? '返回原拼车登记' : '返回排车列表'" domain="排车详情" :pending="false" :status-text="detail ? dispatchStatus(detail.status) : '加载中'" @back="back"> <OverseasDetailShell class="admin-density" dense title="排车详情" reference-label="排车单号" :reference-value="detail?.dispatchNo || dispatchNo" :back-text="inquiryReturnTarget(route.query) ? '返回原拼车登记' : undefined" :back-label="inquiryReturnTarget(route.query) ? '返回原拼车登记' : '返回排车列表'" domain="排车详情" :pending="false" :status-text="detail ? dispatchStatus(detail.status) : '加载中'" @back="back">
<LoadErrorState v-if="loadError" title="排车详情加载失败" :message="loadError.message" :loading="loading" @retry="load"><template #details><ApiErrorMeta :details="loadError" /></template></LoadErrorState> <LoadErrorState v-if="loadError" title="排车详情加载失败" :message="loadError.message" :loading="loading" @retry="load"><template #details><ApiErrorMeta :details="loadError" /></template></LoadErrorState>
<div v-else v-loading="loading" class="dispatch-detail" :aria-busy="loading"> <div v-else v-loading="loading" class="dispatch-detail" :aria-busy="loading">
<div class="summary-grid"> <div class="summary-grid">