This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref, computed, onMounted } from 'vue'
|
import { ref, computed, onMounted } from 'vue'
|
||||||
import { resolveAsset, getAssetRealtimeStatus, getCurrentPackage, getAssetPackages } from '@/api/assets'
|
import { resolveAsset, getAssetRealtimeStatus, getCurrentPackage, getAssetPackages } from '@/api/assets'
|
||||||
import type { AssetRealtimeStatus, AssetPackage } from '@/api/assets'
|
import type { AssetRealtimeStatus, AssetPackage, AssetResolveResponse } from '@/api/assets'
|
||||||
import { formatTime, formatDataSize } from '@/utils/format'
|
import { formatTime, formatDataSize } from '@/utils/format'
|
||||||
import { formatPackageDataSize, formatPackagePrice, getPackageRemainMb, getPackageTotalMb, getPackageUsagePercent, getPackageUsedMb } from '../package-display'
|
import { formatPackageDataSize, formatPackagePrice, getPackageRemainMb, getPackageTotalMb, getPackageUsagePercent, getPackageUsedMb } from '../package-display'
|
||||||
|
|
||||||
@@ -28,6 +28,20 @@
|
|||||||
const cardInfo = computed(() => isCard.value ? assetInfo.value : null)
|
const cardInfo = computed(() => isCard.value ? assetInfo.value : null)
|
||||||
// 设备信息
|
// 设备信息
|
||||||
const deviceInfo = computed(() => isDevice.value ? assetInfo.value : null)
|
const deviceInfo = computed(() => isDevice.value ? assetInfo.value : null)
|
||||||
|
type DeviceBoundCard = NonNullable<AssetResolveResponse['cards']>[number]
|
||||||
|
const deviceBoundCards = computed<DeviceBoundCard[]>(() => Array.isArray(deviceInfo.value?.cards) ? deviceInfo.value.cards : [])
|
||||||
|
const activeDeviceCard = computed<DeviceBoundCard | null>(() => {
|
||||||
|
if (deviceBoundCards.value.length === 1) {
|
||||||
|
return deviceBoundCards.value[0]
|
||||||
|
}
|
||||||
|
|
||||||
|
if (deviceBoundCards.value.length > 1) {
|
||||||
|
return deviceBoundCards.value.find(card => card.is_current) ?? null
|
||||||
|
}
|
||||||
|
|
||||||
|
return null
|
||||||
|
})
|
||||||
|
const deviceRealNameStatus = computed(() => activeDeviceCard.value?.real_name_status ?? deviceInfo.value?.real_name_status)
|
||||||
|
|
||||||
// 搜索资产
|
// 搜索资产
|
||||||
async function handleSearch() {
|
async function handleSearch() {
|
||||||
@@ -890,10 +904,10 @@
|
|||||||
</view>
|
</view>
|
||||||
|
|
||||||
<!-- 实名状态 -->
|
<!-- 实名状态 -->
|
||||||
<view v-if="deviceInfo.real_name_status !== undefined" class="flex items-start justify-between">
|
<view v-if="deviceRealNameStatus !== undefined" class="flex items-start justify-between">
|
||||||
<text class="text-12px text-[#999] w-80px">实名状态</text>
|
<text class="text-12px text-[#999] w-80px">实名状态</text>
|
||||||
<text class="flex-1 text-13px text-[#212121] text-right">
|
<text class="flex-1 text-13px text-[#212121] text-right">
|
||||||
{{ getRealNameStatusText(deviceInfo.real_name_status) }}
|
{{ getRealNameStatusText(deviceRealNameStatus) }}
|
||||||
</text>
|
</text>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
@@ -941,10 +955,10 @@
|
|||||||
</view>
|
</view>
|
||||||
|
|
||||||
<!-- 绑定卡片列表 -->
|
<!-- 绑定卡片列表 -->
|
||||||
<view v-if="deviceInfo.cards && deviceInfo.cards.length > 0" class="bg-white rounded-16px shadow-[0_2px_12px_rgba(0,0,0,0.06)] overflow-hidden mt-2 p-2 px-4 pb-3">
|
<view v-if="deviceBoundCards.length > 0" class="bg-white rounded-16px shadow-[0_2px_12px_rgba(0,0,0,0.06)] overflow-hidden mt-2 p-2 px-4 pb-3">
|
||||||
<text class="text-13px font-600 text-[#212121] block mb-2">绑定IoT卡</text>
|
<text class="text-13px font-600 text-[#212121] block mb-2">绑定IoT卡</text>
|
||||||
<view class="space-y-2">
|
<view class="space-y-2">
|
||||||
<view v-for="card in deviceInfo.cards" :key="card.card_id" class="bg-[#f5f5f5] rounded-12px p-3">
|
<view v-for="card in deviceBoundCards" :key="card.card_id" class="bg-[#f5f5f5] rounded-12px p-3">
|
||||||
<view class="flex items-center justify-between mb-1">
|
<view class="flex items-center justify-between mb-1">
|
||||||
<view class="flex items-center gap-2 min-w-0">
|
<view class="flex items-center gap-2 min-w-0">
|
||||||
<text class="text-12px text-[#212121]">卡槽 {{ card.slot_position }}</text>
|
<text class="text-12px text-[#212121]">卡槽 {{ card.slot_position }}</text>
|
||||||
|
|||||||
Reference in New Issue
Block a user