From c4dfc001d0914774ca9ec4b49823c12c65cd74ef Mon Sep 17 00:00:00 2001 From: web <candymxq888@outlook.com> Date: 星期二, 03 六月 2025 11:06:12 +0800 Subject: [PATCH] fix:修改视频设置参数 --- src/views/screen/flow/graphic/index.vue | 417 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 415 insertions(+), 2 deletions(-) diff --git a/src/views/screen/flow/graphic/index.vue b/src/views/screen/flow/graphic/index.vue index 6893c19..228ed16 100644 --- a/src/views/screen/flow/graphic/index.vue +++ b/src/views/screen/flow/graphic/index.vue @@ -1,13 +1,426 @@ <script setup> +import {onMounted, ref} from "vue"; +import {getUserType} from '@/utils/auth.js' +import {getFlowPointList} from '@/api/screen/index' +import {getFlowVideoData} from '@/api/screen/graphic/index.js' +import {useRoute, useRouter} from "vue-router"; +import VideoPlayer from "@/components/VideoPlayer/VideoPlayer.vue"; +import html2canvas from 'html2canvas'; +const route = useRoute(); +const router = useRouter(); + +const menuList = ref([]) +const userType = ref(getUserType()) +const searchVal = ref('') +const playerData = ref([]) +const showFullScreen = ref(false) +const fullIndex = ref() + +// 全屏弹窗 +const handleFullScreen = (index) => { + fullIndex.value = index + showFullScreen.value = true +} +const closeFullScreen = () => { + showFullScreen.value = false +} + +// 抓拍 +const handleSnap = async (index) => { + const dom = document.getElementById(`player${index}`) + const canvas = await html2canvas(dom, { + backgroundColor: null, // 透明背景 + scale: 2, // 提高分辨率 + logging: false, // 关闭日志 + useCORS: true, // 允许跨域图片 + allowTaint: true, // 允许污染图片 + }); + const imgUrl = canvas.toDataURL('image/png'); + const adom = document.createElement("a"); + adom.download = `截图_${new Date().getTime()}.png` + adom.href = imgUrl; + adom.click() +} + +// 获取监控点菜单 +const getMoitorList = () => { + getFlowPointList().then(res => { + menuList.value = res.data + }) +} + +// 选择菜单 +const handleSelect = (id) => { + playerData.value = [] + getPlayerList(id) +} + +// 搜索 +const handleSearch = () => { + playerData.value = [] + getPlayerList() +} + +// 获取监控点 +const getPlayerList = async (id) => { + getFlowVideoData({pointId: id, pointName: searchVal.value}).then(async res => { + playerData.value = res.data + }) +} + + +onMounted(() => { + getMoitorList() + getPlayerList(route.params.id || '') +}) </script> <template> - <div> - 图像监测 + <div class="graphic"> + <div class="graphic-menu"> + <div class="menu-t">监控点列表</div> + <el-menu class="el-menu" @select="handleSelect"> + <template v-for="(item, index) in menuList" :key="index+1"> + <template v-if="item?.childrenList?.length === 0"> + <el-menu-item :index="item.id">{{ item.pointName }}</el-menu-item> + </template> + <template v-else> + <el-sub-menu :index="item.id"> + <template #title> + <span>{{ item.pointName }}</span> + </template> + <el-menu-item v-for="(child, cidx) in item.childrenList" :key="cidx" :index="child.id"> + {{ child.pointName }} + </el-menu-item> + </el-sub-menu> + </template> + </template> + </el-menu> + </div> + <div class="graphic-monitor"> + <div class="monitor-tool"> + <div class="tool-l"> + <el-input v-model="searchVal" style="width: 20rem" placeholder="请输入监测点名称" clearable/> + <el-button @click="handleSearch"> + <el-icon> + <Search/> + </el-icon> + 搜索 + </el-button> + <el-button style="margin-left: 0" v-if="userType === '1'" @click="router.push('/monitorList')"> + <el-icon> + <Plus/> + </el-icon> + 新增 + </el-button> + </div> + </div> + <div class="monitor-box"> + <div class="monitor-list"> + <div class="item" v-for="(item, index) in playerData" :key="index"> + <div class="title">{{ item.pointName }}</div> + <div class="item-video" :id="`player${index}`"> + <VideoPlayer :item="item" :autoPlay="true" /> + </div> + <div class="info"> + <div class="info-list"> + <div class="info-item"> + <div class="name">水位:</div> + <div class="val"><span>{{ item.waterLevel }}</span>m</div> + </div> + <div class="info-item"> + <div class="name">表面流速:</div> + <div class="val"><span>{{ item.flowVelocity }}</span>m/s</div> + </div> + <div class="info-item"> + <div class="name">水面宽度:</div> + <div class="val"><span>{{ item.waterWidth }}</span>m</div> + </div> + <div class="info-item"> + <div class="name">平均流速:</div> + <div class="val"><span>{{ item.avgVelocity }}</span>m/s</div> + </div> + <div class="info-item"> + <div class="name">过水面积:</div> + <div class="val"><span>{{ item.waterArea }}</span>m³</div> + </div> + <div class="info-item"> + <div class="name">雷达流速:</div> + <div class="val"><span>{{ item.radarVelocity }}</span>m/s</div> + </div> + <div class="info-item"> + <div class="name">实时流量:</div> + <div class="val"><span>{{ item.newFlow }}</span>m³/h</div> + </div> + <div class="info-item"> + <div class="name">起点距:</div> + <div class="val"><span>{{ item.radarDistance }}</span>m</div> + </div> + </div> + <div class="info-btn"> + <div class="fullScreen" v-if="item.url" @click="handleFullScreen(index)"> + <img src="@/assets/images/flow/screenIconWhite.png" alt="" /> + 全屏 + </div> + <el-button style="width: 6rem" @click="handleSnap(index)">抓拍</el-button> + </div> + </div> + </div> + </div> + </div> + </div> + + <div class="fullDialog" v-if="showFullScreen"> + <VideoPlayer :item="playerData[fullIndex]" :autoPlay="true" /> + <div class="closeIcon" @click="closeFullScreen"><el-icon><CircleClose /></el-icon></div> + <div class="full-mask"> + <div class="mask-list"> + <div class="mask-item"> + <div class="name">水位:</div> + <div class="val"><span>{{ playerData[fullIndex].waterLevel }}</span>m</div> + </div> + <div class="mask-item"> + <div class="name">表面流速:</div> + <div class="val"><span>{{ playerData[fullIndex].flowVelocity }}</span>m/s</div> + </div> + <div class="mask-item"> + <div class="name">水面宽度:</div> + <div class="val"><span>{{ playerData[fullIndex].waterWidth }}</span>m</div> + </div> + <div class="mask-item"> + <div class="name">平均流速:</div> + <div class="val"><span>{{ playerData[fullIndex].avgVelocity }}</span>m/s</div> + </div> + <div class="mask-item"> + <div class="name">过水面积:</div> + <div class="val"><span>{{ playerData[fullIndex].waterArea }}</span>m³</div> + </div> + <div class="mask-item"> + <div class="name">雷达流速:</div> + <div class="val"><span>{{ playerData[fullIndex].radarVelocity }}</span>m/s</div> + </div> + <div class="mask-item"> + <div class="name">实时流量:</div> + <div class="val"><span>{{ playerData[fullIndex].newFlow }}</span>m³/h</div> + </div> + <div class="mask-item"> + <div class="name">起点距:</div> + <div class="val"><span>{{ playerData[fullIndex].radarDistance }}</span>m</div> + </div> + </div> + </div> + </div> </div> </template> <style scoped lang="scss"> +.graphic { + height: 100%; + display: flex; + &-menu { + flex-shrink: 0; + width: 20%; + height: 100%; + padding: 10px 0; + background: linear-gradient(135deg, #91BDDB 0%, #9EC2DB 99%); + overflow-y: scroll; + + &::-webkit-scrollbar { + display: none; + } + + .menu-t { + height: 40px; + line-height: 40px; + padding-left: 20px; + font-size: 26px; + color: #fff; + background: url("@/assets/images/flow/monitor-title-bg.png") no-repeat; + background-size: 100% 100%; + } + + .el-menu { + background-color: transparent; + border-right: none; + + :deep(.el-menu) { + background-color: transparent; + } + + :deep(.el-sub-menu__title:hover) { + background-color: rgba(0, 0, 0, 0.06); + } + + :deep(.el-menu-item.is-active) { + color: #fff; + } + } + } + + &-monitor { + flex-shrink: 0; + width: 80%; + height: 100%; + + .monitor-tool { + width: 100%; + height: 60px; + padding: 0 30px; + background: linear-gradient(90deg, #91BDDB 0%, #DADFE3 100%); + display: flex; + align-items: center; + justify-content: space-between; + + .tool-l { + display: flex; + align-items: center; + gap: 1rem; + + .name { + font-size: 1.1rem; + } + } + } + + .monitor-box { + height: calc(100% - 60px); + background: linear-gradient(180deg, #91BDDB 0%, rgba(102, 102, 102, 0.5) 100%); + + .monitor-list { + height: 100%; + display: flex; + align-items: center; + justify-content: space-between; + padding: 0 30px; + + .item { + width: 48%; + height: 96%; + background: rgba(23, 108, 229, 0.3); + border: 1px solid #176CE5; + padding: 20px; + border-radius: 8px; + + .title { + height: 12%; + text-align: center; + font-size: 42px; + color: #fff; + } + + .item-video { + width: 100%; + height: 60%; + background-color: #000; + } + + .info { + width: 100%; + height: 25%; + display: flex; + margin-top: 20px; + + .info-list { + width: 80%; + display: flex; + flex-wrap: wrap; + color: #fff; + font-size: 20px; + + .info-item { + width: 50%; + padding: 8px 0; + flex-shrink: 0; + display: flex; + align-items: center; + + .name { + width: 100px; + } + + .val{ + display: flex; + align-items: center; + span { + display: inline-block; + width: 6rem; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + } + } + } + } + + .info-btn { + width: 15%; + padding: 1rem 0; + position: relative; + :deep(.el-button) { + color: #fff; + background: rgba(94, 229, 92, 0.6); + border-radius: 4px 4px 4px 4px; + border: 1px solid rgba(94, 229, 92, 0.6); + position: absolute; + bottom: 1rem; + } + .fullScreen{ + width: 100%; + height: 50px; + display: flex; + align-items: center; + justify-content: center; + color: #fff; + img{ + width: 25px; + margin-right: 10px; + } + } + } + } + } + } + } + } + + .fullDialog{ + position: fixed; + left: 0; + top: 0; + z-index: 200; + width: 100%; + height: 100%; + background-color: #000; + .closeIcon{ + position: absolute; + right: 20px; + top: 20px; + color: #fff; + font-size: 36px; + } + .full-mask{ + position: absolute; + left: 100px; + bottom: 100px; + width: 250px; + height: 270px; + background-color: rgba(0, 0, 0, 0.5); + border-radius: 20px; + .mask-list{ + padding: 10px 20px; + .mask-item{ + display: flex; + align-items: center; + color: #fff; + padding: 5px 0; + .name{ + width: 50%; + } + } + } + } + } +} </style> \ No newline at end of file -- Gitblit v1.9.3