import { post, get } from '@/utils/request'; import { dayjs } from 'element-plus'; export type RequestProps = { startDate?: string; endDate?: string; exportType?: 0 | 1; userId?: number; departmentId?: number; }; export async function getOverallData(payload?: RequestProps): Promise { return await post('/report/getCustomerTotalCount', payload); } export async function getConversionData(payload?: RequestProps): Promise { return await post('/report/getCustomerTransferRate', payload); } export async function getDepartmentData(): Promise { return await get('/department/normalList'); } export async function getStaffData(): Promise { return await get('/user/getSimpleActiveUserList'); } export async function exportFile(payload: RequestProps, type: number): Promise { return await post( type === 0 ? '/report/exportCustomerTotalCount' : '/report/exportCustomerTransferRate', payload ); } export const dateCollections = [ { name: '当日', start_time: dayjs().startOf('date').format('YYYY-MM-DD HH:mm:ss'), end_time: dayjs().endOf('date').format('YYYY-MM-DD HH:mm:ss') }, { name: '昨日', start_time: dayjs().startOf('date').subtract(1, 'day').format('YYYY-MM-DD HH:mm:ss'), end_time: dayjs().endOf('date').subtract(1, 'day').format('YYYY-MM-DD HH:mm:ss') }, { name: '本周', start_time: dayjs().startOf('week').add(1, 'day').format('YYYY-MM-DD HH:mm:ss'), end_time: dayjs().endOf('week').add(1, 'day').format('YYYY-MM-DD HH:mm:ss') }, { name: '上周', start_time: dayjs().add(-1, 'week').startOf('week').add(1, 'day').format('YYYY-MM-DD HH:mm:ss'), end_time: dayjs().add(-1, 'week').endOf('week').add(1, 'day').format('YYYY-MM-DD HH:mm:ss') }, { name: '本月', start_time: dayjs().startOf('month').format('YYYY-MM-DD HH:mm:ss'), end_time: dayjs().endOf('month').format('YYYY-MM-DD HH:mm:ss') }, { name: '上月', start_time: dayjs().add(-1, 'month').startOf('month').format('YYYY-MM-DD HH:mm:ss'), end_time: dayjs().add(-1, 'month').endOf('month').format('YYYY-MM-DD HH:mm:ss') }, { name: '本季度', start_time: dayjs().month(0).format('YYYY-MM-DD HH:mm:ss'), end_time: dayjs().month(2).endOf('month').format('YYYY-MM-DD HH:mm:ss') }, { name: '上季度', start_time: dayjs().add(-1, 'year').month(9).format('YYYY-MM-DD HH:mm:ss'), end_time: dayjs().add(-1, 'year').month(11).endOf('month').format('YYYY-MM-DD HH:mm:ss') } ];