fix: load overall overseas pallet summary
This commit is contained in:
@@ -31,6 +31,19 @@ describe('PalletsView', () => {
|
||||
vi.mocked(updatePallet).mockReset().mockResolvedValue(null)
|
||||
})
|
||||
|
||||
it('loads the all-warehouse pallet summary when the page opens', async () => {
|
||||
vi.mocked(getPalletSummary).mockResolvedValueOnce({ totalCount: 250, idleCount: 100, occupiedCount: 98, scrappedCount: 52 })
|
||||
|
||||
const wrapper = mount(PalletsView, { attachTo: document.body, global: { plugins: [ElementPlus] } })
|
||||
await flushPromises()
|
||||
|
||||
expect(getPalletSummary).toHaveBeenCalledWith('', {})
|
||||
expect(wrapper.get('[aria-label="海外托盘数量概览"]').text()).toContain('托盘总数250')
|
||||
expect(wrapper.get('[aria-label="海外托盘数量概览"]').text()).toContain('闲置托盘100')
|
||||
expect(wrapper.get('[aria-label="海外托盘数量概览"]').text()).toContain('占用托盘98')
|
||||
expect(wrapper.get('[aria-label="海外托盘数量概览"]').text()).toContain('已报废52')
|
||||
})
|
||||
|
||||
it('loads the current detail version and keeps the edit open on a conflict', async () => {
|
||||
vi.mocked(updatePallet).mockRejectedValueOnce(Object.assign(new Error('version conflict'), { code: 'A0409' }))
|
||||
const wrapper = mount(PalletsView, { attachTo: document.body, global: { plugins: [ElementPlus] } })
|
||||
|
||||
@@ -63,12 +63,14 @@ async function loadWarehouses() {
|
||||
warehouses.value = []; filters.value.warehouseId = ''; rows.value = []; total.value = 0
|
||||
contextLoading.value = true; loadError.value = null; loadErrorKind.value = 'context'
|
||||
try {
|
||||
const [warehousePage, platformFbaWarehouses] = await Promise.all([
|
||||
const [warehousePage, platformFbaWarehouses, overallSummary] = await Promise.all([
|
||||
listReceivingOverseasWarehouses(),
|
||||
listAllPlatformWarehouses({ warehouseType: 'FBA', status: 'ACTIVE' }),
|
||||
getPalletSummary('', {}),
|
||||
])
|
||||
warehouses.value = warehousePage.records
|
||||
fbaWarehouses.value = platformFbaWarehouses
|
||||
summary.value = overallSummary
|
||||
}
|
||||
catch (error) { loadError.value = getApiErrorDetails(error, '海外仓列表加载失败,请重试') }
|
||||
finally { contextLoading.value = false }
|
||||
|
||||
Reference in New Issue
Block a user