statistic_frm.html
12.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
<!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>统计分析_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/style.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/home.css"/>
<style>
html,
body{
background: #F4F6F9;
}
.el-collapse-item__wrap{
height: 240px;
}
</style>
</head>
<body>
<div id="app">
<template>
<div id="chart_area">
<div class="store01001-info-title2">{{ measureTitle }}</div>
<div style="margin-top: 15px;margin-left: 15.5px;margin-right: 14.5px;">
<el-collapse v-model="activeName" accordion @change="collapseChange">
<el-collapse-item name="1">
<template slot="title">
<span class="device-type-title">当前测量:{{ curMeasure }}</span>
</template>
<div class="aui-margin-l-15 aui-margin-r-15" v-for="(list_d, list_i) in measureList">
<el-divider content-position="left">{{ list_d.name }}</el-divider>
<div class="product-info">
<el-row :gutter="10">
<div v-for="(measure_d, measure_i) in measureList[list_i].values">
<el-col :span=measure_d.span style="margin-bottom: 10px;">
<span class="product-select-normal" style="height: 1.5rem;line-height: 1.5rem;font-size:0.6rem;padding-left: 0.3rem;padding-right: 0.3rem;" @click="chooseMeasureType(measure_d)">{{ measure_d.buttonTitle }}</span>
</el-col>
</div>
</el-row>
</div>
</div>
</el-collapse-item>
</el-collapse>
</div>
<div class="store01001-chart-panel">
<div style="padding-left:10px;padding-right:10px;padding-bottom:10px;">
<div style="height:1px;background:rgba(240,245,255,1);margin-top: 6px;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/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: {
deviceImei: api.pageParam.imei,
userId: api.getPrefs({sync: true,key: 'userID'}),
token: api.getPrefs({sync: true,key: 'userToken'}),
measureTitle: '历史测量信息趋势变化',
curMeasure: '电能',
date: parseTime((new Date()).getTime()-1000*60*60*24*1,'{y}-{m}-{d}'),
chooseMeasure: {buttonTitle: '电能', buttonUnit: 'kWh', buttonValue: 'r_elec', span: 8},
activeName: '',
measureList: [
{
name: "测量信息",
values: [
{buttonTitle: '电能', buttonUnit: 'kWh', buttonValue: 'r_elec', span: 8},
{buttonTitle: '功率', buttonUnit: 'W', buttonValue: 'r_power', span: 8},
{buttonTitle: '已备电时长', buttonUnit: 'Min', buttonValue: 'r_standby_power_time', span: 8},
{buttonTitle: '已备电电量', buttonUnit: 'kWh', buttonValue: 'r_reserve_power', span: 8},
{buttonTitle: '温度', buttonUnit: '℃', buttonValue: 'r_temp_val', span: 8},
{buttonTitle: 'DC电压', buttonUnit: 'V', buttonValue: 'r_DC_voltage', span: 8},
{buttonTitle: 'A相交流电压值', buttonUnit: 'V', buttonValue: 'A_AC_voltage', span: 8},
{buttonTitle: 'B相交流电压值', buttonUnit: 'V', buttonValue: 'B_AC_voltage', span: 8},
{buttonTitle: 'C相交流电压值', buttonUnit: 'V', buttonValue: 'C_AC_voltage', span: 8},
{buttonTitle: '直流电流有效值', buttonUnit: 'A', buttonValue: 'r_DC_effe_val', span: 9},
{buttonTitle: '交流电压频率', buttonUnit: 'Hz', buttonValue: 'r_AC_voltage_freq', span: 8}
]
},
],
},
mounted() {
//window.chooseProduct = this.chooseProduct;
},
created() {
that = this
api.addEventListener({
name: 'chanegSearchDate'
}, function(ret, err){
console.log(JSON.stringify(ret));
that.date = ret.value.selected_time
that.chooseMeasureType(that.chooseMeasure)
});
setTimeout(() => {
this.chooseMeasureType(this.chooseMeasure)
}, 1000);
},
methods: {
collapseChange(val) {
if (val === '1') {
// api.sendEvent({
// name: 'pageDownEvent',
// });
api.setFrameAttr({
name: 'statistic_frm',
bounces: false,
});
}else if (val === '') {
api.setFrameAttr({
name: 'statistic_frm',
bounces: true,
});
this.activeName = ''
}
},
async chooseMeasureType(ret) { //
this.collapseChange('')
this.curMeasure = ret.buttonTitle
const params = {
imei: this.deviceImei,
token: this.token,
chartType: ret.buttonValue,
date: this.date
}
console.log(JSON.stringify(params));
var echartDom = document.getElementById("echarts_view");
api.showProgress({
style: 'default',
animationType: 'fade',
title: '加载中...',
text: '',
modal: true
});
let dailyRes = await get_normal_daily_chart(params)
api.hideProgress();
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';
}
},
interval: 0,//让所有坐标值全部显示
rotate:30,//让坐标值旋转一定的角度
},
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);
}
}
},
}
})
}
</script>
</html>