This commit is contained in:
2026-08-12 12:19:02 +08:00
parent f9ff9086d5
commit 11e085e30f
24 changed files with 230 additions and 50 deletions
@@ -208,7 +208,7 @@ describe('LocationsView', () => {
expect(wrapper.text()).toContain('义乌收货仓')
expect(wrapper.text()).toContain('A1-01')
expect(wrapper.findAll('thead th').map((item) => item.text().trim())).toEqual([
'操作', '库位编码', '所属仓库', '库区', '库位类型', '最大承重(kg)', '状态', '备注',
'操作', '库位编码', '所属仓库', '库区', '库位类型', '状态',
])
})
@@ -277,7 +277,7 @@ describe('LocationsView', () => {
expect(row.find('button[aria-label="A1-01的更多操作"]').exists()).toBe(true)
})
it('uses unique fallback labels for more actions across rows', async () => {
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' },
@@ -293,10 +293,10 @@ describe('LocationsView', () => {
const moreButtons = wrapper.findAll('button[aria-label$="的更多操作"]')
const labels = moreButtons.map((button) => button.attributes('aria-label'))
expect(labels).toEqual(['东侧库位的更多操作', 'location-2的更多操作', '当前库位的更多操作'])
expect(labels).toEqual(['东侧库位的更多操作', '当前库位的更多操作', '当前库位的更多操作'])
expect(moreButtons.map((button) => button.attributes('title'))).toEqual(labels)
expect(new Set(labels).size).toBe(labels.length)
expect(labels.every((label) => Boolean(label) && !/undefined|null/.test(label ?? ''))).toBe(true)
expect(labels.join(' ')).not.toContain('location-2')
})
it('does not offer editing for a location outside a domestic warehouse', async () => {
@@ -181,9 +181,9 @@ const columns: DataTableColumn[] = [
{ key: 'warehouse', label: '所属仓库', minWidth: 210, slotName: 'warehouse' },
{ key: 'zone', label: '库区', minWidth: 150, slotName: 'zone' },
{ key: 'locationType', label: '库位类型', width: 120, slotName: 'locationType' },
{ key: 'maxWeightKg', label: '最大承重(kg)', minWidth: 140, slotName: 'maxWeightKg' },
{ key: 'maxWeightKg', label: '最大承重(kg)', minWidth: 140, slotName: 'maxWeightKg', defaultVisible: false },
{ key: 'status', label: '状态', width: 110, slotName: 'status' },
{ key: 'remark', label: '备注', minWidth: 220, slotName: 'remark' },
{ key: 'remark', label: '备注', minWidth: 220, slotName: 'remark', defaultVisible: false },
]
function apiId(value: string) {
@@ -226,7 +226,7 @@ function hasMoreLocationActions(row: PlatformLocationResource) {
}
function locationMoreActionsLabel(row: PlatformLocationResource) {
const identifier = [row.locationCode, row.locationName, row.id]
const identifier = [row.locationCode, row.locationName]
.map((value) => String(value ?? '').trim())
.find(Boolean) || '当前库位'
return `${identifier}的更多操作`
@@ -149,10 +149,13 @@ describe('PalletsView', () => {
page: 1, size: 20,
})
expect(wrapper.text()).toContain('TP-001')
expect(wrapper.text()).toContain('义乌收货仓')
expect(wrapper.text()).toContain('CN-YW-01')
expect(wrapper.text()).toContain('木托盘')
expect(wrapper.text()).toContain('1.2 m³')
expect(wrapper.text()).toContain('8 kg')
expect(wrapper.text()).toContain('黄色')
expect(wrapper.find('.data-table').text()).not.toContain('黄色')
expect(wrapper.find('.data-table').text()).not.toContain('标准川字托盘')
expect(wrapper.text()).not.toContain('更新时间')
const tableToolbar = wrapper.find('.table-panel .data-table__toolbar')
expect(tableToolbar.exists()).toBe(true)
@@ -168,7 +171,9 @@ describe('PalletsView', () => {
expect(wrapper.text()).not.toContain('租户')
expect(wrapper.find('.data-table').exists()).toBe(true)
expect(wrapper.find('.table-actions.pallet-row-actions').exists()).toBe(true)
expect(wrapper.findAll('thead th').map((item) => item.text().trim())[0]).toBe('操作')
expect(wrapper.findAll('thead th').map((item) => item.text().trim())).toEqual([
'操作', '托盘编码', '所属仓库', '托盘类型', '托盘容积(m³)', '托盘重量(kg)',
])
})
it('queries all customers explicitly without adding a customer id', async () => {
@@ -128,11 +128,12 @@ const { captureBaseline } = useUnsavedWorkRegistration({
const columns: DataTableColumn[] = [
{ key: 'actions', label: '操作', minWidth: 224, fixed: 'left', slotName: 'actions' },
{ key: 'pallet', label: '托盘编码', minWidth: 190, slotName: 'pallet' },
{ key: 'warehouse', label: '所属仓库', minWidth: 210, slotName: 'warehouse' },
{ key: 'palletType', prop: 'palletType', label: '托盘类型', minWidth: 140 },
{ key: 'capacity', label: '托盘容积(m³)', minWidth: 160, slotName: 'capacity' },
{ key: 'weight', label: '托盘重量(kg)', minWidth: 160, slotName: 'weight' },
{ key: 'color', prop: 'color', label: '颜色', minWidth: 120 },
{ key: 'remark', label: '备注', minWidth: 220, slotName: 'remark' },
{ key: 'color', prop: 'color', label: '颜色', minWidth: 120, defaultVisible: false },
{ key: 'remark', label: '备注', minWidth: 220, slotName: 'remark', defaultVisible: false },
]
function apiId(value: string) {
@@ -434,6 +435,9 @@ onMounted(() => {
<template #pallet="{ row }">
<div class="pallet-cell"><span><Boxes :size="18" /></span><strong>{{ (row as PlatformPalletResource).palletCode }}</strong></div>
</template>
<template #warehouse="{ row }">
<div class="stacked-value"><strong>{{ warehouseFor((row as PlatformPalletResource).warehouseId)?.warehouseName || '—' }}</strong><small>{{ warehouseFor((row as PlatformPalletResource).warehouseId)?.warehouseCode || '—' }}</small></div>
</template>
<template #capacity="{ row }"><strong>{{ formatCapacity((row as PlatformPalletResource).capacityCbm) }}</strong></template>
<template #weight="{ row }"><strong>{{ formatWeight((row as PlatformPalletResource).weightKg) }}</strong></template>
<template #remark="{ row }"><span class="remark-text">{{ (row as PlatformPalletResource).remark || '—' }}</span></template>
@@ -551,6 +555,9 @@ onMounted(() => {
.pallet-row-actions { gap: 8px; white-space: nowrap; }
.pallet-row-actions :deep(.el-button + .el-button) { margin-left: 0; }
.pallet-cell { display: flex; align-items: center; gap: 10px; }
.stacked-value { display: grid; min-width: 0; gap: 3px; }
.stacked-value strong, .stacked-value small { overflow-wrap: anywhere; }
.stacked-value small { color: var(--cc-muted); font-size: 11px; }
.pallet-cell > span, .detail-hero > span { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; border-radius: 8px; background: var(--el-color-primary-light-9); color: var(--cc-primary); }
.pallet-cell > span { width: 34px; height: 34px; }
.remark-text { display: -webkit-box; overflow: hidden; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-height: 1.55; }