gis模块

This commit is contained in:
xc
2022-01-24 09:17:22 +08:00
parent f1e5f53cad
commit f7892df366
48 changed files with 6131 additions and 22226 deletions

View File

@@ -0,0 +1,56 @@
<template>
<div class="map-nominal-container">
<div class="map-nominal-container-inner" v-for="(item,index) in param" v-bind:key="index">
<div class="map-nominal-container-inner-text">{{item.common}}</div>
<div class="map-nominal-container-inner-label" :style="{'backgroundColor':item.color}"></div>
<div class="map-nominal-container-inner-text">{{item.desc}}</div>
</div>
</div>
</template>
<script>
export default {
name: "mapNominal",
props:{
param:{
type:Array
}
}
}
</script>
<style scoped>
.map-nominal-container {
width: auto;
position: absolute;
bottom: 10px;
left: 16px;
box-sizing: border-box;
padding: 6px;
background-color: #fff;
display: flex;
}
.map-nominal-container-inner-text {
width: 100%;
height: 29px;
line-height: 29px;
color: #606060;
font-size: 12px;
text-align: center;
}
.map-nominal-container-inner-label {
width: 100%;
height: 8px;
}
.map-nominal-container-inner {
width: 70px;
display: flex;
flex-direction: column;
margin-left: 3px;
}
</style>

View File

@@ -0,0 +1,93 @@
<template>
<div class="map-table-container " :style="{'right':type1 == 1 ? '0px':'-500px'}">
<a-card title="监测数据" :headStyle="{'padding':'0px 5px'}"
:bodyStyle="{'padding':'0px 5px','height':'200px','overFlow':'scroll'}">
<div class="left-close-button" @click="showTable(0)" v-if="type1 == 1">
<img src="https://sqtt.oss-cn-qingdao.aliyuncs.com/Uploads/image/goods/2022-01-08/61d8e51ac94d2.png" alt=""
style="width: 30px;height: 30px">
</div>
<div class="left-close-button" @click="showTable(1)" v-if="type1 == 0">
<img src="https://sqtt.oss-cn-qingdao.aliyuncs.com/Uploads/image/goods/2022-01-08/61d8e83754c7e.png" alt=""
style="width: 30px;height: 30px">
</div>
<a-table :columns="columns" :data-source="rowData" size="mini" :scroll="{y:150,x:500}" :pagination="false">
</a-table>
</a-card>
</div>
</template>
<script>
const columns = [
{
title: '点位名称',
dataIndex: 'place',
},
{
title: '级别',
dataIndex: 'regionLevel',
},
{
title: '来源',
dataIndex: 'waterSourceProperty',
},
{
title: '水质类别',
dataIndex: 'waterType',
},
{
title: 'PH',
dataIndex: 'ph',
},
];
export default {
props: {
rowData: {
type: Array
}
},
methods: {
showTable: function (type) {
this.type1 = type
}
},
data() {
return {
columns,
pagination: {
total: 0
},
type1: 0
};
},
}
</script>
<style scoped>
.map-table-container {
box-sizing: border-box;
width: 500px;
padding: 10px;
position: absolute;
bottom: 0px;
transition: right 0.8s;
}
::v-deep .ant-table-thead > tr > th, ::v-deep .ant-table-tbody > tr > td {
padding: 3px 3px;
}
.left-close-button {
width: 40px;
height: 40px;
background-color: #fff;
position: absolute;
left: -40px;
bottom: 0;
display: flex;
justify-content: center;
align-items: center;
}
</style>

View File

@@ -0,0 +1,93 @@
<template>
<div class="map-table-container " :style="{'right':type1 == 1 ? '0px':'-500px'}">
<a-card title="道路交通噪声点位" :headStyle="{'padding':'0px 5px'}"
:bodyStyle="{'padding':'0px 5px','height':'200px','overFlow':'scroll'}">
<div class="left-close-button" @click="showTable(0)" v-if="type1 == 1">
<img src="https://sqtt.oss-cn-qingdao.aliyuncs.com/Uploads/image/goods/2022-01-08/61d8e51ac94d2.png" alt=""
style="width: 30px;height: 30px">
</div>
<div class="left-close-button" @click="showTable(1)" v-if="type1 == 0">
<img src="https://sqtt.oss-cn-qingdao.aliyuncs.com/Uploads/image/goods/2022-01-08/61d8e83754c7e.png" alt=""
style="width: 30px;height: 30px">
</div>
<a-table :columns="columns" :data-source="rowData" size="mini" :scroll="{y:150,x:500}" :pagination="false">
</a-table>
</a-card>
</div>
</template>
<script>
const columns = [
{
title: '点位名称',
dataIndex: 'place',
},
{
title: '点位等级',
className: 'regionLevel',
dataIndex: 'regionLevel',
},
{
title: '所属地区',
dataIndex: 'area',
},
{
title: '所属路段',
dataIndex: 'road',
},
{
title: '噪声 dB(A)',
dataIndex: 'leq',
},
];
export default {
props: {
rowData: {
type: Array
}
},
methods: {
showTable: function (type) {
this.type1 = type
}
},
data() {
return {
columns,
pagination: {
total: 0
},
type1: 0
};
},
}
</script>
<style scoped>
.map-table-container {
box-sizing: border-box;
width: 500px;
padding: 10px;
position: absolute;
bottom: 300px;
transition: right 0.8s;
}
::v-deep .ant-table-thead > tr > th, ::v-deep .ant-table-tbody > tr > td {
padding: 3px 3px;
}
.left-close-button {
width: 40px;
height: 40px;
background-color: #fff;
position: absolute;
left: -40px;
bottom: 0;
display: flex;
justify-content: center;
align-items: center;
}
</style>

View File

@@ -0,0 +1,87 @@
<template>
<div id="tip-tool-container" class="tip-tool-container"
:style="{'top':`${currentY}px`,'left':`${currentX}px`}">
<div class="tip-tool-container-top">
点位名称 {{ data.place }}
</div>
<div class="tip-tool-container-text">
级别 {{ data.regionLevel }}
</div>
<div class="tip-tool-container-text">
来源 {{ data.waterSourceProperty }}
</div>
<div class="tip-tool-container-text">
水质类别 {{ data.waterType }}
</div>
<div class="tip-tool-container-text">
PH {{ data.ph }}
</div>
</div>
</template>
<script>
export default {
props: {
x: {
type: Number,
default: 30000
},
y: {
type: Number,
default: 0
},
flag: {
type: Boolean,
default: false
},
data: {
type: Object
}
},
watch: {
x(val) {
let tipToolInfo = document.getElementById("tip-tool-container")
let tipToolWidth = tipToolInfo.offsetWidth
this.currentX = val - tipToolWidth / 2
},
y(val) {
let tipToolInfo = document.getElementById("tip-tool-container")
let tipToolHeight = tipToolInfo.offsetHeight
this.currentY = val - tipToolHeight
}
},
data() {
return {
currentX: 30000,
currentY: 0,
currentFlag: false
}
}
}
</script>
<style scoped>
.tip-tool-container {
min-width: 150px;
min-height: 150px;
padding: 15px;
box-sizing: border-box;
border-radius: 15px;
background-color: rgba(0, 0, 0, .6);
color: #fff;
position: absolute;
z-index: 9999;
overflow: hidden;
}
.tip-tool-container-top {
font-size: 18px;
font-weight: 550;
text-align: left;
}
.tip-tool-container-text {
font-size: 15px;
line-height: 30px;
text-align: left;
}
</style>

View File

@@ -0,0 +1,435 @@
<template>
<div class="ele-body">
<a-card class="ele-card" :bordered="false">
<a-space>
<a-auto-complete :filterOption="true" :backfill="false" @select="autoInput" :dataSource="dataSource"
placeholder="请输入需要搜索的点位">
</a-auto-complete>
<a-select @change="whereChange" v-model:value="where.year">
<a-select-option v-for="item in yearOptions" :key="item.value">{{
item.label
}}
</a-select-option>
</a-select>
<a-radio-group @change="whereChange" name="area" v-model:value="regionLevel">
<a-radio-button value="城市">城市</a-radio-button>
<a-radio-button value="区县">区县</a-radio-button>
<a-radio-button value="农村">农村</a-radio-button>
</a-radio-group>
</a-space>
</a-card>
<div id="map" ref="map" style="overflow: hidden"></div>
<tip-tool :flag="tipFlag" :x="currentX" :y="currentY" :data="tipData"></tip-tool>
<mapNominal :param="nominalList"></mapNominal>
<!-- <map-table-center :rowData="pointData"></map-table-center>-->
<map-table :rowData="pointData"></map-table>
</div>
</template>
<script>
import {
waterCity,
waterCounty,
waterVillage
} from "@/api/gis/gisApi";
import {
getColumnOptions,
} from "@/api/ecology/atmosphere/acid-rain-plcae";
import tipTool from "./components/tipTool";
import mapNominal from "./components/mapNominal";
import mapTable from "./components/mapTable";
// import mapTableCenter from "./components/mapTableCenter";
var that
export default {
components: {
tipTool,
mapNominal,
mapTable,
// mapTableCenter
},
data() {
return {
yearOptions: [],
arriveCoor: [108.33, 22.84],//坐标点
where: {
year: "",
},
map: {},
pointData: [],
currentY: 0,
currentX: 30000,
tipFlag: false,
tipData: [],
zoom: 12,
points: [],//数据准备
dataSource: [],
value: '',
result: [],
searchKey: "",
searchId: -1,
regionLevel: "城市",
nominalList: [{
"text": "I类",
"color": "#80BC1C",
"common": "I",
"desc": "一类"
}, {
"text": "II类",
"color": "#BBD769",
"common": "Ⅱ",
"desc": "二类"
}, {
"text": "III类",
"color": "#F7E020",
"common": "Ⅲ",
"desc": "三类"
}, {
"text": "IV类",
"color": "#DF9913",
"common": "Ⅳ",
"desc": "四类"
}, {
"text": "V类",
"color": "#E57813",
"common": "",
"desc": "五类"
}, {
"text": "劣V类",
"color": "#DA251C",
"common": "劣Ⅴ",
"desc": "劣五类"
}]
}
},
mounted() {
that = this
this.newInitMap();
},
methods: {
autoInput(e) {
that.dataSource.forEach((item, index) => {
if (item == e) {
if (that.searchId > 0) {
document.getElementById("id" + that.searchId).className = ""
}
that.searchId = index
// eslint-disable-next-line no-undef
that.map.centerAndZoom(new BMap.Point(that.pointData[that.searchId]['longitude'], that.pointData[that.searchId]['latitude']), that.zoom); // 初始化地图,设置中心点坐标和地图级别
document.getElementById("id" + that.searchId).className += "animation_check"
}
})
},
newInitMap() {
// eslint-disable-next-line no-undef
that.map = new BMap.Map(this.$refs.map); // 创建Map实例
// eslint-disable-next-line no-undef
that.map.centerAndZoom(new BMap.Point(that.arriveCoor[0], that.arriveCoor[1]), that.zoom); // 初始化地图,设置中心点坐标和地图级别
that.map.addControl(
// eslint-disable-next-line no-undef
new BMap.MapTypeControl({
// eslint-disable-next-line no-undef
mapTypes: [BMAP_NORMAL_MAP, BMAP_HYBRID_MAP],
})
)
that.map.enableDragging();
that.map.enableScrollWheelZoom();
that.map.enableDoubleClickZoom();
that.map.enableKeyboard();
getColumnOptions("year").then((res) => {
if (res.data.code == 0) {
this.yearOptions = res.data.data.map((item) => {
return {
label: item,
value: item,
};
});
this.where.year = res.data.data[0];
this.whereChange({target: {value: "城市"}});
}
})
},
addMarker: function () { // 创建图标对象
//定义自定义覆盖物的构造函数
function ComplexCustomOverlay(point, index, color) {
this._point = point
this._index = index
this._color = color
}
// eslint-disable-next-line no-undef
ComplexCustomOverlay.prototype = new BMap.Overlay();
ComplexCustomOverlay.prototype.initialize = function (map) {
this._map = map;
var div = this._div = document.createElement("div");
div.style.position = "absolute";
div.style.float = "left"
div.style.cursor = "pointer"
// eslint-disable-next-line no-undef
div.style.zIndex = BMap.Overlay.getZIndex(this._point.lat);
div.style.height = "20px";
div.style.width = "10px";
var arrow = this._arrow = document.createElement("div");
arrow.style.width = "0px";
arrow.style.height = "0px";
arrow.style.borderLeftWidth = "10px"
arrow.style.borderLeftColor = "transparent"
arrow.style.borderStyle = "solid"
arrow.style.borderRightWidth = "10px"
arrow.style.borderRightColor = "transparent"
arrow.style.borderBottomWidth = "20px"
arrow.style.borderTopWidth = "0"
arrow.style.position = "absolute"
arrow.style.borderBottomColor = `${this._color}`
arrow.setAttribute("id", "id" + this._index)
arrow.style.top = "22px";
arrow.style.left = "10px";
div.appendChild(arrow);
that.map.getPanes().labelPane.appendChild(div);
return div;
}
ComplexCustomOverlay.prototype.draw = function () {
var map = this._map;
var pixel = map.pointToOverlayPixel(this._point);
this._div.style.left = pixel.x - parseInt(this._arrow.style.left) + "px";
this._div.style.top = pixel.y - 30 + "px";
}
ComplexCustomOverlay.prototype.addEventListener = function (event, fun) {
this._arrow['on' + event] = fun;
}
that.pointData.forEach(async (item, index) => {
let color = "#9a9a9a"
that.nominalList.forEach((it, ins) => {
if (item.waterType == it.common) {
color = that.nominalList[ins]['color']
return false
}
})
// eslint-disable-next-line no-undef
var myCompOverlay = new ComplexCustomOverlay(new BMap.Point(item.longitude, item.latitude), index, color);
that.map.addOverlay(myCompOverlay);//将标注添加到地图中
myCompOverlay.addEventListener('mouseover', function (e) {
let currentId = e.target.getAttribute("id")
setTimeout(() => {
}, 300)
let bodyInfo = document.getElementsByTagName("body")[0]
let screenWidth = bodyInfo.offsetWidth
// let screenHeight = bodyInfo.offsetHeight
let mapInfo = document.getElementById("map")
let mapWidth = mapInfo.offsetWidth; // 返回元素的总宽度
// let mapHeight = mapInfo.offsetHeight; // 返回元素的总高度
let calcWidth = screenWidth - mapWidth
// let calcHeight = screenHeight - mapHeight
that.tipFlag = true
that.tipData = that.pointData[currentId.substring(2, currentId.length)]
that.currentX = e.pageX - calcWidth
that.currentY = e.pageY - 80
},true)
myCompOverlay.addEventListener('mouseout', function () {
setTimeout(() => {
}, 300)
that.currentX = 30000
that.currentY = 0
that.tipFlag = false
},true)
})
},
whereChange(e) {
that.map.clearOverlays();
let type = e ? e.target.value : "城市"
if (type == "城市") {
// eslint-disable-next-line no-undef
that.map.centerAndZoom(new BMap.Point(108.33, 22.84), that.zoom);
waterCity(this.where).then((res) => {
that.pointData = []
that.dataSource = []
if (res.data.code == 0 && res.data.data.length > 0) {
that.pointData = res.data.data
that.pointData.forEach(item => {
that.dataSource.push(`${item.place}`)
})
that.addMarker()
}
})
}
if (type == "区县") {
that.zoom = 9
// eslint-disable-next-line no-undef
that.map.centerAndZoom(new BMap.Point(108.33, 22.84), that.zoom);
waterCounty(this.where).then((res) => {
that.pointData = []
that.dataSource = []
if (res.data.code == 0 && res.data.data.length > 0) {
that.pointData = res.data.data
that.pointData.forEach(item => {
that.dataSource.push(`${item.place}`)
})
that.addMarker()
}
})
}
if (type == "农村") {
that.zoom = 11
// eslint-disable-next-line no-undef
that.map.centerAndZoom(new BMap.Point(108.33, 22.84), that.zoom);
waterVillage(this.where).then((res) => {
that.pointData = []
that.dataSource = []
if (res.data.code == 0 && res.data.data.length > 0) {
that.pointData = res.data.data
that.pointData.forEach(item => {
that.dataSource.push(`${item.place}`)
})
that.addMarker()
}
})
}
}
}
}
</script>
<style>
::-webkit-scrollbar {
display: none;
}
html,
body {
overflow: hidden;
margin: 0;
width: 100vw;
height: 100vh;
}
.ele-body {
position: relative;
padding: 16px 0;
height: 100%;
}
.ele-card {
z-index: 10;
margin: 0 16px;
display: inline-block;
}
#map {
position: absolute;
top: 0;
bottom: 0;
width: 100%;
}
.anchorBL {
display: none;
}
::v-deep .amap-logo {
right: 0 !important;
left: auto !important;
display: none !important;
}
::v-deep .amap-copyright {
right: 70px !important;
left: auto !important;
opacity: 0 !important;
}
::v-deep .amap-info-content {
background-color: rgba(0, 0, 0, .4);
border-radius: 5px;
color: #fff;
padding: 0;
}
::v-deep .bottom-center .amap-info-sharp {
border-top-color: rgba(0, 0, 0, .6);
}
::v-deep .amap-info-close {
display: none;
}
::v-deep #map-mark {
border-left: 10px solid transparent;
border-right: 10px solid transparent;
border-bottom: 20px solid rgba(0, 0, 255, 0.6);
}
.radar-box {
position: absolute;
.radar {
width: 40px;
height: 40px;
border-radius: 50%;
background-color: red;
position: relative;
}
.radar .ripple {
width: 40px;
height: 40px;
border-radius: 50%;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
border: 1px solid red;
animation: ripple 2s linear infinite;
}
.radar :nth-child(1) {
animation-delay: 0.666s;
}
.radar :nth-child(2) {
animation-delay: 1.322s;
}
@keyframes ripple {
to {
width: 150px;
height: 150px;
opacity: 0;
}
}
}
.animation_check {
animation: myfirst 1s infinite;
}
@keyframes myfirst {
0% {
top: 0px
}
25% {
top: 5px;
}
50% {
top: 0px;
}
75% {
top: -5px;
}
100% {
top: 0px;
}
}
</style>

View File

@@ -0,0 +1,56 @@
<template>
<div class="map-nominal-container">
<div class="map-nominal-container-inner" v-for="(item,index) in param" v-bind:key="index">
<div class="map-nominal-container-inner-text">{{ item.text }}</div>
<div class="map-nominal-container-inner-label" :style="{'backgroundColor':item.color}"></div>
<!-- <div class="map-nominal-container-inner-text">{{item.data}}</div>-->
</div>
</div>
</template>
<script>
export default {
name: "mapNominal",
props: {
param: {
type: Array
}
}
}
</script>
<style scoped>
.map-nominal-container {
width: auto;
position: absolute;
bottom: 10px;
left: 16px;
box-sizing: border-box;
padding: 6px;
background-color: #fff;
display: flex;
}
.map-nominal-container-inner-text {
width: 100%;
height: 29px;
line-height: 29px;
color: #606060;
font-size: 12px;
text-align: center;
}
.map-nominal-container-inner-label {
width: 100%;
height: 8px;
}
.map-nominal-container-inner {
width: 70px;
display: flex;
flex-direction: column;
margin-left: 3px;
}
</style>

View File

@@ -0,0 +1,90 @@
<template>
<div class="map-table-container " :style="{'right':type1 == 1 ? '0px':'-500px'}">
<a-card title="湖库数据" :headStyle="{'padding':'0px 5px'}"
:bodyStyle="{'padding':'0px 5px','height':'200px','overFlow':'scroll'}">
<div class="left-close-button" @click="showTable(0)" v-if="type1 == 1">
<img src="https://sqtt.oss-cn-qingdao.aliyuncs.com/Uploads/image/goods/2022-01-08/61d8e51ac94d2.png" alt=""
style="width: 30px;height: 30px">
</div>
<div class="left-close-button" @click="showTable(1)" v-if="type1 == 0">
<img src="https://sqtt.oss-cn-qingdao.aliyuncs.com/Uploads/image/goods/2022-01-08/61d8e83754c7e.png" alt=""
style="width: 30px;height: 30px">
</div>
<a-table :columns="columns" :data-source="rowData" size="mini" :scroll="{y:150,x:500}" :pagination="false">
</a-table>
</a-card>
</div>
</template>
<script>
const columns = [
{
title: '点位名称',
dataIndex: 'placeName',
},
{
title: '点位等级',
className: 'regionLevel',
dataIndex: 'regionLevel',
},
{
title: '水质',
dataIndex: 'waterType',
},
{
title: 'ph',
dataIndex: 'ph',
},
];
export default {
props: {
rowData: {
type: Array
}
},
methods: {
showTable: function (type) {
this.type1 = type
}
},
data() {
return {
columns,
pagination: {
total: 0
},
type1: 0
};
},
}
</script>
<style scoped>
.map-table-container {
box-sizing: border-box;
width: 500px;
padding: 10px;
position: absolute;
bottom: 0px;
transition: right 0.8s;
}
::v-deep .ant-table-thead > tr > th, ::v-deep .ant-table-tbody > tr > td {
padding: 3px 3px;
}
.left-close-button {
width: 40px;
height: 40px;
background-color: #fff;
position: absolute;
left: -40px;
bottom: 0;
display: flex;
justify-content: center;
align-items: center;
}
</style>

View File

@@ -0,0 +1,93 @@
<template>
<div class="map-table-container " :style="{'right':type1 == 1 ? '0px':'-500px'}">
<a-card title="湖库点位" :headStyle="{'padding':'0px 5px'}"
:bodyStyle="{'padding':'0px 5px','height':'200px','overFlow':'scroll'}">
<div class="left-close-button" @click="showTable(0)" v-if="type1 == 1">
<img src="https://sqtt.oss-cn-qingdao.aliyuncs.com/Uploads/image/goods/2022-01-08/61d8e51ac94d2.png" alt=""
style="width: 30px;height: 30px">
</div>
<div class="left-close-button" @click="showTable(1)" v-if="type1 == 0">
<img src="https://sqtt.oss-cn-qingdao.aliyuncs.com/Uploads/image/goods/2022-01-08/61d8e83754c7e.png" alt=""
style="width: 30px;height: 30px">
</div>
<a-table :columns="columns" :data-source="rowData" size="mini" :scroll="{y:150,x:500}" :pagination="false">
</a-table>
</a-card>
</div>
</template>
<script>
const columns = [
{
title: '点位名称',
dataIndex: 'place',
},
{
title: '点位等级',
className: 'regionLevel',
dataIndex: 'regionLevel',
},
{
title: '所属地区',
dataIndex: 'area',
},
{
title: '所属路段',
dataIndex: 'road',
},
{
title: '噪声 dB(A)',
dataIndex: 'leq',
},
];
export default {
props: {
rowData: {
type: Array
}
},
methods: {
showTable: function (type) {
this.type1 = type
}
},
data() {
return {
columns,
pagination: {
total: 0
},
type1: 0
};
},
}
</script>
<style scoped>
.map-table-container {
box-sizing: border-box;
width: 500px;
padding: 10px;
position: absolute;
bottom: 300px;
transition: right 0.8s;
}
::v-deep .ant-table-thead > tr > th, ::v-deep .ant-table-tbody > tr > td {
padding: 3px 3px;
}
.left-close-button {
width: 40px;
height: 40px;
background-color: #fff;
position: absolute;
left: -40px;
bottom: 0;
display: flex;
justify-content: center;
align-items: center;
}
</style>

View File

@@ -0,0 +1,84 @@
<template>
<div id="tip-tool-container" class="tip-tool-container"
:style="{'top':`${currentY}px`,'left':`${currentX}px`}">
<div class="tip-tool-container-top">
点位名称 {{ data.placeName}}
</div>
<div class="tip-tool-container-text">
点位级别 {{data.regionLevel }}
</div>
<div class="tip-tool-container-text">
水质 {{ data.waterType }}
</div>
<div class="tip-tool-container-text">
PH {{ data.ph }}
</div>
</div>
</template>
<script>
export default {
props: {
x: {
type: Number,
default: 30000
},
y: {
type: Number,
default: 0
},
flag: {
type: Boolean,
default: false
},
data: {
type: Object
}
},
watch: {
x(val) {
let tipToolInfo = document.getElementById("tip-tool-container")
let tipToolWidth = tipToolInfo.offsetWidth
this.currentX = val - tipToolWidth / 2
},
y(val) {
let tipToolInfo = document.getElementById("tip-tool-container")
let tipToolHeight = tipToolInfo.offsetHeight
this.currentY = val - tipToolHeight
}
},
data() {
return {
currentX: 30000,
currentY: 0,
currentFlag: false
}
}
}
</script>
<style scoped>
.tip-tool-container {
min-width: 150px;
min-height: 150px;
padding: 15px;
box-sizing: border-box;
border-radius: 15px;
background-color: rgba(0, 0, 0, .6);
color: #fff;
position: absolute;
z-index: 9999;
overflow: hidden;
}
.tip-tool-container-top {
font-size: 18px;
font-weight: 550;
text-align: left;
}
.tip-tool-container-text {
font-size: 15px;
line-height: 30px;
text-align: left;
}
</style>

View File

@@ -0,0 +1,471 @@
<template>
<div class="ele-body">
<a-card class="ele-card" :bordered="false">
<a-space>
<a-auto-complete :filterOption="true" :backfill="false" @select="autoInput" :dataSource="dataSource"
placeholder="请输入需要搜索的点位">
</a-auto-complete>
<a-select @change="whereChange" v-model:value="where.year">
<a-select-option v-for="item in yearOptions" :key="item.value">{{
item.label
}}
</a-select-option>
</a-select>
<a-radio-group @change="whereChange" name="area" v-model:value="where.type">
<a-radio-button value="0">城市内湖</a-radio-button>
<a-radio-button value="1">专项湖区</a-radio-button>
</a-radio-group>
</a-space>
</a-card>
<div id="map" ref="map" style="overflow: hidden"></div>
<tip-tool :flag="tipFlag" :x="currentX" :y="currentY" :data="tipData"></tip-tool>
<mapNominal :param="nominalList"></mapNominal>
<!-- <map-table-center :rowData="pointData"></map-table-center>-->
<map-table :rowData="pointData"></map-table>
</div>
</template>
<script>
import {
getLakePlace,
getLakePlaceInnerCity,
getLakeYear,
getInnerLakeYear
} from "@/api/gis/gisApi";
// import {
// getColumnOptions,
// } from "@/api/ecology/atmosphere/acid-rain-plcae";
import tipTool from "./components/tipTool";
import mapNominal from "./components/mapNominal";
import mapTable from "./components/mapTable";
// import mapTableCenter from "./components/mapTableCenter";
let scene = null;
let pointLayer = null;
var that
export default {
components: {
tipTool,
mapNominal,
mapTable,
// mapTableCenter
},
data() {
return {
yearOptions: [],
arriveCoor: [108.33, 22.84],//坐标点
where: {
type: "0",
year: "",
filter: ["ph", "transparency", "dissolvedOxygenSaturation", "dissolvedOxygen", "permanganateIndex", "fiveDayBod", "totalNitrogen", "ammonia", "volatilePhenol", "as", "hg", "cr6", "pb", "cd", "totalPhosphorus", "petro", "fecalColiforms", "cod", "chlA", "anSaa", "s", "oxidationReductionPotential"]
},
map: {},
pointData: [],
currentY: 0,
currentX: 30000,
tipFlag: false,
tipData: [],
zoom: 13,
nominalList: [{
"text": "I类",
"color": "#80BC1C",
"common": "I"
}, {
"text": "II类",
"color": "#BBD769",
"common": "II"
}, {
"text": "III类",
"color": "#F7E020",
"common": "III"
}, {
"text": "IV类",
"color": "#DF9913",
"common": "IV"
}, {
"text": "V类",
"color": "#E57813",
"common": "V"
}, {
"text": "劣V类",
"color": "#DA251C",
"common": "劣V"
}],
points: [],//数据准备
dataSource: [],
value: '',
result: [],
searchKey: "",
searchId: -1
};
},
mounted() {
that = this
this.newInitMap();
},
methods: {
autoInput(e) {
that.dataSource.forEach((item, index) => {
if (item == e) {
if (that.searchId > 0) {
document.getElementById("id" + that.searchId).className = ""
}
that.searchId = index
// eslint-disable-next-line no-undef
that.map.centerAndZoom(new BMap.Point(that.pointData[that.searchId]['longitude'], that.pointData[that.searchId]['latitude']), that.zoom); // 初始化地图,设置中心点坐标和地图级别
document.getElementById("id" + that.searchId).className += "animation_check"
}
})
},
newInitMap() {
// eslint-disable-next-line no-undef
that.map = new BMap.Map(this.$refs.map); // 创建Map实例
// eslint-disable-next-line no-undef
that.map.centerAndZoom(new BMap.Point(that.arriveCoor[0], that.arriveCoor[1]), that.zoom); // 初始化地图,设置中心点坐标和地图级别
that.map.addControl(
// eslint-disable-next-line no-undef
new BMap.MapTypeControl({
// eslint-disable-next-line no-undef
mapTypes: [BMAP_NORMAL_MAP, BMAP_HYBRID_MAP],
})
)
that.map.enableDragging();
that.map.enableScrollWheelZoom();
that.map.enableDoubleClickZoom();
that.map.enableKeyboard();
if (that.where.type == 1) {
getLakeYear().then((res) => {
if (res.data.code == 0) {
this.yearOptions = res.data.data.years.map((item) => {
return {
label: item,
value: item,
};
});
this.where.year = res.data.data.years[0];
this.whereChange();
}
})
} else {
getInnerLakeYear().then((res) => {
if (res.data.code == 0) {
this.yearOptions = res.data.data.years.map((item) => {
return {
label: item,
value: item,
};
});
this.where.year = res.data.data.years[0];
this.whereChange();
}
})
}
},
addMarker: function () { // 创建图标对象
//定义自定义覆盖物的构造函数
function ComplexCustomOverlay(point, index, color) {
this._point = point
this._index = index
this._color = color
}
// eslint-disable-next-line no-undef
ComplexCustomOverlay.prototype = new BMap.Overlay();
ComplexCustomOverlay.prototype.initialize = function (map) {
this._map = map;
var div = this._div = document.createElement("div");
div.style.position = "absolute";
div.style.float = "left"
div.style.cursor = "pointer"
// eslint-disable-next-line no-undef
div.style.zIndex = BMap.Overlay.getZIndex(this._point.lat);
div.style.height = "20px";
div.style.width = "10px";
var arrow = this._arrow = document.createElement("div");
arrow.style.width = "0px";
arrow.style.height = "0px";
arrow.style.borderLeftWidth = "10px"
arrow.style.borderLeftColor = "transparent"
arrow.style.borderStyle = "solid"
arrow.style.borderRightWidth = "10px"
arrow.style.borderRightColor = "transparent"
arrow.style.borderBottomWidth = "20px"
arrow.style.borderTopWidth = "0"
arrow.style.position = "absolute"
arrow.style.borderBottomColor = `${this._color}`
arrow.setAttribute("id", "id" + this._index)
arrow.style.top = "22px";
arrow.style.left = "10px";
div.appendChild(arrow);
that.map.getPanes().labelPane.appendChild(div);
return div;
}
ComplexCustomOverlay.prototype.draw = function () {
var map = this._map;
var pixel = map.pointToOverlayPixel(this._point);
this._div.style.left = pixel.x - parseInt(this._arrow.style.left) + "px";
this._div.style.top = pixel.y - 30 + "px";
}
ComplexCustomOverlay.prototype.addEventListener = function (event, fun) {
this._arrow['on' + event] = fun;
}
that.pointData.forEach(async (item, index) => {
let color = ""
that.nominalList.forEach((it, ins) => {
if (item.waterType >= it.common) {
color = that.nominalList[ins]['color']
return false
}
})
// eslint-disable-next-line no-undef
var myCompOverlay = new ComplexCustomOverlay(new BMap.Point(item.longitude, item.latitude), index, color);
that.map.addOverlay(myCompOverlay);//将标注添加到地图中
myCompOverlay.addEventListener('mouseover', function (e) {
let currentId = e.target.getAttribute("id")
setTimeout(() => {
}, 300)
let bodyInfo = document.getElementsByTagName("body")[0]
let screenWidth = bodyInfo.offsetWidth
// let screenHeight = bodyInfo.offsetHeight
let mapInfo = document.getElementById("map")
let mapWidth = mapInfo.offsetWidth; // 返回元素的总宽度
// let mapHeight = mapInfo.offsetHeight; // 返回元素的总高度
let calcWidth = screenWidth - mapWidth
// let calcHeight = screenHeight - mapHeight
that.tipFlag = true
that.tipData = that.pointData[currentId.substring(2, currentId.length)]
that.currentX = e.pageX - calcWidth
that.currentY = e.pageY - 80
},true)
myCompOverlay.addEventListener('mouseout', function () {
setTimeout(() => {
}, 300)
that.currentX = 30000
that.currentY = 0
that.tipFlag = false
},true)
})
},
whereChange(e) {
if (typeof (e) == "object") {
if (e.target.name == "area") {
that.where.type = e.target.value
if (that.where.type == "1") {
that.zoom = 9
} else {
that.zoom = 13
}
}
} else {
if (e > 0) {
that.where.year = e
}
}
that.map.clearOverlays();
// eslint-disable-next-line no-undef
that.map.centerAndZoom(new BMap.Point(108.33, 22.84), that.zoom);
if (scene && pointLayer) {
scene.removeLayer(pointLayer)
}
if (that.where.type == 1) {
getLakePlace(this.where).then((res) => {
that.pointData = []
that.dataSource = []
if (res.data.code == 0 && res.data.data.length > 0) {
that.pointData = res.data.data
let tem_arr = []
if (that.pointData.length > 0) {
that.pointData.forEach(item => {
that.dataSource.push(`${item.lakeLibraryName}`)
tem_arr.push({ // 整合字段
'placeName': item.lakeLibraryName,
'attributes': item.controlAttributes,
'ph': item.ph,
'regionLevel': item.regionLevel,
'longitude': item.longitude,
'latitude': item.latitude,
'waterType' : item.waterType
})
})
}
that.pointData = tem_arr
that.addMarker()
}
})
} else {
getLakePlaceInnerCity(this.where).then((res) => {
that.pointData = []
that.dataSource = []
if (res.data.code == 0 && res.data.data.length > 0) {
that.pointData = res.data.data
let tem_arr = []
if (that.pointData.length > 0) {
that.pointData.forEach(item => {
that.dataSource.push(`${item.pointName}`)
tem_arr.push({
'placeName': item.pointName,
'attributes': item.controlAttributes,
'ph': item.ph,
'regionLevel': item.regionLevel,
'longitude': item.longitude,
'latitude': item.latitude,
'waterType' : item.waterType
})
})
}
that.pointData = tem_arr
that.addMarker()
}
})
}
}
}
}
</script>
<style>
::-webkit-scrollbar {
display: none;
}
html,
body {
overflow: hidden;
margin: 0;
width: 100vw;
height: 100vh;
}
.ele-body {
position: relative;
padding: 16px 0;
height: 100%;
}
.ele-card {
z-index: 10;
margin: 0 16px;
display: inline-block;
}
#map {
position: absolute;
top: 0;
bottom: 0;
width: 100%;
}
.anchorBL {
display: none;
}
::v-deep .amap-logo {
right: 0 !important;
left: auto !important;
display: none !important;
}
::v-deep .amap-copyright {
right: 70px !important;
left: auto !important;
opacity: 0 !important;
}
::v-deep .amap-info-content {
background-color: rgba(0, 0, 0, .4);
border-radius: 5px;
color: #fff;
padding: 0;
}
::v-deep .bottom-center .amap-info-sharp {
border-top-color: rgba(0, 0, 0, .6);
}
::v-deep .amap-info-close {
display: none;
}
::v-deep #map-mark {
border-left: 10px solid transparent;
border-right: 10px solid transparent;
border-bottom: 20px solid rgba(0, 0, 255, 0.6);
}
.radar-box {
position: absolute;
.radar {
width: 40px;
height: 40px;
border-radius: 50%;
background-color: red;
position: relative;
}
.radar .ripple {
width: 40px;
height: 40px;
border-radius: 50%;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
border: 1px solid red;
animation: ripple 2s linear infinite;
}
.radar :nth-child(1) {
animation-delay: 0.666s;
}
.radar :nth-child(2) {
animation-delay: 1.322s;
}
@keyframes ripple {
to {
width: 150px;
height: 150px;
opacity: 0;
}
}
}
.animation_check {
animation: myfirst 1s infinite;
}
@keyframes myfirst {
0% {
top: 0px
}
25% {
top: 5px;
}
50% {
top: 0px;
}
75% {
top: -5px;
}
100% {
top: 0px;
}
}
</style>

View File

@@ -0,0 +1,56 @@
<template>
<div class="map-nominal-container">
<div class="map-nominal-container-inner" v-for="(item,index) in param" v-bind:key="index">
<div class="map-nominal-container-inner-text">{{item.text}}</div>
<div class="map-nominal-container-inner-label" :style="{'backgroundColor':item.color}"></div>
<div class="map-nominal-container-inner-text">{{item.data}}</div>
</div>
</div>
</template>
<script>
export default {
name: "mapNominal",
props:{
param:{
type:Array
}
}
}
</script>
<style scoped>
.map-nominal-container {
width: auto;
position: absolute;
bottom: 10px;
left: 16px;
box-sizing: border-box;
padding: 6px;
background-color: #fff;
display: flex;
}
.map-nominal-container-inner-text {
width: 100%;
height: 29px;
line-height: 29px;
color: #606060;
font-size: 12px;
text-align: center;
}
.map-nominal-container-inner-label {
width: 100%;
height: 8px;
}
.map-nominal-container-inner {
width: 70px;
display: flex;
flex-direction: column;
margin-left: 3px;
}
</style>

View File

@@ -0,0 +1,73 @@
<template>
<div class="map-table-container " :style="{'right':type1 == 1 ? '0px':'-500px'}">
<a-card title="监测数据" :headStyle="{'padding':'0px 5px'}"
:bodyStyle="{'padding':'0px 5px','height':'200px','overFlow':'scroll'}">
<div class="left-close-button" @click="showTable(0)" v-if="type1 == 1">
<img src="https://sqtt.oss-cn-qingdao.aliyuncs.com/Uploads/image/goods/2022-01-08/61d8e51ac94d2.png" alt=""
style="width: 30px;height: 30px">
</div>
<div class="left-close-button" @click="showTable(1)" v-if="type1 == 0">
<img src="https://sqtt.oss-cn-qingdao.aliyuncs.com/Uploads/image/goods/2022-01-08/61d8e83754c7e.png" alt=""
style="width: 30px;height: 30px">
</div>
<a-table :columns="columns" :data-source="rowData" size="mini" :scroll="{y:150,x:500}" :pagination="false">
</a-table>
</a-card>
</div>
</template>
<script>
export default {
props: {
rowData: {
type: Array
},
columns:{
type:Array
}
},
methods: {
showTable: function (type) {
this.type1 = type
}
},
data() {
return {
pagination: {
total: 0
},
type1: 0
};
},
}
</script>
<style scoped>
.map-table-container {
box-sizing: border-box;
width: 500px;
padding: 10px;
position: absolute;
bottom: 0px;
transition: right 0.8s;
}
::v-deep .ant-table-thead > tr > th, ::v-deep .ant-table-tbody > tr > td {
padding: 3px 3px;
}
.left-close-button {
width: 40px;
height: 40px;
background-color: #fff;
position: absolute;
left: -40px;
bottom: 0;
display: flex;
justify-content: center;
align-items: center;
}
</style>

View File

@@ -0,0 +1,93 @@
<template>
<div class="map-table-container " :style="{'right':type1 == 1 ? '0px':'-500px'}">
<a-card title="道路交通噪声点位" :headStyle="{'padding':'0px 5px'}"
:bodyStyle="{'padding':'0px 5px','height':'200px','overFlow':'scroll'}">
<div class="left-close-button" @click="showTable(0)" v-if="type1 == 1">
<img src="https://sqtt.oss-cn-qingdao.aliyuncs.com/Uploads/image/goods/2022-01-08/61d8e51ac94d2.png" alt=""
style="width: 30px;height: 30px">
</div>
<div class="left-close-button" @click="showTable(1)" v-if="type1 == 0">
<img src="https://sqtt.oss-cn-qingdao.aliyuncs.com/Uploads/image/goods/2022-01-08/61d8e83754c7e.png" alt=""
style="width: 30px;height: 30px">
</div>
<a-table :columns="columns" :data-source="rowData" size="mini" :scroll="{y:150,x:500}" :pagination="false">
</a-table>
</a-card>
</div>
</template>
<script>
const columns = [
{
title: '点位名称',
dataIndex: 'place',
},
{
title: '点位等级',
className: 'regionLevel',
dataIndex: 'regionLevel',
},
{
title: '所属地区',
dataIndex: 'area',
},
{
title: '所属路段',
dataIndex: 'road',
},
{
title: '噪声 dB(A)',
dataIndex: 'leq',
},
];
export default {
props: {
rowData: {
type: Array
}
},
methods: {
showTable: function (type) {
this.type1 = type
}
},
data() {
return {
columns,
pagination: {
total: 0
},
type1: 0
};
},
}
</script>
<style scoped>
.map-table-container {
box-sizing: border-box;
width: 500px;
padding: 10px;
position: absolute;
bottom: 300px;
transition: right 0.8s;
}
::v-deep .ant-table-thead > tr > th, ::v-deep .ant-table-tbody > tr > td {
padding: 3px 3px;
}
.left-close-button {
width: 40px;
height: 40px;
background-color: #fff;
position: absolute;
left: -40px;
bottom: 0;
display: flex;
justify-content: center;
align-items: center;
}
</style>

View File

@@ -0,0 +1,78 @@
<template>
<div id="tip-tool-container" class="tip-tool-container"
:style="{'top':`${currentY}px`,'left':`${currentX}px`}">
<div class="tip-tool-container-text" v-for="(item,index) in columns" :key="index">
{{item.title}} {{data[item.dataIndex]}}
</div>
</div>
</template>
<script>
export default {
props: {
x: {
type: Number,
default:30000
},
y: {
type: Number,
default: 0
},
flag: {
type: Boolean,
default: false
},
data:{
type:Object
},
columns:{
type:Array
}
},
watch: {
x(val) {
let tipToolInfo = document.getElementById("tip-tool-container")
let tipToolWidth = tipToolInfo.offsetWidth
this.currentX = val - tipToolWidth / 2
},
y(val) {
let tipToolInfo = document.getElementById("tip-tool-container")
let tipToolHeight = tipToolInfo.offsetHeight
this.currentY = val - tipToolHeight
}
},
data() {
return {
currentX: 30000,
currentY: 0,
currentFlag: false
}
}
}
</script>
<style scoped>
.tip-tool-container {
min-width: 150px;
min-height: 150px;
padding: 15px;
box-sizing: border-box;
border-radius: 15px;
background-color: rgba(0, 0, 0, .6);
color: #fff;
position: absolute;
z-index: 9999;
overflow: hidden;
}
.tip-tool-container-top {
font-size: 18px;
font-weight: 550;
text-align: left;
}
.tip-tool-container-text {
font-size: 15px;
line-height: 30px;
text-align: left;
}
</style>

View File

@@ -0,0 +1,524 @@
<template>
<div class="ele-body">
<a-card class="ele-card" :bordered="false">
<a-space>
<a-auto-complete :filterOption="true" :backfill="false" @select="autoInput" :dataSource="dataSource"
placeholder="请输入需要搜索的点位">
</a-auto-complete>
<a-select @change="whereChange" v-model:value="where.year"
style="width: 100px">
<a-select-option v-for="item in yearOptions" :key="item.value">
{{ item.label }}
</a-select-option>
</a-select>
<a-select @change="selectMonth" :default-value="where.month+'月'"
v-if="currentRequestCata == '1' ||currentRequestCata == '2' "
style="width: 100px">
<a-select-option v-for="(item,index) in 12" :key="index">
{{ index + 1 }}
</a-select-option>
</a-select>
<a-radio-group @change="changeCate" :default-value="currentRequestCata">
<a-radio-button value="0">江河水质</a-radio-button>
<a-radio-button value="1">水功能</a-radio-button>
<a-radio-button value="2">水站</a-radio-button>
</a-radio-group>
<a-select style="width: 200px;" v-if="currentRequestCata == '1'" @change="changeText" name="waterCate"
:default-value="currentCate">
<a-select-option v-for="(item,index) in waterCate" :key="index">
{{ item }}
</a-select-option>
</a-select>
</a-space>
</a-card>
<div id="map" ref="map" style="overflow: hidden"></div>
<tip-tool :columns="columns" :flag="tipFlag" :x="currentX" :y="currentY" :data="tipData"></tip-tool>
<mapNominal :param="nominalList"></mapNominal>
<!-- <map-table-center :rowData="pointData"></map-table-center>-->
<map-table :columns="columns" :rowData="pointData"></map-table>
</div>
</template>
<script>
import {
river, national, waterStation, autonomous
} from "@/api/gis/gisApi";
import {
getColumnOptions,
} from "@/api/ecology/atmosphere/acid-rain-plcae";
import tipTool from "./components/tipTool";
import mapNominal from "./components/mapNominal";
import mapTable from "./components/mapTable";
// import mapTableCenter from "./components/mapTableCenter";
var that
export default {
components: {
tipTool,
mapNominal,
mapTable,
// mapTableCenter
},
data() {
return {
yearOptions: [],
arriveCoor: [108.33, 22.84],//坐标点
where: {
name: "",
year: "",
month: "1"
},
waterCate: ["国家水功能区", "自治区水功能区"],
currentCate: "国家水功能区",
map: {},
pointData: [],
currentY: 0,
currentX: 30000,
tipFlag: false,
tipData: [],
zoom: 13,
points: [],//数据准备
dataSource: [],
value: '',
result: [],
searchKey: "",
searchId: -1,
currentRequestCata: "0",
columns: [],
columns0: [
{
title: "站点名称",
dataIndex: 'sectionName'
},
{
title: '流域',
dataIndex: 'basin',
},
{
title: '城市',
dataIndex: 'city',
},
{
title: '类别',
dataIndex: 'waterQualityCategory',
},
{
title: '河流级别',
dataIndex: 'riverLevel',
}
],
columns2: [
{
title: '水站名称',
dataIndex: 'stationName',
},
{
title: '河流名称',
dataIndex: 'riverName',
},
{
title: '类别',
dataIndex: 'waterQualityCategory',
}
],
nominalList: [{
"text": "I类",
"color": "#80BC1C",
"common": "",
"desc": "一类"
}, {
"text": "II类",
"color": "#BBD769",
"common": "Ⅱ",
"desc": "二类"
}, {
"text": "III类",
"color": "#F7E020",
"common": "Ⅲ",
"desc": "三类"
}, {
"text": "IV类",
"color": "#DF9913",
"common": "Ⅳ",
"desc": "四类"
}, {
"text": "V类",
"color": "#E57813",
"common": "",
"desc": "五类"
}, {
"text": "劣V类",
"color": "#DA251C",
"common": "劣Ⅴ",
"desc": "劣五类"
}],
};
},
mounted() {
that = this
this.newInitMap();
},
methods: {
selectMonth: function (e) {
that.where.month = e + 1
that.requestFun()
},
changeText: function (e) {
that.currentCate = that.waterCate[e]
that.requestFun()
},
changeCate: function (e) {
that.currentRequestCata = e.target.value
that.requestFun()
},
autoInput(e) {
that.dataSource.forEach((item, index) => {
if (item == e) {
if (that.searchId > 0) {
document.getElementById("id" + that.searchId).className = ""
}
that.searchId = index
// eslint-disable-next-line no-undef
that.map.centerAndZoom(new BMap.Point(that.pointData[that.searchId]['longitude'], that.pointData[that.searchId]['latitude']), that.zoom); // 初始化地图,设置中心点坐标和地图级别
document.getElementById("id" + that.searchId).className += "animation_check"
}
})
},
newInitMap() {
// eslint-disable-next-line no-undef
that.map = new BMap.Map(this.$refs.map); // 创建Map实例
// eslint-disable-next-line no-undef
that.map.centerAndZoom(new BMap.Point(that.arriveCoor[0], that.arriveCoor[1]), that.zoom); // 初始化地图,设置中心点坐标和地图级别
that.map.addControl(
// eslint-disable-next-line no-undef
new BMap.MapTypeControl({
// eslint-disable-next-line no-undef
mapTypes: [BMAP_NORMAL_MAP, BMAP_HYBRID_MAP],
})
)
that.map.enableDragging();
that.map.enableScrollWheelZoom();
that.map.enableDoubleClickZoom();
that.map.enableKeyboard();
getColumnOptions("year").then((res) => {
if (res.data.code == 0) {
this.yearOptions = res.data.data.map((item) => {
return {
label: item,
value: item,
};
});
this.where.year = res.data.data[0];
that.requestFun()
}
})
},
addMarker: function () { // 创建图标对象
//定义自定义覆盖物的构造函数
function ComplexCustomOverlay(point, index, color) {
this._point = point
this._index = index
this._color = color
}
// eslint-disable-next-line no-undef
ComplexCustomOverlay.prototype = new BMap.Overlay();
ComplexCustomOverlay.prototype.initialize = function (map) {
this._map = map;
var div = this._div = document.createElement("div");
div.style.position = "absolute";
div.style.float = "left"
div.style.cursor = "pointer"
// eslint-disable-next-line no-undef
div.style.zIndex = BMap.Overlay.getZIndex(this._point.lat);
div.style.height = "20px";
div.style.width = "10px";
var arrow = this._arrow = document.createElement("div");
arrow.style.width = "0px";
arrow.style.height = "0px";
arrow.style.borderLeftWidth = "10px"
arrow.style.borderLeftColor = "transparent"
arrow.style.borderStyle = "solid"
arrow.style.borderRightWidth = "10px"
arrow.style.borderRightColor = "transparent"
arrow.style.borderBottomWidth = "20px"
arrow.style.borderTopWidth = "0"
arrow.style.position = "absolute"
arrow.style.borderBottomColor = `${this._color}`
arrow.setAttribute("id", "id" + this._index)
arrow.style.top = "22px";
arrow.style.left = "10px";
div.appendChild(arrow);
that.map.getPanes().labelPane.appendChild(div);
return div;
}
ComplexCustomOverlay.prototype.draw = function () {
var map = this._map;
var pixel = map.pointToOverlayPixel(this._point);
this._div.style.left = pixel.x - parseInt(this._arrow.style.left) + "px";
this._div.style.top = pixel.y - 30 + "px";
}
ComplexCustomOverlay.prototype.addEventListener = function (event, fun) {
this._arrow['on' + event] = fun;
}
that.pointData.forEach(async (item, index) => {
let color = ""
that.nominalList.forEach((it, ins) => {
if (that.currentRequestCata == 0) {
if (item.waterQualityCategory == it.common) {
color = that.nominalList[ins]['color']
}
} else {
if (item.waterQualityCategory == it.desc) {
color = that.nominalList[ins]['color']
}
}
})
// eslint-disable-next-line no-undef
var myCompOverlay = new ComplexCustomOverlay(new BMap.Point(Number(item.longitude), Number(item.latitude)), index, color);
that.map.addOverlay(myCompOverlay);//将标注添加到地图中
myCompOverlay.addEventListener('mouseover', function (e) {
let currentId = e.target.getAttribute("id")
setTimeout(() => {
}, 300)
let bodyInfo = document.getElementsByTagName("body")[0]
let screenWidth = bodyInfo.offsetWidth
// let screenHeight = bodyInfo.offsetHeight
let mapInfo = document.getElementById("map")
let mapWidth = mapInfo.offsetWidth; // 返回元素的总宽度
// let mapHeight = mapInfo.offsetHeight; // 返回元素的总高度
let calcWidth = screenWidth - mapWidth
// let calcHeight = screenHeight - mapHeight
that.tipFlag = true
that.tipData = that.pointData[currentId.substring(2, currentId.length)]
that.currentX = e.pageX - calcWidth
that.currentY = e.pageY - 80
}, true)
myCompOverlay.addEventListener('mouseout', function () {
setTimeout(() => {
}, 300)
that.currentX = 30000
that.currentY = 0
that.tipFlag = false
}, true)
})
},
whereChange(e) {
that.where.year = e
that.requestFun()
},
requestFun: function () {
that.map.clearOverlays();
// eslint-disable-next-line no-undef
that.map.centerAndZoom(new BMap.Point(that.arriveCoor[0], that.arriveCoor[1]), 8); // 初始化地图,设置中心点坐标和地图级别
if (that.currentRequestCata == 0) { // 江河水质
that.columns = that.columns0
river(that.where).then((res) => {
that.pointData = []
that.dataSource = []
if (res.data.code == 0 && res.data.data.length > 0) {
that.pointData = res.data.data
that.pointData.forEach(item => {
that.dataSource.push(`${item.sectionName}`)
})
that.addMarker()
}
})
}
if (that.currentRequestCata == 1) {
if (that.currentCate == "国家水功能区") {
national(that.where).then((res) => {
that.pointData = []
that.dataSource = []
if (res.data.code == 0 && res.data.data.length > 0) {
that.pointData = res.data.data
that.pointData.forEach(item => {
that.dataSource.push(`${item.place}`)
})
that.addMarker()
}
})
}
if(that.currentRequestCata == 2) {
autonomous(that.where).then((res) => {
that.pointData = []
that.dataSource = []
if (res.data.code == 0 && res.data.data.length > 0) {
that.pointData = res.data.data
that.pointData.forEach(item => {
that.dataSource.push(`${item.riverName}`)
})
that.addMarker()
}
})
}
}
if (that.currentRequestCata == 2) {
that.columns = that.columns2
waterStation(that.where).then((res) => {
that.pointData = []
that.dataSource = []
if (res.data.code == 0 && res.data.data.length > 0) {
that.pointData = res.data.data
that.pointData.forEach(item => {
that.dataSource.push(`${item.place}`)
})
that.addMarker()
}
})
}
}
}
}
</script>
<style>
::-webkit-scrollbar {
display: none;
}
html,
body {
overflow: hidden;
margin: 0;
width: 100vw;
height: 100vh;
}
.ele-body {
position: relative;
padding: 16px 0;
height: 100%;
}
.ele-card {
z-index: 10;
margin: 0 16px;
display: inline-block;
}
#map {
position: absolute;
top: 0;
bottom: 0;
width: 100%;
}
.anchorBL {
display: none;
}
::v-deep .amap-logo {
right: 0 !important;
left: auto !important;
display: none !important;
}
::v-deep .amap-copyright {
right: 70px !important;
left: auto !important;
opacity: 0 !important;
}
::v-deep .amap-info-content {
background-color: rgba(0, 0, 0, .4);
border-radius: 5px;
color: #fff;
padding: 0;
}
::v-deep .bottom-center .amap-info-sharp {
border-top-color: rgba(0, 0, 0, .6);
}
::v-deep .amap-info-close {
display: none;
}
::v-deep #map-mark {
border-left: 10px solid transparent;
border-right: 10px solid transparent;
border-bottom: 20px solid rgba(0, 0, 255, 0.6);
}
.radar-box {
position: absolute;
.radar {
width: 40px;
height: 40px;
border-radius: 50%;
background-color: red;
position: relative;
}
.radar .ripple {
width: 40px;
height: 40px;
border-radius: 50%;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
border: 1px solid red;
animation: ripple 2s linear infinite;
}
.radar :nth-child(1) {
animation-delay: 0.666s;
}
.radar :nth-child(2) {
animation-delay: 1.322s;
}
@keyframes ripple {
to {
width: 150px;
height: 150px;
opacity: 0;
}
}
}
.animation_check {
animation: myfirst 1s infinite;
}
@keyframes myfirst {
0% {
top: 0px
}
25% {
top: 5px;
}
50% {
top: 0px;
}
75% {
top: -5px;
}
100% {
top: 0px;
}
}
</style>