|
|
@ -19,11 +19,22 @@ |
|
|
|
const mapAttribute = config["chartStyle"]["mapProp"]["value"]; |
|
|
|
const mapAttribute = config["chartStyle"]["mapProp"]["value"]; |
|
|
|
|
|
|
|
|
|
|
|
// 地图组件初始化
|
|
|
|
// 地图组件初始化
|
|
|
|
const map = new AMap.Map(dom, { |
|
|
|
let map; |
|
|
|
resizeEnable: true, |
|
|
|
let customConfig = config.customConfig; |
|
|
|
center: [mapAttribute[0], mapAttribute[1]], |
|
|
|
if (customConfig != null && JSON.stringify(customConfig).length > 2) { |
|
|
|
zoom: mapAttribute[2], |
|
|
|
// 读取保存的配置
|
|
|
|
}); |
|
|
|
map = new AMap.Map(dom, { |
|
|
|
|
|
|
|
resizeEnable: true, |
|
|
|
|
|
|
|
center: [customConfig.lng, customConfig.lat], |
|
|
|
|
|
|
|
zoom: customConfig.zoom, |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
map = new AMap.Map(dom, { |
|
|
|
|
|
|
|
resizeEnable: true, |
|
|
|
|
|
|
|
center: [mapAttribute[0], mapAttribute[1]], |
|
|
|
|
|
|
|
zoom: mapAttribute[2], |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 地图设置样式
|
|
|
|
// 地图设置样式
|
|
|
|
const styleName = "amap://styles/" + mapAttribute[3]; |
|
|
|
const styleName = "amap://styles/" + mapAttribute[3]; |
|
|
@ -48,6 +59,13 @@ |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
document.querySelector("#amap-demo-click").onclick = function () { |
|
|
|
document.querySelector("#amap-demo-click").onclick = function () { |
|
|
|
|
|
|
|
let conf = { |
|
|
|
|
|
|
|
zoom: map.getZoom(), |
|
|
|
|
|
|
|
lng: map.getCenter().lng, |
|
|
|
|
|
|
|
lat: map.getCenter().lat, |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
// 保存配置
|
|
|
|
|
|
|
|
saveSessionCallback(conf); |
|
|
|
extensionCallBack('refresh'); |
|
|
|
extensionCallBack('refresh'); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|