优化
This commit is contained in:
@@ -86,7 +86,7 @@ describe('TruckAppointmentsView', () => {
|
||||
|
||||
it('uses the table toolbar for create and keeps a single empty state', () => {
|
||||
expect(source).toContain('<template #toolbar-actions>')
|
||||
expect(source).not.toContain('<template #toolbar-start>')
|
||||
expect(source).toContain('<template #toolbar-start><h1>拖车列表</h1></template>')
|
||||
expect(source).not.toContain('PageToolbar')
|
||||
expect(source).not.toContain('empty-hint')
|
||||
expect(source.match(/empty-text=/g)).toHaveLength(1)
|
||||
@@ -117,7 +117,7 @@ describe('TruckAppointmentsView', () => {
|
||||
expect(wrapper.text()).toContain('候选服务暂不可用')
|
||||
expect(wrapper.text()).toContain('req-truck')
|
||||
vi.mocked(listTruckAppointments).mockResolvedValueOnce({ records: [row], page: 1, size: 20, total: 1, pages: 1 })
|
||||
await wrapper.get('button').trigger('click')
|
||||
await wrapper.get('.data-table__notices .load-error-state__actions button').trigger('click')
|
||||
await flushPromises()
|
||||
expect(listTruckAppointments).toHaveBeenCalledTimes(2)
|
||||
expect(wrapper.text()).toContain('TA-9001')
|
||||
@@ -186,11 +186,13 @@ describe('TruckAppointmentsView', () => {
|
||||
expect(source).not.toContain('customerId:')
|
||||
expect(source).not.toContain('customerName')
|
||||
})
|
||||
it('uses bordered list actions instead of text links', () => {
|
||||
it('opts only the operation column into text actions and keeps column preferences', () => {
|
||||
expect(source).toContain('size="small" type="primary" plain')
|
||||
expect(source).toContain('size="small" :aria-label="appointmentActionLabel(\'编辑\'')
|
||||
expect(source).not.toContain("truck-appointment:view')\" link")
|
||||
expect(source).toContain(':total="total" stripe preference-key="trucking-appointments"')
|
||||
expect(source).toMatch(/class="[^"]*row-actions[^"]*admin-text-actions"/)
|
||||
expect(source).toContain('appearance="integrated" :stripe="false"')
|
||||
expect(source).toContain('preference-key="trucking-appointments"')
|
||||
})
|
||||
|
||||
it('uses unified container types and a wider composite keyword field', () => {
|
||||
|
||||
@@ -64,18 +64,21 @@ function openDetail(row: TruckAppointmentResource, edit = false) { router.push({
|
||||
<template>
|
||||
<AdminPage as="div" class="trucking-page admin-density">
|
||||
<ListPageLayout aria-label="拖车预约列表">
|
||||
<template #toolbar><QueryToolbar v-model="filters" class="surface-panel" ariaLabel="拖车预约查询" :fields="fields" preference-key="trucking-query" @search="search" /></template>
|
||||
<template v-if="loadError" #state><LoadErrorState title="拖车预约列表暂时无法加载" :message="loadError.message" :loading="loading" @retry="load"><template #details><ApiErrorMeta :details="loadError" /></template></LoadErrorState></template>
|
||||
<section v-if="!loadError" class="surface-panel table-panel" :aria-busy="loading">
|
||||
<DataTable v-model:page="page" v-model:page-size="pageSize" :data="rows" :columns="columns" :loading="loading" :total="total" stripe preference-key="trucking-appointments" aria-label="拖车预约列表" empty-text="暂无符合筛选条件的拖车预约">
|
||||
|
||||
|
||||
<section :aria-busy="loading"><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" :loading="loading" :total="total" preference-key="trucking-appointments" aria-label="拖车预约列表" empty-text="暂无符合筛选条件的拖车预约">
|
||||
<template #toolbar-start><h1>拖车列表</h1></template>
|
||||
<template #filters><QueryToolbar v-model="filters" ariaLabel="拖车预约查询" :fields="fields" preference-key="trucking-query" @search="search" /></template>
|
||||
<template #notices><template v-if="loadError"><LoadErrorState title="拖车预约列表暂时无法加载" :message="loadError.message" :loading="loading" @retry="load"><template #details><ApiErrorMeta :details="loadError" /></template></LoadErrorState></template></template>
|
||||
|
||||
|
||||
<template #toolbar-actions><el-button v-if="access.can('platform:firstleg:truck-appointment:create')" type="primary" :disabled="loading" @click="router.push({ name: 'trucking-new' })"><Plus :size="16" />新增拖车</el-button></template>
|
||||
<template #company="{ row }">{{ row.carrierName || (row.carrierId ? '已关联承运商' : '—') }}</template>
|
||||
<template #driver="{ row }">{{ row.driverName || '—' }}<small>{{ row.driverPhone || '—' }}</small></template>
|
||||
<template #store="{ row }">{{ row.storeName || '—' }}</template>
|
||||
<template #status="{ row }"><StatusBadge :status="statusLabel(row.status)" /></template>
|
||||
<template #actions="{ row }"><div class="table-actions density-actions"><el-button class="density-action" size="small" type="primary" plain :aria-label="appointmentActionLabel('查看', row as TruckAppointmentResource)" @click="openDetail(row as TruckAppointmentResource)">详情</el-button><el-button class="density-action" v-if="access.can('platform:firstleg:truck-appointment:edit') && ['DRAFT', 'PENDING_DISPATCH', 'RESCHEDULED'].includes(row.status)" size="small" :aria-label="appointmentActionLabel('编辑', row as TruckAppointmentResource)" @click="openDetail(row as TruckAppointmentResource, true)">编辑</el-button></div></template>
|
||||
</DataTable>
|
||||
</section>
|
||||
<template #actions="{ row }"><div class="table-actions density-actions row-actions admin-text-actions"><el-button class="density-action" size="small" type="primary" plain :aria-label="appointmentActionLabel('查看', row as TruckAppointmentResource)" @click="openDetail(row as TruckAppointmentResource)">详情</el-button><el-button class="density-action" v-if="access.can('platform:firstleg:truck-appointment:edit') && ['DRAFT', 'PENDING_DISPATCH', 'RESCHEDULED'].includes(row.status)" size="small" :aria-label="appointmentActionLabel('编辑', row as TruckAppointmentResource)" @click="openDetail(row as TruckAppointmentResource, true)">编辑</el-button></div></template>
|
||||
</DataTable></section>
|
||||
</ListPageLayout>
|
||||
</AdminPage>
|
||||
</template>
|
||||
|
||||
@@ -5,7 +5,7 @@ export const truckingRoutes = [
|
||||
path: 'trucking',
|
||||
name: 'trucking',
|
||||
component: () => import('./pages/TruckAppointmentsView.vue'),
|
||||
meta: { title: '拖车预约', description: '维护拖车预约及派车状态', permission: 'platform:firstleg:truck-appointment:list' },
|
||||
meta: { showPageHeading: false, title: '拖车预约', description: '维护拖车预约及派车状态', permission: 'platform:firstleg:truck-appointment:list' },
|
||||
},
|
||||
{
|
||||
path: 'trucking/new',
|
||||
|
||||
Reference in New Issue
Block a user