|
|
|
@ -126,6 +126,7 @@ import Tabs from "@/views/dataBoard/satisfactionEval/components/Tabs/index.vue"; |
|
|
|
|
|
|
|
import { requestPostBi } from "@/js/dai/request-bipass"; |
|
|
|
import { requestPost } from "@/js/dai/request"; |
|
|
|
import { spliceIntoChunks } from "@/utils/index"; |
|
|
|
|
|
|
|
export default { |
|
|
|
name: "renfang", |
|
|
|
@ -327,7 +328,34 @@ export default { |
|
|
|
} |
|
|
|
this.getMapData(item.orgId, item.orgLevel); |
|
|
|
}, |
|
|
|
getCenterPoint(geoCoordinateList) { |
|
|
|
const geoCoordinateListFlat = geoCoordinateList.reduce((s, v) => { |
|
|
|
return (s = s.concat(v)) |
|
|
|
}, []) |
|
|
|
const total = geoCoordinateListFlat.length |
|
|
|
let X = 0 |
|
|
|
let Y = 0 |
|
|
|
let Z = 0 |
|
|
|
for (const g of geoCoordinateListFlat) { |
|
|
|
const lat = g.lat * Math.PI / 180 |
|
|
|
const lon = g.lng * Math.PI / 180 |
|
|
|
const x = Math.cos(lat) * Math.cos(lon) |
|
|
|
const y = Math.cos(lat) * Math.sin(lon) |
|
|
|
const z = Math.sin(lat) |
|
|
|
X += x |
|
|
|
Y += y |
|
|
|
Z += z |
|
|
|
} |
|
|
|
|
|
|
|
X = X / total |
|
|
|
Y = Y / total |
|
|
|
Z = Z / total |
|
|
|
const Lon = Math.atan2(Y, X) |
|
|
|
const Hyp = Math.sqrt(X * X + Y * Y) |
|
|
|
const Lat = Math.atan2(Z, Hyp) |
|
|
|
|
|
|
|
return { lng: Lon * 180 / Math.PI, lat: Lat * 180 / Math.PI } |
|
|
|
}, |
|
|
|
// 点击搜索结果条目,在地图上显示点和详情弹窗 |
|
|
|
handleClickSearchItem(item) { |
|
|
|
if (!item.longitude) { |
|
|
|
@ -342,12 +370,24 @@ export default { |
|
|
|
let org = this.orgData.children; |
|
|
|
org.forEach((item) => { |
|
|
|
data.forEach((item2) => { |
|
|
|
let coordinates = spliceIntoChunks(item.coordinates.split(",").map((item) => parseFloat(item)),2) |
|
|
|
let coordinates2 = coordinates.map(item3 => { |
|
|
|
return [{ |
|
|
|
lat: item3[1], |
|
|
|
lng: item3[0] |
|
|
|
}] |
|
|
|
}) |
|
|
|
let index = parseInt(coordinates.length / 2) |
|
|
|
console.log(index,coordinates,'coordinates',coordinates2,this.getCenterPoint(coordinates2)) |
|
|
|
let centerLngLat = this.getCenterPoint(coordinates2) |
|
|
|
// spliceIntoChunks |
|
|
|
if (item2.orgId === item.id && item.coordinates) { |
|
|
|
params.push({ |
|
|
|
...item2, |
|
|
|
peopleType: this.peopleList[this.peopleType], |
|
|
|
latitude: item.latitude, |
|
|
|
longitude: item.longitude, |
|
|
|
latitude: centerLngLat.lat, |
|
|
|
longitude: centerLngLat.lng, |
|
|
|
coordinates |
|
|
|
}); |
|
|
|
} |
|
|
|
}); |
|
|
|
|