ts/src/views/MultiTrajPlayback/hooks/useMultiTrajReq.js
2025-04-22 09:53:35 +08:00

97 lines
2.0 KiB
JavaScript

import { ref } from 'vue'
import { getMubiao, getMubiaoHisTraj } from '../../../api/Mubiao'
import { getSatellite } from '../../../api/Satellite'
import { getHangjing } from '../../../api/Hangjing'
import { getDaodanTree } from '../../../api/Daodan'
export function useMultiTrajReq() {
return { allTreeData, getAllTree, getZBHisTraj }
}
const allTreeData = ref([])
function getAllTree() {
Promise.all([getZBTree(), getDDTree(), getSatelliteTree(), getHJTree()])
.then(res => {
allTreeData.value = {
zb: [res[0]],
dd: [res[1]],
satellite: res[2],
hj: [res[3]],
}
})
.catch(err => {})
}
async function getZBTree() {
const { code, data } = await getMubiao()
if (code === '200') {
data.nodeName = '装备'
return data
} else {
return []
}
}
async function getDDTree() {
const { code, data } = await getDaodanTree()
if (code === '200') {
data.nodeName = 'DD'
return data
} else {
return []
}
}
async function getSatelliteTree() {
const { code, data } = await getSatellite()
if (code === '200') {
return data
} else {
return []
}
}
async function getHJTree() {
const { code, data } = await getHangjing()
if (code === '200') {
data.nodeName = 'hj'
return data
} else {
return []
}
}
async function getZBHisTraj(id, params) {
const [timeBegin, timeEnd] = params
const { code, data } = await getMubiaoHisTraj({
target_id: id,
timeBegin,
timeEnd,
})
if (code === '200') {
return data
}
return []
}
async function getSatelliteHisTraj(id, params) {
const { timeBegin, timeEnd } = params
const { code, data } = await getSatellite()
if (code === '200') {
}
}
async function getDDHisTraj(id, params) {
const { timeBegin, timeEnd } = params
const { code, data } = await getSatellite()
if (code === '200') {
}
}
async function getHJHisTraj(id, params) {
const { timeBegin, timeEnd } = params
const { code, data } = await getSatellite()
if (code === '200') {
}
}