<!-- Description: 场站管理-视频轮询 Author: 李亚光 Date: 2024-09-05 --> <script lang="ts" setup name="StationDeviceVideo"> import { toTreeList } from '@/utils/structure' import { getDeptTreeList } from '@/api/system/dept' import { getDeptStation } from '@/api/home/station/station' const loadingTree = ref<boolean>(false) const defaultProps = { children: 'children', label: 'name', } const treeData = ref<any[]>([]) // 点击树形结构 const handleNodeClick = (data: any) => { if (data.id === 'station') { // 点击的设备(加载视频) console.log('station') } } // 获取组织列表树数据 const fetchTreeData = () => { loadingTree.value = true getDeptTreeList({ deptType: '' }).then((res) => { getDeptStation({}).then((res1) => { const data = res1.data.map((item: any) => ({ ...item, checked: false, code: '', id: 'station', name: `${item.LEDGER_NAME}云台`, open: false, pCodes: '', pid: item.DEPTID, value: '', })) console.log(data) treeData.value = toTreeList([...res.data, ...data], '0', true) loadingTree.value = false }) }).catch(() => { loadingTree.value = false }) } fetchTreeData() </script> <template> <app-container style="overflow: hidden;"> <div class="container"> <!-- 左侧组织机构 --> <div class="left-container"> <div class="dept-div"> <el-card class="box-card" shadow="always"> <template #header> <div class="clearfix"> <!-- <div>监控点列表</div> --> <el-input placeholder="请输入搜索内容" /> </div> </template> <el-scrollbar height="100%" class="user-dept-scroll"> <el-tree v-loading="loadingTree" :data="treeData" :props="defaultProps" default-expand-all :expand-on-click-node="false" @node-click="handleNodeClick" /> </el-scrollbar> </el-card> </div> </div> <!-- 右侧表格 --> <div ref="tableContainer" class="table"> <el-card class="box-card" shadow="always"> <div style="display: flex;flex-wrap: wrap;justify-content: space-around;"> <video v-for="item in 4" :key="item" class="video" :class="`${item <= 2 ? 'mar-bottom' : ''}`" src="" controls autoplay /> </div> </el-card> </div> </div> </app-container> </template> <style lang="scss" scoped> // 样式 .container { width: 100%; display: flex; .left-container { width: 22%; } :deep(.el-radio__label) { display: none; } .table { width: 78%; } } .video { width: 49%; height: 40vh; } .mar-bottom { margin-bottom: 8px; } .dept-div { padding-right: 12px; :deep(.el-card) { height: 85vh; background-color: #fff; } .box-card { width: 100%; .user-dept-scroll { width: 100%; height: calc(100vh - 120px); } } } </style>