diff --git a/src/views/equipmentList/list.vue b/src/views/equipmentList/list.vue index e73ea29..13566cf 100644 --- a/src/views/equipmentList/list.vue +++ b/src/views/equipmentList/list.vue @@ -65,21 +65,119 @@ {{ scope.row.status ?? '-' }} --> - + - - {{ scope.row.batteryLevel1 + '%' }} + 左{{ scope.row.batteryLevel1 + '%' }} - {{ scope.row.batteryLevel2 + '%' }} + 右{{ scope.row.batteryLevel2 + '%' }} - 未获取 + --> + + + + + + + + + + + 左{{ scope.row.batteryLevel1 }}% + + + + + + + + + + + 右{{ scope.row.batteryLevel2 }}% + + + + + 未获取 + + @@ -702,6 +800,21 @@ const handleRefresh = async () => { initHls(monitorVideoUrl, monitorVideoRef); } }; + +/** 电池颜色:>50% 绿,30-50% 黄,<30% 红 */ +const getBatteryColor = (val: number) => { + if (val > 50) return '#52c41a'; + if (val >= 30) return '#faad14'; + return '#ff4d4f'; +}; + +const formatPowerLevel = (val: any) => Number(val) || 0; +const getPowerLevelClass = (val: any) => { + const v = Number(val); + if (v > 50) return 'power--high'; + if (v >= 30) return 'power--mid'; + return 'power--low'; +};