box3.js
3.4 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
function _initOpenDoorChart(_data) {
var dom = document.getElementById("box3_right");
var myChart = echarts.init(dom);
let _createTime = [];
let _openDoorCount = [];
_data.forEach(item => {
_createTime.push(item.createTime);
_openDoorCount.push(item.count);
});
var app = {};
option = null;
option = {
tooltip: {
trigger: 'axis',
axisPointer: {
type: 'cross',
label: {
backgroundColor: '#6a7985'
}
}
},
legend: {
textStyle: {//图例文字的样式
color: '#fff',
fontSize: 12
},
data: ['门禁开门次数']
},
toolbox: {
feature: {
saveAsImage: {}
}
},
grid: {
left: '3%',
right: '4%',
bottom: '3%',
containLabel: true
},
textStyle: {//图例文字的样式
color: '#fff',
fontSize: 12
},
xAxis: [
{
type: 'category',
boundaryGap: false,
data: _createTime
}
],
yAxis: [
{
type: 'value'
}
],
series: [
{
name: '门禁开门次数',
type: 'line',
stack: '总量',
areaStyle: {},
data: _openDoorCount
}
]
};
;
if (option && typeof option === "object") {
myChart.setOption(option, true);
}
}
/**
* 查询 资产信息
*/
function _loadAssets() {
let param = {
params: {
communityId: vc.getCurrentCommunity().communityId
}
}
vc.http.apiGet(
'/bigScreen/getAssets',
param,
function (json, res) {
//vm.menus = vm.refreshMenuActive(JSON.parse(json),0);
let _json = JSON.parse(json);
if (_json.code == 0) {
let _data = _json.data;
document.getElementById("floorCount").innerHTML = _data.floorCount + "栋";
document.getElementById("roomCount").innerHTML = _data.roomCount + "个";
document.getElementById("parkingSpaceCount").innerHTML = _data.parkingSpaceCount + "个";
document.getElementById("machineCount").innerHTML = _data.machineCount + "台";
return;
}
},
function (errInfo, error) {
console.log('请求失败处理');
vc.toast(errInfo);
});
}
/**
* 查询 资产信息
*/
function _getAssetOpenDoor() {
let param = {
params: {
communityId: vc.getCurrentCommunity().communityId
}
}
vc.http.apiGet(
'/bigScreen/getAssetOpenDoor',
param,
function (json, res) {
//vm.menus = vm.refreshMenuActive(JSON.parse(json),0);
let _json = JSON.parse(json);
if (_json.code == 0) {
let _data = _json.data;
_data = _data.reverse();
_initOpenDoorChart(_data);
return;
}
},
function (errInfo, error) {
console.log('请求失败处理');
vc.toast(errInfo);
});
}
_loadAssets();
_getAssetOpenDoor();