This commit is contained in:
2026-09-30 14:01:58 +08:00
parent f14e1a2ea3
commit 8c51e9c1cf
109 changed files with 1525 additions and 651 deletions
@@ -216,7 +216,7 @@ describe('LocationsView', () => {
const wrapper = await mountView()
await selectScope(wrapper)
const tableToolbar = wrapper.find('.table-panel .data-table__toolbar')
const tableToolbar = wrapper.find('.data-table--integrated .data-table__toolbar')
expect(tableToolbar.exists()).toBe(true)
expect(tableToolbar.text()).toContain('新增库位')
expect(tableToolbar.text()).not.toContain('库位列表')
@@ -242,7 +242,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.find('.table-panel .data-table__toolbar').findAll('button').find((button) => button.text().trim() === '新增库位')
const createButton = wrapper.find('.data-table--integrated .data-table__toolbar').findAll('button').find((button) => button.text().trim() === '新增库位')
expect(createButton?.attributes('disabled')).toBeUndefined()
await createButton!.trigger('click')
@@ -258,7 +258,7 @@ describe('LocationsView', () => {
const toolbar = wrapper.findComponent(QueryToolbar)
toolbar.vm.$emit('update:modelValue', { ...(toolbar.props('modelValue') as QueryModel), warehouseId: fbaWarehouse.id })
await flushPromises()
const createButton = wrapper.find('.table-panel .data-table__toolbar').findAll('button').find((button) => button.text().trim() === '新增库位')
const createButton = wrapper.find('.data-table--integrated .data-table__toolbar').findAll('button').find((button) => button.text().trim() === '新增库位')
await createButton!.trigger('click')
await flushPromises()
@@ -483,7 +483,25 @@ onMounted(() => {
<template>
<AdminPage as="div" class="location-page admin-density">
<ListPageLayout aria-label="库位列表页面">
<template #toolbar>
<section aria-label="库位列表区域"><DataTable appearance="integrated" :stripe="false" column-settings-mode="show" :results-visible="!loadError"
v-model:page="page"
v-model:page-size="pageSize"
:data="rows"
:columns="columns"
border
preference-key="locations-table"
:loading="loading"
:total="total"
:page-sizes="[20, 50, 100, 200]"
row-key="id"
aria-label="库位列表"
:empty-text="emptyDescription"
>
<template #toolbar-start><h1>库位管理</h1></template>
<template #filters>
<QueryToolbar
v-model="filters"
ariaLabel="库位筛选"
@@ -492,7 +510,7 @@ onMounted(() => {
@search="applyFilters"
/>
</template>
<template #state>
<template #notices>
<LoadErrorState
v-if="warehouseError"
title="仓库列表加载失败"
@@ -512,25 +530,9 @@ onMounted(() => {
/>
</template>
<section v-if="!loadError" class="surface-panel table-panel" aria-label="库位列表区域">
<DataTable
v-model:page="page"
v-model:page-size="pageSize"
:data="rows"
:columns="columns"
border
stripe
preference-key="locations-table"
:loading="loading"
:total="total"
:page-sizes="[20, 50, 100, 200]"
row-key="id"
aria-label="库位列表"
:empty-text="emptyDescription"
>
<template #toolbar-actions><el-button v-if="access.can('platform:location:create')" type="primary" @click="openCreate"><Plus :size="16" />新增库位</el-button></template>
<template #actions="{ row }">
<div class="location-actions density-actions">
<template #actions="{ row }"><div class="location-actions density-actions row-actions admin-text-actions">
<el-button
v-if="canEdit(row as PlatformLocationResource)"
size="small"
@@ -554,8 +556,7 @@ onMounted(() => {
:disabled="loading || actionLoadingIds.has(String((row as PlatformLocationResource).id))"
@click="removeLocation(row as PlatformLocationResource)"
>删除</el-button>
</div>
</template>
</div></template>
<template #location="{ row }">
<div class="location-cell">
<span><MapPin :size="17" /></span>
@@ -593,8 +594,7 @@ onMounted(() => {
</el-empty>
</template>
<template #pagination-left="{ total: tableTotal }"><span>共 {{ tableTotal }} 个库位</span></template>
</DataTable>
</section>
</DataTable></section>
</ListPageLayout>
<AppDialog
@@ -185,7 +185,7 @@ describe('PalletsView', () => {
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')
const tableToolbar = wrapper.find('.data-table--integrated .data-table__toolbar')
expect(tableToolbar.exists()).toBe(true)
expect(tableToolbar.text()).toContain('新增托盘')
expect(tableToolbar.text()).not.toContain('托盘列表')
@@ -2,7 +2,7 @@
import '@/styles/adminDensity.css'
import { computed, onMounted, reactive, ref, watch } from 'vue'
import { ElMessage, ElMessageBox, type FormInstance, type FormRules } from 'element-plus'
import { Boxes, Plus, Save, Warehouse as WarehouseIcon } from '@lucide/vue'
import { Boxes, Plus, Save } from '@lucide/vue'
import { useAccessPreviewStore } from '@/core/access/accessPreview'
import { useUnsavedWorkRegistration } from '@/core/unsaved-work/useUnsavedWorkRegistration'
import { listAllPlatformWarehouses, type PlatformWarehouseResource } from '@/modules/warehouses'
@@ -345,16 +345,34 @@ onMounted(() => {
<template>
<AdminPage as="div" class="pallet-page admin-density">
<section class="summary-grid" aria-label="托盘数量概览">
<ListPageLayout aria-label="托盘列表页面">
<section aria-label="托盘列表区域"><DataTable appearance="integrated" :stripe="false" column-settings-mode="show" :results-visible="!loadError"
v-model:page="page"
v-model:page-size="pageSize"
:data="rows"
:columns="columns"
border
preference-key="pallets-table"
:loading="loading || warehouseLoading"
:total="total"
row-key="id"
:empty-text="filtered ? '暂无符合筛选条件的托盘' : '暂无托盘数据'"
aria-label="托盘列表"
>
<template #before-results> <section class="summary-grid" aria-label="托盘数量概览">
<article><span>托盘总数</span><strong>{{ summary.totalCount }}</strong></article>
<article><span>闲置托盘</span><strong class="idle">{{ summary.idleCount }}</strong></article>
<article><span>占用托盘</span><strong class="occupied">{{ summary.occupiedCount }}</strong></article>
</section>
<ListPageLayout aria-label="托盘列表页面">
<template #toolbar>
</section></template>
<template #toolbar-start><h1>托盘管理</h1></template>
<template #filters>
<QueryToolbar
v-model="filters"
class="surface-panel pallet-filter-toolbar"
class="pallet-filter-toolbar"
ariaLabel="托盘筛选"
:fields="queryFields"
preference-key="pallets-query"
@@ -363,7 +381,7 @@ onMounted(() => {
@reset="resetFilters"
/>
</template>
<template #state>
<template #notices>
<LoadErrorState
v-if="warehouseError"
title="仓库列表暂时无法加载"
@@ -380,24 +398,9 @@ onMounted(() => {
/>
</template>
<section v-if="!loadError" class="table-panel surface-panel" aria-label="托盘列表区域">
<DataTable
v-model:page="page"
v-model:page-size="pageSize"
:data="rows"
:columns="columns"
border
stripe
preference-key="pallets-table"
:loading="loading || warehouseLoading"
:total="total"
row-key="id"
:empty-text="filtered ? '暂无符合筛选条件的托盘' : '暂无托盘数据'"
aria-label="托盘列表"
>
<template #toolbar-actions><el-button v-if="access.can('platform:pallet:create')" type="primary" @click="openCreate"><Plus :size="16" />新增托盘</el-button></template>
<template #actions="{ row }">
<div class="pallet-row-actions density-actions">
<template #actions="{ row }"><div class="pallet-row-actions density-actions row-actions admin-text-actions">
<el-button v-if="access.can('platform:pallet:edit') && isDomesticWarehouse((row as PlatformPalletResource).warehouseId)" class="density-action" size="small" title="编辑托盘" @click="openEdit(row as PlatformPalletResource)">编辑</el-button>
<el-button
v-if="access.can('platform:pallet:delete')"
@@ -407,8 +410,7 @@ onMounted(() => {
:loading="deletingIds.has(String((row as PlatformPalletResource).id))"
@click="removePallet(row as PlatformPalletResource)"
>删除</el-button>
</div>
</template>
</div></template>
<template #pallet="{ row }">
<div class="pallet-cell"><span><Boxes :size="18" /></span><strong>{{ (row as PlatformPalletResource).palletCode }}</strong></div>
</template>
@@ -419,8 +421,7 @@ onMounted(() => {
<template #weight="{ row }"><strong>{{ formatWeight((row as PlatformPalletResource).weightKg) }}</strong></template>
<template #remark="{ row }"><span class="remark-text">{{ (row as PlatformPalletResource).remark || '—' }}</span></template>
<template #pagination-left="{ total: tableTotal }"><span>共 {{ tableTotal }} 个托盘</span></template>
</DataTable>
</section>
</DataTable></section>
</ListPageLayout>
<AppDialog v-model="editorOpen" :title="editorTitle" width="min(560px, calc(100vw - 28px))" class="pallet-editor-dialog admin-density-dialog" :close-on-click-modal="false" :confirm-loading="saving" :show-confirm="false" destroy-on-close>
+2 -2
View File
@@ -5,7 +5,7 @@ export const warehouseResourceRoutes = [
path: 'master-data/locations',
name: 'locations',
component: () => import('./locations/pages/LocationsView.vue'),
meta: {
meta: { showPageHeading: false,
title: '库位管理',
description: '维护平台仓库库位和可用状态',
permission: 'platform:location:list',
@@ -15,7 +15,7 @@ export const warehouseResourceRoutes = [
path: 'master-data/pallets',
name: 'pallets',
component: () => import('./pallets/pages/PalletsView.vue'),
meta: {
meta: { showPageHeading: false,
title: '托盘管理',
description: '维护平台仓库托盘和可用容积',
permission: 'platform:pallet:list',