fetch(add): 运营商管理
All checks were successful
构建并部署前端到测试环境 / build-and-deploy (push) Successful in 2m23s
All checks were successful
构建并部署前端到测试环境 / build-and-deploy (push) Successful in 2m23s
This commit is contained in:
32
src/config/constants/carrierTypes.ts
Normal file
32
src/config/constants/carrierTypes.ts
Normal file
@@ -0,0 +1,32 @@
|
||||
/**
|
||||
* 运营商类型配置
|
||||
*/
|
||||
|
||||
import { CarrierType } from '@/types/api'
|
||||
|
||||
// 运营商类型选项
|
||||
export const CARRIER_TYPE_OPTIONS = [
|
||||
{ label: '中国移动', value: CarrierType.CMCC, color: '#4CAF50' },
|
||||
{ label: '中国联通', value: CarrierType.CUCC, color: '#2196F3' },
|
||||
{ label: '中国电信', value: CarrierType.CTCC, color: '#FF9800' },
|
||||
{ label: '中国广电', value: CarrierType.CBN, color: '#9C27B0' }
|
||||
]
|
||||
|
||||
// 运营商类型映射
|
||||
export const CARRIER_TYPE_MAP = CARRIER_TYPE_OPTIONS.reduce(
|
||||
(map, item) => {
|
||||
map[item.value] = item
|
||||
return map
|
||||
},
|
||||
{} as Record<CarrierType, { label: string; value: CarrierType; color: string }>
|
||||
)
|
||||
|
||||
// 获取运营商类型标签
|
||||
export function getCarrierTypeLabel(type: CarrierType): string {
|
||||
return CARRIER_TYPE_MAP[type]?.label || type
|
||||
}
|
||||
|
||||
// 获取运营商类型颜色
|
||||
export function getCarrierTypeColor(type: CarrierType): string {
|
||||
return CARRIER_TYPE_MAP[type]?.color || '#666'
|
||||
}
|
||||
@@ -19,3 +19,6 @@ export * from './status'
|
||||
|
||||
// IoT卡相关
|
||||
export * from './iotCard'
|
||||
|
||||
// 运营商类型相关
|
||||
export * from './carrierTypes'
|
||||
|
||||
Reference in New Issue
Block a user