Files
vf_react/src/constants/importanceLevels.js

90 lines
2.5 KiB
JavaScript

// src/constants/importanceLevels.js
// 事件重要性等级配置
import {
WarningIcon,
WarningTwoIcon,
InfoIcon,
CheckCircleIcon,
} from '@chakra-ui/icons';
/**
* 重要性等级配置
* 用于事件列表展示和重要性说明
*/
export const IMPORTANCE_LEVELS = {
'S': {
level: 'S',
color: 'red.800',
bgColor: 'red.50',
borderColor: 'red.200',
colorScheme: 'red',
badgeBg: '#dc2626', // 圆形徽章背景色 - 红色
badgeColor: 'white', // 圆形徽章文字颜色 - 白色
icon: WarningIcon,
label: '极高',
dotBg: 'red.800',
description: '重大事件,市场影响深远',
antdColor: '#cf1322',
},
'A': {
level: 'A',
color: 'red.600',
bgColor: 'red.50',
borderColor: 'red.200',
colorScheme: 'red',
badgeBg: '#ea580c', // 圆形徽章背景色 - 橙色
badgeColor: 'white', // 圆形徽章文字颜色 - 白色
icon: WarningTwoIcon,
label: '高',
dotBg: 'red.600',
description: '重要事件,影响较大',
antdColor: '#ff4d4f',
},
'B': {
level: 'B',
color: 'red.500',
bgColor: 'red.50',
borderColor: 'red.100',
colorScheme: 'red',
badgeBg: '#2563eb', // 圆形徽章背景色 - 蓝色
badgeColor: 'white', // 圆形徽章文字颜色 - 白色
icon: InfoIcon,
label: '中',
dotBg: 'red.500',
description: '普通事件,有一定影响',
antdColor: '#ff7875',
},
'C': {
level: 'C',
color: 'red.400',
bgColor: 'red.50',
borderColor: 'red.100',
colorScheme: 'red',
badgeBg: '#6b7280', // 圆形徽章背景色 - 灰色
badgeColor: 'white', // 圆形徽章文字颜色 - 白色
icon: CheckCircleIcon,
label: '低',
dotBg: 'red.400',
description: '参考事件,影响有限',
antdColor: '#ffa39e',
}
};
/**
* 获取重要性等级配置
* @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);
};