From 5e6b7ee01aee58503a2449ecde4a3ac246198780 Mon Sep 17 00:00:00 2001
From: zhangwencui <1064582902@qq.com>
Date: 星期三, 11 二月 2026 15:23:57 +0800
Subject: [PATCH] 打卡签到传参

---
 src/views/personnelManagement/attendanceCheckin/index.vue |   42 +++++++++++++++++++++++++++++++++++++-----
 1 files changed, 37 insertions(+), 5 deletions(-)

diff --git a/src/views/personnelManagement/attendanceCheckin/index.vue b/src/views/personnelManagement/attendanceCheckin/index.vue
index 7ce645b..0e5b577 100644
--- a/src/views/personnelManagement/attendanceCheckin/index.vue
+++ b/src/views/personnelManagement/attendanceCheckin/index.vue
@@ -342,13 +342,45 @@
       });
   };
 
+  // 鑾峰彇褰撳墠浣嶇疆
+  const getCurrentLocation = () => {
+    return new Promise((resolve, reject) => {
+      if (navigator.geolocation) {
+        navigator.geolocation.getCurrentPosition(
+          position => {
+            const { longitude, latitude } = position.coords;
+            resolve({ longitude, latitude });
+          },
+          error => {
+            console.log("鑾峰彇浣嶇疆澶辫触:", error);
+            reject(error);
+          }
+        );
+      } else {
+        reject(new Error("娴忚鍣ㄤ笉鏀寔鍦扮悊瀹氫綅"));
+      }
+    });
+  };
+
   // 鎵撳崱
   const handleCheckInOut = () => {
-    createPersonalAttendanceRecord({}).then(res => {
-      fetchData();
-      fetchTodayData();
-      ElMessage.success("鎵撳崱鎴愬姛锛�");
-    });
+    getCurrentLocation()
+      .then(location => {
+        createPersonalAttendanceRecord(location).then(res => {
+          fetchData();
+          fetchTodayData();
+          ElMessage.success("鎵撳崱鎴愬姛锛�");
+        });
+      })
+      .catch(error => {
+        // 鑾峰彇浣嶇疆澶辫触鏃讹紝浠嶅厑璁告墦鍗�
+        ElMessage.warning("鑾峰彇浣嶇疆澶辫触锛屽皢浣跨敤榛樿浣嶇疆鎵撳崱");
+        createPersonalAttendanceRecord({}).then(res => {
+          fetchData();
+          fetchTodayData();
+          ElMessage.success("鎵撳崱鎴愬姛锛�");
+        });
+      });
   };
 
   onMounted(() => {

--
Gitblit v1.9.3