吉安感知网项目-前端
罗广辉
2026-01-26 beb95fb5fc166804056abafd70fc01ac27de7621
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">
@@ -153,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">
                  确定
@@ -170,6 +171,8 @@
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'
@@ -201,6 +204,7 @@
const dialogMode = ref('add') // 弹框模式
const submitting = ref(false) // 提交中
const readonly = computed(() => dialogMode.value === 'view')
const route = useRoute()
const titleEnum = ref({ edit: '编辑区域', view: '查看区域', add: '新增区域' })
const flyDateRange = ref([]) // 飞行时间
const deviceTableRef = ref(null)
@@ -223,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)
            : [],
   }
}
// 关闭弹框
@@ -244,6 +280,12 @@
      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')