- imports: 新增 preflight_import 预检报告(判定/分阶段统计/阻断归因/问题/下一步/错误示例),导入任务 settings 落库(映射/校区/更新/重复/未匹配策略),预览应用策略,向导提交写操作日志 - ai-chat: 新增 excel_analyze(ExcelJS)工具,移除附件/上下文截断,start_import_wizard 支持确认参数,ui.import_preflight SSE,预览确认写操作日志 - admin: ImportPreflightCard 渲染与持久化,聊天抽屉布局/侧边栏修复,考勤页 CSS 引入,费用/学生页接口 schema 校验修复
72 lines
1.7 KiB
TypeScript
72 lines
1.7 KiB
TypeScript
import { z } from 'zod';
|
|
|
|
export const importSheetMetaSchema = z
|
|
.object({
|
|
name: z.string(),
|
|
headers: z.array(z.string()),
|
|
rowCount: z.number(),
|
|
suggestedStepKey: z.string().nullable(),
|
|
})
|
|
.passthrough();
|
|
|
|
export const importStepSummarySchema = z
|
|
.object({
|
|
total: z.number(),
|
|
valid: z.number(),
|
|
error: z.number(),
|
|
create: z.number(),
|
|
update: z.number(),
|
|
skip: z.number(),
|
|
})
|
|
.passthrough()
|
|
.nullable();
|
|
|
|
export const importStepDetailSchema = z
|
|
.object({
|
|
id: z.number(),
|
|
stepKey: z.string(),
|
|
label: z.string(),
|
|
sheets: z.array(z.string()),
|
|
status: z.string(),
|
|
mapping: z.record(z.string(), z.string()),
|
|
summary: importStepSummarySchema,
|
|
committedAt: z.string().nullable(),
|
|
})
|
|
.passthrough();
|
|
|
|
export const importRunSettingsSchema = z
|
|
.object({
|
|
mapping: z.record(z.string(), z.record(z.string(), z.string())).optional(),
|
|
organization: z.string().nullable().optional(),
|
|
updateExisting: z.boolean().optional(),
|
|
duplicatePolicy: z.enum(['error', 'skip']).optional(),
|
|
skipUnmatched: z.boolean().optional(),
|
|
})
|
|
.passthrough()
|
|
.nullable()
|
|
.optional();
|
|
|
|
export const importRunDetailSchema = z
|
|
.object({
|
|
id: z.string(),
|
|
fileName: z.string(),
|
|
source: z.enum(['ai', 'manual']),
|
|
status: z.string(),
|
|
currentStepKey: z.string().nullable(),
|
|
createdAt: z.string(),
|
|
sheets: z.array(importSheetMetaSchema),
|
|
steps: z.array(importStepDetailSchema),
|
|
settings: importRunSettingsSchema,
|
|
})
|
|
.passthrough();
|
|
|
|
export const importRunEnvelopeSchema = z
|
|
.object({
|
|
success: z.boolean(),
|
|
data: importRunDetailSchema,
|
|
message: z.string().optional(),
|
|
})
|
|
.passthrough();
|
|
|
|
/** 考勤记录 */
|