iloom-flatten/src/utils/constants.ts

75 lines
2.5 KiB
TypeScript
Raw Normal View History

// 状态映射配置
export const statusMap: Record<string, { label: string; color: string; bgColor: string; borderColor: string }> = {
pending: { label: '待确定', color: 'text-amber-700', bgColor: 'bg-amber-50', borderColor: 'border-amber-200' },
producing: { label: '生产中', color: 'text-blue-700', bgColor: 'bg-blue-50', borderColor: 'border-blue-200' },
completed: { label: '已完成', color: 'text-emerald-700', bgColor: 'bg-emerald-50', borderColor: 'border-emerald-200' },
rejected: { label: '已拒绝', color: 'text-gray-700', bgColor: 'bg-gray-100', borderColor: 'border-gray-300' }
};
// 简化的状态映射(用于纺织厂)
export const simpleStatusMap: Record<string, { label: string; color: string }> = {
pending: { label: '待确定', color: 'bg-yellow-100 text-yellow-700' },
producing: { label: '生产中', color: 'bg-blue-100 text-blue-700' },
completed: { label: '已完成', color: 'bg-green-100 text-green-700' },
rejected: { label: '已拒绝', color: 'bg-gray-100 text-gray-600' }
};
// 步骤类型配置
export const stepTypeConfig: Record<string, { name: string; icon: string }> = {
confirm: { name: '确认计划', icon: 'Check' },
yarn_purchase: { name: '采纱', icon: 'Clock' },
dyeing: { name: '染纱', icon: 'Clock' },
machine_start: { name: '上机', icon: 'Clock' },
fabric_warehouse: { name: '坯布生产', icon: 'Package' }
};
// 步骤名称映射
export const stepNames: Record<string, string> = {
confirm: '确认计划',
yarn_purchase: '采纱',
dyeing: '染纱',
machine_start: '上机',
fabric_warehouse: '坯布生产'
};
// 步骤顺序
export const stepOrder = ['confirm', 'yarn_purchase', 'dyeing', 'machine_start', 'fabric_warehouse'];
// 动画配置
export const animationConfig = {
// 标准过渡 - 用于展开/收起,使用更平滑的缓动函数避免抖动
transition: {
duration: 0.25,
ease: [0.4, 0, 0.2, 1] // 使用 ease-out 缓动,更平滑
},
// 快速过渡
fastTransition: {
duration: 0.2,
ease: [0.4, 0, 0.2, 1]
},
// 慢速过渡
slowTransition: {
duration: 0.4,
ease: [0.4, 0, 0.2, 1]
},
// 弹簧动画 - 用于交互反馈,降低弹性避免抖动
spring: {
type: 'spring',
stiffness: 200,
damping: 25,
mass: 0.8
}
};
// 分页配置
export const paginationConfig = {
defaultPageSize: 20,
maxInventoryRecords: 100,
maxPriceHistory: 50
};
// 进度阈值
export const progressThresholds = {
complete: 97 // 计划完成阈值
};