<template>
|
<div class="main_body">
|
<el-container style="height: 100%">
|
<el-aside
|
width="300px"
|
style="background-color: rgb(238, 241, 246); overflow: hidden"
|
>
|
<div style="width: 274px; margin: 13px auto">
|
<el-date-picker
|
:picker-options="pickerOptions"
|
placeholder="选择日期"
|
popper-class="jlpMySelectPopper"
|
ref="datePick"
|
v-model="datenum"
|
@change="chooseDate"
|
@blur="chooseDate1"
|
@focus="chooseDate2"
|
value-format="yyyy-MM-dd"
|
style="width: 280px"
|
>
|
</el-date-picker>
|
</div>
|
<!-- <el-card class="box-card" style="width: 274px; margin: 13px auto"> -->
|
|
<!-- <div v-else style="height: 180px; width: 274px; overflow-x: hidden">
|
<div
|
style="
|
width: 272px;
|
text-align: center;
|
height: 180px;
|
line-height: 140px;
|
font-size: 14px;
|
color: #5a5c60;
|
"
|
>
|
无飞行记录
|
</div>
|
</div> -->
|
<!-- </el-card> -->
|
|
<div
|
style="width: 274px; margin: 10px auto; border-radius: 8px"
|
class="coll"
|
>
|
<!--accordion 手风琴模式-->
|
<el-collapse
|
accordion
|
style="box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1)"
|
v-show="shou1 === true"
|
v-loading="loading"
|
>
|
<el-collapse-item
|
style="text-indent: 2em; position: relative; padding-botton: 10px"
|
>
|
<template slot="title">
|
<img
|
style="position: absolute; left: 18px"
|
src="../../assets/images/uav/uav.png"
|
/>
|
<span
|
style="display: inline-block; position: absolute; left: 20px"
|
>
|
该日期暂无无人机数据</span
|
>
|
</template>
|
</el-collapse-item>
|
</el-collapse>
|
<el-collapse
|
v-model="asideData.activeNames"
|
accordion
|
style="box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1)"
|
@change="handleChange"
|
ref="collapse"
|
v-show="shou1 === false"
|
v-loading="loading"
|
>
|
<el-collapse-item
|
v-for="(item1, index) in asideData.uavTimeFly"
|
:key="index"
|
:name="index"
|
style="text-indent: 2em; position: relative; padding-botton: 10px"
|
>
|
<template slot="title">
|
<img
|
style="position: absolute; left: 18px"
|
src="../../assets/images/uav/uav.png"
|
/>
|
<span
|
style="display: inline-block; position: absolute; left: 20px"
|
>
|
{{ item1.name }}</span
|
>
|
</template>
|
<el-scrollbar style="height: 200px; overflow-x: hidden">
|
<div
|
v-for="(item, index) in item1.timeSlot"
|
:key="index"
|
class="per-date_area"
|
:class="{ activeArea: asideData.activeKey === index }"
|
@click="getFlyData(item, index, item1.mac)"
|
>
|
<div style="width: 100%; margin: 0 auto">
|
<span>{{
|
item.startTime.substr(11, item.startTime.length)
|
}}</span>
|
<span>~</span>
|
<span>{{
|
item.endTime.substr(11, item.startTime.length)
|
}}</span>
|
<span> ({{ item.total }}条) </span>
|
</div>
|
</div>
|
</el-scrollbar>
|
</el-collapse-item>
|
</el-collapse>
|
</div>
|
</el-aside>
|
<el-main>
|
<div
|
style="
|
position: fixed;
|
z-index: 20;
|
padding-left: 20px;
|
height: 100px;
|
width: 100%;
|
font-size: 18px;
|
background-color: rgba(192, 192, 192, 0.4);
|
"
|
class="dds"
|
>
|
<div class="numss">
|
<el-radio-group
|
v-model="radioSeven"
|
size="medium"
|
@change="changeCode"
|
v-if="selecttrue === 1"
|
style="margin-top: 10px; margin-left: 10px"
|
>
|
<el-radio-button label="PM2.5"></el-radio-button>
|
<el-radio-button label="PM10"></el-radio-button>
|
<el-radio-button label="SO2"></el-radio-button>
|
<el-radio-button label="NO2"></el-radio-button>
|
<el-radio-button label="CO"></el-radio-button>
|
<el-radio-button label="03"></el-radio-button>
|
<el-radio-button label="TVOC"></el-radio-button>
|
</el-radio-group>
|
<div class="Duo" v-if="selecttrue === 2">
|
<div class="spantuu">
|
<span>无人机飞行高度范围(米): </span>
|
<el-input
|
class="inputtu"
|
v-model="tallone"
|
ref="uvas"
|
></el-input>
|
--
|
<el-input
|
class="inputtu"
|
v-model="talltwo"
|
ref="uvas"
|
></el-input>
|
</div>
|
<!-- <el-select v-model="Duovalue" placeholder="其他因子" class="slee">
|
<el-option
|
v-for="item in optionsduo"
|
:key="item.code"
|
:label="item.name"
|
:value="item.name"
|
>
|
</el-option>
|
</el-select> -->
|
<div class="spantu">
|
<span>图形边长(米): </span
|
><el-input
|
class="inputtu"
|
v-model="uvasize"
|
clearable
|
placeholder="请输入内容"
|
ref="uvas"
|
></el-input>
|
</div>
|
<el-select v-model="Duovalue" placeholder="其他因子" class="slee">
|
<el-option
|
v-for="item in optionsduo"
|
:key="item.code"
|
:label="item.name"
|
:value="item.name"
|
>
|
</el-option>
|
</el-select>
|
<!-- <div class="spantuu">
|
<span>无人机飞行高度范围(米): </span>
|
<el-input
|
class="inputtu"
|
v-model="tallone"
|
ref="uvas"
|
></el-input>
|
--
|
<el-input
|
class="inputtu"
|
v-model="talltwo"
|
ref="uvas"
|
></el-input>
|
</div> -->
|
</div>
|
<div v-if="selecttrue === 1" style="margin-left: 10px">
|
<el-button type="primary" @click="gengD" style="margin-top: 10px"
|
>更多条件</el-button
|
>
|
</div>
|
<div
|
v-if="selecttrue === 2"
|
style="margin-left: 10px; margin-top: 10px"
|
>
|
<el-button class="gengD" @click="shou">收起</el-button>
|
<el-button type="primary" @click="selectDuo">查询</el-button>
|
</div>
|
</div>
|
<!-- <div class="Duo" v-if="selecttrue === 2">
|
<el-select v-model="Duovalue" placeholder="其他因子" class="slee">
|
<el-option
|
v-for="item in optionsduo"
|
:key="item.code"
|
:label="item.name"
|
:value="item.name"
|
>
|
</el-option>
|
</el-select>
|
<div class="spantu">
|
<span>图形边长(米): </span
|
><el-input
|
class="inputtu"
|
v-model="uvasize"
|
clearable
|
placeholder="请输入内容"
|
ref="uvas"
|
></el-input>
|
</div>
|
<div class="spantuu">
|
<span>无人机飞行高度范围(米): </span>
|
<el-input class="inputtu" v-model="tallone" ref="uvas"></el-input>
|
--
|
<el-input class="inputtu" v-model="talltwo" ref="uvas"></el-input>
|
</div>
|
</div> -->
|
</div>
|
<!-- <div v-if="noneData" class="noneData">当前时间没有飞行数据</div> -->
|
<div id="map_container" v-loading="loading1" />
|
</el-main>
|
</el-container>
|
</div>
|
</template>
|
|
<script>
|
import json from '@/assets/json/sensor.json'
|
import $ from 'jquery'
|
import '@/assets/icon/iconfont.css'
|
import moment from 'moment'
|
|
var GPS = {
|
PI: 3.14159265358979324,
|
x_pi: (3.14159265358979324 * 3000.0) / 180.0,
|
delta: function (lat, lon) {
|
var a = 6378245.0 // a: 卫星椭球坐标投影到平面地图坐标系的投影因子。
|
var ee = 0.00669342162296594323 // ee: 椭球的偏心率。
|
var dLat = this.transformLat(lon - 105.0, lat - 35.0)
|
var dLon = this.transformLon(lon - 105.0, lat - 35.0)
|
var radLat = (lat / 180.0) * this.PI
|
var magic = Math.sin(radLat)
|
magic = 1 - ee * magic * magic
|
var sqrtMagic = Math.sqrt(magic)
|
dLat = (dLat * 180.0) / (((a * (1 - ee)) / (magic * sqrtMagic)) * this.PI)
|
dLon = (dLon * 180.0) / ((a / sqrtMagic) * Math.cos(radLat) * this.PI)
|
return { lat: dLat, lon: dLon }
|
},
|
|
// WGS-84 to GCJ-02
|
gcj_encrypt: function (wgsLat, wgsLon) {
|
if (this.outOfChina(wgsLat, wgsLon)) {
|
return { lat: wgsLat, lon: wgsLon }
|
}
|
|
var d = this.delta(wgsLat, wgsLon)
|
return { lat: wgsLat + d.lat, lon: wgsLon + d.lon }
|
},
|
// GCJ-02 to WGS-84
|
gcj_decrypt: function (gcjLat, gcjLon) {
|
if (this.outOfChina(gcjLat, gcjLon)) {
|
return { lat: gcjLat, lon: gcjLon }
|
}
|
|
var d = this.delta(gcjLat, gcjLon)
|
return { lat: gcjLat - d.lat, lon: gcjLon - d.lon }
|
},
|
// GCJ-02 to WGS-84 exactly
|
gcj_decrypt_exact: function (gcjLat, gcjLon) {
|
var initDelta = 0.01
|
var threshold = 0.000000001
|
var dLat = initDelta
|
var dLon = initDelta
|
var mLat = gcjLat - dLat
|
var mLon = gcjLon - dLon
|
var pLat = gcjLat + dLat
|
var pLon = gcjLon + dLon
|
var wgsLat
|
var wgsLon
|
var i = 0
|
while (1) {
|
wgsLat = (mLat + pLat) / 2
|
wgsLon = (mLon + pLon) / 2
|
var tmp = this.gcj_encrypt(wgsLat, wgsLon)
|
dLat = tmp.lat - gcjLat
|
dLon = tmp.lon - gcjLon
|
if (Math.abs(dLat) < threshold && Math.abs(dLon) < threshold) {
|
break
|
}
|
|
if (dLat > 0) pLat = wgsLat
|
else mLat = wgsLat
|
if (dLon > 0) pLon = wgsLon
|
else mLon = wgsLon
|
|
if (++i > 10000) break
|
}
|
return { lat: wgsLat, lon: wgsLon }
|
},
|
// GCJ-02 to BD-09
|
bd_encrypt: function (gcjLat, gcjLon) {
|
var x = gcjLon
|
var y = gcjLat
|
var z = Math.sqrt(x * x + y * y) + 0.00002 * Math.sin(y * this.x_pi)
|
var theta = Math.atan2(y, x) + 0.000003 * Math.cos(x * this.x_pi)
|
this.bdLon = z * Math.cos(theta) + 0.0065
|
this.bdLat = z * Math.sin(theta) + 0.006
|
return { lat: this.bdLat, lon: this.bdLon }
|
},
|
// BD-09 to GCJ-02
|
bd_decrypt: function (bdLat, bdLon) {
|
var x = bdLon - 0.0065
|
var y = bdLat - 0.006
|
var z = Math.sqrt(x * x + y * y) - 0.00002 * Math.sin(y * this.x_pi)
|
var theta = Math.atan2(y, x) - 0.000003 * Math.cos(x * this.x_pi)
|
var gcjLon = z * Math.cos(theta)
|
var gcjLat = z * Math.sin(theta)
|
return { lat: gcjLat, lon: gcjLon }
|
},
|
// WGS-84 to Web mercator
|
// mercatorLat -> y mercatorLon -> x
|
mercator_encrypt: function (wgsLat, wgsLon) {
|
var x = (wgsLon * 20037508.34) / 180.0
|
var y =
|
Math.log(Math.tan(((90.0 + wgsLat) * this.PI) / 360.0)) /
|
(this.PI / 180.0)
|
y = (y * 20037508.34) / 180.0
|
return { lat: y, lon: x }
|
},
|
// Web mercator to WGS-84
|
// mercatorLat -> y mercatorLon -> x
|
mercator_decrypt: function (mercatorLat, mercatorLon) {
|
var x = (mercatorLon / 20037508.34) * 180.0
|
var y = (mercatorLat / 20037508.34) * 180.0
|
y =
|
(180 / this.PI) *
|
(2 * Math.atan(Math.exp((y * this.PI) / 180.0)) - this.PI / 2)
|
return { lat: y, lon: x }
|
},
|
// two point's distance
|
distance: function (latA, lonA, latB, lonB) {
|
var earthR = 6371000.0
|
var x =
|
Math.cos((latA * this.PI) / 180.0) *
|
Math.cos((latB * this.PI) / 180.0) *
|
Math.cos(((lonA - lonB) * this.PI) / 180)
|
var y =
|
Math.sin((latA * this.PI) / 180.0) * Math.sin((latB * this.PI) / 180.0)
|
var s = x + y
|
if (s > 1) s = 1
|
if (s < -1) s = -1
|
var alpha = Math.acos(s)
|
var distance = alpha * earthR
|
return distance
|
},
|
outOfChina: function (lat, lon) {
|
if (lon < 72.004 || lon > 137.8347) {
|
return true
|
}
|
if (lat < 0.8293 || lat > 55.8271) {
|
return true
|
}
|
return false
|
},
|
transformLat: function (x, y) {
|
var ret =
|
-100.0 +
|
2.0 * x +
|
3.0 * y +
|
0.2 * y * y +
|
0.1 * x * y +
|
0.2 * Math.sqrt(Math.abs(x))
|
ret +=
|
((20.0 * Math.sin(6.0 * x * this.PI) +
|
20.0 * Math.sin(2.0 * x * this.PI)) *
|
2.0) /
|
3.0
|
ret +=
|
((20.0 * Math.sin(y * this.PI) + 40.0 * Math.sin((y / 3.0) * this.PI)) *
|
2.0) /
|
3.0
|
ret +=
|
((160.0 * Math.sin((y / 12.0) * this.PI) +
|
320 * Math.sin((y * this.PI) / 30.0)) *
|
2.0) /
|
3.0
|
return ret
|
},
|
transformLon: function (x, y) {
|
var ret =
|
300.0 +
|
x +
|
2.0 * y +
|
0.1 * x * x +
|
0.1 * x * y +
|
0.1 * Math.sqrt(Math.abs(x))
|
ret +=
|
((20.0 * Math.sin(6.0 * x * this.PI) +
|
20.0 * Math.sin(2.0 * x * this.PI)) *
|
2.0) /
|
3.0
|
ret +=
|
((20.0 * Math.sin(x * this.PI) + 40.0 * Math.sin((x / 3.0) * this.PI)) *
|
2.0) /
|
3.0
|
ret +=
|
((150.0 * Math.sin((x / 12.0) * this.PI) +
|
300.0 * Math.sin((x / 30.0) * this.PI)) *
|
2.0) /
|
3.0
|
return ret
|
},
|
}
|
export default {
|
filters: {
|
sensorFilter: function (value) {
|
if (!value) return ''
|
return json[value]
|
},
|
},
|
data() {
|
return {
|
chosee: 1,
|
shou1: true,
|
zhanK1: 1,
|
zhanK: 1,
|
Duovalue: '',
|
datenum: new Date(),
|
// orderTime:[Date('2020-06-19'),Date('2021-06-19')]
|
selecttrue: 1,
|
pickerOptions: {
|
cellClassName: (time) => {
|
let timeDate = moment(time.getTime()).format('yyyy-MM-DD')
|
if (this.timeNums.includes(timeDate)) {
|
return 'dateArrClass' // 返回值设置的是我们添加的类名
|
}
|
},
|
},
|
|
tallone: 0,
|
talltwo: 120,
|
// 侧边栏数据
|
asideData: {
|
dates: [], // 存放date数组
|
activeNames: [0],
|
uavTimeFly: [], // 存放无人机信息以及飞行时间区间
|
activeKey: -1,
|
activeAreaKey: 0,
|
},
|
load: 1,
|
value: [],
|
map: null,
|
radio: [
|
{ code: 'a34004', name: 'PM2.5' },
|
{ code: 'a34002', name: 'PM10' },
|
{ code: 'a21026', name: 'SO2' },
|
{ code: 'a21004', name: 'NO2' },
|
{ code: 'a21005', name: 'CO' },
|
{ code: 'a05024', name: 'O3' },
|
{ code: 'a99054', name: 'TVOC' },
|
],
|
valuetime: '2023-01-01',
|
defautRadio: { code: 'a34004', name: 'PM2.5' },
|
Layler: null, // 存放图层
|
textMarkers: { code: '', markers: [] }, // 存放文本标注
|
levelSensor: [35, 75, 115, 150, 250],
|
perPointData: null, // 存放每个点的数据
|
keys: [], // 存放每个点的key值因子code
|
textShowFlag: false,
|
isDisplay: '',
|
carMacItem: null,
|
radioSeven: 'PM2.5',
|
bdLon: null,
|
bdLat: null,
|
loading: false,
|
loading1: false,
|
snesorParams: [
|
'PM2.5',
|
'PM10',
|
'SO2',
|
'NO2',
|
'CO',
|
'O3',
|
'TVOC',
|
'尘负荷',
|
],
|
changeColor: 0,
|
changeColor1: 0,
|
sensorKey: 'a34004',
|
viewKey: '2D',
|
dataType: 'history',
|
responseJSON: null,
|
radio1: null,
|
viewOptions: ['平铺', '立体'],
|
dateValue: [],
|
timeOne: '',
|
threeOptions: {
|
onPick: ({ maxDate, minDate }) => {
|
// 最大时间 最小时间
|
this.timeOne = minDate.getTime() // 当选一个日期时 就是最小日期
|
// 如何你选择了两个日期了,就把那个变量置空
|
if (maxDate) this.timeOne = ''
|
},
|
disabledDate: (time) => {
|
if (this.timeOne) {
|
const WEEK = 3 * 24 * 3600 * 1000 - 1 // 这里乘以3再减去1相当于 限制3天以内
|
const minTime = this.timeOne // 三天之前
|
const maxTime = this.timeOne + WEEK // 三天之后
|
return (
|
time.getTime() < minTime ||
|
time.getTime() > maxTime ||
|
time.getTime() > new Date()
|
)
|
} else {
|
return time.getTime() > new Date()
|
}
|
},
|
},
|
sensorDate: null,
|
noneData: true,
|
defaultData: [],
|
carMac: null,
|
dialogFormVisible: false,
|
optionsduo: [
|
{ code: 'a34004', name: 'PM2.5' },
|
{ code: 'a34002', name: 'PM10' },
|
{ code: 'a21026', name: 'SO2' },
|
{ code: 'a21004', name: 'NO2' },
|
{ code: 'a21005', name: 'CO' },
|
{ code: 'a05024', name: 'O3' },
|
{ code: 'a99054', name: 'TVOC' },
|
{
|
code: 'a01006',
|
name: '气压',
|
},
|
{
|
code: 'a01001',
|
name: '温度',
|
},
|
{
|
code: 'a01002',
|
name: '湿度',
|
},
|
],
|
sensorTableData: [
|
{
|
sensorName: 'PM2.5',
|
unit: 'ug/m³',
|
tab1: '35',
|
tab2: '75',
|
tab3: '115',
|
tab4: '150',
|
tab5: '250',
|
tab6: '350',
|
},
|
{
|
sensorName: 'PM10',
|
unit: 'ug/m³',
|
tab1: '50',
|
tab2: '150',
|
tab3: '250',
|
tab4: '350',
|
tab5: '420',
|
tab6: '500',
|
},
|
{
|
sensorName: 'SO2',
|
unit: 'ug/m³',
|
tab1: '50',
|
tab2: '150',
|
tab3: '475',
|
tab4: '800',
|
tab5: '1600',
|
tab6: '2100',
|
},
|
{
|
sensorName: 'NO2',
|
unit: 'ug/m³',
|
tab1: '40',
|
tab2: '80',
|
tab3: '180',
|
tab4: '280',
|
tab5: '565',
|
tab6: '750',
|
},
|
{
|
sensorName: 'CO',
|
unit: 'mg/m³',
|
tab1: '2',
|
tab2: '4',
|
tab3: '14',
|
tab4: '24',
|
tab5: '36',
|
tab6: '48',
|
},
|
{
|
sensorName: 'O3',
|
unit: 'ug/m³',
|
tab1: '160',
|
tab2: '200',
|
tab3: '300',
|
tab4: '400',
|
tab5: '800',
|
tab6: '1000',
|
},
|
{
|
sensorName: 'TVOC',
|
unit: 'mg/m³',
|
tab1: '0.1',
|
tab2: '0.3',
|
tab3: '0.5',
|
tab4: '0.7',
|
tab5: '0.9',
|
tab6: '1',
|
},
|
{
|
sensorName: '尘负荷',
|
unit: 'ug/m³',
|
tab1: '300',
|
tab2: '500',
|
tab3: '1000',
|
tab4: '10000',
|
tab5: '20000',
|
tab6: '50000',
|
},
|
|
{
|
sensorName: '气压',
|
unit: 'hpa',
|
},
|
{
|
sensorName: '湿度',
|
unit: '%',
|
},
|
{
|
sensorName: '温度',
|
unit: '℃',
|
},
|
],
|
carWs: null,
|
map: null,
|
sensor: null,
|
viewType: null,
|
size: null,
|
distance: null,
|
showPoints: null,
|
viewport: null,
|
mapZoom: null,
|
centerPoint: null,
|
view: null,
|
abc: 0,
|
firstPlayFlag: true,
|
firstWsFlag: true,
|
msgTemp: [],
|
dataTypeList: [
|
{
|
value: 'history',
|
label: '历史数据',
|
},
|
{
|
value: 'webSocket',
|
label: '实时数据',
|
},
|
],
|
dataTypeValue: 'history',
|
historyView: true,
|
webSocketView: false,
|
isDataList: [],
|
shapeLayer: null,
|
carData: [],
|
timeDuan: 0,
|
isDisTime: false,
|
startTime: '',
|
endTime: '',
|
dataDate: '',
|
sensorTime: [],
|
uvasize: 50,
|
timeValue: [
|
new Date(2020, 1, 1, 0, 0, 0),
|
new Date(2022, 12, 31, 23, 59, 59),
|
],
|
timeNums: [],
|
batchs: '',
|
macs: '',
|
}
|
},
|
|
mounted() {
|
this.initStart()
|
// this.$refs.datePick.focus()
|
// this.getDate()
|
// this.flyData()
|
},
|
watch: {
|
dataTypeValue(n, o) {
|
if (this.dataTypeValue === 'webSocket') {
|
this.dateValue = []
|
this.historyView = false
|
this.webSocketView = true
|
} else {
|
this.dateValue = []
|
this.historyView = true
|
this.webSocketView = false
|
}
|
},
|
dateValue(n, o) {
|
if (n === null) {
|
this.dateValue = []
|
}
|
},
|
viewKey(n, o) {
|
// console.log(n)
|
},
|
deep: true,
|
immediate: true,
|
},
|
created() {
|
this.newTime(this.timeValue)
|
this.newDate()
|
this.getDate()
|
|
// this.getFlyData()
|
},
|
methods: {
|
selectDuo() {
|
// console.log(2115);
|
if (this.chosee === 1) {
|
this.$message.warning('请先在左侧选择无人机时间')
|
return
|
} else {
|
// console.log('132123');
|
this.loading1 = true
|
}
|
if (this.view) {
|
this.view.removeAllLayers()
|
this.map.clearOverlays()
|
}
|
this.$request({
|
// url: '/uav/queryDataByBatch',
|
url: '/uav/test',
|
method: 'post',
|
data: {
|
batch: this.batchs,
|
uvasize: this.uvasize,
|
mac: this.macs,
|
height1: this.tallone,
|
height2: this.talltwo,
|
// batch: '2023-06-16 16:21:21',
|
},
|
}).then((res) => {
|
// console.log(res)
|
this.carData = []
|
if (res.data === 'null') {
|
this.noneData = true
|
return
|
}
|
for (var i = 0; i < res.data.length; i++) {
|
res.data[i].flyLat = res.data[i].flyLat + ' °'.toString()
|
res.data[i].flyLon = res.data[i].flyLon + ' °'.toString()
|
// res.data[i].a34004 = Math.floor(Math.random() * 100 + 1)
|
this.carData.push(res.data[i])
|
}
|
if (this.Duovalue != '') {
|
this.radioSeven = ''
|
}
|
this.changeCode(this.Duovalue)
|
this.initStart(this.carData)
|
})
|
},
|
chooseDate() {
|
// this.$refs.datePick.focus() // 选择日期后依旧触发焦点
|
this.getTimeAreaData(this.datenum)
|
$('.coll').css('margin-top', '350px')
|
},
|
chooseDate2() {
|
// this.$refs.datePick.focus() // 选择日期后依旧触发焦点
|
// this.getTimeAreaData(this.datenum)
|
$('.coll').css('margin-top', '350px')
|
},
|
chooseDate1() {
|
$('.coll').css('margin-top', '10px')
|
// this.$refs.datePick.focus() // 选择日期后依旧触发焦点
|
},
|
gengD() {
|
// if (this.zhanK === 1) {
|
// this.$message.warning('请先在左侧选择无人机和时间')
|
// return
|
// }
|
this.selecttrue = 2
|
$('.numss').css({ width: '930px' })
|
},
|
shou() {
|
this.selecttrue = 1
|
$('.numss').css({ width: '690px' })
|
},
|
parseTime(time, cFormat) {
|
if (arguments.length === 0 || !time) {
|
return null
|
}
|
const format = cFormat || '{y}-{m}-{d} {h}:{i}:{s}'
|
let date
|
if (typeof time === 'object') {
|
date = time
|
} else {
|
if (typeof time === 'string') {
|
if (/^[0-9]+$/.test(time)) {
|
time = parseInt(time)
|
} else {
|
time = time.replace(new RegExp(/-/gm), '/')
|
}
|
}
|
|
if (typeof time === 'number' && time.toString().length === 10) {
|
time = time * 1000
|
}
|
date = new Date(time)
|
}
|
const formatObj = {
|
y: date.getFullYear(),
|
m: date.getMonth() + 1,
|
d: date.getDate(),
|
h: date.getHours(),
|
i: date.getMinutes(),
|
s: date.getSeconds(),
|
a: date.getDay(),
|
}
|
const time_str = format.replace(/{([ymdhisa])+}/g, (result, key) => {
|
const value = formatObj[key]
|
if (key === 'a') {
|
return ['日', '一', '二', '三', '四', '五', '六'][value]
|
}
|
return value.toString().padStart(2, '0')
|
})
|
return time_str
|
},
|
newTime2(timeArr) {
|
var arr = []
|
timeArr.map((v) => {
|
var date = new Date(v)
|
var y = date.getFullYear()
|
var m = date.getMonth() + 1
|
m = m < 10 ? '0' + m : m
|
var d = date.getDate()
|
d = d < 10 ? '0' + d : d
|
var h = date.getHours()
|
h = h < 10 ? '0' + h : h
|
var minute = date.getMinutes()
|
minute = minute < 10 ? '0' + minute : minute
|
var s = date.getSeconds()
|
s = s < 10 ? '0' + s : s
|
arr.push(y + '-' + m + '-' + d + ' ' + h + ':' + minute + ':' + s)
|
})
|
return arr
|
},
|
// 点击列表切换走航车数据
|
changeCarData(e) {
|
this.carMac = e
|
this.getStart()
|
},
|
// 请求走航车列表数据
|
// 进行经纬度转换为距离的计算
|
Rad(d) {
|
return (d * Math.PI) / 180.0 // 经纬度转换成三角函数中度分表形式。
|
},
|
// 计算距离,参数分别为第一点的纬度,经度;第二点的纬度,经度
|
GetDistance(lat1, lng1, lat2, lng2) {
|
var radLat1 = this.Rad(lat1)
|
var radLat2 = this.Rad(lat2)
|
var a = radLat1 - radLat2
|
var b = this.Rad(lng1) - this.Rad(lng2)
|
var s =
|
2 *
|
Math.asin(
|
Math.sqrt(
|
Math.pow(Math.sin(a / 2), 2) +
|
Math.cos(radLat1) *
|
Math.cos(radLat2) *
|
Math.pow(Math.sin(b / 2), 2)
|
)
|
)
|
s = s * 6378.137 // EARTH_RADIUS;
|
s = Math.round(s * 10000) / 10000 // 输出为公里
|
// s=s.toFixed(4);
|
return s
|
},
|
// 日期格式化
|
newDate() {
|
var aData = new Date()
|
var month =
|
aData.getMonth() < 9
|
? '0' + (aData.getMonth() + 1)
|
: aData.getMonth() + 1
|
var date = aData.getDate() <= 9 ? '0' + aData.getDate() : aData.getDate()
|
this.sensorDate = aData.getFullYear() + '-' + month + '-' + date
|
},
|
// 时间格式化
|
newTime(timeArr) {
|
let str = ''
|
let str2 = ''
|
this.sensorTime = []
|
timeArr.map((v) => {
|
v = JSON.stringify(v)
|
str2 = v.substr(12, 8).split(':')
|
str2[0] =
|
(str2[0] - 0 + 8) % 24 < 9
|
? '0' + ((str2[0] - 0 + 8) % 24)
|
: (str2[0] - 0 + 8) % 24
|
str = str2.join(':')
|
this.sensorTime.push(str)
|
})
|
},
|
// 修改时间
|
dateChange(e) {
|
if (e === null) {
|
this.sensorDate = []
|
} else {
|
this.sensorDate = this.newTime2(e)
|
if (this.view) {
|
this.view.removeAllLayers()
|
this.map.clearOverlays()
|
// console.log('清除图层')
|
}
|
this.dataType = 'history'
|
// this.map = null
|
this.getStart()
|
}
|
},
|
// 获取无人机以及时间区间
|
getTimeAreaData(item) {
|
// this.asideData.uavTimeFly = []
|
this.loading = true
|
this.$request({
|
url: 'uav/queryTimeSlot',
|
method: 'get',
|
params: {
|
organizationId: this.$store.state.orgId,
|
date: item,
|
},
|
}).then((res) => {
|
// console.log(res, 'res.data.vos')
|
if (res.code === -47) {
|
this.noneData = true
|
// this.asideData.uavTimeFly=res.message
|
this.shou1 = true
|
} else {
|
this.shou1 = false
|
this.asideData.uavTimeFly = res.data.vos
|
}
|
this.loading = false
|
// if (res.code === 0) {
|
// this.asideData.uavTimeFly = res.data.vos
|
// }
|
})
|
},
|
// 折叠面板监听
|
handleChange(val) {
|
// console.log(val, 222)
|
},
|
// 经纬度转换为三维坐标系下的 XY 坐标 map.lngLatToGeodeticCoord
|
// 选中radio
|
selectRedio(item) {
|
this.map.remove(this.textMarkers.markers)
|
this.textMarkers.markers = []
|
this.map.remove(this.Layler)
|
this.addLayers(item)
|
},
|
// 初始化地图
|
getFlyData(item, index, mac) {
|
// for (var i = 0; i < this.xie.date.length; i++) {
|
// this.xie.date[i].flyLat = this.xie.date[i].flyLat + ' °'.toString()
|
// this.xie.date[i].flyLon = this.xie.date[i].flyLon + ' °'.toString()
|
// this.xie.date[i].a34004 = this.xie.date[i].a34004
|
// this.carData.push(this.xie.date[i])
|
// }
|
// this.initStart(this.carData)
|
this.loading1 = true
|
this.asideData.activeKey = index
|
this.chosee = 2
|
this.batchs = item.batch
|
this.macs = mac
|
this.noneData = false
|
if (this.view) {
|
this.view.removeAllLayers()
|
this.map.clearOverlays()
|
}
|
this.$request({
|
// url: '/uav/queryDataByBatch',
|
url: '/uav/test',
|
method: 'post',
|
data: {
|
batch: item.batch,
|
uvasize: this.uvasize,
|
height1: this.tallone,
|
height2: this.talltwo,
|
mac: mac,
|
// batch: '2023-06-16 16:21:21',
|
},
|
}).then((res) => {
|
// console.log(res)
|
this.carData = []
|
if (res.data === 'null') {
|
this.noneData = true
|
return
|
}
|
for (var i = 0; i < res.data.length; i++) {
|
res.data[i].flyLat = res.data[i].flyLat + ' °'.toString()
|
res.data[i].flyLon = res.data[i].flyLon + ' °'.toString()
|
// res.data[i].a34004 = Math.floor(Math.random() * 100 + 1)
|
this.carData.push(res.data[i])
|
}
|
this.initStart(this.carData)
|
this.zhanK = 2
|
})
|
},
|
// 获取组织下存在飞行记录的日期
|
getDate() {
|
this.$request({
|
url: '/uav/queryDate',
|
method: 'get',
|
params: {
|
organizationId: this.$store.state.orgId,
|
},
|
}).then((res) => {
|
this.asideData.dates = JSON.parse(JSON.stringify(res.data.datesStr))
|
this.timeNums = this.asideData.dates
|
if (this.asideData.dates.length > 0) {
|
this.getTimeAreaData(this.datenum, 0)
|
// this.datenum = this.asideData.dates[0]
|
// setTimeout(() => {
|
// if (this.asideData.uavTimeFly[0].timeSlot) {
|
// console.log(
|
// this.asideData.uavTimeFly[0].timeSlot,
|
// 'this.asideData.uavTimeFly[0].timeSlot'
|
// )
|
// // console.log(
|
// // this.asideData.uavTimeFly[0].timeSlot,
|
// // 'this.asideData.uavTimeFly[0].timeSlot[0]'
|
// // )
|
// this.getFlyData(this.asideData.uavTimeFly[0].timeSlot[0], 0, mac)
|
// }
|
// }, 500)
|
}
|
})
|
},
|
initStart(res) {
|
this.abc += 1
|
const that = this
|
if (!res) {
|
that.map = new BMapGL.Map('map_container')
|
that.map.enableScrollWheelZoom(true) // 开启鼠标滚轮,地图可以进行放大、缩小s
|
that.map.setMapType(BMAP_EARTH_MAP) // 设置地图类型为地球模式
|
that.map.setDisplayOptions({
|
street: false, // 是否显示路网(只对卫星图和地球模式有效)
|
})
|
that.map.setHeading(0) // 设置旋转角度
|
if (that.viewKey === '2D') {
|
that.map.setTilt(0) // 地图倾斜
|
} else {
|
that.map.setTilt(52)
|
}
|
that.map.setMapStyleV2({
|
styleJson: [
|
{
|
featureType: 'road',
|
elementType: 'all',
|
stylers: {
|
color: '#ffffff',
|
visibility: 'off',
|
},
|
},
|
{
|
featureType: 'building',
|
elementType: 'all',
|
stylers: {
|
visibility: 'off',
|
},
|
},
|
{
|
featureType: 'poilabel',
|
elementType: 'all',
|
stylers: {
|
visibility: 'off',
|
},
|
},
|
{
|
featureType: 'manmade',
|
elementType: 'all',
|
stylers: {
|
visibility: 'off',
|
},
|
},
|
],
|
})
|
showNoPoints()
|
this.loading1 = false
|
return
|
}
|
if (this.dataType === 'history') {
|
this.responseJSON = res
|
} else {
|
this.responseJSON = res
|
}
|
// var sensorInfo = this.responseJSON
|
// console.log('这是snesor获取得值')
|
// console.log(this.responseJSON)
|
var trackPoints = []
|
if (this.responseJSON.length > 0) {
|
this.noneData = false
|
$.each(this.responseJSON, (item, value) => {
|
if (typeof value.flyLon === 'undefined') {
|
showNoPoints()
|
} else {
|
var lng = parseFloat(
|
value.flyLon.substr(0, value.flyLon.length - 1)
|
)
|
var lat = parseFloat(
|
value.flyLat.substr(0, value.flyLat.length - 1)
|
)
|
if (lng < 70 || lng > 150 || lat > 60 || lat < 20) {
|
return true
|
}
|
// lng = GPS.gcj_encrypt(lat, lng).lon
|
// lat = GPS.gcj_encrypt(lat, lng).lat
|
// lng = GPS.bd_encrypt(lat, lng).lon
|
// lat = GPS.bd_encrypt(lat, lng).lat
|
// lng = GPS.bd_decrypt(lat, lng).lon
|
// lat = GPS.bd_decrypt(lat, lng).lat
|
var point = new BMapGL.Point(lng, lat)
|
point.a34004 = parseInt(value.a34004)
|
point.a34002 = parseInt(value.a34002)
|
point.a21026 = parseInt(value.a21026)
|
point.a21004 = parseInt(value.a21004)
|
point.a01006 = parseInt(value.a01006)
|
point.a01001 = parseInt(value.a01001)
|
point.a01002 = parseInt(value.a01002)
|
point.a21005 = parseFloat(value.a21005).toFixed(3)
|
point.a05024 = parseInt(value.a05024)
|
point.a99054 = parseFloat(value.a99054).toFixed(3)
|
point.dustld = value.dustld - 0
|
trackPoints.push(point)
|
}
|
})
|
that.sensor = this.sensorKey
|
that.viewType = this.viewKey
|
that.size = this.uvasize
|
that.distance = that.size / 2 / Math.sin((1 * Math.PI) / 4)
|
// 已有地图,避免再次请求
|
// if (!that.showPoints) {
|
// console.log(111)
|
// that.map = new BMapGL.Map('map_container')
|
// }
|
// that.map.enableScrollWheelZoom(true) // 开启鼠标滚轮,地图可以进行放大、缩小s
|
// that.map.setMapType(BMAP_EARTH_MAP) // 设置地图类型为地球模式
|
// that.map.setDisplayOptions({
|
// street: false, // 是否显示路网(只对卫星图和地球模式有效)
|
// })
|
// that.map.setHeading(20) // 设置旋转角度
|
// if (that.viewKey === '2D') {
|
// that.map.setTilt(0) // 地图倾斜
|
// } else {
|
// that.map.setTilt(52)
|
// }
|
// 使用百度地图v3.0接口,在设置地图
|
|
// that.map.setDisplayOptions({
|
// // 设置天空颜色
|
// // skyColors: ['rgba(186, 0, 255, 0)', 'rgba(186, 0, 255, 0.2)'], // 天空颜色
|
// building: true, // 不显示建筑物
|
// poiText: false, // 显示poi文字
|
// })
|
// that.map.addControl(new BMapGL.NavigationControl3D()) // 添加3d控件
|
if (this.responseJSON.length === 0) {
|
showNoPoints()
|
}
|
that.showPoints = getShowPoints(that.size)
|
that.viewport = that.map.getViewport(eval(that.showPoints))
|
// console.log(eval(that.showPoints), 'eval(that.showPoints)') // 此方法仅返回视野信息(中心点坐标,缩放),不会将新的中心点和级别做用到当前地图上
|
that.mapZoom = that.viewport.zoom
|
// console.log(that.mapZoom, 'that.mapZoom')
|
that.centerPoint = that.viewport.center
|
if (that.firstPlayFlag) {
|
that.map.centerAndZoom(that.centerPoint, that.mapZoom)
|
that.view = new mapvgl.View({
|
map: that.map,
|
})
|
that.firstPlayFlag = false
|
that.loading1 = false
|
} else {
|
this.view.removeAllLayers()
|
this.map.clearOverlays()
|
that.map.centerAndZoom(that.centerPoint, that.mapZoom)
|
that.view = new mapvgl.View({
|
map: that.map,
|
})
|
that.loading1 = false
|
|
// that.map.centerAndZoom(that.centerPoint, 18)
|
}
|
}
|
drawPolygon(that.sensor) // 绘制多边形。
|
// draw(that.sensor, that.viewType, that.carMac)
|
// drawLine()// 轨迹(绘制带折线箭头)
|
// drawStartAndEnd() // 起点和终点标注
|
function draw(sensor, type, carMac) {
|
var levels = getGrading(sensor, type, carMac)
|
$.each(levels, function (index, value) {
|
var color = value.color
|
var data = value.data
|
if (data.length > 0) {
|
// 创建MapVGL图层管理器,需要使用插件mapvgl
|
that.shapeLayer = new mapvgl.ShapeLayer({
|
color: color, // 柱状图颜色
|
enablePicked: true, // 是否可以拾取
|
selectedIndex: -1, // 选中项
|
selectedColor: '#ee1111', // 选中项颜色
|
autoSelect: true, // 根据鼠标位置来自动设置选中项
|
riseTime: 1800, // 楼块初始化升起时间
|
})
|
that.shapeLayer.setData(data)
|
that.view.addLayer(that.shapeLayer)
|
}
|
})
|
that.map.setDefaultCursor('default')
|
if (type === '2D') {
|
$.each(that.showPoints, function (item, point) {
|
setLabelStyle(point[sensor], point)
|
})
|
}
|
}
|
|
// 画方块,上色,添加文字
|
function drawPolygon(sensor) {
|
$.each(that.showPoints, function (item, point) {
|
var sw = getPoint(225, point.lng, point.lat, that.distance)
|
var ne = getPoint(45, point.lng, point.lat, that.distance)
|
var data = point[sensor]
|
// 根据因子浓度变换方块颜色
|
var color = getColorAndLevel(sensor, data).color
|
var polygon = new BMapGL.Polygon(
|
[
|
new BMapGL.Point(sw.lng, sw.lat), // 左下角
|
new BMapGL.Point(ne.lng, sw.lat), // 左上角
|
new BMapGL.Point(ne.lng, ne.lat), // 右上角
|
new BMapGL.Point(sw.lng, ne.lat), // 右下角
|
],
|
{
|
strokeWeight: 0.1, //边框线的宽度,以像素为单位
|
// strokeOpacity: 0.0, //边线的透明度
|
fillColor: color, //是否需要填充色
|
fillOpacity: 0.8, //填充色的透明度,0~1之间
|
strokeColor: 'black', //边框线的颜色
|
strokeStyle: 'solid', //边线的样式,solid或dashed。
|
}
|
)
|
that.map.addOverlay(polygon)
|
// 方块内添加label文本
|
setLabelStyle(data, point)
|
})
|
}
|
|
// 起点和终点标注
|
function drawStartAndEnd() {
|
var startIcon = new BMapGL.Icon(
|
require('@/assets/images/start.png'),
|
new BMapGL.Size(48, 48)
|
)
|
var startMark = new BMapGL.Marker(that.showPoints[0], {
|
icon: startIcon,
|
offset: new BMapGL.Size(0, -20),
|
})
|
that.map.addOverlay(startMark)
|
var endIcon = new BMapGL.Icon(
|
require('@/assets/images/end.png'),
|
new BMapGL.Size(48, 48)
|
)
|
var endMark = new BMapGL.Marker(
|
that.showPoints[that.showPoints.length - 1],
|
{
|
icon: endIcon,
|
offset: new BMapGL.Size(0, -20),
|
}
|
)
|
that.map.addOverlay(endMark)
|
}
|
|
// 绘制带箭头折线
|
function drawLine() {
|
var data = []
|
var points = []
|
$.each(trackPoints, function (index, value) {
|
var point = []
|
point.push(value['lng'], value['lat'])
|
points.push(point)
|
})
|
data.push({
|
geometry: {
|
type: '"LineString"',
|
coordinates: [points],
|
},
|
})
|
var lineLayer = new mapvgl.LineLayer({
|
color: 'red',
|
width: 3,
|
animation: true,
|
duration: 10, // 循环时间2s
|
trailLength: 0.1, // 拖尾长度占间隔的0.4
|
interval: 0.3, // 粒子长度占线整体长度的0.2
|
})
|
that.view.addLayer(lineLayer)
|
lineLayer.setData(data)
|
}
|
|
// 格子间隔>=size的放进points
|
function getShowPoints(size) {
|
var points = []
|
points.push(trackPoints[0])
|
for (var i = 1; i < trackPoints.length; i++) {
|
var flag = true
|
var point1 = trackPoints[i]
|
for (var j = 0; j < points.length; j++) {
|
var point2 = points[j]
|
var dis = that.map.getDistance(point1, point2) // 返回两点之间的直线距离,单位是米
|
if (dis < size) {
|
flag = false
|
}
|
}
|
points.push(point1)
|
// console.log(points, 'image.png')
|
// if (flag) {
|
// points.push(point1)
|
// console.log(points, 'points')
|
// }
|
}
|
return points
|
}
|
|
// 根据中心,角度,距离,找点
|
function getPoint(angle, lng, lat, distance) {
|
var EARTH_RADIUS = 6378137 // 地球的半径,m
|
// 将距离转换成经度的计算公式
|
var ra = distance / EARTH_RADIUS
|
// 转换为radian,否则结果会不正确
|
angle = (angle / 180) * Math.PI
|
lng = (lng / 180) * Math.PI
|
lat = (lat / 180) * Math.PI
|
lng =
|
lng +
|
Math.atan2(
|
Math.sin(angle) * Math.sin(ra) * Math.cos(lat),
|
Math.cos(ra) - Math.sin(lat) * Math.sin(lat)
|
) // Math.atan2()方法计算二维坐标系中任意一个点(x, y)和原点(0, 0)的连线与X轴正半轴的夹角大小
|
lat = Math.asin(
|
Math.sin(lat) * Math.cos(ra) +
|
Math.cos(lat) * Math.sin(ra) * Math.cos(angle)
|
)
|
// 转为正常的10进制经纬度
|
lng = (lng * 180) / Math.PI
|
lat = (lat * 180) / Math.PI
|
// console.log(lng, lat)
|
return new BMapGL.Point(lng, lat)
|
}
|
|
function getGrading(sensor, type, carMac) {
|
var levels = []
|
var level0 = {}
|
var level1 = {}
|
var level2 = {}
|
var level3 = {}
|
var level4 = {}
|
var level5 = {}
|
var level6 = {}
|
|
var data0 = []
|
var data1 = []
|
var data2 = []
|
var data3 = []
|
var data4 = []
|
var data5 = []
|
var data6 = []
|
|
level0.color = '#38D9D3'
|
level1.color = '#00e400'
|
level2.color = '#ffff00'
|
level3.color = '#ff7e00'
|
level4.color = '#ff0000'
|
level5.color = '#99004c'
|
level6.color = '#7e0023'
|
|
$.each(that.showPoints, function (index, value) {
|
var sw = getPoint(225, value.lng, value.lat, that.distance)
|
var ne = getPoint(45, value.lng, value.lat, 30)
|
var polygon = []
|
var point1 = []
|
var point2 = []
|
var point3 = []
|
var point4 = []
|
point1.push(sw.lng, sw.lat)
|
point2.push(ne.lng, sw.lat)
|
point3.push(ne.lng, ne.lat)
|
point4.push(sw.lng, ne.lat)
|
polygon.push(point1)
|
polygon.push(point2)
|
polygon.push(point3)
|
polygon.push(point4)
|
var valueElement = value[sensor]
|
var colorAndLevel = getColorAndLevel(sensor, value[sensor])
|
var level = colorAndLevel['level']
|
var height
|
if (type === '2D') {
|
height = 0
|
} else {
|
height = value[sensor]
|
// if (sensor === 'a99054') {
|
// height = value[sensor] * 500
|
// }
|
// console.log(carMac, 'carMac')
|
// if (sensor === 'dustld' && (value[sensor] - 0) < 100 && (value[sensor] - 0) !== 0 && carMac === 'p5dnd7a0243622') {
|
// height = 100 * 10
|
// }
|
}
|
switch (level) {
|
case 0:
|
data0.push({
|
geometry: {
|
type: 'Polygon',
|
coordinates: [polygon],
|
},
|
properties: {
|
height: height,
|
},
|
})
|
break
|
case 1:
|
data1.push({
|
geometry: {
|
type: 'Polygon',
|
coordinates: [polygon],
|
},
|
properties: {
|
height: height,
|
},
|
})
|
break
|
case 2:
|
data2.push({
|
geometry: {
|
type: 'Polygon',
|
coordinates: [polygon],
|
},
|
properties: {
|
height: height,
|
},
|
})
|
break
|
case 3:
|
data3.push({
|
geometry: {
|
type: 'Polygon',
|
coordinates: [polygon],
|
},
|
properties: {
|
height: height,
|
},
|
})
|
break
|
case 4:
|
data4.push({
|
geometry: {
|
type: 'Polygon',
|
coordinates: [polygon],
|
},
|
properties: {
|
height: height,
|
},
|
})
|
break
|
case 5:
|
data5.push({
|
geometry: {
|
type: 'Polygon',
|
coordinates: [polygon],
|
},
|
properties: {
|
height: height,
|
},
|
})
|
break
|
case 6:
|
data6.push({
|
geometry: {
|
type: 'Polygon',
|
coordinates: [polygon],
|
},
|
properties: {
|
height: height,
|
},
|
})
|
break
|
}
|
})
|
level0.data = data0
|
level1.data = data1
|
level2.data = data2
|
level3.data = data3
|
level4.data = data4
|
level5.data = data5
|
level6.data = data6
|
levels.push(level0, level1, level2, level3, level4, level5, level6)
|
return levels
|
}
|
function getColorAndLevel(senosor, data) {
|
var levelData = that.sensorTableData
|
var colorAndLevel = {}
|
var color
|
var level
|
switch (that.sensor) {
|
case 'a34004':
|
if (data < levelData[0].tab1) {
|
color = '#00e400'
|
level = 1
|
} else if (data < levelData[0].tab2) {
|
color = '#ffff00'
|
level = 2
|
} else if (data < levelData[0].tab3) {
|
color = '#ff7e00'
|
level = 3
|
} else if (data < levelData[0].tab4) {
|
color = '#ff0000'
|
level = 4
|
} else if (data < levelData[0].tab5) {
|
color = '#99004c'
|
level = 5
|
} else {
|
color = '#7e0023'
|
level = 6
|
}
|
break
|
case 'a34002':
|
if (data < levelData[1].tab1) {
|
color = '#00e400'
|
level = 1
|
} else if (data < levelData[1].tab2) {
|
color = '#ffff00'
|
level = 2
|
} else if (data < levelData[1].tab3) {
|
color = '#ff7e00'
|
level = 3
|
} else if (data < levelData[1].tab4) {
|
color = '#ff0000'
|
level = 4
|
} else if (data < levelData[1].tab5) {
|
color = '#99004c'
|
level = 5
|
} else {
|
color = '#7e0023'
|
level = 6
|
}
|
break
|
case 'a21026':
|
if (data < levelData[2].tab1) {
|
color = '#00e400'
|
level = 1
|
} else if (data < levelData[2].tab2) {
|
color = '#ffff00'
|
level = 2
|
} else if (data < levelData[2].tab3) {
|
color = '#ff7e00'
|
level = 3
|
} else if (data < levelData[2].tab4) {
|
color = '#ff0000'
|
level = 4
|
} else if (data < levelData[2].tab5) {
|
color = '#99004c'
|
level = 5
|
} else {
|
color = '#7e0023'
|
level = 6
|
}
|
break
|
case 'a21004':
|
if (data < levelData[3].tab1) {
|
color = '#00e400'
|
level = 1
|
} else if (data < levelData[3].tab2) {
|
color = '#ffff00'
|
level = 2
|
} else if (data < levelData[3].tab3) {
|
color = '#ff7e00'
|
level = 3
|
} else if (data < levelData[3].tab4) {
|
color = '#ff0000'
|
level = 4
|
} else if (data < levelData[3].tab5) {
|
color = '#99004c'
|
level = 5
|
} else {
|
color = '#7e0023'
|
level = 6
|
}
|
break
|
case 'a21005':
|
if (data < levelData[4].tab1) {
|
color = '#00e400'
|
level = 1
|
} else if (data < levelData[4].tab2) {
|
color = '#ffff00'
|
level = 2
|
} else if (data < levelData[4].tab3) {
|
color = '#ff7e00'
|
level = 3
|
} else if (data < levelData[4].tab4) {
|
color = '#ff0000'
|
level = 4
|
} else if (data < levelData[4].tab5) {
|
color = '#99004c'
|
level = 5
|
} else {
|
color = '#7e0023'
|
level = 6
|
}
|
break
|
case 'a05024':
|
if (data < levelData[5].tab1) {
|
color = '#00e400'
|
level = 1
|
} else if (data < levelData[5].tab2) {
|
color = '#ffff00'
|
level = 2
|
} else if (data < levelData[5].tab3) {
|
color = '#ff7e00'
|
level = 3
|
} else if (data < levelData[5].tab4) {
|
color = '#ff0000'
|
level = 4
|
} else if (data < levelData[5].tab5) {
|
color = '#99004c'
|
level = 5
|
} else {
|
color = '#7e0023'
|
level = 6
|
}
|
break
|
case 'a99054':
|
if (data < levelData[6].tab1) {
|
color = '#00e400'
|
level = 1
|
} else if (data < levelData[6].tab2) {
|
color = '#ffff00'
|
level = 2
|
} else if (data < levelData[6].tab3) {
|
color = '#ff7e00'
|
level = 3
|
} else if (data < levelData[6].tab4) {
|
color = '#ff0000'
|
level = 4
|
} else if (data < levelData[6].tab5) {
|
color = '#99004c'
|
level = 5
|
} else {
|
color = '#7e0023'
|
level = 6
|
}
|
break
|
case 'a01006':
|
if (data) {
|
color = '#00e400'
|
level = 1
|
}
|
break
|
case 'a01001':
|
if (data) {
|
color = '#00e400'
|
level = 1
|
}
|
break
|
case 'a01002':
|
if (data) {
|
color = '#00e400'
|
level = 1
|
}
|
break
|
case 'dustld':
|
if (data < levelData[7].tab1) {
|
color = '#00e400'
|
level = 1
|
} else if (data < levelData[7].tab2) {
|
color = '#ffff00'
|
level = 2
|
} else if (data < levelData[7].tab3) {
|
color = '#ff7e00'
|
level = 3
|
} else if (data < levelData[7].tab4) {
|
color = '#ff0000'
|
level = 4
|
} else if (data < levelData[7].tab5) {
|
color = '#99004c'
|
level = 5
|
} else {
|
color = '#7e0023'
|
level = 6
|
}
|
break
|
}
|
colorAndLevel['color'] = color
|
colorAndLevel['level'] = level
|
return colorAndLevel
|
}
|
|
// point上添加label文本
|
function setLabelStyle(content, point) {
|
var label = new BMapGL.Label(
|
"<span class='my-maptip'>" + content + '<br /><span>', // 为lable填写内容
|
{
|
offset: new BMapGL.Size(-8, -10), // label的偏移量,为了让label的中心显示在点上
|
position: point,
|
} // label的位置
|
)
|
var offsetSize = new BMapGL.Size(0, 0)
|
var size = '10px'
|
if (that.map.getZoom() <= 15.5) {
|
size = '0px'
|
}
|
var labelStyle = {
|
border: '0',
|
fontSize: size,
|
height: '20px',
|
lineHeight: '20px',
|
fontFamily: '微软雅黑',
|
backgroundColor: '0.05',
|
fontWeight: 'bold',
|
}
|
label.setStyle(labelStyle)
|
that.map.addOverlay(label)
|
}
|
|
// 无数据时,缩放至该中心
|
function showNoPoints() {
|
that.map.centerAndZoom('苏州市', 17)
|
setTimeout(function () {
|
document.getElementById('cpm').style.display = 'block'
|
document.getElementById('data').style.display = 'none'
|
}, 250)
|
}
|
|
// 地图缩放级别监控
|
that.map.addEventListener('zoomend', function () {
|
// 这里根据缩放显示和隐藏文本
|
var zoom = that.map.getZoom()
|
$('span.my-maptip').parent()[zoom <= 15.5 ? 'hide' : 'show']()
|
$('span.my-maptip')
|
.parent()
|
.css('font-size', 30 - zoom)
|
})
|
|
// var that = this
|
function clickChange() {
|
$('.carTop').on('click', () => {
|
// console.log('点击了')
|
that.view.removeAllLayers()
|
that.map.clearOverlays()
|
that.sensor = that.sensorKey
|
that.viewType = that.viewKey
|
// draw(that.sensor, that.viewType)
|
drawPolygon(that.sensor)
|
if (that.viewType === '2D') {
|
that.map.setTilt(0)
|
// drawLine()
|
// drawStartAndEnd()
|
$('.sensorLevel').attr('src', '/img/pollutionlevel.png')
|
} else if (that.viewType === '3D') {
|
that.map.setTilt(52)
|
if (that.sensor === 'a34004') {
|
$('.sensorLevel').attr('src', '/img/pm25.png')
|
} else if (that.sensor === 'a34002') {
|
$('.sensorLevel').attr('src', '/img/pm10.png')
|
} else if (that.sensor === 'a99054') {
|
$('.sensorLevel').attr('src', '/img/tvoc.png')
|
}
|
}
|
})
|
}
|
if (that.firstPlayFlag) {
|
clickChange()
|
}
|
},
|
changeCode(value) {
|
switch (value) {
|
case 'PM2.5':
|
this.sensorKey = 'a34004'
|
break
|
case 'PM10':
|
this.sensorKey = 'a34002'
|
break
|
case 'SO2':
|
this.sensorKey = 'a21026'
|
break
|
case 'NO2':
|
this.sensorKey = 'a21004'
|
break
|
case 'CO':
|
this.sensorKey = 'a21005'
|
break
|
case '03':
|
this.sensorKey = 'a05024'
|
break
|
case 'TVOC':
|
this.sensorKey = 'a99054'
|
break
|
case '湿度':
|
this.sensorKey = 'a01002'
|
break
|
case '温度':
|
this.sensorKey = 'a01001'
|
break
|
case '气压':
|
this.sensorKey = 'a01006'
|
break
|
case 'dustld':
|
this.sensorKey = 'dustld'
|
break
|
}
|
this.initStart(this.carData)
|
},
|
changeCode1(index) {
|
this.changeColor1 = index
|
if (index === 0) {
|
this.viewKey = '2D'
|
} else {
|
this.viewKey = '3D'
|
}
|
this.getStart()
|
},
|
},
|
}
|
</script>
|
|
<style lang="scss" >
|
/deep/.BMap_cpyCtrl {
|
display: none;
|
}
|
/deep/.anchorBL img {
|
display: none;
|
}
|
.main_body {
|
border: 0;
|
margin: 0;
|
width: 100%;
|
height: 100%;
|
position: relative;
|
}
|
.el-header,
|
.el-footer {
|
background-color: #b3c0d1;
|
color: #333;
|
text-align: center;
|
line-height: 60px;
|
}
|
|
.el-aside {
|
background-color: #d3dce6;
|
color: #333;
|
text-align: left;
|
line-height: 52px;
|
z-index: 10;
|
}
|
|
.el-main {
|
padding: 0;
|
width: 100%;
|
height: 100%;
|
}
|
|
body > .el-container {
|
margin-bottom: 40px;
|
}
|
|
.el-container:nth-child(5) .el-aside,
|
.el-container:nth-child(6) .el-aside {
|
line-height: 260px;
|
}
|
|
.el-container:nth-child(7) .el-aside {
|
line-height: 320px;
|
}
|
.el-radio-button--medium .el-radio-button__inner {
|
padding: 16px 20px;
|
font-size: 14px;
|
height: 38px;
|
border-radius: 0;
|
width: 80px;
|
line-height: 0.5;
|
}
|
.per-date {
|
height: 50px;
|
line-height: 50px;
|
border-bottom: 1px solid gainsboro;
|
color: #5a5c60;
|
padding-left: 20px;
|
}
|
.per-date:nth-last-child(1) {
|
border-bottom: none;
|
}
|
.per-date:hover {
|
cursor: pointer;
|
}
|
.per-date_area {
|
height: 50px;
|
line-height: 50px;
|
border-bottom: 1px solid gainsboro;
|
color: #5a5c60;
|
}
|
.per-date_area:hover {
|
cursor: pointer;
|
}
|
.per-date_area:nth-child(1) {
|
border-top: 1px solid #ebeef5;
|
}
|
.per-date_area:nth-last-child(1) {
|
border-bottom: none;
|
}
|
.uav {
|
position: relative;
|
}
|
.active {
|
background-color: #f5f7fa;
|
}
|
.activeArea {
|
background-color: #f5f7fa;
|
color: rgb(36, 36, 36);
|
}
|
/*文本样式*/
|
.textShow {
|
//padding: .75rem 1.25rem;
|
margin-bottom: 1rem;
|
border-radius: 0.25rem;
|
position: fixed;
|
top: 11rem;
|
background-color: rgba(255, 255, 255, 0.8);
|
width: auto;
|
//height: 360px;
|
min-width: 22rem;
|
border-width: 0;
|
right: 1rem;
|
box-shadow: 0 2px 6px 0 rgba(34, 24, 21, 0.08);
|
//box_shadow: -1px 2px 8px 1px rgba(34,24,21,.08) !important
|
}
|
.hr {
|
position: relative;
|
top: 2px;
|
}
|
.per-text-data {
|
padding: 0 2.25rem;
|
}
|
.per-text-data:nth-last-child(1) {
|
padding-bottom: 8px;
|
}
|
.el-collapse {
|
border-top: 1px solid #ebeef5;
|
border-bottom: 1px solid #ebeef5;
|
width: 280px;
|
}
|
|
/deep/.el-scrollbar__wrap {
|
overflow-x: hidden;
|
//overflow-y: hidden;
|
}
|
/deep/.el-collapse-item__header {
|
color: #5a5c60;
|
font-size: 16px;
|
}
|
/deep/.el-collapse-item__content {
|
padding-bottom: 5px;
|
}
|
/deep/.el-card__header {
|
padding: 2px 0;
|
text-align: center;
|
}
|
/deep/.el-card__body {
|
padding: 2px 0;
|
}
|
/deep/.amap-logo {
|
display: none !important;
|
}
|
/deep/.amap-copyright {
|
display: none !important;
|
}
|
|
.noneData {
|
position: absolute;
|
color: #000;
|
background: #fff;
|
z-index: 999;
|
left: 50%;
|
top: 50%;
|
transform: translate(-50%);
|
padding: 20px 50px;
|
font-size: 28px;
|
border: 2px solid #ff7f50;
|
}
|
#map_container {
|
width: 100%;
|
height: 100%;
|
overflow: hidden;
|
margin: 0;
|
z-index: 0;
|
font-size: 14px;
|
font-family: '微软雅黑';
|
}
|
/deep/.inputNum {
|
width: 4% !important;
|
}
|
.dateArrClass {
|
position: relative;
|
}
|
.dateArrClass > div ::after {
|
content: '';
|
position: absolute;
|
right: 8px;
|
top: 23px;
|
width: 5px;
|
height: 5px;
|
border-radius: 50%;
|
z-index: 999;
|
background-color: #f40;
|
}
|
.numss {
|
width: 700px;
|
background-color: white;
|
margin-top: 17px;
|
display: flex;
|
height: 60px;
|
}
|
/deep/.el-select {
|
width: 8% !important;
|
}
|
.Duo {
|
display: flex;
|
overflow: hidden;
|
background-color: white;
|
width: 750px;
|
padding-left: 10px;
|
}
|
.spantu {
|
width: 190px;
|
// margin-top: 10px;
|
// margin-left: 20px;
|
// background-color: white;
|
// height: 40px;
|
display: flex;
|
margin-left: 10px;
|
line-height: 60px;
|
font-weight: 5px;
|
color: #696b6f;
|
.inputtu {
|
width: 40%;
|
margin-left: 5px;
|
}
|
}
|
.slee {
|
line-height: 60px;
|
width: 100px;
|
margin-left: 25px;
|
}
|
.spantuu {
|
width: 400px;
|
line-height: 60px;
|
color: #696b6f;
|
.inputtu {
|
width: 20%;
|
}
|
}
|
.jlpMySelectPopper.el-picker-panel {
|
width: 280px;
|
height: 330px;
|
}
|
.jlpMySelectPopper.el-date-picker table {
|
width: 88%;
|
}
|
.BMap_cpyCtrl {
|
display: none;
|
}
|
|
.anchorBL {
|
display: none;
|
}
|
.el-collapse-item__arrow.is-active {
|
-webkit-transform: rotate(90deg);
|
transform: rotate(90deg);
|
position: absolute;
|
top: -3px;
|
right: -3px;
|
}
|
/* 解决自定义滚动条 x 轴显示问题 */
|
.el-scrollbar__wrap {
|
overflow-x: hidden;
|
}
|
</style>
|