| | |
| | | <u-form-item |
| | | label="持有人" |
| | | labelWidth="200rpx" |
| | | prop="aircraftName" |
| | | prop="holder" |
| | | :borderBottom="true" |
| | | ref="item1" |
| | | > |
| | | <u-input |
| | | v-model="formParams.aircraftName" |
| | | v-model="formParams.holder" |
| | | border="none" |
| | | placeholder="请输入" |
| | | ></u-input> |
| | |
| | | @cancel="isShowRegion = false" |
| | | ></u-cascader> |
| | | </u-form> |
| | | <u-button @click="submitForm" color="#1D6FE9">提交</u-button> |
| | | <u-button :disabled="isSubmitDisabled" @click="submitForm" color="#1D6FE9">提交</u-button> |
| | | <!-- <u-button class="submit-button-wrapper" color="#1D6FE9" size="large" @click="submitForm"> |
| | | 注册 |
| | | </u-button> --> |
| | | </view> |
| | | </template> |
| | | <script setup> |
| | | import { aircraftInfoSaveApi,uploadFileApi,areaDataApi } from '@/api/index' |
| | | import { aircraftInfoSaveApi,uploadFileApi, areaDataApi, proTypeApi, manufacturerInfoApi } from '@/api/index' |
| | | import { ref, computed, onMounted } from 'vue' |
| | | import dayjs from 'dayjs' |
| | | |
| | |
| | | // 所属区域确认 |
| | | const onRegionConfirm = (e) => { |
| | | console.log(e,'888') |
| | | formParams.value.region = e?.join(',')[2] || '' // 用逗号分隔的区域码 |
| | | formParams.value.region = e[2] || '' // 用逗号分隔的区域码 |
| | | // 通过arrRegion的数组值为[36,3608,360824] 从areaData里面反查出名称 |
| | | const regionNames = findRegionNamesByCodes(e, areaData.value) |
| | | console.log(regionNames, '77777') |
| | | formParams.value.regionText = regionNames.join('-') || '' // 用连字符连接的区域名称 |
| | | isShowRegion.value = false |
| | | isShowRegion.value = false |
| | | } |
| | | // 是否有保险 |
| | | const actionsHasInsurance = ref([ |
| | |
| | | } |
| | | // 飞行器厂商 |
| | | const showManufacturer = ref(false); |
| | | const manufacturerList = ref([ |
| | | { |
| | | label: 'A厂商', |
| | | value: 'A厂商' |
| | | }, |
| | | { |
| | | label: 'B厂商', |
| | | value: 'B厂商' |
| | | }, |
| | | ]) |
| | | const manufacturerList = ref([]) |
| | | // 选择飞行器厂商 |
| | | const onPickerConfirmManufacturer = (e) => { |
| | | const selected = e.value[0] |
| | |
| | | } |
| | | // 飞行器型号 |
| | | const showType = ref(false); |
| | | const typeList = ref([ |
| | | { |
| | | label: 'A型号', |
| | | value: 'A型号' |
| | | }, |
| | | { |
| | | label: 'B型号', |
| | | value: 'B型号' |
| | | }, |
| | | ]) |
| | | const typeList = ref([]) |
| | | // 选择飞行器型号 |
| | | const onPickerConfirmType = (e) => { |
| | | const selected = e.value[0] |
| | |
| | | }); |
| | | } |
| | | // 提交表单 |
| | | const isSubmitDisabled = ref(false) |
| | | const submitForm = async () => { |
| | | try { |
| | | if (await formRef.value.validate()) { |
| | | isSubmitDisabled.value = true |
| | | const res = await aircraftInfoSaveApi(formParams.value) |
| | | if (res.data.code === 200) { |
| | | isSubmitDisabled.value = false |
| | | uni.showToast({ |
| | | title: '航空器注册成功', |
| | | icon: 'success' |
| | |
| | | // 这里可以添加额外的失败处理逻辑 |
| | | } |
| | | } |
| | | // 获取飞行器类型 |
| | | function getProTypeApi() { |
| | | proTypeApi().then(res => { |
| | | typeList.value = res.data.data.map(item => ({ |
| | | ...item, |
| | | label: item.dictLabel, |
| | | value: item.dictValue |
| | | })) |
| | | }) |
| | | } |
| | | // 获取无人机厂商 |
| | | function getManufacturerInfoApi() { |
| | | manufacturerInfoApi({ |
| | | current: 1, |
| | | size: 1000, |
| | | }).then(res => { |
| | | manufacturerList.value = res.data.data.records.map(item => ({ |
| | | ...item, |
| | | label: item.unitName, |
| | | value: item.id, |
| | | })) |
| | | }) |
| | | } |
| | | onMounted(async () => { |
| | | getProTypeApi() |
| | | getManufacturerInfoApi() |
| | | // 动态导入xzqhData,确保在使用前已初始化 |
| | | const { xzqhData } = await import('@/static/xzqh/index') |
| | | // console.log(xzqhData,'9999') |
| | | // xzqhData.map 循环三层 |
| | | // 第一层:省份 |
| | | // 第二层:城市 |
| | | // 第三层:区县 |
| | | areaData.value = xzqhData |
| | | // xzqhData.map(item => ({ |
| | | // label: item.name, |
| | | // value: item.code, |
| | | // children: item.children.map(child => ({ |
| | | // label: child.name, |
| | | // value: child.code, |
| | | // children: child.children?.map(district => ({ |
| | | // label: district.name, |
| | | // value: district.code |
| | | // })) || [] |
| | | // })) |
| | | // })) |
| | | // console.log(areaData.value, '8888') |
| | | |
| | | }) |
| | | </script> |
| | | <style scoped lang="scss"> |