riku
2025-03-20 3970cefa60ea7e5d899b7475345b65646c19c110
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
144
145
<template>
  <el-row class="wrap">
    <el-col span="2">
      <el-row>
        <CardButton
          name="网格样式"
          direction="left"
          @click="() => (show = !show)"
        ></CardButton>
      </el-row>
    </el-col>
    <el-col span="2">
      <BaseCard v-show="show" direction="right" borderless="r">
        <template #content>
          <div class="content-wrap">
            <div v-for="(g, i) in gridCtrlList" :key="i">
              {{ g.name }}
              <div v-for="(value, t) in g.views" :key="t">
                <!-- {{ value[0] }} -->
                {{ value[1].extData.name }}
                <!-- {{ key }} -->
                <!-- <el-text>{{ g.name }}</el-text> -->
                <!-- <div class="m-t-8">网格要素</div> -->
                <el-row class="m-t-8">
                  <CheckButton
                    active-text="显示网格"
                    inactive-text="隐藏网格"
                    :default-value="true"
                    @change="handleGridClick"
                  >
                  </CheckButton>
                  <CheckButton
                    active-text="显示排名"
                    inactive-text="隐藏排名"
                    :default-value="false"
                    @change="handleGridClick"
                  >
                  </CheckButton>
                  <CheckButton
                    active-text="显示数据"
                    inactive-text="隐藏数据"
                    :default-value="false"
                    @change="handleGridClick"
                  >
                  </CheckButton>
                </el-row>
                <el-row class="m-b-8" gap="2">
                  <div class="m-t-8">网格透明度</div>
                  <el-slider
                    v-model="opacityValue"
                    :min="0"
                    :max="1"
                    :step="0.1"
                    show-stops
                    @change="handleOpacityChange"
                    style="width: 200px"
                  />
                </el-row>
              </div>
            </div>
          </div>
        </template>
      </BaseCard>
    </el-col>
  </el-row>
</template>
<script setup>
/**
 * 网格样式控制工具
 */
import { ref, watch, computed } from 'vue';
 
const props = defineProps({
  // 网格管理对象[SatelliteGrid]数组
  gridCtrls: {
    type: Array,
    default: () => []
  }
});
 
const gridCtrlList = computed(() => {
  return props.gridCtrls.map((g) => {
    return {
      name: g.name,
      views: Array.from(g.mapViewsMap)
    };
  });
});
 
// watch(
//   () => props.gridCtrls,
//   (nV, oV) => {
//     gridCtrlList.value = nV.map((v) => {
//       return Array.from(v.infoMap);
//     });
//   },
//   { deep: true }
// );
 
const show = ref(true);
 
const gridVisible = ref(false);
const rankVisible = ref(false);
const dataVisible = ref(false);
const isStandardColor = ref(true);
const isOpacity = ref(false);
const opacityValue = ref(0.7);
 
const emits = defineEmits([
  'showRank',
  'showData',
  'changeColor',
  'changeOpacity'
]);
 
function handleRankClick() {
  rankVisible.value = !rankVisible.value;
  emits('showRank', rankVisible.value);
}
 
function handleDataClick() {
  dataVisible.value = !dataVisible.value;
  emits('showData', dataVisible.value);
}
 
function handleColorClick() {
  isStandardColor.value = !isStandardColor.value;
  emits('changeColor', isStandardColor.value);
}
 
function handleOpacityClick() {
  // isOpacity.value = !isOpacity.value;
  // emits('changeOpacity', isOpacity.value);
}
 
function handleOpacityChange(value) {
  emits('changeOpacity', value);
}
</script>
<style scoped>
.content-wrap {
  min-width: 300px;
  min-height: 600px;
}
</style>