智慧园区前端大屏
1
shuishen
2024-12-02 1dee40ea46601f2ee5d10aa0190625ebf03bdc4e
src/views/companyInfo/components/box/fireTrend.vue
@@ -2,8 +2,8 @@
 * @Author: shuishen 1109946754@qq.com
 * @Date: 2023-03-13 14:54:26
 * @LastEditors: shuishen 1109946754@qq.com
 * @LastEditTime: 2023-03-13 15:00:55
 * @FilePath: \forest-fire\src\views\statistics\components\box\dataContent.vue
 * @LastEditTime: 2024-11-28 19:28:35
 * @FilePath: \bigScreen\src\views\companyInfo\components\box\fireTrend.vue
 * @Description:
 *
 * Copyright (c) 2023 by ${git_name_email}, All Rights Reserved.
@@ -57,7 +57,6 @@
  pages.page = 1
  pages.pageSize = 1000
  pages.total = 0
  console.log("submit!")
  getLists(formInline)
}
@@ -84,7 +83,7 @@
let picList = ref([])
// 查询分页数据
function getLists(param = {}) {
function getLists (param = {}) {
  param.current = pages.page
  param.size = pages.pageSize
  param.firmId = data.companyInfo.id
@@ -96,6 +95,7 @@
      picList.value = data.picList
      pages.total = data.total
      loading.value = false
      rowClick(tableData.value[0], '', '')
    })
    .catch((err) => {
      loading.value = false
@@ -106,54 +106,52 @@
let addPupoLayers = {}
// 行点击
function rowClick(row, column, event) {
function rowClick (row, column, event) {
  if (!row.lng || !row.lat) {
    return
  }
  // console.log('点击了', row, column, event)
  // 销毁之前的
  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">${row.name}</div>
                <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, 64),
      `<div class="public-map-popup ${'qyfb-box'}">
      `<div class="public-map-popup  qyfb-box yjwz-height-box ">
                    ${iconEl}
                  </div>`
    )
    divIcon.attrParams = row
    let incident = (e) => {
      // const { attrParams } = e.overlay
      // // 删除
      // destroyPupoLayers()
      // if (picList.value.length == 0) {
      //   return
      // }
      // console.log('点击了', picList.value.length)
      // addPupoLayers[attrParams.name] = new DC.HtmlLayer(attrParams.name)
      // window.$viewer.addLayer(addPupoLayers[attrParams.name])
      // let iconEl = `<div class="marsBlueGradientPnl">
      //       <div>${attrParams.fullName}</div>
      //       <img src="${picList.value[0].link}" />
      //           </div>`
      // let divIcon = new DC.DivIcon(
      //   new DC.Position(attrParams.lng, attrParams.lat, 64),
      //   `<div class="public-map-popup-two">
      //               ${iconEl}
      //             </div>`
      // )
      // let incident = () => {
      //   destroyPupoLayers()
      // }
      // divIcon.on(DC.MouseEventType.CLICK, incident)
      // addPupoLayers[attrParams.name].addOverlay(divIcon)
      const { attrParams } = e.overlay
      // 删除
      destroyPupoLayers()
      if (picList.value.length == 0) {
        return
      }
      addPupoLayers['企业应急物资'] = new DC.HtmlLayer('企业应急物资')
      window.$viewer.addLayer(addPupoLayers['企业应急物资'])
      let iconEl = `<div class="marsBlueGradientPnl">
            <div>${attrParams.firmName}</div>
            <img src="${picList.value[0].link}" />
                </div>`
      let divIcon = new DC.DivIcon(
        new DC.Position(attrParams.lng, attrParams.lat, 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)
@@ -165,24 +163,30 @@
}
// 销毁
function destroy() {
function destroy () {
  let arr = Object.keys(addTileLayers)
  arr.forEach(i => {
    addTileLayers[i] && window.$viewer.removeLayer(addTileLayers[i])
    addTileLayers[i] && window.$viewer && window.$viewer.removeLayer(addTileLayers[i])
    addTileLayers[i] = null
    delete addTileLayers[i]
  })
  addTileLayers = {}
}
// 销毁
function destroyPupoLayers() {
function destroyPupoLayers () {
  let arr = Object.keys(addPupoLayers)
  arr.filter(i => i != 'hgyq').forEach(i => {
    addPupoLayers[i] && window.$viewer.removeLayer(addPupoLayers[i])
    addPupoLayers[i] && window.$viewer && window.$viewer.removeLayer(addPupoLayers[i])
    addPupoLayers[i] = null
    delete addPupoLayers[i]
  })
  addPupoLayers = {}
}
onUnmounted(() => {
  console.log('销毁***************************')
  destroy()
  destroyPupoLayers()
  addTileLayers = null
  addPupoLayers = null
})
import { Search, Refresh } from '@element-plus/icons-vue'
</script>
@@ -200,7 +204,7 @@
    </el-form>
    <!-- <global-search :options="options" @searchBtn="searchBtn" @resetBtn="resetBtn" ref="SeachBarCondition"></global-search> -->
    <div class="table-box">
      <el-table :data="tableData" @row-click="rowClick" empty-text="" style="width: 100%"
      <el-table empty-text="暂无数据" border :data="tableData" @row-click="rowClick" style="width: 100%"
        :header-cell-style="headerCellStyle" :cell-style="tableCellStyle"
        element-loading-background="rgba(122, 122, 122, 0.1)">
        <el-table-column prop="name" label="名称" width="240" />
@@ -211,7 +215,7 @@
            <el-button link type="primary" size="small" :disabled="scope.row.lng == ''"
              @click="rowClick(scope.row)">定位</el-button>
          </template>
        </el-table-column> -->
</el-table-column> -->
      </el-table>
    </div>
  </div>