智慧园区前端大屏
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
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
<!--
 * @Author: shuishen 1109946754@qq.com
 * @Date: 2023-03-13 14:54:26
 * @LastEditors: shuishen 1109946754@qq.com
 * @LastEditTime: 2024-12-03 00:22:00
 * @FilePath: \bigScreen\src\views\companyInfo\components\box\fireTrend.vue
 * @Description:
 *
 * Copyright (c) 2023 by ${git_name_email}, All Rights Reserved.
-->
<script setup>
import publicContent from "./publicContent.vue"
import { getList, getCompanyList } from "@/api/emergencySupplies/emergencySupplies"
import { reactive } from "vue"
 
const { VITE_APP_BASE } = import.meta.env
 
let image = ref(VITE_APP_BASE + 'img/mapicon/yjwz.png')
 
const panoramaShow = ref(false)
const panoramaTitle = ref('')
const panoramaUrl = ref('')
const TableContent = ref(null)
const curTableHeight = ref(0)
const loading = ref(false)
 
const tableData = ref([])
const pages = {
  page: 1,
  pageSize: 1000,
  total: 0,
}
 
let data = reactive({
  companyInfo: {}
})
 
onMounted(() => {
  curTableHeight.value = TableContent.value.offsetHeight
  data.companyInfo = JSON.parse(localStorage.getItem('companyInfo'))
  getLists()
})
 
// 搜索条件
const formInline = reactive({
  name: "",
  ownership: ''
})
 
// 提交查询
const onSubmit = () => {
  pages.page = 1
  pages.pageSize = 1000
  pages.total = 0
  getLists(formInline)
}
 
// 分页树改变
const handleSizeChange = (val) => {
  pages.pageSize = val
  getLists(formInline)
}
// 分页改变
const handleCurrentChange = (val) => {
  pages.page = val
  getLists(formInline)
}
// 重置条件
const clearBtn = () => {
  formInline.name = ''
  formInline.ownership = ''
  pages.page = 1
  pages.pageSize = 1000
  pages.total = 0
  getLists(formInline)
}
// 应急物资图片
let picList = ref([])
 
// 查询分页数据
function getLists (param = {}) {
  param.current = pages.page
  param.size = pages.pageSize
  param.firmId = data.companyInfo.id
  loading.value = true
  getCompanyList(param)
    .then((res) => {
      const data = res.data.data
      tableData.value = data.dataList
      picList.value = data.picList
      pages.total = data.total
      loading.value = false
      rowClick(tableData.value[0], '', '')
    })
    .catch((err) => {
      loading.value = false
      console.log(err)
    })
}
let addTileLayers = {}
let addPupoLayers = {}
 
// 行点击
function rowClick (row, column, event) {
  if (!row.lng || !row.lat) {
    return
  }
  // 销毁之前的
  destroy()
  if (!addTileLayers[row.name]) {
    addTileLayers[row.name] = new DC.HtmlLayer(row.name)
    window.$viewer.addLayer(addTileLayers[row.name])
    let iconEl = `
                <div class="map-name">${'应急物资'}</div>
                <div class="map-icon">
                  <img src="${image.value}">
                </div>
                `
    let divIcon = new DC.DivIcon(
      new DC.Position(row.lng, row.lat, row.ele || 64),
      `<div class="public-map-popup  qyfb-box yjwz-height-box ">
                    ${iconEl}
                  </div>`
    )
    divIcon.attrParams = row
    let incident = (e) => {
      const { attrParams } = e.overlay
 
      console.log(attrParams, 894654)
 
 
      if (
        attrParams.panoramicUrl && attrParams.panoramicUrl.length > 0 &&
        attrParams.panoramicUrl.indexOf("http://vr.jxpskj.com:180") != -1
      ) {
        let panoramicUrl = attrParams.panoramicUrl.replace(
          "http://vr.jxpskj.com:180",
          "/panorama"
        )
 
        panoramaTitle.value = attrParams.name
        panoramaUrl.value = panoramicUrl
        panoramaShow.value = true
 
        return
      }
 
 
      // 删除
      destroyPupoLayers()
      if (picList.value.length == 0) {
        return
      }
      addPupoLayers['企业应急物资'] = new DC.HtmlLayer('企业应急物资')
      window.$viewer.addLayer(addPupoLayers['企业应急物资'])
      let iconEl = `<div class="marsBlueGradientPnl">
            <img src="${picList.value[0].link}" />
                </div>`
      let divIcon = new DC.DivIcon(
        new DC.Position(attrParams.lng, attrParams.lat, attrParams.ele || 64),
        `<div class="public-map-popup-two">
                    ${iconEl}
                  </div>`
      )
      let incident = () => {
        destroyPupoLayers()
      }
      divIcon.on(DC.MouseEventType.CLICK, incident)
      addPupoLayers['企业应急物资'].addOverlay(divIcon)
    }
 
    divIcon.on(DC.MouseEventType.CLICK, incident)
 
    addTileLayers[row.name].addOverlay(divIcon)
    // })
    // })
  }
}
 
// 销毁
function destroy () {
  let arr = Object.keys(addTileLayers)
  arr.forEach(i => {
    addTileLayers[i] && window.$viewer && window.$viewer.removeLayer(addTileLayers[i])
    addTileLayers[i] = null
    delete addTileLayers[i]
  })
  addTileLayers = {}
}
// 销毁
function destroyPupoLayers () {
  let arr = Object.keys(addPupoLayers)
  arr.filter(i => i != 'hgyq').forEach(i => {
    addPupoLayers[i] && window.$viewer && window.$viewer.removeLayer(addPupoLayers[i])
    addPupoLayers[i] = null
    delete addPupoLayers[i]
  })
  addPupoLayers = {}
}
onUnmounted(() => {
  destroy()
  destroyPupoLayers()
  addTileLayers = null
  addPupoLayers = null
})
import { Search, Refresh } from '@element-plus/icons-vue'
 
const closePanoramaPopup = () => {
  panoramaShow.value = false
}
</script>
 
<template>
  <div class="search-box w100 h100 flex f-d-c">
    <el-form :inline="true" :model="formInline" class="demo-form-inline">
      <el-form-item label="" class="form-item-input">
        <el-input v-model="formInline.name" placeholder="请输入名称" clearable style="width: 120px" />
      </el-form-item>
      <el-form-item>
        <el-button type="primary" :icon="Search" @click="onSubmit">查 询</el-button>
        <el-button class="reset-btn" :icon="Refresh" @click="clearBtn">重 置</el-button>
      </el-form-item>
    </el-form>
 
    <!-- <global-search :options="options" @searchBtn="searchBtn" @resetBtn="resetBtn" ref="SeachBarCondition"></global-search> -->
    <div class="table-box h0 flex-1" ref="TableContent">
      <el-table empty-text="暂无数据" border :data="tableData" @row-click="rowClick" style="width: 100%"
        element-loading-background="rgba(122, 122, 122, 0.1)" :height="curTableHeight">
        <el-table-column prop="name" label="名称" width="240" />
        <el-table-column prop="numUnit" label="数量" />
        <el-table-column prop="personInCha" label="负责人" />
        <!-- <el-table-column label="操作">
          <template #default="scope">
            <el-button link type="primary" size="small" :disabled="scope.row.lng == ''"
              @click="rowClick(scope.row)">定位</el-button>
          </template>
</el-table-column> -->
      </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;
}
 
.reset-btn {
  color: #D4E8F8;
  background: #43779B;
  border-color: #43779B;
}
 
/* 当表格没有数据时,修改表格的背景颜色 */
.el-table--empty .el-table__body {
  background-color: rgba(135, 158, 199, 0.3) !important;
  /* 你想要的背景颜色 */
}
 
.form-item-input {
  width: 160px;
 
  ::v-deep(.el-input) {
    width: 0;
    flex: 1;
 
    .el-input__wrapper {
      font-size: 16px;
      font-weight: 400;
      border-radius: 5px;
      background: rgba(135, 158, 199, 0.3);
      box-shadow: inset 0px 3px 7px 0px rgba(42, 138, 236, 0.95);
 
      .el-input__inner {
        color: #BFD3E5;
      }
    }
  }
 
}
 
.search-btn {
  // ::v-deep .el-button--primary {
  //   background-color: transparent;
  //   border-color: none;
  //   border: none;
  //   cursor: pointer;
  //   color: #edffff;
  //   background: rgba(135, 158, 199, 0.3);
  //   box-shadow: inset 0px 3px 7px 0px rgba(42, 138, 236, 0.95);
  // }
}
</style>