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}的更多操作`