feat: 任务中心-重做任务
This commit is contained in:
@ -21,7 +21,7 @@ export const getTask = (params = {}) => {
|
|||||||
|
|
||||||
// 任务中心-批量删除
|
// 任务中心-批量删除
|
||||||
export const deleteBatchTasks = (params = {}) => {
|
export const deleteBatchTasks = (params = {}) => {
|
||||||
return Http.delete('/v1/tasks', params);
|
return Http.delete('/v1/tasks', { data: params });
|
||||||
};
|
};
|
||||||
|
|
||||||
// 任务中心-删除
|
// 任务中心-删除
|
||||||
@ -43,3 +43,8 @@ export const getTaskUnread = () => {
|
|||||||
export const patchTaskRead = (params = {}) => {
|
export const patchTaskRead = (params = {}) => {
|
||||||
return Http.patch('/v1/tasks/read', params);
|
return Http.patch('/v1/tasks/read', params);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// 任务中心-重做任务
|
||||||
|
export const postRedoTask = (id: string) => {
|
||||||
|
return Http.post(`/v1/tasks/${id}/redo`);
|
||||||
|
};
|
||||||
@ -77,7 +77,7 @@ import { useSidebarStore } from '@/stores/modules/side-bar';
|
|||||||
import { useUserStore } from '@/stores';
|
import { useUserStore } from '@/stores';
|
||||||
|
|
||||||
import ExitAccountModal from '@/components/_base/exit-account-modal';
|
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 icon1 from '@/assets/option.svg';
|
||||||
import icon2 from '@/assets/exit.svg';
|
import icon2 from '@/assets/exit.svg';
|
||||||
|
|||||||
@ -25,7 +25,7 @@ export const TABLE_COLUMNS = [
|
|||||||
{
|
{
|
||||||
title: '创建时间',
|
title: '创建时间',
|
||||||
dataIndex: 'created_at',
|
dataIndex: 'created_at',
|
||||||
width: 140,
|
width: 180,
|
||||||
sortable: {
|
sortable: {
|
||||||
sortDirections: ['ascend', 'descend'],
|
sortDirections: ['ascend', 'descend'],
|
||||||
},
|
},
|
||||||
@ -33,6 +33,6 @@ export const TABLE_COLUMNS = [
|
|||||||
{
|
{
|
||||||
title: '操作人员',
|
title: '操作人员',
|
||||||
dataIndex: 'operator.name',
|
dataIndex: 'operator.name',
|
||||||
width: 120,
|
width: 150,
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
@ -49,6 +49,7 @@ const open = (record) => {
|
|||||||
async function onDelete() {
|
async function onDelete() {
|
||||||
const _fn = isBatch.value ? deleteBatchTasks : deleteTask;
|
const _fn = isBatch.value ? deleteBatchTasks : deleteTask;
|
||||||
const _params = isBatch.value ? { ids: taskId.value } : taskId.value;
|
const _params = isBatch.value ? { ids: taskId.value } : taskId.value;
|
||||||
|
|
||||||
const { code } = await _fn(_params);
|
const { code } = await _fn(_params);
|
||||||
if (code === 200) {
|
if (code === 200) {
|
||||||
AMessage.success('删除成功');
|
AMessage.success('删除成功');
|
||||||
@ -3,7 +3,7 @@ import { ref, computed } from 'vue';
|
|||||||
import { Input, Table, TableColumn, Checkbox, Pagination, Button, Tooltip, Notification } from '@arco-design/web-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 { IconSearch, IconClose, IconQuestionCircle } from '@arco-design/web-vue/es/icon';
|
||||||
import NoData from '@/components/no-data';
|
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 { INITIAL_FORM, TABLE_COLUMNS } from './constants';
|
||||||
import { TASK_STATUS } from '../../constants';
|
import { TASK_STATUS } from '../../constants';
|
||||||
import { formatTableField, exactFormatTime } from '@/utils/tools';
|
import { formatTableField, exactFormatTime } from '@/utils/tools';
|
||||||
@ -11,7 +11,6 @@ import { useTableSelectionWithPagination } from '@/hooks/useTableSelectionWithPa
|
|||||||
import { downloadByUrl } from '@/utils/tools';
|
import { downloadByUrl } from '@/utils/tools';
|
||||||
import DeleteTaskModal from './delete-task-modal.vue';
|
import DeleteTaskModal from './delete-task-modal.vue';
|
||||||
import icon1 from '@/assets/img/media-account/icon-delete.png';
|
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 {
|
export default {
|
||||||
@ -57,24 +56,6 @@ export default {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const getData = async () => {
|
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 { page, page_size } = pageInfo.value;
|
||||||
const { code, data } = await getTask({
|
const { code, data } = await getTask({
|
||||||
...query.value,
|
...query.value,
|
||||||
@ -106,9 +87,16 @@ export default {
|
|||||||
selectedRowKeys.value = [];
|
selectedRowKeys.value = [];
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleDownload = (record) => {
|
const handleDownload = async (record) => {
|
||||||
showExportNotification(`正在下载“${record.name}”,请稍后...`)
|
if (record.status === 2) {
|
||||||
// record.file && downloadByUrl(record.file);
|
const { code } = await postRedoTask(record.id);
|
||||||
|
if (code === 200) {
|
||||||
|
showExportNotification(`正在下载“${record.name}”,请稍后...`);
|
||||||
|
getData();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
record.file && downloadByUrl(record.file);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
const handleBatchDownload = () => {
|
const handleBatchDownload = () => {
|
||||||
// 批量下载逻辑
|
// 批量下载逻辑
|
||||||
@ -124,6 +112,7 @@ export default {
|
|||||||
const handleBatchDelete = () => {
|
const handleBatchDelete = () => {
|
||||||
const ids = selectedRows.value.map((item) => item.id);
|
const ids = selectedRows.value.map((item) => item.id);
|
||||||
const names = selectedRows.value.map((item) => `"${item.name || '-'}` + '"').join(',');
|
const names = selectedRows.value.map((item) => `"${item.name || '-'}` + '"').join(',');
|
||||||
|
|
||||||
deleteTaskModalRef.value?.open({ id: ids, name: names });
|
deleteTaskModalRef.value?.open({ id: ids, name: names });
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -235,9 +224,6 @@ export default {
|
|||||||
v-slots={{
|
v-slots={{
|
||||||
title: () => (
|
title: () => (
|
||||||
<div class="flex items-center">
|
<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>
|
<span class="cts mr-4px">{column.title}</span>
|
||||||
{column.tooltip && (
|
{column.tooltip && (
|
||||||
<Tooltip content={column.tooltip} position="top">
|
<Tooltip content={column.tooltip} position="top">
|
||||||
@ -249,11 +235,13 @@ export default {
|
|||||||
cell: ({ record }) => {
|
cell: ({ record }) => {
|
||||||
if (column.dataIndex === 'status') {
|
if (column.dataIndex === 'status') {
|
||||||
return <span>{TASK_STATUS.find((v) => v.value === record.status)?.label}</span>;
|
return <span>{TASK_STATUS.find((v) => v.value === record.status)?.label}</span>;
|
||||||
}
|
} else if (column.dataIndex === 'operator.name') {
|
||||||
if (column.dataIndex === 'created_at') {
|
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');
|
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={{
|
v-slots={{
|
||||||
cell: ({ record }) => (
|
cell: ({ record }) => (
|
||||||
<div class="flex items-center">
|
<div class="flex items-center">
|
||||||
{record.status !== 0 && (
|
<img
|
||||||
<img
|
src={icon1}
|
||||||
src={icon1}
|
width="14"
|
||||||
width="14"
|
height="14"
|
||||||
height="14"
|
class="mr-8px cursor-pointer"
|
||||||
class="mr-8px cursor-pointer"
|
onClick={() => handleDelete(record)}
|
||||||
onClick={() => handleDelete(record)}
|
/>
|
||||||
/>
|
|
||||||
)}
|
|
||||||
<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 === 2 ? '重新导出' : '下载'}
|
||||||
</Button>
|
</Button>
|
||||||
@ -40,7 +40,7 @@ export const TABLE_COLUMNS = [
|
|||||||
{
|
{
|
||||||
title: '导入时间',
|
title: '导入时间',
|
||||||
dataIndex: 'created_at',
|
dataIndex: 'created_at',
|
||||||
width: 140,
|
width: 180,
|
||||||
sortable: {
|
sortable: {
|
||||||
sortDirections: ['ascend', 'descend'],
|
sortDirections: ['ascend', 'descend'],
|
||||||
},
|
},
|
||||||
@ -48,6 +48,6 @@ export const TABLE_COLUMNS = [
|
|||||||
{
|
{
|
||||||
title: '操作人员',
|
title: '操作人员',
|
||||||
dataIndex: 'operator.name',
|
dataIndex: 'operator.name',
|
||||||
width: 120,
|
width: 150,
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
@ -11,8 +11,7 @@ import { useTableSelectionWithPagination } from '@/hooks/useTableSelectionWithPa
|
|||||||
import { downloadByUrl } from '@/utils/tools';
|
import { downloadByUrl } from '@/utils/tools';
|
||||||
import DeleteTaskModal from './delete-task-modal.vue';
|
import DeleteTaskModal from './delete-task-modal.vue';
|
||||||
import icon1 from '@/assets/img/media-account/icon-delete.png';
|
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 {
|
export default {
|
||||||
setup(props, { emit, expose }) {
|
setup(props, { emit, expose }) {
|
||||||
@ -57,24 +56,6 @@ export default {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const getData = async () => {
|
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 { page, page_size } = pageInfo.value;
|
||||||
const { code, data } = await getTask({
|
const { code, data } = await getTask({
|
||||||
...query.value,
|
...query.value,
|
||||||
@ -107,7 +88,8 @@ export default {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const handleDownload = (record) => {
|
const handleDownload = (record) => {
|
||||||
showExportNotification(`正在下载“${record.name}”,请稍后...`)
|
downloadByUrl(record.file);
|
||||||
|
// showExportNotification(`正在下载“${record.name}”,请稍后...`)
|
||||||
};
|
};
|
||||||
const handleBatchDownload = () => {
|
const handleBatchDownload = () => {
|
||||||
// 批量下载逻辑
|
// 批量下载逻辑
|
||||||
@ -233,9 +215,6 @@ export default {
|
|||||||
v-slots={{
|
v-slots={{
|
||||||
title: () => (
|
title: () => (
|
||||||
<div class="flex items-center">
|
<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>
|
<span class="cts mr-4px">{column.title}</span>
|
||||||
{column.tooltip && (
|
{column.tooltip && (
|
||||||
<Tooltip content={column.tooltip} position="top">
|
<Tooltip content={column.tooltip} position="top">
|
||||||
@ -247,18 +226,20 @@ export default {
|
|||||||
cell: ({ record }) => {
|
cell: ({ record }) => {
|
||||||
if (column.dataIndex === 'status') {
|
if (column.dataIndex === 'status') {
|
||||||
return <span>{TASK_STATUS.find((v) => v.value === record.status)?.label}</span>;
|
return <span>{TASK_STATUS.find((v) => v.value === record.status)?.label}</span>;
|
||||||
}
|
} else if (column.dataIndex === 'operator.name') {
|
||||||
if (column.dataIndex === 'created_at') {
|
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');
|
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
|
<TableColumn
|
||||||
data-index="operation"
|
data-index="operation"
|
||||||
width={100}
|
width={180}
|
||||||
fixed="right"
|
fixed="right"
|
||||||
title="操作"
|
title="操作"
|
||||||
v-slots={{
|
v-slots={{
|
||||||
@ -2,7 +2,7 @@
|
|||||||
<a-modal
|
<a-modal
|
||||||
v-model:visible="visible"
|
v-model:visible="visible"
|
||||||
title="任务中心"
|
title="任务中心"
|
||||||
modal-class="download-center-modal"
|
modal-class="task-center-modal"
|
||||||
width="860px"
|
width="860px"
|
||||||
:mask-closable="false"
|
:mask-closable="false"
|
||||||
:footer="false"
|
:footer="false"
|
||||||
@ -42,8 +42,6 @@ const getData = () => {
|
|||||||
const open = () => {
|
const open = () => {
|
||||||
getData();
|
getData();
|
||||||
|
|
||||||
console.log(activeTab.value);
|
|
||||||
|
|
||||||
timer = setInterval(() => {
|
timer = setInterval(() => {
|
||||||
getData();
|
getData();
|
||||||
}, 10000);
|
}, 10000);
|
||||||
@ -1,4 +1,4 @@
|
|||||||
.download-center-modal {
|
.task-center-modal {
|
||||||
.arco-modal-header {
|
.arco-modal-header {
|
||||||
border-bottom: none !important;
|
border-bottom: none !important;
|
||||||
.arco-modal-title {
|
.arco-modal-title {
|
||||||
@ -94,7 +94,6 @@ export const useSidebarStore = defineStore('sidebar', {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
async removeTaskUnreadInfo() {
|
async removeTaskUnreadInfo() {
|
||||||
console.log('removeTaskUnreadInfo');
|
|
||||||
patchTaskRead({ ids: this.unreadInfo });
|
patchTaskRead({ ids: this.unreadInfo });
|
||||||
this.unreadInfo = [];
|
this.unreadInfo = [];
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user