This commit is contained in:
2026-08-05 17:10:10 +08:00
parent 4b31eb7786
commit 6736893128
4 changed files with 129 additions and 55 deletions
@@ -200,7 +200,12 @@ describe('LocationsView', () => {
const wrapper = await mountView()
await selectScope(wrapper)
expect(wrapper.find('.table-panel .panel-heading').exists()).toBe(false)
const panelHeading = wrapper.find('.table-panel .panel-heading')
expect(panelHeading.exists()).toBe(true)
expect(panelHeading.text()).toContain('库位列表')
expect(panelHeading.text()).toContain('共 2 个库位')
expect(panelHeading.text()).toContain('新增库位')
expect(wrapper.findComponent(QueryToolbar).text()).not.toContain('新增库位')
expect(listPlatformWarehouses).toHaveBeenCalledWith(undefined, 1, 200)
expect(listPlatformLocations).toHaveBeenLastCalledWith({
page: 1,
@@ -220,7 +225,7 @@ describe('LocationsView', () => {
it('opens creation without a list filter and requires the warehouse inside the form', async () => {
const wrapper = await mountView()
const createButton = wrapper.findAll('button').find((button) => button.text().trim() === '新增库位')
const createButton = wrapper.find('.table-panel .panel-heading').findAll('button').find((button) => button.text().trim() === '新增库位')
expect(createButton?.attributes('disabled')).toBeUndefined()
await createButton!.trigger('click')
@@ -495,15 +495,7 @@ onMounted(() => {
ariaLabel="库位筛选"
:fields="queryFields"
@search="applyFilters"
>
<template #actions>
<el-button
v-if="access.can('platform:location:create')"
type="primary"
@click="openCreate"
><Plus :size="16" />新增库位</el-button>
</template>
</QueryToolbar>
/>
<el-alert v-if="customerError" type="warning" :closable="false" show-icon class="state-alert">
<template #title>所属企业列表加载失败</template>
@@ -527,7 +519,15 @@ onMounted(() => {
<el-button size="small" @click="loadLocations()">重新查询</el-button>
</el-alert>
<section class="surface-panel table-panel">
<section class="surface-panel table-panel" aria-label="库位列表区域">
<div class="panel-heading">
<div><h2>库位列表</h2><p>共 {{ total }} 个库位</p></div>
<el-button
v-if="access.can('platform:location:create')"
type="primary"
@click="openCreate"
><Plus :size="16" />新增库位</el-button>
</div>
<DataTable
v-model:page="page"
v-model:page-size="pageSize"