This commit is contained in:
99
src/types/api/authorization.ts
Normal file
99
src/types/api/authorization.ts
Normal file
@@ -0,0 +1,99 @@
|
||||
/**
|
||||
* 授权记录相关类型定义
|
||||
*/
|
||||
|
||||
/**
|
||||
* 授权人类型
|
||||
*/
|
||||
export enum AuthorizerType {
|
||||
PLATFORM = 2, // 平台
|
||||
AGENT = 3 // 代理
|
||||
}
|
||||
|
||||
/**
|
||||
* 授权状态
|
||||
*/
|
||||
export enum AuthorizationStatus {
|
||||
REVOKED = 0, // 已回收
|
||||
ACTIVE = 1 // 有效
|
||||
}
|
||||
|
||||
/**
|
||||
* 授权记录项
|
||||
*/
|
||||
export interface AuthorizationItem {
|
||||
/** 授权记录ID */
|
||||
id: number
|
||||
/** 卡ID */
|
||||
card_id: number
|
||||
/** ICCID */
|
||||
iccid: string
|
||||
/** 手机号 */
|
||||
msisdn: string
|
||||
/** 企业ID */
|
||||
enterprise_id: number
|
||||
/** 企业名称 */
|
||||
enterprise_name: string
|
||||
/** 授权人ID */
|
||||
authorized_by: number
|
||||
/** 授权人名称 */
|
||||
authorizer_name: string
|
||||
/** 授权人类型:2=平台,3=代理 */
|
||||
authorizer_type: AuthorizerType
|
||||
/** 授权时间 */
|
||||
authorized_at: string
|
||||
/** 回收人ID */
|
||||
revoked_by?: number | null
|
||||
/** 回收人名称 */
|
||||
revoker_name?: string
|
||||
/** 回收时间 */
|
||||
revoked_at?: string | null
|
||||
/** 状态:1=有效,0=已回收 */
|
||||
status: AuthorizationStatus
|
||||
/** 备注 */
|
||||
remark?: string
|
||||
}
|
||||
|
||||
/**
|
||||
* 授权记录列表查询参数
|
||||
*/
|
||||
export interface AuthorizationListParams {
|
||||
/** 页码 */
|
||||
page?: number
|
||||
/** 每页数量 */
|
||||
page_size?: number
|
||||
/** 按企业ID筛选 */
|
||||
enterprise_id?: number
|
||||
/** 按ICCID模糊查询 */
|
||||
iccid?: string
|
||||
/** 授权人类型:2=平台,3=代理 */
|
||||
authorizer_type?: AuthorizerType
|
||||
/** 状态:0=已回收,1=有效 */
|
||||
status?: AuthorizationStatus
|
||||
/** 授权时间起(格式:2006-01-02) */
|
||||
start_time?: string
|
||||
/** 授权时间止(格式:2006-01-02) */
|
||||
end_time?: string
|
||||
}
|
||||
|
||||
/**
|
||||
* 授权记录列表响应
|
||||
*/
|
||||
export interface AuthorizationListResponse {
|
||||
/** 授权记录列表 */
|
||||
items: AuthorizationItem[]
|
||||
/** 当前页码 */
|
||||
page: number
|
||||
/** 每页数量 */
|
||||
size: number
|
||||
/** 总记录数 */
|
||||
total: number
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改授权备注请求
|
||||
*/
|
||||
export interface UpdateAuthorizationRemarkRequest {
|
||||
/** 备注(最多500字) */
|
||||
remark: string
|
||||
}
|
||||
@@ -1,143 +1,204 @@
|
||||
/**
|
||||
* 设备相关类型定义
|
||||
* 设备管理相关类型定义
|
||||
*/
|
||||
|
||||
import { PaginationParams, ImportTask } from './common'
|
||||
import { PaginationParams } from './common'
|
||||
|
||||
// 设备状态
|
||||
// ========== 设备状态枚举 ==========
|
||||
|
||||
// 设备状态枚举
|
||||
export enum DeviceStatus {
|
||||
ONLINE = 'online', // 在线
|
||||
OFFLINE = 'offline', // 离线
|
||||
FAULT = 'fault', // 故障
|
||||
MAINTENANCE = 'maintenance' // 维护中
|
||||
IN_STOCK = 1, // 在库
|
||||
DISTRIBUTED = 2, // 已分销
|
||||
ACTIVATED = 3, // 已激活
|
||||
DEACTIVATED = 4 // 已停用
|
||||
}
|
||||
|
||||
// 设备操作类型
|
||||
export enum DeviceOperationType {
|
||||
RESTART = 'restart', // 重启
|
||||
RESET = 'reset', // 重置
|
||||
UPGRADE = 'upgrade', // 升级
|
||||
CONFIG = 'config', // 配置
|
||||
BIND_CARD = 'bindCard', // 绑定网卡
|
||||
UNBIND_CARD = 'unbindCard' // 解绑网卡
|
||||
}
|
||||
// ========== 设备基础类型 ==========
|
||||
|
||||
// 设备实体
|
||||
// 设备信息
|
||||
export interface Device {
|
||||
id: string | number
|
||||
deviceCode: string // 设备编码
|
||||
deviceName?: string // 设备名称
|
||||
deviceType?: string // 设备类型
|
||||
model?: string // 设备型号
|
||||
manufacturer?: string // 制造商
|
||||
// 网卡信息
|
||||
currentIccid?: string // 当前绑定的ICCID
|
||||
currentOperator?: string // 当前运营商
|
||||
currentImei?: string // IMEI
|
||||
// 卡槽信息(双卡设备)
|
||||
card1Iccid?: string
|
||||
card1Operator?: string
|
||||
card2Iccid?: string
|
||||
card2Operator?: string
|
||||
// 状态信息
|
||||
status: DeviceStatus
|
||||
onlineStatus: boolean // 在线状态
|
||||
lastOnlineTime?: string // 最后在线时间
|
||||
// 所属信息
|
||||
agentId?: string | number
|
||||
agentName?: string
|
||||
// 位置信息
|
||||
location?: string
|
||||
latitude?: number
|
||||
longitude?: number
|
||||
// 其他信息
|
||||
firmwareVersion?: string // 固件版本
|
||||
hardwareVersion?: string // 硬件版本
|
||||
activateTime?: string // 激活时间
|
||||
createTime: string
|
||||
updateTime?: string
|
||||
id: number // 设备ID
|
||||
device_no: string // 设备号
|
||||
device_name: string // 设备名称
|
||||
device_model: string // 设备型号
|
||||
device_type: string // 设备类型
|
||||
manufacturer: string // 制造商
|
||||
max_sim_slots: number // 最大插槽数
|
||||
bound_card_count: number // 已绑定卡数量
|
||||
status: DeviceStatus // 状态 (1:在库, 2:已分销, 3:已激活, 4:已停用)
|
||||
status_name: string // 状态名称
|
||||
shop_id: number | null // 店铺ID
|
||||
shop_name: string // 店铺名称
|
||||
batch_no: string // 批次号
|
||||
activated_at: string | null // 激活时间
|
||||
created_at: string // 创建时间
|
||||
updated_at: string // 更新时间
|
||||
}
|
||||
|
||||
// 设备查询参数
|
||||
export interface DeviceQueryParams extends PaginationParams {
|
||||
keyword?: string // 设备编码/名称/ICCID
|
||||
deviceType?: string
|
||||
status?: DeviceStatus
|
||||
onlineStatus?: boolean
|
||||
agentId?: string | number
|
||||
hasCard?: boolean // 是否绑定网卡
|
||||
operator?: string
|
||||
device_no?: string // 设备号(模糊查询)
|
||||
device_name?: string // 设备名称(模糊查询)
|
||||
status?: DeviceStatus // 状态
|
||||
shop_id?: number | null // 店铺ID (NULL表示平台库存)
|
||||
batch_no?: string // 批次号
|
||||
device_type?: string // 设备类型
|
||||
manufacturer?: string // 制造商(模糊查询)
|
||||
created_at_start?: string // 创建时间起始
|
||||
created_at_end?: string // 创建时间结束
|
||||
}
|
||||
|
||||
// 设备操作参数
|
||||
export interface DeviceOperationParams {
|
||||
deviceId: string | number
|
||||
operation: DeviceOperationType
|
||||
iccid?: string // 绑定/解绑网卡时需要
|
||||
config?: Record<string, any> // 配置参数
|
||||
remark?: string
|
||||
// 设备列表响应
|
||||
export interface DeviceListResponse {
|
||||
list: Device[] | null // 设备列表
|
||||
page: number // 当前页码
|
||||
page_size: number // 每页数量
|
||||
total: number // 总数
|
||||
total_pages: number // 总页数
|
||||
}
|
||||
|
||||
// 设备卡信息
|
||||
export interface DeviceCardInfo {
|
||||
deviceId: string | number
|
||||
deviceCode: string
|
||||
// 主卡信息
|
||||
mainCard?: {
|
||||
iccid: string
|
||||
operator: string
|
||||
imei?: string
|
||||
status: string
|
||||
signal?: number // 信号强度
|
||||
flow?: {
|
||||
total: number
|
||||
used: number
|
||||
remain: number
|
||||
}
|
||||
}
|
||||
// 副卡信息(双卡设备)
|
||||
viceCard?: {
|
||||
iccid: string
|
||||
operator: string
|
||||
imei?: string
|
||||
status: string
|
||||
signal?: number
|
||||
flow?: {
|
||||
total: number
|
||||
used: number
|
||||
remain: number
|
||||
}
|
||||
}
|
||||
// ========== 设备卡绑定相关 ==========
|
||||
|
||||
// 设备卡绑定信息
|
||||
export interface DeviceCardBinding {
|
||||
id: number // 绑定记录ID
|
||||
iot_card_id: number // IoT卡ID
|
||||
iccid: string // ICCID
|
||||
msisdn: string // 接入号
|
||||
carrier_name: string // 运营商名称
|
||||
slot_position: number // 插槽位置 (1-4)
|
||||
status: number // 卡状态 (1:在库, 2:已分销, 3:已激活, 4:已停用)
|
||||
bind_time: string | null // 绑定时间
|
||||
}
|
||||
|
||||
// 修改设备卡信息参数
|
||||
export interface UpdateDeviceCardParams {
|
||||
deviceId: string | number
|
||||
mainCardIccid?: string
|
||||
viceCardIccid?: string
|
||||
// 设备绑定的卡列表响应
|
||||
export interface DeviceCardsResponse {
|
||||
bindings: DeviceCardBinding[] | null // 绑定列表
|
||||
}
|
||||
|
||||
// 设备批量分配参数
|
||||
export interface DeviceBatchAssignParams {
|
||||
deviceIds: (string | number)[]
|
||||
targetAgentId: string | number
|
||||
includeCards: boolean // 是否连同网卡一起分配
|
||||
// 绑定卡到设备请求参数
|
||||
export interface BindCardToDeviceRequest {
|
||||
iot_card_id: number // IoT卡ID
|
||||
slot_position: number // 插槽位置 (1-4)
|
||||
}
|
||||
|
||||
// 设备导入任务
|
||||
export interface DeviceImportTask extends ImportTask {
|
||||
agentId?: string | number
|
||||
agentName?: string
|
||||
operatorName?: string
|
||||
// 绑定卡到设备响应
|
||||
export interface BindCardToDeviceResponse {
|
||||
binding_id: number // 绑定记录ID
|
||||
message: string // 提示信息
|
||||
}
|
||||
|
||||
// 设备导入数据项
|
||||
export interface DeviceImportItem {
|
||||
deviceCode: string
|
||||
deviceName?: string
|
||||
deviceType?: string
|
||||
iccid?: string // 绑定的ICCID
|
||||
card1Iccid?: string
|
||||
card2Iccid?: string
|
||||
location?: string
|
||||
// 解绑设备上的卡响应
|
||||
export interface UnbindCardFromDeviceResponse {
|
||||
message: string // 提示信息
|
||||
}
|
||||
|
||||
// ========== 批量分配和回收相关 ==========
|
||||
|
||||
// 批量分配设备请求参数
|
||||
export interface AllocateDevicesRequest {
|
||||
device_ids: number[] // 设备ID列表
|
||||
target_shop_id: number // 目标店铺ID
|
||||
remark?: string // 备注
|
||||
}
|
||||
|
||||
// 分配失败项
|
||||
export interface AllocationDeviceFailedItem {
|
||||
device_id: number // 设备ID
|
||||
device_no: string // 设备号
|
||||
reason: string // 失败原因
|
||||
}
|
||||
|
||||
// 批量分配设备响应
|
||||
export interface AllocateDevicesResponse {
|
||||
success_count: number // 成功数量
|
||||
fail_count: number // 失败数量
|
||||
failed_items: AllocationDeviceFailedItem[] | null // 失败详情列表
|
||||
}
|
||||
|
||||
// 批量回收设备请求参数
|
||||
export interface RecallDevicesRequest {
|
||||
device_ids: number[] // 设备ID列表
|
||||
remark?: string // 备注
|
||||
}
|
||||
|
||||
// 批量回收设备响应
|
||||
export interface RecallDevicesResponse {
|
||||
success_count: number // 成功数量
|
||||
fail_count: number // 失败数量
|
||||
failed_items: AllocationDeviceFailedItem[] | null // 失败详情列表
|
||||
}
|
||||
|
||||
// ========== 设备导入相关 ==========
|
||||
|
||||
// 批量导入设备请求参数
|
||||
export interface ImportDeviceRequest {
|
||||
file_key: string // 对象存储文件路径(通过 /storage/upload-url 获取)
|
||||
batch_no?: string // 批次号
|
||||
}
|
||||
|
||||
// 批量导入设备响应
|
||||
export interface ImportDeviceResponse {
|
||||
message: string // 提示信息
|
||||
task_id: number // 导入任务ID
|
||||
task_no: string // 任务编号
|
||||
}
|
||||
|
||||
// ========== 导入任务相关 ==========
|
||||
|
||||
// 导入任务状态枚举
|
||||
export enum DeviceImportTaskStatus {
|
||||
PENDING = 1, // 待处理
|
||||
PROCESSING = 2, // 处理中
|
||||
COMPLETED = 3, // 已完成
|
||||
FAILED = 4 // 失败
|
||||
}
|
||||
|
||||
// 导入任务查询参数
|
||||
export interface DeviceImportTaskQueryParams extends PaginationParams {
|
||||
status?: DeviceImportTaskStatus // 任务状态
|
||||
batch_no?: string // 批次号(模糊查询)
|
||||
start_time?: string // 创建时间起始
|
||||
end_time?: string // 创建时间结束
|
||||
}
|
||||
|
||||
// 导入任务信息
|
||||
export interface DeviceImportTask {
|
||||
id: number // 任务ID
|
||||
task_no: string // 任务编号
|
||||
batch_no: string // 批次号
|
||||
file_name: string // 文件名
|
||||
status: DeviceImportTaskStatus // 任务状态
|
||||
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 DeviceImportTaskListResponse {
|
||||
list: DeviceImportTask[] | null // 任务列表
|
||||
page: number // 当前页码
|
||||
page_size: number // 每页数量
|
||||
total: number // 总数
|
||||
total_pages: number // 总页数
|
||||
}
|
||||
|
||||
// 导入结果详细项
|
||||
export interface DeviceImportResultItem {
|
||||
line: number // 行号
|
||||
device_no: string // 设备号
|
||||
reason: string // 原因
|
||||
}
|
||||
|
||||
// 导入任务详情
|
||||
export interface DeviceImportTaskDetail extends DeviceImportTask {
|
||||
failed_items: DeviceImportResultItem[] | null // 失败记录详情
|
||||
skipped_items: DeviceImportResultItem[] | null // 跳过记录详情
|
||||
}
|
||||
|
||||
231
src/types/api/enterpriseCard.ts
Normal file
231
src/types/api/enterpriseCard.ts
Normal file
@@ -0,0 +1,231 @@
|
||||
/**
|
||||
* 企业卡授权相关类型定义
|
||||
*/
|
||||
|
||||
/**
|
||||
* 失败项
|
||||
*/
|
||||
export interface FailedItem {
|
||||
/** ICCID */
|
||||
iccid: string
|
||||
/** 失败原因 */
|
||||
reason: string
|
||||
}
|
||||
|
||||
/**
|
||||
* 分配的设备
|
||||
*/
|
||||
export interface AllocatedDevice {
|
||||
/** 设备ID */
|
||||
device_id: number
|
||||
/** 设备号 */
|
||||
device_no: string
|
||||
/** 卡数量 */
|
||||
card_count: number
|
||||
/** 卡ICCID列表 */
|
||||
iccids: string[]
|
||||
}
|
||||
|
||||
/**
|
||||
* 授权卡给企业请求
|
||||
*/
|
||||
export interface AllocateCardsRequest {
|
||||
/** 需要授权的 ICCID 列表 */
|
||||
iccids: string[]
|
||||
/** 确认整体授权设备下所有卡 */
|
||||
confirm_device_bundles?: boolean
|
||||
}
|
||||
|
||||
/**
|
||||
* 授权卡给企业响应
|
||||
*/
|
||||
export interface AllocateCardsResponse {
|
||||
/** 成功数量 */
|
||||
success_count: number
|
||||
/** 失败数量 */
|
||||
fail_count: number
|
||||
/** 失败详情 */
|
||||
failed_items: FailedItem[] | null
|
||||
/** 连带授权的设备列表 */
|
||||
allocated_devices: AllocatedDevice[] | null
|
||||
}
|
||||
|
||||
/**
|
||||
* 卡授权预检请求
|
||||
*/
|
||||
export interface AllocateCardsPreviewRequest {
|
||||
/** 需要授权的 ICCID 列表(最多1000个) */
|
||||
iccids: string[]
|
||||
}
|
||||
|
||||
/**
|
||||
* 独立卡信息
|
||||
*/
|
||||
export interface StandaloneCard {
|
||||
/** 卡ID */
|
||||
iot_card_id: number
|
||||
/** ICCID */
|
||||
iccid: string
|
||||
/** 手机号 */
|
||||
msisdn: string
|
||||
/** 运营商ID */
|
||||
carrier_id: number
|
||||
/** 状态名称 */
|
||||
status_name: string
|
||||
}
|
||||
|
||||
/**
|
||||
* 设备捆绑卡
|
||||
*/
|
||||
export interface DeviceBundleCard {
|
||||
/** 卡ID */
|
||||
iot_card_id: number
|
||||
/** ICCID */
|
||||
iccid: string
|
||||
/** 手机号 */
|
||||
msisdn: string
|
||||
}
|
||||
|
||||
/**
|
||||
* 设备包
|
||||
*/
|
||||
export interface DeviceBundle {
|
||||
/** 设备ID */
|
||||
device_id: number
|
||||
/** 设备号 */
|
||||
device_no: string
|
||||
/** 触发卡(用户选择的卡) */
|
||||
trigger_card: DeviceBundleCard
|
||||
/** 连带卡(同设备的其他卡) */
|
||||
bundle_cards: DeviceBundleCard[]
|
||||
}
|
||||
|
||||
/**
|
||||
* 授权预检汇总
|
||||
*/
|
||||
export interface AllocatePreviewSummary {
|
||||
/** 总卡数量 */
|
||||
total_card_count: number
|
||||
/** 独立卡数量 */
|
||||
standalone_card_count: number
|
||||
/** 设备数量 */
|
||||
device_count: number
|
||||
/** 设备卡数量 */
|
||||
device_card_count: number
|
||||
/** 失败数量 */
|
||||
failed_count: number
|
||||
}
|
||||
|
||||
/**
|
||||
* 卡授权预检响应
|
||||
*/
|
||||
export interface AllocateCardsPreviewResponse {
|
||||
/** 汇总信息 */
|
||||
summary: AllocatePreviewSummary
|
||||
/** 可直接授权的卡(未绑定设备) */
|
||||
standalone_cards: StandaloneCard[] | null
|
||||
/** 需要整体授权的设备包 */
|
||||
device_bundles: DeviceBundle[] | null
|
||||
/** 失败的卡 */
|
||||
failed_items: FailedItem[] | null
|
||||
}
|
||||
|
||||
/**
|
||||
* 企业卡项
|
||||
*/
|
||||
export interface EnterpriseCardItem {
|
||||
/** 卡ID */
|
||||
id: number
|
||||
/** ICCID */
|
||||
iccid: string
|
||||
/** 手机号 */
|
||||
msisdn: string
|
||||
/** 运营商ID */
|
||||
carrier_id: number
|
||||
/** 运营商名称 */
|
||||
carrier_name: string
|
||||
/** 状态 */
|
||||
status: number
|
||||
/** 状态名称 */
|
||||
status_name: string
|
||||
/** 网络状态 */
|
||||
network_status: number
|
||||
/** 网络状态名称 */
|
||||
network_status_name: string
|
||||
/** 套餐ID */
|
||||
package_id?: number | null
|
||||
/** 套餐名称 */
|
||||
package_name?: string
|
||||
/** 设备ID */
|
||||
device_id?: number | null
|
||||
/** 设备号 */
|
||||
device_no?: string
|
||||
}
|
||||
|
||||
/**
|
||||
* 企业卡列表查询参数
|
||||
*/
|
||||
export interface EnterpriseCardListParams {
|
||||
/** 页码 */
|
||||
page?: number
|
||||
/** 每页数量 */
|
||||
page_size?: number
|
||||
/** 卡状态 */
|
||||
status?: number
|
||||
/** 运营商ID */
|
||||
carrier_id?: number
|
||||
/** ICCID(模糊查询) */
|
||||
iccid?: string
|
||||
/** 设备号(模糊查询) */
|
||||
device_no?: string
|
||||
}
|
||||
|
||||
/**
|
||||
* 企业卡列表响应
|
||||
*/
|
||||
export interface EnterpriseCardPageResult {
|
||||
/** 卡列表 */
|
||||
items: EnterpriseCardItem[]
|
||||
/** 当前页码 */
|
||||
page: number
|
||||
/** 每页数量 */
|
||||
size: number
|
||||
/** 总记录数 */
|
||||
total: number
|
||||
}
|
||||
|
||||
/**
|
||||
* 回收的设备
|
||||
*/
|
||||
export interface RecalledDevice {
|
||||
/** 设备ID */
|
||||
device_id: number
|
||||
/** 设备号 */
|
||||
device_no: string
|
||||
/** 卡数量 */
|
||||
card_count: number
|
||||
/** 卡ICCID列表 */
|
||||
iccids: string[]
|
||||
}
|
||||
|
||||
/**
|
||||
* 回收卡授权请求
|
||||
*/
|
||||
export interface RecallCardsRequest {
|
||||
/** 需要回收授权的 ICCID 列表 */
|
||||
iccids: string[]
|
||||
}
|
||||
|
||||
/**
|
||||
* 回收卡授权响应
|
||||
*/
|
||||
export interface RecallCardsResponse {
|
||||
/** 成功数量 */
|
||||
success_count: number
|
||||
/** 失败数量 */
|
||||
fail_count: number
|
||||
/** 失败详情 */
|
||||
failed_items: FailedItem[] | null
|
||||
/** 连带回收的设备列表 */
|
||||
recalled_devices: RecalledDevice[] | null
|
||||
}
|
||||
@@ -46,3 +46,9 @@ export * from './customerAccount'
|
||||
|
||||
// 设置相关
|
||||
export * from './setting'
|
||||
|
||||
// 授权记录相关
|
||||
export * from './authorization'
|
||||
|
||||
// 企业卡授权相关
|
||||
export * from './enterpriseCard'
|
||||
|
||||
Reference in New Issue
Block a user