|
@@ -1,8 +1,4 @@
|
|
|
<template>
|
|
<template>
|
|
|
- <!-- <statistics-template
|
|
|
|
|
- title="上下线统计"
|
|
|
|
|
- :list="[{value: 20, color: 'green', label: '上线次数'}, {value: 20, color: 'red', label: '下线次数'}]"
|
|
|
|
|
- /> -->
|
|
|
|
|
<a-card
|
|
<a-card
|
|
|
style="margin-top: 20px;"
|
|
style="margin-top: 20px;"
|
|
|
title="设备分析"
|
|
title="设备分析"
|
|
@@ -28,6 +24,7 @@
|
|
|
:options="state.deviceLit"
|
|
:options="state.deviceLit"
|
|
|
@search="getDeviceLabel"
|
|
@search="getDeviceLabel"
|
|
|
@change="selectDevice"
|
|
@change="selectDevice"
|
|
|
|
|
+ allowClear
|
|
|
>
|
|
>
|
|
|
<template v-if="state.fetching" #notFoundContent>
|
|
<template v-if="state.fetching" #notFoundContent>
|
|
|
<a-spin size="small" />
|
|
<a-spin size="small" />
|
|
@@ -71,13 +68,25 @@
|
|
|
<a-spin :spinning="state.loading" >
|
|
<a-spin :spinning="state.loading" >
|
|
|
<a-empty style="margin: 0 auto;" v-if="emptyCondition" :description="emptyDesc" ></a-empty>
|
|
<a-empty style="margin: 0 auto;" v-if="emptyCondition" :description="emptyDesc" ></a-empty>
|
|
|
<span v-else>
|
|
<span v-else>
|
|
|
- <a-col :span="24" v-if="activeTabKey === 'session'">
|
|
|
|
|
- <a-row>
|
|
|
|
|
- <a-col :xs="24" :md="24" :xl="12" >
|
|
|
|
|
- <div id="device-session" style="width: 600px;height: 400px;" ></div>
|
|
|
|
|
|
|
+
|
|
|
|
|
+ <a-col :span="24" v-if="activeTabKey === 'session'" style="margin-top: 20px">
|
|
|
|
|
+ <a-row >
|
|
|
|
|
+ <a-col :xs="24" :md="24" :xl="12" style="position: relative;width: 100%;height: 400px;" >
|
|
|
|
|
+ <!-- <div style="position: absolute;right: 0;top: 0;z-index: 99;width: 40px;height: 60px" >
|
|
|
|
|
+ <a-space>
|
|
|
|
|
+ <a-button :type="lineChartZindex.line > lineChartZindex.bar ? 'primary' : ''" :icon="h(LineChartOutlined)" @click="changeChart('line')"/>
|
|
|
|
|
+ <a-button :type="lineChartZindex.line <= lineChartZindex.bar ? 'primary' : ''" :icon="h(BarChartOutlined)" @click="changeChart('bar')"/>
|
|
|
|
|
+ </a-space>
|
|
|
|
|
+ </div> -->
|
|
|
|
|
+ <div id="device-session" :style="{backgroundColor: '#fff', width: '600px',height: '400px',position: 'absolute',top: '0',left: 0,zIndex: lineChartZindex.line}" ></div>
|
|
|
|
|
+ <div id="device-session-scatter" :style="{backgroundColor: '#fff',width: '600px',height: '400px',position: 'absolute',top: '0',left: 0,zIndex: lineChartZindex.bar}" ></div>
|
|
|
</a-col>
|
|
</a-col>
|
|
|
- <a-col :xs="24" :md="24" :xl="12">
|
|
|
|
|
- <div id="device-session-scatter" style="width: 600px;height: 400px;" ></div>
|
|
|
|
|
|
|
+ <a-col :xs="24" :md="24" :xl="12" >
|
|
|
|
|
+ <a-table
|
|
|
|
|
+ :dataSource="state.dataSource"
|
|
|
|
|
+ :columns="lineCloumns"
|
|
|
|
|
+ >
|
|
|
|
|
+ </a-table>
|
|
|
</a-col>
|
|
</a-col>
|
|
|
</a-row>
|
|
</a-row>
|
|
|
</a-col>
|
|
</a-col>
|
|
@@ -105,13 +114,14 @@
|
|
|
</template>
|
|
</template>
|
|
|
<script lang='ts' setup >
|
|
<script lang='ts' setup >
|
|
|
import { DeviceContriller } from '@/controller'
|
|
import { DeviceContriller } from '@/controller'
|
|
|
-import { reactive, watch, computed, ref, onMounted, watchEffect, nextTick } from 'vue'
|
|
|
|
|
|
|
+import { reactive, watch, computed, ref, onMounted, watchEffect, nextTick, h } from 'vue'
|
|
|
import * as echarts from 'echarts'
|
|
import * as echarts from 'echarts'
|
|
|
import { useRoute } from 'vue-router'
|
|
import { useRoute } from 'vue-router'
|
|
|
import { sessionEchartsJson, attrEchartsJson, scatterOption, barOption, calculateAverage } from './json/echartsJson'
|
|
import { sessionEchartsJson, attrEchartsJson, scatterOption, barOption, calculateAverage } from './json/echartsJson'
|
|
|
import dayjs from 'dayjs'
|
|
import dayjs from 'dayjs'
|
|
|
import StatisticsTemplate from '@/components/StatisticsTemplate'
|
|
import StatisticsTemplate from '@/components/StatisticsTemplate'
|
|
|
import { message } from 'ant-design-vue'
|
|
import { message } from 'ant-design-vue'
|
|
|
|
|
+import { LineChartOutlined, BarChartOutlined } from '@ant-design/icons-vue'
|
|
|
import { useThrottle } from 'flicker-vue-hooks'
|
|
import { useThrottle } from 'flicker-vue-hooks'
|
|
|
|
|
|
|
|
const columns = [
|
|
const columns = [
|
|
@@ -175,6 +185,30 @@ const aggregationFunc = [
|
|
|
}
|
|
}
|
|
|
]
|
|
]
|
|
|
|
|
|
|
|
|
|
+const lineCloumns = [
|
|
|
|
|
+ {
|
|
|
|
|
+ title: '创建时间',
|
|
|
|
|
+ dataIndex: 'createAt',
|
|
|
|
|
+ key: 'createAt'
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ title: '连接状态',
|
|
|
|
|
+ dataIndex: 'sessionType',
|
|
|
|
|
+ key: 'sessionType'
|
|
|
|
|
+ }
|
|
|
|
|
+]
|
|
|
|
|
+
|
|
|
|
|
+const lineChartZindex = ref({
|
|
|
|
|
+ line: 1,
|
|
|
|
|
+ bar: 0
|
|
|
|
|
+})
|
|
|
|
|
+
|
|
|
|
|
+const changeChart = (chart: 'line' | 'bar') => {
|
|
|
|
|
+ if (lineChartZindex.value.line > lineChartZindex.value.bar && chart === 'line') return
|
|
|
|
|
+ if (lineChartZindex.value.line <= lineChartZindex.value.bar && chart === 'bar') return
|
|
|
|
|
+ chart === 'line' ? lineChartZindex.value.line++ : lineChartZindex.value.bar++
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
const route = useRoute()
|
|
const route = useRoute()
|
|
|
|
|
|
|
|
const activeTabKey = ref<'session' | 'attr' | 'poly'>('session')
|
|
const activeTabKey = ref<'session' | 'attr' | 'poly'>('session')
|
|
@@ -304,7 +338,6 @@ watch(
|
|
|
// 选择属性
|
|
// 选择属性
|
|
|
const selectAttr = (value: string) => {
|
|
const selectAttr = (value: string) => {
|
|
|
state.attributeKey = value
|
|
state.attributeKey = value
|
|
|
- // getDeviceAttr()
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
const search = () => {
|
|
const search = () => {
|
|
@@ -317,9 +350,13 @@ const search = () => {
|
|
|
|
|
|
|
|
// 选择设备
|
|
// 选择设备
|
|
|
const selectDevice = async (value: string) => {
|
|
const selectDevice = async (value: string) => {
|
|
|
- const device = await DeviceContriller.byId(value)
|
|
|
|
|
- state.deviceId = device.id
|
|
|
|
|
- getDeviceAttribute()
|
|
|
|
|
|
|
+ console.log('value:', value)
|
|
|
|
|
+
|
|
|
|
|
+ // const device = await DeviceContriller.byId(value)
|
|
|
|
|
+ state.deviceId = value
|
|
|
|
|
+ console.log('选择了设备')
|
|
|
|
|
+
|
|
|
|
|
+ // getDeviceAttribute()
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// 获取设备列表
|
|
// 获取设备列表
|