gerson
2025-02-09 84167d13f951358315d13609de426ebb318a3c9a
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
<template>
    <div class="flex">
        <!-- <div class="size-2 border border-solid " >
                <span class="ywifont ywicon ywicon-liebiao"></span>
            </div> -->
 
        <div class="flex flex-col gap-2 translate-y-20">
            <div class="size-8 rounded flex-center cursor-pointer bg-[#fcfcfc] font-thin " :title="fullScreenTitle" @click="toggleFullScreen">
                <span class="ywifont ywicon !text-[26px]" :class="[`ywicon-${fullScreenIcon}`]"></span>
            </div>
            <div
                v-for="item in Object.keys(mapPanelToolMap)"
                :key="item"
                class="size-8 rounded flex-center cursor-pointer border border-solid border-[#494949] bg-[#fcfcfc]"
                :class="{
                    '!bg-[#1676fd]': item === activeMapToolPanel,
                    'text-white': item === activeMapToolPanel,
                    'hover:text-[#1676fd]': item !== activeMapToolPanel,
                    'hover:border-[#1676fd]': item !== activeMapToolPanel,
                }"
                :title="mapPanelToolMap[item]"
                @click="mapToolPanelClick(item as any)"
            >
                <span class="ywifont ywicon" :class="[`ywicon-${mapPanelToolMapIcon[item].name}`]"></span>
            </div>
        </div>
        <div class="shadow h-full">
            <PropertyPanel
                ref="propertyPanelRef"
                v-show="activeMapToolPanel === MapPanelTool.Property"
                @close="propertyPanelClose"
                :propertyMap="propertyMap"
                :propertyConfigMap="propertyConfigMap"
                class="p-3 w-[280px] h-full gap-1.5"
            ></PropertyPanel>
 
            <LayerControl class="p-3 w-[280px] h-full gap-1.5" v-show="activeMapToolPanel === MapPanelTool.Layer" :olMap="olMap" @close="propertyPanelClose"></LayerControl>
            <ThemeControl class="p-3 w-[280px] h-full gap-1.5" v-show="activeMapToolPanel === MapPanelTool.Theme" :olMap="olMap" @close="propertyPanelClose"></ThemeControl>
        </div>
    </div>
</template>
 
<script setup lang="ts" name="PanelTool">
import { computed, ref } from 'vue';
import { useTextOverflow } from '/@/hooks/useOverflow';
import PropertyPanel from './PropertyPanel.vue';
import { MapPanelTool, mapPanelToolMap, mapPanelToolMapIcon } from '../types';
import { useCompRef } from '/@/utils/types';
import ThemeControl from './ThemeControl.vue';
 
import LayerControl from './LayerControl.vue';
const props = defineProps(['propertyMap', 'propertyConfigMap', 'olMap','isFullscreen']);
const activeMapToolPanel = ref<MapPanelTool>();
 
 
const fullScreenTitle = computed(() => (props.isFullscreen ? '退出全屏(Esc)' : '全屏展开'));
const fullScreenIcon = computed(() => (props.isFullscreen ? 'tuichuquanping' : 'fullscreen'));
 
const emit = defineEmits(['toggleFullScreen']);
const mapToolPanelClick = (type: MapPanelTool) => {
    activeMapToolPanel.value = activeMapToolPanel.value === type ? null : type;
    switch (type) {
        case MapPanelTool.Property:
            break;
 
        default:
            break;
    }
};
 
const toggleFullScreen = () => {
    emit('toggleFullScreen');
};
const propertyPanelRef = useCompRef(PropertyPanel);
 
const propertyPanelClose = () => {
    activeMapToolPanel.value = null;
};
 
const featureClick = (feature) => {
    // if (activeMapToolPanel.value !== MapPanelTool.Property) return;
    propertyPanelRef.value?.featureClick(feature);
};
 
const setActivePanel = (type: MapPanelTool) => {
    activeMapToolPanel.value = type;
};
 
defineExpose({
    featureClick,
    setActivePanel
});
</script>
<style scoped lang="scss"></style>