From 0dcf3e02ece4ecbb6b1983c4379671936693b409 Mon Sep 17 00:00:00 2001
From: shuishen <1109946754@qq.com>
Date: Thu, 22 Jan 2026 11:24:27 +0800
Subject: [PATCH] feat:区域划分可飞行时段日期选择调整

---
 applications/drone-command/src/views/areaManage/partition/FormDiaLog.vue |   33 +++++++++++++++++++++++++++++++++
 1 files changed, 33 insertions(+), 0 deletions(-)

diff --git a/applications/drone-command/src/views/areaManage/partition/FormDiaLog.vue b/applications/drone-command/src/views/areaManage/partition/FormDiaLog.vue
index b1cadef..44c149a 100644
--- a/applications/drone-command/src/views/areaManage/partition/FormDiaLog.vue
+++ b/applications/drone-command/src/views/areaManage/partition/FormDiaLog.vue
@@ -116,6 +116,7 @@
 						<el-date-picker class="command-date-picker"
 							popper-class="command-date-picker-popper" v-model="flyDateRange"
 							type="datetimerange" range-separator="至" start-placeholder="开始时间" end-placeholder="结束时间"
+							:disabled-date="disabledFlyDate" :disabled-time="disabledFlyTime"
 							value-format="YYYY-MM-DD HH:mm:ss" clearable />
 					</el-form-item>
 					<el-form-item label="关联派出所" prop="policeStationId">
@@ -226,6 +227,38 @@
 	deviceIds: fieldRules(false),
 }
 
+function isSameDay (left, right) {
+	return (
+		left.getFullYear() === right.getFullYear() &&
+		left.getMonth() === right.getMonth() &&
+		left.getDate() === right.getDate()
+	)
+}
+
+const disabledFlyDate = time => {
+	const startOfToday = new Date()
+	startOfToday.setHours(0, 0, 0, 0)
+	return time.getTime() < startOfToday.getTime()
+}
+
+const disabledFlyTime = date => {
+	if (!date) return {}
+	const now = new Date()
+	if (!isSameDay(date, now)) return {}
+	const currentHour = now.getHours()
+	const currentMinute = now.getMinutes()
+	const currentSecond = now.getSeconds()
+	return {
+		disabledHours: () => Array.from({ length: currentHour }, (_, index) => index),
+		disabledMinutes: hour =>
+			hour === currentHour ? Array.from({ length: currentMinute }, (_, index) => index) : [],
+		disabledSeconds: (hour, minute) =>
+			hour === currentHour && minute === currentMinute
+				? Array.from({ length: currentSecond }, (_, index) => index)
+				: [],
+	}
+}
+
 // 关闭弹框
 function handleCancel () {
 	visible.value = false

--
Gitblit v1.9.3