fetch(add): 分配记录,批量分配/回收, 单卡列表, 任务列表, 导入ICCID
All checks were successful
构建并部署前端到测试环境 / build-and-deploy (push) Successful in 2m21s

This commit is contained in:
sexygoat
2026-01-24 16:18:30 +08:00
parent c69124a819
commit 0eed8244e5
13 changed files with 2375 additions and 334 deletions

View File

@@ -16,3 +16,6 @@ export * from './commission'
// 通用状态相关
export * from './status'
// IoT卡相关
export * from './iotCard'

View File

@@ -0,0 +1,141 @@
/**
* IoT卡相关常量配置
*/
// IoT卡导入任务状态枚举
export enum IotCardImportTaskStatus {
PENDING = 1, // 待处理
PROCESSING = 2, // 处理中
COMPLETED = 3, // 已完成
FAILED = 4 // 失败
}
// IoT卡导入任务状态选项
export const IOT_CARD_IMPORT_TASK_STATUS_OPTIONS = [
{
label: '待处理',
value: IotCardImportTaskStatus.PENDING,
type: 'info' as const,
color: '#909399'
},
{
label: '处理中',
value: IotCardImportTaskStatus.PROCESSING,
type: 'warning' as const,
color: '#E6A23C'
},
{
label: '已完成',
value: IotCardImportTaskStatus.COMPLETED,
type: 'success' as const,
color: '#67C23A'
},
{
label: '失败',
value: IotCardImportTaskStatus.FAILED,
type: 'danger' as const,
color: '#F56C6C'
}
]
// IoT卡导入任务状态映射
export const IOT_CARD_IMPORT_TASK_STATUS_MAP = IOT_CARD_IMPORT_TASK_STATUS_OPTIONS.reduce(
(map, item) => {
map[item.value] = item
return map
},
{} as Record<
IotCardImportTaskStatus,
{
label: string
value: IotCardImportTaskStatus
type: 'info' | 'warning' | 'success' | 'danger'
color: string
}
>
)
// 获取IoT卡导入任务状态标签
export function getIotCardImportTaskStatusLabel(status: number): string {
return IOT_CARD_IMPORT_TASK_STATUS_MAP[status as IotCardImportTaskStatus]?.label || '未知'
}
// 获取IoT卡导入任务状态类型用于 ElTag
export function getIotCardImportTaskStatusType(status: number) {
return IOT_CARD_IMPORT_TASK_STATUS_MAP[status as IotCardImportTaskStatus]?.type || 'info'
}
// 获取IoT卡导入任务状态颜色
export function getIotCardImportTaskStatusColor(status: number): string {
return IOT_CARD_IMPORT_TASK_STATUS_MAP[status as IotCardImportTaskStatus]?.color || '#909399'
}
// ========== 单卡状态相关 ==========
// 单卡状态枚举
export enum StandaloneCardStatus {
IN_STOCK = 1, // 在库
DISTRIBUTED = 2, // 已分销
ACTIVATED = 3, // 已激活
DEACTIVATED = 4 // 已停用
}
// 单卡状态选项
export const STANDALONE_CARD_STATUS_OPTIONS = [
{
label: '在库',
value: StandaloneCardStatus.IN_STOCK,
type: 'info' as const,
color: '#909399'
},
{
label: '已分销',
value: StandaloneCardStatus.DISTRIBUTED,
type: 'warning' as const,
color: '#E6A23C'
},
{
label: '已激活',
value: StandaloneCardStatus.ACTIVATED,
type: 'success' as const,
color: '#67C23A'
},
{
label: '已停用',
value: StandaloneCardStatus.DEACTIVATED,
type: 'danger' as const,
color: '#F56C6C'
}
]
// 单卡状态映射
export const STANDALONE_CARD_STATUS_MAP = STANDALONE_CARD_STATUS_OPTIONS.reduce(
(map, item) => {
map[item.value] = item
return map
},
{} as Record<
StandaloneCardStatus,
{
label: string
value: StandaloneCardStatus
type: 'info' | 'warning' | 'success' | 'danger'
color: string
}
>
)
// 获取单卡状态标签
export function getStandaloneCardStatusLabel(status: number): string {
return STANDALONE_CARD_STATUS_MAP[status as StandaloneCardStatus]?.label || '未知'
}
// 获取单卡状态类型(用于 ElTag
export function getStandaloneCardStatusType(status: number) {
return STANDALONE_CARD_STATUS_MAP[status as StandaloneCardStatus]?.type || 'info'
}
// 获取单卡状态颜色
export function getStandaloneCardStatusColor(status: number): string {
return STANDALONE_CARD_STATUS_MAP[status as StandaloneCardStatus]?.color || '#909399'
}