Showing
9 changed files
with
103 additions
and
153 deletions
configModel.ts
deleted
100644 → 0
| 1 | -import { BasicPageParams, BasicFetchResult } from '/@/api/model/baseModel'; | ||
| 2 | -/** | ||
| 3 | - * @description: Request list interface parameters | ||
| 4 | - */ | ||
| 5 | -export type MessageConfigParams = BasicPageParams & MessageParams; | ||
| 6 | - | ||
| 7 | -export type MessageParams = { | ||
| 8 | - status?: number; | ||
| 9 | - messageType?: string; | ||
| 10 | -}; | ||
| 11 | - | ||
| 12 | -export interface MessageConfig { | ||
| 13 | - id: string; | ||
| 14 | - configName: string; | ||
| 15 | - messageType: string; | ||
| 16 | - platformType: string; | ||
| 17 | - config: ConfigParams; | ||
| 18 | - createTime: string; | ||
| 19 | - updateTime: string; | ||
| 20 | - status: number; | ||
| 21 | -} | ||
| 22 | -export interface ConfigParams { | ||
| 23 | - host: string; | ||
| 24 | - port: number; | ||
| 25 | - username: string; | ||
| 26 | - password: string; | ||
| 27 | - accessKeyId: string; | ||
| 28 | - accessKeySecret: string; | ||
| 29 | -} | ||
| 30 | - | ||
| 31 | -/** | ||
| 32 | - * @description: Request list return value | ||
| 33 | - */ | ||
| 34 | -export type MessageConfigResultModel = BasicFetchResult<MessageConfig>; | ||
| 35 | - | ||
| 36 | -export type MessageConfigResult = MessageConfig; |
| @@ -82,7 +82,6 @@ | @@ -82,7 +82,6 @@ | ||
| 82 | padding-left: 7px; | 82 | padding-left: 7px; |
| 83 | cursor: pointer; | 83 | cursor: pointer; |
| 84 | transition: all 0.2s ease; | 84 | transition: all 0.2s ease; |
| 85 | - | ||
| 86 | &.light { | 85 | &.light { |
| 87 | border-bottom: 1px solid @border-color-base; | 86 | border-bottom: 1px solid @border-color-base; |
| 88 | } | 87 | } |
| 1 | <template> | 1 | <template> |
| 2 | + 123 | ||
| 2 | <div ref="chartRef" :style="{ height, width }"></div> | 3 | <div ref="chartRef" :style="{ height, width }"></div> |
| 3 | </template> | 4 | </template> |
| 4 | <script lang="ts" setup> | 5 | <script lang="ts" setup> |
| 5 | - import { ref, Ref, withDefaults, defineProps } from 'vue'; | 6 | + import { ref, Ref, withDefaults } from 'vue'; |
| 6 | import { useECharts } from '/@/hooks/web/useECharts'; | 7 | import { useECharts } from '/@/hooks/web/useECharts'; |
| 7 | 8 | ||
| 8 | interface Props { | 9 | interface Props { |
| @@ -80,7 +80,7 @@ | @@ -80,7 +80,7 @@ | ||
| 80 | </div> | 80 | </div> |
| 81 | </template> | 81 | </template> |
| 82 | <script lang="ts" setup> | 82 | <script lang="ts" setup> |
| 83 | - import { defineProps, defineExpose, ref, onMounted } from 'vue'; | 83 | + import { ref, onMounted } from 'vue'; |
| 84 | import { Card } from 'ant-design-vue'; | 84 | import { Card } from 'ant-design-vue'; |
| 85 | import { getHomeData } from '/@/api/dashboard'; | 85 | import { getHomeData } from '/@/api/dashboard'; |
| 86 | import { isAdmin } from '/@/enums/roleEnum'; | 86 | import { isAdmin } from '/@/enums/roleEnum'; |
| @@ -15,22 +15,18 @@ | @@ -15,22 +15,18 @@ | ||
| 15 | >{{ item.label }}</span | 15 | >{{ item.label }}</span |
| 16 | > | 16 | > |
| 17 | </template> | 17 | </template> |
| 18 | - <DatePicker @change="onDateChange" /> | 18 | + <DatePicker @change="onDateChange" v-model:value="dateValue" /> |
| 19 | </div> | 19 | </div> |
| 20 | </template> | 20 | </template> |
| 21 | - <div v-if="activeKey === '1'"> | 21 | + <div v-show="activeKey === '1'"> |
| 22 | <p class="center">告警数</p> | 22 | <p class="center">告警数</p> |
| 23 | <!-- 折线图 --> | 23 | <!-- 折线图 --> |
| 24 | - <VisitAnalysis v-if="!isAdmin(role)" :alarmList="state.alarmList" /> | 24 | + <VisitAnalysis :alarmList="state.alarmList" /> |
| 25 | </div> | 25 | </div> |
| 26 | - <div v-if="activeKey === '2'"> | 26 | + <div v-show="activeKey === '2'"> |
| 27 | <p class="center">消息量</p> | 27 | <p class="center">消息量</p> |
| 28 | <!-- 柱形图 --> | 28 | <!-- 柱形图 --> |
| 29 | - <VisitAnalysisBar | ||
| 30 | - v-if="!isAdmin(role)" | ||
| 31 | - :dataPointList="state.dataPointList" | ||
| 32 | - :messageList="state.messageList" | ||
| 33 | - /> | 29 | + <VisitAnalysisBar :dataPointList="state.dataPointList" :messageList="state.messageList" /> |
| 34 | </div> | 30 | </div> |
| 35 | </Card> | 31 | </Card> |
| 36 | <Card v-bind="$attrs" v-if="isAdmin(role)" title="租户趋势"> | 32 | <Card v-bind="$attrs" v-if="isAdmin(role)" title="租户趋势"> |
| @@ -73,7 +69,8 @@ | @@ -73,7 +69,8 @@ | ||
| 73 | }, | 69 | }, |
| 74 | ]; | 70 | ]; |
| 75 | // 快速选择日期 | 71 | // 快速选择日期 |
| 76 | - const activeIndex = ref(1); | 72 | + const activeIndex = ref(3); |
| 73 | + const dateValue = ref(); | ||
| 77 | const dateList = ref([ | 74 | const dateList = ref([ |
| 78 | { label: '1小时', value: 3600000 }, | 75 | { label: '1小时', value: 3600000 }, |
| 79 | { label: '1天', value: 86400000 }, | 76 | { label: '1天', value: 86400000 }, |
| @@ -82,7 +79,6 @@ | @@ -82,7 +79,6 @@ | ||
| 82 | ]); | 79 | ]); |
| 83 | // web Socket | 80 | // web Socket |
| 84 | const token: string = getAuthCache(JWT_TOKEN_KEY); | 81 | const token: string = getAuthCache(JWT_TOKEN_KEY); |
| 85 | - | ||
| 86 | const state = reactive({ | 82 | const state = reactive({ |
| 87 | server: `${import.meta.env.VITE_WEB_SOCKET}${token}`, | 83 | server: `${import.meta.env.VITE_WEB_SOCKET}${token}`, |
| 88 | alarmList: new Array<[number, string]>(), | 84 | alarmList: new Array<[number, string]>(), |
| @@ -141,7 +137,22 @@ | @@ -141,7 +137,22 @@ | ||
| 141 | }, | 137 | }, |
| 142 | ], | 138 | ], |
| 143 | }); | 139 | }); |
| 140 | + const sendValue1 = JSON.stringify({ | ||
| 141 | + entityDataCmds: [ | ||
| 142 | + { | ||
| 143 | + cmdId: activeKey.value, | ||
| 144 | + historyCmd: { | ||
| 145 | + keys: ['createdAlarmsCountHourly'], | ||
| 146 | + startTs: Date.now() - 2592000000, | ||
| 147 | + endTs: Date.now(), | ||
| 148 | + interval: 86400000, | ||
| 149 | + agg: 'COUNT', | ||
| 150 | + }, | ||
| 151 | + }, | ||
| 152 | + ], | ||
| 153 | + }); | ||
| 144 | send(sendValue); | 154 | send(sendValue); |
| 155 | + send(sendValue1); | ||
| 145 | console.log('建立连接了'); | 156 | console.log('建立连接了'); |
| 146 | }, | 157 | }, |
| 147 | onMessage(_, e) { | 158 | onMessage(_, e) { |
| @@ -199,26 +210,30 @@ | @@ -199,26 +210,30 @@ | ||
| 199 | close(); | 210 | close(); |
| 200 | }, | 211 | }, |
| 201 | }); | 212 | }); |
| 213 | + | ||
| 214 | + // 切换tab页 | ||
| 202 | function onTabChange(key: string) { | 215 | function onTabChange(key: string) { |
| 203 | activeKey.value = key; | 216 | activeKey.value = key; |
| 204 | - if (key === '1') { | ||
| 205 | - const sendAlarmValue = JSON.stringify({ | ||
| 206 | - entityDataCmds: [ | ||
| 207 | - { | ||
| 208 | - cmdId: activeKey.value, | ||
| 209 | - historyCmd: { | ||
| 210 | - keys: ['createdAlarmsCountHourly'], | ||
| 211 | - startTs: Date.now() - 86400000, | ||
| 212 | - endTs: Date.now(), | ||
| 213 | - interval: 7200000, | ||
| 214 | - limit: 12, | ||
| 215 | - agg: 'COUNT', | ||
| 216 | - }, | 217 | + activeIndex.value = 3; |
| 218 | + dateValue.value = ''; | ||
| 219 | + const sendValue = JSON.stringify({ | ||
| 220 | + entityDataCmds: [ | ||
| 221 | + { | ||
| 222 | + cmdId: activeKey.value, | ||
| 223 | + historyCmd: { | ||
| 224 | + keys: | ||
| 225 | + activeKey.value === '1' | ||
| 226 | + ? ['createdAlarmsCountHourly'] | ||
| 227 | + : ['transportMsgCountHourly', 'transportDataPointsCountHourly'], | ||
| 228 | + startTs: Date.now() - 2592000000, | ||
| 229 | + endTs: Date.now(), | ||
| 230 | + interval: 86400000, | ||
| 231 | + agg: 'COUNT', | ||
| 217 | }, | 232 | }, |
| 218 | - ], | ||
| 219 | - }); | ||
| 220 | - send(sendAlarmValue); | ||
| 221 | - } else { | 233 | + }, |
| 234 | + ], | ||
| 235 | + }); | ||
| 236 | + if (key === '2') { | ||
| 222 | const sendMessageValue = JSON.stringify({ | 237 | const sendMessageValue = JSON.stringify({ |
| 223 | entityDataCmds: [ | 238 | entityDataCmds: [ |
| 224 | { | 239 | { |
| @@ -267,24 +282,9 @@ | @@ -267,24 +282,9 @@ | ||
| 267 | }, | 282 | }, |
| 268 | ], | 283 | ], |
| 269 | }); | 284 | }); |
| 270 | - const sendMessageValue2 = JSON.stringify({ | ||
| 271 | - entityDataCmds: [ | ||
| 272 | - { | ||
| 273 | - cmdId: activeKey.value, | ||
| 274 | - historyCmd: { | ||
| 275 | - keys: ['transportMsgCountHourly', 'transportDataPointsCountHourly'], | ||
| 276 | - startTs: Date.now() - 86400000, | ||
| 277 | - endTs: Date.now(), | ||
| 278 | - interval: 7200000, | ||
| 279 | - limit: 12, | ||
| 280 | - agg: 'COUNT', | ||
| 281 | - }, | ||
| 282 | - }, | ||
| 283 | - ], | ||
| 284 | - }); | ||
| 285 | send(sendMessageValue); | 285 | send(sendMessageValue); |
| 286 | - send(sendMessageValue2); | ||
| 287 | } | 286 | } |
| 287 | + send(sendValue); | ||
| 288 | } | 288 | } |
| 289 | // 选择日期 | 289 | // 选择日期 |
| 290 | function onDateChange(_, dateString) { | 290 | function onDateChange(_, dateString) { |
| @@ -313,12 +313,14 @@ | @@ -313,12 +313,14 @@ | ||
| 313 | } | 313 | } |
| 314 | // 快速选择时间 | 314 | // 快速选择时间 |
| 315 | function quickQueryDate(index: number, value: number) { | 315 | function quickQueryDate(index: number, value: number) { |
| 316 | + if (activeIndex.value === index) return; | ||
| 316 | activeIndex.value = index; | 317 | activeIndex.value = index; |
| 317 | - let limit = 12; | ||
| 318 | - if (value === 604800000) { | ||
| 319 | - limit = 7; | ||
| 320 | - } else if (value === 2592000000) { | ||
| 321 | - limit = 30; | 318 | + dateValue.value = ''; |
| 319 | + let interval = 3600000; | ||
| 320 | + if (value === 86400000) { | ||
| 321 | + interval = 7200000; | ||
| 322 | + } else if (value === 604800000 || value === 2592000000) { | ||
| 323 | + interval = 86400000; | ||
| 322 | } | 324 | } |
| 323 | // 动态发送ws数据 | 325 | // 动态发送ws数据 |
| 324 | const sendValue = JSON.stringify({ | 326 | const sendValue = JSON.stringify({ |
| @@ -332,8 +334,7 @@ | @@ -332,8 +334,7 @@ | ||
| 332 | : ['transportMsgCountHourly', 'transportDataPointsCountHourly'], | 334 | : ['transportMsgCountHourly', 'transportDataPointsCountHourly'], |
| 333 | startTs: Date.now() - value, | 335 | startTs: Date.now() - value, |
| 334 | endTs: Date.now(), | 336 | endTs: Date.now(), |
| 335 | - interval: value > 3600000 ? 7200000 : 300000, | ||
| 336 | - limit, | 337 | + interval, |
| 337 | agg: 'COUNT', | 338 | agg: 'COUNT', |
| 338 | }, | 339 | }, |
| 339 | }, | 340 | }, |
| @@ -341,7 +342,7 @@ | @@ -341,7 +342,7 @@ | ||
| 341 | }); | 342 | }); |
| 342 | send(sendValue); | 343 | send(sendValue); |
| 343 | 344 | ||
| 344 | - console.log(value); | 345 | + console.log(JSON.parse(sendValue), '----interval'); |
| 345 | } | 346 | } |
| 346 | </script> | 347 | </script> |
| 347 | 348 |
| 1 | <template> | 1 | <template> |
| 2 | + 123 | ||
| 2 | <div ref="chartRef" :style="{ height, width }"></div> | 3 | <div ref="chartRef" :style="{ height, width }"></div> |
| 3 | </template> | 4 | </template> |
| 4 | <script lang="ts" setup> | 5 | <script lang="ts" setup> |
| 5 | - import { ref, Ref, withDefaults, defineProps } from 'vue'; | 6 | + import { ref, Ref, withDefaults } from 'vue'; |
| 6 | import { useECharts } from '/@/hooks/web/useECharts'; | 7 | import { useECharts } from '/@/hooks/web/useECharts'; |
| 7 | 8 | ||
| 8 | interface Props { | 9 | interface Props { |
| @@ -2,7 +2,7 @@ | @@ -2,7 +2,7 @@ | ||
| 2 | <div ref="chartRef" :style="{ height, width }"></div> | 2 | <div ref="chartRef" :style="{ height, width }"></div> |
| 3 | </template> | 3 | </template> |
| 4 | <script lang="ts" setup> | 4 | <script lang="ts" setup> |
| 5 | - import { onMounted, ref, Ref, withDefaults, defineProps, watch } from 'vue'; | 5 | + import { onMounted, ref, Ref, withDefaults, watch } from 'vue'; |
| 6 | import { useECharts } from '/@/hooks/web/useECharts'; | 6 | import { useECharts } from '/@/hooks/web/useECharts'; |
| 7 | 7 | ||
| 8 | interface Props { | 8 | interface Props { |
| @@ -20,43 +20,29 @@ | @@ -20,43 +20,29 @@ | ||
| 20 | const { setOptions } = useECharts(chartRef as Ref<HTMLDivElement>); | 20 | const { setOptions } = useECharts(chartRef as Ref<HTMLDivElement>); |
| 21 | 21 | ||
| 22 | onMounted(() => { | 22 | onMounted(() => { |
| 23 | - console.log(props.alarmList); | ||
| 24 | setOptions({ | 23 | setOptions({ |
| 25 | tooltip: { | 24 | tooltip: { |
| 26 | trigger: 'axis', | 25 | trigger: 'axis', |
| 27 | - axisPointer: { | ||
| 28 | - lineStyle: { | ||
| 29 | - width: 1, | ||
| 30 | - color: '#019680', | ||
| 31 | - }, | ||
| 32 | - }, | ||
| 33 | }, | 26 | }, |
| 27 | + grid: { | ||
| 28 | + left: '3%', | ||
| 29 | + right: '4%', | ||
| 30 | + bottom: '3%', | ||
| 31 | + containLabel: true, | ||
| 32 | + }, | ||
| 33 | + | ||
| 34 | xAxis: { | 34 | xAxis: { |
| 35 | type: 'time', | 35 | type: 'time', |
| 36 | - boundaryGap: false, | ||
| 37 | - splitLine: { | ||
| 38 | - show: true, | ||
| 39 | - lineStyle: { | ||
| 40 | - width: 1, | ||
| 41 | - type: 'solid', | ||
| 42 | - color: 'rgba(226,226,226,0.5)', | ||
| 43 | - }, | ||
| 44 | - }, | ||
| 45 | - axisTick: { | ||
| 46 | - show: false, | ||
| 47 | - }, | ||
| 48 | }, | 36 | }, |
| 49 | - yAxis: {}, | ||
| 50 | - grid: { left: '1%', right: '1%', top: '2 %', bottom: 0, containLabel: true }, | 37 | + yAxis: { |
| 38 | + type: 'value', | ||
| 39 | + }, | ||
| 51 | series: [ | 40 | series: [ |
| 52 | { | 41 | { |
| 53 | - smooth: true, | 42 | + name: '告警数', |
| 43 | + type: 'bar', | ||
| 44 | + stack: 'Total', | ||
| 54 | data: props.alarmList, | 45 | data: props.alarmList, |
| 55 | - type: 'line', | ||
| 56 | - areaStyle: {}, | ||
| 57 | - itemStyle: { | ||
| 58 | - color: '#5ab1ef', | ||
| 59 | - }, | ||
| 60 | }, | 46 | }, |
| 61 | ], | 47 | ], |
| 62 | }); | 48 | }); |
| @@ -68,39 +54,26 @@ | @@ -68,39 +54,26 @@ | ||
| 68 | setOptions({ | 54 | setOptions({ |
| 69 | tooltip: { | 55 | tooltip: { |
| 70 | trigger: 'axis', | 56 | trigger: 'axis', |
| 71 | - axisPointer: { | ||
| 72 | - lineStyle: { | ||
| 73 | - width: 1, | ||
| 74 | - color: '#019680', | ||
| 75 | - }, | ||
| 76 | - }, | ||
| 77 | }, | 57 | }, |
| 58 | + grid: { | ||
| 59 | + left: '3%', | ||
| 60 | + right: '4%', | ||
| 61 | + bottom: '3%', | ||
| 62 | + containLabel: true, | ||
| 63 | + }, | ||
| 64 | + | ||
| 78 | xAxis: { | 65 | xAxis: { |
| 79 | type: 'time', | 66 | type: 'time', |
| 80 | - boundaryGap: false, | ||
| 81 | - splitLine: { | ||
| 82 | - show: true, | ||
| 83 | - lineStyle: { | ||
| 84 | - width: 1, | ||
| 85 | - type: 'solid', | ||
| 86 | - color: 'rgba(226,226,226,0.5)', | ||
| 87 | - }, | ||
| 88 | - }, | ||
| 89 | - axisTick: { | ||
| 90 | - show: false, | ||
| 91 | - }, | ||
| 92 | }, | 67 | }, |
| 93 | - yAxis: {}, | ||
| 94 | - grid: { left: '1%', right: '1%', top: '2 %', bottom: 0, containLabel: true }, | 68 | + yAxis: { |
| 69 | + type: 'value', | ||
| 70 | + }, | ||
| 95 | series: [ | 71 | series: [ |
| 96 | { | 72 | { |
| 97 | - smooth: true, | 73 | + name: '告警数', |
| 74 | + type: 'bar', | ||
| 75 | + stack: 'Total', | ||
| 98 | data: newValue, | 76 | data: newValue, |
| 99 | - type: 'line', | ||
| 100 | - areaStyle: {}, | ||
| 101 | - itemStyle: { | ||
| 102 | - color: '#5ab1ef', | ||
| 103 | - }, | ||
| 104 | }, | 77 | }, |
| 105 | ], | 78 | ], |
| 106 | }); | 79 | }); |
| @@ -2,7 +2,7 @@ | @@ -2,7 +2,7 @@ | ||
| 2 | <div ref="chartRef" :style="{ height, width }"></div> | 2 | <div ref="chartRef" :style="{ height, width }"></div> |
| 3 | </template> | 3 | </template> |
| 4 | <script lang="ts" setup> | 4 | <script lang="ts" setup> |
| 5 | - import { ref, Ref, watch, withDefaults, defineProps } from 'vue'; | 5 | + import { ref, Ref, watch, withDefaults } from 'vue'; |
| 6 | import { useECharts } from '/@/hooks/web/useECharts'; | 6 | import { useECharts } from '/@/hooks/web/useECharts'; |
| 7 | type DataItem = [number, string]; | 7 | type DataItem = [number, string]; |
| 8 | interface Props { | 8 | interface Props { |
| @@ -38,21 +38,25 @@ | @@ -38,21 +38,25 @@ | ||
| 38 | }, | 38 | }, |
| 39 | yAxis: {}, | 39 | yAxis: {}, |
| 40 | grid: { | 40 | grid: { |
| 41 | - bottom: 100, | 41 | + left: '3%', |
| 42 | + right: '4%', | ||
| 43 | + bottom: '3%', | ||
| 44 | + containLabel: true, | ||
| 42 | }, | 45 | }, |
| 43 | series: [ | 46 | series: [ |
| 44 | { | 47 | { |
| 45 | - name: '传输数据点', | 48 | + name: '传输消息量', |
| 46 | type: 'bar', | 49 | type: 'bar', |
| 47 | stack: 'total', | 50 | stack: 'total', |
| 48 | - data: newValue, | 51 | + data: newValue1, |
| 52 | + color: '#5c7bd9', | ||
| 49 | }, | 53 | }, |
| 50 | { | 54 | { |
| 51 | - name: '传输消息量', | 55 | + name: '传输数据点', |
| 52 | type: 'bar', | 56 | type: 'bar', |
| 53 | stack: 'total', | 57 | stack: 'total', |
| 54 | - | ||
| 55 | - data: newValue1, | 58 | + data: newValue, |
| 59 | + color: '#9fe080', | ||
| 56 | }, | 60 | }, |
| 57 | ], | 61 | ], |
| 58 | }); | 62 | }); |
| @@ -44,6 +44,13 @@ | @@ -44,6 +44,13 @@ | ||
| 44 | labelWidth: 120, | 44 | labelWidth: 120, |
| 45 | schemas: alarmSearchSchemas, | 45 | schemas: alarmSearchSchemas, |
| 46 | }, | 46 | }, |
| 47 | + showTableSetting: true, | ||
| 48 | + tableSetting: { | ||
| 49 | + redo: true, | ||
| 50 | + size: false, | ||
| 51 | + setting: false, | ||
| 52 | + fullScreen: false, | ||
| 53 | + }, | ||
| 47 | useSearchForm: true, | 54 | useSearchForm: true, |
| 48 | bordered: true, | 55 | bordered: true, |
| 49 | showIndexColumn: false, | 56 | showIndexColumn: false, |