index_frm.html
20.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
<meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
<meta name="referrer" content="no-referrer">
<title>01001首页_frm</title>
<link rel="stylesheet" type="text/css" href="http://iot.uccc.cc:9090/app/css/api.css"/>
<link rel="stylesheet" type="text/css" href="http://iot.uccc.cc:9090/app/css/aui.css"/>
<link rel="stylesheet" type="text/css" href="http://iot.uccc.cc:9090/app/css/home.css"/>
<link rel="stylesheet" type="text/css" href="http://iot.uccc.cc:9090/app/css/element.css"/>
<link rel="stylesheet" type="text/css" href="http://iot.uccc.cc:9090/app/css/style.css"/>
<style>
html,body{
background: #F4F6F9;
}
</style>
</head>
<body>
<div id="app">
<template>
<div class="store01001-panel-and-count">
<div class="store01001-panel-area">
<div class="store01001-device-name">{{ deviceName }}</div>
<div class="store01001-device-imei">{{ deviceImei }}</div>
<!--aui-hide-->
<div class="store01001-status-list">
<div class="aui-row aui-row-flex">
<div class="aui-col aui-col-span-7 aui-row-flex-center aui-row-flex-middle" style="height:111px;">
<div class="store01001-device-state">
<div class="store01001-cur-state-value">
<span v-if="deviceInfo.online">在线</span>
<span v-else>离线</span>
</div>
<div class="store01001-short-line"></div>
<div class="store01001-state-title">状态</div>
</div>
</div>
<div class="aui-col aui-col-span-10 aui-row-flex-center aui-row-flex-middle" style="height:111px;">
<img src="http://iot.uccc.cc:9090/product/02001/top-middle.png" style="height:100%;" />
</div>
<div class="aui-col aui-col-span-7 aui-row-flex-center aui-row-flex-middle" style="height:111px;">
<div class="store01001-device-state">
<div class="store01001-cur-state-value" id="cur_state2">
<span>{{ deviceInfo | warningFilter }}</span>
</div>
<div class="store01001-short-line"></div>
<div class="store01001-state-title">报警</div>
</div>
</div>
</div>
</div>
<div class="store01001-panel-count">
<el-row>
<!-- <el-col :span=1 style="height:72px;"> </el-col> -->
<div v-for="(d, i) in indexBtns">
<el-col :span=d.span style="height:72px;" >
<el-row tapmode @click.native="selectBtn(i)">
<el-col :span=24 style="margin-top:0.5rem;">
<div v-if="i === 2 && warningCount != 0" class="aui-badge">{{ warningCount }}</div>
<div v-if="i === 3 && faultCount != 0" class="aui-badge">{{ faultCount }}</div>
<img :src=d.img :id="'cache_btns_'+ i" style="margin: 0 auto;" />
</el-col>
<el-col :span=24>
<p class="store01001-btn-name">{{ d.name }}</p>
</el-col>
</el-row>
</el-col>
</div>
</el-row>
</div>
</div>
</div>
<div class="store01001-info-title1">
<el-row>
<el-col :span=12 >
<span>{{ energyTitle }}</span>
</el-col>
<el-col :span=12 tapmode @click.native="showStatistics">
<span style="font-size:14px;float: right;">能耗分析<i class="aui-iconfont aui-icon-right"></i></span>
</el-col>
</el-row>
<el-row>
<el-col :span=11>
<div class="store02001-energy-area">
<div class="store02001-energy-inside-area">
<span>{{ dnToday }}</span>
<p>当日用电量(kWh)</p>
</div>
</div>
</el-col>
<el-col :span=2> </el-col>
<el-col :span=11>
<div class="store02001-energy-area">
<div class="store02001-energy-inside-area">
<span>{{ dnYestday }}</span>
<p>昨日用电量(kWh)</p>
</div>
</div>
</el-col>
</el-row>
</div>
<div id="chart_area">
<div class="store01001-info-title2">{{ measureTitle }}</div>
<div class="store01001-chart-panel">
<div style="padding-left:10px;padding-right:10px;padding-bottom:10px;">
<div style="padding-top: 10px;" tapmode @click="showPopup">
<span>{{ curMeasure }} </span><i></i>
</div>
<div style="height:1px;background:rgba(240,245,255,1);margin-top: 13.5px;margin-bottom:5px;"></div>
<div class="tab-view-list" id="echarts_view" style="height:11.5rem;">
</div>
<div style="height:10px;"></div>
</div>
</div>
</div>
<div style="height:30px;width:auto"></div>
</template>
</div>
</body>
<script type="text/javascript" src="http://iot.uccc.cc:9090/app/js/api.js"></script>
<script type="text/javascript" src="http://iot.uccc.cc:9090/app/js/jquery-3.3.1.min.js"></script>
<script type="text/javascript" src="http://iot.uccc.cc:9090/app/js/vue.min.js"></script>
<!-- <script type="text/javascript" src="http://iot.uccc.cc:9090/app/js/common.js"></script> -->
<script type="text/javascript" src="http://iot.uccc.cc:9090/app/js/element.js"></script>
<!-- <script type="text/javascript" src="http://iot.uccc.cc:9090/app/js/ctrl.js"></script> -->
<script type="text/javascript" src="http://iot.uccc.cc:9090/app/js/fastclick.js"></script>
<script type="text/javascript" src="http://iot.uccc.cc:9090/app/js/aui-popup-wjb.js" ></script>
<script type="text/javascript" src="http://iot.uccc.cc:9090/app/js/echarts.min.js"></script>
<script type="text/javascript" src="../../../script/common.js"></script>
<script type="text/javascript" src="../../../script/ctrl.js"></script>
<script type="text/javascript">
var vm,
popup,
that;
apiready = function(){
api.parseTapmode();
$(function() {
FastClick.attach(document.body);
});
//---------初始化vue
vm = new Vue({
el: '#app',
data: {
deviceInfo: api.pageParam.deviceInfo,
deviceImei: api.pageParam.imei,
deviceName: '',
indexBtns: [
],
indexBtnsTemp: [
{img: 'http://iot.uccc.cc:9090/product/02001/home_icon_menu01.png', name: '设备信息', span: 5},
{img: 'http://iot.uccc.cc:9090/product/02001/home_icon_menu06.png', name: '操作命令', span: 5},
{img: 'http://iot.uccc.cc:9090/product/02001/home_icon_menu03.png', name: '报警信息', span: 4},
{img: 'http://iot.uccc.cc:9090/product/02001/home_icon_menu02.png', name: '故障信息', span: 5},
{img: 'http://iot.uccc.cc:9090/product/02001/home_icon_menu04.png', name: '统计分析', span: 5},
],
energyTitle: "能耗统计",
measureTitle: "测量信息",
curMeasure: "A相电压",
chartArr: [{text:'A相电压',value:'dy1',unit: 'V'},{text:'B相电压',value:'dy2',unit: 'V'},
{text:'C相电压',value:'dy3',unit: 'V'},{text:'A相电流',value:'dl1',unit: 'A'},
{text:'B相电流',value:'dl2',unit: 'A'},{text:'C相电流',value:'dl3',unit: 'A'},
{text:'漏电',value:'ld',unit: 'mA'},{text:'功率',value:'gl',unit: 'kW'},
{text:'功率因素',value:'glys',unit: ''},{text:'电能',value:'dn',unit: 'kWh'},
{text:'温度1',value:'wd1',unit: '℃'},{text:'温度2',value:'wd2',unit: '℃'},
{text:'温度3',value:'wd3',unit: '℃'},{text:'温度4',value:'wd4',unit: '℃'}],
userId: api.getPrefs({sync: true,key: 'userID'}),
token: api.getPrefs({sync: true,key: 'userToken'}),
warningCount: 0,
faultCount: 0,
dnYestday: 0.00,
dnToday: 0.00,
},
mounted() {
//window.chooseProduct = this.chooseProduct;
},
filters: {
warningFilter(v) {
let detailInfo = eval("v.store"+(v.storeType.table))
let bjztArr = detailInfo.bjzt.split("")
let count = 0
bjztArr.forEach(d => {
if (d === "1") {
count += 1
}
});
if (count > 0) {
return "异常"
}else {
return "正常"
}
}
},
created() {
this.initBtns()
that = this
setTimeout(() => {
this.chooseMeasureType({buttonIndex: 1, buttonTitle: 'A相电压', buttonValue: 'dy1', buttonUnit: 'V'})
}, 1000);
api.addEventListener({
name: 'reloadIndex'
}, function(ret, err){
that.initBtns();
});
/** 下拉刷新 */
api.setRefreshHeaderInfo({
loadingImg:'widget://image/alpha0.png',
bgColor: '#529AF3',
textColor: 'rgba(255,255,255,0.5)',
textDown: '下拉刷新...',
textUp: '松开刷新...'
}, function(ret, err) {
that.initBtns();
api.refreshHeaderLoadDone();
});
// setTimeout(() => {
// this.selectBtn(3)
// }, 1000);
},
methods: {
async initBtns() {
let params = {
imei: this.deviceImei,
userId: this.userId,
token: this.token
}
let lastInfoRes = await get_device_infos_by_imei(params)
let lastInfo = lastInfoRes.data.device
this.deviceInfo = lastInfo
// let detailInfo = eval("lastInfo.store"+(lastInfo.storeType.table))
this.warningCount = lastInfo.warning_count
// this.deviceName = filterDeviceName(lastInfo.bind.storename, api.pageParam.imei),
if (this.userType === 1) {
this.deviceName = filterDeviceName(lastInfo.bind.storename, api.pageParam.imei)
}else if (this.userType === 2) {
this.deviceName = filterDeviceName(lastInfo.name, api.pageParam.imei)
}
this.faultCount = lastInfo.fault_count
let btnTemp = this.indexBtnsTemp
this.indexBtns = btnTemp
let yestday = parseTime(new Date(new Date().getTime() - 24*60*60*1000),'{y}-{m}-{d}')
let today = parseTime(new Date(),'{y}-{m}-{d}')
let _params = {
day1: today,
day2: yestday,
imei: this.deviceImei,
}
let eneryStaticRes = await get_energy_static_by_day(_params)
let eneryList = eneryStaticRes.data.List
eneryList.forEach(d => {
if (yestday === d.day && this.deviceImei === d.imei) {
this.dnYestday = d.total.toFixed(2)
}else if (today === d.day && this.deviceImei === d.imei) {
this.dnToday = d.total.toFixed(2)
}
});
},
async chooseMeasureType(ret) { //
const params = {
imei: this.deviceImei,
token: this.token,
chartType: ret.buttonValue
}
var echartDom = document.getElementById("echarts_view");
let dailyRes = await get_ty401_daily_chart(params)
if (dailyRes.success == 1) {
var myChart = echarts.init(echartDom);
var option = {
title: {
left: 'center',
text: ret.buttonTitle+'趋势变化图',
},
grid: {
// top: 50,
x: 45,
x2: 20,
y: 50,
},
tooltip: {
trigger: 'axis',
position: 'top',
formatter: function (params) {
params = params[0];
return params.axisValue+'<br />'+params.marker+params.seriesName+'值 '+params.data+ ret.buttonUnit;
},
},
xAxis: {
type: 'category',
boundaryGap: false,
data: dailyRes.data.xdata.map(function(item){
return item.substring(11,16)
}),
axisLine: {
lineStyle: {
color: '#B0C8FF'
}
},
axisLabel: {
textStyle: {
color: function (value, index) {
return '#818295';
}
},
rotate:330
}
},
yAxis: {
type: 'value',
boundaryGap: [0, '100%'],
//y轴颜色
axisLine: {
lineStyle: {
color: '#fff'
}
},
axisLabel: {
formatter: '{value}'+ ret.buttonUnit,
textStyle: {
color: function (value, index) {
return value >= 0 ? '#818295' : 'red';
}
}
},
splitLine:{
show:true ,
lineStyle:{
color:'#F0F5FF',
width: 1
}
}
},
dataZoom: [
{
type: 'slider',
fillerColor: '#B0C8FF',
backgroundColor: '#F0F5FF',
start: 0,
end: 100,
handleIcon: 'M10.7,11.9v-1.3H9.3v1.3c-4.9,0.3-8.8,4.4-8.8,9.4c0,5,3.9,9.1,8.8,9.4v1.3h1.3v-1.3c4.9-0.3,8.8-4.4,8.8-9.4C19.5,16.3,15.6,12.2,10.7,11.9z M13.3,24.4H6.7V23h6.6V24.4z M13.3,19.6H6.7v-1.4h6.6V19.6z',
handleSize: '90%',
handleStyle: {
color: '#5B7FF8',
},
dataBackground:{
lineStyle:{
color:'#B0C8FF'
},
areaStyle:{
color:'#F0F5FF',
opacity:1,
}
},
bottom:'0%'
},{
type: 'inside',//这个 dataZoom 组件是 inside 型 dataZoom 组件(能在坐标系内进行拖动,以及用滚轮(或移动触屏上的两指滑动)进行缩放)
xAxisIndex: 0,//控制x轴
}
],
series: [{
data: dailyRes.data.ydata[ret.buttonValue],
name: ret.buttonTitle,
type:'line',
showSymbol: true,
hoverAnimation: false,
symbol: 'path://M30.9,53.2C16.8,53.2,5.3,41.7,5.3,27.6S16.8,2,30.9,2C45,2,56.4,13.5,56.4,27.6S45,53.2,30.9,53.2z M30.9,3.5C17.6,3.5,6.8,14.4,6.8,27.6c0,13.3,10.8,24.1,24.101,24.1C44.2,51.7,55,40.9,55,27.6C54.9,14.4,44.1,3.5,30.9,3.5z M36.9,35.8c0,0.601-0.4,1-0.9,1h-1.3c-0.5,0-0.9-0.399-0.9-1V19.5c0-0.6,0.4-1,0.9-1H36c0.5,0,0.9,0.4,0.9,1V35.8z M27.8,35.8 c0,0.601-0.4,1-0.9,1h-1.3c-0.5,0-0.9-0.399-0.9-1V19.5c0-0.6,0.4-1,0.9-1H27c0.5,0,0.9,0.4,0.9,1L27.8,35.8L27.8,35.8z',
symbolSize: 8,
// 折线颜色
itemStyle: {
normal: {
color: '#5B7FF8',
lineStyle: {
color: '#5B7FF8'
}
}
},
}]
};
if (option && typeof option === "object") {
myChart.setOption(option, true);
}
}
},
showPopup() {
popup = new auiPopup();
popup.init({
frameBounces:true,//当前页面是否弹动,(主要针对安卓端)
location: 'bottom-right',//位置,top(默认:顶部中间),top-left top-right,bottom,bottom-left,bottom-right
buttons: this.chartArr,
},function(ret){
if(ret){
that.chooseMeasureType(ret)
that.curMeasure = ret.buttonTitle
}
})
},
//这里以后全部是配置对应的http地址...
selectBtn(index) {
let params = {productId: api.pageParam.productId,
imei: api.pageParam.imei}
switch (index) {
case 0:
api.openWin({
name: 'deviceDetails_win',
// url: 'http://iot.uccc.cc:9090/app_html/store02001/device_details_win.html',
url: './device_details_win.html',
bounces: true,
pageParam: params
});
break;
case 1:
params.pwd = this.deviceInfo.password
api.openWin({
name: 'deviceOperate_win',
// url: 'http://iot.uccc.cc:9090/app_html/store02001/device_operate_win.html',
url: './device_operate_win.html',
bounces: false,
pageParam: params
});
break;
case 2:
api.openWin({
name: 'alarmInfo_win',
url: 'http://iot.uccc.cc:9090/app_html/store02001/alarm_info_win.html',
// url: './alarm_info_win.html',
bounces: false,
pageParam: params
});
break;
case 3:
api.openWin({
name: 'fault_win',
url: 'http://iot.uccc.cc:9090/app_html/store02001/fault_info_win.html',
// url: './fault_info_win.html',
bounces: false,
pageParam: params
});
break;
case 4:
api.openWin({
name: 'statistic_win',
url: 'http://iot.uccc.cc:9090/app_html/store02001/statistic_win.html',
bounces: false,
pageParam: params
});
break;
default:
break;
}
},
showStatistics() {
// addAlert("努力开发中...");
api.openWin({
name: 'energy_statistics_win',
url: 'http://iot.uccc.cc:9090/app_html/store02001/energy_statistics_win.html',
// url: './energy_statistics_win.html',
slidBackEnabled: false,
pageParam: {
productId: api.pageParam.productId,
imei: api.pageParam.imei
}
});
},
}
})
};
</script>
</html>