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 ++++++++++++++++
applications/drone-command/src/styles/common/cockpit.scss | 36 ++++++++++++++++++
2 files changed, 69 insertions(+), 0 deletions(-)
diff --git a/applications/drone-command/src/styles/common/cockpit.scss b/applications/drone-command/src/styles/common/cockpit.scss
index add79aa..7fe99d9 100644
--- a/applications/drone-command/src/styles/common/cockpit.scss
+++ b/applications/drone-command/src/styles/common/cockpit.scss
@@ -204,6 +204,42 @@
color: #fff !important;
.el-date-range-picker__time-header {
+ .el-time-panel {
+ background: #1A1A2A !important;
+ border-radius: 0px 0px 8px 8px;
+ border: none !important;
+
+ // 将 time-picker-popper 的样式移到这里
+ .el-time-panel__header {
+ background: #161B2C !important;
+ color: #ffffff !important;
+ border-bottom: 1px solid rgba(71, 157, 255, 0.3) !important;
+ }
+
+ .el-time-panel__content {
+ .el-time-spinner__item {
+ &:hover {
+ background: transparent !important;
+ }
+
+ &.active {
+ color: #479dff !important;
+ font-weight: bold;
+ }
+ }
+ }
+
+ .el-time-panel__footer {
+ .el-time-panel__btn {
+ color: #fff;
+ }
+
+ .el-time-panel__btn:first-child {
+ color: #86909C;
+ }
+ }
+ }
+
.el-input__wrapper {
box-shadow: none;
background: #2E2E48 !important;
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