projectMap.js
2.35 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
let action = null;
var app = null;
layui.config({
base: "/js/",
version: 1
}).use(['system'], function () {
var form = layui.form,
$ = layui.jquery,
element = layui.element,
table = layui.table,
system = layui.system,
sysU = new system.u(),
sendDataWhere = null,
areaName = "configure",
controllerName = "BaseProject",
mapObj = null;
action = {
}
app = {
data: {
mapEle: "container",
},
methods: {
initMap() {
mapObj = mapApp(app.data.mapEle).initMap();
},
getProjectData() {
var ajaxConfig = {
data: { pageRequest: null, entity: { flag:"projectMapList" } },
url: `/configure/BaseProject/Load`,
success: function (result) {
if (sysU.successBefore(result)) return false;
app.methods.createMarkerInfo(result)
}
};
sysU.ajax(ajaxConfig);
},
createMarkerInfo(json) {
json.Result.forEach(item => {
var content = `<h4 style = 'margin:0;'>${item.projectAddress}</h4>
设备总数:${item.eqCount}、在线:<span style='color:blue;'>${item.eqOnLine}</span>、待机:${item.eqOff}、故障:<span style='color:red;'>${item.eqAlarm}</span>
<div style = 'display: flex;' >
<div><a style='text-decoration: underline;color: blue;' onclick='app.methods.mapMarkerClick(${JSON.stringify(item)})' href='#'>点击链接</a></div>
</div >` ;//定义大标题 写html语句标签
mapObj.createMarkerInfo(content, {
title: "项目名称:"+item.projectName,
longitude: item.longitude,
latitude: item.latitude
});
})
},
mapMarkerClick(item) {
alert(JSON.stringify(item))
}
},
registerEvent: function () {
},
init: function () {
app.methods.initMap();
app.methods.getProjectData();
app.registerEvent();
}
};
app.init();
});