优化代码

This commit is contained in:
wuxw 2024-06-18 00:58:42 +08:00
parent 9bdc7edcfa
commit 0b0e3b1b83

View File

@ -25,19 +25,19 @@
let param = {
params: {
communityId: vc.getCurrentCommunity().communityId,
inspectionRouteId: _route.inspectionRouteId,
taskId: _route.taskId,
page: 1,
row: 1000
}
};
//发送get请求
vc.http.apiGet('/inspectionRoute.listInspectionRoutePoints',
vc.http.apiGet('/inspection.queryInspectionTaskDetail',
param,
function (json) {
let _json = JSON.parse(json);
$that.inspectionTaskMapInfo.data = _json.inspectionPoints;
$that.inspectionTaskMapInfo.data = _json.data;
$that.initInspectionTaskMap(_json.inspectionPoints);
$that.initInspectionTaskMap(_json.data);
},
function () {
@ -53,10 +53,16 @@
// });
if (_pos && _pos.length > 0) {
_lat = _pos[0].lat;
_lng = _pos[0].lng;
if (!_pos || _pos.length < 1) {
return;
}
_pos.forEach(_p => {
if (_p.lat) {
_lat = _p.lat;
_lng = _p.lng;
}
});
let center = new TMap.LatLng(_lat, _lng)
//定义map变量调用 TMap.Map() 构造函数创建地图
@ -115,7 +121,7 @@
geometries: _geometriesMarker
});
var label = new TMap.MultiLabel({
let label = new TMap.MultiLabel({
id: 'label-layer',
map: $that.inspectionTaskMapInfo.map, //设置折线图层显示到哪个地图实例中
//文字标记样式
@ -133,7 +139,7 @@
geometries: _geometriesLabel
});
var polylineLayer = new TMap.MultiPolyline({
let polylineLayer = new TMap.MultiPolyline({
id: 'polyline-layer', //图层唯一标识
map: $that.inspectionTaskMapInfo.map,//设置折线图层显示到哪个地图实例中
//折线样式定义