feat: 任务中心-重做任务

This commit is contained in:
rd
2025-07-18 17:47:16 +08:00
parent 4f10e5edf1
commit 7956594705
14 changed files with 47 additions and 77 deletions

View File

@ -21,7 +21,7 @@ export const getTask = (params = {}) => {
// 任务中心-批量删除
export const deleteBatchTasks = (params = {}) => {
return Http.delete('/v1/tasks', params);
return Http.delete('/v1/tasks', { data: params });
};
// 任务中心-删除
@ -42,4 +42,9 @@ export const getTaskUnread = () => {
// 任务中心-已读
export const patchTaskRead = (params = {}) => {
return Http.patch('/v1/tasks/read', params);
};
// 任务中心-重做任务
export const postRedoTask = (id: string) => {
return Http.post(`/v1/tasks/${id}/redo`);
};

View File

@ -77,7 +77,7 @@ import { useSidebarStore } from '@/stores/modules/side-bar';
import { useUserStore } from '@/stores';
import ExitAccountModal from '@/components/_base/exit-account-modal';
import DownloadCenterModal from '../download-center-modal';
import DownloadCenterModal from '../task-center-modal';
import icon1 from '@/assets/option.svg';
import icon2 from '@/assets/exit.svg';

View File

@ -25,7 +25,7 @@ export const TABLE_COLUMNS = [
{
title: '创建时间',
dataIndex: 'created_at',
width: 140,
width: 180,
sortable: {
sortDirections: ['ascend', 'descend'],
},
@ -33,6 +33,6 @@ export const TABLE_COLUMNS = [
{
title: '操作人员',
dataIndex: 'operator.name',
width: 120,
width: 150,
},
];

View File

@ -49,6 +49,7 @@ const open = (record) => {
async function onDelete() {
const _fn = isBatch.value ? deleteBatchTasks : deleteTask;
const _params = isBatch.value ? { ids: taskId.value } : taskId.value;
const { code } = await _fn(_params);
if (code === 200) {
AMessage.success('删除成功');

View File

@ -3,7 +3,7 @@ import { ref, computed } from 'vue';
import { Input, Table, TableColumn, Checkbox, Pagination, Button, Tooltip, Notification } from '@arco-design/web-vue';
import { IconSearch, IconClose, IconQuestionCircle } from '@arco-design/web-vue/es/icon';
import NoData from '@/components/no-data';
import { getTask } from '@/api/all/common';
import { getTask, postRedoTask } from '@/api/all/common';
import { INITIAL_FORM, TABLE_COLUMNS } from './constants';
import { TASK_STATUS } from '../../constants';
import { formatTableField, exactFormatTime } from '@/utils/tools';
@ -11,7 +11,6 @@ import { useTableSelectionWithPagination } from '@/hooks/useTableSelectionWithPa
import { downloadByUrl } from '@/utils/tools';
import DeleteTaskModal from './delete-task-modal.vue';
import icon1 from '@/assets/img/media-account/icon-delete.png';
import icon5 from '@/assets/img/media-account/icon-warn-1.png';
import { showExportNotification } from '@/utils/arcoD';
export default {
@ -57,24 +56,6 @@ export default {
};
const getData = async () => {
dataSource.value = [
{
id: 1,
file_name: '投放指南20150701',
module: '营销资产平台',
time: 1752130053,
name: '张三三张三三张三三张三三张三三',
},
{
id: 2,
file_name: '投放指南20150701',
module: '营销资产平台',
time: 1752130053,
name: '张三三张三三张三三张三三张三三',
},
];
pageInfo.value.total = 2;
const { page, page_size } = pageInfo.value;
const { code, data } = await getTask({
...query.value,
@ -106,9 +87,16 @@ export default {
selectedRowKeys.value = [];
};
const handleDownload = (record) => {
showExportNotification(`正在下载“${record.name}”,请稍后...`)
// record.file && downloadByUrl(record.file);
const handleDownload = async (record) => {
if (record.status === 2) {
const { code } = await postRedoTask(record.id);
if (code === 200) {
showExportNotification(`正在下载“${record.name}”,请稍后...`);
getData();
}
} else {
record.file && downloadByUrl(record.file);
}
};
const handleBatchDownload = () => {
//
@ -124,6 +112,7 @@ export default {
const handleBatchDelete = () => {
const ids = selectedRows.value.map((item) => item.id);
const names = selectedRows.value.map((item) => `"${item.name || '-'}` + '"').join('');
deleteTaskModalRef.value?.open({ id: ids, name: names });
};
@ -235,9 +224,6 @@ export default {
v-slots={{
title: () => (
<div class="flex items-center">
{column.dataIndex === 'ai_evaluate' && (
<img width="16" height="16" src={icon5} class="mr-4px" />
)}
<span class="cts mr-4px">{column.title}</span>
{column.tooltip && (
<Tooltip content={column.tooltip} position="top">
@ -249,11 +235,13 @@ export default {
cell: ({ record }) => {
if (column.dataIndex === 'status') {
return <span>{TASK_STATUS.find((v) => v.value === record.status)?.label}</span>;
}
if (column.dataIndex === 'created_at') {
} else if (column.dataIndex === 'operator.name') {
return record.operator?.name || record.operator?.mobile;
} else if (column.dataIndex === 'created_at') {
return exactFormatTime(record.created_at, 'YYYY-MM-DD HH:mm:ss', 'YYYY-MM-DD HH:mm:ss');
} else {
return formatTableField(column, record, true);
}
return formatTableField(column, record, true);
},
}}
/>
@ -266,15 +254,13 @@ export default {
v-slots={{
cell: ({ record }) => (
<div class="flex items-center">
{record.status !== 0 && (
<img
src={icon1}
width="14"
height="14"
class="mr-8px cursor-pointer"
onClick={() => handleDelete(record)}
/>
)}
<img
src={icon1}
width="14"
height="14"
class="mr-8px cursor-pointer"
onClick={() => handleDelete(record)}
/>
<Button type="outline" size="mini" class="search-btn" onClick={() => handleDownload(record)}>
{record.status === 2 ? '重新导出' : '下载'}
</Button>

View File

@ -40,7 +40,7 @@ export const TABLE_COLUMNS = [
{
title: '导入时间',
dataIndex: 'created_at',
width: 140,
width: 180,
sortable: {
sortDirections: ['ascend', 'descend'],
},
@ -48,6 +48,6 @@ export const TABLE_COLUMNS = [
{
title: '操作人员',
dataIndex: 'operator.name',
width: 120,
width: 150,
},
];

View File

@ -11,8 +11,7 @@ import { useTableSelectionWithPagination } from '@/hooks/useTableSelectionWithPa
import { downloadByUrl } from '@/utils/tools';
import DeleteTaskModal from './delete-task-modal.vue';
import icon1 from '@/assets/img/media-account/icon-delete.png';
import icon5 from '@/assets/img/media-account/icon-warn-1.png';
import { showExportNotification } from '@/utils/arcoD';
// import { showExportNotification } from '@/utils/arcoD';
export default {
setup(props, { emit, expose }) {
@ -57,24 +56,6 @@ export default {
};
const getData = async () => {
dataSource.value = [
{
id: 1,
file_name: '投放指南20150701',
module: '营销资产平台',
time: 1752130053,
name: '张三三张三三张三三张三三张三三',
},
{
id: 2,
file_name: '投放指南20150701',
module: '营销资产平台',
time: 1752130053,
name: '张三三张三三张三三张三三张三三',
},
];
pageInfo.value.total = 2;
const { page, page_size } = pageInfo.value;
const { code, data } = await getTask({
...query.value,
@ -107,7 +88,8 @@ export default {
};
const handleDownload = (record) => {
showExportNotification(`正在下载“${record.name}”,请稍后...`)
downloadByUrl(record.file);
// showExportNotification(`${record.name}...`)
};
const handleBatchDownload = () => {
//
@ -233,9 +215,6 @@ export default {
v-slots={{
title: () => (
<div class="flex items-center">
{column.dataIndex === 'ai_evaluate' && (
<img width="16" height="16" src={icon5} class="mr-4px" />
)}
<span class="cts mr-4px">{column.title}</span>
{column.tooltip && (
<Tooltip content={column.tooltip} position="top">
@ -247,18 +226,20 @@ export default {
cell: ({ record }) => {
if (column.dataIndex === 'status') {
return <span>{TASK_STATUS.find((v) => v.value === record.status)?.label}</span>;
}
if (column.dataIndex === 'created_at') {
} else if (column.dataIndex === 'operator.name') {
return <span>{record.operator?.name || record.operator?.mobile}</span>
} else if (column.dataIndex === 'created_at') {
return exactFormatTime(record.created_at, 'YYYY-MM-DD HH:mm:ss', 'YYYY-MM-DD HH:mm:ss');
} else {
return formatTableField(column, record, true);
}
return formatTableField(column, record, true);
},
}}
/>
))}
<TableColumn
data-index="operation"
width={100}
width={180}
fixed="right"
title="操作"
v-slots={{

View File

@ -2,7 +2,7 @@
<a-modal
v-model:visible="visible"
title="任务中心"
modal-class="download-center-modal"
modal-class="task-center-modal"
width="860px"
:mask-closable="false"
:footer="false"
@ -42,8 +42,6 @@ const getData = () => {
const open = () => {
getData();
console.log(activeTab.value);
timer = setInterval(() => {
getData();
}, 10000);

View File

@ -1,4 +1,4 @@
.download-center-modal {
.task-center-modal {
.arco-modal-header {
border-bottom: none !important;
.arco-modal-title {

View File

@ -94,7 +94,6 @@ export const useSidebarStore = defineStore('sidebar', {
}
},
async removeTaskUnreadInfo() {
console.log('removeTaskUnreadInfo');
patchTaskRead({ ids: this.unreadInfo });
this.unreadInfo = [];
},