ProjectOverview.js
6.77 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
let action = null;
layui.config({
base: "/js/",
version: 1
}).use(['system',"vue"], function () {
var form = layui.form,
$ = layui.jquery,
element = layui.element,
table = layui.table,
system = layui.system,
sysU = new system.u(),
sendDataWhere = null,
sendDataDescWhere = null,
areaName = "configure",
controllerName = "BaseProject",
projectKeys = null,
projectName = "",
vueApp=null,
app = null;
action = {
}
app = {
data: {
cols: [[
{ field: "zizeng", width: 80, title: "序号", fixed: "left", type: "numbers" },
{
field: "equipmentName", width: 220, title: "设备"
},
{
field: "Status", width: 150, title: "ip地址", templet: function (d) {
if (d.Status == "" || d.Status == null) return "";
var bg = "layui-badge-dot layui-bg-green",
statusText = "在线";
if (d.Status == "Failure") {
statusText = "故障";
bg = "layui-badge-dot layui-bg-red";
}
if (d.seconds > 300) {
statusText = "离线";
bg = "layui-badge-dot layui-bg-gray";
}
return `<span class="${bg}" style=" left: 7px;"></span> <span style="padding-left: 8px;">${statusText}</span`;
}
}
]],
tableIns: null,
tableElem: "mainList",
echartOpt: {
eqTuoShanRateEle: document.getElementById("eqTuoShanRate"),
eqAlarmsNumberEle: document.getElementById("eqAlarmsNumber"),
tuoShanRatelegendData: "".GetTimeRange("","",7)
}
},
methods: {
initTable: function (opt) {
var config = { projectKeys: projectKeys }
if (opt != undefined) $.extend(config, opt);
let options = {
elem: "#" + app.data.tableElem,
url: `/configure/BaseProject/GetEqInfoByProjectKeys`,
cols: app.data.cols,
height: 'full-400', // 最大高度减去其他容器已占有的高度差
where: config,
page: false
}
app.data.tableIns = sysU.initTable(options);
},
initEchartsTuoShanRate: function () {
let myChart = echarts.init(app.data.echartOpt.eqTuoShanRateEle)
//window.eqTuoShanRateOpt.legend.data = legendData
window.eqTuoShanRateOpt.xAxis[0].data = app.data.echartOpt.tuoShanRatelegendData
//window.eqTuoShanRateOpt.series=[];
//for (var i = 0; i < seriesData.length; i++) {
// var serItemData = {
// name: '设备1',
// type: 'line',
// data: []
// }
// window.eqTuoShanRateOpt.series.push(serItemData);
//}
myChart.clear()
myChart.setOption(window.eqTuoShanRateOpt)
},
initEchartsAlarmsNumber: function () {
let myChart = echarts.init(app.data.echartOpt.eqAlarmsNumberEle)
//window.eqTuoShanRateOpt.legend.data = legendData
//window.eqTuoShanRateOpt.xAxis[0].data = xAxisData
//window.eqTuoShanRateOpt.series=[];
//for (var i = 0; i < seriesData.length; i++) {
// var serItemData = {
// name: '设备1',
// type: 'line',
// data: []
// }
// window.eqTuoShanRateOpt.series.push(serItemData);
//}
myChart.clear()
myChart.setOption(window.eqAlarmsNumber)
},
/**
* 初始化vue
*/
initVue: function () {
vueApp = new Vue({
el: '.vueApp',
data: {
head: {
projectName: 0
},
body: {
eqCount: 0,
eqOnline: 0,
eqStandBy: 0,
eqOffline: 0,
eqError:0,
eqOnlineRate:0,
},
},
methods: {
},
ready: function () {
this.head.projectName = `${projectName}`;
}
});
},
/**
* vue 集合赋值 result.Result.eqCount
*/
initVueDataValue: function (result) {
var res = result.Result;
vueApp.body.eqCount = res.eqSumCount;
vueApp.body.eqOnline = res.eqOnLineCount;
vueApp.body.eqStandBy = res.eqStandByCount;
vueApp.body.eqError = res.eqErrorCount;
vueApp.body.eqOffline = res.eqOffLineCount;
vueApp.body.eqOnlineRate = res.runningRate;
},
getUrlParam: function () {
projectKeys = localStorage.getItem("projectMapKeys");
projectName = localStorage.getItem("projectMapName");
},
getEquipmentDataList() {
var ajaxConfig = {
data: { pageRequest: null, entity: { flag: "projectMapList", keys: projectKeys } },
url: `/configure/BaseProject/LoadProjectOverview`,
success: function (result) {
if (sysU.successBefore(result)) return false;
app.methods.initVueDataValue(result);
}
};
sysU.ajax(ajaxConfig);
},
init: function () {
var tempElem = $(".sys-a-det");
tempElem.attr("href", tempElem.data("scr") + `?projectKeys=${projectKeys}`)
app.methods.getEquipmentDataList();
app.methods.initEchartsTuoShanRate();
app.methods.initEchartsAlarmsNumber();
}
},
registerEvent: function () {
},
init: function () {
app.methods.getUrlParam();
app.methods.initVue();
app.methods.initTable();
app.methods.init();
}
};
app.init();
});