ts/src/views/Mubiao/index.vue

122 lines
3.2 KiB
Vue
Raw Normal View History

2024-12-09 06:44:52 +00:00
<script setup lang="ts">
import { h } from 'vue'
import { NButton } from 'naive-ui'
import type { TreeOption } from 'naive-ui'
import { getMubiao, getMubiaoPos } from '@/api/Mubiao'
// import type { DataTableColumns, DataTableRowKey } from 'naive-ui'
import Tree from '@/components/Tree/index.vue'
import HeatMap from './components/HeatMap/index.vue'
import { useMubiao } from './hooks/mubiao'
import { useMuBiaoPositionWS } from './hooks/mubiaoPos'
import { useMuBiaoDisappearWS } from './hooks/mubiaoDisappear'
import { useMubiaoDetail } from './hooks/mubiaoDetail'
import { useMBTrajectory } from './components/HisTrajectory/hooks/mbTraj'
2025-01-23 01:05:13 +00:00
import { useDaodan } from '../Daodan/daodan'
2024-12-09 06:44:52 +00:00
const { addMubiao, data } = useMubiao()
const useMbPosWS = useMuBiaoPositionWS()
const useMbDisappearWS = useMuBiaoDisappearWS()
const getMubiaoData = async () => {
const { code, data: resData } = await getMubiao()
if (code === '200') {
data.value = [resData]
}
}
onMounted(() => {
getMubiaoData()
// useMuBiaoPositionWS()
})
const checkedKeys = ref<Array<string | number>>([])
watch(checkedKeys, val => {
addMubiao(val)
})
const { showDetailsMubiao } = useMubiaoDetail()
const { showOrHideHisTraj } = useMBTrajectory()
2025-01-23 01:05:13 +00:00
const { showOrHideDdConfig } = useDaodan()
2024-12-09 06:44:52 +00:00
const renderSuffix = ({ option }: { option: TreeOption }) => {
// console.log(option.data)
2025-01-23 01:05:13 +00:00
if (!option.data) {
return undefined
}
return h('div', { class: 'flex items-center gap-2 pr-2' }, [
h(
NButton,
{
text: true,
size: 'tiny',
type: 'info',
onClick: () => showDetailsMubiao(option.data),
},
{ default: () => '详情' }
),
option.data.targetType === '丙' &&
2024-12-09 06:44:52 +00:00
h(
NButton,
{
text: true,
size: 'tiny',
type: 'info',
2025-01-23 01:05:13 +00:00
onClick: () => showOrHideDdConfig(option.data),
2024-12-09 06:44:52 +00:00
},
2025-01-23 01:05:13 +00:00
{ default: () => '试验配置' }
2024-12-09 06:44:52 +00:00
),
2025-01-23 01:05:13 +00:00
option.data.targetType !== '丙' &&
2024-12-09 06:44:52 +00:00
h(
NButton,
{
text: true,
size: 'tiny',
type: 'info',
onClick: () => showOrHideHisTraj(option.data),
},
{ default: () => '轨迹回放' }
),
2025-01-23 01:05:13 +00:00
])
2024-12-09 06:44:52 +00:00
}
</script>
<template>
<div class="flex flex-col gap-2 w-h-full">
<!-- <heat-map /> -->
<!-- <div class="flex items-center gap-2">
<div class="whitespace-nowrap">国别</div>
<n-select v-model:value="country" :options="countryOptions" />
<div class="whitespace-nowrap">性质</div>
<n-select v-model:value="type" :options="typeOptions" />
</div>
<div class="flex items-center gap-2">
<div class="whitespace-nowrap">类型</div>
<n-select v-model:value="type" :options="typeOptions" />
</div> -->
<!-- <n-data-table
class="flex-1"
:columns="columns"
:data="data"
:row-key="(rowData: Record<string, any>) => rowData.id"
flex-height
@update:checked-row-keys="handleCheck"
/> -->
<div class="h-0 flex-1">
2025-01-23 01:05:13 +00:00
<tree
:data="data"
:key-field="'dataId'"
:label-field="'nodeName'"
v-model:checked="checkedKeys"
showSearch
:renderSuffix="renderSuffix"
/>
2024-12-09 06:44:52 +00:00
</div>
<!-- :nodeProps="nodeProps" -->
</div>
</template>
<style lang="scss" scoped></style>