吉安感知网项目-前端
张含笑
2026-01-17 39ec001f02bde6fd7b7a40bdf7b2313df87e8e76
uniapps/work-wx/src/subPackages/flightApplication/add.vue
@@ -373,7 +373,7 @@
        @cancel="isShowFlightRouteInfo = false"
    />
    </u-form>
    <u-button @click="submitForm" color="#1D6FE9">飞行申请</u-button>
    <u-button :disabled="isSubmitDisabled" @click="submitForm" color="#1D6FE9">飞行申请</u-button>
    <!-- 飞任务类型 -->
    <view class="attention">
        注:新增空域/航线/飞手等前往吉安市低空经济服务一体化
@@ -381,7 +381,14 @@
</view>
</template>
<script setup>
import { flightPlanSaveApi, flightRoutePageInfoApi, aircraftInfoPageInfoOfMyApi, pilotInfoPageInfoOfMyApi, flightAirspacePageInfoApi, uploadFileApi } from '@/api/index'
import { flightPlanSaveApi,
    flightRoutePageInfoApi,
    aircraftInfoPageInfoOfMyApi,
    pilotInfoPageInfoOfMyApi,
    droneFlightTaskApi,
    uploadFileApi,
    flightTaskApi,flightRulesApi,flightModeApi,flightPlanApi
 } from '@/api/index'
import { ref, computed, onMounted } from 'vue'
import dayjs from 'dayjs'
@@ -400,7 +407,7 @@
    planType: '', // 计划类型
    planTypeText: '', // 计划类型文本
    contactPerson: '', // 联系人
    contactPhon: '', // 联系人电话
    contactPhone: '', // 联系人电话
    undertaker: '', // 承办人
    undertakerPhone: '', // 承办人电话
    timeRange: '', // 时间范围
@@ -432,13 +439,37 @@
    contactPerson: [
        { required: true, message: '请输入联系人', trigger: 'blur' }
    ],
    contactPhon: [
    contactPhone: [
        // 验证手机号码
        {
            validator: (rule, value, callback) => {
                const reg = /^1[3456789]\d{9}$/
                if (!reg.test(value)) {
                    callback(new Error('请输入正确的手机号码'))
                } else {
                    callback()
                }
            },
            trigger: 'blur'
        },
        { required: true, message: '请输入联系人电话', trigger: 'blur' }
    ],
    undertaker: [
        { required: true, message: '请输入承办人', trigger: 'blur' }
    ],
    undertakerPhone: [
        // 验证手机号码
        {
            validator: (rule, value, callback) => {
                const reg = /^1[3456789]\d{9}$/
                if (!reg.test(value)) {
                    callback(new Error('请输入正确的手机号码'))
                } else {
                    callback()
                }
            },
            trigger: 'blur'
        },
        { required: true, message: '请输入承办人联系电话', trigger: 'blur' }
    ],
    startTime: [
@@ -462,32 +493,7 @@
})
// 任务类型
const isShowFlightTaskType = ref(false)
const actionsFlightTaskType = [
    {
        label: '警务',
        value: '警务',
    },
    {
        label: '文旅',
        value: '文旅',
    },
    {
        label: '航拍',
        value: '航拍',
    },
    {
        label: '物流',
        value: '物流',
    },
    {
        label: '巡检',
        value: '巡检',
    },
    {
        label: '植保',
        value: '植保',
    },
]
const actionsFlightTaskType = ref([])
const onPickerFlightTaskType = (e) => {
  const selected = e.value[0]
  formParams.value.flightTaskType = selected.value
@@ -497,16 +503,7 @@
// 飞行规则
const isShowFlightRule = ref(false)
const actionsFlightRule = [
    {
        label: '目视餡相飞行规则(VFR)',
        value: '目视餡相飞行规则(VFR)',
    },
    {
        label: '仪表飞行规则(IFR)',
        value: '仪表飞行规则(IFR)',
    },
]
const actionsFlightRule = ref([])
const onPickerFlightRule = (e) => {
  const selected = e.value[0]
  formParams.value.flightRule = selected.value
@@ -515,16 +512,7 @@
}
// 飞行方式
const isShowFlightMode = ref(false)
const actionsFlightMode = [
    {
        label: '视距内飞行 (VLOS)',
        value: '视距内飞行 (VLOS)',
    },
    {
        label: '超视距飞行(BVLOS)',
        value: '超视距飞行(BVLOS)',
    },
]
const actionsFlightMode = ref([])
const onPickerFlightMode = (e) => {
  const selected = e.value[0]
  formParams.value.flightMode = selected.value
@@ -533,16 +521,7 @@
}
// 计划类型
const isShowPlanType = ref(false)
const actionsPlanType = [
    {
        label: '一般',
        value: '0',
    },
    {
        label: '紧急',
        value: '1',
    }
]
const actionsPlanType = ref([])
const onPickerPlanType = (e) => {
  const selected = e.value[0]
  formParams.value.planType = selected.value
@@ -611,12 +590,12 @@
const isShowAirspaceInfo = ref(false)
const airspaceInfoList = ref([])
function getAirspaceInfo() {
    flightAirspacePageInfoApi({
    droneFlightTaskApi({
        current: 1,
        size: 1000,
    }).then(res => {
        airspaceInfoList.value = res.data.data.records.map(item => ({
            label: item.airspaceName || '暂无',
            label: item.taskName || '暂无',
            value: item.id,
        }))
    })
@@ -635,7 +614,6 @@
        current: 1,
        size: 1000,
    }).then(res => {
        console.log(res.data.data, '0000')
        flightRouteInfoList.value = res.data.data.records.map(item => ({
            label: item.name,
            value: item.id,
@@ -703,12 +681,14 @@
        });
    });
};
const isSubmitDisabled = ref(false)
// 提交表单
const submitForm = async () => {
  await formRef.value.validate()
  isSubmitDisabled.value = true
  flightPlanSaveApi(formParams.value).then(res => {
    if (res.data.code === 200) {
        isSubmitDisabled.value = true
      uni.showToast({
        title: '提交成功',
        icon: 'success',
@@ -727,7 +707,52 @@
    }
  })
}
// 获取任务类型
function getTaskType() {
    flightTaskApi().then(res => {
        actionsFlightTaskType.value = res.data.data.map(item => ({
            ...item,
            label: item.dictLabel || '暂无',
            value: item.dictValue || '暂无',
        }))
    })
}
// 获取飞行模式
function getFlightMode() {
    flightModeApi().then(res => {
        actionsFlightMode.value = res.data.data.map(item => ({
            ...item,
            label: item.dictLabel || '暂无',
            value: item.dictValue || '暂无',
        }))
    })
}
// 获取飞行规则
function getFlightRules() {
    flightRulesApi().then(res => {
        actionsFlightRule.value = res.data.data.map(item => ({
            ...item,
            label: item.dictLabel || '暂无',
            value: item.dictValue || '暂无',
        }))
    })
}
// 获取飞行计划
function getFlightPlan() {
    flightPlanApi().then(res => {
        actionsPlanType.value = res.data.data.map(item => ({
            ...item,
            label: item.dictLabel || '暂无',
            value: item.dictValue || '暂无',
        }))
    })
}
onMounted(() => {
    // getProTypeApi()
    getTaskType()
    getFlightMode()
    getFlightRules()
    getFlightPlan()
    getAircraftInfo()
    getPilotInfo()
    getAirspaceInfo()