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

@@ -227,3 +227,225 @@ export interface CardOrder {
createTime: string
payTime?: string
}
// ========== ICCID批量导入相关 ==========
// ICCID导入任务状态枚举
export enum IotCardImportTaskStatus {
PENDING = 1, // 待处理
PROCESSING = 2, // 处理中
COMPLETED = 3, // 已完成
FAILED = 4 // 失败
}
// ICCID导入请求参数
export interface ImportIotCardParams {
carrier_id: number // 运营商ID
batch_no?: string // 批次号
file: File // 文件
}
// ICCID导入响应
export interface ImportIotCardResponse {
message: string
task_id: number
task_no: string
}
// 导入任务记录
export interface IotCardImportTask {
id: number // 任务ID
task_no: string // 任务编号
batch_no: string // 批次号
carrier_id: number // 运营商ID
carrier_name: string // 运营商名称
file_name: string // 文件名
status: IotCardImportTaskStatus // 任务状态
status_text: string // 任务状态文本
total_count: number // 总数
success_count: number // 成功数
fail_count: number // 失败数
skip_count: number // 跳过数
error_message: string // 错误信息
created_at: string // 创建时间
started_at: string | null // 开始处理时间
completed_at: string | null // 完成时间
}
// 导入任务查询参数
export interface IotCardImportTaskQueryParams extends PaginationParams {
status?: IotCardImportTaskStatus // 任务状态
carrier_id?: number // 运营商ID
batch_no?: string // 批次号(模糊查询)
start_time?: string // 创建时间起始
end_time?: string // 创建时间结束
}
// 导入结果详细项
export interface ImportResultItem {
line: number // 行号
iccid: string // ICCID
reason: string // 原因
}
// 导入任务详情
export interface IotCardImportTaskDetail extends IotCardImportTask {
failed_items: ImportResultItem[] | null // 失败记录详情
skipped_items: ImportResultItem[] | null // 跳过记录详情
}
// ========== 单卡列表(未绑定设备)相关 ==========
// 单卡状态枚举
export enum StandaloneCardStatus {
IN_STOCK = 1, // 在库
DISTRIBUTED = 2, // 已分销
ACTIVATED = 3, // 已激活
DEACTIVATED = 4 // 已停用
}
// 单卡查询参数
export interface StandaloneCardQueryParams extends PaginationParams {
status?: StandaloneCardStatus // 状态
carrier_id?: number // 运营商ID
shop_id?: number // 分销商ID
iccid?: string // ICCID(模糊查询)
msisdn?: string // 卡接入号(模糊查询)
batch_no?: string // 批次号
package_id?: number // 套餐ID
is_distributed?: boolean // 是否已分销
is_replaced?: boolean // 是否有换卡记录
iccid_start?: string // ICCID起始号
iccid_end?: string // ICCID结束号
}
// 单卡信息
export interface StandaloneIotCard {
id: number // 卡ID
iccid: string // ICCID
imsi: string // IMSI
msisdn: string // 卡接入号
carrier_id: number // 运营商ID
carrier_name: string // 运营商名称
card_type: string // 卡类型
card_category: string // 卡业务类型 (normal:普通卡, industry:行业卡)
status: StandaloneCardStatus // 状态
activation_status: number // 激活状态 (0:未激活, 1:已激活)
network_status: number // 网络状态 (0:停机, 1:开机)
real_name_status: number // 实名状态 (0:未实名, 1:已实名)
batch_no: string // 批次号
supplier: string // 供应商
shop_id: number | null // 店铺ID
shop_name: string // 店铺名称
cost_price: number // 成本价(分)
distribute_price: number // 分销价(分)
data_usage_mb: number // 累计流量使用(MB)
activated_at: string | null // 激活时间
created_at: string // 创建时间
updated_at: string // 更新时间
}
// ========== 单卡批量分配和回收相关 ==========
// 选卡方式枚举
export enum CardSelectionType {
LIST = 'list', // ICCID列表
RANGE = 'range', // 号段范围
FILTER = 'filter' // 筛选条件
}
// 批量分配单卡请求参数
export interface AllocateStandaloneCardsRequest {
selection_type: CardSelectionType // 选卡方式
to_shop_id: number // 目标店铺ID
iccids?: string[] // ICCID列表selection_type=list时必填
iccid_start?: string // 起始ICCIDselection_type=range时必填
iccid_end?: string // 结束ICCIDselection_type=range时必填
carrier_id?: number // 运营商IDselection_type=filter时可选
status?: StandaloneCardStatus // 卡状态selection_type=filter时可选
batch_no?: string // 批次号selection_type=filter时可选
remark?: string // 备注
}
// 批量回收单卡请求参数
export interface RecallStandaloneCardsRequest {
selection_type: CardSelectionType // 选卡方式
from_shop_id: number // 来源店铺ID被回收方
iccids?: string[] // ICCID列表selection_type=list时必填
iccid_start?: string // 起始ICCIDselection_type=range时必填
iccid_end?: string // 结束ICCIDselection_type=range时必填
carrier_id?: number // 运营商IDselection_type=filter时可选
batch_no?: string // 批次号selection_type=filter时可选
remark?: string // 备注
}
// 分配失败项
export interface AllocationFailedItem {
iccid: string // ICCID
reason: string // 失败原因
}
// 批量分配/回收响应
export interface AllocateStandaloneCardsResponse {
allocation_no: string // 分配/回收单号
total_count: number // 待分配/回收总数
success_count: number // 成功数
fail_count: number // 失败数
failed_items: AllocationFailedItem[] | null // 失败项列表
}
// ========== 资产分配记录相关 ==========
// 分配类型枚举
export enum AllocationTypeEnum {
ALLOCATE = 'allocate', // 分配
RECALL = 'recall' // 回收
}
// 资产类型枚举
export enum AssetTypeEnum {
IOT_CARD = 'iot_card', // 物联网卡
DEVICE = 'device' // 设备
}
// 资产分配记录查询参数
export interface AssetAllocationRecordQueryParams extends PaginationParams {
allocation_type?: AllocationTypeEnum // 分配类型
asset_type?: AssetTypeEnum // 资产类型
asset_identifier?: string // 资产标识符ICCID或设备号
allocation_no?: string // 分配单号
from_shop_id?: number // 来源店铺ID
to_shop_id?: number // 目标店铺ID
operator_id?: number // 操作人ID
created_at_start?: string // 创建时间起始
created_at_end?: string // 创建时间结束
}
// 资产分配记录
export interface AssetAllocationRecord {
id: number // 记录ID
allocation_no: string // 分配单号
allocation_type: AllocationTypeEnum // 分配类型
allocation_name: string // 分配类型名称
asset_type: AssetTypeEnum // 资产类型
asset_type_name: string // 资产类型名称
asset_id: number // 资产ID
asset_identifier: string // 资产标识符ICCID或设备号
from_owner_id: number | null // 来源所有者ID
from_owner_name: string // 来源所有者名称
from_owner_type: string // 来源所有者类型
to_owner_id: number // 目标所有者ID
to_owner_name: string // 目标所有者名称
to_owner_type: string // 目标所有者类型
operator_id: number // 操作人ID
operator_name: string // 操作人名称
related_card_count: number // 关联卡数量
related_device_id: number | null // 关联设备ID
remark: string // 备注
created_at: string // 创建时间
}
// 资产分配记录详情
export interface AssetAllocationRecordDetail extends AssetAllocationRecord {
related_card_ids: number[] // 关联卡ID列表
}