import { post, get, uploadFile as requestUploadFile } from '@/utils/request'; export type RequestProps = { /** * @description 0-本月 1-本周 2-本年 */ dateType?: 0 | 1 | 2; /** * @description 0-仅本人 1-本人及下属 2-仅本部门 3-本部门及下属部门 */ queryType?: 0 | 1 | 2 | 3; startDate?: string; endDate?: string; }; export type SummaryData = { code: string; data: { clueDataSummary: { changeNum: number; newNum: number; }; businessOpportunityDataSummary: { winning: number; allAmountOfMoney: number; losting: number; newNum: number; }; customDataSummary: { closeDealNum: number; newNum: number; }; }; }; export async function getSummaryData( payload?: RequestProps ): Promise { return await post('/order/dataSummary', payload); } export type StageData = { code: string; data: { dataMap: { stageName: string; num: number; }[]; }; }; export async function getStageData(payload?: RequestProps): Promise { return await post('/order/businessOpportunityStage', payload); } export type BulletinData = { code: string; data: { custom: { customPromote: string; customCount: number; }; businessOpportunity: { businessOpportunityCount: number; businessOpportunityPromote: string; }; contacts: { contactsCount: number; contactsPromote: string; }; salesOrder: { salesOrderCount: number; salesOrderPromote: string; }; salesOrdersPrice: { salesOrderPricePromote: string; salesOrdersPrice: number; }; clue: { cluePromote: string; clueCount: number; }; businessOpportunityPrice: { businessOpportunityPromote: string; businessOpportunityPrice: number; }; }; }; export async function getBulletinData( payload?: RequestProps ): Promise { return await post('/order/salesKit', payload); } export type AIQuestionParams = { questionDataSource: number; sourceContent: string; content: string; startDate: string; endDate: string; url?: string; }; export type AIQuestionResponse = { code: string; data: string; }; export async function askAIQuestion( payload: AIQuestionParams ): Promise { return await post('/aiQuestion/ask', payload); } export type UploadFileResponse = { code: string; data: string; }; export async function uploadFileApi(file: File): Promise { const formData = new FormData(); formData.append('multipartFile', file); return await requestUploadFile('/common/uploadFile', formData); }