This commit is contained in:
duanxiaohai 2024-08-02 14:39:49 +08:00
parent e97173cf1d
commit 668ad34ea2
1 changed files with 52 additions and 11 deletions

View File

@ -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 =
@ -1321,7 +1320,7 @@ const getDatas = async (e, i) => {
}); });
}; };
const getDatas2 = async (e, i, cs) => { const getDatas2 = async (e, i, cs) => {
let i1=i; let i1 = i;
if ( if (
i == "cjr" || i == "cjr" ||
i == "dibian" || i == "dibian" ||
@ -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,20 +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,
@ -2185,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" ||
@ -2249,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;