From 78fde874f61e03447b8b3e062845be1a96ba4023 Mon Sep 17 00:00:00 2001 From: helloxujingliang <3225043@qq.com> Date: Thu, 27 Feb 2025 16:23:24 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AE=A1=E7=AE=97=E5=9B=BE=E6=96=91=E5=88=86?= =?UTF-8?q?=E5=89=B2=E9=9D=A2=E7=A7=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../MapList/SplitPolygonModal/index.vue | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/src/views/demo/tiankongdi/curbspotcity/MapList/SplitPolygonModal/index.vue b/src/views/demo/tiankongdi/curbspotcity/MapList/SplitPolygonModal/index.vue index 789a69e8..6893ee2b 100644 --- a/src/views/demo/tiankongdi/curbspotcity/MapList/SplitPolygonModal/index.vue +++ b/src/views/demo/tiankongdi/curbspotcity/MapList/SplitPolygonModal/index.vue @@ -907,7 +907,19 @@ import { itemProps } from '@/components/Menu/src/props'; splitPolygonForm.value?.splice(currentPolygon.value,1); splitAfterPolygon.value?.splice(currentPolygon.value,1); } + + + let sumArea = 0.0; e?.forEach((item, index) => { + var polygon = turf.polygon(item.geometry.coordinates); + + let are = (turf.area(polygon) / 666.67).toFixed(2); + + if(index == e.length-1){ + are = (parseFloat(area) - sumArea).toFixed(2); + } + sumArea = sumArea + are; + let form = { fid: null, unitname: '', @@ -921,14 +933,18 @@ import { itemProps } from '@/components/Menu/src/props'; yongjiujibennongtian_area: null, shengtaibaohuhongxian_area: null, guotukongjianguihua_area: null, - area: null, + area: are, geom: item, checked:false, }; + splitPolygonForm.value?.push(form); splitAfterPolygon.value?.push(form.geom) }); + + + // 分割完成后重新渲染面数据 let splitAfterFeatures = { type: 'FeatureCollection', @@ -936,6 +952,8 @@ import { itemProps } from '@/components/Menu/src/props'; }; splitPolygonForm.value?.forEach((item,idnex)=>{ + console.log("item.geom",item.geom); + splitAfterFeatures.features.push(item.geom); })