118 lines
2.5 KiB
TypeScript
118 lines
2.5 KiB
TypeScript
import { requestClient } from '#/api/request';
|
||
|
||
const prefix = 'workbench/';
|
||
|
||
/** 工作台布局项(后端按角色下发) */
|
||
export type WorkbenchLayoutItem = {
|
||
id: number;
|
||
widget_code: string;
|
||
title: string;
|
||
sort: number;
|
||
config: null | Record<string, any>;
|
||
};
|
||
|
||
/** 医生今日摘要(与医生小程序工作台同口径) */
|
||
export type DoctorSummaryResult = {
|
||
range: string;
|
||
prescription_count: number;
|
||
wait_accept: number;
|
||
accepting: number;
|
||
completed: number;
|
||
prescription_amount: string;
|
||
};
|
||
|
||
/** 药师待审摘要 */
|
||
export type PharmacistSummaryResult = {
|
||
pending_total: number;
|
||
};
|
||
|
||
/** 诊所今日摘要 */
|
||
export type ClinicSummaryResult = {
|
||
wait_accept: number;
|
||
accepting: number;
|
||
completed: number;
|
||
wait_delivery: number;
|
||
};
|
||
|
||
/** 订单管理员摘要 */
|
||
export type OrderSummaryResult = {
|
||
wait_delivery: number;
|
||
refunding: number;
|
||
};
|
||
|
||
/** 平台今日总览(超管/系统管理员) */
|
||
export type PlatformOverviewResult = {
|
||
order_count: number;
|
||
register_count: number;
|
||
revenue: number;
|
||
store_input_count: number;
|
||
};
|
||
|
||
/** 待办中心单项(count>0 需要处理,path 为跳转路由) */
|
||
export type TodoCenterItem = {
|
||
code: string;
|
||
label: string;
|
||
count: number;
|
||
path: string;
|
||
};
|
||
|
||
/** 待办中心结果 */
|
||
export type TodoCenterResult = {
|
||
items: TodoCenterItem[];
|
||
};
|
||
|
||
/**
|
||
* 获取当前登录角色的工作台布局
|
||
*/
|
||
export async function getWorkbenchLayoutApi() {
|
||
return requestClient.get<WorkbenchLayoutItem[]>(`${prefix}layout`);
|
||
}
|
||
|
||
/**
|
||
* 医生今日摘要
|
||
*/
|
||
export async function getDoctorSummaryApi(range: string = 'today') {
|
||
return requestClient.get<DoctorSummaryResult>(`${prefix}doctor-summary`, {
|
||
params: { range },
|
||
});
|
||
}
|
||
|
||
/**
|
||
* 药师待审摘要
|
||
*/
|
||
export async function getPharmacistSummaryApi() {
|
||
return requestClient.get<PharmacistSummaryResult>(
|
||
`${prefix}pharmacist-summary`,
|
||
);
|
||
}
|
||
|
||
/**
|
||
* 诊所今日摘要
|
||
*/
|
||
export async function getClinicSummaryApi() {
|
||
return requestClient.get<ClinicSummaryResult>(`${prefix}clinic-summary`);
|
||
}
|
||
|
||
/**
|
||
* 订单管理员摘要
|
||
*/
|
||
export async function getOrderSummaryApi() {
|
||
return requestClient.get<OrderSummaryResult>(`${prefix}order-summary`);
|
||
}
|
||
|
||
/**
|
||
* 平台今日总览(超管/系统管理员)
|
||
*/
|
||
export async function getPlatformOverviewApi() {
|
||
return requestClient.get<PlatformOverviewResult>(
|
||
`${prefix}platform-overview`,
|
||
);
|
||
}
|
||
|
||
/**
|
||
* 待办中心(超管/系统管理员)
|
||
*/
|
||
export async function getTodoCenterApi() {
|
||
return requestClient.get<TodoCenterResult>(`${prefix}todo-center`);
|
||
}
|