modify-bug
All checks were successful
构建并部署前端到测试环境 / build-and-deploy (push) Successful in 6m58s

This commit is contained in:
sexygoat
2026-03-28 18:31:43 +08:00
parent d6c23c8bd1
commit dbe6070207
22 changed files with 922 additions and 260 deletions

View File

@@ -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卡')
}