1
|
|
-<template>
|
2
|
|
- <view class="index-page">
|
3
|
|
- <!-- 公共组件-每个页面必须引入 -->
|
4
|
|
- <public-module></public-module>
|
5
|
|
- <view>
|
6
|
|
- <!-- 基础统计 -->
|
7
|
|
- <view class="basic-sty">
|
8
|
|
- <view class="basic-text"><text class="text text-bold">基础统计</text></view>
|
9
|
|
- <view class="basic">
|
10
|
|
- <view class="basic-item">
|
11
|
|
- <view class="item-child-top u-flex">
|
12
|
|
- <image class="item-image" src="../../static/device-total.png"></image>
|
13
|
|
- <text class="item-text home-text-muted">设备统计</text>
|
14
|
|
- </view>
|
15
|
|
- <view class="item-child-bottom u-flex">
|
16
|
|
- <view @click="navigatorDeviceStatus('ONLINE')" class="u-flex sigle-child">
|
17
|
|
- <view class="sigle-text">
|
18
|
|
- <text class="home-text-total">{{ deviceData.onLine }}</text>
|
19
|
|
- </view>
|
20
|
|
- <view class="sigle-value"><text class="home-text-total-bottom">在线</text></view>
|
21
|
|
- </view>
|
22
|
|
- <view @click="navigatorDeviceStatus('OFFLINE')" class="u-flex sigle-child">
|
23
|
|
- <view class="sigle-text">
|
24
|
|
- <text class="home-text-total">{{ deviceData.offLine }}</text>
|
25
|
|
- </view>
|
26
|
|
- <view class="sigle-value"><text class="home-text-total-bottom">离线</text></view>
|
27
|
|
- </view>
|
28
|
|
- <view @click="navigatorDeviceStatus('INACTIVE')" class="u-flex sigle-child">
|
29
|
|
- <view class="sigle-text">
|
30
|
|
- <text class="home-text-total">{{ deviceData.inActive }}</text>
|
31
|
|
- </view>
|
32
|
|
- <view class="sigle-value"><text class="home-text-total-bottom">待激活</text></view>
|
33
|
|
- </view>
|
34
|
|
- </view>
|
35
|
|
- </view>
|
36
|
|
- <view class="basic-item">
|
37
|
|
- <view class="item-child-top u-flex">
|
38
|
|
- <image class="item-image" src="../../static/alert.png"></image>
|
39
|
|
- <text class="item-text home-text-muted">告警统计</text>
|
40
|
|
- </view>
|
41
|
|
- <view class="item-child-bottom u-flex">
|
42
|
|
- <view @click="navigatorAlarmStatus(['ACTIVE_UNACK'])"
|
43
|
|
- class="u-flex sigle-child">
|
44
|
|
- <view class="sigle-text">
|
45
|
|
- <text class="home-text-total">{{ alertData.activedAlarm }}</text>
|
46
|
|
- </view>
|
47
|
|
- <view class="sigle-value"><text class="home-text-total-bottom">未处理</text></view>
|
48
|
|
- </view>
|
49
|
|
- <view @click="navigatorAlarmStatus('CLEARED_ACK')" class="u-flex sigle-child">
|
50
|
|
- <view class="sigle-text">
|
51
|
|
- <text class="home-text-total">{{ alertData.clearedAck }}</text>
|
52
|
|
- </view>
|
53
|
|
- <view class="sigle-value"><text class="home-text-total-bottom">已处理</text></view>
|
54
|
|
- </view>
|
55
|
|
- <view @click="navigatorAlarmStatus('CLEARED_UNACK')" class="u-flex sigle-child">
|
56
|
|
- <view class="sigle-text">
|
57
|
|
- <text class="home-text-total">{{ alertData.clearedUnack }}</text>
|
58
|
|
- </view>
|
59
|
|
- <view class="sigle-value"><text class="home-text-total-bottom">误报</text></view>
|
60
|
|
- </view>
|
61
|
|
- </view>
|
62
|
|
- </view>
|
63
|
|
- </view>
|
64
|
|
- </view>
|
65
|
|
- <!-- 基础统计 -->
|
66
|
|
- <!-- 四宫格CSS最新网格布局-->
|
67
|
|
- <view class="grid-container">
|
68
|
|
- <!-- <view class="grid-item" @click="showToastWip()">
|
69
|
|
- <view class="item-center">
|
70
|
|
- <view class="center"><image class="image" src="../../static/form.png"></image></view>
|
71
|
|
- <view class="center-text"><text class="text text-muted">维修工单</text></view>
|
72
|
|
- </view>
|
73
|
|
- </view> -->
|
74
|
|
- <view @click="openCamera" class="grid-item">
|
75
|
|
- <view class="item-center">
|
76
|
|
- <view class="center">
|
77
|
|
- <image class="image" src="../../static/camer.png"></image>
|
78
|
|
- </view>
|
79
|
|
- <view class="center-text"><text class="text text-muted" style="">摄像头管理</text></view>
|
80
|
|
- </view>
|
81
|
|
- </view>
|
82
|
|
- <!-- <view class="grid-item" @click="showToastWip()">
|
83
|
|
- <view class="item-center">
|
84
|
|
- <view class="center"><image class="image" src="../../static/device.png"></image></view>
|
85
|
|
- <view class="center-text"><text class="text text-muted">设备接入</text></view>
|
86
|
|
- </view>
|
87
|
|
- </view> -->
|
88
|
|
- <view @click="openOrgStatus" class="grid-item">
|
89
|
|
- <view class="item-center">
|
90
|
|
- <view class="center">
|
91
|
|
- <image class="image" src="../../static/status.png"></image>
|
92
|
|
- </view>
|
93
|
|
- <view class="center-text"><text class="text text-muted">组态</text></view>
|
94
|
|
- </view>
|
95
|
|
- </view>
|
96
|
|
- </view>
|
97
|
|
- <!-- 四宫格 -->
|
98
|
|
- </view>
|
99
|
|
- <f-tabbar></f-tabbar>
|
100
|
|
- </view>
|
101
|
|
-</template>
|
102
|
|
-
|
103
|
|
-<script>
|
104
|
|
- import fTabbar from '@/components/module/f-tabbar/f-tabbar';
|
105
|
|
- import {
|
106
|
|
- mapActions
|
107
|
|
- } from 'vuex';
|
|
1
|
+<template>
|
|
2
|
+ <view class="index-page">
|
|
3
|
+ <!-- 公共组件-每个页面必须引入 -->
|
|
4
|
+ <public-module></public-module>
|
|
5
|
+ <view>
|
|
6
|
+ <!-- 基础统计 -->
|
|
7
|
+ <view class="basic-sty">
|
|
8
|
+ <view class="basic-text"><text class="text text-bold">基础统计</text></view>
|
|
9
|
+ <view class="basic">
|
|
10
|
+ <view class="basic-item" v-for="(item,index) in basicStatistics" :key="index">
|
|
11
|
+ <view class="item-child-top u-flex">
|
|
12
|
+ <image class="item-image" :src="item.icon"></image>
|
|
13
|
+ <text class="item-text home-text-muted">{{item.text}}</text>
|
|
14
|
+ </view>
|
|
15
|
+ <view class="item-child-bottom u-flex">
|
|
16
|
+ <view @click="navigatorPage(item,item.leftParam)" class="u-flex sigle-child">
|
|
17
|
+ <view class="sigle-text">
|
|
18
|
+ <text class="home-text-total">{{item.value.leftValue}}</text>
|
|
19
|
+ </view>
|
|
20
|
+ <view class="sigle-value"><text
|
|
21
|
+ class="home-text-total-bottom">{{item.label.leftText}}</text></view>
|
|
22
|
+ </view>
|
|
23
|
+ <view @click="navigatorPage(item,item.centerParam)" class="u-flex sigle-child">
|
|
24
|
+ <view class="sigle-text">
|
|
25
|
+ <text class="home-text-total">{{item.value.centerValue}}</text>
|
|
26
|
+ </view>
|
|
27
|
+ <view class="sigle-value"><text
|
|
28
|
+ class="home-text-total-bottom">{{item.label.centerText}}</text></view>
|
|
29
|
+ </view>
|
|
30
|
+ <view @click="navigatorPage(item,item.rightParam)" class="u-flex sigle-child">
|
|
31
|
+ <view class="sigle-text">
|
|
32
|
+ <text class="home-text-total">{{item.value.rightrValue}}</text>
|
|
33
|
+ </view>
|
|
34
|
+ <view class="sigle-value"><text
|
|
35
|
+ class="home-text-total-bottom">{{item.label.rightText}}</text></view>
|
|
36
|
+ </view>
|
|
37
|
+ </view>
|
|
38
|
+ </view>
|
|
39
|
+ </view>
|
|
40
|
+ </view>
|
|
41
|
+ <!-- 网格信息 -->
|
|
42
|
+ <view class="grid-container">
|
|
43
|
+ <view v-for="(item,index) in basicGridList" :key="index" @click="handleEvent(item.event)"
|
|
44
|
+ class="grid-item">
|
|
45
|
+ <view class="item-center">
|
|
46
|
+ <view class="center">
|
|
47
|
+ <image class="image" :src="item.icon"></image>
|
|
48
|
+ </view>
|
|
49
|
+ <view class="center-text"><text class="text text-muted" style="">{{item.text}}</text></view>
|
|
50
|
+ </view>
|
|
51
|
+ </view>
|
|
52
|
+ </view>
|
|
53
|
+ </view>
|
|
54
|
+ <f-tabbar></f-tabbar>
|
|
55
|
+ </view>
|
|
56
|
+</template>
|
|
57
|
+
|
|
58
|
+<script>
|
|
59
|
+ import fTabbar from '@/components/module/f-tabbar/f-tabbar';
|
|
60
|
+ import {
|
|
61
|
+ mapActions
|
|
62
|
+ } from 'vuex';
|
108
|
63
|
import api from '@/api/index.js'
|
109
|
|
- import { useNavigateTo } from '@/plugins/utils.js'
|
110
|
|
-
|
111
|
|
- export default {
|
112
|
|
- components: {
|
113
|
|
- fTabbar
|
114
|
|
- },
|
115
|
|
- data() {
|
116
|
|
- return {
|
117
|
|
- deviceData: {
|
118
|
|
- onLine: 0,
|
119
|
|
- offLine: 0,
|
120
|
|
- inActive: 0
|
121
|
|
- },
|
122
|
|
- alertData: {
|
123
|
|
- activedAlarm: 0,
|
124
|
|
- clearedAck: 0,
|
125
|
|
- clearedUnack: 0
|
126
|
|
- }
|
127
|
|
- };
|
128
|
|
- },
|
129
|
|
- onLoad() {
|
130
|
|
- // 隐藏原生的tabbar
|
131
|
|
- uni.hideTabBar();
|
132
|
|
- if(getApp().getBindNot()){
|
133
|
|
- return
|
134
|
|
- }
|
135
|
|
- this.getDeviceTotalData();
|
136
|
|
- uni.setStorageSync('getConfiguration', {
|
137
|
|
- isConfiguration: false
|
138
|
|
- });
|
139
|
|
- uni.removeStorageSync('getConfiguration');
|
|
64
|
+ import {
|
|
65
|
+ useNavigateTo
|
|
66
|
+ } from '@/plugins/utils.js'
|
|
67
|
+
|
|
68
|
+ export default {
|
|
69
|
+ components: {
|
|
70
|
+ fTabbar
|
|
71
|
+ },
|
|
72
|
+ data() {
|
|
73
|
+ return {
|
|
74
|
+ basicGridList: [{
|
|
75
|
+ event: 'openCamera',
|
|
76
|
+ icon: '/static/camer.png',
|
|
77
|
+ text: '摄像头管理'
|
|
78
|
+ },
|
|
79
|
+ {
|
|
80
|
+ event: 'openConfiguration',
|
|
81
|
+ icon: '/static/status.png',
|
|
82
|
+ text: '组态'
|
|
83
|
+ },
|
|
84
|
+ ],
|
|
85
|
+ basicStatistics: [{
|
|
86
|
+ text: '设备统计',
|
|
87
|
+ icon: '/static/device-total.png',
|
|
88
|
+ leftParam: 'ONLINE',
|
|
89
|
+ centerParam: 'OFFLINE',
|
|
90
|
+ rightParam: 'INACTIVE',
|
|
91
|
+ value: {
|
|
92
|
+ leftValue: 0,
|
|
93
|
+ centerValue: 0,
|
|
94
|
+ rightrValue: 0
|
|
95
|
+ },
|
|
96
|
+ label: {
|
|
97
|
+ leftText: "在线",
|
|
98
|
+ centerText: "离线",
|
|
99
|
+ rightText: "待激活"
|
|
100
|
+ }
|
|
101
|
+ },
|
|
102
|
+ {
|
|
103
|
+ text: '告警统计',
|
|
104
|
+ icon: '/static/alert.png',
|
|
105
|
+ leftParam: ['ACTIVE_UNACK'],
|
|
106
|
+ centerParam: 'CLEARED_ACK',
|
|
107
|
+ rightParam: 'CLEARED_UNACK',
|
|
108
|
+ value: {
|
|
109
|
+ leftValue: 0,
|
|
110
|
+ centerValue: 0,
|
|
111
|
+ rightrValue: 0
|
|
112
|
+ },
|
|
113
|
+ label: {
|
|
114
|
+ leftText: "未处理",
|
|
115
|
+ centerText: "已处理",
|
|
116
|
+ rightText: "误报"
|
|
117
|
+ }
|
|
118
|
+ },
|
|
119
|
+ ]
|
|
120
|
+ };
|
|
121
|
+ },
|
|
122
|
+ onLoad() {
|
|
123
|
+ // 隐藏原生的tabbar
|
|
124
|
+ uni.hideTabBar();
|
|
125
|
+ if (getApp().getBindNot()) {
|
|
126
|
+ return
|
|
127
|
+ }
|
|
128
|
+ this.getDeviceTotalData();
|
|
129
|
+ uni.setStorageSync('getConfiguration', {
|
|
130
|
+ isConfiguration: false
|
|
131
|
+ });
|
|
132
|
+ uni.removeStorageSync('getConfiguration');
|
140
|
133
|
},
|
141
|
134
|
onPullDownRefresh() {
|
142
|
135
|
this.getDeviceTotalData();
|
143
|
|
- setTimeout(function () {
|
|
136
|
+ setTimeout(function() {
|
144
|
137
|
uni.stopPullDownRefresh();
|
145
|
138
|
uni.$u.toast('下拉刷新成功...');
|
146
|
|
- }, 1000);
|
147
|
|
- },
|
148
|
|
- methods: {
|
149
|
|
- ...mapActions(['updateBadgeTotal']),
|
150
|
|
- async getDeviceTotalData() {
|
151
|
|
- const res = await api.homeApi.getHomeStatisticsApi()
|
|
139
|
+ }, 800);
|
|
140
|
+ },
|
|
141
|
+ methods: {
|
|
142
|
+ ...mapActions(['updateBadgeTotal']),
|
|
143
|
+ async getDeviceTotalData() {
|
|
144
|
+ const res = await api.homeApi.getHomeStatisticsApi()
|
152
|
145
|
if (res) {
|
153
|
|
- for(let i in this.deviceData) Reflect.set(this.deviceData,i,res.totalDevice[i])
|
154
|
|
- for(let i in this.alertData) Reflect.set(this.alertData,i,res.totalAlarm[i])
|
155
|
|
- //异步实时更新告警徽标数
|
156
|
|
- this.updateBadgeTotal(res.totalAlarm?.activedAlarm);
|
157
|
|
- }
|
158
|
|
- },
|
159
|
|
- showToastWip() {
|
160
|
|
- uni.$u.toast('拼命开发中 ...');
|
161
|
|
- },
|
|
146
|
+ this.basicStatistics[0].value.leftValue = res.totalDevice.onLine
|
|
147
|
+ this.basicStatistics[0].value.centerValue = res.totalDevice.offLine
|
|
148
|
+ this.basicStatistics[0].value.rightrValue = res.totalDevice.inActive
|
|
149
|
+ this.basicStatistics[1].value.leftValue = res.totalAlarm.activedAlarm
|
|
150
|
+ this.basicStatistics[1].value.centerValue = res.totalAlarm.clearedAck
|
|
151
|
+ this.basicStatistics[1].value.rightrValue = res.totalAlarm.clearedUnack
|
|
152
|
+ //异步实时更新告警徽标数
|
|
153
|
+ this.updateBadgeTotal(res.totalAlarm?.activedAlarm);
|
|
154
|
+ }
|
|
155
|
+ },
|
162
|
156
|
openCamera() {
|
163
|
|
- useNavigateTo('camera/camera')
|
164
|
|
- },
|
165
|
|
- openOrgStatus() {
|
166
|
|
- useNavigateTo('configuration/configuration')
|
167
|
|
- },
|
168
|
|
- //告警状态查询
|
169
|
|
- navigatorAlarmStatus(e) {
|
170
|
|
- uni.reLaunch({
|
171
|
|
- url: '../alarm/alarm?type=' + JSON.stringify(e)
|
172
|
|
- });
|
173
|
|
- },
|
174
|
|
- //设备状态查询
|
175
|
|
- navigatorDeviceStatus(e) {
|
176
|
|
- uni.reLaunch({
|
177
|
|
- url: `../device/device?deviceState=${e}`
|
178
|
|
- });
|
179
|
|
- }
|
180
|
|
- }
|
181
|
|
- };
|
182
|
|
-</script>
|
183
|
|
-
|
184
|
|
-<style lang="scss" scoped>
|
185
|
|
- @import './static/index.scss';
|
186
|
|
-</style> |
|
157
|
+ useNavigateTo('camera/camera')
|
|
158
|
+ },
|
|
159
|
+ openConfiguration() {
|
|
160
|
+ useNavigateTo('configuration/configuration')
|
|
161
|
+ },
|
|
162
|
+ handleEvent(event) {
|
|
163
|
+ if (event === 'openCamera') {
|
|
164
|
+ this.openCamera()
|
|
165
|
+ } else {
|
|
166
|
+ this.openConfiguration()
|
|
167
|
+ }
|
|
168
|
+ },
|
|
169
|
+ navigatorPage(item, type) {
|
|
170
|
+ const {
|
|
171
|
+ text
|
|
172
|
+ } = item
|
|
173
|
+ if (text === '设备统计') {
|
|
174
|
+ this.navigatorDeviceStatus(type)
|
|
175
|
+ } else {
|
|
176
|
+ this.navigatorAlarmStatus(type)
|
|
177
|
+ }
|
|
178
|
+ },
|
|
179
|
+ //告警状态查询
|
|
180
|
+ navigatorAlarmStatus(e) {
|
|
181
|
+ uni.reLaunch({
|
|
182
|
+ url: '../alarm/alarm?type=' + JSON.stringify(e)
|
|
183
|
+ });
|
|
184
|
+ },
|
|
185
|
+ //设备状态查询
|
|
186
|
+ navigatorDeviceStatus(e) {
|
|
187
|
+ uni.reLaunch({
|
|
188
|
+ url: `../device/device?deviceState=${e}`
|
|
189
|
+ });
|
|
190
|
+ }
|
|
191
|
+ }
|
|
192
|
+ };
|
|
193
|
+</script>
|
|
194
|
+
|
|
195
|
+<style lang="scss" scoped>
|
|
196
|
+ @import './static/index.scss';
|
|
197
|
+</style> |
|
|
\ No newline at end of file |
...
|
...
|
|