12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576 |
- 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<any> {
- return await post('/report/getCustomerTotalCount', payload);
- }
- export async function getConversionData(payload?: RequestProps): Promise<any> {
- return await post('/report/getCustomerTransferRate', payload);
- }
- export async function getDepartmentData(): Promise<any> {
- return await get('/department/normalList');
- }
- export async function getStaffData(): Promise<any> {
- return await get('/user/getSimpleActiveUserList');
- }
- export async function exportFile(payload: RequestProps, type: number): Promise<any> {
- 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')
- }
- ];
|