This commit is contained in:
parent
43f064e8aa
commit
296562a0cd
|
@ -1390,7 +1390,7 @@ const changeFwq = async (id, name, names) => {
|
|||
circle = null;
|
||||
// drawACircle("hide"); //隐藏服务圈 圆
|
||||
} else {
|
||||
csh()
|
||||
csh();
|
||||
await getServiceCircle(names, name);
|
||||
if (fwqList.value.length !== 0) {
|
||||
fwq_list_arr.value.forEach((item, index) => {
|
||||
|
@ -1434,13 +1434,20 @@ const addggfwq = () => {
|
|||
data.fwqCoordinates2.push(item.point[1]);
|
||||
createCustomOverlay(item, index);
|
||||
});
|
||||
console.log("经纬度", data.fwqCoordinates1, data.fwqCoordinates2);
|
||||
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 average = sum / numericCoordinates.length; // 计算平均值
|
||||
return parseFloat(average.toFixed(5)); // 保留5位小数并转换为数字
|
||||
}
|
||||
data.fwqCoordinates1 = calculateAverage(data.fwqCoordinates1);
|
||||
|
||||
data.fwqCoordinates2 = calculateAverage(data.fwqCoordinates2);
|
||||
drawACircle();
|
||||
} else {
|
||||
|
@ -1449,7 +1456,7 @@ const addggfwq = () => {
|
|||
};
|
||||
// 添加服务圈
|
||||
const drawACircle = (v) => {
|
||||
console.log("经纬度", data.fwqCoordinates1, data.fwqCoordinates2);
|
||||
// console.log("经纬度1", data.fwqCoordinates1, data.fwqCoordinates2);
|
||||
if (!circle) {
|
||||
var point = new BMapGL.Point(data.fwqCoordinates1, data.fwqCoordinates2);
|
||||
circle = new BMapGL.Circle(point, 1000, {
|
||||
|
@ -2713,7 +2720,6 @@ onMounted(() => {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
.title {
|
||||
.title_name {
|
||||
cursor: pointer;
|
||||
|
|
Loading…
Reference in New Issue