diff --git a/apps/web-antd/src/views/iot/device/device/modules/detail/device-details-thing-model-event.vue b/apps/web-antd/src/views/iot/device/device/modules/detail/device-details-thing-model-event.vue index 90ceb8bf3..d82a306a5 100644 --- a/apps/web-antd/src/views/iot/device/device/modules/detail/device-details-thing-model-event.vue +++ b/apps/web-antd/src/views/iot/device/device/modules/detail/device-details-thing-model-event.vue @@ -6,7 +6,7 @@ import { computed, onMounted, reactive, ref } from 'vue'; import { ContentWrap } from '@vben/common-ui'; import { IconifyIcon } from '@vben/icons'; -import { formatDate } from '@vben/utils'; +import { formatDateTime } from '@vben/utils'; import { Button, @@ -181,7 +181,7 @@ onMounted(() => { {{ record.request?.reportTime - ? formatDate(record.request.reportTime) + ? formatDateTime(record.request.reportTime) : '-' }} diff --git a/apps/web-antd/src/views/iot/device/device/modules/detail/device-realtime-people-counter.vue b/apps/web-antd/src/views/iot/device/device/modules/detail/device-realtime-people-counter.vue new file mode 100644 index 000000000..186853385 --- /dev/null +++ b/apps/web-antd/src/views/iot/device/device/modules/detail/device-realtime-people-counter.vue @@ -0,0 +1,390 @@ + + + + + + + + + + + + + + 客流进 + {{ getPropertyValue('people_in', 0) }} + + + + + + + + + + + + 客流出 + {{ getPropertyValue('people_out', 0) }} + + + + + + + + + + + + 在场人数 + + {{ netFlow >= 0 ? netFlow : 0 }} + + + + + + + + + + + + + 蓝牙信号 + + + {{ getPropertyValue('rssi', '-') }}dBm + + + + + + + + + + + {{ getPropertyValue('battery_tx', 0) }}% + + + {{ formatDateTime(lastUpdateTime) }} + + + + + + + + + + + + + {{ getPropertyValue('people_in', 0) }} + + + + + + {{ getPropertyValue('people_out', 0) }} + + + + + + + diff --git a/apps/web-antd/src/views/iot/device/device/modules/detail/device-realtime-smart-badge.vue b/apps/web-antd/src/views/iot/device/device/modules/detail/device-realtime-smart-badge.vue new file mode 100644 index 000000000..fa7fdf64a --- /dev/null +++ b/apps/web-antd/src/views/iot/device/device/modules/detail/device-realtime-smart-badge.vue @@ -0,0 +1,489 @@ + + + + + + + + + + + + + + 位置 + + {{ getPropertyValue('latitude') }}, {{ getPropertyValue('longitude') }} + + + + + + + + + + + + + 电量 + + {{ getPropertyValue('batteryLevel', 0) }}% + + + + + + + + + + + + + 蓝牙信标 + {{ bluetoothDevices.length }} 个 + + + + + + + + + + + + 语音播报 + 点击发送 + + + + + + + + + + {{ formatDateTime(lastUpdateTime) }} + + + + 刷新 + + + + + + + + 蓝牙信标 + + + {{ device.mac }} + + + {{ device.rssi }}dBm + + + + + + + + 按键事件 + + + {{ getEventTime(event) }} + + {{ parseButtonEvent(event.request?.params || '{}').keyState }} + + 按键{{ parseButtonEvent(event.request?.params || '{}').keyId }} + + + + + + + + + + + + diff --git a/apps/web-antd/src/views/iot/device/device/modules/detail/index.vue b/apps/web-antd/src/views/iot/device/device/modules/detail/index.vue index d8bf6a095..e404ca054 100644 --- a/apps/web-antd/src/views/iot/device/device/modules/detail/index.vue +++ b/apps/web-antd/src/views/iot/device/device/modules/detail/index.vue @@ -3,7 +3,7 @@ import type { IotDeviceApi } from '#/api/iot/device/device'; import type { IotProductApi } from '#/api/iot/product/product'; import type { ThingModelData } from '#/api/iot/thingmodel'; -import { onMounted, ref } from 'vue'; +import { computed, onMounted, ref } from 'vue'; import { useRoute, useRouter } from 'vue-router'; import { Page } from '@vben/common-ui'; @@ -21,9 +21,17 @@ import DeviceDetailsMessage from './device-details-message.vue'; import DeviceDetailsSimulator from './device-details-simulator.vue'; import DeviceDetailsSubDevice from './device-details-sub-device.vue'; import DeviceDetailsThingModel from './device-details-thing-model.vue'; +import DeviceRealtimePeopleCounter from './device-realtime-people-counter.vue'; +import DeviceRealtimeSmartBadge from './device-realtime-smart-badge.vue'; defineOptions({ name: 'IoTDeviceDetail' }); +/** 产品Key常量 */ +const PRODUCT_KEYS = { + SMART_BADGE: 'AOQwO9pJWKgfFTk4', // 智能工牌 + PEOPLE_COUNTER: '82Zr08RUnstRHRO2', // 客流计数器 +}; + const route = useRoute(); const router = useRouter(); @@ -34,6 +42,21 @@ const device = ref({} as IotDeviceApi.Device); const activeTab = ref('info'); const thingModelList = ref([]); +/** 是否显示智能工牌卡片 */ +const showSmartBadgeCard = computed(() => { + return product.value?.productKey === PRODUCT_KEYS.SMART_BADGE; +}); + +/** 是否显示客流计数器卡片 */ +const showPeopleCounterCard = computed(() => { + return product.value?.productKey === PRODUCT_KEYS.PEOPLE_COUNTER; +}); + +/** 是否有实时数据卡片 */ +const hasRealtimeCard = computed(() => { + return showSmartBadgeCard.value || showPeopleCounterCard.value; +}); + /** 获取设备详情 */ async function getDeviceData(deviceId: number) { loading.value = true; @@ -95,6 +118,18 @@ onMounted(async () => { /> + + + + +