forked from dyf/dyf-vue-ui
控制中心添加670的控制,大屏页面问题
This commit is contained in:
@ -26,6 +26,14 @@ function SosSetting (data: any) {
|
||||
data: data
|
||||
});
|
||||
};
|
||||
//批量强制报警
|
||||
function SosSettingBatch(data:any){
|
||||
return request({
|
||||
url: `/api/xinghan/device/SOSGradeSettingsBatch`,
|
||||
method: 'post',
|
||||
data: data
|
||||
});
|
||||
}
|
||||
|
||||
//静电探测档位控制
|
||||
function staticPowerSetting (data: any) {
|
||||
@ -62,5 +70,6 @@ export default {
|
||||
SosSetting:SosSetting,
|
||||
staticPowerSetting:staticPowerSetting,
|
||||
deviceRealTimeStatus:deviceRealTimeStatus,
|
||||
SendMessage:SendMessage
|
||||
SendMessage:SendMessage,
|
||||
SosSettingBatch:SosSettingBatch
|
||||
};
|
||||
@ -7,11 +7,11 @@ function initMap(click) {
|
||||
map = new AMap.Map("map", {
|
||||
viewMode: '2D', //默认使用 2D 模式
|
||||
zoom: 11, //地图级别
|
||||
center: [116.396477 , 39.909278], //地图中心点
|
||||
center: [116.396477, 39.909278], //地图中心点
|
||||
mapStyle: "amap://styles/darkblue"
|
||||
});
|
||||
|
||||
map.on('click', function (evt) {
|
||||
map.on('click', function (evt) {
|
||||
// alert('您点击的位置:'+evt.lnglat.lng+' , '+ evt.lnglat.lat);
|
||||
if (click) {
|
||||
click(evt.lnglat);
|
||||
@ -35,7 +35,7 @@ function initMap(click) {
|
||||
|
||||
//添加一个点
|
||||
function AddPoint(point, index, dragEnd, click, iconImg) {
|
||||
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
try {
|
||||
if (!point) {
|
||||
@ -65,7 +65,8 @@ function AddPoint(point, index, dragEnd, click, iconImg) {
|
||||
title: point.isAlarming ? '正在报警:' + point.deviceName : point.deviceName,
|
||||
text: index,
|
||||
class: 'point',
|
||||
extData: point
|
||||
extData: point,
|
||||
anchor:'bottom-center'
|
||||
});
|
||||
marker.setMap(map);
|
||||
|
||||
@ -101,30 +102,12 @@ function setCenter(lon, latitude) {
|
||||
}
|
||||
|
||||
function calcCenter() {
|
||||
|
||||
|
||||
if (!layPoints || layPoints.length === 0) {
|
||||
throw new Error("坐标数组不能为空");
|
||||
}
|
||||
|
||||
// 计算所有经度和纬度的总和
|
||||
const total = layPoints.reduce((sum, point) => {
|
||||
return {
|
||||
lng: sum.lng + parseFloat(point.lng),
|
||||
lat: sum.lat + parseFloat(point.lat)
|
||||
};
|
||||
}, { lng: 0, lat: 0 });
|
||||
|
||||
// 计算平均值得到中心点
|
||||
const center = {
|
||||
lng: total.lng / layPoints.length,
|
||||
lat: total.lat / layPoints.length
|
||||
};
|
||||
|
||||
return center;
|
||||
}
|
||||
//画多边形
|
||||
function DrawPoy(points) {
|
||||
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
if (!map) {
|
||||
reject("map未初始化");
|
||||
@ -179,6 +162,7 @@ function DrawPoy(points) {
|
||||
}
|
||||
//画圆形
|
||||
function DrawCicle(points, raduis, dragEnd) {
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
if (!map) {
|
||||
reject("map未初始化");
|
||||
@ -201,7 +185,7 @@ function DrawCicle(points, raduis, dragEnd) {
|
||||
reject("圆的中心点不正确")
|
||||
return;
|
||||
}
|
||||
layPoints.push({ lng: coordinates[0].lng, lat: points.coordinates[0].lat });
|
||||
|
||||
let circle = new AMap.Circle({
|
||||
center: [points.coordinates[0].lng, points.coordinates[0].lat],
|
||||
radius: raduis ? raduis : 1000, //半径
|
||||
@ -217,6 +201,7 @@ function DrawCicle(points, raduis, dragEnd) {
|
||||
zIndex: 50,
|
||||
})
|
||||
map.add(circle);
|
||||
layPoints.push({ lng: points.coordinates[0].lng, lat: points.coordinates[0].lat });
|
||||
resolve("添加圆成功");
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user