diff --git a/src/constants/importanceLevels.js b/src/constants/importanceLevels.js new file mode 100644 index 00000000..2b2bc465 --- /dev/null +++ b/src/constants/importanceLevels.js @@ -0,0 +1,77 @@ +// src/constants/importanceLevels.js +// 事件重要性等级配置 + +import { + WarningIcon, + WarningTwoIcon, + InfoIcon, + CheckCircleIcon, +} from '@chakra-ui/icons'; + +/** + * 重要性等级配置 + * 用于事件列表展示和重要性说明 + */ +export const IMPORTANCE_LEVELS = { + 'S': { + level: 'S', + color: 'purple.600', + bgColor: 'purple.50', + borderColor: 'purple.200', + icon: WarningIcon, + label: '极高', + dotBg: 'purple.500', + description: '重大事件,市场影响深远', + antdColor: '#722ed1', // 对应 Ant Design 的紫色 + }, + 'A': { + level: 'A', + color: 'red.600', + bgColor: 'red.50', + borderColor: 'red.200', + icon: WarningTwoIcon, + label: '高', + dotBg: 'red.500', + description: '重要事件,影响较大', + antdColor: '#ff4d4f', // 对应 Ant Design 的红色 + }, + 'B': { + level: 'B', + color: 'orange.600', + bgColor: 'orange.50', + borderColor: 'orange.200', + icon: InfoIcon, + label: '中', + dotBg: 'orange.500', + description: '普通事件,有一定影响', + antdColor: '#faad14', // 对应 Ant Design 的橙色 + }, + 'C': { + level: 'C', + color: 'green.600', + bgColor: 'green.50', + borderColor: 'green.200', + icon: CheckCircleIcon, + label: '低', + dotBg: 'green.500', + description: '参考事件,影响有限', + antdColor: '#52c41a', // 对应 Ant Design 的绿色 + } +}; + +/** + * 获取重要性等级配置 + * @param {string} importance - 重要性等级 (S/A/B/C) + * @returns {Object} 重要性配置对象 + */ +export const getImportanceConfig = (importance) => { + return IMPORTANCE_LEVELS[importance] || IMPORTANCE_LEVELS['C']; +}; + +/** + * 获取所有等级配置(用于说明列表) + * @returns {Array} 所有等级配置数组 + */ +export const getAllImportanceLevels = () => { + return Object.values(IMPORTANCE_LEVELS); +};