Browse Source

fix:修改bug

wangsisi 4 months ago
parent
commit
f6bf2f158b
2 changed files with 28 additions and 4 deletions
  1. 14 1
      src/views/authentic/authenticMap.js
  2. 14 3
      src/views/authentic/index.vue

+ 14 - 1
src/views/authentic/authenticMap.js

@@ -125,7 +125,6 @@ class AuthenticMap {
       if(!f){
         return false
       }
-      console.log(f)
       let res = f.get("id") === mapData.curPointData.id || !f.get("id")
       if(!res){
         ElMessage.warning("编辑中")
@@ -398,6 +397,20 @@ class AuthenticMap {
     return { geometryArr, area: area.toFixed(2) };
   }
 
+  getSinglePoint(){
+    let geometryArr = [];
+    let area = 0;
+    // 获取当前勾画完的地块  mapData.point
+    [mapData.point].forEach((item) => {
+      geometryArr.push({ featureWkt: new WKT().writeFeature(item) });
+      let geom = item.getGeometry().clone();
+      geom.transform(proj.get("EPSG:4326"), proj.get("EPSG:38572"));
+      let areaItem = getArea(geom);
+      area = (areaItem + areaItem / 2) / 1000;
+    });
+    return { geometryArr, area: area.toFixed(2) };
+  }
+
   /**
    address
    farmName

+ 14 - 3
src/views/authentic/index.vue

@@ -596,10 +596,21 @@ const getDetailsData = (id) => {
 
 // 添加经纬度列表
 const updatePointList = () => {
-  const { geometryArr, area } = authenticMap.getAreaGeometry();
-  const lastItem = geometryArr[geometryArr.length - 1];
+  let geometryArrCopy, areaCopy
+  if(mapData.isEditArea){
+    //编辑修改时查所有地块点位
+    const { geometryArr, area } = authenticMap.getAreaGeometry();
+    geometryArrCopy = geometryArr
+    areaCopy = area
+  }else{
+    //新建查询当前点位的地块数据
+    const { geometryArr, area } = authenticMap.getSinglePoint();
+    geometryArrCopy = geometryArr
+    areaCopy = area
+  }
+  const lastItem = geometryArrCopy[geometryArrCopy.length - 1];
   formInline.geom = lastItem.featureWkt;
-  formInline.mu = area + "亩";
+  formInline.mu = areaCopy + "亩";
   let result = parseMultiPolygon(lastItem.featureWkt);
   result.pop();
   pointList.value = result;