|
|
@@ -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 |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|