From a1d7e81859f554f3a53680cc35f0f49bf1f77098 Mon Sep 17 00:00:00 2001
From: wwf <1971391498@qq.com>
Date: 星期四, 14 五月 2026 14:37:02 +0800
Subject: [PATCH] 导入项目

---
 src/views/iot/ota/firmware/detail/index.vue |  143 +++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 143 insertions(+), 0 deletions(-)

diff --git a/src/views/iot/ota/firmware/detail/index.vue b/src/views/iot/ota/firmware/detail/index.vue
new file mode 100644
index 0000000..00e7578
--- /dev/null
+++ b/src/views/iot/ota/firmware/detail/index.vue
@@ -0,0 +1,143 @@
+<template>
+  <div class="app-container">
+    <!-- 鍥轰欢淇℃伅 -->
+    <ContentWrap title="鍥轰欢淇℃伅" class="mb-20px">
+      <el-descriptions :column="3" v-loading="firmwareLoading" border>
+        <el-descriptions-item label="鍥轰欢鍚嶇О">
+          {{ firmware?.name }}
+        </el-descriptions-item>
+        <el-descriptions-item label="鎵�灞炰骇鍝�">
+          {{ firmware?.productName }}
+        </el-descriptions-item>
+        <el-descriptions-item label="鍥轰欢鐗堟湰">
+          {{ firmware?.version }}
+        </el-descriptions-item>
+        <el-descriptions-item label="鍒涘缓鏃堕棿">
+          {{ firmware?.createTime ? formatDate(firmware.createTime) : '-' }}
+        </el-descriptions-item>
+        <el-descriptions-item label="鍥轰欢鎻忚堪" :span="2">
+          {{ firmware?.description }}
+        </el-descriptions-item>
+      </el-descriptions>
+    </ContentWrap>
+
+    <!-- 鍗囩骇璁惧缁熻 -->
+    <ContentWrap title="鍗囩骇璁惧缁熻" class="mb-20px">
+      <el-row :gutter="20" class="py-20px" v-loading="firmwareStatisticsLoading">
+        <el-col :span="6">
+          <div class="text-center p-20px border border-solid border-gray-200 rounded bg-gray-50">
+            <div class="text-32px font-bold mb-8px text-blue-500">
+              {{
+                Object.values(firmwareStatistics).reduce((sum, count) => sum + (count || 0), 0) || 0
+              }}
+            </div>
+            <div class="text-14px text-gray-600">鍗囩骇璁惧鎬绘暟</div>
+          </div>
+        </el-col>
+        <el-col :span="3">
+          <div class="text-center p-20px border border-solid border-gray-200 rounded bg-gray-50">
+            <div class="text-32px font-bold mb-8px text-gray-400">
+              {{ firmwareStatistics[IoTOtaTaskRecordStatusEnum.PENDING.value] || 0 }}
+            </div>
+            <div class="text-14px text-gray-600">寰呮帹閫�</div>
+          </div>
+        </el-col>
+        <el-col :span="3">
+          <div class="text-center p-20px border border-solid border-gray-200 rounded bg-gray-50">
+            <div class="text-32px font-bold mb-8px text-blue-400">
+              {{ firmwareStatistics[IoTOtaTaskRecordStatusEnum.PUSHED.value] || 0 }}
+            </div>
+            <div class="text-14px text-gray-600">宸叉帹閫�</div>
+          </div>
+        </el-col>
+        <el-col :span="3">
+          <div class="text-center p-20px border border-solid border-gray-200 rounded bg-gray-50">
+            <div class="text-32px font-bold mb-8px text-yellow-500">
+              {{ firmwareStatistics[IoTOtaTaskRecordStatusEnum.UPGRADING.value] || 0 }}
+            </div>
+            <div class="text-14px text-gray-600">姝e湪鍗囩骇</div>
+          </div>
+        </el-col>
+        <el-col :span="3">
+          <div class="text-center p-20px border border-solid border-gray-200 rounded bg-gray-50">
+            <div class="text-32px font-bold mb-8px text-green-500">
+              {{ firmwareStatistics[IoTOtaTaskRecordStatusEnum.SUCCESS.value] || 0 }}
+            </div>
+            <div class="text-14px text-gray-600">鍗囩骇鎴愬姛</div>
+          </div>
+        </el-col>
+        <el-col :span="3">
+          <div class="text-center p-20px border border-solid border-gray-200 rounded bg-gray-50">
+            <div class="text-32px font-bold mb-8px text-red-500">
+              {{ firmwareStatistics[IoTOtaTaskRecordStatusEnum.FAILURE.value] || 0 }}
+            </div>
+            <div class="text-14px text-gray-600">鍗囩骇澶辫触</div>
+          </div>
+        </el-col>
+        <el-col :span="3">
+          <div class="text-center p-20px border border-solid border-gray-200 rounded bg-gray-50">
+            <div class="text-32px font-bold mb-8px text-gray-400">
+              {{ firmwareStatistics[IoTOtaTaskRecordStatusEnum.CANCELED.value] || 0 }}
+            </div>
+            <div class="text-14px text-gray-600">鍗囩骇鍙栨秷</div>
+          </div>
+        </el-col>
+      </el-row>
+    </ContentWrap>
+
+    <!-- 浠诲姟绠$悊 -->
+    <OtaTaskList
+      :firmware-id="firmwareId"
+      :product-id="firmware?.productId"
+      @success="getStatistics"
+    />
+  </div>
+</template>
+
+<script setup lang="ts">
+import { formatDate } from '@/utils/formatTime'
+import { IoTOtaFirmwareApi, IoTOtaFirmware } from '@/api/iot/ota/firmware'
+import { IoTOtaTaskRecordApi } from '@/api/iot/ota/task/record'
+import { IoTOtaTaskRecordStatusEnum } from '@/views/iot/utils/constants'
+import OtaTaskList from '../../task/OtaTaskList.vue'
+
+/** IoT OTA 鍥轰欢璇︽儏 */
+defineOptions({ name: 'IoTOtaFirmwareDetail' })
+
+const route = useRoute() // 璺敱
+
+const firmwareId = ref(Number(route.params.id)) // 鍥轰欢缂栧彿
+const firmwareLoading = ref(false) // 鍥轰欢鍔犺浇鐘舵��
+const firmware = ref<IoTOtaFirmware>({} as IoTOtaFirmware) // 鍥轰欢淇℃伅
+
+const firmwareStatisticsLoading = ref(false) // 缁熻淇℃伅鍔犺浇鐘舵��
+const firmwareStatistics = ref<Record<string, number>>({}) // 缁熻淇℃伅
+
+/** 鑾峰彇鍥轰欢淇℃伅 */
+const getFirmwareInfo = async () => {
+  firmwareLoading.value = true
+  try {
+    firmware.value = await IoTOtaFirmwareApi.getOtaFirmware(firmwareId.value)
+  } finally {
+    firmwareLoading.value = false
+  }
+}
+
+/** 鑾峰彇鍗囩骇缁熻 */
+const getStatistics = async () => {
+  firmwareStatisticsLoading.value = true
+  try {
+    firmwareStatistics.value = await IoTOtaTaskRecordApi.getOtaTaskRecordStatusStatistics(
+      firmwareId.value
+    )
+  } finally {
+    firmwareStatisticsLoading.value = false
+  }
+}
+
+/** 鍒濆鍖� */
+onMounted(() => {
+  getFirmwareInfo()
+  getStatistics()
+})
+</script>

--
Gitblit v1.8.0