优化
This commit is contained in:
@@ -113,6 +113,13 @@ describe('DownloadCenterView', () => {
|
||||
expect(getPlatformExportTask).toHaveBeenCalledWith('9')
|
||||
expect(document.body.textContent).toContain('任务详情 · EXP9')
|
||||
expect(document.body.textContent).toContain('客户列表.xlsx')
|
||||
expect(document.querySelector('.el-drawer')).toBeNull()
|
||||
expect(document.querySelector('.el-dialog')).not.toBeNull()
|
||||
const detailDownload = [...document.querySelectorAll<HTMLButtonElement>('button')]
|
||||
.find((item) => item.textContent?.trim() === '下载文件')
|
||||
detailDownload?.click()
|
||||
await flushPromises()
|
||||
expect(downloadPlatformExportTask).toHaveBeenCalledWith('9')
|
||||
wrapper.unmount()
|
||||
})
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ import {
|
||||
} from '@/modules/downloads/api/platformExportTasks'
|
||||
import ApiErrorMeta from '@/shared/components/ApiErrorMeta.vue'
|
||||
import AdminPage from '@/shared/components/AdminPage.vue'
|
||||
import AppDrawer from '@/shared/components/AppDrawer.vue'
|
||||
import AppDialog from '@/shared/components/AppDialog.vue'
|
||||
import DataTable, { type DataTableColumn } from '@/shared/components/DataTable.vue'
|
||||
import ListPageLayout from '@/shared/components/ListPageLayout.vue'
|
||||
import QueryToolbar, { type QueryField, type QueryModel } from '@/shared/components/QueryToolbar.vue'
|
||||
@@ -148,6 +148,10 @@ function closeDetail() {
|
||||
detailLoading.value = false
|
||||
}
|
||||
|
||||
function downloadDetailTask() {
|
||||
if (detailTask.value?.status === 'SUCCEEDED') void downloadTask(detailTask.value)
|
||||
}
|
||||
|
||||
async function downloadTask(task: PlatformExportTask) {
|
||||
downloadingId.value = task.id
|
||||
try {
|
||||
@@ -270,12 +274,12 @@ onBeforeUnmount(() => {
|
||||
</section>
|
||||
</ListPageLayout>
|
||||
|
||||
<AppDrawer
|
||||
<AppDialog
|
||||
v-model="detailOpen"
|
||||
:title="detailTask ? `任务详情 · ${detailTask.taskNo}` : '任务详情'"
|
||||
size="min(620px, 94vw)"
|
||||
width="min(720px, calc(100vw - 28px))"
|
||||
:loading="detailLoading"
|
||||
:show-footer="false"
|
||||
:show-confirm="false"
|
||||
destroy-on-close
|
||||
@closed="closeDetail"
|
||||
>
|
||||
@@ -309,7 +313,18 @@ onBeforeUnmount(() => {
|
||||
<p>{{ detailTask.failureMessage }}</p>
|
||||
</section>
|
||||
</div>
|
||||
</AppDrawer>
|
||||
<template #footer="{ close }">
|
||||
<div class="app-dialog__footer">
|
||||
<el-button @click="close">关闭</el-button>
|
||||
<el-button
|
||||
type="primary"
|
||||
:loading="downloadingId === detailTask?.id"
|
||||
:disabled="detailTask?.status !== 'SUCCEEDED'"
|
||||
@click="downloadDetailTask"
|
||||
>下载文件</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</AppDialog>
|
||||
</div>
|
||||
</AdminPage>
|
||||
</template>
|
||||
|
||||
Reference in New Issue
Block a user