This commit is contained in:
duanxiaohai 2024-07-30 14:00:10 +08:00
parent 43f064e8aa
commit 296562a0cd
1 changed files with 10 additions and 4 deletions

View File

@ -1390,7 +1390,7 @@ const changeFwq = async (id, name, names) => {
circle = null; circle = null;
// drawACircle("hide"); // // drawACircle("hide"); //
} else { } else {
csh() csh();
await getServiceCircle(names, name); await getServiceCircle(names, name);
if (fwqList.value.length !== 0) { if (fwqList.value.length !== 0) {
fwq_list_arr.value.forEach((item, index) => { fwq_list_arr.value.forEach((item, index) => {
@ -1434,13 +1434,20 @@ const addggfwq = () => {
data.fwqCoordinates2.push(item.point[1]); data.fwqCoordinates2.push(item.point[1]);
createCustomOverlay(item, index); createCustomOverlay(item, index);
}); });
console.log("经纬度", data.fwqCoordinates1, data.fwqCoordinates2);
function calculateAverage(coordinates) { function calculateAverage(coordinates) {
const numericCoordinates = coordinates.map(Number); // // const numericCoordinates = coordinates.map(Number); //
const numericCoordinates = coordinates.map((coord) => {
// 使
const cleanedCoord = coord.replace(/[^0-9.-]/g, "");
return Number(cleanedCoord); //
});
const sum = numericCoordinates.reduce((acc, val) => acc + val, 0); // const sum = numericCoordinates.reduce((acc, val) => acc + val, 0); //
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(); drawACircle();
} else { } else {
@ -1449,7 +1456,7 @@ const addggfwq = () => {
}; };
// //
const drawACircle = (v) => { const drawACircle = (v) => {
console.log("经纬度", 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, 1000, {
@ -2713,7 +2720,6 @@ onMounted(() => {
} }
} }
.title { .title {
.title_name { .title_name {
cursor: pointer; cursor: pointer;