refactor: 前端应用骨架迁移至 zustand 并统一路由权限壳
This commit is contained in:
79
apps/admin/src/api/schemas/dashboard.ts
Normal file
79
apps/admin/src/api/schemas/dashboard.ts
Normal file
@@ -0,0 +1,79 @@
|
||||
import { z } from 'zod';
|
||||
|
||||
export const classroomScheduleSchema = z
|
||||
.object({
|
||||
classrooms: z.array(z.record(z.string(), z.unknown())),
|
||||
organizations: z.array(z.record(z.string(), z.unknown())),
|
||||
matrix: z.record(z.string(), z.record(z.string(), z.array(z.record(z.string(), z.unknown())))),
|
||||
summary: z.record(z.string(), z.record(z.string(), z.unknown())),
|
||||
days: z.number().optional(),
|
||||
})
|
||||
.passthrough();
|
||||
|
||||
/** Dashboard 统计 */
|
||||
export const dashboardStatsSchema = z
|
||||
.object({
|
||||
totalRooms: z.number(),
|
||||
totalStudents: z.number(),
|
||||
occupiedBeds: z.number(),
|
||||
totalCapacity: z.number(),
|
||||
occupancyRate: z.string(),
|
||||
classroomCount: z.number(),
|
||||
classroomOccupancyRate: z.string(),
|
||||
todayAttendanceRate: z.string().optional(),
|
||||
monthlyIncome: z.number(),
|
||||
classCount: z.number(),
|
||||
teacherCount: z.number(),
|
||||
pendingDeposits: z.number(),
|
||||
activeRentals: z.number(),
|
||||
todayPresent: z.number(),
|
||||
occupancyByBuilding: z.array(
|
||||
z.object({ building: z.string(), count: z.string() }).passthrough(),
|
||||
),
|
||||
attendanceByStatus: z.record(z.string(), z.number()),
|
||||
expenseByType: z.array(z.object({ type: z.string(), total: z.string() }).passthrough()),
|
||||
attendanceTrend: z.array(z.object({ date: z.string(), rate: z.string() }).passthrough()),
|
||||
incomeTrend: z.array(z.object({ month: z.string(), amount: z.number() }).passthrough()),
|
||||
})
|
||||
.passthrough();
|
||||
|
||||
export const roomRankingSchema = z.array(
|
||||
z.object({ roomNumber: z.string(), total: z.string() }).passthrough(),
|
||||
);
|
||||
|
||||
export const classAttendanceRankingSchema = z
|
||||
.object({
|
||||
top: z.array(
|
||||
z
|
||||
.object({ className: z.string(), present: z.number(), total: z.number(), rate: z.number() })
|
||||
.passthrough(),
|
||||
),
|
||||
bottom: z.array(
|
||||
z
|
||||
.object({ className: z.string(), present: z.number(), total: z.number(), rate: z.number() })
|
||||
.passthrough(),
|
||||
),
|
||||
})
|
||||
.passthrough();
|
||||
|
||||
export const ganttRoomsSchema = z.array(
|
||||
z
|
||||
.object({ roomNumber: z.string(), occupancies: z.array(z.record(z.string(), z.unknown())) })
|
||||
.passthrough(),
|
||||
);
|
||||
|
||||
export const classroomOccupanciesSchema = z.array(
|
||||
z
|
||||
.object({ name: z.string(), building: z.string(), capacity: z.number(), occupancy: z.number() })
|
||||
.passthrough(),
|
||||
);
|
||||
|
||||
export const classroomUtilStatsSchema = z
|
||||
.object({
|
||||
totalClassrooms: z.number(),
|
||||
inUseCount: z.number(),
|
||||
utilizationRate: z.string(),
|
||||
})
|
||||
.passthrough();
|
||||
|
||||
/** 考勤元数据 */
|
||||
Reference in New Issue
Block a user