1
|
-<template>
|
|
|
2
|
- <view class="device-page">
|
|
|
3
|
- <f-navbar>
|
|
|
4
|
- <view class="u-flex" slot="left" style="justify-content: space-between;flex-direction: row;">
|
|
|
5
|
- <view style="width: 580rpx;"><u--input prefixIcon="search" placeholder="输入设备SN或名称搜索" border="surround" shape="circle"></u--input></view>
|
|
|
6
|
- <view style="margin-left: 7rpx;">
|
|
|
7
|
- <view class=""><text style="color:#333333;font-size: 14px;">筛选</text></view>
|
|
|
8
|
- </view>
|
|
|
9
|
- <view style="margin-left: 7rpx;"><image @click="openSearchDialog" style="width: 40rpx;height: 40rpx;" src="../../static/shaixuan.png" mode=""></image></view>
|
|
|
10
|
- </view>
|
|
|
11
|
- </f-navbar>
|
|
|
12
|
- <!-- 公共组件-每个页面必须引入 -->
|
|
|
13
|
- <public-module></public-module>
|
|
|
14
|
- <view class="org-sty">
|
|
|
15
|
- <view class="org-item">
|
|
|
16
|
- <view class="u-flex" style="flex-direction: row;margin-top: 26rpx;margin-left: 15rpx;">
|
|
|
17
|
- <text style="color:#333333;font-size: 15px;margin-left: 14rpx;">组织关系</text>
|
|
|
18
|
- </view>
|
|
|
19
|
- <view style="margin-top: 5rpx;margin-left: 15rpx;flex-direction: row;" class="u-flex">
|
|
|
20
|
- <image style="margin-left: 14rpx;width: 30rpx;height: 30rpx;" src="../../static/org.png" mode=""></image>
|
|
|
21
|
- <text style="margin-left: 10rpx;color:#666666;font-size: 12px;">设备数:1234</text>
|
|
|
22
|
- </view>
|
|
|
23
|
- </view>
|
|
|
24
|
- <view class="org-item" style="">
|
|
|
25
|
- <image @click="openOrg" style="width: 6px;height: 10px;float: right; margin-right: 34rpx; margin-top: 58rpx;" src="../../static/right-arrow.png" mode=""></image>
|
|
|
26
|
- </view>
|
|
|
27
|
- </view>
|
|
|
28
|
- <mescroll-body ref="mescrollRef" @init="mescrollInit" :down="downOption" @down="downCallback" @up="upCallback">
|
|
|
29
|
- <view class="device-list">
|
|
|
30
|
- <view @click="openDeviceDetail(item.id)" class="list-item" v-for="(item, index) in list" :key="index">
|
|
|
31
|
- <view class="u-flex item" style="justify-content: flex-start;flex-direction: column;align-items: center;">
|
|
|
32
|
- <view style="width: 450rpx;text-align: left;">
|
|
|
33
|
- <text style="color:#333333;font-size: 15px;">{{ item.name1 }}</text>
|
|
|
34
|
- </view>
|
|
|
35
|
- <view style="width: 450rpx;text-align: left;">
|
|
|
36
|
- <text style="color:#666666;font-size: 15px;">{{ item.name2 }}</text>
|
|
|
37
|
- </view>
|
|
|
38
|
- <view style="width: 450rpx;text-align: left;">
|
|
|
39
|
- <text style="color:#666666;font-size: 15px;">{{ item.name3 }}</text>
|
|
|
40
|
- </view>
|
|
|
41
|
- </view>
|
|
|
42
|
- <view class="item">
|
|
|
43
|
- <view class="u-flex" style="flex-direction: row;margin-top: -6rpx;">
|
|
|
44
|
- <image style="width: 30rpx;height: 30rpx;margin-top: 5rpx;margin-right: 5rpx;" :src="item.name4" mode=""></image>
|
|
|
45
|
- <view class="">
|
|
|
46
|
- <text style="color: #377DFF;font-size: 13px;margin-left: 5rpx;margin-top: 20rpx;">{{ item.name5 }}</text>
|
|
|
47
|
- </view>
|
|
|
48
|
- </view>
|
|
|
49
|
- </view>
|
|
|
50
|
- </view>
|
|
|
51
|
- </view>
|
|
|
52
|
- </mescroll-body>
|
|
|
53
|
- <view style="height: 30rpx;"></view>
|
|
|
54
|
- <!-- 设备筛选 -->
|
|
|
55
|
- <u-popup @close="close" closeable bgColor="transparent" :overlay="true" :show="show" mode="bottom">
|
|
|
56
|
- <view style="height: 900rpx;background:#f5f5f5;border-radius: 20rpx;">
|
|
|
57
|
- <view style="text-align: center;position: relative;top: 68rpx;margin-top: -40rpx;"><text style="font-size: 16px;color: #333333;">筛选条件</text></view>
|
|
|
58
|
- <view style="margin-top: 97rpx;margin-left: 43rpx;">
|
|
|
59
|
- <view style="width: 750rpx;margin-left: 14rpx;" class=""><text style="color: #333333;font-size: 14px;">设备状态</text></view>
|
|
|
60
|
- <view
|
|
|
61
|
- class="u-flex"
|
|
|
62
|
- style="margin-top: 15rpx;width:650rpx;height: 60rpx;flex-direction: row;
|
|
|
63
|
- flex-wrap: wrap;justify-content: space-between; align-content: space-between;"
|
|
|
64
|
- >
|
|
|
65
|
- <view
|
|
|
66
|
- v-for="(item, index) in deviceStatus"
|
|
|
67
|
- :key="index"
|
|
|
68
|
- style="margin: 10rpx;line-height: 45rpx;text-align: center;
|
|
|
69
|
- width:180rpx;height: 60rpx;
|
|
|
70
|
- border: 0.02px solid rgba(55, 125, 255, 0.3);
|
|
|
71
|
- background-color:#F6F6F6;border-radius:32px"
|
|
|
72
|
- >
|
|
|
73
|
- <text style="color:#333333;font-size: 13px;">{{ item.name }}</text>
|
|
|
74
|
- </view>
|
|
|
75
|
- </view>
|
|
|
76
|
- </view>
|
|
|
77
|
- <view style="margin-top: 145rpx;margin-left: 43rpx;">
|
|
|
78
|
- <view style="width: 750rpx;margin-left: 14rpx;" class=""><text style="color: #333333;font-size: 14px;">告警状态</text></view>
|
|
|
79
|
- <view
|
|
|
80
|
- class="u-flex"
|
|
|
81
|
- style="margin-top: 15rpx;width:650rpx;height: 60rpx;flex-direction: row;
|
|
|
82
|
- flex-wrap: wrap;justify-content: space-between; align-content: space-between;"
|
|
|
83
|
- >
|
|
|
84
|
- <view
|
|
|
85
|
- v-for="(item, index) in alertStatus"
|
|
|
86
|
- :key="index"
|
|
|
87
|
- style="margin: 10rpx;line-height: 45rpx;text-align: center;
|
|
|
88
|
- width:180rpx;height: 60rpx;
|
|
|
89
|
- border: 0.02px solid rgba(55, 125, 255, 0.3);
|
|
|
90
|
- background-color:#F6F6F6;border-radius:32px"
|
|
|
91
|
- >
|
|
|
92
|
- <text style="color:#333333;font-size: 13px;">{{ item.name }}</text>
|
|
|
93
|
- </view>
|
|
|
94
|
- </view>
|
|
|
95
|
- </view>
|
|
|
96
|
- <view style="margin-top: 66rpx;margin-left: 43rpx;">
|
|
|
97
|
- <view style="width: 750rpx;margin-left: 14rpx;" class=""><text style="color: #333333;font-size: 14px;">设备类型</text></view>
|
|
|
98
|
- <view
|
|
|
99
|
- class="u-flex"
|
|
|
100
|
- style="margin-top: 15rpx;width:650rpx;height: 60rpx;flex-direction: row;
|
|
|
101
|
- flex-wrap: wrap;justify-content: space-between; align-content: space-between;"
|
|
|
102
|
- >
|
|
|
103
|
- <view
|
|
|
104
|
- v-for="(item, index) in typeStatus"
|
|
|
105
|
- :key="index"
|
|
|
106
|
- style="margin: 10rpx;line-height: 45rpx;text-align: center;
|
|
|
107
|
- width:180rpx;height: 60rpx;
|
|
|
108
|
- border: 0.02px solid rgba(55, 125, 255, 0.3);
|
|
|
109
|
- background-color:#F6F6F6;border-radius:32px"
|
|
|
110
|
- >
|
|
|
111
|
- <text style="color:#333333;font-size: 13px;">{{ item.name }}</text>
|
|
|
112
|
- </view>
|
|
|
113
|
- </view>
|
|
|
114
|
- </view>
|
|
|
115
|
- <view class="u-flex" style="flex-direction: row;margin-top: 128rpx;margin-left: 55rpx;">
|
|
|
116
|
- <view style="width: 300rpx"><u-button type="info" shape="circle" text="重置"></u-button></view>
|
|
|
117
|
- <view style="width: 300rpx;margin-left:46rpx ;"><u-button type="success" shape="circle" text="确认"></u-button></view>
|
|
|
118
|
- </view>
|
|
|
119
|
- </view>
|
|
|
120
|
- </u-popup>
|
|
|
121
|
- <f-tabbar></f-tabbar>
|
|
|
122
|
- </view>
|
|
|
123
|
-</template>
|
|
|
124
|
-
|
|
|
125
|
-<script>
|
|
|
126
|
-import fTabbar from '@/components/module/f-tabbar/f-tabbar';
|
|
|
127
|
-import fNavbar from '@/components/module/f-navbar/f-navbar';
|
|
|
128
|
-import MescrollMixin from "@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js";
|
|
|
129
|
-
|
|
|
130
|
-export default {
|
|
|
131
|
- mixins: [MescrollMixin], // 使用mixin (在main.js注册全局组件)
|
|
|
132
|
- components: {
|
|
|
133
|
- fTabbar,
|
|
|
134
|
- fNavbar
|
|
|
135
|
- },
|
|
|
136
|
- data() {
|
|
|
137
|
- return {
|
|
|
138
|
- downOption: {
|
|
|
139
|
- auto: false //是否在初始化后,自动执行downCallback; 默认true
|
|
|
140
|
- },
|
|
|
141
|
- show: false,
|
|
|
142
|
- deviceStatus: [
|
|
|
143
|
- {
|
|
|
144
|
- index: 1,
|
|
|
145
|
- name: '全部',
|
|
|
146
|
- bgColor: '#377DFF',
|
|
|
147
|
- textColor: '#377DFF'
|
|
|
148
|
- },
|
|
|
149
|
- {
|
|
|
150
|
- index: 2,
|
|
|
151
|
- name: '在线',
|
|
|
152
|
- bgColor: '#F6F6F6',
|
|
|
153
|
- textColor: '#F6F6F6'
|
|
|
154
|
- },
|
|
|
155
|
- {
|
|
|
156
|
- index: 3,
|
|
|
157
|
- name: '离线',
|
|
|
158
|
- bgColor: '#F6F6F6',
|
|
|
159
|
- textColor: '#F6F6F6'
|
|
|
160
|
- },
|
|
|
161
|
- {
|
|
|
162
|
- index: 4,
|
|
|
163
|
- name: '待激活',
|
|
|
164
|
- bgColor: '#F6F6F6',
|
|
|
165
|
- textColor: '#F6F6F6'
|
|
|
166
|
- }
|
|
|
167
|
- ],
|
|
|
168
|
- alertStatus: [
|
|
|
169
|
- {
|
|
|
170
|
- index: 1,
|
|
|
171
|
- name: '全部',
|
|
|
172
|
- bgColor: '#377DFF',
|
|
|
173
|
- textColor: '#377DFF'
|
|
|
174
|
- },
|
|
|
175
|
- {
|
|
|
176
|
- index: 2,
|
|
|
177
|
- name: '告警',
|
|
|
178
|
- bgColor: '#F6F6F6',
|
|
|
179
|
- textColor: '#F6F6F6'
|
|
|
180
|
- },
|
|
|
181
|
- {
|
|
|
182
|
- index: 3,
|
|
|
183
|
- name: '正常',
|
|
|
184
|
- bgColor: '#F6F6F6',
|
|
|
185
|
- textColor: '#F6F6F6'
|
|
|
186
|
- }
|
|
|
187
|
- ],
|
|
|
188
|
- typeStatus: [
|
|
|
189
|
- {
|
|
|
190
|
- index: 1,
|
|
|
191
|
- name: '全部',
|
|
|
192
|
- bgColor: '#377DFF',
|
|
|
193
|
- textColor: '#377DFF'
|
|
|
194
|
- },
|
|
|
195
|
- {
|
|
|
196
|
- index: 2,
|
|
|
197
|
- name: '网关设备',
|
|
|
198
|
- bgColor: '#F6F6F6',
|
|
|
199
|
- textColor: '#F6F6F6'
|
|
|
200
|
- },
|
|
|
201
|
- {
|
|
|
202
|
- index: 3,
|
|
|
203
|
- name: '网关子设备',
|
|
|
204
|
- bgColor: '#F6F6F6',
|
|
|
205
|
- textColor: '#F6F6F6'
|
|
|
206
|
- },
|
|
|
207
|
- {
|
|
|
208
|
- index: 4,
|
|
|
209
|
- name: '直连设备',
|
|
|
210
|
- bgColor: '#F6F6F6',
|
|
|
211
|
- textColor: '#F6F6F6'
|
|
|
212
|
- }
|
|
|
213
|
- ],
|
|
|
214
|
- list: [
|
|
|
215
|
- {
|
|
|
216
|
- name1: '1号楼1楼三单元水表',
|
|
|
217
|
- name2: '设备编号:SN987633433',
|
|
|
218
|
- name3: '所属组:XXXXXX',
|
|
|
219
|
- name4: '../../static/online.png',
|
|
|
220
|
- name5: '在线',
|
|
|
221
|
- id: 'xx1'
|
|
|
222
|
- },
|
|
|
223
|
- {
|
|
|
224
|
- name1: '2号楼1楼三单元水表',
|
|
|
225
|
- name2: '设备编号:SN987633433',
|
|
|
226
|
- name3: '所属组:XXXXXX',
|
|
|
227
|
- name4: '../../static/online.png',
|
|
|
228
|
- name5: '在线',
|
|
|
229
|
- id: 'xx2'
|
|
|
230
|
- },
|
|
|
231
|
- {
|
|
|
232
|
- name1: '3号楼1楼三单元水表',
|
|
|
233
|
- name2: '设备编号:SN987633433',
|
|
|
234
|
- name3: '所属组:XXXXXX',
|
|
|
235
|
- name4: '../../static/baojing.png',
|
|
|
236
|
- name5: '离线',
|
|
|
237
|
- id: 'xx3'
|
|
|
238
|
- },
|
|
|
239
|
- {
|
|
|
240
|
- name1: '4号楼1楼三单元水表',
|
|
|
241
|
- name2: '设备编号:SN987633433',
|
|
|
242
|
- name3: '所属组:XXXXXX',
|
|
|
243
|
- name4: '../../static/unonline.png',
|
|
|
244
|
- name5: '未激活',
|
|
|
245
|
- id: 'xx4'
|
|
|
246
|
- },
|
|
|
247
|
- {
|
|
|
248
|
- name1: '5号楼1楼三单元水表',
|
|
|
249
|
- name2: '设备编号:SN987633433',
|
|
|
250
|
- name3: '所属组:XXXXXX',
|
|
|
251
|
- name4: '../../static/online.png',
|
|
|
252
|
- name5: '在线',
|
|
|
253
|
- id: 'xx5'
|
|
|
254
|
- },
|
|
|
255
|
- {
|
|
|
256
|
- name1: '6号楼1楼三单元水表',
|
|
|
257
|
- name2: '设备编号:SN987633433',
|
|
|
258
|
- name3: '所属组:XXXXXX',
|
|
|
259
|
- name4: '../../static/online.png',
|
|
|
260
|
- name5: '在线',
|
|
|
261
|
- id: 'xx5'
|
|
|
262
|
- }
|
|
|
263
|
- ]
|
|
|
264
|
- };
|
|
|
265
|
- },
|
|
|
266
|
- onLoad() {
|
|
|
267
|
- // 隐藏原生的tabbar
|
|
|
268
|
- uni.hideTabBar();
|
|
|
269
|
- },
|
|
|
270
|
- methods: {
|
|
|
271
|
- /*下拉刷新的回调 */
|
|
|
272
|
- downCallback() {
|
|
|
273
|
- //联网加载数据
|
|
|
274
|
- this.loadData(1)
|
|
|
275
|
- },
|
|
|
276
|
- /*上拉加载的回调: 其中page.num:当前页 从1开始, page.size:每页数据条数,默认10 */
|
|
|
277
|
- upCallback(page) {
|
|
|
278
|
- //联网加载数据
|
|
|
279
|
- this.loadData(page.num)
|
|
|
280
|
- },
|
|
|
281
|
- //获取设备
|
|
|
282
|
- loadData(pageNo) {
|
|
|
283
|
- let httpData = {
|
|
|
284
|
- page: pageNo,
|
|
|
285
|
- pageSize: 10,
|
|
|
286
|
- }
|
|
|
287
|
- uni.$u.http.get('/yt/device', {params: httpData, custom: {load:false}}).then(res => {
|
|
|
288
|
- uni.stopPullDownRefresh();
|
|
|
289
|
- console.log('获取后端数据',res);
|
|
|
290
|
- //方法一(推荐): 后台接口有返回列表的总页数 totalPage
|
|
|
291
|
- // this.mescroll.endByPage(res.length, res.pages); //必传参数(当前页的数据个数, 总页数)
|
|
|
292
|
- // if (pageNo == 1) {
|
|
|
293
|
- // this.list = res
|
|
|
294
|
- // } else {
|
|
|
295
|
- // this.list = this.list.concat(res);
|
|
|
296
|
- // }
|
|
|
297
|
- }).catch(() => {
|
|
|
298
|
- //联网失败, 结束加载
|
|
|
299
|
- this.mescroll.endErr();
|
|
|
300
|
- });
|
|
|
301
|
- },
|
|
|
302
|
- openOrg() {
|
|
|
303
|
- uni.navigateTo({
|
|
|
304
|
- url: './org/org'
|
|
|
305
|
- });
|
|
|
306
|
- },
|
|
|
307
|
- open() {},
|
|
|
308
|
- close() {
|
|
|
309
|
- this.show = false;
|
|
|
310
|
- },
|
|
|
311
|
- openSearchDialog() {
|
|
|
312
|
- this.show = true;
|
|
|
313
|
- },
|
|
|
314
|
- openDeviceDetail(e) {
|
|
|
315
|
- console.log(e);
|
|
|
316
|
- uni.navigateTo({
|
|
|
317
|
- url: 'deviceDetail'
|
|
|
318
|
- });
|
|
|
319
|
- }
|
|
|
320
|
- }
|
|
|
321
|
-};
|
|
|
322
|
-</script>
|
|
|
323
|
-
|
|
|
324
|
-<style lang="scss" scoped>
|
|
|
325
|
-.device-page {
|
|
|
326
|
- // padding: 0rpx 15rpx;
|
|
|
327
|
- min-height: 100vh;
|
|
|
328
|
- background-color: #f8f9fa;
|
|
|
329
|
-}
|
|
|
330
|
-.org-sty {
|
|
|
331
|
- width: 750rpx;
|
|
|
332
|
- height: 150rpx;
|
|
|
333
|
- margin-top: 1rpx;
|
|
|
334
|
- background-color: #fff;
|
|
|
335
|
- display: flex;
|
|
|
336
|
- flex-direction: row;
|
|
|
337
|
- justify-content: space-between;
|
|
|
338
|
- .org-item {
|
|
|
339
|
- width: 350rpx;
|
|
|
340
|
- height: 200rpx;
|
|
|
341
|
- }
|
|
|
342
|
-}
|
|
|
343
|
-.device-list {
|
|
|
344
|
- display: flex;
|
|
|
345
|
- flex-direction: column;
|
|
|
346
|
- padding-left: 20rpx;
|
|
|
347
|
- .list-item {
|
|
|
348
|
- width: 713rpx;
|
|
|
349
|
- height: 200rpx;
|
|
|
350
|
- background-color: #fff;
|
|
|
351
|
- margin-top: 24rpx;
|
|
|
352
|
- display: flex;
|
|
|
353
|
- flex-direction: row;
|
|
|
354
|
- border-radius: 10px;
|
|
|
355
|
- justify-content: space-between;
|
|
|
356
|
- .item {
|
|
|
357
|
- margin: 30rpx;
|
|
|
358
|
- }
|
|
|
359
|
- }
|
|
|
360
|
-}
|
1
|
+<template>
|
|
|
2
|
+ <view class="device-page">
|
|
|
3
|
+ <f-navbar>
|
|
|
4
|
+ <view class="u-flex" slot="left" style="justify-content: space-between;">
|
|
|
5
|
+ <view style="width: 580rpx;"><u--input prefixIcon="search" placeholder="输入设备SN或名称搜索" border="surround" shape="circle" @change="inputChanged"></u--input></view>
|
|
|
6
|
+ <view style="margin-left: 7rpx;">
|
|
|
7
|
+ <view><text style="color:#333;font-size: 14px;">筛选</text></view>
|
|
|
8
|
+ </view>
|
|
|
9
|
+ <view style="margin-left: 7rpx;"><image @click="openSearchDialog" style="width: 40rpx;height: 40rpx;" src="../../static/shaixuan.png" /></view>
|
|
|
10
|
+ </view>
|
|
|
11
|
+ </f-navbar>
|
|
|
12
|
+ <!-- 公共组件-每个页面必须引入 -->
|
|
|
13
|
+ <public-module></public-module>
|
|
|
14
|
+ <view class="org-sty">
|
|
|
15
|
+ <view class="org-item">
|
|
|
16
|
+ <view class="u-flex" style="margin-top: 26rpx;margin-left: 15rpx;"><text style="color:#333;font-size: 15px;margin-left: 14rpx;">组织关系</text></view>
|
|
|
17
|
+ <view style="margin-top: 20rpx;margin-left: 15rpx;" class="u-flex" v-if="total">
|
|
|
18
|
+ <image style="margin-left: 14rpx;width: 30rpx;height: 30rpx;" src="../../static/org.png" />
|
|
|
19
|
+ <text style="margin-left: 10rpx;color:#666;font-size: 12px;">设备数 : {{ total }}</text>
|
|
|
20
|
+ </view>
|
|
|
21
|
+ </view>
|
|
|
22
|
+ <view class="org-item">
|
|
|
23
|
+ <image @click="openOrg" style="width: 6px;height: 10px;float: right; margin-right: 34rpx; margin-top: 58rpx;" src="../../static/right-arrow.png" />
|
|
|
24
|
+ </view>
|
|
|
25
|
+ </view>
|
|
|
26
|
+ <mescroll-body ref="mescrollRef" @init="mescrollInit" :down="downOption" @down="downCallback" @up="upCallback">
|
|
|
27
|
+ <view class="device-list">
|
|
|
28
|
+ <view @click="openDeviceDetail(item.id)" class="list-item" v-for="item in list" :key="item.id">
|
|
|
29
|
+ <view class="u-flex item" style="justify-content: flex-start;flex-direction: column;align-items: center;">
|
|
|
30
|
+ <view style="width: 450rpx;text-align: left;">
|
|
|
31
|
+ <text style="color:#333;font-size: 15px;">{{ item.name ? `设备名称:${item.name}` : '' }}</text>
|
|
|
32
|
+ </view>
|
|
|
33
|
+ <view style="width: 450rpx;text-align: left; margin-top: 10rpx;">
|
|
|
34
|
+ <text style="color:#666;font-size: 15px;">{{ item.sn ? `设备编号:${item.sn}` : '' }}</text>
|
|
|
35
|
+ </view>
|
|
|
36
|
+ <view style="width: 450rpx;text-align: left; margin-top: 10rpx;">
|
|
|
37
|
+ <text style="color:#666;font-size: 15px;">{{ item.organizationDTO.name ? `所属组织:${item.organizationDTO.name}` : '' }}</text>
|
|
|
38
|
+ </view>
|
|
|
39
|
+ </view>
|
|
|
40
|
+ <view class="item">
|
|
|
41
|
+ <view class="u-flex" style="margin-top: -6rpx;">
|
|
|
42
|
+ <image
|
|
|
43
|
+ style="width: 30rpx;height: 30rpx;margin-top: 5rpx;margin-right: 5rpx;"
|
|
|
44
|
+ :src="item.deviceState === 'ONLINE' ? '../../static/online.png' : item.deviceState === 'INACTIVE' ? '../../static/secondary.png' : '../../static/baojing.png'"
|
|
|
45
|
+ />
|
|
|
46
|
+
|
|
|
47
|
+ <view>
|
|
|
48
|
+ <text style="color: #377DFF;font-size: 13px;margin-left: 5rpx;margin-top: 20rpx;">
|
|
|
49
|
+ {{ item.deviceState === 'ONLINE' ? '在线' : item.deviceState === 'INACTIVE' ? '待激活' : '离线' }}
|
|
|
50
|
+ </text>
|
|
|
51
|
+ </view>
|
|
|
52
|
+ </view>
|
|
|
53
|
+ </view>
|
|
|
54
|
+ </view>
|
|
|
55
|
+ </view>
|
|
|
56
|
+ </mescroll-body>
|
|
|
57
|
+ <!-- 设备筛选 -->
|
|
|
58
|
+ <u-popup @close="close" closeable bgColor="#fff" :show="show" mode="bottom" :round="20">
|
|
|
59
|
+ <view>
|
|
|
60
|
+ <view style="text-align: center;margin-top: 28rpx;"><text>筛选条件</text></view>
|
|
|
61
|
+
|
|
|
62
|
+ <FilterItem :filterList="deviceStatus" title="设备状态" @clickTag="currentIndex => handleClickTag(currentIndex, deviceStatus)"></FilterItem>
|
|
|
63
|
+ <FilterItem :filterList="alarmStatus" title="告警状态" @clickTag="currentIndex => handleClickTag(currentIndex, alarmStatus)"></FilterItem>
|
|
|
64
|
+ <FilterItem :filterList="typeStatus" title="设备类型" @clickTag="currentIndex => handleClickTag(currentIndex, typeStatus)"></FilterItem>
|
|
|
65
|
+ <view class="u-flex" style="margin-top:40rpx;margin-left: 55rpx;">
|
|
|
66
|
+ <view style="width: 300rpx"><u-button type="info" shape="circle" text="重置" @click="resetFilter"></u-button></view>
|
|
|
67
|
+ <view style="width: 300rpx;margin-left:46rpx;"><u-button type="primary" shape="circle" text="确认" @click="confirmFilter"></u-button></view>
|
|
|
68
|
+ </view>
|
|
|
69
|
+ </view>
|
|
|
70
|
+ </u-popup>
|
|
|
71
|
+ <f-tabbar></f-tabbar>
|
|
|
72
|
+ </view>
|
|
|
73
|
+</template>
|
|
|
74
|
+
|
|
|
75
|
+<script>
|
|
|
76
|
+import fTabbar from '@/components/module/f-tabbar/f-tabbar';
|
|
|
77
|
+import fNavbar from '@/components/module/f-navbar/f-navbar';
|
|
|
78
|
+import FilterItem from './FilterItem.vue';
|
|
|
79
|
+import MescrollMixin from '@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js';
|
|
|
80
|
+import {debounce} from '@/plugins/throttle.js'
|
|
|
81
|
+export default {
|
|
|
82
|
+ mixins: [MescrollMixin], // 使用mixin (在main.js注册全局组件)
|
|
|
83
|
+ components: {
|
|
|
84
|
+ fTabbar,
|
|
|
85
|
+ fNavbar,
|
|
|
86
|
+ FilterItem
|
|
|
87
|
+ },
|
|
|
88
|
+ data() {
|
|
|
89
|
+ return {
|
|
|
90
|
+ downOption: {
|
|
|
91
|
+ auto: false //是否在初始化后,自动执行downCallback; 默认true
|
|
|
92
|
+ },
|
|
|
93
|
+ show: false,
|
|
|
94
|
+ deviceStatus: [
|
|
|
95
|
+ {
|
|
|
96
|
+ checked: true,
|
|
|
97
|
+ name: '全部',
|
|
|
98
|
+ type: ''
|
|
|
99
|
+ },
|
|
|
100
|
+ {
|
|
|
101
|
+ checked: false,
|
|
|
102
|
+ name: '在线',
|
|
|
103
|
+ type: 'ONLINE'
|
|
|
104
|
+ },
|
|
|
105
|
+ {
|
|
|
106
|
+ checked: false,
|
|
|
107
|
+ name: '离线',
|
|
|
108
|
+ type: 'OFFLINE'
|
|
|
109
|
+ },
|
|
|
110
|
+ {
|
|
|
111
|
+ checked: false,
|
|
|
112
|
+ name: '待激活',
|
|
|
113
|
+ type: 'INACTIVE'
|
|
|
114
|
+ }
|
|
|
115
|
+ ],
|
|
|
116
|
+ alarmStatus: [
|
|
|
117
|
+ {
|
|
|
118
|
+ checked: true,
|
|
|
119
|
+ name: '全部',
|
|
|
120
|
+ type: ''
|
|
|
121
|
+ },
|
|
|
122
|
+ {
|
|
|
123
|
+ checked: false,
|
|
|
124
|
+ name: '告警',
|
|
|
125
|
+ type: '1'
|
|
|
126
|
+ },
|
|
|
127
|
+ {
|
|
|
128
|
+ checked: false,
|
|
|
129
|
+ name: '正常',
|
|
|
130
|
+ type: '0'
|
|
|
131
|
+ }
|
|
|
132
|
+ ],
|
|
|
133
|
+ typeStatus: [
|
|
|
134
|
+ {
|
|
|
135
|
+ checked: true,
|
|
|
136
|
+ name: '全部',
|
|
|
137
|
+ type: ''
|
|
|
138
|
+ },
|
|
|
139
|
+ {
|
|
|
140
|
+ checked: false,
|
|
|
141
|
+ name: '直连设备',
|
|
|
142
|
+ type: 'DIRECT_CONNECTION'
|
|
|
143
|
+ },
|
|
|
144
|
+ {
|
|
|
145
|
+ checked: false,
|
|
|
146
|
+ name: '网关设备',
|
|
|
147
|
+ type: 'GATEWAY'
|
|
|
148
|
+ },
|
|
|
149
|
+ {
|
|
|
150
|
+ checked: false,
|
|
|
151
|
+ name: '网关子设备',
|
|
|
152
|
+ type: 'SENSOR'
|
|
|
153
|
+ }
|
|
|
154
|
+ ],
|
|
|
155
|
+ total: 0,
|
|
|
156
|
+ list: [],
|
|
|
157
|
+ };
|
|
|
158
|
+ },
|
|
|
159
|
+ onLoad() {
|
|
|
160
|
+ // 隐藏原生的tabbar
|
|
|
161
|
+ uni.hideTabBar();
|
|
|
162
|
+ },
|
|
|
163
|
+ methods: {
|
|
|
164
|
+ /*下拉刷新的回调 */
|
|
|
165
|
+ downCallback() {
|
|
|
166
|
+ //联网加载数据
|
|
|
167
|
+ this.loadData(1);
|
|
|
168
|
+ },
|
|
|
169
|
+ /*上拉加载的回调: 其中page.num:当前页 从1开始, page.size:每页数据条数,默认10 */
|
|
|
170
|
+ upCallback(page) {
|
|
|
171
|
+ //联网加载数据
|
|
|
172
|
+ console.log(page);
|
|
|
173
|
+ this.loadData(page.num);
|
|
|
174
|
+ },
|
|
|
175
|
+
|
|
|
176
|
+ //获取设备
|
|
|
177
|
+ loadData(pageNo, params = {}) {
|
|
|
178
|
+ let httpData = {
|
|
|
179
|
+ page: pageNo,
|
|
|
180
|
+ pageSize: 10,
|
|
|
181
|
+ ...params
|
|
|
182
|
+ };
|
|
|
183
|
+ uni.$u.http
|
|
|
184
|
+ .get('/yt/device', {
|
|
|
185
|
+ params: httpData,
|
|
|
186
|
+ custom: {
|
|
|
187
|
+ load: false
|
|
|
188
|
+ }
|
|
|
189
|
+ })
|
|
|
190
|
+ .then(res => {
|
|
|
191
|
+ this.total = res.total;
|
|
|
192
|
+ uni.stopPullDownRefresh();
|
|
|
193
|
+ console.log('获取后端数据', res);
|
|
|
194
|
+ //方法一(推荐): 后台接口有返回列表的总页数 totalPage
|
|
|
195
|
+ this.mescroll.endByPage(res.total, Math.ceil(res.total / 10)); //必传参数(当前页的数据个数, 总页数)
|
|
|
196
|
+ if (pageNo == 1) {
|
|
|
197
|
+ this.list = res.items;
|
|
|
198
|
+ } else {
|
|
|
199
|
+ this.list = this.list.concat(res.items);
|
|
|
200
|
+ }
|
|
|
201
|
+ })
|
|
|
202
|
+ .catch(() => {
|
|
|
203
|
+ //联网失败, 结束加载
|
|
|
204
|
+ this.mescroll.endErr();
|
|
|
205
|
+ });
|
|
|
206
|
+ },
|
|
|
207
|
+ openOrg() {
|
|
|
208
|
+ uni.navigateTo({
|
|
|
209
|
+ url: './org/org'
|
|
|
210
|
+ });
|
|
|
211
|
+ },
|
|
|
212
|
+ close() {
|
|
|
213
|
+ this.resetFilter();
|
|
|
214
|
+ this.show = false;
|
|
|
215
|
+ },
|
|
|
216
|
+ openSearchDialog() {
|
|
|
217
|
+ this.show = true;
|
|
|
218
|
+ },
|
|
|
219
|
+ openDeviceDetail(id) {
|
|
|
220
|
+ uni.navigateTo({
|
|
|
221
|
+ url: `deviceDetail?id=${id}`
|
|
|
222
|
+ });
|
|
|
223
|
+ },
|
|
|
224
|
+ handleClickTag(currentIndex, list) {
|
|
|
225
|
+ list.map((item, index) => {
|
|
|
226
|
+ item.checked = index === currentIndex;
|
|
|
227
|
+ });
|
|
|
228
|
+ },
|
|
|
229
|
+ resetFilter() {
|
|
|
230
|
+ const { deviceStatus, alarmStatus, typeStatus } = this;
|
|
|
231
|
+ [deviceStatus, alarmStatus, typeStatus].forEach(item => item.map((item, index) => (item.checked = index === 0)));
|
|
|
232
|
+ },
|
|
|
233
|
+ confirmFilter() {
|
|
|
234
|
+ const deviceState = this.deviceStatus.find(item => item.checked);
|
|
|
235
|
+ const alarmStatus = this.alarmStatus.find(item => item.checked);
|
|
|
236
|
+ const deviceType = this.typeStatus.find(item => item.checked);
|
|
|
237
|
+ this.loadData(1, {
|
|
|
238
|
+ deviceState: deviceState.type ? deviceState.type : undefined,
|
|
|
239
|
+ deviceType: deviceType.type ? deviceType.type : undefined,
|
|
|
240
|
+ alarmStatus: alarmStatus.type === '0' || alarmStatus.type === '1' ? alarmStatus.type : undefined
|
|
|
241
|
+ });
|
|
|
242
|
+ this.show = false;
|
|
|
243
|
+ },
|
|
|
244
|
+ inputChanged:debounce(function(name){
|
|
|
245
|
+ this.loadData(1,{
|
|
|
246
|
+ name
|
|
|
247
|
+ })
|
|
|
248
|
+ },500)
|
|
|
249
|
+ }
|
|
|
250
|
+};
|
|
|
251
|
+</script>
|
|
|
252
|
+
|
|
|
253
|
+<style lang="scss" scoped>
|
|
|
254
|
+.device-page {
|
|
|
255
|
+ min-height: 100vh;
|
|
|
256
|
+ background-color: #f8f9fa;
|
|
|
257
|
+}
|
|
|
258
|
+
|
|
|
259
|
+.org-sty {
|
|
|
260
|
+ width: 750rpx;
|
|
|
261
|
+ height: 150rpx;
|
|
|
262
|
+ margin-top: 1rpx;
|
|
|
263
|
+ background-color: #fff;
|
|
|
264
|
+ display: flex;
|
|
|
265
|
+ justify-content: space-between;
|
|
|
266
|
+
|
|
|
267
|
+ .org-item {
|
|
|
268
|
+ width: 350rpx;
|
|
|
269
|
+ height: 200rpx;
|
|
|
270
|
+ }
|
|
|
271
|
+}
|
|
|
272
|
+
|
|
|
273
|
+.device-list {
|
|
|
274
|
+ display: flex;
|
|
|
275
|
+ flex-direction: column;
|
|
|
276
|
+ padding-left: 20rpx;
|
|
|
277
|
+
|
|
|
278
|
+ .list-item {
|
|
|
279
|
+ width: 713rpx;
|
|
|
280
|
+ height: 200rpx;
|
|
|
281
|
+ background-color: #fff;
|
|
|
282
|
+ margin-top: 24rpx;
|
|
|
283
|
+ display: flex;
|
|
|
284
|
+ border-radius: 10px;
|
|
|
285
|
+ justify-content: space-between;
|
|
|
286
|
+
|
|
|
287
|
+ .item {
|
|
|
288
|
+ margin: 30rpx;
|
|
|
289
|
+ }
|
|
|
290
|
+ }
|
|
|
291
|
+}
|
361
|
</style> |
292
|
</style> |