From 2a3c3cdbf2398695d61633e072f98ee2757e9e27 Mon Sep 17 00:00:00 2001
From: longz <longzhaoz@qq.com>
Date: 星期二, 11 八月 2026 11:20:26 +0800
Subject: [PATCH] feat(appointment): 添加访客预约系统解除绑定功能

---
 frontend-admin/src/views/AppointmentListView.vue |   19 +++++++++++++++++--
 1 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/frontend-admin/src/views/AppointmentListView.vue b/frontend-admin/src/views/AppointmentListView.vue
index 20e7078..a084345 100644
--- a/frontend-admin/src/views/AppointmentListView.vue
+++ b/frontend-admin/src/views/AppointmentListView.vue
@@ -344,7 +344,8 @@
 const size = ref(10);
 const total = ref(0);
 const rows = ref<AppointmentRow[]>([]);
-const visitDateRange = ref<string[]>([]);
+const DEFAULT_VISIT_DATE_LOOKBACK_DAYS = 7;
+const visitDateRange = ref<string[]>(createDefaultVisitDateRange());
 
 const deptOptions = ref<DeptOption[]>([]);
 const passAreaOptions = ref<PassAreaOption[]>([]);
@@ -396,6 +397,20 @@
     || (detail.createTime as string | undefined);
   return value ? formatActionTime(value) : "-";
 });
+
+function formatDateForQuery(date: Date) {
+  const year = date.getFullYear();
+  const month = `${date.getMonth() + 1}`.padStart(2, "0");
+  const day = `${date.getDate()}`.padStart(2, "0");
+  return `${year}-${month}-${day}`;
+}
+
+function createDefaultVisitDateRange() {
+  const end = new Date();
+  const start = new Date(end);
+  start.setDate(start.getDate() - DEFAULT_VISIT_DATE_LOOKBACK_DAYS);
+  return [formatDateForQuery(start), formatDateForQuery(end)];
+}
 
 function indexMethod(index: number) {
   return (page.value - 1) * size.value + index + 1;
@@ -507,7 +522,7 @@
   filters.approvalStatus = "";
   filters.visitorKeyword = "";
   filters.visitReasonCode = "";
-  visitDateRange.value = [];
+  visitDateRange.value = createDefaultVisitDateRange();
   page.value = 1;
   load();
 }

--
Gitblit v1.7.1