feat: 新增导入字段,显示实名认证策略字段
All checks were successful
构建并部署前端到测试环境 / build-and-deploy (push) Successful in 4m9s

This commit is contained in:
sexygoat
2026-04-17 18:40:54 +08:00
parent 90b13eb5ec
commit b48d6a1894
16 changed files with 267 additions and 130 deletions

View File

@@ -37,6 +37,9 @@
{{ getRealNameStatusName(cardInfo?.real_name_status) }}
</ElTag>
</ElDescriptionsItem>
<ElDescriptionsItem label="实名认证策略">
{{ getRealnamePolicyName(cardInfo?.realname_policy) }}
</ElDescriptionsItem>
<ElDescriptionsItem label="店铺">{{ cardInfo?.shop_name || '-' }}</ElDescriptionsItem>
<ElDescriptionsItem label="套餐系列">{{ cardInfo?.series_name || '-' }}</ElDescriptionsItem>
@@ -92,6 +95,9 @@
{{ getRealNameStatusName(currentCard?.real_name_status) }}
</ElTag>
</ElDescriptionsItem>
<ElDescriptionsItem label="实名认证策略">
{{ getRealnamePolicyName(cardInfo?.realname_policy) }}
</ElDescriptionsItem>
<ElDescriptionsItem label="设备名称">{{ cardInfo?.device_name || '-' }}</ElDescriptionsItem>
<ElDescriptionsItem label="在线状态">
<ElTag :type="getOnlineStatusType(cardInfo?.online_status)" size="small">
@@ -167,9 +173,9 @@
</div>
</template>
</ElTableColumn>
<ElTableColumn prop="msisdn" label="MSISDN" min-width="140" />
<ElTableColumn prop="carrier_name" label="运营商" width="120" />
<ElTableColumn prop="slot_position" label="卡槽位置" align="center" width="130">
<ElTableColumn prop="msisdn" label="MSISDN" min-width="120" />
<ElTableColumn prop="carrier_name" label="运营商" min-width="120" />
<ElTableColumn prop="slot_position" label="卡槽位置" width="130">
<template #default="scope">
<div style="display: flex; gap: 10px; align-items: center; justify-content: center">
<span>SIM-{{ scope.row.slot_position }}</span>
@@ -177,20 +183,25 @@
</div>
</template>
</ElTableColumn>
<ElTableColumn label="网络状态" align="center" width="100">
<ElTableColumn label="网络状态" width="100">
<template #default="scope">
<ElTag :type="scope.row.network_status === 1 ? 'success' : 'danger'" size="small">
{{ scope.row.network_status === 1 ? '正常' : '停机' }}
</ElTag>
</template>
</ElTableColumn>
<ElTableColumn label="实名状态" align="center" width="100">
<ElTableColumn label="实名状态" width="100">
<template #default="scope">
<ElTag :type="getRealNameStatusType(scope.row.real_name_status)" size="small">
{{ getRealNameStatusName(scope.row.real_name_status) }}
</ElTag>
</template>
</ElTableColumn>
<ElTableColumn label="实名认证策略" width="180">
<template #default="scope">
{{ getRealnamePolicyName(scope.row.realname_policy) }}
</template>
</ElTableColumn>
<ElTableColumn label="实名时间" width="180">
<template #default="scope">
{{ scope.row.real_name_at ? formatDateTime(scope.row.real_name_at) : '-' }}
@@ -511,6 +522,7 @@
formatDuration,
getRealNameStatusName,
getRealNameStatusType,
getRealnamePolicyName,
getAssetStatusName,
getAssetStatusType,
getOnlineStatusName,

View File

@@ -65,6 +65,17 @@ export function useAssetFormatters(deviceRealtime?: Ref<any>) {
return map[status] || 'info'
}
// 获取实名认证策略名称
const getRealnamePolicyName = (policy?: string) => {
if (!policy) return '-'
const policyMap: Record<string, string> = {
none: '无需实名',
before_order: '先实名后充值/购买',
after_order: '先充值/购买后实名'
}
return policyMap[policy] || policy
}
// 获取资产状态名称
const getAssetStatusName = (status?: number) => {
if (status === undefined || status === null) return '未知'
@@ -232,6 +243,7 @@ export function useAssetFormatters(deviceRealtime?: Ref<any>) {
formatIccidWithDashes,
getRealNameStatusName,
getRealNameStatusType,
getRealnamePolicyName,
getAssetStatusName,
getAssetStatusType,
getOnlineStatusName,

View File

@@ -59,6 +59,7 @@ export function useAssetInfo() {
series_id: data.series_id,
series_name: data.series_name,
real_name_status: data.real_name_status,
realname_policy: data.realname_policy,
real_name_at: data.real_name_at,
activated_at: data.activated_at,
created_at: data.created_at,

View File

@@ -16,6 +16,7 @@ export interface AssetInfo {
msisdn?: string
carrier_name?: string
real_name_status?: number
realname_policy?: string
network_status?: string
current_month_used_data?: number
device_type?: string
@@ -35,6 +36,7 @@ export interface BindingCard {
is_current: boolean
status?: number
carrier_name?: string
realname_policy?: string
}
// 设备实时信息接口

View File

@@ -77,6 +77,37 @@
</ElButton>
</div>
<ElRow :gutter="20">
<ElCol :span="12">
<ElFormItem label="批次号" prop="batch_no">
<ElInput
v-model="importForm.batch_no"
placeholder="请输入批次号或点击生成"
:maxlength="100"
clearable
>
<template #append>
<ElButton @click="handleGenerateBatchNo">生成编码</ElButton>
</template>
</ElInput>
</ElFormItem>
</ElCol>
<ElCol :span="12">
<ElFormItem label="实名认证策略">
<ElSelect
v-model="importForm.realname_policy"
placeholder="默认无需实名"
clearable
style="width: 100%"
>
<ElOption label="无需实名" value="none" />
<ElOption label="先实名后充值/购买" value="before_order" />
<ElOption label="先充值/购买后实名" value="after_order" />
</ElSelect>
</ElFormItem>
</ElCol>
</ElRow>
<ElUpload
ref="uploadRef"
drag
@@ -122,6 +153,7 @@
import { StorageService } from '@/api/modules/storage'
import type { DeviceImportTask, DeviceImportTaskStatus } from '@/types/api/device'
import { RoutesAlias } from '@/router/routesAlias'
import { generatePackageCode } from '@/utils/codeGenerator'
defineOptions({ name: 'DeviceTask' })
@@ -134,6 +166,10 @@
const fileList = ref<File[]>([])
const uploading = ref(false)
const importDialogVisible = ref(false)
const importForm = reactive({
batch_no: '',
realname_policy: '' as '' | 'none' | 'before_order' | 'after_order'
})
// 搜索表单初始值
const initialSearchState = {
@@ -507,9 +543,18 @@
fileList.value = []
}
// 生成批次号
const handleGenerateBatchNo = () => {
const code = generatePackageCode().replace('PKG', 'DEV')
importForm.batch_no = code
ElMessage.success('批次号生成成功')
}
// 取消导入
const handleCancelImport = () => {
clearFiles()
importForm.batch_no = ''
importForm.realname_policy = ''
importDialogVisible.value = false
}
@@ -548,7 +593,8 @@
ElMessage.info('正在创建导入任务...')
const importRes = await DeviceService.importDevices({
file_key,
batch_no: `DEV-${Date.now()}`
batch_no: importForm.batch_no || undefined,
realname_policy: importForm.realname_policy || undefined
})
if (importRes.code !== 0) {

View File

@@ -119,35 +119,72 @@
</ElButton>
</div>
<ElFormItem label="运营商" required style="margin-bottom: 20px">
<ElSelect
v-model="selectedCarrierId"
placeholder="请输入运营商名称搜索"
style="width: 100%"
filterable
remote
:remote-method="handleCarrierSearch"
:loading="carrierLoading"
clearable
>
<ElOption
v-for="carrier in carrierList"
:key="carrier.id"
:label="carrier.carrier_name"
:value="carrier.id"
/>
</ElSelect>
</ElFormItem>
<ElRow :gutter="20">
<ElCol :span="12">
<ElFormItem label="运营商" required>
<ElSelect
v-model="selectedCarrierId"
placeholder="请输入运营商名称搜索"
style="width: 100%"
filterable
remote
:remote-method="handleCarrierSearch"
:loading="carrierLoading"
clearable
>
<ElOption
v-for="carrier in carrierList"
:key="carrier.id"
:label="carrier.carrier_name"
:value="carrier.id"
/>
</ElSelect>
</ElFormItem>
</ElCol>
<ElCol :span="12">
<ElFormItem label="卡业务类型">
<ElSelect
v-model="selectedCardCategory"
placeholder="请选择卡业务类型"
style="width: 100%"
>
<ElOption label="普通卡" value="normal" />
<ElOption label="行业卡" value="industry" />
</ElSelect>
</ElFormItem>
</ElCol>
</ElRow>
<ElFormItem label="卡业务类型" style="margin-bottom: 20px">
<ElSelect v-model="selectedCardCategory" placeholder="请选择卡业务类型" style="width: 100%">
<ElOption label="普通卡" value="normal" />
<ElOption label="行业卡" value="industry" />
</ElSelect>
<div style="margin-top: 4px; font-size: 12px; color: var(--el-text-color-secondary)">
默认为普通卡可选择行业卡
</div>
</ElFormItem>
<ElRow :gutter="20">
<ElCol :span="12">
<ElFormItem label="批次号" prop="batch_no">
<ElInput
v-model="importForm.batch_no"
placeholder="请输入批次号或点击生成"
:maxlength="100"
clearable
>
<template #append>
<ElButton @click="handleGenerateBatchNo">生成编码</ElButton>
</template>
</ElInput>
</ElFormItem>
</ElCol>
<ElCol :span="12">
<ElFormItem label="实名认证策略">
<ElSelect
v-model="importForm.realname_policy"
placeholder="默认无需实名"
clearable
style="width: 100%"
>
<ElOption label="无需实名" value="none" />
<ElOption label="先实名后充值/购买" value="before_order" />
<ElOption label="先充值/购买后实名" value="after_order" />
</ElSelect>
</ElFormItem>
</ElCol>
</ElRow>
<ElUpload
ref="uploadRef"
@@ -200,6 +237,7 @@
import { useAuth } from '@/composables/useAuth'
import { formatDateTime } from '@/utils/business/format'
import { StorageService } from '@/api/modules/storage'
import { generatePackageCode } from '@/utils/codeGenerator'
import { RoutesAlias } from '@/router/routesAlias'
import type { IotCardImportTask, IotCardImportTaskStatus } from '@/types/api/card'
import type { Carrier } from '@/types/api'
@@ -224,6 +262,10 @@
const failDataLoading = ref(false)
const failedItems = ref<any[]>([])
const currentFailTask = ref<IotCardImportTask | null>(null)
const importForm = reactive({
batch_no: '',
realname_policy: '' as '' | 'none' | 'before_order' | 'after_order'
})
// 搜索表单初始值
const initialSearchState = {
@@ -682,10 +724,19 @@
selectedCarrierId.value = undefined
}
// 生成批次号
const handleGenerateBatchNo = () => {
const code = generatePackageCode().replace('PKG', 'IOT')
importForm.batch_no = code
ElMessage.success('批次号生成成功')
}
// 取消导入
const handleCancelImport = () => {
clearFiles()
selectedCardCategory.value = 'normal' // 重置为默认值
selectedCardCategory.value = 'normal'
importForm.batch_no = ''
importForm.realname_policy = ''
importDialogVisible.value = false
}
@@ -755,8 +806,9 @@
const importRes = await CardService.importIotCards({
carrier_id: selectedCarrierId.value,
file_key,
batch_no: `IOT-${Date.now()}`,
card_category: selectedCardCategory.value // 新增卡业务类型
batch_no: importForm.batch_no || undefined,
card_category: selectedCardCategory.value,
realname_policy: importForm.realname_policy || undefined
})
if (importRes.code !== 0) {