添加多维度分析API接口到analytics.ts
This commit is contained in:
parent
ba0d70cab2
commit
2d827bdbc7
@ -412,3 +412,89 @@ export const getDesignerDeductionDetails = async (
|
||||
};
|
||||
};
|
||||
|
||||
// ==================== 多维度分析类型 ====================
|
||||
|
||||
export interface CategoryAnalysis {
|
||||
categoryId: number;
|
||||
categoryName: string;
|
||||
totalTasks: number;
|
||||
completedTasks: number;
|
||||
inProgressTasks: number;
|
||||
pendingTasks: number;
|
||||
totalScore: number;
|
||||
completionRate: number;
|
||||
totalQuantity: number;
|
||||
}
|
||||
|
||||
export interface BrandAnalysis {
|
||||
brandId: number;
|
||||
brandName: string;
|
||||
totalTasks: number;
|
||||
completedTasks: number;
|
||||
inProgressTasks: number;
|
||||
totalScore: number;
|
||||
completionRate: number;
|
||||
totalQuantity: number;
|
||||
}
|
||||
|
||||
export interface DeptAnalysis {
|
||||
deptId: number;
|
||||
deptName: string;
|
||||
totalTasks: number;
|
||||
completedTasks: number;
|
||||
inProgressTasks: number;
|
||||
pendingTasks: number;
|
||||
totalScore: number;
|
||||
completionRate: number;
|
||||
totalQuantity: number;
|
||||
avgCompletionHours?: number;
|
||||
}
|
||||
|
||||
export interface PlatformAnalysis {
|
||||
platformId: number;
|
||||
platformName: string;
|
||||
totalTasks: number;
|
||||
completedTasks: number;
|
||||
inProgressTasks: number;
|
||||
totalScore: number;
|
||||
completionRate: number;
|
||||
totalQuantity: number;
|
||||
}
|
||||
|
||||
export interface DimensionAnalysis {
|
||||
categoryAnalysis: CategoryAnalysis[];
|
||||
brandAnalysis: BrandAnalysis[];
|
||||
receivingDeptAnalysis: DeptAnalysis[];
|
||||
demandDeptAnalysis: DeptAnalysis[];
|
||||
platformAnalysis: PlatformAnalysis[];
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取多维度分析数据
|
||||
*/
|
||||
export const getDimensionAnalysis = async (
|
||||
dateRange: string = 'month',
|
||||
month?: string
|
||||
): Promise<DimensionAnalysis> => {
|
||||
const params: any = { dateRange };
|
||||
if (month) params.month = month;
|
||||
|
||||
const response = await request.get('/analytics/dimension-analysis', { params });
|
||||
|
||||
if (response && typeof response === 'object') {
|
||||
if ('data' in response && response.data !== undefined && response.data !== null) {
|
||||
return response.data as DimensionAnalysis;
|
||||
}
|
||||
if ('categoryAnalysis' in response || 'brandAnalysis' in response) {
|
||||
return response as unknown as DimensionAnalysis;
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
categoryAnalysis: [],
|
||||
brandAnalysis: [],
|
||||
receivingDeptAnalysis: [],
|
||||
demandDeptAnalysis: [],
|
||||
platformAnalysis: []
|
||||
};
|
||||
};
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user