feat: 导入投放账户修改为异步逻辑
This commit is contained in:
@ -42,8 +42,8 @@ import icon1 from '@/assets/img/media-account/icon-download.png';
|
||||
import icon2 from '@/assets/img/media-account/icon-delete.png';
|
||||
import icon3 from '@/assets/img/media-account/icon-dy.png';
|
||||
import icon4 from '@/assets/img/media-account/icon-xhs.png';
|
||||
import icon5 from '@/assets/img/media-account/icon-warn-1.png';
|
||||
import icon6 from '@/assets/img/media-account/icon-success.png';
|
||||
// import icon5 from '@/assets/img/media-account/icon-warn-1.png';
|
||||
// import icon6 from '@/assets/img/media-account/icon-success.png';
|
||||
|
||||
const UploadStatus = {
|
||||
DEFAULT: 'default',
|
||||
@ -74,10 +74,10 @@ export default {
|
||||
const formRef = ref();
|
||||
const file = ref(null);
|
||||
const authorizedAccountModalRef = ref(null);
|
||||
const importPromptModalRef = ref(null);
|
||||
// const importPromptModalRef = ref(null);
|
||||
const uploadRef = ref(null);
|
||||
const isCustomCookie = ref(false);
|
||||
const form = ref({ ...INITIAL_FORM });
|
||||
const form = ref(cloneDeep(INITIAL_FORM));
|
||||
const syncDataModalRef = ref(null);
|
||||
const importLoading = ref(false);
|
||||
|
||||
@ -140,7 +140,7 @@ export default {
|
||||
const reset = () => {
|
||||
formRef.value?.resetFields();
|
||||
formRef.value?.clearValidate();
|
||||
form.value = { ...INITIAL_FORM };
|
||||
form.value = cloneDeep(INITIAL_FORM);
|
||||
fileName.value = '';
|
||||
file.value = null;
|
||||
isEdit.value = false;
|
||||
@ -197,6 +197,8 @@ export default {
|
||||
}
|
||||
} catch (error) {
|
||||
uploadStatus.value = UploadStatus.ERROR;
|
||||
} finally {
|
||||
importLoading.value = false;
|
||||
}
|
||||
};
|
||||
const handleAddAccount = async () => {
|
||||
|
||||
@ -130,7 +130,7 @@ import BatchTagModal from './components/batch-tag-modal';
|
||||
import BatchGroupModal from './components/batch-group-modal';
|
||||
|
||||
import { INITIAL_QUERY, INITIAL_PAGE_INFO } from './constants';
|
||||
import {renderNotification} from "./renderComp"
|
||||
import { showImportResultNotification } from '@/utils/arcoD';
|
||||
import { EnumStatus } from '@/views/property-marketing/media-account/components/status-select/constants';
|
||||
import { getTaskStatus } from '@/api/all/common';
|
||||
import {
|
||||
@ -350,7 +350,7 @@ const getSyncTaskStatus = async (id, notificationId) => {
|
||||
if (data?.status !== 0) {
|
||||
clearQueryTaskTimer();
|
||||
notificationId && Notification.remove(notificationId);
|
||||
renderNotification(data)
|
||||
showImportResultNotification(data)
|
||||
getData();
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,40 +0,0 @@
|
||||
import { downloadByUrl } from '@/utils/tools';
|
||||
|
||||
const handleDownloadError = (file) => {
|
||||
file && downloadByUrl(file);
|
||||
};
|
||||
export const renderNotification = (data) => {
|
||||
const { total_number, success_number, fail_number, file } = data;
|
||||
const hasError = fail_number > 0;
|
||||
Notification.warning({
|
||||
id,
|
||||
showIcon: false,
|
||||
closable: true,
|
||||
content: (
|
||||
<div>
|
||||
<div class="flex items-center mb-4px">
|
||||
<img src={hasError ? icon5 : icon6} width="16" height="16" class="mr-8px" />
|
||||
<span class="text-16px lh-24px font-400 color-#211F24">导入完成</span>
|
||||
</div>
|
||||
<p class="text-14px lh-22px font-400 color-#211F24">
|
||||
共导入 {total_number} 个账号,导入成功 {success_number} 个
|
||||
{hasError && (
|
||||
<span>
|
||||
,失败 <span class="color-#F64B31">{fail_number}</span> 个
|
||||
</span>
|
||||
)}
|
||||
</p>
|
||||
{hasError && (
|
||||
<div
|
||||
class="mt-8px text-14px lh-22px font-400 color-#6D4CFE cursor-pointer"
|
||||
onClick={() => handleDownloadError(file)}
|
||||
>
|
||||
下载问题表格
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
),
|
||||
duration: 3000,
|
||||
class: `px-16px py-16px w-400px rounded-2px ${hasError ? 'bg-#FFF7E5' : 'bg-#EBF7F2'}`,
|
||||
});
|
||||
};
|
||||
Reference in New Issue
Block a user