Merge branch 'main' of https://git.cityme.com.cn/xiangshan/ggfwjsc
This commit is contained in:
commit
a15d1cbeb9
|
@ -1161,7 +1161,7 @@ const getData = async (i, e) => {
|
||||||
"100nlPercent",
|
"100nlPercent",
|
||||||
];
|
];
|
||||||
if (res.data.ageGroupsPercent) {
|
if (res.data.ageGroupsPercent) {
|
||||||
console.log(PopulationRatio.value[0].progress);
|
// console.log(PopulationRatio.value[0].progress);
|
||||||
agename.forEach((key, index) => {
|
agename.forEach((key, index) => {
|
||||||
if (PopulationRatio.value[index]) {
|
if (PopulationRatio.value[index]) {
|
||||||
PopulationRatio.value[index].progress =
|
PopulationRatio.value[index].progress =
|
||||||
|
@ -1309,7 +1309,6 @@ const getDatas = async (e, i) => {
|
||||||
"100nlPercent",
|
"100nlPercent",
|
||||||
];
|
];
|
||||||
if (res.data.ageGroupsPercent) {
|
if (res.data.ageGroupsPercent) {
|
||||||
console.log(PopulationRatio.value[0].progress);
|
|
||||||
agename.forEach((key, index) => {
|
agename.forEach((key, index) => {
|
||||||
if (PopulationRatio.value[index]) {
|
if (PopulationRatio.value[index]) {
|
||||||
PopulationRatio.value[index].progress =
|
PopulationRatio.value[index].progress =
|
||||||
|
@ -1391,7 +1390,6 @@ const getDatas2 = async (e, i, cs) => {
|
||||||
"100nlPercent",
|
"100nlPercent",
|
||||||
];
|
];
|
||||||
if (res.data.ageGroupsPercent) {
|
if (res.data.ageGroupsPercent) {
|
||||||
console.log(PopulationRatio.value[0].progress);
|
|
||||||
agename.forEach((key, index) => {
|
agename.forEach((key, index) => {
|
||||||
if (PopulationRatio.value[index]) {
|
if (PopulationRatio.value[index]) {
|
||||||
PopulationRatio.value[index].progress =
|
PopulationRatio.value[index].progress =
|
||||||
|
@ -1742,7 +1740,6 @@ const to_jd = (item_name) => {
|
||||||
//详情
|
//详情
|
||||||
const open_detail = () => {
|
const open_detail = () => {
|
||||||
dialogShow.value = true;
|
dialogShow.value = true;
|
||||||
console.log(1111111111, dialogShow.value);
|
|
||||||
};
|
};
|
||||||
const close = () => {
|
const close = () => {
|
||||||
dialogShow.value = false;
|
dialogShow.value = false;
|
||||||
|
@ -1826,19 +1823,65 @@ const addggfwq = () => {
|
||||||
const average = sum / numericCoordinates.length; // 计算平均值
|
const average = sum / numericCoordinates.length; // 计算平均值
|
||||||
return parseFloat(average.toFixed(5)); // 保留5位小数并转换为数字
|
return parseFloat(average.toFixed(5)); // 保留5位小数并转换为数字
|
||||||
}
|
}
|
||||||
|
|
||||||
data.fwqCoordinates1 = calculateAverage(data.fwqCoordinates1);
|
data.fwqCoordinates1 = calculateAverage(data.fwqCoordinates1);
|
||||||
data.fwqCoordinates2 = calculateAverage(data.fwqCoordinates2);
|
data.fwqCoordinates2 = calculateAverage(data.fwqCoordinates2);
|
||||||
drawACircle();
|
|
||||||
|
let distances = []; // 初始化距离数组
|
||||||
|
fwqList.value.forEach((item) => {
|
||||||
|
let distance = algorithm(
|
||||||
|
(item.point[0] = Number(item.point[0].replace(/[^0-9.-]/g, ""))),
|
||||||
|
(item.point[1] = Number(item.point[1].replace(/[^0-9.-]/g, ""))),
|
||||||
|
data.fwqCoordinates1,
|
||||||
|
data.fwqCoordinates2
|
||||||
|
);
|
||||||
|
distances.push(distance); // 将距离存入数组
|
||||||
|
});
|
||||||
|
let maxDistance = Math.max(...distances); // 找到最大距离
|
||||||
|
maxDistance = Math.ceil(maxDistance * 1.8); // 向上取整
|
||||||
|
if (maxDistance < 100) {
|
||||||
|
maxDistance = 150; // 如果小于 100,则赋值为 150
|
||||||
|
}
|
||||||
|
console.log("最大距离:", maxDistance);
|
||||||
|
drawACircle(maxDistance);
|
||||||
} else {
|
} else {
|
||||||
ElMessage.warning("无数据");
|
ElMessage.warning("无数据");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
//计算两点之间直线距离
|
||||||
|
const algorithm = (point1, point2, point3, point4) => {
|
||||||
|
// console.log(point1, point2, point3, point4, 5555);
|
||||||
|
let [x1, y1] = [point1, point2];
|
||||||
|
let [x2, y2] = [point3, point4];
|
||||||
|
let Lat1 = rad(x1); // 纬度
|
||||||
|
let Lat2 = rad(x2);
|
||||||
|
let a = Lat1 - Lat2; // 两点纬度之差
|
||||||
|
let b = rad(y1) - rad(y2); // 经度之差
|
||||||
|
let s =
|
||||||
|
2 *
|
||||||
|
Math.asin(
|
||||||
|
Math.sqrt(
|
||||||
|
Math.pow(Math.sin(a / 2), 2) +
|
||||||
|
Math.cos(Lat1) * Math.cos(Lat2) * Math.pow(Math.sin(b / 2), 2)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
// 计算两点距离的公式
|
||||||
|
s = s * 6378137.0; // 弧长等于弧度乘地球半径(半径为米)
|
||||||
|
s = Math.round(s * 10000) / 10000; // 精确距离的数值
|
||||||
|
return s;
|
||||||
|
};
|
||||||
|
|
||||||
|
// 角度转换成弧度
|
||||||
|
const rad = (d) => {
|
||||||
|
return (d * Math.PI) / 180.0;
|
||||||
|
};
|
||||||
|
|
||||||
// 添加服务圈
|
// 添加服务圈
|
||||||
const drawACircle = (v) => {
|
const drawACircle = (maxDistance) => {
|
||||||
// console.log("经纬度1", data.fwqCoordinates1, data.fwqCoordinates2);
|
// console.log("经纬度1", data.fwqCoordinates1, data.fwqCoordinates2);
|
||||||
if (!circle) {
|
if (!circle) {
|
||||||
var point = new BMapGL.Point(data.fwqCoordinates1, data.fwqCoordinates2);
|
var point = new BMapGL.Point(data.fwqCoordinates1, data.fwqCoordinates2);
|
||||||
circle = new BMapGL.Circle(point, 1000, {
|
circle = new BMapGL.Circle(point, maxDistance, {
|
||||||
strokeColor: "yellow",
|
strokeColor: "yellow",
|
||||||
strokeWeight: 2,
|
strokeWeight: 2,
|
||||||
strokeOpacity: 0.8,
|
strokeOpacity: 0.8,
|
||||||
|
@ -2184,7 +2227,6 @@ const createCustomOverlayJd2 = (polygon, indexx) => {
|
||||||
}
|
}
|
||||||
let num = "";
|
let num = "";
|
||||||
if (choose.value.person == "6666") {
|
if (choose.value.person == "6666") {
|
||||||
console.log(1);
|
|
||||||
num = "swrs";
|
num = "swrs";
|
||||||
} else if (
|
} else if (
|
||||||
choose.value.person == "cjr" ||
|
choose.value.person == "cjr" ||
|
||||||
|
@ -2248,7 +2290,7 @@ const loadCs = (name) => {
|
||||||
};
|
};
|
||||||
//添加村社区块
|
//添加村社区块
|
||||||
const addPolygonCountyCs = () => {
|
const addPolygonCountyCs = () => {
|
||||||
console.log(11111111111111, xkzDk);
|
// console.log(11111111111111, xkzDk);
|
||||||
xkzDk.map((item, index) => {
|
xkzDk.map((item, index) => {
|
||||||
let num = index % 9;
|
let num = index % 9;
|
||||||
let fillColor = colorList[num].bg;
|
let fillColor = colorList[num].bg;
|
||||||
|
|
Loading…
Reference in New Issue