无人机管理后台前端(已迁走)
张含笑
2025-08-28 df56c62977cbfc6eeea1a868055a20d8075af5c1
src/views/resource/components/spotDetails.vue
@@ -115,7 +115,7 @@
import { ref, watch, onBeforeUnmount, onMounted } from 'vue';
import FunButton from '@/views/resource/components/FunButton.vue';
const uploadPatchDialog = defineModel('show');
const props = defineProps(['title']);
const props = defineProps(['title','detailid']);
const polygonTableEle = ref(null);
let publicCesiumInstance = null;
let viewer = null;
@@ -160,11 +160,21 @@
  size: 20,
});
// 图斑管理表格
const getspotManagementTableApi =()=>{
  spotManagementTableApi(params).then(res => {
    console.log('管理表格数据',res);
const getTableList =()=>{
const params={
  patchesInfoId:props.detailid
}
  tableMapListApi(params).then(res => {
    console.log('地图表格数据',res.data.data);
     tableData.value = res.data.data
     // 先清空地图现有图斑
  tbJwdList = [];
  viewer?.entities.removeAll(); // 清除所有实体
  // 加载图斑
  entitiesAddSpot();
  })
}
const handleSizeChange = () => {};
const handleCurrentChange = () => {};
const tableData = ref([]);
@@ -183,21 +193,23 @@
  device_sn: '',
});
// 获取列表数据
const getTableList = async () => {
  tableData.value = [];
  const res = await getPatchesSpotList(polygonSearch.value);
  if (res.data.code !== 0) return;
  tableData.value = res.data.data.list.map(item => ({
    ...item,
    dkfw: item.sdfw && item.is_exception == 1 ? item.sdfw : item.dkfw,
  }));
  total.value = res.data.data.pagination.total;
  // 先清空地图现有图斑
  tbJwdList = [];
  viewer.entities.removeAll(); // 清除所有实体
  // 加载图斑
  entitiesAddSpot();
};
// const getTableList = async () => {
//   tableData.value = [];
//   const res = await getPatchesSpotList(polygonSearch.value);
//   if (res.data.code !== 0) return;
//   console.log('rrrrr',res.data.data);
//   tableData.value = res.data.data.list.map(item => ({
//     ...item,
//     dkfw: item.sdfw && item.is_exception == 1 ? item.sdfw : item.dkfw,
//   }));
//   total.value = res.data.data.pagination.total;
//   // 先清空地图现有图斑
//   tbJwdList = [];
//   viewer.entities.removeAll(); // 清除所有实体
//   // 加载图斑
//   entitiesAddSpot();
// };
// 地图
const initMap = () => {
@@ -233,8 +245,8 @@
    const color =
      item.is_exception == 2 ? Cesium.Color.RED.withAlpha(0.5) : Cesium.Color.YELLOW.withAlpha(0.5);
    const outlineColor = item.is_exception == 2 ? Cesium.Color.RED : Cesium.Color.YELLOW;
    viewInstance.value.removeById('polygon_dk' + item.id);
    homeViewer.value.entities?.add({
    viewInstance.value?.removeById('polygon_dk' + item.id);
    homeViewer.value?.entities?.add({
      id: 'polygon_dk' + item.id,
      customType: 'pattern_spot_polygon',
      customInfo: {
@@ -260,10 +272,10 @@
    if (tbJwdList.length > 0) {
      const positions = tbJwdList.flatMap(item => Cesium.Cartesian3.fromDegreesArray(item.grouped));
      homeViewer.value.camera.flyToBoundingSphere(new Cesium.BoundingSphere.fromPoints(positions));
      homeViewer.value?.camera.flyToBoundingSphere(new Cesium.BoundingSphere.fromPoints(positions));
    }
    viewInstance.value.removeLeftClickEvent('spotHighlighting');
    viewInstance.value.addLeftClickEvent(null, spotHighlighting, 'spotHighlighting');
    viewInstance.value?.removeLeftClickEvent('spotHighlighting');
    viewInstance.value?.addLeftClickEvent(null, spotHighlighting, 'spotHighlighting');
  });
};
@@ -370,6 +382,7 @@
    setTimeout(() => {
      initMap();
      getTableList();
    }, 0);
  } else {
    if (funButtonEle.value) {
@@ -380,7 +393,7 @@
  }
});
onMounted(()=>{
  getspotManagementTableApi()
})
onBeforeUnmount(() => {
  destroyMap();