巡查组件优化

main
userName 2025-04-29 13:27:32 +08:00
parent 38f4ec7e79
commit 9aa4fbba6e
3 changed files with 79 additions and 60 deletions

View File

@ -151,11 +151,14 @@ const getAreaListData=(id)=>{
}
const lisClick=(e)=>{
EventBus.emit('clockinlistsenddata' , e);
entityArr.value.forEach(item =>{
let graphic = window.graphicLayer.getGraphicById(item);
window.graphicLayer.removeGraphic(graphic);
})
entityArr.value = []
if(entityArr.value.length>0){
entityArr.value.forEach(item =>{
let graphic = window.graphicLayer.getGraphicById(item);
window.graphicLayer.removeGraphic(graphic);
})
entityArr.value = []
}
handlerAddEntity(e)
}
@ -172,9 +175,8 @@ const handlerAddEntity = (data) => {
}
}
entityArr.value.push(data.Id)
let graphic = window.graphicLayer.getGraphicById(data.Id);
let graphic = new mars3d.graphic.BillboardEntity(graphicOptions);
graphic = new mars3d.graphic.BillboardEntity(graphicOptions);
window.graphicLayer.addGraphic(graphic);
window.globalMap.flyToGraphic(graphic,{radius:300});
}

View File

@ -38,6 +38,7 @@ import { PropType, toRefs, ref, onMounted } from 'vue'
import { CreateComponentType } from '@/packages/index.d'
import * as mars3d from "mars3d";
import axios from 'axios'
import { message } from 'ant-design-vue';
import { getAppEnvConfig } from '@/utils/env'
var { VITE_GLOB_API_URL } = getAppEnvConfig();
@ -59,11 +60,13 @@ const {
headerData
} = toRefs(props.chartConfig.option)
const goflyaddress=(e)=>{
entityArr.value.forEach(item =>{
let graphic = window.graphicLayer.getGraphicById(item);
window.graphicLayer.removeGraphic(graphic);
})
entityArr.value = []
if(entityArr.value.length > 0){
entityArr.value.forEach(item =>{
let graphic = window.graphicLayer.getGraphicById(item);
window.graphicLayer.removeGraphic(graphic);
})
entityArr.value = []
}
handlerAddEntity(e)
}
// Entity
@ -78,18 +81,19 @@ const handlerAddEntity = (data) => {
}
}
entityArr.value.push(data.CreateId)
let graphic = window.graphicLayer.getGraphicById(data.CreateId);
let graphic = new mars3d.graphic.BillboardEntity(graphicOptions);
graphic = new mars3d.graphic.BillboardEntity(graphicOptions);
window.graphicLayer.addGraphic(graphic);
window.globalMap.flyToGraphic(graphic,{radius:300});
}
const rotateLine = (data)=>{
polyLineArr.value.forEach(item =>{
let graphic = window.graphicLayer.getGraphicById(item);
window.graphicLayer.removeGraphic(graphic);
})
polyLineArr.value = []
if(polyLineArr.value.length > 0){
polyLineArr.value.forEach(item =>{
let graphic = window.graphicLayer.getGraphicById(item);
window.graphicLayer.removeGraphic(graphic);
})
polyLineArr.value = []
}
axios({
method: "get",
url: VITE_GLOB_API_URL + '/api/FirePatrol/GetPatrolPointByTime',
@ -102,24 +106,28 @@ const rotateLine = (data)=>{
}).then(res => {
let rel = res.data.result
let positionsArr = []
rel.forEach(item =>{
let arr = []
arr.push(item.lng,item.lat)
positionsArr.push(arr)
})
const graphic = new mars3d.graphic.PolylineEntity({
id: data.CreateId,
positions: positionsArr,
style: {
color: '#25F8EE',
depthFail: true,
opacity: 1,
},
attr: { remark: "轨迹" },
flyTo: true
})
window.graphicLayer.addGraphic(graphic)
polyLineArr.value.push(data.CreateId)
if(rel.length > 0){
rel.forEach(item =>{
let arr = []
arr.push(item.lng,item.lat)
positionsArr.push(arr)
})
const graphic = new mars3d.graphic.PolylineEntity({
id: data.createId,
positions: positionsArr,
style: {
color: '#25F8EE',
depthFail: true,
opacity: 1,
},
attr: { remark: "轨迹" },
flyTo: true
})
window.graphicLayer.addGraphic(graphic)
polyLineArr.value.push(data.createId)
}else{
message.warning('暂无巡查轨迹');
}
})
}
const getListData=()=>{

View File

@ -81,6 +81,7 @@ import { PropType, toRefs, ref, onMounted } from 'vue'
import { CreateComponentType } from '@/packages/index.d'
import { EventBus } from '@/utils/eventBus'
import axios from 'axios'
import { message } from 'ant-design-vue';
import { getAppEnvConfig } from '@/utils/env'
var { VITE_GLOB_API_URL } = getAppEnvConfig();
@ -116,11 +117,14 @@ const dateChange = (e)=>{
dateRange.value = e
}
const rotateLine = (data)=>{
polyLineArr.value.forEach(item =>{
let graphic = window.graphicLayer.getGraphicById(item);
window.graphicLayer.removeGraphic(graphic);
})
polyLineArr.value = []
if(polyLineArr.value.length > 0){
polyLineArr.value.forEach(item =>{
let graphic = window.graphicLayer.getGraphicById(item);
window.graphicLayer.removeGraphic(graphic);
})
polyLineArr.value = []
}
axios({
method: "get",
url: VITE_GLOB_API_URL + '/api/FirePatrol/GetPatrolPointByTime',
@ -135,24 +139,29 @@ const rotateLine = (data)=>{
}).then(res => {
let rel = res.data.result
let positionsArr = []
rel.forEach(item =>{
let arr = []
arr.push(item.lng,item.lat)
positionsArr.push(arr)
})
const graphic = new mars3d.graphic.PolylineEntity({
id: data.createId,
positions: positionsArr,
style: {
color: '#25F8EE',
depthFail: true,
opacity: 1,
},
attr: { remark: "轨迹" },
flyTo: true
})
window.graphicLayer.addGraphic(graphic)
polyLineArr.value.push(data.createId)
if(rel.length > 0){
rel.forEach(item =>{
let arr = []
arr.push(item.lng,item.lat)
positionsArr.push(arr)
})
const graphic = new mars3d.graphic.PolylineEntity({
id: data.createId,
positions: positionsArr,
style: {
color: '#25F8EE',
depthFail: true,
opacity: 1,
},
attr: { remark: "轨迹" },
flyTo: true
})
window.graphicLayer.addGraphic(graphic)
polyLineArr.value.push(data.createId)
}else{
message.warning('暂无巡查轨迹');
}
})
}
const circleGeom = (data) =>{