From 910b2ead53df78a62a06d1bdfc3e05c8c5b5fc65 Mon Sep 17 00:00:00 2001
From: liu <2021943741@qq.com>
Date: 星期一, 26 十月 2026 11:41:10 +0800
Subject: [PATCH] feat(hrm): 考勤规则支持百度地图选点

---
 src/views/hrm/attendance/rule/data.ts |   39 ++++++++++++++++++++++++++++++++++-----
 1 files changed, 34 insertions(+), 5 deletions(-)

diff --git a/src/views/hrm/attendance/rule/data.ts b/src/views/hrm/attendance/rule/data.ts
index c286424..2b4dd3f 100644
--- a/src/views/hrm/attendance/rule/data.ts
+++ b/src/views/hrm/attendance/rule/data.ts
@@ -11,8 +11,18 @@
 /** 琛ㄥ崟绫诲瀷 */
 export type FormType = 'create' | 'update' | 'detail';
 
+export interface LocationFormCallbacks {
+  onLatitudeChange?: (value?: number) => void;
+  onLocationRequiredChange?: (value: boolean) => void;
+  onLongitudeChange?: (value?: number) => void;
+  onRadiusChange?: (value?: number) => void;
+}
+
 /** 鏂板/缂栬緫鑰冨嫟瑙勫垯鐨勮〃鍗� */
-export function useFormSchema(formType: FormType): VbenFormSchema[] {
+export function useFormSchema(
+  formType: FormType,
+  locationCallbacks: LocationFormCallbacks = {},
+): VbenFormSchema[] {
   return [
     {
       fieldName: 'id',
@@ -112,6 +122,7 @@
       defaultValue: false,
       componentProps: {
         checkedChildren: '鍚敤',
+        onChange: locationCallbacks.onLocationRequiredChange,
         unCheckedChildren: '鍏抽棴',
       },
     },
@@ -140,7 +151,13 @@
       fieldName: 'longitude',
       label: '缁忓害(WGS84)',
       component: 'InputNumber',
-      componentProps: { min: -180, max: 180, precision: 7, style: { width: '100%' } },
+      componentProps: {
+        min: -180,
+        max: 180,
+        onChange: locationCallbacks.onLongitudeChange,
+        precision: 7,
+        style: { width: '100%' },
+      },
       dependencies: {
         triggerFields: ['locationRequired'],
         show: (values) => Boolean(values.locationRequired),
@@ -151,7 +168,13 @@
       fieldName: 'latitude',
       label: '绾害(WGS84)',
       component: 'InputNumber',
-      componentProps: { min: -90, max: 90, precision: 7, style: { width: '100%' } },
+      componentProps: {
+        min: -90,
+        max: 90,
+        onChange: locationCallbacks.onLatitudeChange,
+        precision: 7,
+        style: { width: '100%' },
+      },
       dependencies: {
         triggerFields: ['locationRequired'],
         show: (values) => Boolean(values.locationRequired),
@@ -162,8 +185,14 @@
       fieldName: 'radiusMeters',
       label: '鎵撳崱鍗婂緞(绫�)',
       component: 'InputNumber',
-      defaultValue: 100,
-      componentProps: { min: 10, max: 5000, precision: 0, style: { width: '100%' } },
+      defaultValue: 10,
+      componentProps: {
+        min: 10,
+        max: 5000,
+        onChange: locationCallbacks.onRadiusChange,
+        precision: 0,
+        style: { width: '100%' },
+      },
       help: '鏈�灏忓彲璁� 10 绫筹紱瀹為檯绮惧害鍙栧喅浜庢墜鏈� GPS 涓庣幆澧�',
       dependencies: {
         triggerFields: ['locationRequired'],

--
Gitblit v1.9.3