lixuliang
2024-04-18 b5c4921d0828500379502a916a2ccf2d9d4acc96
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" :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 "@tools/Popup.vue";
let UndergroundMode;
export default {
  name: "undergroundModel",
  components: {
    Popup,
  },
  data() {
    return {
      form: {
        title: "地下模式",
        open: false,
        grid: false,
        alpha: 50,
        depth: 100,
      },
    };
  },
  methods: {
    // 关闭弹窗
    close() {
      this.$refs.pop.close();
    },
    // 打开弹窗
    open() {
      this.$refs.pop.open();
    },
    // 开关开关
    openChange() {
      let value = this.form.alpha / 100;
      if (this.form.open == 1) {
        this.$notify({
          title: "地下模式",
          message: "地下模式已开启",
          type: "success",
          duration: "3000",
        });
        UndergroundMode = window.sgworld.Analysis.UndergroundMode(true, value);
        UndergroundMode.grid = this.form.grid;
        UndergroundMode.depth = this.form.depth;
      } else {
        window.sgworld.Analysis.UndergroundMode(false, value);
        UndergroundMode = null;
        this.$notify({
          title: "地下模式",
          message: "地下模式已关闭",
          duration: "3000",
        });
      }
    },
    // 开关开关
    gridChange() {
      UndergroundMode && (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;
      UndergroundMode && (UndergroundMode.alpha = value);
    },
    // 滑块儿值调整
    depthChange() {
      let value = this.form.depth;
      UndergroundMode && (UndergroundMode.depth = value);
    },
  },
};
</script>
<style lang="less">
</style>