优化首页

This commit is contained in:
weidong 2024-02-04 14:36:58 +08:00
parent 2b77c8c78a
commit 05e79800c7
8 changed files with 41 additions and 16 deletions

View File

@ -52,6 +52,7 @@ public class IndexController extends BasicController{
statusQueryWrapper.ne("tenantid", tenantId);
statusQueryWrapper.isNotNull("latitude");
statusQueryWrapper.isNotNull("longitude");
statusQueryWrapper.orderByAsc("warning");
deviceList = statusMapper.selectList(statusQueryWrapper);
statusQueryWrapper = new QueryWrapper<>();

Binary file not shown.

After

Width:  |  Height:  |  Size: 577 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 461 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 232 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 938 B

After

Width:  |  Height:  |  Size: 528 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 528 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 231 B

After

Width:  |  Height:  |  Size: 448 B

View File

@ -90,11 +90,16 @@
[# th:each="device : ${deviceList}"]
{deviceid:[[${device.deviceid}]],
latitude:[[${device.latitude}]],
longitude:[[${device.longitude}]]},
longitude:[[${device.longitude}]],
warning:[[${device.warning}]]},
[/]
];
let batch_id = 0;
var convertor = new BMapGL.Convertor();
var loc_green = new BMapGL.Icon("../images/loc1_green.png", new BMapGL.Size(18, 24));
var loc_red = new BMapGL.Icon("../images/loc1_red.png", new BMapGL.Size(18, 24));
var loc_orange = new BMapGL.Icon("../images/loc1_orange.png", new BMapGL.Size(18, 24));
//console.log(deviceList);
for(var i=0; i<deviceList.length; i++) {
@ -107,21 +112,47 @@
map.setCenter(new BMapGL.Point(centerLon,centerLat));
}
translateCallback = function (data){
if(data.status === 0) {
var i=0;
for(; i<data.points.length; i++) {
map.addOverlay(new BMapGL.Marker(data.points[i],{
icon:loc_green
}));
if(deviceList[batch_id+i].warning == 2) {
map.addOverlay(new BMapGL.Marker(data.points[i], {
icon: loc_red
}));
}
else if(deviceList[batch_id+i].warning == 1) {
map.addOverlay(new BMapGL.Marker(data.points[i], {
icon: loc_orange
}));
}
else {
map.addOverlay(new BMapGL.Marker(data.points[i], {
icon: loc_green
}));
}
if(deviceList[batch_id+i].warning != 0){
var label = new BMapGL.Label(deviceList[batch_id+i].deviceid,
{
position: data.points[i], // 指定文本标注所在的地理位置
offset: new BMapGL.Size(10, 10) // 设置文本偏移量
}); // 创建文本标注对象
map.addOverlay(label);
}
}
}
batch_id+=10;
// 函数内定时器的回调函数会继续调用 timer()
if(batch_id<deviceList.length) {
setTimeout(() => {
timer();
}, 500);
}
}
let batch_id = 0;
var convertor = new BMapGL.Convertor();
//每秒转换10个坐标否则会受百度并发限制
function timer() {
var pointArr = [];
@ -136,16 +167,9 @@
convertor.translate(pointArr, 1, 5, translateCallback);
batch_id+=10;
// 函数内定时器的回调函数会继续调用 timer()
if(batch_id<totalNum) {
setTimeout(() => {
timer();
}, 500);
}
}
// 启动函数
timer()
timer();
}