From ebd0ec4f51288042b6fc5bf714b1febbb63cfacc Mon Sep 17 00:00:00 2001
From: chenyao <1219716595@qq.com>
Date: Fri, 09 Jan 2026 18:03:49 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'
---
applications/drone-command/src/views/dataCockpit/components/EquipmentWarning.vue | 101 ++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 101 insertions(+), 0 deletions(-)
diff --git a/applications/drone-command/src/views/dataCockpit/components/EquipmentWarning.vue b/applications/drone-command/src/views/dataCockpit/components/EquipmentWarning.vue
new file mode 100644
index 0000000..4f2c8a0
--- /dev/null
+++ b/applications/drone-command/src/views/dataCockpit/components/EquipmentWarning.vue
@@ -0,0 +1,101 @@
+<!--
+ * @Author : yuan
+ * @Date : 2026-01-08 09:29:07
+ * @LastEditors : yuan
+ * @LastEditTime : 2026-01-08 14:49:25
+ * @FilePath : \applications\drone-command\src\views\dataCockpit\components\EquipmentWarning.vue
+ * @Description :
+ * Copyright 2026 OBKoro1, All Rights Reserved.
+ * 2026-01-08 09:29:07
+-->
+<template>
+ <div
+ class="equipment-warning"
+ v-loading="loading"
+ element-loading-background="rgba(5, 5, 15, 0.6)"
+ element-loading-text="加载中..."
+ >
+ <EmptyState v-if="!equipmentWarningData.length" />
+ <EquipmentTemplate
+ v-else
+ v-for="(item, ind) in equipmentWarningData"
+ :key="ind"
+ :data="item"
+ @click="onCardClick"
+ />
+ </div>
+</template>
+
+<script setup>
+import { onMounted, ref } from 'vue'
+import EquipmentTemplate from './templateComponents/EquipmentTemplate.vue'
+import { deviceSearchApi } from '@/api/dataCockpit'
+import EmptyState from './EmptyState.vue'
+
+const equipmentWarningData = ref([])
+const loading = ref(false)
+const minLoadingMs = 400
+
+const statusMap = {
+ 0: { text: '在线', statusType: 'online' },
+ 1: { text: '离线', statusType: 'offline' },
+ 2: { text: '故障', statusType: 'fault' },
+ 3: { text: '报废', statusType: 'offline' }
+}
+const deviceTypeMap = {
+ 1: '便捷侦测箱',
+ 2: '反制枪',
+ 3: '察打一体'
+}
+
+const formatDeviceItem = (item) => {
+ const statusInfo = statusMap[item?.status] || { text: '-', statusType: '' }
+ return {
+ id: item.id,
+ name: item.deviceName || item.deviceModel || '-',
+ status: statusInfo.text,
+ statusType: statusInfo.statusType,
+ type: deviceTypeMap[item.deviceType] || item.deviceType || '-',
+ manufacturer: item.manufacturer || '-',
+ azimuth: item.azimuth ?? 0,
+ pitch: item.elevation ?? 0,
+ range: item.effectiveRangeKm ?? 0,
+ model: item.deviceModel || '-',
+ longitude: item.longitude ?? '-',
+ latitude: item.latitude ?? '-'
+ }
+}
+
+const fetchDeviceWarning = async () => {
+ const startAt = Date.now()
+ loading.value = true
+ try {
+ const params = { current: 1, size: 20, deviceStatusList: '1,2,3' }
+ const res = await deviceSearchApi(params)
+ const records = res?.data?.data?.records ?? []
+ equipmentWarningData.value = records.map(formatDeviceItem)
+ } finally {
+ const elapsed = Date.now() - startAt
+ if (elapsed < minLoadingMs) {
+ await new Promise((resolve) => setTimeout(resolve, minLoadingMs - elapsed))
+ }
+ loading.value = false
+ }
+}
+
+onMounted(() => {
+ fetchDeviceWarning()
+})
+
+const onCardClick = (item) => {
+ console.log('点击设备卡片:', item.id)
+}
+</script>
+
+<style lang="scss" scoped>
+.equipment-warning {
+ width: 100%;
+ height: 100%;
+}
+
+</style>
--
Gitblit v1.9.3