feat: AIHR 智能人力资源管理系统初始提交
- 员工花名册管理(加密存储、导入导出) - 薪酬管理(发薪批次、薪酬模版、加班费计算、工资条) - 社保公积金(多城市配置、版本管理、基数调整) - 解聘管理(6步流程、证据链、工作交接) - AI 助手(合同审查、风险预测、RAG 知识库) - Dashboard 仪表盘 - 设置与通知
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
import { z } from 'zod'
|
||||
|
||||
export const registerSchema = z.object({
|
||||
orgName: z.string().min(2, '企业名称至少2个字').max(50, '企业名称最多50个字'),
|
||||
phone: z.string().regex(/^1[3-9]\d{9}$/, '手机号格式不正确'),
|
||||
password: z.string().min(8, '密码至少8位').max(32, '密码最多32位'),
|
||||
confirmPassword: z.string(),
|
||||
}).refine((data) => data.password === data.confirmPassword, {
|
||||
message: '两次密码不一致',
|
||||
path: ['confirmPassword'],
|
||||
})
|
||||
|
||||
export const loginSchema = z.object({
|
||||
phone: z.string().regex(/^1[3-9]\d{9}$/, '手机号格式不正确'),
|
||||
password: z.string().min(1, '请输入密码'),
|
||||
})
|
||||
|
||||
export const refreshSchema = z.object({
|
||||
refreshToken: z.string().min(1, '缺少 refreshToken'),
|
||||
})
|
||||
|
||||
export const forgotPasswordSchema = z.object({
|
||||
phone: z.string().regex(/^1[3-9]\d{9}$/, '手机号格式不正确'),
|
||||
})
|
||||
|
||||
export const resetPasswordSchema = z.object({
|
||||
phone: z.string().regex(/^1[3-9]\d{9}$/, '手机号格式不正确'),
|
||||
newPassword: z.string().min(8, '密码至少8位').max(32, '密码最多32位'),
|
||||
})
|
||||
|
||||
export const verifyCodeSchema = z.object({
|
||||
phone: z.string().regex(/^1[3-9]\d{9}$/, '手机号格式不正确'),
|
||||
code: z.string().length(6, '验证码为6位数字'),
|
||||
newPassword: z.string().min(8, '密码至少8位').max(32, '密码最多32位'),
|
||||
})
|
||||
@@ -0,0 +1,62 @@
|
||||
import { z } from 'zod'
|
||||
|
||||
export const createEmployeeSchema = z.object({
|
||||
name: z.string().min(1, '姓名不能为空').max(30, '姓名最多30个字'),
|
||||
department: z.string().min(1, '部门不能为空').max(50, '部门最多50个字'),
|
||||
hireDate: z.string().datetime(),
|
||||
monthlySalary: z.string().min(1, '月薪不能为空'),
|
||||
gender: z.enum(['男', '女']).optional(),
|
||||
phone: z.string().regex(/^1[3-9]\d{9}$/).optional(),
|
||||
isPregnant: z.boolean().default(false),
|
||||
isInMedicalPeriod: z.boolean().default(false),
|
||||
isWorkInjured: z.boolean().default(false),
|
||||
city: z.string().max(20).optional(),
|
||||
contract: z.object({
|
||||
signDate: z.string().datetime().nullable(),
|
||||
startDate: z.string().datetime(),
|
||||
endDate: z.string().datetime().nullable(),
|
||||
contractType: z.enum(['FIXED', 'UNFIXED', 'UNSIGNED']),
|
||||
signMethod: z.enum(['PAPER', 'ELECTRONIC']).default('PAPER'),
|
||||
contractYears: z.number().int().min(1).max(10).default(3),
|
||||
probationMonths: z.number().int().min(0).max(6).default(0),
|
||||
probationSalary: z.number().min(0).default(0),
|
||||
}).optional(),
|
||||
})
|
||||
|
||||
export const updateEmployeeSchema = z.object({
|
||||
name: z.string().min(1).max(30).optional(),
|
||||
department: z.string().min(1).max(50).optional(),
|
||||
hireDate: z.string().datetime().optional(),
|
||||
monthlySalary: z.string().min(1).optional(),
|
||||
gender: z.enum(['男', '女']).optional(),
|
||||
phone: z.string().regex(/^1[3-9]\d{9}$/).optional(),
|
||||
bankName: z.string().max(50).optional(),
|
||||
bankAccount: z.string().max(30).optional(),
|
||||
emergencyContact: z.string().max(30).optional(),
|
||||
emergencyPhone: z.string().max(20).optional(),
|
||||
address: z.string().max(200).optional(),
|
||||
isPregnant: z.boolean().optional(),
|
||||
isInMedicalPeriod: z.boolean().optional(),
|
||||
isWorkInjured: z.boolean().optional(),
|
||||
socialInsBase: z.number().min(0).nullable().optional(),
|
||||
housingFundBase: z.number().min(0).nullable().optional(),
|
||||
specialDeduction: z.number().min(0).optional(),
|
||||
city: z.string().max(20).optional(),
|
||||
})
|
||||
|
||||
export const batchRenewSchema = z.object({
|
||||
contractIds: z.array(z.string()).min(1, '至少选择一个合同'),
|
||||
years: z.number().int().min(1).max(5).default(3),
|
||||
})
|
||||
|
||||
export const addContractSchema = z.object({
|
||||
employeeId: z.string().min(1),
|
||||
signDate: z.string().datetime().nullable(),
|
||||
startDate: z.string().datetime(),
|
||||
endDate: z.string().datetime().nullable(),
|
||||
contractType: z.enum(['FIXED', 'UNFIXED', 'UNSIGNED']),
|
||||
signMethod: z.enum(['PAPER', 'ELECTRONIC']).default('PAPER'),
|
||||
contractYears: z.number().int().min(1).max(10).default(3),
|
||||
probationMonths: z.number().int().min(0).max(6).default(0),
|
||||
probationSalary: z.number().min(0).default(0),
|
||||
})
|
||||
@@ -0,0 +1,37 @@
|
||||
import { z } from 'zod'
|
||||
|
||||
export const portalLoginSchema = z.object({
|
||||
phone: z.string().regex(/^1[3-9]\d{9}$/, '手机号格式不正确'),
|
||||
password: z.string().min(6, '密码至少6位'),
|
||||
})
|
||||
|
||||
export const portalSendCodeSchema = z.object({
|
||||
phone: z.string().regex(/^1[3-9]\d{9}$/, '手机号格式不正确'),
|
||||
})
|
||||
|
||||
export const portalVerifyCodeSchema = z.object({
|
||||
phone: z.string().regex(/^1[3-9]\d{9}$/, '手机号格式不正确'),
|
||||
code: z.string().length(6, '验证码为6位数字'),
|
||||
})
|
||||
|
||||
export const onboardingSchema = z.object({
|
||||
token: z.string().min(1, '缺少 token'),
|
||||
name: z.string().min(1, '姓名不能为空'),
|
||||
phone: z.string().regex(/^1[3-9]\d{9}$/, '手机号格式不正确'),
|
||||
idCard: z.string().min(15, '身份证号格式不正确').max(18),
|
||||
emergencyContact: z.string().optional(),
|
||||
emergencyPhone: z.string().optional(),
|
||||
address: z.string().optional(),
|
||||
bankCard: z.string().optional(),
|
||||
bankName: z.string().optional(),
|
||||
})
|
||||
|
||||
export const contractConfirmSchema = z.object({
|
||||
token: z.string().min(1, '缺少 token'),
|
||||
agreed: z.boolean().refine((v) => v === true, '请勾选确认签署'),
|
||||
verifyCode: z.string().length(6, '验证码为6位数字'),
|
||||
})
|
||||
|
||||
export const contractSendCodeSchema = z.object({
|
||||
token: z.string().min(1, '缺少 token'),
|
||||
})
|
||||
@@ -0,0 +1,15 @@
|
||||
import { z } from 'zod'
|
||||
|
||||
export const terminationChecklistSchema = z.object({
|
||||
employeeId: z.string().min(1, '请选择员工'),
|
||||
reason: z.enum(['NEGOTIATED', 'FAULT', 'NONFAULT', 'LAYOFF', 'EXPIRED']),
|
||||
terminationDate: z.string().datetime(),
|
||||
compensation: z.number().min(0).default(0),
|
||||
checklist: z.record(z.boolean()).default({}),
|
||||
remark: z.string().max(500).optional(),
|
||||
})
|
||||
|
||||
export const terminationQuerySchema = z.object({
|
||||
page: z.coerce.number().min(1).default(1),
|
||||
pageSize: z.coerce.number().min(1).max(50).default(20),
|
||||
})
|
||||
Reference in New Issue
Block a user