智慧园区前端大屏
shuishen
2024-12-27 6f0c1938dff15c1625d97368786d2e93e293c32b
应急空间点位增加可编辑
4 files modified
136 ■■■■ changed files
src/api/space/space.js 27 ●●●●● patch | view | raw | blame | history
src/pages/map/components/scomponents/layersControl.vue 76 ●●●●● patch | view | raw | blame | history
src/store/map.js 9 ●●●● patch | view | raw | blame | history
src/views/space/components/box/dataContent.vue 24 ●●●● patch | view | raw | blame | history
src/api/space/space.js
@@ -1,30 +1,39 @@
import request from 'utils/http'
export const getDetail = (params) => {
    const url = `/yw/emergencySpace/getDetail`;
  const url = `/yw/emergencySpace/getDetail`
    return request({
        url,
        method: 'get',
        params,
    });
};
  })
}
export const getList = (params) => {
    const url = `/yw/emergencySpace/page`;
  const url = `/yw/emergencySpace/page`
    return request({
        url,
        method: 'get',
        params,
    });
};
  })
}
export const getGouQu = (params) => {
    const url = `/yw/emergencySpace/page`;
  const url = `/yw/emergencySpace/page`
    return request({
        url,
        method: 'get',
        params,
    });
};
  })
}
export const updateSpace = (data) => {
  const url = `/yw/emergencySpace/update`
  return request({
    url,
    method: 'post',
    data,
  })
}
src/pages/map/components/scomponents/layersControl.vue
@@ -2,7 +2,7 @@
 * @Author: shuishen 1109946754@qq.com
 * @Date: 2024-10-31 10:47:29
 * @LastEditors: shuishen 1109946754@qq.com
 * @LastEditTime: 2024-12-26 18:54:27
 * @LastEditTime: 2024-12-27 14:45:27
 * @FilePath: \bigScreen\src\pages\map\components\scomponents\layersControl.vue
 * @Description:
 *
@@ -70,7 +70,7 @@
import panorama from './popup/panorama.vue'
import { getPage } from '@/api/indParkInfo'
import { getPage as getfirmPage } from '@/api/firmInfo/firmInfo'
import { getList, getGouQu } from "@/api/space/space"
import { getList, getGouQu, updateSpace } from "@/api/space/space"
import { getList as getRiskList } from "@/api/riskSource/riskSource"
import { getPanoramaList } from "@/api/panorama/"
import yqfw from "@/assets/json/yqfw"
@@ -82,8 +82,13 @@
import EventBus from 'utils/bus'
import { usePointStore } from 'store/usepoint'
const pointStore = usePointStore()
import { useMap } from 'store/map'
const mapStore = useMap()
import { useRouter } from 'vue-router'
const router = useRouter()
import {
  ElMessage
} from 'element-plus'
const { VITE_APP_BASE } = import.meta.env
// , '7', 
@@ -662,6 +667,8 @@
  }
}
let moveEntity = null
const handleCheckChange = (data) => {
  let options = treeRef.value?.getCheckedNodes()
@@ -760,7 +767,11 @@
              if (item.incident) incident = item.incident
              divIcon.on(DC.MouseEventType.CLICK, incident)
              divIcon.on(DC.MouseEventType.CLICK, (e) => {
                moveEntity = e
                return
                incident(e)
              })
              addTileLayers[item.layerName].addOverlay(divIcon)
            })
@@ -966,6 +977,62 @@
EventBus.on('flyToyqfw', flyToyqfw)
EventBus.on('destroyPop', destroyPop)
let tooltip = window.$viewer.tooltip
const viewerMouseMove = (e) => {
  if (mapStore.editPoint) {
    if (moveEntity != null) {
      if (e.wgs84Position) {
        moveEntity.overlay.position = new DC.Position(e.wgs84Position.lng, e.wgs84Position.lat, e.wgs84Position.alt)
      } else {
        moveEntity.overlay.position = new DC.Position(e.wgs84SurfacePosition.lng, e.wgs84SurfacePosition.lat, e.wgs84SurfacePosition.alt)
      }
      tooltip.showAt({ x: e.windowPosition.x + 10, y: e.windowPosition.y }, '右键结束编辑')
    } else {
      tooltip.showAt({ x: e.windowPosition.x + 10, y: e.windowPosition.y }, '左键选中点位,开始编辑')
    }
  }
}
window.$viewer.on(DC.MouseEventType.MOUSE_MOVE, viewerMouseMove)
const viewerRightClick = (e) => {
  if (mapStore.editPoint && moveEntity != null) {
    tooltip.enable = false
    let lng, lat, ele
    const { attrParams } = moveEntity.overlay
    if (e.wgs84Position) {
      lng = e.wgs84Position.lng
      lat = e.wgs84Position.lat
      ele = e.wgs84Position.alt
    } else {
      lng = e.wgs84SurfacePosition.lng
      lat = e.wgs84SurfacePosition.lat
      ele = e.wgs84SurfacePosition.alt
    }
    updateSpace({
      id: attrParams.id,
      lng,
      lat,
      ele: Math.ceil(ele)
    }).then(res => {
      moveEntity = null
      mapStore.setEditPoint(false)
      ElMessage({
        message: '修改成功',
        type: 'success',
      })
    })
  }
}
window.$viewer.on(DC.MouseEventType.RIGHT_CLICK, viewerRightClick)
onMounted(() => {
  handleCheckChange(data.filter(i => indexPoint.value.includes(i.id)))
})
@@ -1054,6 +1121,9 @@
  destroyPop()
  addPopLayers = null
  window.$viewer && window.$viewer.off(DC.MouseEventType.MOUSE_MOVE, viewerMouseMove)
  window.$viewer && window.$viewer.off(DC.MouseEventType.RIGHT_CLICK, viewerRightClick)
  EventBus.off('restHandleCheckChange', restHandleCheckChange)
  EventBus.off('restHandleDelChange', restHandleDelChange)
  EventBus.off('flyToyqfw', flyToyqfw)
src/store/map.js
@@ -2,7 +2,7 @@
 * @Author: shuishen 1109946754@qq.com
 * @Date: 2024-10-28 18:24:16
 * @LastEditors: shuishen 1109946754@qq.com
 * @LastEditTime: 2024-11-19 18:03:04
 * @LastEditTime: 2024-12-27 14:09:03
 * @FilePath: \bigScreen\src\store\map.js
 * @Description: 
 * 
@@ -15,7 +15,8 @@
  // 存储状态的地方,相当于 Vuex 的 state
  state: () => ({
    loadMap: false,
    pointHeight: 64
    pointHeight: 64,
    editPoint: false,
  }),
  // 相当于 Vuex 的 getters,用于计算状态
@@ -28,5 +29,9 @@
    setLoadMap (flag) {
      this.loadMap = flag
    },
    setEditPoint (flag) {
      this.editPoint = flag
    }
  }
})
src/views/space/components/box/dataContent.vue
@@ -2,18 +2,20 @@
 * @Author: shuishen 1109946754@qq.com
 * @Date: 2023-03-13 14:54:26
 * @LastEditors: shuishen 1109946754@qq.com
 * @LastEditTime: 2024-11-28 19:30:58
 * @LastEditTime: 2024-12-27 14:43:43
 * @FilePath: \bigScreen\src\views\space\components\box\dataContent.vue
 * @Description:
 *
 * Copyright (c) 2023 by ${git_name_email}, All Rights Reserved.
-->
<script setup>
import { useMap } from 'store/map'
import EventBus from 'utils/bus'
import publicContent from "./publicContent.vue"
import { getList } from "@/api/space/space"
import { nextTick, onUnmounted, reactive } from "vue"
const store = useMap()
const SeachBarCondition = ref(null)
const loading = ref(false)
const TableContent = ref(null)
@@ -147,6 +149,16 @@
  }
}
let tooltip = window.$viewer.tooltip
// 当前点编辑
const editClick = (row) => {
  if (row.lng && row.lat) {
    window.$viewer.flyToPosition(new DC.Position(row.lng, row.lat, 300, 0, -90, 0))
    tooltip.enable = true
    store.setEditPoint(true)
  }
}
// 查看详情
function goDetail (row) { }
@@ -220,13 +232,15 @@
        <el-table-column show-overflow-tooltip prop="firmName" label="企业名称" />
        <el-table-column show-overflow-tooltip prop="name" label="名称" width="100" />
        <el-table-column prop="mainFuncName" label="作用" width="55" />
        <!-- <el-table-column align="center" width="62" label="操作">
        <el-table-column v-if="curSelectTabType != 9" align="center" width="62" label="操作">
          <template #default="scope">
            <el-button link type="primary" size="small" :disabled="scope.row.lng == ''" @click="rowClick(scope.row)">
              定位
            <el-button link type="primary" size="small" :disabled="scope.row.lng == ''"
              @click.stop="editClick(scope.row)">
              编辑
            </el-button>
          </template>
        </el-table-column> -->
        </el-table-column>
      </el-table>
    </div>