智慧园区前端大屏
shuishen
2025-09-15 17a81d641608545682e3f79f7c6090cac48fe81a
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
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
<!--
 * @Author: shuishen 1109946754@qq.com
 * @Date: 2023-03-13 14:54:26
 * @LastEditors: shuishen 1109946754@qq.com
 * @LastEditTime: 2025-08-06 00:07:03
 * @FilePath: \jsProject\bigScreen\src\views\rim\components\box\dataContent.vue
 * @Description: 
 * 
 * Copyright (c) 2023 by ${git_name_email}, All Rights Reserved. 
-->
<script setup>
const { VITE_APP_BASE } = import.meta.env
import { Search, Refresh, Download } from '@element-plus/icons-vue'
import { useMap } from 'store/map'
import EventBus from 'utils/bus'
import { getEmePool, getNearbySupplies } from "@/api/base"
import { nextTick, onBeforeUnmount, onUnmounted, reactive, watch } from "vue"
const store = useMap()
const loading = ref(false)
const TableContent = ref(null)
const curTableHeight = ref(0)
const regionVal = ref(100)
const panoramaShow = ref(false)
const panoramaTitle = ref('')
const panoramaUrl = ref('')
 
const tableData = ref([])
 
const typeList = [
    {
        type: 1,
        backgroundIcon: VITE_APP_BASE + 'img/mapicon/yjc.png',
        className: 'yjc-box',
    },
    {
        type: 2,
        backgroundIcon: VITE_APP_BASE + 'img/mapicon/yjc.png',
        className: 'yjc-box',
    },
    {
        type: 3,
        backgroundIcon: VITE_APP_BASE + 'img/mapicon/ysf.png',
        className: 'ysf-box',
    },
    {
        type: 4,
        backgroundIcon: VITE_APP_BASE + 'img/mapicon/zb.png',
        className: 'sk-box',
    },
    {
        type: 5,
        backgroundIcon: VITE_APP_BASE + 'img/mapicon/sd.png',
        className: 'xfs-box',
    },
    {
        type: 6,
        backgroundIcon: VITE_APP_BASE + 'img/mapicon/kt.png',
        className: 'sk-box',
    },
    {
        type: 8,
        backgroundIcon: VITE_APP_BASE + 'img/mapicon/ql.png',
        className: 'xfs-box',
    },
]
 
let yjwzImg = VITE_APP_BASE + 'img/mapicon/yjwz.png'
 
onMounted(() => {
    curTableHeight.value = TableContent.value.offsetHeight
    EventBus.emit('flyToyqfw', 'flyToyqfw')
    EventBus.emit('destroyPop', 'destroyPop')
})
 
const searchClick = () => {
    getLists()
}
 
const tabList = ref([
    {
        ind: 0,
        title: '应急空间',
        select: false,
    },
    {
        ind: 1,
        title: '应急物资',
        select: false,
    }
])
 
const curTabInd = ref(0)
const tabClick = (item) => {
    tabList.value.forEach(i => i.select = false)
 
    item.select = true
    curTabInd.value = item.ind
 
    getLists()
}
 
let addTileLayers = null
// 查询分页数据
const getLists = () => {
    loading.value = true
    tableData.value = []
 
    if (!addTileLayers) {
        addTileLayers = new DC.HtmlLayer('addTileLayers')
        window.$viewer.addLayer(addTileLayers)
    } else {
        addTileLayers.clear()
    }
 
    if (curTabInd.value === 1) {
        getNearbySupplies({
            distance: regionVal.value,
            latitude: store.rimPosition.lat.toFixed(6),
            longitude: store.rimPosition.lng.toFixed(6)
        })
            .then((res) => {
                const data = res.data.data
 
                data.filter(i => i.lng && i.lng != '' && i.lat && i.lat != '').forEach(i => {
                    i.panoramicUrl = i.url
 
                    if (i.type === 2) {
                        let iconEl = `
                            <div class="map-name">${i.name}</div>
                                <div class="map-icon">
                                <img src="${yjwzImg}">
                            </div>
                            `
                        let divIcon = new DC.DivIcon(
                            new DC.Position(i.lng, i.lat, i.ele || 64),
                            `<div class="public-map-popup  qyfb-box yjwz-height-box ">
                                ${iconEl}
                            </div>`
                        )
                        divIcon.attrParams = i
 
                        let incident = (e) => {
                            const { attrParams } = e.overlay
 
                            if (
                                attrParams.panoramicUrl && attrParams.panoramicUrl.length > 0
                            ) {
                                panoramaTitle.value = attrParams.name
                                panoramaUrl.value = attrParams.panoramicUrl
                                panoramaShow.value = true
 
                                return
                            }
                        }
 
                        divIcon.on(DC.MouseEventType.CLICK, incident)
 
                        addTileLayers.addOverlay(divIcon)
                    }
                })
 
                tableData.value = data
                loading.value = false
            })
            .catch((err) => {
                loading.value = false
                console.log(err)
            })
    } else {
        getEmePool({
            distance: regionVal.value,
            latitude: store.rimPosition.lat.toFixed(6),
            longitude: store.rimPosition.lng.toFixed(6)
        })
            .then((res) => {
                const data = res.data.data
 
                data.filter(i => i.lng && i.lng != '' && i.lat && i.lat != '').forEach(i => {
                    i.firmName = i.firmName ? i.firmName : '瑞昌工业园'
                    let iconEl = ''
                    let divclassName = ''
                    let flag = typeList.find(l => l.type == i.type)
 
                    if (flag) {
                        divclassName = flag.className
                        if (flag.backgroundIcon) {
                            iconEl = `
                        <div class="map-name">${i.name}</div>
                        <div class="map-icon">
                            <img src="${flag.backgroundIcon}">
                        </div>
                        `
                        }
                        let divIcon = new DC.DivIcon(
                            new DC.Position(i.lng, i.lat, i.ele || 64),
                            `<div class="public-map-popup ${divclassName}">
                            ${iconEl}
                        </div>`
                        )
                        divIcon.attrParams = i
                        addTileLayers.addOverlay(divIcon)
                    }
                })
 
                tableData.value = data
                loading.value = false
            })
            .catch((err) => {
                loading.value = false
                console.log(err)
            })
    }
}
 
nextTick(() => {
    tabClick(tabList.value[0])
})
 
watch(() => store.rimPosition, () => {
    getLists()
})
 
const closePanoramaPopup = () => {
    panoramaShow.value = false
}
 
onBeforeUnmount(() => {
    if (addTileLayers) {
        addTileLayers.clear()
        window.$viewer && window.$viewer.removeLayer(addTileLayers)
 
        addTileLayers = null
    }
})
 
// 行点击
function rowClick (row, column, event) {
    if (row.lng && row.lat) {
        window.$viewer.flyToPosition(new DC.Position(row.lng, row.lat, 600, 0, -90, 0))
    }
}
</script>
 
<template>
    <div class="w100 h0 flex-1 flex f-d-c cur-container">
        <div class="location">
            <div class="point-box"><span>经度:</span><span>{{ store.rimPosition.lng.toFixed(6) }}</span></div>
            <div class="point-box"><span>纬度:</span><span>{{ store.rimPosition.lat.toFixed(6) }}</span></div>
 
            <div class="set-region">
                <span>范围:</span>
                <span>
                    <el-input v-model="regionVal" type="number" :size="'small'" placeholder="请输入范围" />m
                </span>
            </div>
 
            <div class="btn">
                <el-button :type="'primary'" :size="'small'" :icon="Search" @click="searchClick">
                </el-button>
            </div>
        </div>
 
        <div class="tab-list">
            <div :class="{ active: item.select }" v-for="item, index in tabList" :key="index" @click="tabClick(item)">{{
                item.title }}</div>
        </div>
        <!-- <global-search :options="options" @searchBtn="searchBtn" @resetBtn="resetBtn" ref="SeachBarCondition"></global-search> -->
 
        <div class="h0 flex-1 table-content" ref="TableContent" v-loading="loading"
            element-loading-background="rgba(46, 81, 136, 0.9)">
            <el-table empty-text="暂无数据" @row-click="rowClick" border :data="tableData" :height="curTableHeight"
                style="width: 100%">
                <el-table-column align="center" label="ID" width="42" prop="rank">
                    <template #default="{ $index, row }">
                        {{ $index + 1 }}
                    </template>
                </el-table-column>
                <el-table-column align="center" show-overflow-tooltip prop="firmName" label="企业名称" />
                <el-table-column align="center" show-overflow-tooltip prop="name" label="名称" />
            </el-table>
        </div>
 
        <panorama v-show="panoramaShow" :title="panoramaTitle" :url="panoramaUrl"
            @closePanoramaPopup="closePanoramaPopup">
        </panorama>
    </div>
</template>
 
<style lang="scss" scoped>
.el-form-item__label {
    color: #fff !important;
}
 
.table-content {
    flex-basis: auto;
    height: calc(100% - 40px);
}
 
.cur-container {
    color: #fff;
 
    .location {
        padding: 4px 6px;
        display: flex;
        gap: 4px;
 
        .point-box {
            flex: 1;
        }
 
        .set-region {
            display: flex;
            width: 112px;
 
            span {
                display: flex;
                white-space: nowrap;
            }
 
            ::v-deep(.el-input) {
                .el-input__wrapper {
                    background: rgba(135, 158, 199, 0.2);
                    box-shadow: inset 0px 3px 7px 0px rgba(42, 138, 236, 0.949);
                    border-radius: 4px 4px 4px 4px;
                    border: 1px solid #4081CB;
                }
 
                input {
                    color: #D4E8F8;
                }
            }
        }
 
        ::v-deep(.el-button) {
            background: #277DFF;
            border-color: #277DFF;
 
            &.reset-btn {
                color: #D4E8F8;
                background: #43779B;
                border-color: #43779B;
            }
        }
 
        div {
            display: flex;
        }
    }
 
    .tab-list {
        margin: 8px 6px;
        display: flex;
 
        >div {
            flex: 1;
            display: flex;
            justify-content: center;
            align-items: center;
            background: rgb(103, 135, 214) !important;
            line-height: 32px;
            cursor: pointer !important;
 
            &.active {
                background: #409eff !important;
            }
        }
    }
}
</style>