/** * 去重汇总导入启动适配(任务 65):multipart POST /import(file+groupId+company_id) → importId。 * *

company_id 决定这批数据写进哪一家:超管认页面上方 tab,非超管 requestCompanyId 为 null * ⇒ 一个字段都不发,后端按会话恒锁本公司。

*/ import { http } from '@/api/http' import { parseDedupeImportProgress, parseDedupeImportStart, type DedupeImportProgress } from './dedupe-import-model' export const DEDUPE_IMPORT_ENDPOINT = '/api/admin/dedupe-total-data/import' export const DEDUPE_DELETE_IMPORT_ENDPOINT = '/api/admin/dedupe-total-data/delete-import' export async function startDedupeImport(file: File, groupId: number, companyId?: number | null): Promise { const form = new FormData() form.append('file', file, file.name) form.append('groupId', String(groupId)) if (companyId != null) form.append('company_id', String(companyId)) const { data } = await http.post(DEDUPE_IMPORT_ENDPOINT, form) return parseDedupeImportStart(data) } /** 查询导入进度:GET /import/{importId}。 */ export async function fetchDedupeImportProgress(importId: string): Promise { const { data } = await http.get(`${DEDUPE_IMPORT_ENDPOINT}/${importId}`) return parseDedupeImportProgress(data) } /** 删除导入启动:multipart POST /delete-import(file+groupId) → importId。 */ export async function startDedupeDeleteImport(file: File, groupId: number, companyId?: number | null): Promise { const form = new FormData() form.append('file', file, file.name) form.append('groupId', String(groupId)) if (companyId != null) form.append('company_id', String(companyId)) const { data } = await http.post(DEDUPE_DELETE_IMPORT_ENDPOINT, form) return parseDedupeImportStart(data) } /** 查询删除导入进度:GET /delete-import/{importId}。 */ export async function fetchDedupeDeleteImportProgress(importId: string): Promise { const { data } = await http.get(`${DEDUPE_DELETE_IMPORT_ENDPOINT}/${importId}`) return parseDedupeImportProgress(data) }