Browse Source

Merge branch 'lixin' of gitadmin/tuoheng_lc_web into develop

tags/v1.2.0
lixin 1 year ago
parent
commit
e3f248e582
4 changed files with 107 additions and 13 deletions
  1. +1
    -1
      src/views/dashboard/components/Extend.vue
  2. +2
    -2
      src/views/dashboard/components/SuppliesInfo.vue
  3. +84
    -4
      src/views/dashboard/components/Underlay.vue
  4. +20
    -6
      src/views/dashboard/components/WarningDrawer.vue

+ 1
- 1
src/views/dashboard/components/Extend.vue View File

@@ -1,7 +1,7 @@
<template>
<div class="map__entend">
<div v-for="(item,index) in extendList" :key="index" class="extend__container" @click="handleClick(index)">
<img :src="selectedTab === index ? `/src/assets/images/${item.selected.path}.png` : `/src/assets/images/${item.path}.png`" alt="">
<img :src="selectedTab === index ? `../src/assets/images/${item.selected.path}.png` : `../src/assets/images/${item.path}.png`" alt="">
<p :style="{color: selectedTab === index ? item.selected.color : '#eee'}">{{ item.name }}</p>
</div>


+ 2
- 2
src/views/dashboard/components/SuppliesInfo.vue View File

@@ -7,11 +7,11 @@
</div>

<p class="supplies-type">
<img :src="`/src/assets/gis/images/toLeft.png`" @click="deSuppliesIndex">
<img :src="`../src/assets/gis/images/toLeft.png`" @click="deSuppliesIndex">
<span v-for="(item ,index) in MATERIAL_TYPE" v-show="item.value === suppliesType" :key="index">
{{ item.label }}
</span>
<img :src="`/src/assets/gis/images/toRight.png`" @click="inSuppliesIndex">
<img :src="`../src/assets/gis/images/toRight.png`" @click="inSuppliesIndex">
</p>

<div class="supplies-table">

+ 84
- 4
src/views/dashboard/components/Underlay.vue View File

@@ -11,6 +11,7 @@ import { Tile, Vector as VectorLayer } from 'ol/layer'
import TileWMS from 'ol/source/TileWMS.js'
import LineString from 'ol/geom/LineString'
import Point from 'ol/geom/Point'
import { Style, Icon, Text, Fill } from 'ol/style'
import { XYZ, Vector as VectorSource } from 'ol/source'
import { transform, fromLonLat } from 'ol/proj'
import { getVectorContext } from 'ol/render'
@@ -19,6 +20,10 @@ import * as control from 'ol/control'
import { styleList } from '@/utils/style.js'
import { getTrackList } from '@/api/task/index.js'
import { useInspectionStore } from '@/store/modules/inspection.js'
import { airportList } from '@/api/dashboard/index.js'
import { gcj02towgs84 } from '@/utils/coordinate-util.js'
import uav_icon from '@/assets/images/airport.png'
import gcj02Mecator from '@/utils/map/gcj02Mecator.js'

export default {
name: 'UnderLay',
@@ -39,7 +44,9 @@ export default {
// 轨迹数据
trackList: [],
socket: null,
liveTrackLayer: null
liveTrackLayer: null,
trackTimer: null,
airLayer: null
})

const getMapOptions = computed(() => {
@@ -56,6 +63,7 @@ export default {
const tdtImgMap = new Tile({
visible: true,
source: new XYZ({
projection: gcj02Mecator,
url: 'https://wprd0{1-4}.is.autonavi.com/appmaptile?lang=zh_cn&size=1&style=6&x={x}&y={y}&z={z}'
})
})
@@ -96,11 +104,80 @@ export default {
})
}

const drawAirport = async(id) => {
const res = await airportList({ page: 1, limit: 100 })
if (res.code === 0) {
if (res.data.length > 0) {
for (let i = 0; i < res.data.length; i++) {
if (id === res.data[i].id) {
const airport = res.data[i]
const lngLat = gcj02towgs84(
parseFloat(airport.longitude),
parseFloat(airport.latitude)
)
const feature = new Feature({
geometry: new Point(fromLonLat(lngLat))
})
// 要素设置样式
feature.setStyle(
new Style({
image: new Icon({
src: uav_icon
}),
text: new Text({
// 文字内容
text: airport.name,
// 位置
textAlign: 'center',
// 基准线
textBaseline: 'top',
offsetY: 30,
// 文字样式
font: 'normal 20px Microsoft YaHei',
backgroundFill: new Fill({
color: '#1890FF'
}),
padding: [3, 6, 3, 6],
// 文字颜色
fill: new Fill({
color: '#fff'
})
})
})
)
// 要素设置id
feature.setId(airport.id)
// 添加矢量图层
data.airLayer = new VectorLayer({
source: new VectorSource({
features: [feature]
}),
visible: true
})
data.map.addLayer(data.airLayer)
}
}
}
}
}

if (inspectionStore.getList.id) {
if (!data.map) {
getTrackData().then(({ trackList }) => {
setLiveTrack(formatTradeList(trackList))
})
data.trackTimer = setInterval(() => {
getTrackData().then(({ trackList }) => {
// 有数据了再画
if (trackList.length > 0) {
clearInterval(data.trackTimer)
data.trackTimer = null
setLiveTrack(formatTradeList(trackList))
}
})
}, 2000)

// 绘制机场
if (inspectionStore.getList.airportId) {
drawAirport(inspectionStore.getList.airportId)
}
}
}

@@ -204,6 +281,9 @@ export default {
const endLiveFly = () => {
clearInterval(data.socket)
data.socket = null
if (data.airLayer) {
data.map.removeLayer(data.airLayer)
}
}

onMounted(() => {

+ 20
- 6
src/views/dashboard/components/WarningDrawer.vue View File

@@ -128,9 +128,9 @@ export default defineComponent({
function handleDrawerColse() {
emit('update:visible', false)
getEmergencyRecord(inspectionStore.getList.id)
// inspectionStore.resetList()
inspectionStore.resetList()
// 结束直播飞行
// baseMap.value?.endLiveFly()
baseMap.value?.endLiveFly()
// 关闭视频播放
emergencyVideo.value?.disposeVideo()

@@ -187,13 +187,27 @@ export default defineComponent({
})

watch(() => inspectionStore.getList, (value) => {
if (value?.aiplayUrl) {
setTimeout(() => {
initOriginPlayer(value)
}, 3000)
if (value) {
// 获取无人机实时数据,绘制表格
// if (value.airportId) {
// setInterval(() => {
// getUavInfo(value.airportId)
// }, 2000)
// }
console.log(value)
// setTimeout(() => {
// initOriginPlayer(value)
// }, 3000)
}
})

const getUavInfo = async(id) => {
const res = await uavInfo(id)
if (res.code === 0) {
console.log(res.data)
}
}

/* 初始化播放器 */
function initOriginPlayer(value) {
const origin = {

Loading…
Cancel
Save