From 263cd8a65d89614859b1c273ca8adc6813594bbf Mon Sep 17 00:00:00 2001
From: 董国庆 <364620639@qq.com>
Date: 星期五, 24 四月 2026 16:05:30 +0800
Subject: [PATCH] fix(operationWorkbench): 修复点位面板关闭逻辑与表单验证问题

---
 src/views/businessOperations/operationWorkbench/map.vue |   40 ++++++++++++++++++++++++++++++++++------
 1 files changed, 34 insertions(+), 6 deletions(-)

diff --git a/src/views/businessOperations/operationWorkbench/map.vue b/src/views/businessOperations/operationWorkbench/map.vue
index bf5ed2d..63f31ee 100644
--- a/src/views/businessOperations/operationWorkbench/map.vue
+++ b/src/views/businessOperations/operationWorkbench/map.vue
@@ -1057,6 +1057,15 @@
     : "3";
 }
 
+function ensurePointParkingTimeLimitByStatus(statusText?: string) {
+  if (
+    ["可运营", "待生效", "启用中"].includes(String(statusText || "")) &&
+    !String(pointForm.value.parkingTimeLimit || "").trim()
+  ) {
+    pointForm.value.parkingTimeLimit = "3";
+  }
+}
+
 const currentStatusOptions = computed(
   () => statusOptionsMap[activeTab.value] || []
 );
@@ -3804,6 +3813,21 @@
 });
 
 watch(
+  () => pointForm.value.pointOnOff,
+  (value) => {
+    const normalized = normalizePointOnOff(value);
+    if (value !== normalized) {
+      pointForm.value.pointOnOff = normalized;
+    }
+  },
+  { immediate: true }
+);
+
+watch(currentPointStatusText, (status) => {
+  ensurePointParkingTimeLimitByStatus(status);
+});
+
+watch(
   () => [route.name, route.fullPath, workbenchStore.version],
   () => {
     if (route.name !== "operationWorkbenchMap") return;
@@ -4044,10 +4068,12 @@
   if (isPointFormMode.value && !(await confirmDiscardPointEdit())) return;
   pointPanelClosed.value = true;
   selectedId.value = "";
+  if (pointCreateMode.value) {
+    exitPointCreateMode();
+    return;
+  }
   pointDetailData.value = null;
   pointEditMode.value = false;
-  pointCreateMode.value = false;
-  pointCreateReady.value = false;
   pointEditSnapshot.value = "";
   cleanupPointEditMapState();
 }
@@ -5790,7 +5816,9 @@
     fenceId = "0";
     pointType = 2;
   }
-  const pointOnOff = normalizePointOnOff(pointForm.value.pointOnOff);
+  const pointOnOff = normalizePointOnOff(
+    pointForm.value.pointOnOff || pointDetailData.value?.pointOnOff || "3"
+  );
   pointForm.value.pointOnOff = pointOnOff;
   pointSaving.value = true;
   try {
@@ -5806,7 +5834,7 @@
       ...administrativeInfo,
       pointName: pointForm.value.pointName.trim(),
       pointAddress: pointForm.value.pointAddress.trim(),
-      pointOnOff,
+      pointOnOff: Number(pointOnOff),
       parkingTimeLimit: pointForm.value.parkingTimeLimit || undefined,
       remarks: pointForm.value.remarks.trim() || undefined,
       pointLon: pointForm.value.pointLon ?? undefined,
@@ -5878,10 +5906,10 @@
       syncPointDetailFromSelected();
       return;
     }
-    window.$message?.error(res.msg || "保存失败");
+    // window.$message?.error(res.msg || "保存失败");
   } catch (error) {
     console.error("保存点位失败:", error);
-    window.$message?.error("保存失败");
+    // window.$message?.error("保存失败");
   } finally {
     pointSaving.value = false;
   }

--
Gitblit v1.7.1