2025-06-25 18:26:03 +08:00
|
|
|
|
<!--
|
|
|
|
|
|
* @Author: RenXiaoDong
|
|
|
|
|
|
* @Date: 2025-06-25 10:00:50
|
|
|
|
|
|
-->
|
|
|
|
|
|
<template>
|
|
|
|
|
|
<div class="account-manage-wrap">
|
2025-06-28 15:28:54 +08:00
|
|
|
|
<div class="filter-wrap bg-#fff rounded-8px border-1px border-#D7D7D9 border-solid">
|
2025-06-25 18:26:03 +08:00
|
|
|
|
<div class="top flex h-64px px-24px py-10px justify-between items-center">
|
|
|
|
|
|
<p class="text-18px font-400 lh-26px color-#211F24 title">账号管理</p>
|
|
|
|
|
|
<div class="flex items-center">
|
2025-07-22 11:28:39 +08:00
|
|
|
|
<a-button class="w-112px mr-12px" type="outline" size="medium" @click="handleOpenTagsModal">
|
2025-06-25 18:26:03 +08:00
|
|
|
|
<template #icon>
|
|
|
|
|
|
<img :src="icon3" width="16" height="16" />
|
|
|
|
|
|
</template>
|
|
|
|
|
|
<template #default>标签管理</template>
|
|
|
|
|
|
</a-button>
|
2025-07-22 11:28:39 +08:00
|
|
|
|
<a-button class="w-112px mr-12px" type="outline" size="medium" @click="handleOpenGroupModal">
|
2025-06-25 18:26:03 +08:00
|
|
|
|
<template #icon>
|
|
|
|
|
|
<img :src="icon2" width="16" height="16" />
|
|
|
|
|
|
</template>
|
|
|
|
|
|
<template #default>分组管理</template>
|
|
|
|
|
|
</a-button>
|
2025-07-22 11:28:39 +08:00
|
|
|
|
<a-button type="primary" class="w-112px" size="medium" @click="handleOpenAccountModal">
|
2025-06-25 18:26:03 +08:00
|
|
|
|
<template #icon>
|
|
|
|
|
|
<img :src="icon1" width="16" height="16" />
|
|
|
|
|
|
</template>
|
|
|
|
|
|
<template #default>添加账号</template>
|
|
|
|
|
|
</a-button>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
2025-07-03 16:56:10 +08:00
|
|
|
|
<FilterBlock ref="filterBlockRef" v-model:query="query" @onSearch="handleSearch" @onReset="handleReset" />
|
2025-06-25 18:26:03 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
<div
|
2025-07-04 14:05:01 +08:00
|
|
|
|
v-if="dataSource.length > 0"
|
2025-06-25 18:26:03 +08:00
|
|
|
|
class="tip-row flex justify-between px-16px py-10px w-100% my-12px h-42px"
|
2025-07-04 14:05:01 +08:00
|
|
|
|
:class="selectedItems.length > 0 ? 'selected' : isAbNormalStatus ? 'abnormal' : 'normal'"
|
2025-06-25 18:26:03 +08:00
|
|
|
|
>
|
|
|
|
|
|
<div class="flex items-center">
|
2025-06-26 18:31:52 +08:00
|
|
|
|
<div class="flex items-center">
|
|
|
|
|
|
<template v-if="selectedItems.length > 0">
|
|
|
|
|
|
<a-checkbox
|
|
|
|
|
|
:model-value="checkedAll"
|
|
|
|
|
|
:indeterminate="indeterminate"
|
|
|
|
|
|
class="mr-8px"
|
|
|
|
|
|
@change="handleChangeAll"
|
|
|
|
|
|
/>
|
|
|
|
|
|
<span class="label mr-24px">
|
|
|
|
|
|
已选
|
|
|
|
|
|
<span class="color-#6D4CFE">{{ selectedItems.length }}</span>
|
|
|
|
|
|
个账号
|
|
|
|
|
|
</span>
|
|
|
|
|
|
|
2025-07-14 16:29:04 +08:00
|
|
|
|
<span class="operation-btn" :class="{ disabled: isDisabledBatchSyncData }" @click="handleBatchSyncData"
|
|
|
|
|
|
>批量更新数据</span
|
|
|
|
|
|
>
|
2025-06-26 18:31:52 +08:00
|
|
|
|
<span class="operation-btn" @click="handleBatchTag">批量标签</span>
|
|
|
|
|
|
<span class="operation-btn" @click="handleBatchGroup">批量分组</span>
|
|
|
|
|
|
<span class="operation-btn red" @click="handleBatchDelete"> 批量删除 </span>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
<template v-else>
|
2025-07-04 14:05:01 +08:00
|
|
|
|
<img :src="isAbNormalStatus ? icon5 : icon4" width="16" height="16" class="mr-8px" />
|
|
|
|
|
|
<span class="label"> {{ tipLabel }} </span>
|
2025-06-26 18:31:52 +08:00
|
|
|
|
</template>
|
|
|
|
|
|
</div>
|
2025-06-25 18:26:03 +08:00
|
|
|
|
</div>
|
2025-06-26 18:31:52 +08:00
|
|
|
|
|
|
|
|
|
|
<template v-if="selectedItems.length > 0">
|
|
|
|
|
|
<img :src="icon6" width="16" height="16" class="cursor-pointer" @click="handleCloseTip" />
|
|
|
|
|
|
</template>
|
|
|
|
|
|
<div v-else>
|
2025-07-04 14:05:01 +08:00
|
|
|
|
<a-space v-if="isAbNormalStatus" class="flex items-center">
|
2025-07-23 15:22:46 +08:00
|
|
|
|
<a-button type="primary" status="danger" size="mini" @click="handleOpenAbnormalAccount">
|
2025-06-25 18:26:03 +08:00
|
|
|
|
<template #default>查看异常账号</template>
|
|
|
|
|
|
</a-button>
|
|
|
|
|
|
</a-space>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div class="card-wrap">
|
2025-06-26 18:31:52 +08:00
|
|
|
|
<AccountTable
|
2025-07-03 16:56:10 +08:00
|
|
|
|
v-if="dataSource.length > 0"
|
2025-07-14 17:30:59 +08:00
|
|
|
|
:syncMediaAccounts="syncMediaAccounts"
|
2025-07-18 16:11:57 +08:00
|
|
|
|
:isLoadingTaskStatus="isLoadingTaskStatus"
|
2025-06-26 18:31:52 +08:00
|
|
|
|
:dataSource="dataSource"
|
|
|
|
|
|
:selectedItems="selectedItems"
|
|
|
|
|
|
@selectionChange="handleSelectionChange"
|
|
|
|
|
|
@delete="handleDelete"
|
2025-06-27 16:36:18 +08:00
|
|
|
|
@openEdit="handleOpenEdit"
|
2025-07-04 15:49:42 +08:00
|
|
|
|
@update="getData"
|
2025-07-23 14:46:37 +08:00
|
|
|
|
@updateSyncStatus="handleUpdateSyncStatus"
|
2025-06-26 18:31:52 +08:00
|
|
|
|
/>
|
2025-07-03 16:56:10 +08:00
|
|
|
|
<NoData v-else />
|
|
|
|
|
|
|
|
|
|
|
|
<div v-if="pageInfo.total > 0" class="pagination-box">
|
2025-06-25 18:26:03 +08:00
|
|
|
|
<a-pagination
|
|
|
|
|
|
:total="pageInfo.total"
|
|
|
|
|
|
size="mini"
|
|
|
|
|
|
show-total
|
|
|
|
|
|
show-jumper
|
2025-07-14 16:39:02 +08:00
|
|
|
|
show-page-size
|
|
|
|
|
|
:page-size-options="[8, 16, 20, 32, 64]"
|
2025-06-25 18:26:03 +08:00
|
|
|
|
:current="pageInfo.page"
|
|
|
|
|
|
:page-size="pageInfo.pageSize"
|
|
|
|
|
|
@change="onPageChange"
|
|
|
|
|
|
@page-size-change="onPageSizeChange"
|
|
|
|
|
|
/>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
2025-07-03 16:56:10 +08:00
|
|
|
|
<GroupManageModal ref="groupManageModalRef" @update="filterBlockRef?.getGroups" />
|
|
|
|
|
|
<TagsManageModal ref="tagsManageModalRef" @update="filterBlockRef?.getTags" />
|
2025-07-18 14:43:19 +08:00
|
|
|
|
<AddAccountModal ref="addAccountModalRef" @update="getData" @startQueryTaskStatus="handleGetImportTaskStatus" />
|
2025-07-05 14:27:07 +08:00
|
|
|
|
|
|
|
|
|
|
<DeleteAccountModal ref="deleteAccountRef" @update="getData" @batchUpdate="onBatchSuccess" />
|
|
|
|
|
|
<BatchTagModal ref="batchTagModalRef" @update="onBatchSuccess" />
|
|
|
|
|
|
<BatchGroupModal ref="batchGroupModalRef" @update="onBatchSuccess" />
|
2025-06-25 18:26:03 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
<script setup>
|
2025-07-14 16:29:04 +08:00
|
|
|
|
import { ref, provide } from 'vue';
|
2025-07-18 14:43:19 +08:00
|
|
|
|
import { Notification } from '@arco-design/web-vue';
|
2025-06-25 18:26:03 +08:00
|
|
|
|
|
|
|
|
|
|
import FilterBlock from './components/filter-block';
|
|
|
|
|
|
import AccountTable from './components/account-table';
|
|
|
|
|
|
import GroupManageModal from './components/group-manage-modal';
|
|
|
|
|
|
import TagsManageModal from './components/tags-manage-modal';
|
|
|
|
|
|
import AddAccountModal from './components/add-account-modal';
|
2025-06-26 18:31:52 +08:00
|
|
|
|
import DeleteAccountModal from './components/account-table/delete-account';
|
2025-06-27 11:56:05 +08:00
|
|
|
|
import BatchTagModal from './components/batch-tag-modal';
|
|
|
|
|
|
import BatchGroupModal from './components/batch-group-modal';
|
2025-06-25 18:26:03 +08:00
|
|
|
|
|
2025-07-03 16:56:10 +08:00
|
|
|
|
import { INITIAL_QUERY, INITIAL_PAGE_INFO } from './constants';
|
2025-07-21 10:20:07 +08:00
|
|
|
|
import { showImportResultNotification } from '@/utils/arcoD';
|
2025-07-18 14:43:19 +08:00
|
|
|
|
import { getTaskStatus } from '@/api/all/common';
|
2025-07-24 18:30:33 +08:00
|
|
|
|
import { EnumStatus } from '@/views/property-marketing/media-account/components/status-select/status-box.tsx';
|
2025-07-14 16:29:04 +08:00
|
|
|
|
import {
|
|
|
|
|
|
getMediaAccounts,
|
|
|
|
|
|
getMediaAccountsHealth,
|
|
|
|
|
|
postSyncMediaAccountData,
|
|
|
|
|
|
postBatchSyncMediaAccountData,
|
|
|
|
|
|
getMediaAccountSyncStatus,
|
|
|
|
|
|
} from '@/api/all/propertyMarketing';
|
2025-06-25 18:26:03 +08:00
|
|
|
|
|
|
|
|
|
|
import icon1 from '@/assets/img/media-account/icon-add.png';
|
|
|
|
|
|
import icon2 from '@/assets/img/media-account/icon-group.png';
|
|
|
|
|
|
import icon3 from '@/assets/img/media-account/icon-tag.png';
|
|
|
|
|
|
import icon4 from '@/assets/img/media-account/icon-success.png';
|
|
|
|
|
|
import icon5 from '@/assets/img/media-account/icon-warn.png';
|
2025-06-26 18:31:52 +08:00
|
|
|
|
import icon6 from '@/assets/img/media-account/icon-close.png';
|
2025-06-25 18:26:03 +08:00
|
|
|
|
|
2025-07-14 16:29:04 +08:00
|
|
|
|
let syncDataTimer = null;
|
2025-07-18 14:43:19 +08:00
|
|
|
|
let queryTaskTimer = null;
|
2025-07-14 16:29:04 +08:00
|
|
|
|
|
2025-06-25 18:26:03 +08:00
|
|
|
|
const groupManageModalRef = ref(null);
|
|
|
|
|
|
const tagsManageModalRef = ref(null);
|
|
|
|
|
|
const addAccountModalRef = ref(null);
|
2025-06-26 18:31:52 +08:00
|
|
|
|
const deleteAccountRef = ref(null);
|
2025-06-27 11:56:05 +08:00
|
|
|
|
const batchTagModalRef = ref(null);
|
|
|
|
|
|
const batchGroupModalRef = ref(null);
|
2025-07-03 16:56:10 +08:00
|
|
|
|
const filterBlockRef = ref(null);
|
2025-06-25 18:26:03 +08:00
|
|
|
|
|
2025-07-03 16:56:10 +08:00
|
|
|
|
const pageInfo = ref(cloneDeep(INITIAL_PAGE_INFO));
|
2025-06-25 18:26:03 +08:00
|
|
|
|
const query = ref(cloneDeep(INITIAL_QUERY));
|
|
|
|
|
|
const dataSource = ref([]);
|
2025-06-26 18:31:52 +08:00
|
|
|
|
const selectedItems = ref([]);
|
2025-07-04 14:05:01 +08:00
|
|
|
|
const healthData = ref({});
|
2025-07-14 17:30:59 +08:00
|
|
|
|
const syncMediaAccounts = ref([]);
|
2025-07-18 16:11:57 +08:00
|
|
|
|
const isLoadingTaskStatus = ref(false); // 正在查询状态中
|
2025-07-04 14:05:01 +08:00
|
|
|
|
|
2025-07-24 18:30:33 +08:00
|
|
|
|
const isAbNormalStatus = computed(() => healthData.value?.abnormal_number > 0);
|
2025-07-14 16:29:04 +08:00
|
|
|
|
const isDisabledBatchSyncData = computed(() => selectedItems.value.some((item) => item.status !== EnumStatus.NORMAL));
|
2025-06-25 18:26:03 +08:00
|
|
|
|
|
2025-06-26 18:31:52 +08:00
|
|
|
|
const checkedAll = computed(() => selectedItems.value.length === dataSource.value.length);
|
|
|
|
|
|
const indeterminate = computed(
|
|
|
|
|
|
() => selectedItems.value.length > 0 && selectedItems.value.length < dataSource.value.length,
|
|
|
|
|
|
);
|
2025-06-25 18:26:03 +08:00
|
|
|
|
|
2025-07-04 14:05:01 +08:00
|
|
|
|
const tipLabel = computed(() => {
|
|
|
|
|
|
if (!isAbNormalStatus.value) {
|
|
|
|
|
|
return '太棒啦!所有账号都在正常运行。';
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const {
|
2025-07-24 18:30:33 +08:00
|
|
|
|
abnormal_number = 0,
|
2025-07-04 14:05:01 +08:00
|
|
|
|
login_invalid_number = 0,
|
|
|
|
|
|
too_many_requests_number = 0,
|
|
|
|
|
|
account_frozen_number = 0,
|
2025-07-11 15:25:36 +08:00
|
|
|
|
miss_data_number = 0,
|
2025-07-04 14:05:01 +08:00
|
|
|
|
} = healthData.value;
|
|
|
|
|
|
|
|
|
|
|
|
// 定义异常类型映射
|
|
|
|
|
|
const abnormalTypes = [
|
|
|
|
|
|
{ count: login_invalid_number, label: 'cookie过期' },
|
2025-07-11 15:25:36 +08:00
|
|
|
|
{ count: too_many_requests_number, label: '请求频繁' },
|
2025-07-04 14:05:01 +08:00
|
|
|
|
{ count: account_frozen_number, label: '账号被封' },
|
2025-07-11 15:25:36 +08:00
|
|
|
|
{ count: miss_data_number, label: '数据缺失' },
|
2025-07-14 17:30:59 +08:00
|
|
|
|
{ count: abnormal_number, label: '其他异常' },
|
2025-07-04 14:05:01 +08:00
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
|
|
// 过滤出有异常的项并格式化
|
|
|
|
|
|
const abnormalLabels = abnormalTypes.filter(({ count }) => count > 0).map(({ count, label }) => `${count}个${label}`);
|
|
|
|
|
|
|
2025-07-24 18:30:33 +08:00
|
|
|
|
return `共有 ${abnormal_number} 个账号存在授权异常,其中:${abnormalLabels.join(',')}。`;
|
2025-07-04 14:05:01 +08:00
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
const getData = () => {
|
|
|
|
|
|
getHealthData();
|
|
|
|
|
|
getAccountData();
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
const getHealthData = async () => {
|
|
|
|
|
|
const { code, data } = await getMediaAccountsHealth();
|
|
|
|
|
|
if (code === 200) {
|
|
|
|
|
|
healthData.value = data;
|
|
|
|
|
|
}
|
|
|
|
|
|
};
|
|
|
|
|
|
const getAccountData = async () => {
|
2025-07-03 16:56:10 +08:00
|
|
|
|
const { page, pageSize } = pageInfo.value;
|
|
|
|
|
|
const { code, data } = await getMediaAccounts({
|
|
|
|
|
|
page,
|
|
|
|
|
|
page_size: pageSize,
|
|
|
|
|
|
...query.value,
|
|
|
|
|
|
});
|
|
|
|
|
|
if (code === 200) {
|
|
|
|
|
|
dataSource.value = data?.data ?? [];
|
|
|
|
|
|
pageInfo.value.total = data?.total ?? 0;
|
|
|
|
|
|
}
|
2025-06-25 18:26:03 +08:00
|
|
|
|
};
|
2025-06-27 16:36:18 +08:00
|
|
|
|
const reload = () => {
|
2025-07-03 16:56:10 +08:00
|
|
|
|
pageInfo.value.page = 1;
|
2025-06-27 16:36:18 +08:00
|
|
|
|
getData();
|
|
|
|
|
|
};
|
|
|
|
|
|
const handleSearch = () => {
|
2025-07-14 11:16:37 +08:00
|
|
|
|
reload();
|
2025-06-25 18:26:03 +08:00
|
|
|
|
};
|
|
|
|
|
|
const handleReset = () => {
|
2025-07-03 16:56:10 +08:00
|
|
|
|
pageInfo.value = cloneDeep(INITIAL_PAGE_INFO);
|
2025-06-28 15:28:54 +08:00
|
|
|
|
selectedItems.value = [];
|
2025-06-25 18:26:03 +08:00
|
|
|
|
query.value = cloneDeep(INITIAL_QUERY);
|
2025-06-27 16:36:18 +08:00
|
|
|
|
reload();
|
2025-06-25 18:26:03 +08:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
const onPageChange = (current) => {
|
2025-07-03 16:56:10 +08:00
|
|
|
|
pageInfo.value.page = current;
|
2025-06-25 18:26:03 +08:00
|
|
|
|
getData();
|
|
|
|
|
|
};
|
|
|
|
|
|
const onPageSizeChange = (pageSize) => {
|
2025-07-03 16:56:10 +08:00
|
|
|
|
pageInfo.value.pageSize = pageSize;
|
2025-06-27 16:36:18 +08:00
|
|
|
|
reload();
|
2025-06-25 18:26:03 +08:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
const handleOpenGroupModal = () => {
|
|
|
|
|
|
groupManageModalRef.value?.open();
|
|
|
|
|
|
};
|
|
|
|
|
|
const handleOpenTagsModal = () => {
|
|
|
|
|
|
tagsManageModalRef.value?.open();
|
|
|
|
|
|
};
|
|
|
|
|
|
const handleOpenAccountModal = () => {
|
|
|
|
|
|
addAccountModalRef.value?.open();
|
|
|
|
|
|
};
|
2025-06-26 18:31:52 +08:00
|
|
|
|
|
|
|
|
|
|
const handleOpenEdit = (item) => {
|
|
|
|
|
|
addAccountModalRef.value?.open(item.id);
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
const handleSelectionChange = (val) => {
|
|
|
|
|
|
selectedItems.value = val;
|
|
|
|
|
|
};
|
2025-07-03 18:02:56 +08:00
|
|
|
|
const handleChangeAll = (checked) => {
|
|
|
|
|
|
selectedItems.value = checked ? cloneDeep(dataSource.value) : [];
|
2025-06-26 18:31:52 +08:00
|
|
|
|
};
|
|
|
|
|
|
const handleBatchDelete = () => {
|
|
|
|
|
|
const ids = selectedItems.value.map((item) => item.id);
|
2025-07-04 14:05:01 +08:00
|
|
|
|
const names = selectedItems.value.map((item) => `"${item.name || '-'}"`).join(',');
|
2025-06-26 18:31:52 +08:00
|
|
|
|
deleteAccountRef.value?.open({ id: ids, name: names });
|
|
|
|
|
|
};
|
|
|
|
|
|
const handleDelete = (item) => {
|
|
|
|
|
|
const { id, name } = item;
|
2025-07-04 14:05:01 +08:00
|
|
|
|
deleteAccountRef.value?.open({ id, name: `"${name || '-'}"` });
|
2025-06-26 18:31:52 +08:00
|
|
|
|
};
|
|
|
|
|
|
const handleCloseTip = () => {
|
|
|
|
|
|
selectedItems.value = [];
|
|
|
|
|
|
};
|
2025-07-14 18:08:39 +08:00
|
|
|
|
// 先立即执行一次
|
|
|
|
|
|
const getAsyncStatus = async () => {
|
|
|
|
|
|
const { code, data } = await getMediaAccountSyncStatus();
|
|
|
|
|
|
if (code === 200) {
|
|
|
|
|
|
syncMediaAccounts.value = data;
|
|
|
|
|
|
|
|
|
|
|
|
// 所有任务都结束了,才停止轮询,刷新页面
|
|
|
|
|
|
const isEnd = data.every((item) => item.status !== 0);
|
|
|
|
|
|
if (isEnd) {
|
|
|
|
|
|
clearSyncDataTimer();
|
2025-07-18 16:11:57 +08:00
|
|
|
|
isLoadingTaskStatus.value = false;
|
2025-07-14 18:08:39 +08:00
|
|
|
|
getData();
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
};
|
2025-07-25 10:26:53 +08:00
|
|
|
|
|
2025-07-23 14:46:37 +08:00
|
|
|
|
const handleUpdateSyncStatus = (item) => {
|
|
|
|
|
|
const target = syncMediaAccounts.value.find((v) => v.id === item.id);
|
|
|
|
|
|
if (target) {
|
2025-07-25 10:26:53 +08:00
|
|
|
|
target.status = EnumStatus.NORMAL;
|
2025-07-23 14:46:37 +08:00
|
|
|
|
}
|
|
|
|
|
|
};
|
2025-07-14 18:08:39 +08:00
|
|
|
|
|
2025-07-14 16:29:04 +08:00
|
|
|
|
const startSyncDataPolling = () => {
|
2025-07-18 16:11:57 +08:00
|
|
|
|
isLoadingTaskStatus.value = true;
|
2025-07-14 16:29:04 +08:00
|
|
|
|
clearSyncDataTimer();
|
|
|
|
|
|
|
2025-07-14 18:08:39 +08:00
|
|
|
|
getAsyncStatus();
|
|
|
|
|
|
syncDataTimer = setInterval(getAsyncStatus, 3000);
|
2025-07-14 16:29:04 +08:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
const handleSyncData = async (item) => {
|
|
|
|
|
|
const { code } = await postSyncMediaAccountData(item.id);
|
|
|
|
|
|
if (code === 200) {
|
2025-07-18 16:11:57 +08:00
|
|
|
|
if (!isLoadingTaskStatus.value) {
|
2025-07-14 16:29:04 +08:00
|
|
|
|
startSyncDataPolling();
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
};
|
2025-06-27 11:56:05 +08:00
|
|
|
|
|
|
|
|
|
|
const handleBatchTag = () => {
|
|
|
|
|
|
batchTagModalRef.value?.open(selectedItems.value);
|
|
|
|
|
|
};
|
2025-07-14 16:29:04 +08:00
|
|
|
|
const handleBatchSyncData = async () => {
|
|
|
|
|
|
if (isDisabledBatchSyncData.value) {
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const ids = selectedItems.value.map((item) => item.id);
|
|
|
|
|
|
const { code } = await postBatchSyncMediaAccountData({ ids });
|
|
|
|
|
|
if (code === 200) {
|
2025-07-18 16:11:57 +08:00
|
|
|
|
if (!isLoadingTaskStatus.value) {
|
2025-07-14 16:29:04 +08:00
|
|
|
|
startSyncDataPolling();
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
};
|
2025-06-27 11:56:05 +08:00
|
|
|
|
const handleBatchGroup = () => {
|
|
|
|
|
|
batchGroupModalRef.value?.open(selectedItems.value);
|
|
|
|
|
|
};
|
2025-07-05 14:27:07 +08:00
|
|
|
|
const onBatchSuccess = () => {
|
|
|
|
|
|
selectedItems.value = [];
|
|
|
|
|
|
getData();
|
|
|
|
|
|
};
|
2025-06-27 16:36:18 +08:00
|
|
|
|
const handleOpenAbnormalAccount = () => {
|
2025-07-25 17:53:51 +08:00
|
|
|
|
query.value.status = 3;
|
2025-06-27 16:36:18 +08:00
|
|
|
|
reload();
|
|
|
|
|
|
};
|
2025-07-18 14:43:19 +08:00
|
|
|
|
|
|
|
|
|
|
// 查询导入账号任务状态
|
|
|
|
|
|
const getSyncTaskStatus = async (id, notificationId) => {
|
|
|
|
|
|
const { code, data } = await getTaskStatus(id);
|
|
|
|
|
|
if (code === 200) {
|
|
|
|
|
|
if (data?.status !== 0) {
|
|
|
|
|
|
clearQueryTaskTimer();
|
|
|
|
|
|
notificationId && Notification.remove(notificationId);
|
2025-07-21 10:45:07 +08:00
|
|
|
|
showImportResultNotification(data);
|
2025-07-18 14:43:19 +08:00
|
|
|
|
getData();
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
};
|
|
|
|
|
|
const handleGetImportTaskStatus = (id, notificationId) => {
|
|
|
|
|
|
clearQueryTaskTimer();
|
|
|
|
|
|
getSyncTaskStatus(id, notificationId);
|
2025-07-21 10:45:07 +08:00
|
|
|
|
queryTaskTimer = setInterval(() => getSyncTaskStatus(id, notificationId), 3000);
|
2025-07-18 14:43:19 +08:00
|
|
|
|
};
|
2025-07-14 16:29:04 +08:00
|
|
|
|
const clearSyncDataTimer = () => {
|
|
|
|
|
|
if (syncDataTimer) {
|
|
|
|
|
|
clearInterval(syncDataTimer);
|
|
|
|
|
|
syncDataTimer = null;
|
|
|
|
|
|
}
|
|
|
|
|
|
};
|
2025-07-18 14:43:19 +08:00
|
|
|
|
const clearQueryTaskTimer = () => {
|
|
|
|
|
|
if (queryTaskTimer) {
|
|
|
|
|
|
clearInterval(queryTaskTimer);
|
|
|
|
|
|
queryTaskTimer = null;
|
|
|
|
|
|
}
|
|
|
|
|
|
};
|
2025-07-14 16:29:04 +08:00
|
|
|
|
|
|
|
|
|
|
onMounted(() => {
|
|
|
|
|
|
getData();
|
|
|
|
|
|
});
|
|
|
|
|
|
onUnmounted(() => {
|
|
|
|
|
|
clearSyncDataTimer();
|
2025-07-18 14:43:19 +08:00
|
|
|
|
clearQueryTaskTimer();
|
2025-07-14 16:29:04 +08:00
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
provide('handleSyncData', handleSyncData);
|
2025-06-25 18:26:03 +08:00
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
<style scoped lang="scss">
|
|
|
|
|
|
@import './style.scss';
|
|
|
|
|
|
</style>
|