feat: 新增全部已使用流量和全部总流量字段
All checks were successful
构建并部署前端到测试环境 / build-and-deploy (push) Successful in 2m30s
All checks were successful
构建并部署前端到测试环境 / build-and-deploy (push) Successful in 2m30s
This commit is contained in:
@@ -11,6 +11,7 @@ import {
|
||||
} from '@/utils/business/apiRateLimit'
|
||||
import type {
|
||||
BaseResponse,
|
||||
AssetResolveParams,
|
||||
AssetResolveResponse,
|
||||
AssetRealtimeStatusResponse,
|
||||
AssetRefreshResponse,
|
||||
@@ -49,9 +50,13 @@ export class AssetService extends BaseService {
|
||||
* 支持虚拟号、ICCID、IMEI、SN、MSISDN
|
||||
* GET /api/admin/assets/resolve/:identifier
|
||||
* @param identifier 资产标识符(虚拟号、ICCID、IMEI、SN、MSISDN)
|
||||
* @param params 查询参数
|
||||
*/
|
||||
static resolveAsset(identifier: string): Promise<BaseResponse<AssetResolveResponse>> {
|
||||
return this.getOne<AssetResolveResponse>(`/api/admin/assets/resolve/${identifier}`)
|
||||
static resolveAsset(
|
||||
identifier: string,
|
||||
params?: AssetResolveParams
|
||||
): Promise<BaseResponse<AssetResolveResponse>> {
|
||||
return this.getOne<AssetResolveResponse>(`/api/admin/assets/resolve/${identifier}`, params)
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -42,6 +42,10 @@ export type UsageType = 'single_card' | 'device'
|
||||
|
||||
// ========== 资产详情响应 ==========
|
||||
|
||||
export interface AssetResolveParams {
|
||||
include_usage_summary?: boolean // 是否返回当前世代流量汇总字段
|
||||
}
|
||||
|
||||
/**
|
||||
* 资产解析/详情响应
|
||||
* 对应接口:GET /api/admin/assets/resolve/:identifier
|
||||
@@ -67,6 +71,8 @@ export interface AssetResolveResponse {
|
||||
real_used_mb: number // 真流量已用
|
||||
virtual_total_mb: number // 业务停机阈值(展示用)
|
||||
virtual_used_mb: number // 展示已用量
|
||||
total_virtual_used_mb?: number | null // 所有套餐已用量(MB),未请求时为 null
|
||||
total_virtual_remaining_mb?: number | null // 所有套餐剩余量(MB),未请求时为 null
|
||||
reduction_pct: number // 展示增幅比例(小数,如 0.428571)
|
||||
device_protect_status?: DeviceProtectStatus // 保护期状态:none / stop / start(仅 device)
|
||||
activated_at: string // 激活时间
|
||||
|
||||
@@ -82,6 +82,12 @@
|
||||
<ElDescriptionsItem label="运营商状态" :span="1">
|
||||
<span class="gateway-extend-text">{{ cardInfo?.gateway_extend || '-' }}</span>
|
||||
</ElDescriptionsItem>
|
||||
<ElDescriptionsItem label="所有套餐已用量">
|
||||
{{ formatUsageSummaryMb(cardInfo?.total_virtual_used_mb) }}
|
||||
</ElDescriptionsItem>
|
||||
<ElDescriptionsItem label="所有套餐剩余量">
|
||||
{{ formatUsageSummaryMb(cardInfo?.total_virtual_remaining_mb) }}
|
||||
</ElDescriptionsItem>
|
||||
|
||||
<template v-if="cardInfo?.bound_device_id">
|
||||
<ElDescriptionsItem label="绑定设备号">
|
||||
@@ -163,6 +169,12 @@
|
||||
formatDateTime(deviceRealtime?.last_sync_time) || '-'
|
||||
}}</ElDescriptionsItem>
|
||||
<ElDescriptionsItem label="SN">{{ cardInfo?.sn || '-' }}</ElDescriptionsItem>
|
||||
<ElDescriptionsItem label="所有套餐已用量">
|
||||
{{ formatUsageSummaryMb(cardInfo?.total_virtual_used_mb) }}
|
||||
</ElDescriptionsItem>
|
||||
<ElDescriptionsItem label="所有套餐剩余量">
|
||||
{{ formatUsageSummaryMb(cardInfo?.total_virtual_remaining_mb) }}
|
||||
</ElDescriptionsItem>
|
||||
</template>
|
||||
</ElDescriptions>
|
||||
|
||||
@@ -532,6 +544,8 @@
|
||||
supplier?: string
|
||||
gateway_card_imei?: string
|
||||
gateway_extend?: string
|
||||
total_virtual_used_mb?: number | null
|
||||
total_virtual_remaining_mb?: number | null
|
||||
last_sync_time?: string | null
|
||||
last_data_check_at?: string | null
|
||||
last_real_name_check_at?: string | null
|
||||
@@ -710,6 +724,11 @@
|
||||
props.cardInfo?.last_card_status_check_at !== undefined
|
||||
)
|
||||
|
||||
const formatUsageSummaryMb = (value?: number | null) => {
|
||||
if (value === undefined || value === null) return '-'
|
||||
return formatDataSize(value)
|
||||
}
|
||||
|
||||
// 处理轮询开关变化
|
||||
const handlePollingChange = (value: string | number | boolean) => {
|
||||
emit('update:pollingEnabled', Boolean(value))
|
||||
|
||||
@@ -92,7 +92,7 @@ export function useAssetInfo() {
|
||||
const fetchAssetDetail = async (identifier: string) => {
|
||||
try {
|
||||
loading.value = true
|
||||
const response = await AssetService.resolveAsset(identifier)
|
||||
const response = await AssetService.resolveAsset(identifier, { include_usage_summary: true })
|
||||
|
||||
if (response.code === 0 && response.data) {
|
||||
const data = response.data
|
||||
@@ -136,6 +136,8 @@ export function useAssetInfo() {
|
||||
gateway_card_imei: resolvedGatewayCardImei,
|
||||
resolved_gateway_card_imei: resolvedGatewayCardImei,
|
||||
gateway_extend: data.gateway_extend ?? '',
|
||||
total_virtual_used_mb: data.total_virtual_used_mb ?? null,
|
||||
total_virtual_remaining_mb: data.total_virtual_remaining_mb ?? null,
|
||||
bound_device_id: data.bound_device_id,
|
||||
bound_device_no: data.bound_device_no || '',
|
||||
bound_device_name: data.bound_device_name || '',
|
||||
|
||||
@@ -30,6 +30,8 @@ export interface AssetInfo {
|
||||
status?: number
|
||||
gateway_card_imei?: string
|
||||
gateway_extend?: string
|
||||
total_virtual_used_mb?: number | null
|
||||
total_virtual_remaining_mb?: number | null
|
||||
last_sync_time?: string | null
|
||||
last_data_check_at?: string | null
|
||||
last_real_name_check_at?: string | null
|
||||
|
||||
@@ -991,6 +991,7 @@
|
||||
:identifier="operationLogsIdentifier"
|
||||
download-permission="iot_card:download_log_file"
|
||||
/>
|
||||
|
||||
<ExportTaskCreateDialog
|
||||
v-model="exportDialogVisible"
|
||||
scene="iot_card"
|
||||
|
||||
@@ -27,9 +27,9 @@
|
||||
:loading="loading"
|
||||
:data="packageList"
|
||||
:marginTop="10"
|
||||
:pagination="false"
|
||||
:actions="getActions"
|
||||
:actionsWidth="150"
|
||||
height="70vh"
|
||||
:inlineActionsCount="2"
|
||||
>
|
||||
<template #default>
|
||||
@@ -134,7 +134,6 @@
|
||||
ElCard,
|
||||
ElButton,
|
||||
ElIcon,
|
||||
ElTable,
|
||||
ElTableColumn,
|
||||
ElTag,
|
||||
ElDialog,
|
||||
|
||||
Reference in New Issue
Block a user