From b9cfdcf42a23237b363ad28ad5f12a091a297a05 Mon Sep 17 00:00:00 2001 From: ouyangxq <775153912@qq.com> Date: Thu, 13 Aug 2026 20:00:38 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/router/index.test.ts | 3 +- .../pages/InboundOrderDetailView.test.ts | 61 --- .../inbounds/pages/InboundOrderDetailView.vue | 75 ---- .../inbounds/pages/InboundOrdersView.test.ts | 9 +- .../inbounds/pages/InboundOrdersView.vue | 8 +- .../review/MeasurementReviewPanel.test.ts | 25 +- .../review/MeasurementReviewPanel.vue | 6 +- src/modules/inbounds/review/types.ts | 1 + src/modules/inbounds/routes.ts | 10 - .../pages/UnifiedOrdersView.test.ts | 4 +- .../pages/UnifiedOrdersView.vue | 17 +- .../locations/pages/LocationsView.test.ts | 95 ++--- .../locations/pages/LocationsView.vue | 348 ++++++------------ 13 files changed, 183 insertions(+), 479 deletions(-) delete mode 100644 src/modules/inbounds/pages/InboundOrderDetailView.test.ts delete mode 100644 src/modules/inbounds/pages/InboundOrderDetailView.vue diff --git a/src/app/router/index.test.ts b/src/app/router/index.test.ts index 8137c629..d432cb1c 100644 --- a/src/app/router/index.test.ts +++ b/src/app/router/index.test.ts @@ -23,7 +23,6 @@ describe('admin router access metadata', () => { it('protects phase-two inbound operations and master data with deployed permissions', () => { const expected = [ ['inbound-orders', '/inbounds', 'platform:firstleg:inbound:list'], - ['inbound-order-detail', '/inbounds/:inboundId', 'platform:firstleg:inbound:view'], ['fba-carrier-rates', '/first-leg-pricing/carrier-rates', 'firstleg:fba-pricing:rate:view'], ['locations', '/master-data/locations', 'platform:location:list'], ['pallets', '/master-data/pallets', 'platform:pallet:list'], @@ -37,7 +36,7 @@ describe('admin router access metadata', () => { }) it('does not register removed duplicate pricing and FBA placeholder pages', () => { - const removedRouteNames = ['fba-customer-rules', 'general-fba', 'general-voyage'] + const removedRouteNames = ['inbound-order-detail', 'fba-customer-rules', 'general-fba', 'general-voyage'] for (const name of removedRouteNames) { expect(router.getRoutes().some((route) => route.name === name)).toBe(false) diff --git a/src/modules/inbounds/pages/InboundOrderDetailView.test.ts b/src/modules/inbounds/pages/InboundOrderDetailView.test.ts deleted file mode 100644 index 45c9fe7b..00000000 --- a/src/modules/inbounds/pages/InboundOrderDetailView.test.ts +++ /dev/null @@ -1,61 +0,0 @@ -import { readFileSync } from 'node:fs' -import { resolve } from 'node:path' -import ElementPlus from 'element-plus' -import { flushPromises, mount } from '@vue/test-utils' -import { createMemoryHistory, createRouter } from 'vue-router' -import { describe, expect, it } from 'vitest' -import InboundOrderDetailView from './InboundOrderDetailView.vue' - -const source = readFileSync(resolve(process.cwd(), 'src/modules/inbounds/pages/InboundOrderDetailView.vue'), 'utf8') - -describe('InboundOrderDetailView', () => { - it('maps the compatible route parameter to customer context without a detail-page selector', async () => { - const router = createRouter({ - history: createMemoryHistory(), - routes: [ - { path: '/', name: 'dashboard', component: { template: '
首页
' } }, - { path: '/inbounds', name: 'inbound-orders', component: { template: '
入库单列表
' } }, - { path: '/inbounds/:inboundId', name: 'inbound-order-detail', component: InboundOrderDetailView }, - ], - }) - await router.push('/inbounds/19001?tenantId=10002') - await router.isReady() - const wrapper = mount(InboundOrderDetailView, { - global: { - plugins: [router, ElementPlus], - stubs: { - InboundWorkflowWorkspace: { - props: ['customerId', 'inboundId'], - template: '
{{ customerId }}:{{ inboundId }}
', - }, - }, - }, - }) - - expect(wrapper.get('[aria-label="面包屑"]').text()).toContain('首页入库单列表入库单详情') - expect(wrapper.get('[data-testid="workspace"]').text()).toBe('10002:19001') - expect(wrapper.findAll('button').filter((button) => button.text().includes('返回入库单列表'))).toHaveLength(1) - await wrapper.findAll('button').filter((button) => button.text().includes('返回入库单列表')).at(-1)?.trigger('click') - await flushPromises() - expect(router.currentRoute.value.name).toBe('inbound-orders') - expect(router.currentRoute.value.query.tenantId).toBe('10002') - - expect(source).toContain('route.query.tenantId') - expect(source).toContain('const customerId = computed') - expect(source).toContain("name: 'inbound-orders'") - expect(source).toContain(':customer-id="customerId"') - expect(source).toContain(':inbound-id="inboundId"') - expect(source).toContain('缺少所属企业信息,请从入库单列表重新打开') - expect(source).not.toContain('PlatformTenantSelector') - expect(source).not.toContain('租户') - expect(source).toContain(' -import { computed } from 'vue' -import { useRoute, useRouter } from 'vue-router' -import { ArrowLeft, ChevronRight, Home } from '@lucide/vue' -import AdminPage from '@/shared/components/AdminPage.vue' -import DetailPageLayout from '@/shared/components/DetailPageLayout.vue' -import PageToolbar from '@/shared/components/PageToolbar.vue' -import InboundWorkflowWorkspace from '../components/InboundWorkflowWorkspace.vue' - -const route = useRoute() -const router = useRouter() - -function routeValue(value: unknown) { - if (Array.isArray(value)) return String(value[0] || '') - return value === null || value === undefined ? '' : String(value) -} - -const inboundId = computed(() => routeValue(route.params.inboundId)) -const customerId = computed(() => routeValue(route.query.tenantId)) - -function backToList() { - void router.push({ name: 'inbound-orders', query: customerId.value ? { tenantId: customerId.value } : undefined }) -} - -function backToHome() { - void router.push({ name: 'dashboard' }) -} - - - - - diff --git a/src/modules/inbounds/pages/InboundOrdersView.test.ts b/src/modules/inbounds/pages/InboundOrdersView.test.ts index 29f01a37..ac1ad0b4 100644 --- a/src/modules/inbounds/pages/InboundOrdersView.test.ts +++ b/src/modules/inbounds/pages/InboundOrdersView.test.ts @@ -169,7 +169,7 @@ describe('InboundOrdersView', () => { })) }) - it('passes the selected backend tab and routes view to the independent detail page', async () => { + it('passes the selected backend tab and routes view to the unified order detail page', async () => { const wrapper = mountPage() const toolbar = await selectCustomer(wrapper) toolbar.vm.$emit('search') @@ -182,8 +182,8 @@ describe('InboundOrdersView', () => { ;[...document.querySelectorAll('button')].filter((button) => button.textContent?.trim() === '查看').at(-1)?.click() await flushPromises() expect(routerPush).toHaveBeenCalledWith({ - name: 'inbound-order-detail', - params: { inboundId: '19001' }, + name: 'unified-order-detail', + params: { orderId: '18001' }, query: { tenantId: '10002' }, }) expect(wrapper.find('[aria-label="入库单详情抽屉"]').exists()).toBe(false) @@ -334,7 +334,8 @@ describe('InboundOrdersView', () => { expect(source).toContain('preference-key="inbound-orders-table"') expect(columnSource.match(/defaultVisible: false/g)?.length).toBeGreaterThanOrEqual(25) expect(toolbarSource).toMatch(/@media \(max-width: 720px\)[\s\S]*width: 100%/) - expect(source).toContain('处理') expect(source).toContain('') diff --git a/src/modules/inbounds/pages/InboundOrdersView.vue b/src/modules/inbounds/pages/InboundOrdersView.vue index e07b2d84..37076dd7 100644 --- a/src/modules/inbounds/pages/InboundOrdersView.vue +++ b/src/modules/inbounds/pages/InboundOrdersView.vue @@ -283,7 +283,11 @@ function applyFilters() { } function openDetail(row: InboundOrderSummary) { - void router.push({ name: 'inbound-order-detail', params: { inboundId: row.id }, query: { tenantId: row.tenantId } }) + if (!row.orderId) { + ElMessage.warning('该入库单尚未关联订单,暂时无法查看订单详情') + return + } + void router.push({ name: 'unified-order-detail', params: { orderId: row.orderId }, query: { tenantId: row.tenantId } }) } async function printCartonLabels(row: InboundOrderSummary) { if (printingInboundId.value) return @@ -411,7 +415,7 @@ onBeforeUnmount(() => { disposed = true; loadRequestId += 1; customerRequestId + - + diff --git a/src/modules/inbounds/review/MeasurementReviewPanel.test.ts b/src/modules/inbounds/review/MeasurementReviewPanel.test.ts index e2db43a4..8e04bda2 100644 --- a/src/modules/inbounds/review/MeasurementReviewPanel.test.ts +++ b/src/modules/inbounds/review/MeasurementReviewPanel.test.ts @@ -5,7 +5,7 @@ import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' import { useAccessPreviewStore } from '@/core/access/accessPreview' import { useAuthStore } from '@/core/auth/auth' import DataTable from '@/shared/components/DataTable.vue' -import { approveMeasurement, getMeasurementReviewDetail, listMeasurementReviewHistory } from './api' +import { approveMeasurement, getMeasurementReviewDetail, listMeasurementReviewHistory, rejectMeasurement } from './api' import MeasurementReviewPanel from './MeasurementReviewPanel.vue' vi.mock('./api', () => ({ @@ -19,7 +19,7 @@ vi.mock('./api', () => ({ const detail = { inboundId: '90001', inboundCode: 'RK90001', companyName: '柏悦客户', channelCode: 'SEA', channelName: '海运', processStatus: 'MEASURE_PENDING', measureReviewStatus: 'PENDING', recommendedPalletType: 'STANDARD', reviewReason: null, reviewerId: null, reviewerName: null, - measurementId: '70001', sourceType: 'DEVICE', measurementStatus: 'SUBMITTED', version: 4, + measurementId: '70001', sourceType: 'DEVICE', measurementStatus: 'SUBMITTED', inboundVersion: 7, version: 4, originalDocumentNo: 'ORD-001', originalGrossWeightKg: 100, originalVolumeCbm: 2, originalPackageCount: 10, actualPackageCount: 10, actualGrossWeightKg: 110, actualVolumeCbm: 2.2, volumeWeightKg: 367.4, actualGoodsName: '测试货物', items: [{ id: '1', boxCode: 'RK90001#10-1', itemNo: '001', boxSpecification: '60×40×30', packageCount: 10, lengthCm: 60, widthCm: 40, heightCm: 30, girthCm: 240, unitWeightKg: 11, unitVolumeCbm: 0.072, totalWeightKg: 110, totalVolumeCbm: 0.72, volumeWeightKg: 120.24, intelligentImageFileId: '30001', machineNo: 'MJ20210327', measuredAt: '2026-08-04T10:30:00+08:00', overLimitWarning: '周长超过渠道限制,请人工核验尺寸后再作出审核决定', outerLengthCm: 61, outerWidthCm: 41, outerHeightCm: 31, remark: '外箱存在轻微变形' }], @@ -92,7 +92,26 @@ describe('MeasurementReviewPanel', () => { '确认测量审核通过', expect.objectContaining({ confirmButtonText: '通过并完成入库' }), ) - expect(approveMeasurement).toHaveBeenCalledWith('10001', '90001', { measurementId: '70001', expectedVersion: 4 }) + expect(approveMeasurement).toHaveBeenCalledWith('10001', '90001', { measurementId: '70001', expectedVersion: 7 }) expect(wrapper.emitted('changed')).toHaveLength(1) }) + + it('rejects with the inbound optimistic-lock version instead of the measurement version', async () => { + vi.mocked(rejectMeasurement).mockResolvedValue(undefined) + const wrapper = mount(MeasurementReviewPanel, { props: { customerId: '10001', inboundId: '90001' }, global: { plugins: [ElementPlus] } }) + await flushPromises() + + const reject = wrapper.findAll('button').find((button) => button.text().includes('驳回')) + await reject?.trigger('click') + await wrapper.find('textarea').setValue('重量图片需要重新核对') + const confirm = wrapper.findAll('button').find((button) => button.text().includes('确认驳回')) + await confirm?.trigger('click') + await flushPromises() + + expect(rejectMeasurement).toHaveBeenCalledWith('10001', '90001', { + measurementId: '70001', + expectedVersion: 7, + reason: '重量图片需要重新核对', + }) + }) }) diff --git a/src/modules/inbounds/review/MeasurementReviewPanel.vue b/src/modules/inbounds/review/MeasurementReviewPanel.vue index feedcdc8..c2fb80c5 100644 --- a/src/modules/inbounds/review/MeasurementReviewPanel.vue +++ b/src/modules/inbounds/review/MeasurementReviewPanel.vue @@ -156,7 +156,7 @@ async function confirmApprove() { try { await approveMeasurement(customerId.value, props.inboundId, { measurementId: detail.value.measurementId, - expectedVersion: detail.value.version, + expectedVersion: detail.value.inboundVersion, }) ElMessage.success('审核已通过,费用发布和入库正在完成') await reload() @@ -187,14 +187,14 @@ async function submitReason() { if (kind === 'reject') { await rejectMeasurement(customerId.value, props.inboundId, { measurementId: detail.value.measurementId, - expectedVersion: detail.value.version, + expectedVersion: detail.value.inboundVersion, reason: value, }) ElMessage.success('测量已驳回,已退回测量修正') } else { await releaseRejectedMeasurement(customerId.value, props.inboundId, { measurementId: detail.value.measurementId, - expectedVersion: detail.value.version, + expectedVersion: detail.value.inboundVersion, reason: value, }) ElMessage.success('异常放行已提交,后续计费入库将继续处理') diff --git a/src/modules/inbounds/review/types.ts b/src/modules/inbounds/review/types.ts index 7d619a4a..34cfa9be 100644 --- a/src/modules/inbounds/review/types.ts +++ b/src/modules/inbounds/review/types.ts @@ -60,6 +60,7 @@ export interface MeasurementReviewDetail { measurementId: string sourceType: string | null measurementStatus: string | null + inboundVersion: number version: number originalDocumentNo: string | null originalGrossWeightKg: number | null diff --git a/src/modules/inbounds/routes.ts b/src/modules/inbounds/routes.ts index 7006fc73..3aa0d1d2 100644 --- a/src/modules/inbounds/routes.ts +++ b/src/modules/inbounds/routes.ts @@ -31,14 +31,4 @@ export const inboundRoutes = [ permission: 'platform:firstleg:inbound:list', }, }, - { - path: 'inbounds/:inboundId', - name: 'inbound-order-detail', - component: () => import('./pages/InboundOrderDetailView.vue'), - meta: { - title: '入库作业详情', - description: '处理测量、称重、审核并查看费用和托盘库位结果', - permission: 'platform:firstleg:inbound:view', - }, - }, ] satisfies RouteRecordRaw[] diff --git a/src/modules/unified-orders/pages/UnifiedOrdersView.test.ts b/src/modules/unified-orders/pages/UnifiedOrdersView.test.ts index da58f01a..10c78fad 100644 --- a/src/modules/unified-orders/pages/UnifiedOrdersView.test.ts +++ b/src/modules/unified-orders/pages/UnifiedOrdersView.test.ts @@ -149,7 +149,9 @@ describe('UnifiedOrdersView contract', () => { expect(source).toContain(' = { note: StickyNote, @@ -771,10 +761,7 @@ onMounted(() => { 返回列表
-

- {{ detail.summary.inboundCode || `入库单 ${detail.summary.inboundId}` }} - {{ detail?.summary.inboundCode || '暂未生成' }} -

+

{{ detail?.summary.inboundCode || (detail?.summary.inboundId ? `入库单 ${detail.summary.inboundId}` : '暂未生成') }}

{{ detail?.summary.orderNo || `订单 ${orderId}` }}

@@ -1119,8 +1106,6 @@ onMounted(() => { .order-mark { display: grid; width: 36px; height: 36px; flex: 0 0 36px; place-items: center; border-radius: 7px; background: #1d2939; color: #fff; } .order-title { min-width: 0; } .order-title h1 { margin: 0; overflow: hidden; color: #172033; font-size: 18px; line-height: 1.2; text-overflow: ellipsis; white-space: nowrap; } -.inbound-code-link { width: 100%; max-width: 100%; overflow: hidden; justify-content: flex-start; padding: 0; color: var(--cc-primary); font: inherit; font-weight: 700; vertical-align: baseline; } -.inbound-code-link :deep(span) { display: block; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .order-title p { margin: 2px 0 0; color: var(--cc-muted); font-size: 11px; } .detail-header-actions { display: flex; flex: 0 0 auto; gap: 8px; } .detail-header-actions :deep(.el-button + .el-button) { margin-left: 0; } diff --git a/src/modules/warehouse-resources/locations/pages/LocationsView.test.ts b/src/modules/warehouse-resources/locations/pages/LocationsView.test.ts index fe733060..18f6435c 100644 --- a/src/modules/warehouse-resources/locations/pages/LocationsView.test.ts +++ b/src/modules/warehouse-resources/locations/pages/LocationsView.test.ts @@ -145,20 +145,21 @@ describe('LocationsView', () => { it('uses bordered striped tables and explicit semantic row actions', () => { expect(locationsSource).toContain('border') expect(locationsSource).toContain('stripe') - expect(locationsSource).toContain('size="small" plain type="primary"') + expect(locationsSource).toMatch(/size="small"\s+plain\s+type="primary"/) expect(locationsSource).toMatch(/size="small"\s+plain\s+:type=/) expect(locationsSource).toMatch(/size="small"\s+plain\s+type="danger"/) - expect(locationsSource).toContain('') + expect(locationsSource).not.toContain('') expect(locationsSource).toContain('') expect(locationsSource).toContain('') expect(locationsSource).toContain('') expect(locationsSource).toContain('@media (max-width: 720px)') }) - it('uses the prototype-sized centered editor while retaining the detail drawer', () => { - expect(locationsSource).toContain("drawerMode.value === 'view' ? AppDrawer : AppDialog") - expect(locationsSource).toContain("width: 'min(560px, calc(100vw - 28px))'") + it('uses the prototype-sized centered editor without a detail drawer or section cards', () => { + expect(locationsSource).not.toContain('AppDrawer') + expect(locationsSource).not.toContain('FormSection') + expect(locationsSource).toContain('width="min(560px, calc(100vw - 28px))"') expect(locationsSource).toContain(':global(.location-editor-dialog .el-dialog__body) { min-height: 0; overflow-y: auto; }') - expect(locationsSource).toContain('.drawer-form :deep(.form-grid.two-cols) { grid-template-columns: minmax(0, 1fr); }') + expect(locationsSource).toContain('.editor-field-grid { grid-template-columns: minmax(0, 1fr); }') }) beforeEach(() => { vi.stubGlobal('ResizeObserver', ResizeObserverStub) @@ -271,7 +272,7 @@ describe('LocationsView', () => { const bodyRows = wrapper.findAll('tbody tr') expect(bodyRows[0]?.text()).toContain('编辑') - expect(bodyRows[1]?.text()).toContain('详情') + expect(bodyRows[1]?.text()).not.toContain('详情') expect(bodyRows[1]?.text()).not.toContain('编辑') expect(bodyRows[1]?.text()).not.toContain('更多') }) @@ -280,45 +281,23 @@ describe('LocationsView', () => { const wrapper = await mountView(['platform:location:list', 'platform:location:status']) const row = wrapper.find('tbody tr') - expect(row.text()).toContain('详情') + expect(row.text()).not.toContain('详情') expect(row.text()).toContain('停用') expect(row.text()).not.toContain('更多') }) - it('keeps the first three actions visible and moves only the fourth action into more', async () => { + it('shows edit, status, and delete directly for a disabled location', async () => { vi.mocked(listPlatformLocations).mockResolvedValue({ records: [{ ...availableLocation, status: 'DISABLED' }], page: 1, size: 20, total: 1, pages: 1, }) const wrapper = await mountView() const row = wrapper.find('tbody tr') - expect(row.text()).toContain('详情') + expect(row.text()).not.toContain('详情') expect(row.text()).toContain('编辑') expect(row.text()).toContain('启用') - expect(row.text()).not.toContain('删除') - expect(row.find('button[aria-label="A1-01的更多操作"]').exists()).toBe(true) - }) - - it('uses business labels without exposing internal ids in more actions', async () => { - vi.mocked(listPlatformLocations).mockResolvedValue({ - records: [ - { ...availableLocation, id: 'location-1', locationCode: '', locationName: '东侧库位', status: 'DISABLED' }, - { ...availableLocation, id: 'location-2', locationCode: '', locationName: '', status: 'DISABLED' }, - { ...availableLocation, id: undefined, locationCode: '', locationName: '', status: 'DISABLED' } as unknown as PlatformLocationResource, - ], - page: 1, - size: 20, - total: 3, - pages: 1, - }) - const wrapper = await mountView() - const moreButtons = wrapper.findAll('button[aria-label$="的更多操作"]') - const labels = moreButtons.map((button) => button.attributes('aria-label')) - - expect(labels).toEqual(['东侧库位的更多操作', '当前库位的更多操作', '当前库位的更多操作']) - expect(moreButtons.map((button) => button.attributes('title'))).toEqual(labels) - expect(labels.every((label) => Boolean(label) && !/undefined|null/.test(label ?? ''))).toBe(true) - expect(labels.join(' ')).not.toContain('location-2') + expect(row.text()).toContain('删除') + expect(row.text()).not.toContain('更多') }) it('does not offer editing for a location outside a domestic warehouse', async () => { @@ -328,41 +307,32 @@ describe('LocationsView', () => { const wrapper = await mountView() const bodyRows = wrapper.findAll('tbody tr') - expect(bodyRows[0]?.text()).toContain('详情') + expect(bodyRows[0]?.text()).not.toContain('详情') expect(bodyRows[0]?.text()).not.toContain('编辑') expect(bodyRows[1]?.text()).toContain('编辑') }) - it('opens an authenticated detail view with warehouse context', async () => { + it('loads the latest authenticated detail before opening the editor', async () => { const wrapper = await mountView() - const detailButton = wrapper.find('.el-table__body-wrapper tbody tr button') - expect(detailButton.text()).toBe('详情') - await detailButton.trigger('click') + const editButton = wrapper.findAll('.el-table__body-wrapper tbody tr button').find((button) => button.text().trim() === '编辑') + await editButton!.trigger('click') await flushPromises() expect(getPlatformLocation).toHaveBeenCalledWith(warehouseId, availableLocation.id) - expect(document.body.textContent).toContain('库位详情') - expect(document.body.textContent).toContain('义乌收货仓(CN-YW-01)') - expect(document.body.textContent).toContain('资源作用域平台公共资源') + expect(document.body.textContent).toContain('编辑库位') + expect(document.body.textContent).toContain('A1 区 01 位') expect(document.body.textContent).not.toContain('所属企业') expect(document.body.textContent).not.toContain('企业 ID') - expect(document.body.textContent).toContain('库位名称A1 区 01 位') - expect(document.body.textContent).toContain('v3') + expect(document.body.querySelector('.el-drawer')).toBeNull() }) - it('presents occupied locations as read-only business resources', async () => { - vi.mocked(getPlatformLocation).mockResolvedValueOnce({ - location: occupiedLocation, - warehouseCode: warehouse.warehouseCode, - warehouseName: warehouse.warehouseName, - }) + it('does not provide a detail or edit entry for occupied locations', async () => { const wrapper = await mountView() const occupiedRow = wrapper.findAll('tbody tr')[1] - await occupiedRow!.find('button').trigger('click') - await flushPromises() - expect(document.body.textContent).toContain('状态已占用') - expect(document.body.textContent).toContain('当前库位正在被业务使用,只允许查看。') + expect(occupiedRow?.text()).not.toContain('详情') + expect(occupiedRow?.text()).not.toContain('编辑') + expect(occupiedRow?.findAll('button')).toHaveLength(0) }) it('clears the warehouse on reset and immediately restores the full query', async () => { @@ -405,7 +375,7 @@ describe('LocationsView', () => { }) }) - it('keeps the latest detail when an older location request finishes last', async () => { + it('keeps the latest editor request when an older location request finishes last', async () => { const secondLocation = { ...availableLocation, id: '9223372036854775800', locationCode: 'A1-03' } const firstDetail = { location: availableLocation, warehouseCode: warehouse.warehouseCode, warehouseName: warehouse.warehouseName } const secondDetail = { location: secondLocation, warehouseCode: warehouse.warehouseCode, warehouseName: warehouse.warehouseName } @@ -417,20 +387,19 @@ describe('LocationsView', () => { })) const wrapper = await mountView() const vm = wrapper.vm as unknown as { - drawerOpen: boolean - detail: typeof firstDetail | null - loadDetail(row: PlatformLocationResource, mode: 'view' | 'edit'): Promise + editorOpen: boolean + form: { locationCode: string } + openEdit(row: PlatformLocationResource): Promise } - void vm.loadDetail(availableLocation, 'view') - vm.drawerOpen = false - await wrapper.vm.$nextTick() - void vm.loadDetail(secondLocation, 'view') + void vm.openEdit(availableLocation) + void vm.openEdit(secondLocation) resolveSecond(secondDetail) await flushPromises() resolveFirst(firstDetail) await flushPromises() - expect(vm.detail?.location.locationCode).toBe('A1-03') + expect(vm.editorOpen).toBe(true) + expect(vm.form.locationCode).toBe('A1-03') }) }) diff --git a/src/modules/warehouse-resources/locations/pages/LocationsView.vue b/src/modules/warehouse-resources/locations/pages/LocationsView.vue index 15c481f6..f10e22bc 100644 --- a/src/modules/warehouse-resources/locations/pages/LocationsView.vue +++ b/src/modules/warehouse-resources/locations/pages/LocationsView.vue @@ -1,16 +1,13 @@