Browse Source

Merge branch 'lixin' of gitadmin/tuoheng_lc_web into develop

tags/v1.2.0
lixin 1 year ago
parent
commit
057a5b5352
4 changed files with 42 additions and 42 deletions
  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 View File

if (res.code === 0) { if (res.code === 0) {
if (res.data) { if (res.data) {
data.list = res.data data.list = res.data
} else {
data.list.length = 0
} }
} }
} }

+ 34
- 35
src/views/dashboard/components/FireAlarm.vue View File



import { reactive, toRefs, watch } from 'vue' import { reactive, toRefs, watch } from 'vue'
import { EARLY_SOURCE, TASK_STATUS } from '@/utils/dictionary.js' 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 用于简单的空间计算 // turf 用于简单的空间计算
import * as turf from '@turf/turf' import * as turf from '@turf/turf'
export default { export default {
data: { data: {
type: Object, type: Object,
default: () => { } default: () => { }
},
airport: {
type: Object,
default: () => { }
} }
}, },
emits: ['start', 'close'], emits: ['start', 'close'],
watch(() => props.data, (value) => { watch(() => props.data, (value) => {
if (JSON.stringify(value) !== '{}') { if (JSON.stringify(value) !== '{}') {
data.warningInfo = props.data data.warningInfo = props.data
data.airport = props.airport
showDetail(data.warningInfo) showDetail(data.warningInfo)
data.warningShow = true data.warningShow = true
closeAirport() closeAirport()
} }


// 可用机场列表 // 可用机场列表
const showUsableAirport = (info) => {
const showUsableAirport = async(info) => {
data.usableAirport.length = 0 data.usableAirport.length = 0
data.airpotOptions.length = 0 data.airpotOptions.length = 0
const warningLngLat = turf.point([parseFloat(info?.data?.lng), parseFloat(info?.data?.lat)]) 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({ data.usableAirport.push({
id: item.id, id: item.id,
airName: item.name, airName: item.name,
value: item.id, value: item.id,
label: item.name 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 View File

/> />
</div> </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" /> <WarningDrawer v-model:visible="drawerShow" @refresh:id="refreshRecord" />



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

} }
}, 2000) }, 2000)


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



Loading…
Cancel
Save