123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990 |
- 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(Math.floor(dayjs().month() / 3) * 3) // 当前季度的起始月份
- .startOf("month")
- .format("YYYY-MM-DD HH:mm:ss"),
- end_time: dayjs()
- .month(Math.floor(dayjs().month() / 3) * 3 + 2) // 当前季度的结束月份
- .endOf("month")
- .format("YYYY-MM-DD HH:mm:ss"),
- },
- {
- name: "上季度",
- start_time: dayjs()
- .subtract(1, "quarter")
- .month(Math.floor(dayjs().subtract(1, "quarter").month() / 3) * 3)
- .startOf("month")
- .format("YYYY-MM-DD HH:mm:ss"),
- end_time: dayjs()
- .subtract(1, "quarter")
- .month(Math.floor(dayjs().subtract(1, "quarter").month() / 3) * 3 + 2)
- .endOf("month")
- .format("YYYY-MM-DD HH:mm:ss"),
- },
- ];
|