智慧园区前端大屏
shuishen
2024-12-18 9a37c5e1b2190c3f6ec71483923922189091dd52
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
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
<!--
 * @Author: shuishen 1109946754@qq.com
 * @Date: 2023-03-10 15:27:59
 * @LastEditors: shuishen 1109946754@qq.com
 * @LastEditTime: 2024-11-28 11:35:07
 * @FilePath: \bigScreen\src\views\space\components\leftContainer.vue
 * @Description:
 *
 * Copyright (c) 2023 by ${git_name_email}, All Rights Reserved.
-->
<script setup>
import EventBus from 'utils/bus'
 
import { getDictionary } from "@/api/dict/dict"
import { onUnmounted, reactive } from 'vue'
const resData = reactive({
  data: []
})
 
const gawList = ref([
  {
    label: '污水管网',
    value: "3-3-2",
    select: true
  },
  {
    label: '雨水管网',
    value: "3-3-4",
    select: false
  },
])
const curSelect = ref('')
 
// 获取下拉字典
const getDictData = (code) => {
  const param = {
    code: code,
  }
  getDictionary(param).then((res) => {
    resData.data = res.data.data.filter(i => i.dictKey != 7 && i.dictKey != 9 && i.dictKey != 11).map(item => {
      return {
        label: item.dictValue,
        value: item.dictKey
      }
    })
 
    tabClick(resData.data[0])
  })
}
 
const tabClick = (item) => {
  EventBus.emit('destroyPop', 'destroyPop')
  if (curSelect.value) {
    if (curSelect.value == '3') {
      EventBus.emit('restHandleDelChange', `3-3`)
      EventBus.emit('restHandleDelChange', `3-3-1`)
      EventBus.emit('restHandleDelChange', `3-3-2`)
      EventBus.emit('restHandleDelChange', `3-3-3`)
      EventBus.emit('restHandleDelChange', `3-3-4`)
    } else {
      gawList.value.forEach(element => {
        if (element.value == `3-3-2`) {
          element.select = true
        } else {
          element.select = false
        }
      });
      EventBus.emit('restHandleDelChange', `3-${curSelect.value}`)
    }
  }
  curSelect.value = item.value
  if (item.value == '3') {
    EventBus.emit('restHandleCheckChange', `3-3-2`)
  } else {
    EventBus.emit('restHandleCheckChange', `3-${item.value}`)
  }
  EventBus.emit('spaceTabChange', item.value)
  EventBus.emit('flyToyqfw', 'flyToyqfw')
}
 
const tabClickGW = (item) => {
  if (item.select) {
    EventBus.emit('restHandleDelChange', item.value)
    item.select = false
  } else {
    EventBus.emit('restHandleCheckChange', item.value)
    item.select = true
  }
}
 
const showOn = computed(() => (item) => {
  if (curSelect.value == item.value) {
    return true
  }
  return false
})
 
getDictData("emergency_space_type")
 
onUnmounted(() => {
  if (curSelect.value) EventBus.emit('restHandleDelChange', `3-${curSelect.value}`)
  EventBus.emit('restHandleDelChange', `3-3-1`)
  EventBus.emit('restHandleDelChange', `3-3-2`)
  EventBus.emit('restHandleDelChange', `3-3-3`)
  EventBus.emit('restHandleDelChange', `3-3-4`)
})
</script>
 
<template>
  <div>
    <div class="left-container cur-container">
      <div class="tablist h100">
        <div class="cursor-p" :class="{ on: showOn(item) }" v-for="item, index in resData.data" :key="index"
          @click="tabClick(item)">
          <div class="label-box">
            {{ item.label }}
          </div>
        </div>
      </div>
    </div>
    <div v-if="curSelect == '3'">
      <div class="cur-container-title">
        <div class="tablist">
          <div class="cursor-p" :class="{ on: item.select }" v-for="item, index in gawList" :key="index"
            @click="tabClickGW(item)">
            <div class="label-box">
              {{ item.label }}
            </div>
          </div>
        </div>
      </div>
    </div>
 
  </div>
</template>
 
<style lang="scss" scoped>
.left-container {
  width: auto;
}
 
.cur-container {
  background: transparent;
  pointer-events: none;
 
  .tablist {
    pointer-events: all;
 
    &>div {
      display: flex;
      align-items: center;
      justify-content: center;
      margin-top: 10px;
      padding: 8px;
      width: 64px;
      height: 48px;
 
      border-radius: 50%;
      box-shadow: inset 0 0 40px #409eff;
      color: #fff;
      box-sizing: content-box;
      font-size: 12px;
 
      &.on {
        position: relative;
        // color: #75b1ff;
        box-shadow: inset 0 0 100px #2a8ef1;
      }
 
      .label-box {
        padding: 8px;
        line-height: 20px;
        text-align: center;
      }
    }
  }
}
 
.cur-container-title {
  background: transparent;
  pointer-events: none;
  margin-left: 120px;
  margin-top: 120px;
 
  .tablist {
    pointer-events: all;
 
    &>div {
      display: flex;
      align-items: center;
      justify-content: center;
      margin-top: 10px;
      padding: 8px;
      width: 64px;
      height: 48px;
 
      color: #fff;
      border-radius: 50%;
      box-shadow: inset 0 0 40px #409eff;
      box-sizing: content-box;
      font-size: 12px;
 
      &.on {
        position: relative;
        // color: #75b1ff;
        box-shadow: inset 0 0 100px #2a8ef1;
      }
 
      .label-box {
        padding: 8px;
        line-height: 16px;
        text-align: center;
      }
    }
  }
}
</style>