From beb95fb5fc166804056abafd70fc01ac27de7621 Mon Sep 17 00:00:00 2001
From: 罗广辉 <guanghui.luo@foxmail.com>
Date: Mon, 26 Jan 2026 09:11:00 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

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

diff --git a/applications/drone-command/src/views/areaManage/partition/FormDiaLog.vue b/applications/drone-command/src/views/areaManage/partition/FormDiaLog.vue
index d626857..0b2786e 100644
--- a/applications/drone-command/src/views/areaManage/partition/FormDiaLog.vue
+++ b/applications/drone-command/src/views/areaManage/partition/FormDiaLog.vue
@@ -16,10 +16,12 @@
 
 			<div class="right-container">
 				<div class="header">
-					{{ titleEnum[dialogMode] }}
+					<span>{{ titleEnum[dialogMode] }}</span>
+				
+					<el-icon class="close-btn" @click.stop="visible = false"><Close /></el-icon>
 				</div>
 
-				<div class="dialog-container" v-if="readonly">
+				<div class="content" v-if="readonly">
 					<div class="detail-title">区域详情</div>
 					<el-row>
 						<el-col :span="24">
@@ -114,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">
@@ -151,7 +154,7 @@
 				</el-form>
 
 				<div class="footer">
-					<el-button color="#2B2B4C" @click="handleCancel">{{ readonly ? '关闭' : '取消' }}</el-button>
+					<el-button v-if="dialogMode != 'view'" color="#2B2B4C" @click="handleCancel">{{ readonly ? '关闭' : '取消' }}</el-button>
 					<el-button color="#284FE3" v-if="!readonly" type="primary" :loading="submitting"
 						:disabled="submitting" @click="handleSubmit">
 						确定
@@ -163,9 +166,13 @@
 </template>
 
 <script setup>
+import { Close } from '@element-plus/icons-vue'
+
 import { computed, inject, nextTick, onMounted, ref, watch } from 'vue'
 import { ElMessage } from 'element-plus'
 import { fwAreaDivideDetailApi, fwAreaDivideSubmitApi } from './partitionApi'
+import { saveOperationLog } from '@ztzf/apis'
+import { useRoute } from 'vue-router'
 import { fieldRules, geomAnalysis, getDictLabel } from '@ztzf/utils'
 import CommonCesiumMap from '@/components/map-container/common-cesium-map.vue'
 import { DrawPolygon } from '@/utils/cesium/DrawPolygon'
@@ -197,7 +204,8 @@
 const dialogMode = ref('add') // 弹框模式
 const submitting = ref(false) // 提交中
 const readonly = computed(() => dialogMode.value === 'view')
-const titleEnum = ref({ edit: '编辑场景', view: '查看场景', add: '新增场景' })
+const route = useRoute()
+const titleEnum = ref({ edit: '编辑区域', view: '查看区域', add: '新增区域' })
 const flyDateRange = ref([]) // 飞行时间
 const deviceTableRef = ref(null)
 const searchName = ref('')
@@ -219,7 +227,39 @@
 	controlLevel: fieldRules(true),
 	flyDateStart: fieldRules(true),
 	policeStationId: fieldRules(true),
-	deviceIds: fieldRules(true),
+	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)
+				: [],
+	}
 }
 
 // 关闭弹框
@@ -231,11 +271,21 @@
 async function handleSubmit () {
 	const isValid = await formRef.value?.validate().catch(() => false)
 	if (!isValid) return
+	if (dialogMode.value === 'add' && Number(formData.value.areaSize) < 0.5) {
+		ElMessage.warning('区域面积不能小于0.5km²,请重新绘制')
+		return
+	}
 	submitting.value = true
 	try {
 		let str = [...pointList, pointList[0]].map(item => `${item.longitude} ${item.latitude}`).join(',')
 		formData.value.geom = `POLYGON((${str}))`
 		await fwAreaDivideSubmitApi(formData.value)
+		const actionText = dialogMode.value === 'add' ? '新增' : '编辑'
+		saveOperationLog({
+			requestUri: route.path,
+			title: `${route.name || '区域划分'}-${actionText}`,
+			type: 1,
+		})
 		ElMessage.success(dialogMode.value === 'add' ? '新增成功' : '更新成功')
 		visible.value = false
 		emit('success')

--
Gitblit v1.9.3