无人机管理后台前端(已迁走)
张含笑
2025-10-29 db2ed7285a4b485140a30f2ec79e5e8661c13e98
feat:编辑数据
3 files modified
31 ■■■■ changed files
src/views/layerManagement/components/leftList.vue 2 ●●●●● patch | view | raw | blame | history
src/views/layerManagement/components/rightEdit.vue 17 ●●●●● patch | view | raw | blame | history
src/views/layerManagement/index.vue 12 ●●●●● patch | view | raw | blame | history
src/views/layerManagement/components/leftList.vue
@@ -156,6 +156,8 @@
// 新增围栏
const addFence = () => {
  layerParams.value.addNest = true;
  console.log('layerParams.value',layerParams.value);
};
// 新增文件夹
const addFolder = () => {};
src/views/layerManagement/components/rightEdit.vue
@@ -58,6 +58,7 @@
</template>
<script setup>
import { deitFenceApi } from '@/api/layer/index';
const emit = defineEmits([ 'callParentMethod']);
const layerParams = inject('layerParams');
const formData = ref({
@@ -75,7 +76,7 @@
detailData.value = layerParams.value.editDetailData
const totalArea = layerParams.value.total_area
const totalCount = layerParams.value.total_count
console.log('layerParams',layerParams
console.log('layerParams',detailData.value
);
const cancelHandel = () => {
@@ -84,6 +85,20 @@
   emit('callParentMethod');
};
const submitHandle = () => {
    const params={
    folder_id:detailData.value.folder_id,
    id:detailData.value.id,
    name:detailData.value.name,
    description:detailData.value.description,
    is_enabled: detailData.value.is_enabled,
    area:detailData.value.area,
    altitude:detailData.value.altitude,
    geo_data: layerParams.value.polygonPosition,
    }
deitFenceApi(params).then(res=>{
  console.log('保存',res);
})
  layerParams.value.addNest = false;
  layerParams.value.editNest = false;
   emit('callParentMethod');
src/views/layerManagement/index.vue
@@ -60,6 +60,7 @@
  editDetailData: null,
  total_count: 0,
  total_area: 0,
  polygonPosition:null,
});
provide('layerParams', layerParams);
const handleClick = tab => {
@@ -68,13 +69,10 @@
  activeName.value = clickedTab.name;
};
let tbJwdList = [];
const selectDataList = ref([]);
// 编辑区域
// 编辑围栏区域
const handleEdit = val => {
  console.log('编辑数据', val);
  layerParams.value.editDetailData = val;
  drawPolygonExample.editThePatch(true);
  const positions = parseGeoDataToPositions(val.geo_data, val.altitude);
@@ -228,9 +226,9 @@
  }
  let polygon = curPolygonPosition.map(item => [item?.lng, item?.lat]);
  polygon.push([curPolygonPosition[0]?.lng, curPolygonPosition[0]?.lat]);
  console.log('绘制的多边形顶点坐标(Cartesian3):', polygon);
  console.log('转换后的经纬度坐标:', curPolygonPosition);
  // console.log('绘制的多边形顶点坐标(Cartesian3):', polygon);
layerParams.value.polygonPosition = polygon
  console.log('polygon', layerParams.value.polygonPosition);
};
const throttleLoadPlanarRoute = throttle(loadPlanarRoute, 200);
drawPolygonExample.subscribe('getPolygonPositions', data => {