Commit 2ad545a4 by wangzhihui

bug修复

1 parent fd0463c1
...@@ -2329,9 +2329,9 @@ ...@@ -2329,9 +2329,9 @@
"dev": true "dev": true
}, },
"clipboard": { "clipboard": {
"version": "2.0.4", "version": "2.0.11",
"resolved": "http://registry.npm.taobao.org/clipboard/download/clipboard-2.0.4.tgz", "resolved": "https://registry.npmmirror.com/clipboard/-/clipboard-2.0.11.tgz",
"integrity": "sha1-g22v1mzw/qXXHOXVsL9ulYAJES0=", "integrity": "sha512-C+0bbOqkezLIsmWSvlsXS0Q0bmkugu7jcfMIACB+RDEntIzQIkdr148we28AfSloQLRdZlYL/QYyrq05j/3Faw==",
"requires": { "requires": {
"good-listener": "^1.2.2", "good-listener": "^1.2.2",
"select": "^1.1.2", "select": "^1.1.2",
...@@ -3279,8 +3279,8 @@ ...@@ -3279,8 +3279,8 @@
}, },
"delegate": { "delegate": {
"version": "3.2.0", "version": "3.2.0",
"resolved": "http://registry.npm.taobao.org/delegate/download/delegate-3.2.0.tgz", "resolved": "https://registry.npmmirror.com/delegate/-/delegate-3.2.0.tgz",
"integrity": "sha1-tmtxwxWFIuirV0T3INjKDCr1kWY=" "integrity": "sha512-IofjkYBZaZivn0V8nnsMJGBr4jVLxHDheKSW88PyxS5QC4Vo9ZbZVvhzlSxY87fVq3STR6r+4cGepyHkcWOQSw=="
}, },
"delegates": { "delegates": {
"version": "1.0.0", "version": "1.0.0",
...@@ -5800,8 +5800,8 @@ ...@@ -5800,8 +5800,8 @@
}, },
"good-listener": { "good-listener": {
"version": "1.2.2", "version": "1.2.2",
"resolved": "http://registry.npm.taobao.org/good-listener/download/good-listener-1.2.2.tgz", "resolved": "https://registry.npmmirror.com/good-listener/-/good-listener-1.2.2.tgz",
"integrity": "sha1-1TswzfkxPf+33JoNR3CWqm0UXFA=", "integrity": "sha512-goW1b+d9q/HIwbVYZzZ6SsTr4IgE+WA44A0GmPIQstuOrgsFcT7VEJ48nmr9GaRtNu0XTKacFLGnBPAM6Afouw==",
"requires": { "requires": {
"delegate": "^3.1.2" "delegate": "^3.1.2"
} }
...@@ -11687,8 +11687,8 @@ ...@@ -11687,8 +11687,8 @@
}, },
"select": { "select": {
"version": "1.1.2", "version": "1.1.2",
"resolved": "http://registry.npm.taobao.org/select/download/select-1.1.2.tgz", "resolved": "https://registry.npmmirror.com/select/-/select-1.1.2.tgz",
"integrity": "sha1-DnNQrN7ICxEIUoeG7B1EGNEbOW0=" "integrity": "sha512-OwpTSOfy6xSs1+pwcNrv0RBMOzI39Lp3qQKUTPVVPRjCdNa5JH/oPRiqsesIskK8TVgmRiHwO4KXlV2Li9dANA=="
}, },
"select-hose": { "select-hose": {
"version": "2.0.0", "version": "2.0.0",
...@@ -12918,8 +12918,8 @@ ...@@ -12918,8 +12918,8 @@
}, },
"tiny-emitter": { "tiny-emitter": {
"version": "2.1.0", "version": "2.1.0",
"resolved": "http://registry.npm.taobao.org/tiny-emitter/download/tiny-emitter-2.1.0.tgz", "resolved": "https://registry.npmmirror.com/tiny-emitter/-/tiny-emitter-2.1.0.tgz",
"integrity": "sha1-HRpW7fxRxD6GPLtTgqcjMONVVCM=" "integrity": "sha512-NB6Dk1A9xgQPMoGqC5CVXn123gWyte215ONT5Pp5a0yt4nlEoO1ZWeCwpncaekPHXO60i47ihFnZPiRPjRMq4Q=="
}, },
"tmp": { "tmp": {
"version": "0.0.33", "version": "0.0.33",
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
"calendar-months": "^1.0.1", "calendar-months": "^1.0.1",
"caniuse-lite": "^1.0.30001292", "caniuse-lite": "^1.0.30001292",
"chart.js": "^2.7.2", "chart.js": "^2.7.2",
"clipboard": "^2.0.4", "clipboard": "^2.0.11",
"dayjs": "^1.11.11", "dayjs": "^1.11.11",
"downloadjs": "^1.4.7", "downloadjs": "^1.4.7",
"echarts": "^5.5.0", "echarts": "^5.5.0",
......
...@@ -389,6 +389,7 @@ ...@@ -389,6 +389,7 @@
.map-infowindow-ct { .map-infowindow-ct {
&>p { &>p {
display: flex; display: flex;
min-width: 300px;
} }
// .lb {} // .lb {}
...@@ -396,7 +397,6 @@ ...@@ -396,7 +397,6 @@
.des { .des {
flex: 1; flex: 1;
word-break: break-all; word-break: break-all;
max-width: 160px;
} }
.icon { .icon {
...@@ -459,7 +459,7 @@ ...@@ -459,7 +459,7 @@
color: rgba(0, 153, 68, 0.8); color: rgba(0, 153, 68, 0.8);
margin: 2px; margin: 2px;
cursor: pointer; cursor: pointer;
white-space: nowrap;
&:hover { &:hover {
color: rgba(0, 153, 68, 1); color: rgba(0, 153, 68, 1);
border-color: rgba(0, 153, 68, 1); border-color: rgba(0, 153, 68, 1);
...@@ -569,10 +569,41 @@ ...@@ -569,10 +569,41 @@
cursor: pointer; cursor: pointer;
} }
.map-infowindow-title { .map-infowindow-title-other{
position: relative; position: relative;
padding-right: 30px; padding-right: 30px;
white-space: nowrap;
.question_icon {
display: inline-block;
background: url('https://img01.glsx.com.cn/weapp/resource/e-shield/circle-question.png') no-repeat;
background-size: 20px auto;
width: 20px;
height: 20px;
vertical-align: middle;
}
.popover_box {
position: absolute;
background: rgba(0, 0, 0, 0.5);
top: 20px;
right: 0px;
padding: 10px;
z-index: 2;
border-radius: 4px;
color: #fff;
font-size: 12px;
pointer-events: none;
p {
margin: 0;
}
}
}
.map-infowindow-title {
position: relative;
padding-right: 30px;
white-space: nowrap;
width:300px;
.question_icon { .question_icon {
display: inline-block; display: inline-block;
background: url('https://img01.glsx.com.cn/weapp/resource/e-shield/circle-question.png') no-repeat; background: url('https://img01.glsx.com.cn/weapp/resource/e-shield/circle-question.png') no-repeat;
...@@ -651,3 +682,6 @@ ...@@ -651,3 +682,6 @@
.resident_btn_hidden { .resident_btn_hidden {
display: none; display: none;
} }
.BMap_bubble_top{
height: 7px !important;
}
\ No newline at end of file \ No newline at end of file
...@@ -504,7 +504,8 @@ export default { ...@@ -504,7 +504,8 @@ export default {
}, },
}); });
}, },
mounted() { async mounted() {
await this.$refs.fenceMap.initBMap()
//this.listener(); //this.listener();
this.$nextTick(() => { this.$nextTick(() => {
let check = () => { let check = () => {
...@@ -841,6 +842,7 @@ export default { ...@@ -841,6 +842,7 @@ export default {
let oParams = {}; let oParams = {};
oParams.fenceId = id; oParams.fenceId = id;
GET_ELECFENCE_INFO(oParams).then((res) => { GET_ELECFENCE_INFO(oParams).then((res) => {
console.log(res);
if (res.code != 200) { if (res.code != 200) {
return false; return false;
} }
......
...@@ -171,6 +171,9 @@ export default { ...@@ -171,6 +171,9 @@ export default {
this.autoComplete = AMap.invoke("Autocomplete", { this.autoComplete = AMap.invoke("Autocomplete", {
input: "poiMapSearch", input: "poiMapSearch",
}); });
AMap.invoke("LocalCity", (res) => {
AMap.invoke('panTo',res.center)
});
AMap.invoke("autocompleteShow"); AMap.invoke("autocompleteShow");
AMap.invoke("autocompleteAddEventListener", "onconfirm", (e) => { AMap.invoke("autocompleteAddEventListener", "onconfirm", (e) => {
let _poi = e.item.value; let _poi = e.item.value;
...@@ -210,22 +213,91 @@ export default { ...@@ -210,22 +213,91 @@ export default {
addMassMarkers(arr) { addMassMarkers(arr) {
let _this = this; let _this = this;
let _query = _this.$route.query; let _query = _this.$route.query;
let markers = []; // let markers = [];
for (let i = 0, len = arr.length; i < len; i++) { for (let i = 0, len = arr.length; i < len; i++) {
let k = arr[i]; let k = arr[i];
if (k.lnglat) { if (k.lnglat) {
let m = k.lnglat.split(","); let m = k.lnglat.split(",");
let lnglatXY = mapService.getLngLat(m[0], m[1]); let lnglatXY = mapService.getLngLat(m[0], m[1]);
markers.push(lnglatXY); // markers.push(lnglatXY);
let marker = mapService.createPoiMarker(lnglatXY, AMap); let marker = mapService.createPoiMarker(lnglatXY, AMap);
AMap.invoke("addOverlay", marker); marker.info=k
AMap.invoke("markerAddEventListener", "click", (e) => {
let data = { ...e, ...k }; this.markers[i] = marker;
this.markerEvent(data); this.$set(this.markerList, k.id, marker);
}); // this.infowins[i] = infoWindow;
// AMap.invoke("addOverlay", marker);
// AMap.invoke("markerAddEventListener", "click", (e) => {
// let data = { ...e, ...k };
// this.markerEvent(data);
// });
} }
} }
AMap.invoke("setViewport", markers); this.createClusterer();
// AMap.invoke("setViewport", markers);
},
createClusterer() {
var cluster,
markers = [];
for (let idx in this.markers) {
markers.push(this.markers[idx]);
}
let icon=require('images/poi-marker-default.png')
this.cluster = AMap.invoke(
"Cluster",
markers,
(data) => {
console.log(data)
return {
point: [data.latLng.lng, data.latLng.lat],
properties: {
address: data.address,
near: data.near,
poiType: data.poiType,
// id: data.id,
// sn: data.sn,
// adcode: data.adcode,
marker: data,
},
};
},
{
clusterMinPoints: 2,
clusterMaxZoom: 18,
updateRealTime: true,
fitViewOnClick: true,
renderSingleStyle: {
type: Cluster.ClusterRender.WEBGL,
style: {
width: 14,
height: 19,
icon: icon
},
},
}
);
AMap.invoke("clusterSetData", this.cluster);
//click | mouseover | mouseout | change | destroy
AMap.invoke("clusterAddEventListener", "click", (e) => {
if (e.properties&&e.properties.marker) {
let data={...e.properties.marker,...e.properties.marker.info}
this.markerEvent(data);
// AMap.invoke(
// "infoWindowDisableCloseOnClick",
// e.properties.marker.openInfoWindow
// );
// AMap.invoke(
// "mapOpenInfoWindow",
// e.properties.marker.openInfoWindow,
// e.properties.marker.getPosition()
// );
}
});
// AMap.invoke("clusterAddEventListener", "mouseout", (e) => {
// AMap.invoke("mapCloseInfoWindow");
// });
}, },
// 地图右键添加poi点 // 地图右键添加poi点
...@@ -386,7 +458,6 @@ export default { ...@@ -386,7 +458,6 @@ export default {
// 删除poi点 // 删除poi点
removePoi(row) { removePoi(row) {
console.log(row);
let _this = this; let _this = this;
let _message = "确认删除该POI信息吗?"; let _message = "确认删除该POI信息吗?";
let _typeList = { let _typeList = {
...@@ -428,8 +499,13 @@ export default { ...@@ -428,8 +499,13 @@ export default {
_params.id = row.id; _params.id = row.id;
DELETE_POI_INFO(_params).then((res) => { DELETE_POI_INFO(_params).then((res) => {
if (res.code == 200) { if (res.code == 200) {
// console.log(this.markerList,row)
let _marker = _this.markerList[row.id]; let _marker = _this.markerList[row.id];
AMap.invoke('removeOverlay', _marker) AMap.invoke('removeOverlay', _marker)
// AMap.invoke(
// "infoWindowDisableCloseOnClick",
// _InfoWindow
// );
_InfoWindow && AMap.invoke('mapCloseInfoWindow', _InfoWindow); _InfoWindow && AMap.invoke('mapCloseInfoWindow', _InfoWindow);
showToast({ showToast({
message: "删除成功", message: "删除成功",
...@@ -448,6 +524,7 @@ export default { ...@@ -448,6 +524,7 @@ export default {
let _this = this; let _this = this;
let _query = _this.$route.query; let _query = _this.$route.query;
GET_POI_TRACK().then((res) => { GET_POI_TRACK().then((res) => {
console.log(res,'GET_POI_TRACK')
if (res.code == 200) { if (res.code == 200) {
let _list = res.data || []; let _list = res.data || [];
_this.addMassMarkers(_list); _this.addMassMarkers(_list);
......
...@@ -271,6 +271,9 @@ export default { ...@@ -271,6 +271,9 @@ export default {
async initBMap() { async initBMap() {
this.mapObj = await mapService.init("alarmMap"); this.mapObj = await mapService.init("alarmMap");
window.AMap = this.mapObj; window.AMap = this.mapObj;
AMap.invoke("LocalCity", (res) => {
AMap.invoke('panTo',res.center)
});
this.isInitMap = true; this.isInitMap = true;
this.boxShow = true; this.boxShow = true;
this.getStayPointList(this.vehicleId); this.getStayPointList(this.vehicleId);
......
...@@ -764,7 +764,7 @@ export default { ...@@ -764,7 +764,7 @@ export default {
if (!value) return true; if (!value) return true;
return data.label.indexOf(value) !== -1; return data.label.indexOf(value) !== -1;
}, },
listener() { async listener() {
const state = history.state; const state = history.state;
if (!state) { if (!state) {
this.init(null); this.init(null);
...@@ -775,6 +775,7 @@ export default { ...@@ -775,6 +775,7 @@ export default {
this.readonlyStatus = readonlyStatus; this.readonlyStatus = readonlyStatus;
this.fenceId = fenceId; this.fenceId = fenceId;
} }
await this.$refs.fenceMap.initBMap()
this.init(btnRemark); this.init(btnRemark);
}, },
init(btnRemark) { init(btnRemark) {
...@@ -784,26 +785,19 @@ export default { ...@@ -784,26 +785,19 @@ export default {
this.btnText = btnText; this.btnText = btnText;
} }
if (typeof this.fenceId != "undefined") { if (typeof this.fenceId != "undefined") {
console.log(1)
btnRemark === "viewUpdated" btnRemark === "viewUpdated"
? this.getUpdatedFenceDetail(this.fenceId) ? this.getUpdatedFenceDetail(this.fenceId)
: this.getFenceDetail(this.fenceId); : this.getFenceDetail(this.fenceId);
} else { } else {
// 线路编号无意义 屏蔽
// MONITOR_SERVICE.getNewFenceId().then((res)=>{
// if(res.returnCode == 0){
// this.form.fenceNo = res.data.fenceNo;
// this.$refs.fenceMap.initFence({
// fenceType: 'circle'
// });
// }
// });
this.$refs.fenceMap.initFence({ this.$refs.fenceMap.initFence({
fenceType: "polygon", fenceType: "polygon",
polygonPath: this.polygonPath, polygonPath: this.polygonPath,
}); });
// 新增定位到当前位置
AMap.invoke("LocalCity", (res) => {
AMap.invoke('panTo',res.center)
});
this.restainFenceName = undefined; this.restainFenceName = undefined;
} }
}, },
...@@ -849,7 +843,6 @@ export default { ...@@ -849,7 +843,6 @@ export default {
if (data.lnglat) { if (data.lnglat) {
this.polygonPath = data.lnglat.split("|").map((item) => { this.polygonPath = data.lnglat.split("|").map((item) => {
let arr = item.split(","); let arr = item.split(",");
console.log(arr);
return mapService.getLngLat(arr[0], arr[1]); return mapService.getLngLat(arr[0], arr[1]);
}); });
} }
......
...@@ -117,7 +117,7 @@ export default { ...@@ -117,7 +117,7 @@ export default {
// _this.bindContextMenu(); // _this.bindContextMenu();
// _this.bindSearch(); // _this.bindSearch();
// }); // });
this.initBMap(); // this.initBMap();
}, },
watch: { watch: {
lng(newVal) { lng(newVal) {
...@@ -127,11 +127,16 @@ export default { ...@@ -127,11 +127,16 @@ export default {
//this.transfer() //this.transfer()
}, },
}, },
async created() {}, async created() {
// this.initBMap();
},
methods: { methods: {
async initBMap() { async initBMap() {
this.mapObj = await mapService.init("mapContainer"); this.mapObj = await mapService.init("mapContainer");
window.AMap = this.mapObj; window.AMap = this.mapObj;
AMap.invoke("LocalCity", (res) => {
// AMap.invoke('panTo',res.center)
});
this.bindContextMenu(); this.bindContextMenu();
this.bindSearch(); this.bindSearch();
}, },
...@@ -266,6 +271,7 @@ export default { ...@@ -266,6 +271,7 @@ export default {
} }
}, },
initFence(data) { initFence(data) {
console.log(data)
let _this = this; let _this = this;
this._mapPromiseTimeout = setInterval(function () { this._mapPromiseTimeout = setInterval(function () {
if (_this.mapObj) { if (_this.mapObj) {
...@@ -398,6 +404,7 @@ export default { ...@@ -398,6 +404,7 @@ export default {
}); });
AMap.invoke("addOverlay", self.polygon); AMap.invoke("addOverlay", self.polygon);
AMap.invoke('setZoom',17)
} else { } else {
var styleOptions = { var styleOptions = {
strokeColor: "#FF33FF", // 边线颜色 strokeColor: "#FF33FF", // 边线颜色
......
...@@ -570,7 +570,6 @@ export default { ...@@ -570,7 +570,6 @@ export default {
times: "0", times: "0",
locationType: this.form.replayType == "RtTrack" ? 0 : 1, locationType: this.form.replayType == "RtTrack" ? 0 : 1,
}).then((res) => { }).then((res) => {
console.log(res);
if (res.code == 200) { if (res.code == 200) {
const data = res.data; const data = res.data;
if (data.length) { if (data.length) {
......
...@@ -228,9 +228,13 @@ export default { ...@@ -228,9 +228,13 @@ export default {
}, },
methods: { methods: {
async initBMap() { async initBMap() {
console.log(11111111111);
this.mapObj = await mapService.init("map"); this.mapObj = await mapService.init("map");
this.mapLoading = false; this.mapLoading = false;
window.AMap = this.mapObj; window.AMap = this.mapObj;
AMap.invoke("LocalCity", (res) => {
AMap.invoke('panTo',res.center)
});
this.autoComplete = AMap.invoke("Autocomplete", { this.autoComplete = AMap.invoke("Autocomplete", {
input: "tipInput", input: "tipInput",
}); });
...@@ -248,7 +252,6 @@ export default { ...@@ -248,7 +252,6 @@ export default {
} }
}, },
// 获取地址 // 获取地址
getAddress() { getAddress() {
let _this = this; let _this = this;
...@@ -656,13 +659,12 @@ export default { ...@@ -656,13 +659,12 @@ export default {
// 如果是地址,则标记出对应的点 // 如果是地址,则标记出对应的点
if (query.menuId == 1 && query.lng) { if (query.menuId == 1 && query.lng) {
let poi=AMap.invoke('Point',query.lng, query.lat) let poi = AMap.invoke("Point", query.lng, query.lat);
this.autoCenterMarker = mapService.createMarker(poi); this.autoCenterMarker = mapService.createMarker(poi);
AMap.invoke('addOverlay',this.autoCenterMarker); AMap.invoke("addOverlay", this.autoCenterMarker);
AMap.invoke("panTo", poi); AMap.invoke("panTo", poi);
} }
this.drawRectangle(query); this.drawRectangle(query);
this.getAreaLocation(); this.getAreaLocation();
...@@ -689,22 +691,22 @@ export default { ...@@ -689,22 +691,22 @@ export default {
}); });
AMap.invoke("addOverlay", overlay); AMap.invoke("addOverlay", overlay);
console.log(overlay); console.log(overlay);
AMap.invoke("rectOpenEdit", overlay,{ AMap.invoke("rectOpenEdit", overlay, {
isOpen:false, isOpen: false,
enableDragging:true enableDragging: true,
}); //开启编辑 }); //开启编辑
// AMap.invoke("rectCloseEdit"); //关闭编辑 // AMap.invoke("rectCloseEdit"); //关闭编辑
// AMap.invoke("rectAddEventListener", "operate-change", (e) => { // AMap.invoke("rectAddEventListener", "operate-change", (e) => {
// console.log(e.target); // console.log(e.target);
// }); // });
this.rectangle=overlay this.rectangle = overlay;
this.calculateWidthHeight(overlay.getBounds()); this.calculateWidthHeight(overlay.getBounds());
let _zoom = AMap.invoke("getZoom"); let _zoom = AMap.invoke("getZoom");
AMap.invoke("setZoom",24) AMap.invoke("setZoom", 24);
console.log(_zoom); console.log(_zoom);
if (_zoom < 11) { if (_zoom < 11) {
AMap.invoke("setZoom",11) AMap.invoke("setZoom", 11);
} }
AMap.invoke("panTo", pathArr[0], true); AMap.invoke("panTo", pathArr[0], true);
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: 'wangzhihui' '1733904062@qq.com' * @Author: 'wangzhihui' '1733904062@qq.com'
* @Date: 2024-11-28 16:37:15 * @Date: 2024-11-28 16:37:15
* @LastEditors: 'wangzhihui' '1733904062@qq.com' * @LastEditors: 'wangzhihui' '1733904062@qq.com'
* @LastEditTime: 2024-12-20 11:07:37 * @LastEditTime: 2024-12-26 15:31:02
* @FilePath: \oEshield\src\utils\fence.js * @FilePath: \oEshield\src\utils\fence.js
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/ */
...@@ -109,20 +109,22 @@ const fence = { ...@@ -109,20 +109,22 @@ const fence = {
}, },
updateFenceCircle(data){ updateFenceCircle(data){
console.log(data)
let center
AMap.invoke('circleDisableEditing') AMap.invoke('circleDisableEditing')
if( data.radius&&this.circle){ if( data.radius&&this.circle){
this.circle.setRadius(data.radius * 1) this.circle.setRadius(data.radius * 1)
} }
if(data.lng&&data.lat){ if(data.lng&&data.lat){
let center = mapService.getLngLat(data.lng, this.lat); center = mapService.getLngLat(data.lng, this.lat);
this.circle&& this.circle.setCenter(center); this.circle&& this.circle.setCenter(center);
AMap.invoke('panTo',center,true)
}
}
center= this.circle&& this.circle.getCenter()
AMap.invoke('removeOverlay', this.circle) AMap.invoke('removeOverlay', this.circle)
AMap.invoke('addOverlay', this.circle) AMap.invoke('addOverlay', this.circle)
AMap.invoke('circleEnableEditing') AMap.invoke('circleEnableEditing')
AMap.invoke('panTo',center,true)
}, },
createFenceCircle(data) { createFenceCircle(data) {
if(!this.circle){ if(!this.circle){
...@@ -215,6 +217,7 @@ const fence = { ...@@ -215,6 +217,7 @@ const fence = {
}) })
AMap.invoke('addOverlay', self.polygon) AMap.invoke('addOverlay', self.polygon)
AMap.invoke('setZoom',17)
} else if (self.isEditMode) { } else if (self.isEditMode) {
var styleOptions = { var styleOptions = {
strokeColor: '#FF33FF', // 边线颜色 strokeColor: '#FF33FF', // 边线颜色
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: 'wangzhihui' '1733904062@qq.com' * @Author: 'wangzhihui' '1733904062@qq.com'
* @Date: 2024-12-06 14:10:32 * @Date: 2024-12-06 14:10:32
* @LastEditors: 'wangzhihui' '1733904062@qq.com' * @LastEditors: 'wangzhihui' '1733904062@qq.com'
* @LastEditTime: 2024-12-23 14:10:33 * @LastEditTime: 2024-12-27 17:25:57
* @FilePath: \oEshield\src\utils\mapBService.js * @FilePath: \oEshield\src\utils\mapBService.js
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/ */
...@@ -56,7 +56,7 @@ MapService.prototype = { ...@@ -56,7 +56,7 @@ MapService.prototype = {
// 添加比例尺 // 添加比例尺
mapapi.invoke("ScaleControl") mapapi.invoke("ScaleControl")
// 距离测量 // 距离测量
// mapapi.invoke('DistanceTool',this.mapInstance) mapapi.invoke('DistanceTool',this.mapInstance)
resolve(mapapi) resolve(mapapi)
// //距离测量 // //距离测量
...@@ -124,7 +124,7 @@ MapService.prototype = { ...@@ -124,7 +124,7 @@ MapService.prototype = {
createPointMarker: function(lnglatXY) { createPointMarker: function(lnglatXY) {
let that=this, let that=this,
url=require('images/point.png'), url=require('images/point.png'),
size=that.map.invoke('Size', 36, 22) size=that.map.invoke('Size', 18, 18)
var marker=that.map.invoke('Marker', lnglatXY, { var marker=that.map.invoke('Marker', lnglatXY, {
icon:that.map.invoke('Icon', url,size) icon:that.map.invoke('Icon', url,size)
}) })
...@@ -279,6 +279,7 @@ MapService.prototype = { ...@@ -279,6 +279,7 @@ MapService.prototype = {
return Circle return Circle
}, },
createInfoWindow(marker, map, div, isInfoOpen, isInfoAutoMove) { createInfoWindow(marker, map, div, isInfoOpen, isInfoAutoMove) {
console.log(div,'div')
var self = this; var self = this;
var infoWindow=self.map.invoke('InfoWindow',div,{ var infoWindow=self.map.invoke('InfoWindow',div,{
enableAutoPan:!!isInfoAutoMove enableAutoPan:!!isInfoAutoMove
...@@ -288,8 +289,20 @@ MapService.prototype = { ...@@ -288,8 +289,20 @@ MapService.prototype = {
if (clipboard) { if (clipboard) {
clipboard.destroy(); clipboard.destroy();
} }
clipboard = new ClipboardJS('.copy-btn', {
if (isInfoOpen) {
infoWindow.redraw();
}
//给Marker绑定单击事件
// marker.addEventListener('click', markerClick);
self.map.invoke('markerAddEventListener','click',markerClick)
self.map.invoke('infoWindowAddEventListener','open',()=>{
clipboard = new ClipboardJS(document.querySelectorAll('.copy-btn'), {
text: function(trigger) { text: function(trigger) {
console.log(trigger,trigger.getAttribute('aria-label'),'trigger')
return trigger.getAttribute('aria-label'); return trigger.getAttribute('aria-label');
} }
}) })
...@@ -298,32 +311,19 @@ MapService.prototype = { ...@@ -298,32 +311,19 @@ MapService.prototype = {
EventBus.$emit('uiMap.copySuccess'); EventBus.$emit('uiMap.copySuccess');
}); });
clipboard.on('error', function(e) { clipboard.on('error', function(e) {
console.log(e,'err')
}); });
})
if (isInfoOpen) {
infoWindow.redraw();
}
//给Marker绑定单击事件
// marker.addEventListener('click', markerClick);
self.map.invoke('markerAddEventListener','click',markerClick)
function markerClick(e) { function markerClick(e) {
//infoWindow.setContent(e.target.content); //infoWindow.setContent(e.target.content);
self.map.invoke("mapOpenInfoWindow", infoWindow,e.target.getPosition()) self.map.invoke("mapOpenInfoWindow", infoWindow,e.target.getPosition())
// infoWindow.open(map, e.target.getPosition()); // infoWindow.open(map, e.target.getPosition());
} }
return infoWindow; return infoWindow;
}, },
// 初始化复制事件
initCopyEvent() {
var clipboard = new ClipboardJS('.copy-btn', {
text: function(trigger) {
return trigger.getAttribute('aria-label');
}
})
},
// 车辆监控-查看位置点 // 车辆监控-查看位置点
bindMonitorInfoWindow: function(marker, map, info, isInfoOpen, isInfoAutoMove) { bindMonitorInfoWindow: function(marker, map, info, isInfoOpen, isInfoAutoMove) {
...@@ -707,6 +707,7 @@ MapService.prototype = { ...@@ -707,6 +707,7 @@ MapService.prototype = {
// 根据权限-显示店面名称、车牌号 // 根据权限-显示店面名称、车牌号
let list = vue.prototype.$parentCommon.getAuthData(); let list = vue.prototype.$parentCommon.getAuthData();
console.log(list,'list')
let o = list.find(k => k.origin.permissionTag == 'oEshield_monitor_store_name'); let o = list.find(k => k.origin.permissionTag == 'oEshield_monitor_store_name');
let n = list.find(k => k.origin.permissionTag == 'oEshield_monitor_plate_number'); let n = list.find(k => k.origin.permissionTag == 'oEshield_monitor_plate_number');
if (o && info.shopName) { if (o && info.shopName) {
...@@ -716,6 +717,7 @@ MapService.prototype = { ...@@ -716,6 +717,7 @@ MapService.prototype = {
if (n && info.licensePlate) { if (n && info.licensePlate) {
_html += `<p><i class="icon_info_plate"></i>车牌号: <span class="des copy-btn" aria-label="${info.licensePlate}">${info.licensePlate || '--'}</span></p>`; _html += `<p><i class="icon_info_plate"></i>车牌号: <span class="des copy-btn" aria-label="${info.licensePlate}">${info.licensePlate || '--'}</span></p>`;
} }
console.log(info,'info')
_html += `<p class="" aria-label="${info.sn}"><i class="icon icon-info_device"></i> 设备号:<span class="des copy-btn" aria-label="${info.sn}(${info.isSource === '1' ? '有线' : '无线'})"> ${info.sn} (${info.isSource === '1' ? '有线' : '无线'})</span> _html += `<p class="" aria-label="${info.sn}"><i class="icon icon-info_device"></i> 设备号:<span class="des copy-btn" aria-label="${info.sn}(${info.isSource === '1' ? '有线' : '无线'})"> ${info.sn} (${info.isSource === '1' ? '有线' : '无线'})</span>
<span class="battery" data-battery> <span class="battery" data-battery>
...@@ -730,7 +732,7 @@ MapService.prototype = { ...@@ -730,7 +732,7 @@ MapService.prototype = {
</p> </p>
<p><i class="icon icon-info_time"></i> 最后上点时间: <span class="des copy-btn" data-time aria-label=""></span></p> <p><i class="icon icon-info_time"></i> 最后上点时间: <span class="des copy-btn" data-time aria-label=""></span></p>
<p><i class="icon icon-info_location"></i> 最后上点地址: <span class="des adr copy-btn" data-transferAddress aria-label="${info.transferAddress}">${info.transferAddress}</span> <p><i class="icon icon-info_location"></i> 最后上点地址: <span class="des adr copy-btn" data-transferAddress aria-label="${info.transferAddress}">${info.transferAddress}</span>
<a class="" data-clipboard-text="${info.transferAddress}"><i class="icon icon-info_copy copy-btn" data-address-icon aria-label="${info.transferAddress}"></i></a> <a class="" data-clipboard-text="${info.transferAddress}"><i class="icon icon-info_copy copy-btn copy-btn1" data-address-icon aria-label="${info.transferAddress}"></i></a>
</p> </p>
<p><i class="icon icon-info_type"></i> 定位类型:<span class="el-button-group">` <p><i class="icon icon-info_type"></i> 定位类型:<span class="el-button-group">`
...@@ -792,7 +794,7 @@ MapService.prototype = { ...@@ -792,7 +794,7 @@ MapService.prototype = {
<div class="map-infowindow-ct"> <div class="map-infowindow-ct">
<p><i class="icon icon-info_time"></i> 停留时间: <span class="des">${info.begintime}</span></p> <p><i class="icon icon-info_time"></i> 停留时间: <span class="des">${info.begintime}</span></p>
<p><i class="icon icon-info_location"></i> 停留地址: <span class="des adr" >${info.transferAddress}</span> <p><i class="icon icon-info_location"></i> 停留地址: <span class="des adr" >${info.transferAddress}</span>
<a class="copy-btn address-copy" id="address-copy" address-copy data-clipboard-text="${info.transferAddress}"><i class="icon icon-info_copy"></i></a> <a class=" address-copy" id="address-copy" address-copy data-clipboard-text="${info.transferAddress}"><i class="icon copy-btn icon-info_copy" aria-label="${info.transferAddress}"></i></a>
</p> </p>
<p><i class="icon icon-info_stop"></i> 停留时长: <span class="des">${info.duration}</span></p> <p><i class="icon icon-info_stop"></i> 停留时长: <span class="des">${info.duration}</span></p>
</div>`; </div>`;
...@@ -802,7 +804,7 @@ MapService.prototype = { ...@@ -802,7 +804,7 @@ MapService.prototype = {
<div class="map-infowindow-ct"> <div class="map-infowindow-ct">
<p><i class="icon icon-info_device"></i> 设备号: <span class="des">${info.sn}</span></p> <p><i class="icon icon-info_device"></i> 设备号: <span class="des">${info.sn}</span></p>
<p><i class="icon icon-info_location"></i> 常驻地址: <span class="des adr" >${info.transferAddress}</span> <p><i class="icon icon-info_location"></i> 常驻地址: <span class="des adr" >${info.transferAddress}</span>
<a class="copy-btn" data-clipboard-text="${info.transferAddress}"><i class="icon icon-info_copy"></i></a> <a data-clipboard-text="${info.transferAddress}"><i class="copy-btn icon icon-info_copy" aria-label="${info.transferAddress}"></i></a>
</p> </p>
<p><i class="icon icon-info_device"></i> 驻留次数: <span class="des">${info.totalTimes}次</span></p> <p><i class="icon icon-info_device"></i> 驻留次数: <span class="des">${info.totalTimes}次</span></p>
<p><i class="icon icon-info_stop"></i> 驻留时长: <span class="des">${info.totalDurationString}</span></p> <p><i class="icon icon-info_stop"></i> 驻留时长: <span class="des">${info.totalDurationString}</span></p>
...@@ -832,7 +834,7 @@ MapService.prototype = { ...@@ -832,7 +834,7 @@ MapService.prototype = {
msg = '定位' msg = '定位'
} }
return `<h3 class="map-infowindow-title">${info.name || '--'}/${info.standNo || '--'}</h3> return `<h3 class="map-infowindow-title-other">${info.name || '--'}/${info.standNo || '--'}</h3>
<div class="map-infowindow-ct"> <div class="map-infowindow-ct">
<p><i class="icon icon-info_device"></i> 设备号: <span class="des">${info.sn} (${info.source == 1 ? '有线' : '无线'})</span></p> <p><i class="icon icon-info_device"></i> 设备号: <span class="des">${info.sn} (${info.source == 1 ? '有线' : '无线'})</span></p>
<p><i class="icon icon-info_time"></i>${msg}时间: <span class="des"data-time>${info.time}</span></p> <p><i class="icon icon-info_time"></i>${msg}时间: <span class="des"data-time>${info.time}</span></p>
......
...@@ -96,8 +96,7 @@ const monitor = { ...@@ -96,8 +96,7 @@ const monitor = {
const lnglat = this.markers[snSourceType].getPosition(); const lnglat = this.markers[snSourceType].getPosition();
AMap.invoke("mapOpenInfoWindow", this.infowins[snSourceType],lnglat) AMap.invoke("mapOpenInfoWindow", this.infowins[snSourceType],lnglat)
AMap.invoke('addOverlay',this.markers[snSourceType]) AMap.invoke('addOverlay',this.markers[snSourceType])
mapService.mapInstance.panTo(lnglat,true) AMap.invoke('panTo',lnglat)
} }
}); });
...@@ -107,9 +106,10 @@ const monitor = { ...@@ -107,9 +106,10 @@ const monitor = {
let eLocation = item[item.eLocateType]; let eLocation = item[item.eLocateType];
if (this.markers[snSourceType]) { if (this.markers[snSourceType]) {
this.markers[snSourceType].setPosition(mapService.getLngLat(parseFloat(eLocation.elng), parseFloat(eLocation.elat))); this.markers[snSourceType].setPosition(mapService.getLngLat(parseFloat(eLocation.blng), parseFloat(eLocation.blat)));
AMap.invoke("mapOpenInfoWindow", this.infowins[snSourceType],mapService.getLngLat(parseFloat(eLocation.elng), parseFloat(eLocation.elat))) AMap.invoke("mapOpenInfoWindow", this.infowins[snSourceType],mapService.getLngLat(parseFloat(eLocation.blng), parseFloat(eLocation.blat)))
AMap.invoke('addOverlay',this.markers[snSourceType]) AMap.invoke('addOverlay',this.markers[snSourceType])
// this.infowins[snSourceType].setPosition(); // this.infowins[snSourceType].setPosition();
} }
...@@ -131,7 +131,7 @@ const monitor = { ...@@ -131,7 +131,7 @@ const monitor = {
if (res.returnCode == 0) { if (res.returnCode == 0) {
const data = res.data const data = res.data
if (data) { if (data) {
const transferObj = { elat: data.wifiLat, elng: data.wifiLng } const transferObj = { blat: data.wifiLat, blng: data.wifiLng }
MAPGEO.transferAddressByGroup({ data: [transferObj] }, () => { MAPGEO.transferAddressByGroup({ data: [transferObj] }, () => {
infoDiv.querySelector('[data-transferAddress]').textContent = transferObj.transferAddress; infoDiv.querySelector('[data-transferAddress]').textContent = transferObj.transferAddress;
infoDiv.querySelector('[data-time]').textContent = data.lastReportTime; infoDiv.querySelector('[data-time]').textContent = data.lastReportTime;
...@@ -139,8 +139,8 @@ const monitor = { ...@@ -139,8 +139,8 @@ const monitor = {
const snSourceType = `${info.sn}:${info.isSource}` const snSourceType = `${info.sn}:${info.isSource}`
if (this.markers[snSourceType]) { if (this.markers[snSourceType]) {
this.markers[snSourceType].setPosition(mapService.getLngLat(parseFloat(transferObj.elng), parseFloat(transferObj.elat))); this.markers[snSourceType].setPosition(mapService.getLngLat(parseFloat(transferObj.blng), parseFloat(transferObj.blat)));
AMap.invoke("mapOpenInfoWindow", this.infowins[snSourceType],mapService.getLngLat(parseFloat(transferObj.elng))) AMap.invoke("mapOpenInfoWindow", this.infowins[snSourceType],mapService.getLngLat(parseFloat(transferObj.blng)))
AMap.invoke('addOverlay',this.markers[snSourceType]) AMap.invoke('addOverlay',this.markers[snSourceType])
} }
gpsBtn && gpsBtn.classList.remove('el-button--primary'); gpsBtn && gpsBtn.classList.remove('el-button--primary');
...@@ -166,18 +166,19 @@ const monitor = { ...@@ -166,18 +166,19 @@ const monitor = {
this.data = data; this.data = data;
const transferObj = [] const transferObj = []
data.forEach((item) => { data.forEach((item) => {
if (item.gpsLocation && item.gpsLocation.elat && item.gpsLocation.elng) { if (item.gpsLocation && item.gpsLocation.blat && item.gpsLocation.blng) {
transferObj.push(item.gpsLocation) transferObj.push(item.gpsLocation)
} }
if (item.bsLocation && item.bsLocation.elat && item.bsLocation.elng) { if (item.bsLocation && item.bsLocation.blat && item.bsLocation.blng) {
transferObj.push(item.bsLocation) transferObj.push(item.bsLocation)
} }
}) })
MAPGEO.transferAddressByGroup({ data: transferObj }, () => { MAPGEO.transferAddressByGroup({ data: transferObj }, () => {
this.data.forEach((item, idx) => { this.data.forEach((item, idx) => {
console.log(item)
let eLocation = item[item.eLocateType]; let eLocation = item[item.eLocateType];
if (!eLocation.elng && !eLocation.elat) return; if (!eLocation.blng && !eLocation.blat) return;
let isInfoOpen = false; let isInfoOpen = false;
let tag = `${item.sn}:${item.isSource}`; let tag = `${item.sn}:${item.isSource}`;
if (this.infowins[tag] && this.infowins[tag].isOpen()) { if (this.infowins[tag] && this.infowins[tag].isOpen()) {
...@@ -187,8 +188,8 @@ const monitor = { ...@@ -187,8 +188,8 @@ const monitor = {
let infoWindow; let infoWindow;
let snSourceType = `${item.sn}:${item.isSource}` let snSourceType = `${item.sn}:${item.isSource}`
if (this.markers[tag]) { if (this.markers[tag]) {
this.markers[tag].setPosition(mapService.getLngLat(parseFloat(eLocation.elng), parseFloat(eLocation.elat))); this.markers[tag].setPosition(mapService.getLngLat(parseFloat(eLocation.blng), parseFloat(eLocation.blat)));
//this.infowins[tag].setPosition(mapService.getLngLat(parseFloat(eLocation.elng), parseFloat(eLocation.elat))); //this.infowins[tag].setPosition(mapService.getLngLat(parseFloat(eLocation.blng), parseFloat(eLocation.blat)));
//infoWindow = mapService.bindMonitorInfoWindow(this.markers[tag], MAP, item, isInfoOpen); //infoWindow = mapService.bindMonitorInfoWindow(this.markers[tag], MAP, item, isInfoOpen);
console.log(this.markers,'markers') console.log(this.markers,'markers')
this.infowins[tag] = mapService.bindMonitorInfoWindow(this.markers[tag], AMap, item, isInfoOpen, this.isCompare ? true : false); this.infowins[tag] = mapService.bindMonitorInfoWindow(this.markers[tag], AMap, item, isInfoOpen, this.isCompare ? true : false);
...@@ -196,7 +197,7 @@ const monitor = { ...@@ -196,7 +197,7 @@ const monitor = {
EventBus.$emit(`uiMap.monitor.changeStatus.${snSourceType}`) EventBus.$emit(`uiMap.monitor.changeStatus.${snSourceType}`)
} else { } else {
this.infowins[tag] && MAP.remove(this.infowins[tag]); this.infowins[tag] && MAP.remove(this.infowins[tag]);
const getLngLat=mapService.getLngLat(parseFloat(eLocation.elng),parseFloat(eLocation.elat)) const getLngLat=mapService.getLngLat(parseFloat(eLocation.blng),parseFloat(eLocation.blat))
let marker = mapService.createCarMarker(getLngLat, AMap); let marker = mapService.createCarMarker(getLngLat, AMap);
infoWindow = mapService.bindMonitorInfoWindow(marker, AMap, item, isInfoOpen, this.isCompare ? true : false); infoWindow = mapService.bindMonitorInfoWindow(marker, AMap, item, isInfoOpen, this.isCompare ? true : false);
this.markers[tag] = marker; this.markers[tag] = marker;
......
...@@ -56,7 +56,7 @@ const replay = { ...@@ -56,7 +56,7 @@ const replay = {
defaultContent: replay.getNavgInfoContent(firstItem), defaultContent: replay.getNavgInfoContent(firstItem),
autoView: true, // 是否开启自动视野调整,如果开启那么路书在运动过程中会根据视野自动调整 autoView: true, // 是否开启自动视野调整,如果开启那么路书在运动过程中会根据视野自动调整
speed: replay.getSpeed(replay.speed, replay.dis), speed: replay.getSpeed(replay.speed, replay.dis),
icon: AMap.invoke('Icon', 'https://e-shield-old.glsx.com.cn/images/icon_car.png', AMap.invoke('Size', 36, 22),{ anchor: AMap.invoke('Size', 24, 24) }), icon: AMap.invoke('Icon', 'https://e-shield-old.glsx.com.cn/images/icon_car.png', AMap.invoke('Size', 36, 22),{ anchor: AMap.invoke('Size',18, 11) }),
enableRotation: true, // 是否设置marker随着道路的走向进行旋转 enableRotation: true, // 是否设置marker随着道路的走向进行旋转
}) })
AMap.invoke('lushuStart') //开始 AMap.invoke('lushuStart') //开始
...@@ -89,6 +89,7 @@ const replay = { ...@@ -89,6 +89,7 @@ const replay = {
</div>` </div>`
}, },
destroy: function(){ destroy: function(){
AMap.invoke('clearsOverlay')
// const MAP = mapService.map; // const MAP = mapService.map;
// if(replay.pathSimplifierIns){ // if(replay.pathSimplifierIns){
// replay.pathSimplifierIns.hide(); // replay.pathSimplifierIns.hide();
...@@ -105,6 +106,7 @@ const replay = { ...@@ -105,6 +106,7 @@ const replay = {
bindEvent(){ bindEvent(){
//解析轨迹地址 //解析轨迹地址
EventBus.$on('uiMap.replay.transferAdr', function(data){ EventBus.$on('uiMap.replay.transferAdr', function(data){
console.log(data)
replay.data = data; replay.data = data;
replay.transferAddressByGroup(); replay.transferAddressByGroup();
}); });
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!