perf: 统一字段

This commit is contained in:
rd
2025-07-18 18:08:18 +08:00
parent bfeba5bd44
commit b52dace9ce
3 changed files with 18 additions and 10 deletions

View File

@ -5,7 +5,7 @@ import { IconSearch, IconClose, IconQuestionCircle } from '@arco-design/web-vue/
import NoData from '@/components/no-data'; import NoData from '@/components/no-data';
import { getTask, postRedoTask } from '@/api/all/common'; import { getTask, postRedoTask } from '@/api/all/common';
import { INITIAL_FORM, TABLE_COLUMNS } from './constants'; import { INITIAL_FORM, TABLE_COLUMNS } from './constants';
import { TASK_STATUS } from '../../constants'; import { TASK_STATUS, enumTaskStatus } from '../../constants';
import { formatTableField, exactFormatTime } from '@/utils/tools'; import { formatTableField, exactFormatTime } from '@/utils/tools';
import { useTableSelectionWithPagination } from '@/hooks/useTableSelectionWithPagination'; import { useTableSelectionWithPagination } from '@/hooks/useTableSelectionWithPagination';
import { downloadByUrl } from '@/utils/tools'; import { downloadByUrl } from '@/utils/tools';
@ -88,7 +88,7 @@ export default {
}; };
const handleDownload = async (record) => { const handleDownload = async (record) => {
if (record.status === 2) { if (record.status === enumTaskStatus.Failed) {
const { code } = await postRedoTask(record.id); const { code } = await postRedoTask(record.id);
if (code === 200) { if (code === 200) {
showExportNotification(`正在下载“${record.name}”,请稍后...`); showExportNotification(`正在下载“${record.name}”,请稍后...`);
@ -261,9 +261,11 @@ export default {
class="mr-8px cursor-pointer" class="mr-8px cursor-pointer"
onClick={() => handleDelete(record)} onClick={() => handleDelete(record)}
/> />
{record.status !== enumTaskStatus.Exporting && (
<Button type="outline" size="mini" class="search-btn" onClick={() => handleDownload(record)}> <Button type="outline" size="mini" class="search-btn" onClick={() => handleDownload(record)}>
{record.status === 2 ? '重新导出' : '下载'} {record.status === enumTaskStatus.Failed ? '重新导出' : '下载'}
</Button> </Button>
)}
</div> </div>
), ),
}} }}

View File

@ -5,7 +5,7 @@ import { IconSearch, IconClose, IconQuestionCircle } from '@arco-design/web-vue/
import NoData from '@/components/no-data'; import NoData from '@/components/no-data';
import { getTask } from '@/api/all/common'; import { getTask } from '@/api/all/common';
import { INITIAL_FORM, TABLE_COLUMNS } from './constants'; import { INITIAL_FORM, TABLE_COLUMNS } from './constants';
import { TASK_STATUS } from '../../constants'; import { TASK_STATUS, enumTaskStatus } from '../../constants';
import { formatTableField, exactFormatTime } from '@/utils/tools'; import { formatTableField, exactFormatTime } from '@/utils/tools';
import { useTableSelectionWithPagination } from '@/hooks/useTableSelectionWithPagination'; import { useTableSelectionWithPagination } from '@/hooks/useTableSelectionWithPagination';
import { downloadByUrl } from '@/utils/tools'; import { downloadByUrl } from '@/utils/tools';
@ -252,7 +252,7 @@ export default {
class="mr-8px cursor-pointer" class="mr-8px cursor-pointer"
onClick={() => handleDelete(record)} onClick={() => handleDelete(record)}
/> />
{record.status === 2 && ( {record.status === enumTaskStatus.Failed && (
<Button type="outline" size="mini" class="search-btn" onClick={() => handleDownload(record)}> <Button type="outline" size="mini" class="search-btn" onClick={() => handleDownload(record)}>
下载问题表格 下载问题表格
</Button> </Button>

View File

@ -1,14 +1,20 @@
export enum enumTaskStatus {
Exporting = 0, // 导出中
Finished = 1, // 已完成
Failed = 2 // 导出失败
}
export const TASK_STATUS = [ export const TASK_STATUS = [
{ {
label: '导出中', label: '导出中',
value: 0, value: enumTaskStatus.Exporting,
}, },
{ {
label: '已完成', label: '已完成',
value: 1, value: enumTaskStatus.Finished,
}, },
{ {
label: '导出失败', label: '导出失败',
value: 2, value: enumTaskStatus.Failed,
}, },
]; ];