无人机管理后台前端(已迁走)
chenyao
2025-11-22 6bb71049a8909c6ff9170c0fd1022ff9adf9a124
feat:智飞工单
3 files modified
143 ■■■■ changed files
src/views/tickets/component/AddEditDetails.vue 95 ●●●● patch | view | raw | blame | history
src/views/tickets/component/SearchBox.vue 24 ●●●●● patch | view | raw | blame | history
src/views/tickets/orderLog.vue 24 ●●●● patch | view | raw | blame | history
src/views/tickets/component/AddEditDetails.vue
@@ -42,12 +42,12 @@
        <el-row :gutter="20">
          <el-col :span="12">
            <el-form-item label="工单名称" prop="name">
              <el-input v-model="formParams.name" placeholder="请输入工单名称" maxlength="100" show-word-limit :disabled="txtTitle === '审核工单' || txtTitle === '工单详情'"></el-input>
              <el-input v-model="formParams.name" placeholder="请输入工单名称" maxlength="100" show-word-limit :disabled="txtTitle === '工单审核' || txtTitle === '工单详情'"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="关联航线" prop="file_id">
              <el-select v-model="formParams.file_id" placeholder="请选择航线" filterable @change="getFlyingNest" :disabled="txtTitle === '审核工单' || txtTitle === '工单详情'">
              <el-select v-model="formParams.file_id" placeholder="请选择航线" filterable @change="getFlyingNest" :disabled="txtTitle === '工单审核' || txtTitle === '工单详情'">
                <el-option v-for="item in lineList" :key="item.wayline_id" :label="item.name"
                           :value="item.wayline_id" />
              </el-select>
@@ -55,21 +55,21 @@
          </el-col>
          <el-col :span="6">
            <el-form-item label="安全返航真高" prop="rth_altitude" class="safe-height">
              <el-input-number v-model="formParams.rth_altitude" :min="50" :max="500" :disabled="txtTitle === '审核工单' || txtTitle === '工单详情'"></el-input-number>
              <el-input-number v-model="formParams.rth_altitude" :min="50" :max="500" :disabled="txtTitle === '工单审核' || txtTitle === '工单详情'"></el-input-number>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="20">
          <el-col :span="12">
            <el-form-item label="关联机巢" prop="device_sns">
              <el-select v-model="formParams.device_sns" placeholder="请选择机巢" multiple :disabled="(txtTitle === '审核工单' || txtTitle === '工单详情')">
              <el-select v-model="formParams.device_sns" placeholder="请选择机巢" multiple :disabled="(txtTitle === '工单审核' || txtTitle === '工单详情')">
                <el-option v-for="item in drone_sns" :key="item.device_sn" :label="item.nickname" :value="item.device_sn" />
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="关联算法" prop="ai_types">
              <el-select v-model="formParams.ai_types" placeholder="请选择关联算法" multiple :disabled="txtTitle === '审核工单' || txtTitle === '工单详情'">
              <el-select v-model="formParams.ai_types" placeholder="请选择关联算法" multiple :disabled="txtTitle === '工单审核' || txtTitle === '工单详情'">
                <el-option v-for="item in aiTypeList" :key="item.dictKey" :label="item.dictValue" :value="item.dictKey" />
              </el-select>
            </el-form-item>
@@ -79,7 +79,7 @@
        <el-row :gutter="20">
          <el-col :span="12"  v-if="txtTitle === '新建工单'">
            <el-form-item label="工单内容" prop="content">
              <el-input type="textarea" v-model="formParams.content" rows="4" placeholder="请输入工单内容" maxlength="255" show-word-limit :disabled="txtTitle === '审核工单' || txtTitle === '工单详情'"></el-input>
              <el-input type="textarea" v-model="formParams.content" rows="4" placeholder="请输入工单内容" maxlength="255" show-word-limit :disabled="txtTitle === '工单审核' || txtTitle === '工单详情'"></el-input>
            </el-form-item>
          </el-col>
@@ -91,7 +91,7 @@
          <el-col :span="7">
            <el-form-item label="周期频次" prop="date_range">
              <el-date-picker :disabled="txtTitle === '审核工单' || txtTitle === '工单详情'"
              <el-date-picker :disabled="txtTitle === '工单审核' || txtTitle === '工单详情'"
                v-model="formParams.date_range"
                type="daterange"
                range-separator="至"
@@ -101,25 +101,25 @@
            </el-form-item>
          </el-col>
          <el-col :span="2">
            <el-select v-model="formParams.rep_fre_type" placeholder="请选择频次" :disabled="txtTitle === '审核工单' || txtTitle === '工单详情'">
            <el-select v-model="formParams.rep_fre_type" placeholder="请选择频次" :disabled="txtTitle === '工单审核' || txtTitle === '工单详情'">
              <el-option v-for="item in weeks" :key="item" :label="item" :value="item" />
            </el-select>
          </el-col>
          <el-col :span="3">
            <el-time-picker :style="{ width: pxToRem(140) }"
                            v-model="formParams.deal_time"
                            :disabled="txtTitle === '审核工单' || txtTitle === '工单详情'"
                            :disabled="txtTitle === '工单审核' || txtTitle === '工单详情'"
                            prop="deal_time"
                            value-format="HH:mm"
                            :picker-options="{ selectableRange: '00:00 - 23:59'}" />
          </el-col>
        </el-row>
        <el-row :gutter="20" v-if="txtTitle === '审核工单' || txtTitle === '工单详情' || txtTitle === '工单编辑'">
        <el-row :gutter="20" v-if="txtTitle === '工单审核' || txtTitle === '工单详情' || txtTitle === '工单编辑'">
          <el-col :span="12">
            <el-form-item label="工单内容" prop="content">
              <el-input type="textarea" v-model="formParams.content" rows="4" placeholder="请输入工单内容" maxlength="255"
                        show-word-limit :disabled="txtTitle === '审核工单' || txtTitle === '工单详情'"></el-input>
                        show-word-limit :disabled="txtTitle === '工单审核' || txtTitle === '工单详情'"></el-input>
            </el-form-item>
          </el-col>
        </el-row>
@@ -141,7 +141,7 @@
    <template #footer v-if="txtTitle === '工单审核'">
      <div class="dialog-footer">
        <el-button type="primary"
                   v-if="formParams.status == 1 && permission.order_log_review"
                   v-if="formParams.status == 1 && permission.orderLogpass"
                   @click="orderPass(formParams.id)">通过
        </el-button>
        <el-button type="danger"
@@ -174,7 +174,7 @@
  orderLogDetails,
  orderLogPass,
  orderLogReject,
  orderLogRecall
  orderLogRecall, getWaylineMaxTerrainHeight
} from '@/api/tickets/orderLog';
import dayjs from 'dayjs'
import 'dayjs/locale/zh-cn' // 导入中文语言包
@@ -190,6 +190,18 @@
const store = useStore()
const userInfo = computed(() => store.state.user.userInfo)
const permission = computed(() => store.state.user.permission);
// safeHeight 计算属性
const safeHeight = computed(() => {
  const height = store.state.common.safeHeight
  return Number(height) || 0 // 确保是数字类型
})
// positionsArr 计算属性
const positionsArr = computed(() => {
  const arr = store.state.common.positionsArr
  return arr || [] // 确保是数组类型
})
const txtTitle = inject('txtTitle')
const rowObj = inject('rowObj')
@@ -304,6 +316,26 @@
  ).padStart(2, '0')} 00:00:00`
}
async function returnHeight() {
  let checkedList = drone_sns.value.filter(item => formParams.value.device_sns.includes(item.device_sn));
  const maxItem = checkedList.reduce((max, item) => {
    return item.drone_height > max.drone_height ? item : max;
  });
  // 返航绝对高度
  let backHeight = formParams.value.rth_altitude // + maxItem.drone_height
  console.log(backHeight,'backHeight')
  // 安全起飞高度
  let positions = positionsArr.value
  positions.unshift({latitude: maxItem.latitude, longitude: maxItem.longitude, height:maxItem.drone_height })
  positions.push({latitude: maxItem.latitude, longitude: maxItem.longitude, height:maxItem.drone_height})
  let resultHeight = 0
  await getWaylineMaxTerrainHeight(positions).then(res => {
    resultHeight = safeHeight.value > (res.data.data + 30) ? safeHeight.value : (res.data.data + 30)
  })
  let valueHeight = _.round(backHeight - resultHeight, 2)
  return _.round(backHeight - resultHeight, 2)
}
function submitForm(status) {
  orderFormRef.value?.validate(async (valid, fields) => {
    if (valid) {
@@ -319,6 +351,29 @@
        if (selectedDate === dayjs().format('YYYY-MM-DD') && selectedTime < now) {
          return ElMessage({message: '任务时间不能小于当前时间', type: 'warning'})
        }
      }
      let checkedList = drone_sns.value.filter(item => formParams.value.device_sns.includes(item.device_sn));
      const maxItem = checkedList.reduce((max, item) => {
        return item.drone_height > max.drone_height ? item : max;
      });
      // 返航绝对高度
      let backHeight = formParams.value.rth_altitude // + maxItem.drone_height
      console.log(backHeight,'backHeight')
      // 安全起飞高度
      let positions = positionsArr.value
      positions.unshift({latitude: maxItem.latitude, longitude: maxItem.longitude, height:maxItem.drone_height })
      positions.push({latitude: maxItem.latitude, longitude: maxItem.longitude, height:maxItem.drone_height})
      let resultHeight = 0
      await getWaylineMaxTerrainHeight(positions).then(res => {
        resultHeight = safeHeight.value > (res.data.data + 30) ? safeHeight.value : (res.data.data + 30)
      })
      let valueHeight = _.round(backHeight - resultHeight, 2)
      if (valueHeight < 0) {
        await ElMessageBox.confirm(`当前返航高度存在安全隐患,建议调整为${resultHeight}米以上后进行发布`, '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        })
      }
      const submitData = {
        ...formParams.value,
@@ -370,10 +425,18 @@
  }
}
const initMapPosition = async () => {
  await nextTick()
  if (mapContainerRef.value?.initAddEntity) {
    mapContainerRef.value.initAddEntity('initPosition')
  }
}
// 监听txtTitle
watch(isShowAddEditDetails, async (newVal, oldVal) => {
  console.log('txtTitle 发生变化:', newVal, oldVal)
  formParams.value = {}
  formParams.value = {rth_altitude:120}
  if (txtTitle.value === '工单审核' || txtTitle.value === '工单详情' || txtTitle.value === '工单编辑') {
    const response = await orderLogDetails(rowObj.value.id)
    const data = response.data.data
@@ -383,6 +446,8 @@
    console.log(formParams.value, '898789')
    drone_sns.value = data.device_list
    initMapLine(data.device_map_infos)
  } else {
    initMapPosition()
  }
}, {
  immediate: true // 立即执行一次
@@ -476,7 +541,7 @@
    .step-description {
      font-size: 14px;
      color: #666;
      line-height: 1.5;
      line-height: 2.2;
    }
  }
}
src/views/tickets/component/SearchBox.vue
@@ -2,16 +2,16 @@
  <div class="search-box-test">
    <el-form :model="searchForm" inline>
      <div class="search-first">
        <el-form-item>
        <el-form-item label="关键字:">
          <el-input v-model="searchForm.key_word" placeholder="编号/名称/内容/姓名" clearable />
        </el-form-item>
        <el-form-item label="选择日期:">
        <el-form-item label="选择日期:" :style="{ width: pxToRem(460) }">
          <el-date-picker
            v-model="dateRange"
            type="daterange"
            range-separator="至" start-placeholder="开始日期"
            end-placeholder="结束日期"
            :default-value="datePickerDefaultVal" />
            :default-value="datePickerDefaultVal" @change="handleSearch" />
        </el-form-item>
        <el-form-item label="关联航线:">
          <el-select
@@ -33,8 +33,8 @@
          <el-select
            :teleported="false"
            v-model="searchForm.ai_typesValue"
            placeholder="请选择关联航线"
            clearable>
            placeholder="请选择关联算法"
            clearable @change="handleSearch">
            <el-option
              v-for="item in aiTypeList"
              :key="item.dictKey"
@@ -48,7 +48,8 @@
            :teleported="false"
            :disabled="activeTab === 'WAIT_AUDIT' || activeTab === 'REJECTED' || activeTab === 'PASS'"
            v-model="searchForm.status"
            placeholder="请选择关联航线"
            placeholder="请选择单状态"
            @change="handleSearch"
            clearable>
            <el-option
              v-for="item in orderStatus"
@@ -58,21 +59,21 @@
            />
          </el-select>
        </el-form-item>
        <el-form-item label="工单周期:">
        <el-form-item label="工单周期:" :style="{ width: pxToRem(460) }">
          <el-date-picker
            v-model="cycleDateRange"
            type="daterange"
            range-separator="至" start-placeholder="开始日期"
            end-placeholder="结束日期"
            :default-value="datePickerDefaultVal" />
            :default-value="datePickerDefaultVal" @change="handleSearch"/>
        </el-form-item>
        <el-form-item label="选择频次:">
          <el-select v-model="searchForm.rep_fre_type" placeholder="请选择频次" clearable>
          <el-select v-model="searchForm.rep_fre_type" placeholder="请选择频次" clearable @change="handleSearch">
            <el-option v-for="item in cycles" :key="item" :label="item" :value="item" />
          </el-select>
        </el-form-item>
        <el-form-item label="执行时间:">
          <el-time-picker
          <el-time-picker @change="handleSearch"
            v-model="searchForm.deal_time"
            placeholder="请选择执行时间"
            prop="deal_time"
@@ -285,6 +286,9 @@
    :deep(.el-input__wrapper.is-disabled) {
      box-shadow: 0 0 0 1px #026ad6;
    }
    .el-form-item__label {
      width: 80px;
    }
    .el-form-item {
      margin-bottom: 0;
src/views/tickets/orderLog.vue
@@ -16,34 +16,34 @@
                '0') }}
              </template>
            </el-table-column>
            <el-table-column prop="job_info_num" label="工单编号" width="170">
            <el-table-column prop="job_info_num" label="工单编号" width="150" show-overflow-tooltip>
              <template #default="scope">
                <el-tooltip-copy :content="scope.row.job_info_num" :showCopyText="true">
                  {{scope.row.job_info_num}}
                </el-tooltip-copy>
              </template>
            </el-table-column>
            <el-table-column prop="name" label="工单名称" width="160">
            <el-table-column prop="name" label="工单名称" width="100" show-overflow-tooltip>
              <template #default="scope">
                <el-tooltip-copy :content="scope.row.name" :showCopyText="true">
                  {{scope.row.name}}
                </el-tooltip-copy>
              </template>
            </el-table-column>
            <el-table-column prop="dept_name" label="工单状态">
            <el-table-column prop="dept_name" label="工单状态" width="88">
              <template #default="scope">
                <el-tag :type="getStatusTagType(scope.row.status)">{{ getOrderStatus(scope.row.status) }}</el-tag>
              </template>
            </el-table-column>
            <el-table-column prop="dept_name" label="所属单位" show-overflow-tooltip/>
            <el-table-column prop="create_time" label="创建时间" width="160" show-overflow-tooltip/>
            <el-table-column prop="job_num" label="已执行次数" width="90" align="center" />
            <el-table-column prop="content" label="工单内容" show-overflow-tooltip align="center" />
            <el-table-column prop="dept_name" label="所属单位" width="88" show-overflow-tooltip/>
            <el-table-column prop="create_time" label="创建时间" width="120" show-overflow-tooltip/>
            <el-table-column prop="job_num" label="已执行次数" width="100" align="center" />
            <el-table-column prop="content" label="工单内容" show-overflow-tooltip align="center"/>
            <el-table-column prop="wayline_name" label="关联航线" show-overflow-tooltip />
            <el-table-column prop="ai_type_str" label="关联算法" width="200" align="center" />
            <el-table-column prop="device_names" label="关联机巢" width="200" align="center" />
            <el-table-column prop="creator_name" label="创建人" align="center" show-overflow-tooltip />
            <el-table-column prop="cycle_time_value" label="工单周期频次" align="center" show-overflow-tooltip />
            <el-table-column prop="ai_type_str" label="关联算法" width="100" align="center" show-overflow-tooltip/>
            <el-table-column prop="device_names" label="关联机巢" width="100" align="center" show-overflow-tooltip/>
            <el-table-column prop="creator_name" label="创建人" width="100" align="center" show-overflow-tooltip />
            <el-table-column prop="cycle_time_value" label="工单周期频次" width="110" align="center" show-overflow-tooltip />
            <el-table-column label="操作" width="200" fixed="right" align="center">
              <template #default="scope">
<!--                {{scope.row.status}}-->
@@ -442,7 +442,7 @@
  .task-table {
    //height: 0;
    //flex: 1;
    height: 500px;
    height: 600px;
    margin-top: 18px;
    overflow: auto;
  }