状态
diff --git a/src/views/property-marketing/media-account/account-manage/components/account-table/style.scss b/src/views/property-marketing/media-account/account-manage/components/account-table/style.scss
index f3b99bd..3e77ae9 100644
--- a/src/views/property-marketing/media-account/account-manage/components/account-table/style.scss
+++ b/src/views/property-marketing/media-account/account-manage/components/account-table/style.scss
@@ -25,6 +25,7 @@
font-style: normal;
font-weight: 400;
margin-bottom: 11px;
+ width: fit-content;
// line-height: 22px; /* 157.143% */
}
.label {
From 46ced21844bda8157b9268984c2b3bf4bf7c2646 Mon Sep 17 00:00:00 2001
From: rd <1344903914@qq.com>
Date: Thu, 17 Jul 2025 14:42:01 +0800
Subject: [PATCH 30/97] =?UTF-8?q?refactor:=20=E6=80=A7=E5=88=AB=E5=88=86?=
=?UTF-8?q?=E5=B8=83=E6=95=B0=E6=8D=AE=E5=8F=96=E5=80=BC=E9=80=BB=E8=BE=91?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/views/components/dataEngine/userPersona.vue | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)
diff --git a/src/views/components/dataEngine/userPersona.vue b/src/views/components/dataEngine/userPersona.vue
index ee736a0..53a053a 100644
--- a/src/views/components/dataEngine/userPersona.vue
+++ b/src/views/components/dataEngine/userPersona.vue
@@ -18,16 +18,16 @@
女性
- {{ genderData[0].rate * 100 }}%
+ {{ (girlData.rate * 100).toFixed(2) }}%
TGI
- {{ genderData[0].tgi }}
+ {{ girlData.tgi }}
男性
- {{ genderData[1].rate * 100 }}%
+ {{ (boyData.rate * 100).toFixed(2) }}%
TGI
- {{ genderData[1].tgi }}
+ {{ boyData.tgi }}
@@ -145,10 +145,13 @@ const topHeaderRef = ref();
const selectedIndustry = computed(() => topHeaderRef.value?.selectedIndustry);
const selectedSubCategory = computed(() => topHeaderRef.value?.selectedSubCategory);
const selectedTimePeriod = computed(() => topHeaderRef.value?.selectedTimePeriod);
+
const genderData = ref([]);
const genderValueData = ref([]);
const ageValueData = ref([]);
const geoList = ref([]);
+const boyData = computed(() => genderData.value.find( v => v.gender === 1) ?? {})
+const girlData = computed(() => genderData.value.find( v => v.gender === 2) ?? {})
// 监听筛选条件变化
watch([selectedIndustry, selectedTimePeriod, selectedSubCategory], () => {
getAgeDistributionsList();
@@ -233,7 +236,7 @@ const getGenderDistributionsList = async () => {
await nextTick();
genderValueData.value = data.map((item) => ({
- value: item.rate * 100,
+ value: (item.rate * 100).toFixed(2),
tgi: item.tgi,
name: item.gender === 1 ? '女性' : '男性',
}));
From d30be4dc935026e8695aa49e8e4979d8a777bb82 Mon Sep 17 00:00:00 2001
From: rd <1344903914@qq.com>
Date: Thu, 17 Jul 2025 15:28:20 +0800
Subject: [PATCH 31/97] =?UTF-8?q?feat:=20=E4=B8=8B=E8=BD=BD=E4=B8=AD?=
=?UTF-8?q?=E5=BF=83?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/api/all/common.ts | 15 +
.../components/export-task/constants.ts | 28 +-
.../export-task/delete-task-modal.vue | 14 +-
.../components/export-task/index.vue | 143 ++++----
.../components/export-task/style.scss | 3 +
.../components/import-task/constants.ts | 38 +++
.../import-task/delete-task-modal.vue | 61 ++++
.../components/import-task/index.vue | 315 ++++++++++++++++++
.../components/import-task/style.scss | 51 +++
.../download-center-modal/constants.ts | 14 +
.../download-center-modal/index.vue | 24 +-
.../download-center-modal/style.scss | 70 ++--
src/hooks/useTableSelectionWithPagination.ts | 1 +
13 files changed, 651 insertions(+), 126 deletions(-)
create mode 100644 src/components/_base/navbar/components/download-center-modal/components/import-task/constants.ts
create mode 100644 src/components/_base/navbar/components/download-center-modal/components/import-task/delete-task-modal.vue
create mode 100644 src/components/_base/navbar/components/download-center-modal/components/import-task/index.vue
create mode 100644 src/components/_base/navbar/components/download-center-modal/components/import-task/style.scss
create mode 100644 src/components/_base/navbar/components/download-center-modal/constants.ts
diff --git a/src/api/all/common.ts b/src/api/all/common.ts
index 9b210da..a1a7b0c 100644
--- a/src/api/all/common.ts
+++ b/src/api/all/common.ts
@@ -13,3 +13,18 @@ export const getCustomColumns = (params = {}) => {
export const updateCustomColumns = (params = {}) => {
return Http.put('/v1/custom-columns', params);
};
+
+// 任务中心-分页
+export const getTask = (params = {}) => {
+ return Http.get('/v1/tasks', params);
+};
+
+// 任务中心-批量删除
+export const deleteBatchTasks = (params = {}) => {
+ return Http.delete('/v1/tasks', params);
+};
+
+// 任务中心-删除
+export const deleteTask = (id: string) => {
+ return Http.delete(`/v1/tasks/${id}`);
+};
diff --git a/src/components/_base/navbar/components/download-center-modal/components/export-task/constants.ts b/src/components/_base/navbar/components/download-center-modal/components/export-task/constants.ts
index 3b1fef8..0b9ed2c 100644
--- a/src/components/_base/navbar/components/download-center-modal/components/export-task/constants.ts
+++ b/src/components/_base/navbar/components/download-center-modal/components/export-task/constants.ts
@@ -1,21 +1,16 @@
export const INITIAL_FORM = {
- search: '',
+ type: 1,
+ operator_name: '',
module: '',
- column: undefined,
- order: undefined,
-};
-export const INITIAL_PAGE_INFO = {
- page: 1,
- pageSize: 20,
- total: 0,
+ sort_column: undefined,
+ sort_order: undefined,
};
export const TABLE_COLUMNS = [
{
title: '文件名称',
- dataIndex: 'file_name',
+ dataIndex: 'name',
width: 180,
- // fixed: 'left',
},
{
title: '所属模块',
@@ -23,16 +18,21 @@ export const TABLE_COLUMNS = [
width: 120,
},
{
- title: '下载时间',
- dataIndex: 'time',
- width: 120,
+ title: '状态',
+ dataIndex: 'status',
+ width: 100,
+ },
+ {
+ title: '创建时间',
+ dataIndex: 'created_at',
+ width: 140,
sortable: {
sortDirections: ['ascend', 'descend'],
},
},
{
title: '操作人员',
- dataIndex: 'name',
+ dataIndex: 'operator.name',
width: 120,
},
];
diff --git a/src/components/_base/navbar/components/download-center-modal/components/export-task/delete-task-modal.vue b/src/components/_base/navbar/components/download-center-modal/components/export-task/delete-task-modal.vue
index 9b3ed35..589cfe8 100644
--- a/src/components/_base/navbar/components/download-center-modal/components/export-task/delete-task-modal.vue
+++ b/src/components/_base/navbar/components/download-center-modal/components/export-task/delete-task-modal.vue
@@ -20,35 +20,35 @@
diff --git a/src/components/_base/navbar/components/download-center-modal/components/import-task/index.vue b/src/components/_base/navbar/components/download-center-modal/components/import-task/index.vue
new file mode 100644
index 0000000..7e59e12
--- /dev/null
+++ b/src/components/_base/navbar/components/download-center-modal/components/import-task/index.vue
@@ -0,0 +1,315 @@
+
+
+
+
+
+
所属模块
+
+
+ {{ item.name }}
+
+
+
+
+
+
+
+
+
+
+ 已选
+ {{ selectedRows.length }}
+ 个文件
+
+
+
批量下载
+
批量删除
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
![]()
+
{{ column.title }}
+
+
+
+
+
+
+
+ {{ record.platform === 0 ? '抖音' : record.platform === 1 ? '小红书' : '-' }}
+
+
+ {{ exactFormatTime(record.time) }}
+
+
+
+ {{ formatTableField(column, record, true) }}
+
+
+
+
+
+
![]()
+
下载
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/components/_base/navbar/components/download-center-modal/components/import-task/style.scss b/src/components/_base/navbar/components/download-center-modal/components/import-task/style.scss
new file mode 100644
index 0000000..606ffe5
--- /dev/null
+++ b/src/components/_base/navbar/components/download-center-modal/components/import-task/style.scss
@@ -0,0 +1,51 @@
+.import-task-wrap {
+ height: 100%;
+ .tip-row {
+ border-radius: 2px;
+ background: #f0edff;
+ .label {
+ font-family: $font-family-medium;
+ font-size: 14px;
+ font-style: normal;
+ font-weight: 400;
+ line-height: 22px;
+ }
+ &.normal {
+ background: #ebf7f2;
+ .label {
+ color: #211f24;
+ }
+ }
+ &.abnormal {
+ background: #ffe7e4;
+ .label {
+ color: #211f24;
+ }
+ }
+ .err-btn {
+ background-color: #f64b31 !important;
+ color: var(--BG-white, #fff);
+ font-family: 'PingFang SC';
+ font-size: 12px;
+ font-style: normal;
+ font-weight: 400;
+ line-height: 20px;
+ }
+ .operation-btn {
+ padding: 0;
+ cursor: pointer;
+ color: var(--Brand-Brand-6, #6d4cfe);
+ font-family: $font-family-regular;
+ font-size: 14px;
+ font-style: normal;
+ font-weight: 400;
+ line-height: 22px;
+ &:not(:last-child) {
+ margin-right: 16px;
+ }
+ &.red {
+ color: #f64b31;
+ }
+ }
+ }
+}
diff --git a/src/components/_base/navbar/components/download-center-modal/constants.ts b/src/components/_base/navbar/components/download-center-modal/constants.ts
new file mode 100644
index 0000000..4a1095f
--- /dev/null
+++ b/src/components/_base/navbar/components/download-center-modal/constants.ts
@@ -0,0 +1,14 @@
+export const TASK_STATUS = [
+ {
+ label: '导出中',
+ value: 0,
+ },
+ {
+ label: '已完成',
+ value: 1,
+ },
+ {
+ label: '导出失败',
+ value: 2,
+ },
+];
diff --git a/src/components/_base/navbar/components/download-center-modal/index.vue b/src/components/_base/navbar/components/download-center-modal/index.vue
index f4046b4..0986b9b 100644
--- a/src/components/_base/navbar/components/download-center-modal/index.vue
+++ b/src/components/_base/navbar/components/download-center-modal/index.vue
@@ -8,19 +8,41 @@
:footer="false"
@close="onClose"
>
-
+
+
+
+
+
+
+
diff --git a/src/views/property-marketing/project-manage/project-list/components/filter-block/style.scss b/src/views/property-marketing/project-manage/project-list/components/filter-block/style.scss
new file mode 100644
index 0000000..48e2115
--- /dev/null
+++ b/src/views/property-marketing/project-manage/project-list/components/filter-block/style.scss
@@ -0,0 +1,23 @@
+.container {
+ .filter-row {
+ .filter-row-item {
+ &:not(:last-child) {
+ margin-right: 24px;
+ }
+ .label {
+ margin-right: 8px;
+ color: #211f24;
+ font-family: $font-family-regular;
+ font-size: 14px;
+ font-style: normal;
+ font-weight: 400;
+ flex-shrink: 0;
+ line-height: 22px; /* 157.143% */
+ }
+ :deep(.arco-space-item) {
+ width: 100%;
+ }
+ }
+ }
+
+}
diff --git a/src/views/property-marketing/project-manage/project-list/components/project-table/constants.ts b/src/views/property-marketing/project-manage/project-list/components/project-table/constants.ts
new file mode 100644
index 0000000..ae9a58f
--- /dev/null
+++ b/src/views/property-marketing/project-manage/project-list/components/project-table/constants.ts
@@ -0,0 +1,45 @@
+/*
+ * @Author: RenXiaoDong
+ * @Date: 2025-06-28 10:33:06
+ */
+export const TABLE_COLUMNS = [
+ {
+ title: '项目名称',
+ dataIndex: 'name',
+ width: 240,
+ fixed: 'left',
+ },
+ {
+ title: '项目预算',
+ dataIndex: 'key1',
+ width: 180,
+ },
+ {
+ title: '关联平台账号',
+ dataIndex: 'key2',
+ width: 180,
+ },
+ {
+ title: '关联渠道账户',
+ dataIndex: 'key3',
+ width: 180,
+ },
+ {
+ title: '关联内容稿件',
+ dataIndex: 'key4',
+ width: 180,
+ },
+ {
+ title: '创建时间',
+ dataIndex: 'create_at',
+ width: 180,
+ sortable: {
+ sortDirections: ['ascend', 'descend'],
+ },
+ },
+ {
+ title: '操作',
+ dataIndex: 'operation',
+ width: 100,
+ },
+];
diff --git a/src/views/property-marketing/project-manage/project-list/components/project-table/index.vue b/src/views/property-marketing/project-manage/project-list/components/project-table/index.vue
new file mode 100644
index 0000000..dc8e325
--- /dev/null
+++ b/src/views/property-marketing/project-manage/project-list/components/project-table/index.vue
@@ -0,0 +1,88 @@
+
+
+
+
+
+
+
+
+
+
{{ column.title }}
+
+
+
+
+
+
+
+ {{ exactFormatTime(record.create_at) }}
+
+
+
+
![]()
+
编辑
+
+
+
+
+ {{ formatTableField(column, record, true) }}
+
+
+
+
+
+
+
+
+
diff --git a/src/views/property-marketing/project-manage/project-list/components/project-table/style.scss b/src/views/property-marketing/project-manage/project-list/components/project-table/style.scss
new file mode 100644
index 0000000..38fb392
--- /dev/null
+++ b/src/views/property-marketing/project-manage/project-list/components/project-table/style.scss
@@ -0,0 +1,10 @@
+.project-table {
+ .cts {
+ color: var(--Text-1, #211f24);
+ font-family: $font-family-medium;
+ font-size: 14px;
+ font-style: normal;
+ font-weight: 400;
+ line-height: 22px;
+ }
+}
diff --git a/src/views/property-marketing/project-manage/project-list/constants.ts b/src/views/property-marketing/project-manage/project-list/constants.ts
new file mode 100644
index 0000000..7f13ca2
--- /dev/null
+++ b/src/views/property-marketing/project-manage/project-list/constants.ts
@@ -0,0 +1,5 @@
+export const INITIAL_QUERY = {
+ search: '',
+ column: '',
+ order: '',
+};
diff --git a/src/views/property-marketing/project-manage/project-list/index.vue b/src/views/property-marketing/project-manage/project-list/index.vue
new file mode 100644
index 0000000..88ddc92
--- /dev/null
+++ b/src/views/property-marketing/project-manage/project-list/index.vue
@@ -0,0 +1,138 @@
+
+
+
+
+
项目列表
+
+
+
+
+
+ 添加项目
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/views/property-marketing/project-manage/project-list/style.scss b/src/views/property-marketing/project-manage/project-list/style.scss
new file mode 100644
index 0000000..dda7199
--- /dev/null
+++ b/src/views/property-marketing/project-manage/project-list/style.scss
@@ -0,0 +1,39 @@
+.project-list-wrap {
+ height: 100%;
+ display: flex;
+ flex-direction: column;
+ :deep(.search-btn) {
+ border-radius: 4px;
+ border: 1px solid var(--Brand-Brand-6, #6d4cfe);
+ color: #6d4cfe;
+ }
+ :deep(.reset-btn) {
+ border-radius: 4px;
+ border: 1px solid var(--BG-500, #b1b2b5);
+ background: var(--BG-white, #fff);
+ }
+ .filter-wrap {
+ .top {
+ .title {
+ font-family: $font-family-medium;
+ font-style: normal;
+ }
+ :deep(.arco-btn) {
+ .arco-btn-icon {
+ line-height: 16px;
+ }
+ }
+ }
+ }
+ .table-wrap {
+ display: flex;
+ flex-direction: column;
+ .pagination-box {
+ display: flex;
+ width: 100%;
+ padding: 16px 24px;
+ justify-content: flex-end;
+ align-items: center;
+ }
+ }
+}
diff --git a/src/views/property-marketing/put-account/account-manage/index.vue b/src/views/property-marketing/put-account/account-manage/index.vue
index 3279b16..aa50bcd 100644
--- a/src/views/property-marketing/put-account/account-manage/index.vue
+++ b/src/views/property-marketing/put-account/account-manage/index.vue
@@ -79,7 +79,7 @@
show-page-size
:page-size-options="[8, 16, 20, 32, 64]"
:current="pageInfo.page"
- :page-size="pageInfo.pageSize"
+ :page-size="pageInfo.page_size"
@change="onPageChange"
@page-size-change="onPageSizeChange"
/>
@@ -114,7 +114,7 @@ const deleteAccountRef = ref(null);
const pageInfo = ref({
page: 1,
- pageSize: 20,
+ page_size: 20,
total: 0,
});
const query = ref(cloneDeep(INITIAL_QUERY));
@@ -174,10 +174,10 @@ const getHealthData = async () => {
}
};
const getAccountData = async () => {
- const { page, pageSize } = pageInfo.value;
+ const { page, page_size } = pageInfo.value;
const { code, data, total } = await getPlacementAccounts({
page,
- page_size: pageSize,
+ page_size,
...query.value,
});
if (code === 200) {
@@ -190,11 +190,11 @@ const reload = () => {
getData();
};
const handleSearch = () => {
- getData();
+ reload();
};
const handleReset = () => {
pageInfo.value.page = 1;
- pageInfo.value.pageSize = 20;
+ pageInfo.value.page_size = 20;
pageInfo.value.total = 0;
selectedItems.value = [];
query.value = cloneDeep(INITIAL_QUERY);
@@ -206,7 +206,7 @@ const onPageChange = (current) => {
getData();
};
const onPageSizeChange = (pageSize) => {
- pageInfo.value.pageSize = pageSize;
+ pageInfo.value.page_size = pageSize;
reload();
};
From e6798bf313c1ffdba8ef2a67da118f7d85d4e334 Mon Sep 17 00:00:00 2001
From: rd <1344903914@qq.com>
Date: Mon, 21 Jul 2025 15:10:26 +0800
Subject: [PATCH 54/97] =?UTF-8?q?feat:=20=E6=89=B9=E9=87=8F=E4=B8=8B?=
=?UTF-8?q?=E8=BD=BD=E4=BB=BB=E5=8A=A1?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
config/unplugin/auto-import.ts | 2 +-
src/api/all/common.ts | 10 +++
.../components/export-task/index.vue | 89 ++++++++++++++++---
.../components/task-center-modal/index.vue | 1 +
src/utils/arcoD.tsx | 4 +-
src/utils/tools.ts | 3 +
.../components/add-account-modal/index.vue | 7 +-
.../components/add-account-modal/index.vue | 7 +-
8 files changed, 103 insertions(+), 20 deletions(-)
diff --git a/config/unplugin/auto-import.ts b/config/unplugin/auto-import.ts
index 5617d5a..7778cc9 100644
--- a/config/unplugin/auto-import.ts
+++ b/config/unplugin/auto-import.ts
@@ -16,7 +16,7 @@ export function configAutoImport() {
'@vueuse/core',
{
dayjs: [['default', 'dayjs']],
- 'lodash-es': ['cloneDeep', 'omit', 'pick', 'union', 'uniq', 'isNumber', 'uniqBy', 'isEmpty', 'merge'],
+ 'lodash-es': ['cloneDeep', 'omit', 'pick', 'union', 'uniq', 'isNumber', 'uniqBy', 'isEmpty', 'merge', 'debounce'],
'@/hooks': ['useModal'],
},
],
diff --git a/src/api/all/common.ts b/src/api/all/common.ts
index 74d626d..8cc013a 100644
--- a/src/api/all/common.ts
+++ b/src/api/all/common.ts
@@ -47,4 +47,14 @@ export const patchTaskRead = (params = {}) => {
// 任务中心-重做任务
export const postRedoTask = (id: string) => {
return Http.post(`/v1/tasks/${id}/redo`);
+};
+
+// 任务中心-批量下载
+export const postBatchDownload = (params = {}) => {
+ return Http.post(`/v1/tasks/batch-download`, params);
+};
+
+// 任务中心-批量查询任务状态
+export const batchQueryTaskStatus = (params = {}) => {
+ return Http.get(`/v1/tasks/batch-query-status`, params);
};
\ No newline at end of file
diff --git a/src/components/_base/navbar/components/task-center-modal/components/export-task/index.vue b/src/components/_base/navbar/components/task-center-modal/components/export-task/index.vue
index 39124d1..4ee0181 100644
--- a/src/components/_base/navbar/components/task-center-modal/components/export-task/index.vue
+++ b/src/components/_base/navbar/components/task-center-modal/components/export-task/index.vue
@@ -3,10 +3,10 @@ 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, postRedoTask } from '@/api/all/common';
+import { getTask, postRedoTask, postBatchDownload, batchQueryTaskStatus } from '@/api/all/common';
import { INITIAL_FORM, TABLE_COLUMNS } from './constants';
import { EXPORT_TASK_STATUS, enumTaskStatus } from '../../constants';
-import { formatTableField, exactFormatTime } from '@/utils/tools';
+import { formatTableField, exactFormatTime, genRandomId } from '@/utils/tools';
import { useTableSelectionWithPagination } from '@/hooks/useTableSelectionWithPagination';
import { downloadByUrl } from '@/utils/tools';
import DeleteTaskModal from './delete-task-modal.vue';
@@ -34,9 +34,11 @@ export default {
getData();
},
});
+ let queryTaskTimer = null;
- const query = ref({ ...INITIAL_FORM });
+ const query = ref(cloneDeep(INITIAL_FORM));
const deleteTaskModalRef = ref(null);
+ const downloadTaskIds = ref([]);
const checkedAll = computed(() => selectedRows.value.length === dataSource.value.length);
const indeterminate = computed(
@@ -44,11 +46,12 @@ export default {
);
const reset = () => {
- query.value = { ...INITIAL_FORM };
- pageInfo.value = { ...DEFAULT_PAGE_INFO };
+ query.value = cloneDeep(INITIAL_FORM);
+ pageInfo.value = cloneDeep(DEFAULT_PAGE_INFO);
selectedRowKeys.value = [];
selectedRows.value = [];
dataSource.value = [];
+ downloadTaskIds.value = [];
};
const init = () => {
@@ -82,7 +85,7 @@ export default {
reload();
};
- const handleCloseTip = () => {
+ const clearSelectedRows = () => {
selectedRows.value = [];
selectedRowKeys.value = [];
};
@@ -98,8 +101,66 @@ export default {
record.file && downloadByUrl(record.file);
}
};
- const handleBatchDownload = () => {
- // 批量下载逻辑
+
+ const clearQueryTaskTimer = () => {
+ if (queryTaskTimer) {
+ clearInterval(queryTaskTimer);
+ queryTaskTimer = null;
+ }
+ };
+ const startBatchDownload = (id) => {
+ const randomId = genRandomId();
+ showExportNotification(
+ `正在批量下载“${selectedRows.value[0]?.name}”等${selectedRows.value.length}个文件,请稍后...`,
+ {
+ duration: 0,
+ id: randomId,
+ },
+ );
+ downloadTaskIds.value.push({
+ id,
+ randomId,
+ });
+
+ // getSyncTaskStatus(randomId);
+ if (!queryTaskTimer) {
+ queryTaskTimer = setInterval(() => getSyncTaskStatus(), 3000);
+ }
+ };
+ const handleBatchDownload = debounce(async () => {
+ const { code, data } = await postBatchDownload({ ids: selectedRowKeys.value });
+ if (code === 200) {
+ startBatchDownload(data.id);
+ }
+ }, 500);
+ const getSyncTaskStatus = async () => {
+ const { code, data } = await batchQueryTaskStatus({ ids: downloadTaskIds.value.map((v) => v.id) });
+ if (code === 200) {
+ let completeTaskNum = 0;
+ data.forEach((item) => {
+ const { status, file, id } = item;
+ if (status !== 0) {
+ completeTaskNum++;
+
+ const notificationId = downloadTaskIds.value.find((v) => v.id === id)?.randomId;
+ notificationId && Notification.remove(notificationId);
+
+ if (status === 1) {
+ AMessage.success('批量下载已完成,正在下载文件...');
+ downloadByUrl(file);
+ } else if (status === 2) {
+ AMessage.error('批量下载失败,请重新尝试下载');
+ }
+ }
+ });
+
+ // 全部完成了
+ if (completeTaskNum === data.length) {
+ clearQueryTaskTimer();
+ clearSelectedRows();
+ downloadTaskIds.value = [];
+ }
+ }
};
const handleDelete = (record) => {
@@ -121,8 +182,14 @@ export default {
selectedRowKeys.value = [];
getData();
};
+ const unloadComp = () => {
+ clearQueryTaskTimer();
+ };
+ onUnmounted(() => {
+ clearQueryTaskTimer;
+ });
- expose({ init, reset });
+ expose({ init, reset, unloadComp });
return () => (
@@ -187,7 +254,7 @@ export default {