From 9197799574b4e1cb918771f424b93c11c7da8317 Mon Sep 17 00:00:00 2001
From: 张含笑 <zhx18749296735@163.com>
Date: Fri, 23 Jan 2026 17:08:34 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 uniapps/work-wx/src/subPackages/deviceRegistration/add.vue |   96 ++++++++++++++++++++++++++---------------------
 1 files changed, 53 insertions(+), 43 deletions(-)

diff --git a/uniapps/work-wx/src/subPackages/deviceRegistration/add.vue b/uniapps/work-wx/src/subPackages/deviceRegistration/add.vue
index 12c7a53..5bf7f64 100644
--- a/uniapps/work-wx/src/subPackages/deviceRegistration/add.vue
+++ b/uniapps/work-wx/src/subPackages/deviceRegistration/add.vue
@@ -260,7 +260,7 @@
         @cancel="showPurchaseDate = false"
         />
         <!-- 所属区域 -->
-        <u-cascader 
+        <u-cascader
             v-model:show="isShowRegion"
             v-model="formParams.regionCode"
             :data="areaData"
@@ -282,6 +282,10 @@
 import { aircraftInfoSaveApi,uploadFileApi, areaDataApi, proTypeApi, manufacturerInfoApi } from '@/api/index'
 import { ref, computed, onMounted } from 'vue'
 import dayjs from 'dayjs'
+
+// 获取store中的数据 字典
+import { useAppStore, useUserStore } from "@/store";
+const appStore = useAppStore()
 
 const formRef = ref(null);
 const formParams = ref({
@@ -326,6 +330,10 @@
     isModifiedText: [
         { required: true, message: '请选择是否改装', trigger: 'change' }
     ],
+    type: [
+        { required: true, message: '请选择飞行器类型', trigger: 'change' }
+    ],
+
 })
 // 是否改装
 const actionsModified = ref([
@@ -356,31 +364,29 @@
 const findRegionNamesByCodes = (codes, areaData) => {
   const result = []
   let currentData = areaData
-  
+
   for (const code of codes) {
     // 转换为字符串比较(因为code可能是字符串类型)
     const codeStr = code.toString()
     const item = currentData.find(item => item.code === codeStr)
-    
+
     if (!item) {
       console.warn(`未找到code为 ${codeStr} 的行政区划`)
       break
     }
-    
+
     result.push(item.name)
     currentData = item.children || []
   }
-  
+
   return result
 }
 
 // 所属区域确认
 const onRegionConfirm = (e) => {
-    console.log(e,'888')
     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
 }
@@ -412,13 +418,14 @@
   formParams.value.manufacturerText = selected.label
   showManufacturer.value = false
 }
-// 飞行器型号
+// 飞行器类型
 const showType = ref(false);
-const typeList = ref([])
-// 选择飞行器型号
+const typeList = ref(appStore.getProType)
+// 选择飞行器类型
 const onPickerConfirmType = (e) => {
   const selected = e.value[0]
   formParams.value.type = selected.value
+  console.log(formParams.value.type,'6666')
   formParams.value.typeText = selected.label
   showType.value = false
 }
@@ -427,36 +434,36 @@
     // 获取上传的文件对象
     const file = event.file;
     console.log('上传的文件:', file);
-    
+
     // 显示加载提示
     uni.showLoading({
         title: '上传中...'
     });
-    
+
     // 准备上传参数
     const uploadParams = {
         name: 'file', // 服务器端接收文件的字段名
         file: file, // 传入文件对象
         filePath: file.path || file.url, // 文件路径
     };
-    
+
     // 调用上传文件接口
     uploadFileApi(uploadParams).then(res => {
         uni.hideLoading();
-        
+
         console.log('上传成功结果:', res);
-        
+
         // 根据接口返回的数据结构处理结果
         if (res.data && res.data.code === 200) {
             // 假设接口返回的数据结构是 { url, fileName } 等
             const uploadResult = res.data.data;
-            
+
             // 更新表单数据,将上传结果展示在input内
             formParams.value.caacRegistrationCodeText = uploadResult.fileName || uploadResult.url || '文件上传成功';
-            
+
             // 可以将完整的上传信息保存到表单中,以便提交时使用
             formParams.value.caacRegistrationCode= uploadResult.fileUrl || '文件上传成功';
-            
+
             uni.showToast({
                 title: '上传成功',
                 icon: 'success'
@@ -491,36 +498,36 @@
     // 获取上传的文件对象
     const file = event.file;
     console.log('上传的文件:', file);
-    
+
     // 显示加载提示
     uni.showLoading({
         title: '上传中...'
     });
-    
+
     // 准备上传参数
     const uploadParams = {
         name: 'file', // 服务器端接收文件的字段名
         file: file, // 传入文件对象
         filePath: file.path || file.url, // 文件路径
     };
-    
+
     // 调用上传文件接口
     uploadFileApi(uploadParams).then(res => {
         uni.hideLoading();
-        
+
         console.log('上传成功结果:', res);
-        
+
         // 根据接口返回的数据结构处理结果
         if (res.data && res.data.code === 200) {
             // 假设接口返回的数据结构是 { url, fileName } 等
             const uploadResult = res.data.data;
-            
+
             // 更新表单数据,将上传结果展示在input内
             formParams.value.deviceImageText = uploadResult.fileName || uploadResult.url || '文件上传成功';
-            
+
             // 可以将完整的上传信息保存到表单中,以便提交时使用
             formParams.value.deviceImage= uploadResult.fileUrl || '文件上传成功';
-            
+
             uni.showToast({
                 title: '上传成功',
                 icon: 'success'
@@ -571,15 +578,15 @@
     }
 }
 // 获取飞行器类型
-function getProTypeApi() {
-    proTypeApi().then(res => {
-        typeList.value = res.data.data.map(item => ({
-            ...item,
-            label: item.dictLabel,
-            value: item.dictValue
-        }))
-    })
-}
+// function getProTypeApi() {
+//     proTypeApi().then(res => {
+//         typeList.value = res.data.data.map(item => ({
+//             ...item,
+//             label: item.dictLabel,
+//             value: item.dictValue
+//         }))
+//     })
+// }
 // 获取无人机厂商
 function getManufacturerInfoApi() {
     manufacturerInfoApi({
@@ -594,7 +601,6 @@
     })
 }
 onMounted(async () => {
-    getProTypeApi()
     getManufacturerInfoApi()
     // 动态从外部URL导入xzqhData,确保在使用前已初始化
     // 注意:直接动态导入外部URL可能会有跨域或构建问题,建议检查服务器CORS设置
@@ -610,11 +616,11 @@
     display: flex;
     flex-direction: column;
     // padding: 24rpx;
-    
+
     .select-wrapper {
         position: relative;
         width: 100%;
-        
+
         .select-icon {
             position: absolute;
             right: 20rpx;
@@ -624,6 +630,10 @@
             font-size: 24rpx;
             pointer-events: none;
         }
+    }
+
+    :deep(.u-toolbar__wrapper__confirm) {
+        color: #1D6FE9;
     }
 
     .upload {
@@ -656,7 +666,7 @@
         border-radius: 8rpx 8rpx 8rpx 8rpx;
         margin-bottom: 20rpx;
     }
-    
+
     :deep(.u-form-item) {
         margin-bottom: 20rpx;
         padding: 16rpx 24rpx 18rpx 24rpx;
@@ -671,7 +681,7 @@
             border-radius: 8rpx;
             padding: 0 20rpx;
             background-color: #f5f5f5;
-            
+
             &::placeholder {
                 font-family: Source Han Sans CN, Source Han Sans CN;
                 font-weight: 400;
@@ -679,12 +689,12 @@
                 color: #D2D2D2;
             }
         }
-        
+
         .clickable-input {
             width: 100%;
             cursor: pointer;
         }
-        
+
         :deep(.u-form-item__label) {
             margin-bottom: 20rpx;
             // font-weight: bold;
@@ -694,7 +704,7 @@
             font-size: 30rpx;
             color: #222324;
         }
-        
+
         :deep(.u-form-item__required) {
             color: #FF2600;
             margin-right: 8rpx;

--
Gitblit v1.9.3