|
|
@@ -130,6 +130,33 @@
|
|
|
<a-descriptions-item label="主题前缀">
|
|
|
{{ dataStore.dtuConfig.topic_prefix || '未配置' }}
|
|
|
</a-descriptions-item>
|
|
|
+ <a-descriptions-item label="主板温度">
|
|
|
+ <span :style="{ color: getTempColor(dataStore.dtuStatus.temperature) }">
|
|
|
+ {{ dataStore.dtuStatus.temperature !== null && dataStore.dtuStatus.temperature !== undefined
|
|
|
+ ? `${dataStore.dtuStatus.temperature}°C` : '--' }}
|
|
|
+ </span>
|
|
|
+ </a-descriptions-item>
|
|
|
+ <a-descriptions-item label="固件版本">
|
|
|
+ {{ dataStore.dtuStatus.firmware_version || dataStore.dtuConfig.firmware_version || '--' }}
|
|
|
+ </a-descriptions-item>
|
|
|
+ <a-descriptions-item label="CPU 使用率">
|
|
|
+ <a-progress
|
|
|
+ v-if="dataStore.dtuStatus.cpu_usage !== null && dataStore.dtuStatus.cpu_usage !== undefined"
|
|
|
+ :percent="Math.round(dataStore.dtuStatus.cpu_usage)"
|
|
|
+ :status="dataStore.dtuStatus.cpu_usage > 80 ? 'exception' : 'normal'"
|
|
|
+ style="width: 100%"
|
|
|
+ />
|
|
|
+ <span v-else>--</span>
|
|
|
+ </a-descriptions-item>
|
|
|
+ <a-descriptions-item label="内存使用率">
|
|
|
+ <a-progress
|
|
|
+ v-if="dataStore.dtuStatus.memory_usage !== null && dataStore.dtuStatus.memory_usage !== undefined"
|
|
|
+ :percent="Math.round(dataStore.dtuStatus.memory_usage)"
|
|
|
+ :status="dataStore.dtuStatus.memory_usage > 80 ? 'exception' : 'normal'"
|
|
|
+ style="width: 100%"
|
|
|
+ />
|
|
|
+ <span v-else>--</span>
|
|
|
+ </a-descriptions-item>
|
|
|
</a-descriptions>
|
|
|
|
|
|
<div style="display: flex; justify-content: flex-end; margin-top: 16px">
|
|
|
@@ -209,7 +236,7 @@
|
|
|
</template>
|
|
|
|
|
|
<script setup>
|
|
|
-import { onMounted, ref, computed, watch } from 'vue'
|
|
|
+import { onMounted, onUnmounted, ref, computed, watch } from 'vue'
|
|
|
import { useDataStore } from '../stores/dataStore'
|
|
|
import apiService from '../api/apiService'
|
|
|
import StatusIndicator from './StatusIndicator.vue'
|
|
|
@@ -252,6 +279,13 @@ const canRegister = computed(() => {
|
|
|
return formData.value.topic_prefix && formData.value.customer_id && formData.value.dtu_id
|
|
|
})
|
|
|
|
|
|
+const getTempColor = (t) => {
|
|
|
+ if (t === null || t === undefined) return '#999'
|
|
|
+ if (t >= 70) return '#ff4d4f'
|
|
|
+ if (t >= 60) return '#faad14'
|
|
|
+ return '#52c41a'
|
|
|
+}
|
|
|
+
|
|
|
watch(() => formData.value.topic_prefix, () => {
|
|
|
if (formData.value.topic_prefix) {
|
|
|
showErrors.value = false
|
|
|
@@ -380,6 +414,8 @@ const sendConfigBroadcast = async () => {
|
|
|
|
|
|
onMounted(() => {
|
|
|
refreshStatus()
|
|
|
+ const timer = setInterval(refreshStatus, 30000)
|
|
|
+ onUnmounted(() => clearInterval(timer))
|
|
|
})
|
|
|
</script>
|
|
|
|