Commit 6a9cef23 authored by 纪泽龙's avatar 纪泽龙

Merge branch 'develop_jzl'

parents 84a3840b 554757ba
......@@ -271,7 +271,14 @@ export default {
if (res.code == 200) {
this.dialogVisible = false;
data.pipeId = data.pipeId ? data.pipeId : res.data;
this.lineOkCallBack.call(this.gaodeMap, this.target, data);
this.lineOkCallBack.call(this.gaodeMap, this.target, data,()=>{
const arr= this.gaodeMap.polyLines.map(item=>{
return item.getExtData().lineData
})
console.log("arr===================",arr)
this.gaodeMap.view.pipeClassify(arr)
this.gaodeMap.view.pipeList();
});
if (!this.editForm.pipeId) {
this.gaodeMap.newLineObj = null;
this.gaodeMap.createNewLine();
......
......@@ -214,10 +214,12 @@ export default {
if (valid) {
if (this.form.deviceId != null) {
updateDeviceInfo(this.form).then((response) => {
if (response.code == 200) {
this.dialogVisible = false;
this.map.remove(this.obj);
this.gaoMap.addMarker(this.gaoMap.deviceType, this.form);
this.msgSuccess("修改成功");
}
});
} else {
addDeviceInfo(this.form).then((response) => {
......
......@@ -35,6 +35,8 @@ class gaodeMap {
myMap = null;
showInfoWindow = null;
view = null;
// 地图移动结束后出现infowindow用的函数
handleInfoWindowOpenFunc = null;
//构造函数中设置中央点默认值
constructor(center) {
......@@ -88,6 +90,10 @@ class gaodeMap {
this.closeInfoWindow();
});
this.myMap.on("moveend", () => {
if (this.handleInfoWindowOpenFunc) {
this.handleInfoWindowOpenFunc();
this.handleInfoWindowOpenFunc = null;
}
// console.log("缩放开始")
if (!this.onceFlag) {
this.onceFlag = true;
......@@ -101,7 +107,9 @@ class gaodeMap {
this.districtBoundaries();
}
panTo(lnglat) {
this.myMap.panTo(lnglat);
}
/**
* 获取map
* @returns {AMap.Map}
......@@ -160,7 +168,7 @@ class gaodeMap {
* @param markerType
* @param lnglats
*/
addMarker(markerType, data) {
addMarker(markerType, data, func) {
let that = this;
that.markerType = markerType;
let infoWindow = new AMap.InfoWindow({
......@@ -189,8 +197,9 @@ class gaodeMap {
DEVICE_TYPE.INSPECTOR != markerType
) {
marker.content = this.getMarketContent(data);
marker.on("mouseover", infoOpen);
marker.on("mouseover", this.infoOpen);
marker.on("mouseout", infoClose);
marker.infoWindow = infoWindow;
marker.setExtData(data);
that.deviceType = markerType;
let editWindow = that.createInfowindow("编辑");
......@@ -287,17 +296,19 @@ class gaodeMap {
map.setStatus(options);
//infoWindow.close(map, e.target.getPosition());
}
function infoOpen(e) {
if (func) {
func();
}
}
// 其他设备
infoOpen = e => {
let options = map.getStatus();
options.scrollWheel = false;
map.setStatus(options);
infoWindow.setContent(e.target.content);
infoWindow.open(map, e.target.getPosition());
that.markerInfoWindow = infoWindow;
}
}
e.target.infoWindow.setContent(e.target.content);
e.target.infoWindow.open(map, e.target.getPosition());
this.markerInfoWindow = e.target.infoWindow;
};
/**
* marker添加拖拽事件
*/
......@@ -454,7 +465,7 @@ class gaodeMap {
* 添加折线
* @param path
*/
addPolyline(arr) {
addPolyline(arr, func) {
// this` polyLines = [];
console.log("包装的数组", arr);
for (let i = 0; i < arr.length; i++) {
......@@ -480,8 +491,13 @@ class gaodeMap {
lineData: item
}
});
// 如果是修改后包装,有记录的index 就在原位置插入,如果没有,就直接在最后插入
if (this.changePolineListNum===null) {
this.polyLines.push(polyline);
}else{
this.polyLines.splice(this.changePolineListNum,0,polyline);
this.changePolineListNum=null;
}
// 信息窗体
const dom = createPop(lineInfoWindow, {
obj: { a: 123, editorPage: true, ...item, polyline }
......@@ -510,9 +526,29 @@ class gaodeMap {
this.newLineAddEvent(polyline);
polyline.infoWindow = infoWindow;
//添加事件
polyline.on("mouseover", e => {
polyline.on("mouseover", this.polylineMouseOver);
polyline.on("mouseout", e => {
polyline.setOptions({ strokeColor: "#F7FE38" });
// infoWindow.close();
});
// 计算info的位置
// function infoPosition() {}
}
map.add(this.polyLines);
if (func) {
func();
}
// 缩放地图到合适的视野级别
// map.setFitView();
}
// 鼠标移入管道
polylineMouseOver = e => {
let polyline = e.target;
if (this.lineType == 1) return;
// 上方导航的高
let X = 20,
Y = -20;
if (e.originEvent) {
const topBar = 81;
// 坐标导航的宽
const leftBar = 100;
......@@ -523,10 +559,10 @@ class gaodeMap {
} = document.body;
// 弹出的信息窗口的宽高
const {
offsetWidth: infoWindowWidth,
offsetHeight: infoWindowHeight
} = { offsetWidth: 406, offsetHeight: 316 };
const { offsetWidth: infoWindowWidth, offsetHeight: infoWindowHeight } = {
offsetWidth: 406,
offsetHeight: 316
};
// 鼠标碰到线后的位置
const { clientX: mouseClientX, clientY: mouseClientY } = e.originEvent;
// 鼠标到左边界的距离
......@@ -537,8 +573,7 @@ class gaodeMap {
const offsetBottomY = windowClientHeight - mouseClientY;
const offsetY = mouseClientY - 80 - infoWindowHeight;
let X = 20,
Y = -20;
if (offsetLeftX <= infoWindowWidth) {
console.log("靠左了");
X = 20;
......@@ -554,24 +589,16 @@ class gaodeMap {
Y = -infoWindowHeight - 20;
}
polyline.setOptions({ strokeColor: "#FF5A67" });
infoWindow.setOffset(new AMap.Pixel(X, Y));
infoWindow.open(map, e.lnglat);
}
polyline.infoWindow.setOffset(new AMap.Pixel(X, Y));
polyline.infoWindow.open(map, e.lnglat);
// polyline.infoWindow=infoWindow;
this.showInfoWindow = infoWindow;
this.showInfoWindow = polyline.infoWindow;
// const
});
polyline.on("mouseout", e => {
polyline.setOptions({ strokeColor: "#F7FE38" });
// infoWindow.close();
});
// 计算info的位置
// function infoPosition() {}
}
map.add(this.polyLines);
// 缩放地图到合适的视野级别
// map.setFitView();
}
};
// 创建一条新的线
createNewLine() {
map.remove(this.markerOverlays);
......@@ -767,20 +794,22 @@ class gaodeMap {
}
// 传进组件的会调 点确认的时候调
lineOkCallBack(target, data) {
lineOkCallBack(target, data, func) {
target.polyEditor.close();
const index = this.polyLines.indexOf(target);
// 如果是老线,就要线删除原来的,然后重新包装一遍
if (index >= 0) {
// 记录当前位置的元素
this.changePolineListNum = index;
this.polyLines.splice(index, 1);
}
console.log("data999-=================>传回来的data", data);
this.addPolyline([data]);
this.addPolyline([data], func);
map.remove(target);
// console.log('polyLines',this.polyLines)
}
// 上传服务器用的组件
infoWindowPipelineView(options) {
// const {} =options;
const notice = createPop(pipelineView, {
......
......@@ -506,7 +506,7 @@ export default {
},
// 隐患
getMapHiddenTroublelist(queryParams) {
return getMapHiddenTroublelist().then((res) => {
return getMapHiddenTroublelist(queryParams).then((res) => {
console.log(res);
if (res.code == 200) {
this.troubleClassify(res.data);
......@@ -1206,6 +1206,8 @@ export default {
await this.getPipeList({ pipeName: this.keyWord });
// 值班人员
await this.getInspectorLocations({ userName: this.keyWord });
await this.getMapHiddenTroublelist({ troubleName: this.keyWord });
// 设备报警
this.getSelectAlarmDevice();
......@@ -1242,13 +1244,16 @@ export default {
// this.gaoMap.createNewLine();
},
refreshMap() {
// this.changeBtnDataClear();
this.keyWord="";
this.arrowRightNum=[];
this.iconClass = "icon-create";
this.createValue = 0;
this.createLabel = "新建";
this.targetNum = 0;
map.clearMap();
this.initMap();
this.leftBarNum = [1, 2, 3, 4, 7, 8, 9];
this.initMap();
},
// 改变工单弹框状态
// openChange(bool) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment