suerprisePlus
2024-07-30 e5e65bb50cbfb973f98191993ab559767eff7a53
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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
<template>
    <Popup ref="pop" top="20px" left="calc(100% - 600px)" :maxHeight="'700px'" :title="title" @close="close(true)"
        width="300px" @cancel="close(false)">
        <div style="padding: 10px;">
            <div class="underGroundBox">
                <el-switch class="elSwitch" @change="setUnderGroundCheck" v-model="value1" active-text="地下模式">
                </el-switch>
 
                <!-- <div class="contentRight">
                    <el-switch class="elSwitch" v-model="value2" active-text="地下网格">
                    </el-switch>
                </div> -->
            </div>
            <div class="underGroundBox">
                <span>
                    透明度 :
                </span>
                <div class="contentRight">
                    <el-slider v-model="value3" @change="setAlphaChange" :format-tooltip="formatTooltip"></el-slider>
                </div>
 
            </div>
        </div>
 
 
    </Popup>
</template>
 
<script>
import Popup from '@/components/Tool/Popup.vue';
export default {
    name: 'location',
    components: { Popup },
    data() {
        return {
            title: '地下模式',
            value1: true,
            value2: false,
            value3: 50,
 
        };
    },
    methods: {
        // 关闭弹窗
        close(isCloseBtn, removeLayer = true) {
            //   removeLayer && this.removeImageLayer();
            // 重置data值
            this.value1 = false;
            this.value3 = 50;
            this.setUnderGroundCheck();
            this.setAlphaChange()
            Object.assign(this.$data, this.$options.data());
            !isCloseBtn && this.$refs.pop.close();
 
        },
        setUnderGroundCheck() {
            earthCtrl.camera.undergroundMode = this.value1
            earthCtrl.camera.imageryLayerAlpha = this.value3 / 100
        },
        // 打开弹窗
        open() {
            this.close(true);
            this.$refs.pop.open();
 
            this.setUnderGroundCheck();
        },
        formatTooltip(val) {
            return val + '%'
        },
        setAlphaChange() {
            earthCtrl.camera.imageryLayerAlpha = this.value3 / 100
        }
 
 
    },
};
</script>
 
<style lang="scss" scoped>
.elSwitch {
    ::v-deep.el-switch__core {
        border-radius: 10px !important;
        width: 40px !important;
        height: 20px;
    }
 
    ::v-deep.el-switch__core:after {
        width: 16px;
        height: 16px;
        border-radius: 100%;
 
    }
 
 
}
 
.underGroundBox {
    display: flex;
    margin-bottom: 10px;
    align-items: center;
 
    span {
        font-size: 14px;
    }
 
    .contentRight {
        flex: 1;
        margin-left: 10px;
    }
}
 
::v-deep .el-switch.is-checked .el-switch__core:after {
    margin-left: -17px;
 
}
</style>