优化
This commit is contained in:
@@ -233,10 +233,10 @@ describe('DownloadCenterView', () => {
|
||||
const wrapper = mount(DownloadCenterView, { global: { plugins: [createPinia(), ElementPlus] } })
|
||||
await wrapper.vm.$nextTick()
|
||||
|
||||
expect(wrapper.find('.table-panel').attributes('aria-busy')).toBe('true')
|
||||
expect(wrapper.find('.el-table').attributes('aria-busy')).toBe('true')
|
||||
resolveRequest({ records: [], page: 1, size: 20, total: 0, pages: 0 })
|
||||
await flushPromises()
|
||||
expect(wrapper.find('.table-panel').attributes('aria-busy')).toBe('false')
|
||||
expect(wrapper.find('.el-table').attributes('aria-busy')).toBe('false')
|
||||
})
|
||||
|
||||
it('does not schedule another refresh after an in-flight load finishes on an unmounted page', async () => {
|
||||
|
||||
@@ -266,25 +266,28 @@ onBeforeUnmount(() => {
|
||||
<AdminPage class="admin-density">
|
||||
<div class="business-page download-center-page">
|
||||
<ListPageLayout ariaLabel="下载任务列表">
|
||||
<template #toolbar>
|
||||
<QueryToolbar v-model="filters" class="surface-panel" ariaLabel="下载任务筛选" :fields="queryFields" preference-key="downloads-query" @search="applyFilters" />
|
||||
</template>
|
||||
|
||||
<template v-if="loadError" #state>
|
||||
|
||||
|
||||
|
||||
<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="result.records" :columns="columns" preference-key="downloads-table" :loading="loading" :total="result.total" row-key="id" empty-text="暂无符合筛选条件的下载任务" aria-label="下载任务列表">
|
||||
<template #toolbar-start><h1>下载中心</h1></template>
|
||||
<template #filters>
|
||||
<QueryToolbar v-model="filters" ariaLabel="下载任务筛选" :fields="queryFields" preference-key="downloads-query" @search="applyFilters" />
|
||||
</template>
|
||||
<template #notices><template v-if="loadError">
|
||||
<section class="surface-panel download-error" role="alert">
|
||||
<div><strong>下载任务暂时无法加载</strong><p>{{ loadError.message }}</p><ApiErrorMeta :details="loadError" /></div>
|
||||
<el-button type="primary" :loading="loading" @click="loadTasks()">重新加载</el-button>
|
||||
</section>
|
||||
</template>
|
||||
|
||||
<section v-if="!loadError" class="surface-panel table-panel" :aria-busy="loading">
|
||||
<div v-if="syncWarning" class="download-sync-warning" role="status">
|
||||
</template></template>
|
||||
<template #before-results><div v-if="syncWarning" class="download-sync-warning" role="status">
|
||||
<span>自动刷新暂时失败,正在保留当前任务并继续重试:{{ syncWarning.message }}</span>
|
||||
<ApiErrorMeta :details="syncWarning" />
|
||||
</div>
|
||||
<DataTable v-model:page="page" v-model:page-size="pageSize" :data="result.records" :columns="columns" preference-key="downloads-table" :loading="loading" :total="result.total" row-key="id" empty-text="暂无符合筛选条件的下载任务" aria-label="下载任务列表">
|
||||
</div></template>
|
||||
|
||||
<template #pagination-left="{ total: tableTotal }"><span>共 {{ tableTotal }} 个任务</span></template>
|
||||
<template #actions="{ row }"><div class="table-actions density-actions">
|
||||
<template #actions="{ row }"><div class="table-actions density-actions row-actions admin-text-actions">
|
||||
<el-button data-tone="neutral" class="density-action" v-if="(row as PlatformExportTask)?.id" @click="openDetail(row as PlatformExportTask)">详情</el-button>
|
||||
<el-button data-tone="neutral" class="density-action" v-if="(row as PlatformExportTask).status === 'SUCCEEDED'" :loading="downloadingId === (row as PlatformExportTask).id" @click="downloadTask(row as PlatformExportTask)">下载</el-button>
|
||||
<el-button data-tone="neutral" class="density-action" v-if="canRetry(row as PlatformExportTask)" :loading="retryingId === (row as PlatformExportTask).id" @click="retryTask(row as PlatformExportTask)">{{ retryLabel(row as PlatformExportTask) }}</el-button>
|
||||
@@ -296,8 +299,7 @@ onBeforeUnmount(() => {
|
||||
<template #requestedAt="{ row }">{{ formatDate((row as PlatformExportTask).requestedAt) }}</template>
|
||||
<template #completedAt="{ row }">{{ formatDate((row as PlatformExportTask).completedAt) }}</template>
|
||||
<template #expiresAt="{ row }">{{ formatDate((row as PlatformExportTask).expiresAt) }}</template>
|
||||
</DataTable>
|
||||
</section>
|
||||
</DataTable></section>
|
||||
</ListPageLayout>
|
||||
|
||||
<AppDialog class="admin-density-dialog"
|
||||
|
||||
@@ -5,6 +5,6 @@ export const downloadRoutes = [
|
||||
path: 'downloads',
|
||||
name: 'download-center',
|
||||
component: () => import('@/modules/downloads/pages/DownloadCenterView.vue'),
|
||||
meta: { title: '下载中心', description: '查看异步导出任务并下载已生成文件', permission: 'platform:download:list' },
|
||||
meta: { showPageHeading: false, title: '下载中心', description: '查看异步导出任务并下载已生成文件', permission: 'platform:download:list' },
|
||||
},
|
||||
] satisfies RouteRecordRaw[]
|
||||
|
||||
Reference in New Issue
Block a user