From c6159b0a5a424250adeca1bc2b475da5324fe038 Mon Sep 17 00:00:00 2001 From: web <candymxq888@outlook.com> Date: 星期五, 18 四月 2025 17:16:30 +0800 Subject: [PATCH] fix:对接报表数据 --- src/views/screen/flow/graphic/index.vue | 263 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 260 insertions(+), 3 deletions(-) diff --git a/src/views/screen/flow/graphic/index.vue b/src/views/screen/flow/graphic/index.vue index 6893c19..4d3ba4d 100644 --- a/src/views/screen/flow/graphic/index.vue +++ b/src/views/screen/flow/graphic/index.vue @@ -1,13 +1,270 @@ <script setup> +import {onMounted, ref} from "vue"; +import {getUserType} from '@/utils/auth.js' +import html2canvas from "html2canvas"; +import {getFlowPointList} from '@/api/screen/index' + +const menuList = ref([]) +const userType = ref(getUserType()) +const monitorRef = ref() +const searchVal = ref('') +const video = ref() + +// 全屏操作 +const handleFullScreen = () => { + monitorRef.value.requestFullscreen() +} + +// 抓拍 +const handleSnap = () => { + if(video.value) { + html2canvas(video.value).then(canvas => { + const link = document.createElement("a"); + link.href = canvas.toDataURL("image/png"); + link.download = '截图.png'; + link.click() + }) + } +} + +const handleSearch = async () => { +} + + +// 获取监控点 +const getMoitorList = () => { + getFlowPointList().then(res => { + menuList.value = res.data + }) +} + + +onMounted(() => { + getMoitorList() +}) </script> <template> - <div> - 图像监测 + <div class="graphic"> + <div class="graphic-menu"> + <div class="menu-t">监控点列表</div> + <el-menu class="el-menu"> + <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="请输入监测点名称" /> + <el-button @click="handleSearch"><el-icon><Search /></el-icon>搜索</el-button> + <el-button style="margin-left: 0" v-if="userType === '1'"><el-icon><Plus /></el-icon>新增</el-button> + </div> + <div class="tool-r" @click="handleFullScreen"> + <img src="@/assets/images/flow/fullscreen.png" /> + 全屏 + </div> + </div> + <div class="monitor-box" ref="monitorRef"> + <div class="monitor-list"> + <div class="item"> + <div class="title">新扎口流量监测点</div> + <div class="videoBox" ref="video"></div> + <div class="info"> + <div class="info-list"> + <div class="info-item"> + <div class="name">水位:</div> + <div class="val"><span>2332</span>m</div> + </div> + <div class="info-item"> + <div class="name">表面流速:</div> + <div class="val"><span>4.5</span>m/s</div> + </div> + <div class="info-item"> + <div class="name">水面宽度:</div> + <div class="val"><span>100</span>m</div> + </div> + <div class="info-item"> + <div class="name">平均流速:</div> + <div class="val"><span>4.5</span>m/s</div> + </div> + <div class="info-item"> + <div class="name">过水面积:</div> + <div class="val"><span>30</span>㎡</div> + </div> + <div class="info-item"> + <div class="name">雷达流速:</div> + <div class="val"><span>4.5</span>m/s</div> + </div> + <div class="info-item"> + <div class="name">实时流速:</div> + <div class="val"><span>120</span>㎡/s</div> + </div> + <div class="info-item"> + <div class="name">起点距:</div> + <div class="val"><span>500</span>m</div> + </div> + </div> + <div class="info-btn"> + <el-button style="width: 6rem" @click="handleSnap">抓拍</el-button> + </div> + </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; + } + } + .tool-r{ + display: flex; + align-items: center; + img{ + width: 25px; + margin-right: 10px; + } + } + } + .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; + } + .videoBox{ + 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 span{ + display: inline-block; + padding: 0 20px; + } + } + } + .info-btn{ + width: 20%; + padding: 1rem 0; + display: flex; + align-items: flex-end; + :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); + } + } + } + } + } + } + } +} </style> \ No newline at end of file -- Gitblit v1.9.3