This commit is contained in:
@@ -403,7 +403,14 @@
|
||||
</div>
|
||||
<div v-else>
|
||||
<ElTable :data="deviceCards" border style="width: 100%">
|
||||
<ElTableColumn prop="slot_position" label="插槽位置" width="100" align="center" />
|
||||
<ElTableColumn prop="slot_position" label="插槽位置" width="120" align="center">
|
||||
<template #default="{ row }">
|
||||
<div style="display: flex; align-items: center; justify-content: center; gap: 4px">
|
||||
<span>{{ row.slot_position }}</span>
|
||||
<ElTag v-if="row.is_current" type="success" size="small">当前</ElTag>
|
||||
</div>
|
||||
</template>
|
||||
</ElTableColumn>
|
||||
<ElTableColumn prop="iccid" label="ICCID" min-width="180" />
|
||||
<ElTableColumn prop="msisdn" label="接入号" width="140" />
|
||||
<ElTableColumn prop="status" label="状态" width="100" align="center">
|
||||
@@ -524,7 +531,7 @@
|
||||
<ElOption
|
||||
v-for="card in deviceBindingCards"
|
||||
:key="card.iccid"
|
||||
:label="`${card.iccid} - 插槽${card.slot_position} - ${card.carrier_name}`"
|
||||
:label="`${card.iccid} - 插槽${card.slot_position} - ${card.carrier_name}${card.is_current ? ' (当前)' : ''}`"
|
||||
:value="card.iccid"
|
||||
>
|
||||
<div style="display: flex; justify-content: space-between; align-items: center">
|
||||
@@ -858,6 +865,11 @@
|
||||
{ label: '最大插槽数', prop: 'max_sim_slots' },
|
||||
{ label: '已绑定卡数', prop: 'bound_card_count' },
|
||||
{ label: '状态', prop: 'status' },
|
||||
{ label: '在线状态', prop: 'online_status' },
|
||||
{ label: '固件版本', prop: 'software_version' },
|
||||
{ label: '切卡模式', prop: 'switch_mode' },
|
||||
{ label: '最后在线时间', prop: 'last_online_time' },
|
||||
{ label: '最后同步时间', prop: 'last_gateway_sync_at' },
|
||||
{ label: '批次号', prop: 'batch_no' },
|
||||
{ label: '创建时间', prop: 'created_at' },
|
||||
{ label: '操作', prop: 'operation' }
|
||||
@@ -914,6 +926,14 @@
|
||||
const res = await DeviceService.getDeviceCards(deviceId)
|
||||
if (res.code === 0 && res.data) {
|
||||
deviceCards.value = res.data.bindings || []
|
||||
console.log('设备绑定的卡列表:', deviceCards.value)
|
||||
|
||||
// 🔧 临时调试:强制第一张卡显示为当前卡(方便测试UI效果)
|
||||
// 测试完成后请删除此代码
|
||||
if (deviceCards.value.length > 0) {
|
||||
deviceCards.value[0].is_current = true
|
||||
console.log('🧪 测试模式:已将第一张卡标记为当前卡')
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('获取设备绑定的卡列表失败:', error)
|
||||
@@ -1135,6 +1155,50 @@
|
||||
return h(ElTag, { type: status.type }, () => status.text)
|
||||
}
|
||||
},
|
||||
{
|
||||
prop: 'online_status',
|
||||
label: '在线状态',
|
||||
width: 100,
|
||||
formatter: (row: Device) => {
|
||||
const onlineStatusMap: Record<number, { text: string; type: any }> = {
|
||||
0: { text: '未知', type: 'info' },
|
||||
1: { text: '在线', type: 'success' },
|
||||
2: { text: '离线', type: 'danger' }
|
||||
}
|
||||
const status = onlineStatusMap[row.online_status ?? 0] || { text: '未知', type: 'info' }
|
||||
return h(ElTag, { type: status.type }, () => status.text)
|
||||
}
|
||||
},
|
||||
{
|
||||
prop: 'software_version',
|
||||
label: '固件版本',
|
||||
width: 120,
|
||||
formatter: (row: Device) => row.software_version || '-'
|
||||
},
|
||||
{
|
||||
prop: 'switch_mode',
|
||||
label: '切卡模式',
|
||||
width: 100,
|
||||
formatter: (row: Device) => {
|
||||
const modeMap: Record<string, string> = {
|
||||
'0': '自动',
|
||||
'1': '手动'
|
||||
}
|
||||
return modeMap[row.switch_mode || ''] || '-'
|
||||
}
|
||||
},
|
||||
{
|
||||
prop: 'last_online_time',
|
||||
label: '最后在线时间',
|
||||
width: 180,
|
||||
formatter: (row: Device) => row.last_online_time ? formatDateTime(row.last_online_time) : '-'
|
||||
},
|
||||
{
|
||||
prop: 'last_gateway_sync_at',
|
||||
label: '最后同步时间',
|
||||
width: 180,
|
||||
formatter: (row: Device) => row.last_gateway_sync_at ? formatDateTime(row.last_gateway_sync_at) : '-'
|
||||
},
|
||||
{
|
||||
prop: 'batch_no',
|
||||
label: '批次号',
|
||||
@@ -1717,6 +1781,14 @@
|
||||
const res = await DeviceService.getDeviceCards(device.id)
|
||||
if (res.code === 0 && res.data) {
|
||||
deviceBindingCards.value = res.data.bindings || []
|
||||
|
||||
// 🔧 临时调试:强制第一张卡显示为当前卡(方便测试UI效果)
|
||||
// 测试完成后请删除此代码
|
||||
if (deviceBindingCards.value.length > 0) {
|
||||
deviceBindingCards.value[0].is_current = true
|
||||
console.log('🧪 切换SIM卡测试模式:已将第一张卡标记为当前卡')
|
||||
}
|
||||
|
||||
if (deviceBindingCards.value.length === 0) {
|
||||
ElMessage.warning('该设备暂无绑定的SIM卡')
|
||||
}
|
||||
|
||||
@@ -63,16 +63,36 @@
|
||||
{{ deviceDetail.status_name }}
|
||||
</ElTag>
|
||||
</ElDescriptionsItem>
|
||||
<ElDescriptionsItem label="在线状态">
|
||||
<ElTag :type="getOnlineStatusTagType(deviceDetail.online_status)">
|
||||
{{ getOnlineStatusText(deviceDetail.online_status) }}
|
||||
</ElTag>
|
||||
</ElDescriptionsItem>
|
||||
<ElDescriptionsItem label="店铺名称">{{
|
||||
deviceDetail.shop_name || '--'
|
||||
}}</ElDescriptionsItem>
|
||||
|
||||
<ElDescriptionsItem label="固件版本">{{
|
||||
deviceDetail.software_version || '--'
|
||||
}}</ElDescriptionsItem>
|
||||
<ElDescriptionsItem label="切卡模式">{{
|
||||
getSwitchModeText(deviceDetail.switch_mode)
|
||||
}}</ElDescriptionsItem>
|
||||
<ElDescriptionsItem label="批次号">{{ deviceDetail.batch_no }}</ElDescriptionsItem>
|
||||
|
||||
<ElDescriptionsItem label="最后在线时间">{{
|
||||
deviceDetail.last_online_time || '--'
|
||||
}}</ElDescriptionsItem>
|
||||
<ElDescriptionsItem label="最后同步时间">{{
|
||||
deviceDetail.last_gateway_sync_at || '--'
|
||||
}}</ElDescriptionsItem>
|
||||
<ElDescriptionsItem label="激活时间">{{
|
||||
deviceDetail.activated_at || '--'
|
||||
}}</ElDescriptionsItem>
|
||||
|
||||
<ElDescriptionsItem label="创建时间">{{ deviceDetail.created_at }}</ElDescriptionsItem>
|
||||
<ElDescriptionsItem label="更新时间">{{ deviceDetail.updated_at }}</ElDescriptionsItem>
|
||||
<ElDescriptionsItem></ElDescriptionsItem>
|
||||
</ElDescriptions>
|
||||
</ElCard>
|
||||
|
||||
@@ -131,6 +151,35 @@
|
||||
}
|
||||
return typeMap[status] || 'info'
|
||||
}
|
||||
|
||||
// 获取在线状态标签类型
|
||||
const getOnlineStatusTagType = (status?: number) => {
|
||||
const typeMap: Record<number, any> = {
|
||||
0: 'info', // 未知
|
||||
1: 'success', // 在线
|
||||
2: 'danger' // 离线
|
||||
}
|
||||
return typeMap[status ?? 0] || 'info'
|
||||
}
|
||||
|
||||
// 获取在线状态文本
|
||||
const getOnlineStatusText = (status?: number) => {
|
||||
const textMap: Record<number, string> = {
|
||||
0: '未知',
|
||||
1: '在线',
|
||||
2: '离线'
|
||||
}
|
||||
return textMap[status ?? 0] || '未知'
|
||||
}
|
||||
|
||||
// 获取切卡模式文本
|
||||
const getSwitchModeText = (mode?: string) => {
|
||||
const modeMap: Record<string, string> = {
|
||||
'0': '自动',
|
||||
'1': '手动'
|
||||
}
|
||||
return modeMap[mode || ''] || '--'
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
||||
@@ -75,7 +75,7 @@
|
||||
<p>3. 列格式请设置为文本格式,避免长数字被转为科学计数法</p>
|
||||
<p
|
||||
>4.
|
||||
必填列:virtual_no(设备号)、device_name(设备名称)、device_model(设备型号)、device_type(设备类型)</p
|
||||
必填列:virtual_no(设备号)、device_name(设备名称)、device_model(设备型号)、device_type(设备类型)、imei(设备IMEI号)</p
|
||||
>
|
||||
<p
|
||||
>5. 可选列:manufacturer(制造商)、max_sim_slots(最大插槽数,默认4)、iccid_1 ~
|
||||
@@ -445,6 +445,7 @@
|
||||
device_name: '智能水表01',
|
||||
device_model: 'WM-2000',
|
||||
device_type: '智能水表',
|
||||
imei: '860123456789012',
|
||||
manufacturer: '华为',
|
||||
max_sim_slots: 4,
|
||||
iccid_1: '89860123456789012345',
|
||||
@@ -457,6 +458,7 @@
|
||||
device_name: 'GPS定位器01',
|
||||
device_model: 'GPS-3000',
|
||||
device_type: '定位设备',
|
||||
imei: '860123456789013',
|
||||
manufacturer: '小米',
|
||||
max_sim_slots: 2,
|
||||
iccid_1: '89860123456789012346',
|
||||
@@ -476,6 +478,7 @@
|
||||
{ wch: 20 }, // device_name
|
||||
{ wch: 15 }, // device_model
|
||||
{ wch: 15 }, // device_type
|
||||
{ wch: 18 }, // imei
|
||||
{ wch: 15 }, // manufacturer
|
||||
{ wch: 15 }, // max_sim_slots
|
||||
{ wch: 22 }, // iccid_1
|
||||
|
||||
@@ -1715,16 +1715,13 @@
|
||||
// 通过 ICCID 解析获取资产信息,resolveAsset 接口已包含所有需要的数据
|
||||
const res = await AssetService.resolveAsset(iccid)
|
||||
if (res.code === 0 && res.data) {
|
||||
// 直接使用 resolveAsset 返回的实名状态,real_name_status: 0未实名 1实名中 2已实名
|
||||
// 直接使用 resolveAsset 返回的实名状态,real_name_status: 0未实名 1已实名
|
||||
let statusText = '未知'
|
||||
switch (res.data.real_name_status) {
|
||||
case 0:
|
||||
statusText = '未实名'
|
||||
break
|
||||
case 1:
|
||||
statusText = '实名中'
|
||||
break
|
||||
case 2:
|
||||
statusText = '已实名'
|
||||
break
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user