index_frm.html
23.2 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
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
<!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/01001/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 v-if="deviceInfo.gate_status === '1'">合闸</span>
<span v-if="deviceInfo.gate_status === '0'">分闸</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 && actionCount != 0" class="aui-badge">{{ actionCount }}</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>{{ operateTitle }}</span>
</el-col>
<el-col :span=12 tapmode @click.native="showLogs">
<span style="font-size:14px;float: right;">操作记录<i class="aui-iconfont aui-icon-right"></i></span>
</el-col>
</el-row>
</div>
<div class="operation-menu-list" >
<el-row>
<div v-for="(list_d, list_i) in operateList">
<el-col :span=12 style="margin-top: 10px;">
<div class="operation-panel" style="margin-right:5px;">
<div style="margin-left:15px;margin-right:15px;margin-bottom:10px;">
<div class="aui-row aui-row-flex">
<div class="aui-col aui-col-span-12 aui-row-flex-start" style="margin-top:12.5px;">
<img :src="list_d.url" style="height:44px;width:44px;">
</div>
<div class="aui-col aui-col-span-12 aui-row-flex-end" >
<div class="operation-btn" :id="'btn_'+ (list_i+1)" tapmode @click="deviceOperation(list_i+1 , list_d.name ,'&S9+', list_d.command);"><span :id="'loading'+ (list_i+1)"> {{ list_d.name }}</span></div>
</div>
</div>
</div>
</div>
</el-col>
</div>
</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">
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: filterDeviceName(api.pageParam.deviceInfo.bind.storename, api.pageParam.imei),
indexBtns: [
],
indexBtnsTemp: [
{img: 'http://iot.uccc.cc:9090/product/01001/home_RemoteOperation_02.png', name: '设备信息', span: 5},
{img: 'http://iot.uccc.cc:9090/product/01001/home_icon_menu05.png', name: '参数设置', span: 5},
{img: 'http://iot.uccc.cc:9090/product/01001/home_icon_menu03.png', name: '报警信息', span: 4},
{img: 'http://iot.uccc.cc:9090/product/01001/home_icon_menu02.png', name: '保护动作', span: 5},
{img: 'http://iot.uccc.cc:9090/product/01001/home_icon_menu04.png', name: '统计分析', span: 5},
],
operateTitle: '远程操作',
operateList: [
{
name: "分闸",
url: "http://iot.uccc.cc:9090/product/01001/lazha.png",
command: "4"
},
{
name: "自检",
url: "http://iot.uccc.cc:9090/product/01001/home_RemoteOperation_02.png",
command: "8"
},
{
name: "复位",
url: "http://iot.uccc.cc:9090/product/01001/home_RemoteOperation_03.png",
command: "16"
},
{
name: "消音",
url: "http://iot.uccc.cc:9090/product/01001/home_RemoteOperation_05.png",
command: "2"
}
],
measureTitle: "测量信息",
curMeasure: "电流",
chartArr: [{text:'电流',value:'current',unit: 'A'},{text:'剩余电流',value:'rest_current',unit: 'mA'},
{text:'电压',value:'voltage',unit: 'V'},{text:'频率',value:'rate',unit: 'Hz'},
{text:'线缆温度',value:'line_temp',unit: '℃'},{text:'内部温度',value:'temp1',unit: '℃'}],
userId: api.getPrefs({sync: true,key: 'userID'}),
token: api.getPrefs({sync: true,key: 'userToken'}),
warningCount: 0,
actionCount: 0,
inputDialogJSON: '',
},
mounted() {
//window.chooseProduct = this.chooseProduct;
},
created() {
this.initBtns()
that = this
this.inputDialogJSON = returnInputDialogJSON()
setTimeout(() => {
this.chooseMeasureType({buttonIndex: 1, buttonTitle: '电流', buttonValue: 'current', buttonUnit: 'A'})
}, 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();
});
// this.selectBtn(1)
},
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.warningCount = lastInfo.warning_count
this.deviceName = filterDeviceName(lastInfo.bind.storename, api.pageParam.imei),
this.actionCount = lastInfo.action_count
let btnTemp = this.indexBtnsTemp
this.indexBtns = btnTemp
},
async chooseMeasureType(ret) { //
const params = {
imei: this.deviceImei,
token: this.token,
chartType: ret.buttonValue
}
var echartDom = document.getElementById("echarts_view");
let dailyRes = await get_daily_charts(params)
if (dailyRes.code == 0) {
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.date.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[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/store01001/device_details_win.html',
bounces: true,
pageParam: params
});
break;
case 1:
api.openWin({
name: 'deviceOperate_win',
url: 'http://iot.uccc.cc:9090/app_html/store01001/device_operate_win.html',
bounces: true,
pageParam: params
});
break;
case 2:
api.openWin({
name: 'alarmInfo_win',
url: 'http://iot.uccc.cc:9090/app_html/store01001/alarm_info_win.html',
bounces: true,
pageParam: params
});
break;
case 3:
api.openWin({
name: 'protectAction_win',
url: 'http://iot.uccc.cc:9090/app_html/store01001/protect_action_win.html',
bounces: true,
pageParam: params
});
break;
case 4:
api.openWin({
name: 'statistic_win',
url: 'http://iot.uccc.cc:9090/app_html/store01001/statistic_win.html',
bounces: true,
pageParam: params
});
break;
default:
break;
}
},
showLogs() {
api.openWin({
name: 'operaterLog_win',
url: 'http://iot.uccc.cc:9090/app_html/store01001/operater_log_win.html',
slidBackEnabled: true,
pageParam: {
productId: api.pageParam.productId,
imei: api.pageParam.imei
}
});
},
deviceOperation(index, name, cmd, val) {
let dialogBox = api.require('dialogBox')
let dom = $api.byId('btn_'+index);
dialogBox.input(this.inputDialogJSON, async function(ret) {
if (ret.eventType == 'left') {
var dialogBox = api.require('dialogBox');
dialogBox.close({
dialogName: 'input'
});
}else if (ret.eventType == "right") {
const params = {
imei: that.deviceImei,
userId: api.getPrefs({sync: true,key: 'userID'}),
token: api.getPrefs({sync: true,key: 'userToken'}),
}
let deviceInfos = await get_device_infos_by_imei(params)
if (deviceInfos.data.device.password === ret.text) {
var dialogBox = api.require('dialogBox');
dialogBox.close({
dialogName: 'input'
});
var spanDom = $api.byId('loading'+index);
$api.html(spanDom, '');
$api.addCls(dom, 'store01001-operate-operation-doing'); //缩放效果,改变宽度
$api.addCls(dom, 'store01001-operate-not-click'); //不可点击
$api.addCls(spanDom, 'aui-loading'); //加gif
$.ajax({
url: HOST + '/iot_api/v2/app/set_device',
type: 'POST',
dataType: 'json',
headers:{
'Content-Type':'application/json;charset=utf-8',
'token': that.token
},
data: JSON.stringify({
imei: that.deviceImei,
command: cmd,
value: val,
user_id: that.userId
}),
complete: function() {
api.hideProgress();
},
success: function(ret) {
setTimeout(function(){
$api.html(spanDom, name);
$api.removeCls(dom, 'store01001-operate-operation-doing');
$api.removeCls(dom, 'store01001-operate-not-click');
$api.removeCls(spanDom, 'aui-loading');
console.log(JSON.stringify(ret));
if (ret.code == 0 && ret.msg == '操作成功') {
api.toast({
msg: ret.msg,
duration: 2000,
location: 'bottom'
});
}else {
api.toast({
msg: '操作' + name + '失败',
duration: 2000,
location: 'bottom'
});
}
that.initBtns()
}, 1000);
},
error: function() {
api.toast({
msg: '操作' + name + '失败',
duration: 2000,
location: 'bottom'
});
}
});
}else {
api.toast({msg: '设备密码错误!',duration: 2000,location: 'bottom'});
}
}
});
}
}
})
};
</script>
</html>