测试地图

main
coco1986509808 2024-01-05 16:34:21 +08:00
parent e01a137237
commit 59fb58e644
1 changed files with 278 additions and 12 deletions

View File

@ -1,27 +1,293 @@
<template>
<div>
<!-- <iframe style="width: 800px; height: 600px;" src="../../../../020/index.html"/>-->
<!-- <iframe :src="this.txtUrl" width="100%" :style="{height:calHeight}" sandbox></iframe>-->
<!-- <iframe src="../../../../public/index.html" width="100%" :style="{height:calHeight}" ></iframe>-->
<iframe src="http://www.baidu.com/" width="100%" :style="{height:calHeight}" ></iframe>
<!-- <iframe src="http://www.baidu.com/" width="100%" :style="{height:calHeight}" ></iframe>-->
<!-- 摄像头分布图 -->
<div >
<baidu-map
class="map"
:scroll-wheel-zoom="true"
:double-click-zoom="false"
@zoomend="mouseEvent"
:center="{lng: 103.943382, lat: 30.750594 }"
:zoom="zoom">
<bm-navigation anchor="BMAP_ANCHOR_TOP_RIGHT"></bm-navigation>
<bm-marker
:icon="iconUrl"
v-for="(item,key ) of this.mapList"
:key="key"
:position="{'lng':item.cameraLongitude,'lat':item.cameraLatitude}"
@rightclick="rightmons(item.idFaceCamera)"
:dragging="false"
>
<bm-label
:massClear="false"
@dblclick="deletePoint(item)"
v-if="lableOpen"
:content="'<div style=display:'+item.displayCss+ '><div >名称:' + item.cameraName+'</div>'+ '<div>位置:' + item.cameraRegionFirstlevelBackUp+'</div>'+'<div>坐标:' + item.cameraLongitude+','+ item.cameraLatitude+'</div></div >'"
:labelStyle="{backgroundColor :'0.05',border :'0',color: 'blue', fontSize : '14px' ,padding:'10px'}"
:offset="{width: -100, height: -90}"
/>
</bm-marker>
</baidu-map>
</div>
</div>
</template>
<script>
import cameraAddUpdate from "./camera-add-update";
import cameraUpload from "./camera-upload";
import cameraView from "./camera-view";
export default {
components: {
cameraAddUpdate,
cameraView,
cameraUpload
},
data() {
return {
// txtUrl: "../../../../020/index.html",
txtUrl:"http://localhost:10101/github.com"
lableOpen: false,
zoom: 14,
iconUrl: {
url: require("../../../assets/img/video.png"),
size: { width: 30, height: 30 }
},
list: true,
mapList: [],
position: { lng: 103.931057, lat: 30.755467 },
mapOpen: false,
// camera camreaViewcamreaView
viewState: false,
//
formModel: {
cameraName: "",
cameraRegion: [],
cameratLocationtypeId: ""
},
// table
cameraList: [],
//
total: 0,
pageObj: {
pageNo: 1,
pageSize: 10,
note: {}
},
//
areaOptions: [],
areaProps: {
multiple: true
}
};
},
methods: {
deletePoint(e) {
let arr = [];
this.mapList.forEach(item => {
if (e.idFaceCamera == item.idFaceCamera) {
item.displayCss = "none";
}
arr.push(item);
});
this.mapList = arr;
},
//
mouseEvent(type, target) {
//14 14 14
if (type.currentTarget.Oa > 14) {
this.lableOpen = true;
} else {
this.lableOpen = false;
}
},
computed: {
// , iframe100px
calHeight() {
return (window.innerHeight - 100) + 'px';
rightmons(type, target) {
this.$nextTick(() => {
this.$refs.addUpdateFaceRef.init("update", type);
});
},
//
videoMap() {
this.list = !this.list;
},
// el-pagination
handleSizeChange: function(pageSize) {
this.pageObj.pageSize = pageSize;
this.handleCurrentChange();
},
handleCurrentChange: function(pageNo) {
this.pageObj.pageNo = pageNo;
this.pageObj.note = {
...this.pageObj.note,
...this.formModel
};
if (this.pageObj.note.cameraRegion.length === 0) {
this.pageObj.note.cameraRegion = "";
} else {
this.pageObj.note.cameraRegion = String(
this.pageObj.note.cameraRegion[
this.pageObj.note.cameraRegion.length - 1
]
);
}
this.commonSeach();
},
//
searchClick() {
this.pageObj.note = {
...this.pageObj.note,
...this.formModel
};
if (this.pageObj.note.cameraName != "") {
this.pageObj.pageNo = 1;
} else if (this.pageObj.note.cameratLocationtypeId != "") {
this.pageObj.pageNo = 1;
}
if (this.pageObj.note.cameraRegion.length === 0) {
this.pageObj.note.cameraRegion = "";
} else {
this.pageObj.note.cameraRegion = String(
this.pageObj.note.cameraRegion[
this.pageObj.note.cameraRegion.length - 1
]
);
this.pageObj.pageNo = 1;
}
this.commonSeach();
},
searchClicks() {
this.$http
.get(`/camera/getAllList?cameraName=${this.formModel.cameraName}`)
.then(res => {
this.mapList = res.data.data;
});
},
// /
addOrUpdateClick(param, row = {}) {
console.log(this.$refs.reference);
}
this.$nextTick(() => {
this.$refs.addUpdateFaceRef.init(param, row.idFaceCamera);
});
},
// /
refreshClick(param) {
param === "add" ? (this.pageObj.pageNo = 1) : this.pageObj.pageNo;
this.pageObj.note = {
...this.pageObj.note,
...this.formModel
};
if (this.pageObj.note.cameraName != "") {
this.pageObj.pageNo = 1;
} else if (this.pageObj.note.cameratLocationtypeId != "") {
this.pageObj.pageNo = 1;
}
if (this.pageObj.note.cameraRegion.length === 0) {
this.pageObj.note.cameraRegion = "";
} else {
this.pageObj.note.cameraRegion = String(
this.pageObj.note.cameraRegion[
this.pageObj.note.cameraRegion.length - 1
]
);
this.pageObj.pageNo = 1;
}
this.commonSeach();
},
//
deleteClick(row) {
this.$confirm("此操作将永久删除该文件, 是否继续?", "提示", {
confirmButtonText: "确认",
cancelButtonText: "取消",
type: "warning"
})
.then(() => {
this.$http.get(`/camera/delete/${row.idFaceCamera}`).then(res => {
if (res.data.code === 0) {
this.pageObj.note = { ...this.pageObj.note, ...this.formModel };
if (this.pageObj.note.cameraName != "") {
this.pageObj.pageNo = 1;
} else if (this.pageObj.note.cameratLocationtypeId != "") {
this.pageObj.pageNo = 1;
}
if (this.pageObj.note.cameraRegion.length === 0) {
this.pageObj.note.cameraRegion = "";
} else {
this.pageObj.note.cameraRegion = String(
this.pageObj.note.cameraRegion[
this.pageObj.note.cameraRegion.length - 1
]
);
this.pageObj.pageNo = 1;
}
if (this.cameraList.length === 1 && this.pageObj.pageNo > 1) {
this.pageObj.pageNo = this.pageObj.pageNo - 1;
}
this.commonSeach();
this.$message.success("删除成功");
} else {
this.$message.warning(res.data.message);
}
});
})
.catch(err => {
this.$message.info("已取消删除");
console.log(err);
});
},
//
commonSeach(pageObj = this.pageObj) {
this.$http.post("/camera/getList", pageObj).then(res => {
if (res.data.code === 0) {
this.cameraList = res.data.data.records;
this.total = Number(res.data.data.total);
} else if (res.data.code == 60001) {
this.$message.warning(res.data.message);
} else {
console.log(res);
}
});
this.$http.get("/camera/getAllList").then(res => {
this.mapList = res.data.data;
this.mapList.forEach(item => {
item.displayCss = "block";
});
});
}
},
created() {
//
this.commonSeach();
//
this.$http.get("/camera/getRegion").then(res => {
if (res.data.code === 0) {
this.areaOptions = res.data.data;
}
});
}
};
</script>
<style scoped>
.map {
height: 750px;
}
.conditions-div {
background-color: #fff;
border-radius: 2px;
}
/*
去除百度地图版权
去除右上角[地图卫星三维]控件
去除百度地图右上角平移缩放控件的市县区文字
*/
.map >>> .anchorBL,
.map >>> .anchorTR,
.map >>> .BMap_zlHolder {
display: none;
visibility: hidden;
}
.conditions-div >>> .el-form-item {
margin: 10px;
}
</style>