Selaa lähdekoodia

map change

tags/v1.2.0
lixin 1 vuosi sitten
vanhempi
commit
7cbeb025d8
4 muutettua tiedostoa jossa 42 lisäystä ja 42 poistoa
  1. +2
    -0
      src/layout/components/Header/index.vue
  2. +34
    -35
      src/views/dashboard/components/FireAlarm.vue
  3. +1
    -1
      src/views/dashboard/components/OneMap.vue
  4. +5
    -6
      src/views/dashboard/components/WarningDrawer.vue

+ 2
- 0
src/layout/components/Header/index.vue Näytä tiedosto

@@ -107,6 +107,8 @@ export default defineComponent({
if (res.code === 0) {
if (res.data) {
data.list = res.data
} else {
data.list.length = 0
}
}
}

+ 34
- 35
src/views/dashboard/components/FireAlarm.vue Näytä tiedosto

@@ -93,7 +93,7 @@

import { reactive, toRefs, watch } from 'vue'
import { EARLY_SOURCE, TASK_STATUS } from '@/utils/dictionary.js'
import { getWarningRecord, getWarningInfo, ignoreWarning, confirmWarning, pointflight } from '@/api/dashboard/index.js'
import { getWarningRecord, getWarningInfo, ignoreWarning, confirmWarning, pointflight, airportList } from '@/api/dashboard/index.js'
// turf 用于简单的空间计算
import * as turf from '@turf/turf'
export default {
@@ -103,10 +103,6 @@ export default {
data: {
type: Object,
default: () => { }
},
airport: {
type: Object,
default: () => { }
}
},
emits: ['start', 'close'],
@@ -131,7 +127,6 @@ export default {
watch(() => props.data, (value) => {
if (JSON.stringify(value) !== '{}') {
data.warningInfo = props.data
data.airport = props.airport
showDetail(data.warningInfo)
data.warningShow = true
closeAirport()
@@ -207,36 +202,26 @@ export default {
}

// 可用机场列表
const showUsableAirport = (info) => {
const showUsableAirport = async(info) => {
data.usableAirport.length = 0
data.airpotOptions.length = 0
const warningLngLat = turf.point([parseFloat(info?.data?.lng), parseFloat(info?.data?.lat)])
if (data.airport) {
data.airport?.map((item) => {
if (item.online) {
var airportFind = false
if (parseInt(info?.data?.airportId) === item.id) {
airportFind = true
}
const airLngLat = turf.point([parseFloat(item.longitude), parseFloat(item.latitude)])
const distance = turf.distance(warningLngLat, airLngLat).toFixed(2)
// 根据机场最大里程过滤机场
if (parseInt(item.coverage) > distance) {
const res = await airportList({ page: 1, limit: 100 })
if (res.code === 0) {
data.airport = res.data
if (data.airport) {
data.airport?.map((item) => {
if (item.online) {
var airportFind = false
if (parseInt(info?.data?.airportId) === item.id) {
airportFind = true
}
const airLngLat = turf.point([parseFloat(item.longitude), parseFloat(item.latitude)])
const distance = turf.distance(warningLngLat, airLngLat).toFixed(2)
// 根据机场最大里程过滤机场
if (parseInt(item.coverage) > distance) {
// 无人机是否处于空闲状态
if (parseInt(item.status) === 1) {
data.usableAirport.push({
id: item.id,
airName: item.name,
distance: distance,
find: airportFind
})
data.airpotOptions.push({
value: item.id,
label: item.name
})
} else {
// 无人机不是空闲 但是发现此预警的内容
if (data.warningInfo?.airportId === item.id) {
if (parseInt(item.status) === 1) {
data.usableAirport.push({
id: item.id,
airName: item.name,
@@ -247,12 +232,26 @@ export default {
value: item.id,
label: item.name
})
} else {
// 无人机不是空闲 但是发现此预警的内容
if (data.warningInfo?.airportId === item.id) {
data.usableAirport.push({
id: item.id,
airName: item.name,
distance: distance,
find: airportFind
})
data.airpotOptions.push({
value: item.id,
label: item.name
})
}
}
}
}
}
})
data.airportId = data.airpotOptions[0]?.value || null
})
data.airportId = data.airpotOptions[0]?.value || null
}
}
}


+ 1
- 1
src/views/dashboard/components/OneMap.vue Näytä tiedosto

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

<fire-alarm ref="Warning" :data="warningDetail" :airport="airportsAll" @start="handleExecute" @close="closeWarningTab" />
<fire-alarm ref="Warning" :data="warningDetail" @start="handleExecute" @close="closeWarningTab" />

<WarningDrawer v-model:visible="drawerShow" @refresh:id="refreshRecord" />


+ 5
- 6
src/views/dashboard/components/WarningDrawer.vue Näytä tiedosto

@@ -210,14 +210,11 @@ export default defineComponent({
}
}, 2000)

// 3分钟后判断是否是否起飞成功
// 6分钟后判断是否是否起飞成功
data.failTimer = setInterval(async() => {
const res = await getTaskDetail(value.id)
if (res.code === 0) {
if (res.data.playUrl) {
clearInterval(data.liveTimer)
data.liveTimer = null
} else {
if (res.data.status === 3) {
$dialog.confirm(
{
type: 'error',
@@ -237,8 +234,10 @@ export default defineComponent({
}
)
}
clearInterval(data.failTimer)
data.failTimer = null
}
}, 2 * 60 * 1000)
}, 6 * 60 * 1000)
}
})


Loading…
Peruuta
Tallenna