import { ConstantListItem } from '@/common/types'; import { AlarmType } from '@/common/types/alarm'; import { APP_TYPE, Category } from '../types'; import { appTypeWithCategories, appTypeToCategory, appTypeToActionType, } from './'; // 预警处理类型状态 export const ALARM_CONFIRM_TYPE: ConstantListItem[] = [ { value: AlarmType.real, label: '真实有效', color: '#E52C3E' }, { value: AlarmType.danger, label: '安全隐患', color: '#E57022' }, { value: AlarmType.testing, label: '测试', color: '#1DCCBB' }, { value: AlarmType.inspect, label: '巡检', color: '#2B6DE5' }, { value: AlarmType.useless, label: '无效', color: '#F2A516' }, ]; export const getAlarmEventListConfig = (appType: APP_TYPE) => { let config: { params: { categories?: Category; actionType?: string; }; appName?: string; } = { params: {} }; // 请求参数 if (appTypeWithCategories.includes(appType)) { // 使用 categories 参数 config.params = { categories: appTypeToCategory?.[appType], }; } else { // 使用 actionType 参数 config.params = { actionType: appTypeToActionType?.[appType], }; } return config; };