吉安感知网项目-前端
张含笑
2026-01-27 dd57e0e9a989e7ee8b3e3473a7ee6a1dff06a4ae
applications/drone-command/src/views/areaManage/partition/FormDiaLog.vue
@@ -42,7 +42,9 @@
                  </el-col>
                  <el-col :span="24">
                     <div class="label">触发条件</div>
                     <div class="val">{{ formData.triggerCondition }}</div>
                     <div class="val">
                        {{ getDictLabel(formData.triggerCondition, dictObj.triggeringCondition) }}
                     </div>
                  </el-col>
                  <el-col :span="24">
                     <div class="label">响应机制</div>
@@ -102,8 +104,11 @@
                     maxlength="200" placeholder="请输入" clearable />
               </el-form-item>
               <el-form-item label="触发条件" prop="triggerCondition">
                  <el-input class="command-input" v-model="formData.triggerCondition"
                     maxlength="200" placeholder="请输入" clearable />
                  <el-select class="command-select" popper-class="command-select-popper"
                     v-model="formData.triggerCondition" placeholder="请选择" clearable>
                     <el-option v-for="item in dictObj.triggeringCondition" :key="item.dictKey"
                        :label="item.dictValue" :value="item.dictKey" />
                  </el-select>
               </el-form-item>
               <el-form-item label="管控级别" prop="controlLevel">
                  <el-select class="command-select" popper-class="command-select-popper"
@@ -116,6 +121,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 +159,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 +176,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 +209,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 +232,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 +285,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')
@@ -368,7 +415,7 @@
// 获取设备列表
async function getDeviceList () {
   if (deviceOptions.value.length) return
   const res = await fwDeviceListApi({ isAreaSelect: 1, areaId: formData.value.id })
   const res = await fwDeviceListApi({ isAreaSelect: 1, areaId: formData.value.id, isTrack: 1 })
   deviceOptions.value = res?.data?.data ?? []
   if (dialogMode.value === 'view') {
      deviceOptions.value = deviceOptions.value.filter(item => formData.value.deviceIds.includes(item.id))