123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277 |
- <template>
- <div class="right-menu">
- <div class="menu-container">
- <div style="position: relative;margin-top: 60px;">
- <div ref="scrollListRef" :class="!menuState.showMenu ? 'menu-list' : 'menu-list menu-list-right'">
- <div
- v-for="(item, index) in menuState.menuData"
- :key="index"
- :class="menuState.activeIndex === index ? 'menu-item menu-active' : 'menu-item'"
- @click="clickMenu(index)"
- >
- <div :class="item.meta?.icon + ' ' + item.meta?.icon + '_checked'"></div>
- <div class="gradient-text text">{{ item.name }}</div>
- </div>
- </div>
- <div :class="menuState.showMenu ? 'right-btn' : 'left-btn'" @click="clickContractMenu"></div>
- <div v-show="menuState.menuData.length > 7" class="btn-box">
- <div class="up-btn" @click="clickBtn('up')"></div>
- <div class="down-btn" @click="clickBtn('down')"></div>
- </div>
- </div>
- <div v-show="menuState.showMenu" class="menu-content">
- <!--图层分析-->
- <LayerAnalysis v-if="menuState.showMenu && menuState.menuData[menuState.activeIndex]?.name === '图层分析'" :pointType="pointType" />
- <!--空间分析-->
- <SpatialAnalysis v-if="menuState.showMenu && menuState.menuData[menuState.activeIndex]?.name === '空间分析'" @handleMenu="handleMenu" />
- <!--江湖河库-->
- <Reservoir v-if="menuState.showMenu && menuState.menuData[menuState.activeIndex]?.name === '江湖河库'" />
- <!--路网视频-->
- <RoadNetworkVideo v-if="menuState.showMenu && menuState.menuData[menuState.activeIndex]?.name === '路网视频'" />
- <!--水库监测-->
- <ReservoirMonitor v-if="menuState.showMenu && menuState.menuData[menuState.activeIndex]?.name === '水库监测'" />
- <!--河道监测-->
- <RiverMonitor v-if="menuState.showMenu && menuState.menuData[menuState.activeIndex]?.name === '河道监测'" />
- <!--无人机-->
- <RiverMonitor v-if="menuState.showMenu && menuState.menuData[menuState.activeIndex]?.name === '河道监测'" />
- <!--实时标绘-->
- <OnlinePlotting
- v-if="menuState.showMenu && menuState.menuData[menuState.activeIndex]?.name === '实时标绘'"
- :mouseToolState="mouseToolState"
- :drawing="drawing"
- @updateDrawing="updateDrawing"
- />
- </div>
- </div>
- </div>
- </template>
- <script lang="ts" setup name="rightMenu">
- import RiverMonitor from './RiverMonitor.vue';
- import ReservoirMonitor from './ReservoirMonitor.vue';
- import RoadNetworkVideo from './RoadNetworkVideo.vue';
- import Reservoir from './Reservoir.vue';
- import SpatialAnalysis from '@/views/globalMap/RightMenu/SpatialAnalysis.vue';
- import LayerAnalysis from '@/views/globalMap/RightMenu/LayerAnalysis.vue';
- import OnlinePlotting from '@/views/globalMap/RightMenu/OnlinePlotting.vue';
- import { PointType } from '@/api/globalMap/type';
- interface Props {
- pointType: PointType[];
- }
- withDefaults(defineProps<Props>(), {});
- const emits = defineEmits(['update:drawing']);
- const scrollListRef = ref();
- const menuState = reactive({
- showMenu: false,
- activeIndex: 0,
- menuData: [{ name: '图层分析', meta: { icon: 'icon1' } }]
- });
- const activeName = computed(() => {
- let name = '';
- if (!!menuState.menuData && menuState.menuData.length > 0 && !!menuState.menuData[menuState.activeIndex]) {
- name = menuState.menuData[menuState.activeIndex].name;
- }
- return name;
- });
- // 点击收缩展开
- const clickContractMenu = () => {
- menuState.showMenu = !menuState.showMenu;
- };
- // 菜单上下移动
- const clickBtn = (direction: string) => {
- const len = menuState.menuData.length;
- if (direction === 'up' && scrollListRef.value.scrollTop - 168 >= 0) {
- scrollListRef.value.scrollTop -= 168;
- } else if (direction === 'down' && scrollListRef.value.scrollTop + 168 <= 168 * len) {
- scrollListRef.value.scrollTop += 168;
- }
- };
- // 点击菜单
- const clickMenu = (index) => {
- menuState.showMenu = true;
- menuState.activeIndex = index;
- };
- // 显示菜单
- const handleMenu = (name) => {
- let index = menuState.menuData.findIndex((item) => {
- return item.name === name;
- });
- if (index > -1) {
- clickMenu(index);
- }
- };
- // 新增菜单 type 1 新增 2 删除
- const updateMenu = (type, menu) => {
- if (type === '1') {
- menuState.menuData.push(menu);
- clickMenu(menuState.menuData.length - 1);
- } else if (type === '2') {
- let index = menuState.menuData.findIndex((item) => item.name === menu.name);
- if (index > -1) {
- menuState.menuData.splice(index, 1);
- menuState.activeIndex = 0;
- }
- }
- };
- const updateDrawing = (value: boolean) => {
- emits('update:drawing', value);
- };
- defineExpose({ handleMenu, clickContractMenu, updateMenu });
- </script>
- <style lang="scss" scoped>
- .right-menu {
- position: absolute;
- top: 100px;
- right: 0;
- }
- .expand-btn {
- width: 70px;
- height: 240px;
- font-size: 32px;
- background: #d7d7d7;
- padding: 10px 18px;
- cursor: pointer;
- display: flex;
- align-items: center;
- }
- .menu-container {
- display: flex;
- .menu-list-right {
- margin-right: -115px;
- }
- .menu-list {
- position: relative;
- max-height: 1176px;
- overflow: hidden;
- .menu-item {
- width: 470px;
- height: 168px;
- font-size: 32px;
- padding: 30px 18px 10px 40px;
- cursor: pointer;
- display: flex;
- align-items: center;
- background: url('@/assets/images/map/rightMenu/box.png') no-repeat;
- .text {
- font-size: 48px;
- }
- &:hover {
- background: url('@/assets/images/map/rightMenu/box_checked.png') no-repeat;
- }
- }
- .menu-active {
- background: url('@/assets/images/map/rightMenu/box_checked.png') no-repeat;
- }
- }
- .left-btn,
- .right-btn {
- position: absolute;
- top: 50%;
- right: -150px;
- transform: translateY(-50%);
- z-index: 2;
- }
- .right-btn {
- width: 177px;
- height: 151px;
- cursor: pointer;
- background: url('@/assets/images/map/rightMenu/right.png') no-repeat;
- cursor: pointer;
- }
- .left-btn {
- right: 20px;
- width: 125px;
- height: 151px;
- background: url('@/assets/images/map/rightMenu/left.png') no-repeat;
- cursor: pointer;
- }
- .btn-box {
- width: 100%;
- display: flex;
- margin-left: 45px;
- .up-btn {
- width: 151px;
- height: 178px;
- background: url('@/assets/images/map/rightMenu/up.png') no-repeat;
- cursor: pointer;
- }
- .down-btn {
- height: 177px;
- width: 151px;
- background: url('@/assets/images/map/rightMenu/down.png') no-repeat;
- cursor: pointer;
- }
- }
- .menu-content {
- width: 1643px;
- height: 1369px;
- background: url('@/assets/images/map/rightMenu/content.png') no-repeat;
- padding: 130px 20px 20px 130px;
- font-size: 36px;
- position: relative;
- }
- }
- .icon1 {
- width: 99px;
- height: 92px;
- background: url('@/assets/images/map/rightMenu/icon2.png') no-repeat;
- cursor: pointer;
- }
- .icon1_checked {
- background: url('@/assets/images/map/rightMenu/icon2_checked.png') no-repeat;
- }
- .icon2 {
- width: 99px;
- height: 92px;
- background: url('@/assets/images/map/rightMenu/icon2.png') no-repeat;
- cursor: pointer;
- }
- .icon2_checked {
- background: url('@/assets/images/map/rightMenu/icon2_checked.png') no-repeat;
- }
- .icon3 {
- width: 92px;
- height: 92px;
- background: url('@/assets/images/map/rightMenu/icon3.png') no-repeat;
- cursor: pointer;
- }
- .icon3_checked {
- background: url('@/assets/images/map/rightMenu/icon3_checked.png') no-repeat;
- }
- .icon4 {
- width: 90px;
- height: 85px;
- background: url('@/assets/images/map/rightMenu/icon4.png') no-repeat;
- cursor: pointer;
- }
- .icon4_checked {
- background: url('@/assets/images/map/rightMenu/icon4_checked.png') no-repeat;
- }
- .icon5 {
- width: 91px;
- height: 82px;
- background: url('@/assets/images/map/rightMenu/icon5.png') no-repeat;
- cursor: pointer;
- }
- .icon5_checked {
- background: url('@/assets/images/map/rightMenu/icon5_checked.png') no-repeat;
- }
- .icon6 {
- width: 89px;
- height: 87px;
- background: url('@/assets/images/map/rightMenu/icon6.png') no-repeat;
- cursor: pointer;
- }
- .icon6_checked {
- background: url('@/assets/images/map/rightMenu/icon6_checked.png') no-repeat;
- }
- </style>
|