|
@@ -12,6 +12,7 @@
|
|
<a-radio-group v-model:value="tableType" button-style="solid" size="small">
|
|
<a-radio-group v-model:value="tableType" button-style="solid" size="small">
|
|
<a-radio-button value="fall">跌倒统计</a-radio-button>
|
|
<a-radio-button value="fall">跌倒统计</a-radio-button>
|
|
<a-radio-button value="alarm">告警统计</a-radio-button>
|
|
<a-radio-button value="alarm">告警统计</a-radio-button>
|
|
|
|
+ <a-radio-button value="online">上下线记录</a-radio-button>
|
|
</a-radio-group>
|
|
</a-radio-group>
|
|
</template>
|
|
</template>
|
|
|
|
|
|
@@ -47,13 +48,6 @@
|
|
<div class="tableCard">
|
|
<div class="tableCard">
|
|
<a-table :columns="columns" :data-source="tableList" :loading="loading" :pagination="false">
|
|
<a-table :columns="columns" :data-source="tableList" :loading="loading" :pagination="false">
|
|
<template #bodyCell="{ column, record }">
|
|
<template #bodyCell="{ column, record }">
|
|
- <!-- <template v-if="column.key === 'pose'">
|
|
|
|
- {{ record.poseName }}
|
|
|
|
- </template> -->
|
|
|
|
- <!-- <template v-if="column.key === 'isHandle'">
|
|
|
|
- <a-tag v-if="record.isHandle === 0" :bordered="false" color="red">未处理</a-tag>
|
|
|
|
- <a-tag v-if="record.isHandle === 1" :bordered="false" color="green">已处理</a-tag>
|
|
|
|
- </template> -->
|
|
|
|
<template v-if="column.key === 'eventType'">
|
|
<template v-if="column.key === 'eventType'">
|
|
{{ record.eventTypeName }}
|
|
{{ record.eventTypeName }}
|
|
</template>
|
|
</template>
|
|
@@ -85,6 +79,11 @@
|
|
</a-collapse>
|
|
</a-collapse>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
</template>
|
|
|
|
+
|
|
|
|
+ <template v-if="column.key === 'onlineType'">
|
|
|
|
+ <a-tag v-if="record.type === 'on'" :bordered="false" color="green">上线</a-tag>
|
|
|
|
+ <a-tag v-if="record.type === 'off'" :bordered="false" color="red">离线</a-tag>
|
|
|
|
+ </template>
|
|
</template>
|
|
</template>
|
|
</a-table>
|
|
</a-table>
|
|
|
|
|
|
@@ -103,9 +102,13 @@
|
|
<script setup lang="ts">
|
|
<script setup lang="ts">
|
|
import { computed, ref, watch } from 'vue'
|
|
import { computed, ref, watch } from 'vue'
|
|
import { useSearch } from '@/hooks/useSearch'
|
|
import { useSearch } from '@/hooks/useSearch'
|
|
-import { fallColumns, alarmColumns } from './const'
|
|
|
|
|
|
+import { fallColumns, alarmColumns, onlineColumns } from './const'
|
|
import * as statsApi from '@/api/stats'
|
|
import * as statsApi from '@/api/stats'
|
|
-import type { StatsFallQueryDataRow, StatsAlarmQueryDataRow } from '@/api/stats/types'
|
|
|
|
|
|
+import type {
|
|
|
|
+ StatsFallQueryDataRow,
|
|
|
|
+ StatsAlarmQueryDataRow,
|
|
|
|
+ StatsDeviceOnlineQueryDataRow,
|
|
|
|
+} from '@/api/stats/types'
|
|
import { useDict, type DictItem } from '@/hooks/useDict'
|
|
import { useDict, type DictItem } from '@/hooks/useDict'
|
|
import { useDictName } from '@/hooks/useDictName'
|
|
import { useDictName } from '@/hooks/useDictName'
|
|
import * as alarmApi from '@/api/alarm'
|
|
import * as alarmApi from '@/api/alarm'
|
|
@@ -120,6 +123,7 @@ type Props = {
|
|
devId: string
|
|
devId: string
|
|
title?: string
|
|
title?: string
|
|
width?: number
|
|
width?: number
|
|
|
|
+ type?: 'fall' | 'alarm' | 'online'
|
|
}
|
|
}
|
|
|
|
|
|
const emit = defineEmits<{
|
|
const emit = defineEmits<{
|
|
@@ -131,14 +135,17 @@ const props = withDefaults(defineProps<Props>(), {
|
|
devId: '',
|
|
devId: '',
|
|
title: '设备历史统计',
|
|
title: '设备历史统计',
|
|
width: 900,
|
|
width: 900,
|
|
|
|
+ type: 'fall',
|
|
})
|
|
})
|
|
|
|
|
|
// 表格统计类型展示 跌倒、一般滞留、异常滞留
|
|
// 表格统计类型展示 跌倒、一般滞留、异常滞留
|
|
-const tableType = ref<'fall' | 'alarm'>('fall')
|
|
|
|
|
|
+const tableType = ref<'fall' | 'alarm' | 'online'>('fall')
|
|
|
|
|
|
const columns = computed(() => {
|
|
const columns = computed(() => {
|
|
if (tableType.value === 'alarm') {
|
|
if (tableType.value === 'alarm') {
|
|
return alarmColumns
|
|
return alarmColumns
|
|
|
|
+ } else if (tableType.value === 'online') {
|
|
|
|
+ return onlineColumns
|
|
} else {
|
|
} else {
|
|
return fallColumns
|
|
return fallColumns
|
|
}
|
|
}
|
|
@@ -216,13 +223,15 @@ const alarmEventTypeOptions = computed(() => [
|
|
})),
|
|
})),
|
|
])
|
|
])
|
|
|
|
|
|
-const tableList = ref<(StatsFallQueryDataRow | StatsAlarmQueryDataRow)[]>([])
|
|
|
|
|
|
+type TableList = StatsFallQueryDataRow | StatsAlarmQueryDataRow | StatsDeviceOnlineQueryDataRow
|
|
|
|
+const tableList = ref<TableList[]>([])
|
|
const tableTotal = ref<number>(0)
|
|
const tableTotal = ref<number>(0)
|
|
const current = ref<number>(1)
|
|
const current = ref<number>(1)
|
|
const pageSize = ref<number>(10)
|
|
const pageSize = ref<number>(10)
|
|
|
|
|
|
const fallList = ref<StatsFallQueryDataRow[]>([])
|
|
const fallList = ref<StatsFallQueryDataRow[]>([])
|
|
const alarmList = ref<StatsAlarmQueryDataRow[]>([])
|
|
const alarmList = ref<StatsAlarmQueryDataRow[]>([])
|
|
|
|
+const onlineList = ref<StatsDeviceOnlineQueryDataRow[]>([])
|
|
|
|
|
|
// 搜索
|
|
// 搜索
|
|
const searchHandler = async () => {
|
|
const searchHandler = async () => {
|
|
@@ -303,6 +312,30 @@ const fetchAlarmList = async () => {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+// 获取上下线统计数据
|
|
|
|
+const fetchOnlineList = async () => {
|
|
|
|
+ console.log('🚀🚀🚀fetchOnlineList')
|
|
|
|
+ try {
|
|
|
|
+ loading.value = true
|
|
|
|
+ const res = await statsApi.statsDeviceOnlineQuery({
|
|
|
|
+ pageNo: current.value,
|
|
|
|
+ pageSize: pageSize.value,
|
|
|
|
+ devId: props.devId,
|
|
|
|
+ createTimeStart: searchState.createTimeStart,
|
|
|
|
+ createTimeEnd: searchState.createTimeEnd,
|
|
|
|
+ })
|
|
|
|
+ console.log('✅ 获取上下线统计数据成功', res)
|
|
|
|
+ const { rows, total } = res.data
|
|
|
|
+ onlineList.value = rows as StatsDeviceOnlineQueryDataRow[]
|
|
|
|
+ tableList.value = onlineList.value
|
|
|
|
+ tableTotal.value = Number(total)
|
|
|
|
+ loading.value = false
|
|
|
|
+ } catch (error) {
|
|
|
|
+ console.error('❌ 获取上下线统计数据失败', error)
|
|
|
|
+ loading.value = false
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
const fetchList = () => {
|
|
const fetchList = () => {
|
|
if (tableType.value === 'fall') {
|
|
if (tableType.value === 'fall') {
|
|
fetchFallList()
|
|
fetchFallList()
|
|
@@ -310,6 +343,9 @@ const fetchList = () => {
|
|
if (tableType.value === 'alarm') {
|
|
if (tableType.value === 'alarm') {
|
|
fetchAlarmList()
|
|
fetchAlarmList()
|
|
}
|
|
}
|
|
|
|
+ if (tableType.value === 'online') {
|
|
|
|
+ fetchOnlineList()
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
watch(
|
|
watch(
|
|
@@ -325,6 +361,7 @@ watch(
|
|
(newVal) => {
|
|
(newVal) => {
|
|
if (newVal) {
|
|
if (newVal) {
|
|
console.log('🌸🌸 DeviceStatsDrawer PROPS 🌸🌸', props)
|
|
console.log('🌸🌸 DeviceStatsDrawer PROPS 🌸🌸', props)
|
|
|
|
+ tableType.value = props.type || 'fall'
|
|
fetchList()
|
|
fetchList()
|
|
}
|
|
}
|
|
},
|
|
},
|