Commit a4cface6 by 前端

Merge branch 'v1.20.1' into 'develop'

v1.21.0版本需求已上线,合并代码到develop

See merge request !55
2 parents 6b305168 6b8da5c5
...@@ -21,7 +21,6 @@ const MAPGEO = { ...@@ -21,7 +21,6 @@ const MAPGEO = {
} }
}, },
transfer(obj, cb){ transfer(obj, cb){
const data = obj.data; const data = obj.data;
obj.len = data.length; obj.len = data.length;
obj.times = obj.len>20?Math.ceil(obj.len/20):1; obj.times = obj.len>20?Math.ceil(obj.len/20):1;
...@@ -43,14 +42,18 @@ const MAPGEO = { ...@@ -43,14 +42,18 @@ const MAPGEO = {
geocoderGetAdr(lnglatArr, initIdx) geocoderGetAdr(lnglatArr, initIdx)
})(initIdx) })(initIdx)
} }
function fixed6(num){
return Number(num).toFixed(6);
}
function geocoderGetAdr(arr, initIdx){ function geocoderGetAdr(arr, initIdx){
const timeoutId = window.setTimeout(()=>{ const timeoutId = window.setTimeout(()=>{
MAPGEO.geocoder.getAddress(arr, function(status, result) { MAPGEO.geocoder.getAddress(arr, function(status, result) {
if (status === 'complete' && result.info === 'OK') {//获取地址成功 if (status === 'complete' && result.info === 'OK') {//获取地址成功
result.regeocodes.forEach((item, idx)=>{ result.regeocodes.forEach((item, idx)=>{
let o = arr[idx] let o = arr[idx]
let _idx = data.findIndex(k => k.elng == o.lng && k.elat == o.lat); // limin 20230627 arr经纬度会被改成四舍五入6位小数 导致比较得不出index.方案:全部转成四舍五入6位再比较
// let _idx = data.findIndex(k => k.elng == o.lng && k.elat == o.lat);
let _idx = data.findIndex(k =>fixed6(k.elng) == fixed6(o.lng) && fixed6(k.elat) == fixed6(o.lat));
//data[initIdx + idx].transferAddress = item.formattedAddress; //data[initIdx + idx].transferAddress = item.formattedAddress;
data[_idx].transferAddress = item.formattedAddress; data[_idx].transferAddress = item.formattedAddress;
obj.totalNum++; obj.totalNum++;
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!