月球大数据地理空间分析展示平台-【中台】
Surpriseplus
2023-06-14 a7ceb07fdcbcac1edcecb8c96bfa7808ea7670c5
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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
<template>
  <Popup
    ref="pop"
    :title="form.title"
    left="calc(100% - 330px)"
  >
    <div class="undergroundModel">
      <el-form
        ref="form"
        :model="form"
        label-width="100px"
      >
        <el-form-item class="nolabel-form-item">
          <el-form-item
            class="inline-form-item"
            label="地下模式"
          >
            <el-switch
              v-model="form.open"
              @change="openChange"
            > </el-switch>
          </el-form-item>
          <el-form-item
            class="inline-form-item"
            label="地下格网"
          >
            <el-switch
              v-model="form.grid"
              @change="gridChange"
            > </el-switch>
          </el-form-item>
        </el-form-item>
        <el-form-item label="透明度">
          <el-slider
            v-model="form.alpha"
            :min="0"
            :max="100"
            @change="alphaChange"
          ></el-slider>
        </el-form-item>
        <el-form-item
          label="格网深度"
          v-if="form.grid"
        >
          <el-slider
            v-model="form.depth"
            :min="0"
            :max="300"
            @change="depthChange"
          ></el-slider>
        </el-form-item>
      </el-form>
    </div>
  </Popup>
</template>
<script>
import Popup from "./Popup.vue";
 
export default {
  name: "undergroundModel",
  components: {
    Popup,
  },
  data() {
    return {
      form: {
        title: "地下模式",
        open: false,
        grid: false,
        alpha: 50,
        depth: 100,
      },
    };
  },
  methods: {
    // 关闭弹窗
    close() {
      this.form.open = false;
      this.openChange()
      this.$refs.pop.close();
    },
    // 打开弹窗
    open() {
      this.$refs.pop.open();
      this.form.open = true;
      this.openChange()
    },
    // 开关开关
    openChange() {
      let value = this.form.alpha / 100;
      if (this.form.open == 1) {
        // this.$notify({
        //   title: "地下模式",
        //   message: "地下模式已开启",
        //   type: "success",
        //   duration: "3000",
        // });
        window.UndergroundMode = window.sgworld.Analysis.UndergroundMode(true, value);
        window.UndergroundMode.grid = this.form.grid;
        window.UndergroundMode.depth = this.form.depth;
      } else {
        window.sgworld.Analysis.UndergroundMode(false, value);
        window.UndergroundMode = null;
        // this.$notify({
        //   title: "地下模式",
        //   message: "地下模式已关闭",
        //   duration: "3000",
        // });
      }
    },
    // 开关开关
    gridChange() {
      window.UndergroundMode && (window.UndergroundMode.grid = this.form.grid);
      // if (this.form.grid) {
      //   this.$notify({
      //     title: "地下模式",
      //     message: "开启地下格网",
      //     type: "success",
      //     duration: "3000",
      //   });
      // } else {
      //   this.$notify({
      //     title: "地下模式",
      //     message: "关闭地下格网",
      //     duration: "3000",
      //   });
      // }
    },
    // 滑块儿值调整
    alphaChange() {
      let value = this.form.alpha / 100;
      window.UndergroundMode && (window.UndergroundMode.alpha = value);
    },
    // 滑块儿值调整
    depthChange() {
      let value = this.form.depth;
      window.UndergroundMode && (window.UndergroundMode.depth = value);
    },
  },
};
</script>
<style lang="less">
</style>