fix(admin): 隐藏散板需求通往旧车次页面的入口
This commit is contained in:
@@ -38,6 +38,21 @@ function mount(component: object, props: Record<string, unknown> = {}): { wrappe
|
||||
const button = (w: VueWrapper, label: string) => w.findAll('button').find(b => b.text() === label)!
|
||||
beforeEach(() => { state.route.query = {}; vi.clearAllMocks(); state.manage = false; state.write = true; state.quote = false; state.links.clear(); vi.mocked(ElMessageBox.confirm).mockImplementation(vi.fn().mockResolvedValue(undefined)); vi.mocked(api.listCapacityOffers).mockResolvedValue(pageOf([structuredClone(offer)], 41)); vi.mocked(api.listCapacityInquiries).mockResolvedValue(pageOf([structuredClone(inquiry)])); vi.mocked(api.getCapacityOffer).mockResolvedValue({ offer: structuredClone(offer), inquiries: pageOf([structuredClone(inquiry)]) }) })
|
||||
afterEach(() => { wrappers.splice(0).forEach(w => w.unmount()); vi.useRealTimers() })
|
||||
it('hides both legacy trip entries even for managers while retaining read-only offer detail', async () => {
|
||||
state.manage = true
|
||||
state.links.add('platform:fleet:trip:list')
|
||||
const { wrapper: list } = mount(CapacityOffersView); await flushPromises()
|
||||
expect(button(list, '选择车次发布余位')).toBeUndefined()
|
||||
await button(list, '详情').trigger('click'); await flushPromises()
|
||||
expect(state.push).toHaveBeenCalledExactlyOnceWith({ name: 'overseas-master-data-capacity-offer-detail', params: { offerNo: offer.offerNo } })
|
||||
state.push.mockClear()
|
||||
const { wrapper: detail } = mount(CapacityOfferDetailView); await flushPromises()
|
||||
expect(detail.text()).toContain(offer.tripNo)
|
||||
expect(button(detail, offer.tripNo)).toBeUndefined()
|
||||
expect(detail.text()).toContain(offer.contactPhone)
|
||||
expect(state.push).not.toHaveBeenCalled()
|
||||
})
|
||||
|
||||
it.each(['DRAFT', 'CONFIRMED', 'RECEIVED', 'BOUND', 'CANCELLED'] as const)('labels %s cargo consistently in the list and detail without treating estimated pallets as actual', async status => {
|
||||
const row: CapacityInquiry = { ...inquiry, status, expectedPalletCount: 7, cargo: { ...inquiry.cargo, packageCount: 12, palletSpaces: 3, weightKg: 80, volumeCbm: 2 } }
|
||||
const label = status === 'RECEIVED' || status === 'BOUND' ? '已核实' : status === 'CANCELLED' ? '记录' : '预报'
|
||||
|
||||
Reference in New Issue
Block a user