From a4d0446d7c1c1e56641fd4e887ad4d0ecd0534ca Mon Sep 17 00:00:00 2001
From: zhangwencui <1064582902@qq.com>
Date: 星期四, 05 三月 2026 17:43:55 +0800
Subject: [PATCH] 排班管理页面完成70%

---
 src/views/personnelManagement/attendanceCheckin/index.vue |  106 +++++++++++++++++++++++++++++++++++++++++++----------
 1 files changed, 86 insertions(+), 20 deletions(-)

diff --git a/src/views/personnelManagement/attendanceCheckin/index.vue b/src/views/personnelManagement/attendanceCheckin/index.vue
index 0e5b577..9a3acfa 100644
--- a/src/views/personnelManagement/attendanceCheckin/index.vue
+++ b/src/views/personnelManagement/attendanceCheckin/index.vue
@@ -1,7 +1,7 @@
 <template>
   <div class="app-container">
     <!-- 鍛樺伐鎵撳崱鍖� -->
-    <el-card shadow="never"
+    <!-- <el-card shadow="never"
              class="mb16">
       <div class="attendance-header">
         <div>
@@ -58,8 +58,17 @@
           </el-tag>
         </el-descriptions-item>
       </el-descriptions>
-    </el-card>
+    </el-card> -->
     <div class="attendance-operation">
+      <el-button @click="handleBack"
+                 type="default"
+                 size="small"
+                 style="margin-right: 16px">
+        <el-icon>
+          <ArrowLeft />
+        </el-icon>
+        杩斿洖鎺掔彮绠$悊
+      </el-button>
       <!-- 鏌ヨ鏉′欢锛堢鐞嗗憳鑰冨嫟鏃ユ姤锛� -->
       <el-form :model="searchForm"
                :inline="true"
@@ -159,7 +168,7 @@
                          label="澶囨敞"
                          show-overflow-tooltip />
       </el-table>
-      <pagination :total="total"
+      <pagination :total="page.total"
                   layout="total, sizes, prev, pager, next, jumper"
                   :page="page.current"
                   :limit="page.size"
@@ -170,6 +179,7 @@
 
 <script setup>
   import { ref, reactive, computed, onMounted, onBeforeUnmount } from "vue";
+  import { useRouter } from "vue-router";
   import { ElMessage, ElMessageBox } from "element-plus";
   import {
     createPersonalAttendanceRecord,
@@ -178,9 +188,10 @@
   } from "@/api/personnelManagement/personalAttendanceRecords.js";
   import Pagination from "@/components/Pagination/index.vue";
   import { deptTreeSelect } from "@/api/system/user.js";
-  import { Refresh, Search } from "@element-plus/icons-vue";
+  import { Refresh, Search, ArrowLeft } from "@element-plus/icons-vue";
 
   const { proxy } = getCurrentInstance();
+  const router = useRouter();
   const tableLoading = ref(false);
   // 鍒嗛〉鍙傛暟
   const page = reactive({
@@ -302,7 +313,7 @@
     findPersonalAttendanceRecords({ ...page, ...searchForm })
       .then(res => {
         tableData.value = res.data.records;
-        page.value.total = res.data.total;
+        page.total = res.data.total;
       })
       .finally(() => {
         tableLoading.value = false;
@@ -311,9 +322,9 @@
 
   // 鏌ヨ浠婃棩鎵撳崱淇℃伅
   const fetchTodayData = () => {
-    findTodayPersonalAttendanceRecord({}).then(res => {
-      todayRecord.value = res.data;
-    });
+    // findTodayPersonalAttendanceRecord({}).then(res => {
+    //   todayRecord.value = res.data;
+    // });
   };
 
   const paginationChange = pagination => {
@@ -345,20 +356,67 @@
   // 鑾峰彇褰撳墠浣嶇疆
   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 {
+      if (!navigator.geolocation) {
         reject(new Error("娴忚鍣ㄤ笉鏀寔鍦扮悊瀹氫綅"));
+        return;
       }
+
+      // 妫�鏌ユ槸鍚︿娇鐢℉TTPS
+      const isSecureContext =
+        window.isSecureContext || window.location.protocol === "https:";
+      console.log(
+        "褰撳墠鍗忚:",
+        window.location.protocol,
+        "鏄惁瀹夊叏涓婁笅鏂�:",
+        isSecureContext
+      );
+
+      if (!isSecureContext) {
+        console.warn("褰撳墠涓嶆槸HTTPS鍗忚锛屽湴鐞嗕綅缃瓵PI鍙兘鍙楅檺");
+      }
+
+      navigator.geolocation.getCurrentPosition(
+        position => {
+          const { longitude, latitude } = position.coords;
+          console.log("鑾峰彇浣嶇疆鎴愬姛:", longitude, latitude);
+          resolve({ longitude, latitude });
+        },
+        error => {
+          console.log("鑾峰彇浣嶇疆澶辫触:", error);
+          let errorMessage = "鑾峰彇浣嶇疆澶辫触";
+
+          // 鏍规嵁閿欒绫诲瀷鎻愪緵鏇村叿浣撶殑鎻愮ず
+          switch (error.code) {
+            case error.PERMISSION_DENIED:
+              errorMessage =
+                "鐢ㄦ埛鎷掔粷浜嗕綅缃潈闄愯姹傦紝璇峰湪娴忚鍣ㄨ缃腑鍏佽浣嶇疆璁块棶";
+              break;
+            case error.POSITION_UNAVAILABLE:
+              errorMessage = "浣嶇疆淇℃伅涓嶅彲鐢紝璇锋鏌ヨ澶囧畾浣嶅姛鑳�";
+              break;
+            case error.TIMEOUT:
+              errorMessage = "鑾峰彇浣嶇疆瓒呮椂锛岃閲嶈瘯";
+              break;
+            case error.UNKNOWN_ERROR:
+              errorMessage = "鑾峰彇浣嶇疆鏃跺彂鐢熸湭鐭ラ敊璇�";
+              break;
+            default:
+              errorMessage = `鑾峰彇浣嶇疆澶辫触: ${error.message}`;
+          }
+
+          // 妫�鏌ユ槸鍚︽槸HTTPS闂
+          if (error.code === error.PERMISSION_DENIED && !isSecureContext) {
+            errorMessage += "锛堟敞鎰忥細鐢熶骇鐜闇�瑕佷娇鐢℉TTPS鍗忚鎵嶈兘鑾峰彇浣嶇疆锛�";
+          }
+
+          reject(new Error(errorMessage));
+        },
+        {
+          enableHighAccuracy: true,
+          timeout: 10000,
+          maximumAge: 0,
+        }
+      );
     });
   };
 
@@ -366,6 +424,7 @@
   const handleCheckInOut = () => {
     getCurrentLocation()
       .then(location => {
+        console.log("浣嶇疆鎴愬姛");
         createPersonalAttendanceRecord(location).then(res => {
           fetchData();
           fetchTodayData();
@@ -397,6 +456,13 @@
     fetchDeptOptions();
   });
 
+  // 杩斿洖鎺掔彮绠$悊椤甸潰
+  const handleBack = () => {
+    router.push({
+      path: "/personnelManagement/classsSheduling/index",
+    });
+  };
+
   onBeforeUnmount(() => {
     if (timer) {
       clearInterval(timer);

--
Gitblit v1.9.3