Browse Source

Merge branch 'farmer' of http://www.sysuimars.cn:3000/feiniao/feiniao-farm-h5 into farmer

lxf 23 hours ago
parent
commit
534fb2cd5b

+ 1 - 1
src/components/pageComponents/ArchivesFarmTimeLine.vue

@@ -788,7 +788,7 @@ const getFarmWorkPlan = () => {
                 }
 
                 // 判断是否为空数据:没有节气或没有物候期数据
-                if (solarTerms.value.length === 0 && phenologyList.value.length === 0) {
+                if (solarTerms.value.length === 0 || phenologyList.value.length === 0) {
                     isEmpty.value = true;
                 } else {
                     isEmpty.value = false;

+ 1 - 0
src/views/old_mini/create_farm/index.vue

@@ -304,6 +304,7 @@ function handleMapUpdate() {
         store.commit("home/SET_FARM_POLYGON", null);
         isFromEditMap.value = false; // 从home进入,可以手动输入
         hasDefaultPolygon.value = false; // 重置默认地块状态
+        locationVal.value = null;
 
         centerPoint.value = store.state.home.miniUserLocationPoint;
         const arr = convertPointToArray(centerPoint.value);

+ 4 - 1
src/views/old_mini/interactionList/map/drawRegionMap.js

@@ -248,7 +248,10 @@ class DrawRegionMap {
                                 ...(isVarietyNameLabel
                                     ? {
                                           backgroundFill: new Fill({
-                                              color: "rgba(0, 57, 44, 0.85)",
+                                              color:
+                                                  KMap.Map?.drawStyleColors?.stroke
+                                                      ? `${KMap.Map.drawStyleColors.stroke}D9`
+                                                      : "rgba(0, 57, 44, 0.85)",
                                           }),
                                           padding: [2, 6, 2, 6],
                                       }

+ 26 - 3
src/views/old_mini/monitor/subPages/darwArea.vue

@@ -529,6 +529,24 @@ const flattenGeomWktList = (arr) => {
 /** 地图回显:展开 MULTIPOLYGON 为多个 POLYGON WKT,并去掉无效项 */
 const flattenGeomWktListForMap = (arr) => flattenGeomWktList(arr).filter(isValidGeom);
 
+const formatAreaTextFromGeomArr = (geomWktArr) => {
+    if (!Array.isArray(geomWktArr) || geomWktArr.length === 0) return "";
+    let totalArea = 0;
+    for (const wkt of geomWktArr) {
+        if (!isValidGeom(wkt)) continue;
+        try {
+            const geometry = wktGeomFormat.readGeometry(String(wkt).trim(), WGS84_WKT_OPTS);
+            geometry.transform(proj.get("EPSG:4326"), proj.get("EPSG:38572"));
+            let area = getArea(geometry);
+            area = (area + area / 2) / 1000;
+            totalArea += Number(area) || 0;
+        } catch (_) {
+            /* 单条解析失败则跳过 */
+        }
+    }
+    return totalArea > 0 ? `${totalArea.toFixed(2)}亩` : "";
+};
+
 // 从 tab.geomItems[{geomWkt}] 中提取 WKT 数组(兼容单块/多块)
 const getGeomArrFromGeomItems = (tab) => {
     const items = tab?.geomItems;
@@ -698,17 +716,22 @@ const handleVarietyClick = (tab, index) => {
         pendingGeomRenderTimer.value = setTimeout(() => {
             // 再兜底清一次,避免异步回调在 destroy/init 后仍执行导致重复追加
             drawRegionMap.kmap?.polygonLayer?.source?.clear?.();
-            const viewOnlyVarietyLabel =
-                route.query.type === "viewOnly" && activeRegionType.value === "variety"
+            const viewOnlySubCategoryLabel =
+                route.query.type === "viewOnly" && getCanonicalRegionTypeForStyles() !== "ABNORMAL"
                     ? (tab.regionName || tab.problemZoneTypeName || "").toString().trim()
                     : "";
+            const currentAreaText = formatAreaTextFromGeomArr(geomArr);
+            const viewOnlySubCategoryLabelWithArea =
+                viewOnlySubCategoryLabel && currentAreaText
+                    ? `${viewOnlySubCategoryLabel}\n${currentAreaText}`
+                    : viewOnlySubCategoryLabel;
             drawRegionMap.setAreaGeometry(
                 geomArr,
                 false,
                 undefined,
                 undefined,
                 getAbnormalGrowthOverlayMeta(),
-                viewOnlyVarietyLabel || undefined
+                viewOnlySubCategoryLabelWithArea || undefined
             );
             // 有当前小类地块:仅 fit 当前可编辑层,避免被其它只读参考地块拉远
             drawRegionMap.fitView?.();