优化: 大文件拆分+代码分割+按需加载+console清理+any类型替换
- Money.tsx (2260行→54行): 拆分为 money/ 子目录4个组件, React.lazy二级分割 - AIAssistant.tsx (2038行→63行): 拆分为 ai-assistant/ 子目录6个组件, React.lazy二级分割 - xlsx改为动态导入, OvertimeTab从345KB降至12.7KB - api-services.ts: 请求参数 any→Record<string,unknown> - 移除前端3处console.log残留 - 后端console替换为pino logger - 前后端未使用import/变量清理 - Zod schema验证: termination/platform/special-status/work-process - 新增 leave.routes.ts, acceptance-test.routes.ts - UI组件: PageGuide, QueryError, Stepper
This commit is contained in:
@@ -666,7 +666,7 @@ export async function getDashboardData(orgId: string) {
|
||||
const yearEnd = new Date(now.getFullYear(), 11, 31, 23, 59, 59)
|
||||
|
||||
const [
|
||||
employeeCount, highRisks, pendingRisks, riskItems, resolvedItems,
|
||||
employeeCount, _highRisks, _pendingRisks, riskItems, resolvedItems,
|
||||
overtimeRecords, payslips, batchEntries, socialConfig, housingConfig,
|
||||
monthContracts, monthTerminations, monthDisciplinary, monthAttendance,
|
||||
monthSeverancePay,
|
||||
@@ -1217,17 +1217,13 @@ export async function getCostAnalysis(orgId: string, month: string) {
|
||||
const monthNum = parseInt(month.slice(5, 7))
|
||||
|
||||
// 当月数据
|
||||
const currentMonthStart = new Date(year, monthNum - 1, 1)
|
||||
const currentMonthEnd = new Date(year, monthNum, 0, 23, 59, 59)
|
||||
|
||||
// 上月(环比)
|
||||
const prevMonthStart = new Date(year, monthNum - 2, 1)
|
||||
const prevMonthEnd = new Date(year, monthNum - 1, 0, 23, 59, 59)
|
||||
const prevMonthStr = `${prevMonthStart.getFullYear()}-${String(prevMonthStart.getMonth() + 1).padStart(2, '0')}`
|
||||
|
||||
// 去年同月(同比)
|
||||
const lastYearMonthStart = new Date(year - 1, monthNum - 1, 1)
|
||||
const lastYearMonthEnd = new Date(year - 1, monthNum, 0, 23, 59, 59)
|
||||
const lastYearMonthStr = `${lastYearMonthStart.getFullYear()}-${String(lastYearMonthStart.getMonth() + 1).padStart(2, '0')}`
|
||||
|
||||
// 获取各月归档批次汇总(按员工去重,与 getDashboardData 口径一致)
|
||||
@@ -1802,7 +1798,7 @@ export async function getAnnualValueReport(orgId: string, year: number) {
|
||||
|
||||
const [
|
||||
risksResolved,
|
||||
lossAvoidedAgg,
|
||||
_lossAvoidedAgg,
|
||||
aiConversations,
|
||||
aiReviews,
|
||||
contractsSigned,
|
||||
@@ -2043,11 +2039,6 @@ export async function getAnnualValueReport(orgId: string, year: number) {
|
||||
// 总价值 = 规避损失 + 节约成本
|
||||
const totalValue = adjustedLossAvoided + costSaved
|
||||
|
||||
// ROI = 总价值 / 系统成本(年费 12000 元),上限 9999%
|
||||
const systemCost = 12000
|
||||
const rawRoi = systemCost > 0 ? Math.round((totalValue / systemCost) * 100) : 0
|
||||
const roi = Math.min(rawRoi, 9999)
|
||||
|
||||
const metrics = {
|
||||
risksResolved,
|
||||
lossAvoided,
|
||||
|
||||
Reference in New Issue
Block a user