From f0f22709fb7f9945e5bc246181e21fd0c282e694 Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期四, 04 六月 2026 15:51:29 +0800
Subject: [PATCH] 马铃薯app 1.客户往来、供应商往来查询展示修改 2.环境检测页面展示修改

---
 src/pages/inspectionUpload/components/formDia.vue |  167 +++++++++++++++++--------------------------------------
 1 files changed, 52 insertions(+), 115 deletions(-)

diff --git a/src/pages/inspectionUpload/components/formDia.vue b/src/pages/inspectionUpload/components/formDia.vue
index 62bf40f..6ff1f12 100644
--- a/src/pages/inspectionUpload/components/formDia.vue
+++ b/src/pages/inspectionUpload/components/formDia.vue
@@ -1,7 +1,7 @@
 <template>
-  <u-popup 
-    v-model="dialogVisitable" 
-    mode="center" 
+  <u-popup
+    v-model="dialogVisitable"
+    mode="center"
     :round="10"
     :closeable="true"
     @close="cancel"
@@ -10,23 +10,23 @@
       <view class="popup-header">
         <text class="popup-title">宸℃璁板綍涓婁紶</text>
       </view>
-      
+
       <view class="upload-container">
         <!-- 寮傚父鐘舵�侀�夋嫨 -->
         <view class="form-container">
           <view class="title">宸℃鐘舵��</view>
           <view class="exception-section">
             <view class="exception-options">
-              <view 
-                class="exception-option" 
+              <view
+                class="exception-option"
                 :class="{ active: hasException === false }"
                 @click="setExceptionStatus(false)"
               >
                 <u-icon name="checkmark-circle" size="20" color="#52c41a"></u-icon>
                 <text class="option-text">姝e父</text>
               </view>
-              <view 
-                class="exception-option" 
+              <view
+                class="exception-option"
                 :class="{ active: hasException === true }"
                 @click="setExceptionStatus(true)"
               >
@@ -48,54 +48,23 @@
             :customStyle="{ padding: '10px', backgroundColor: '#f5f5f5' }"
           />
         </view>
-        
+
         <!-- 涓婁紶鍖哄煙锛堜粎鍦ㄥ紓甯告椂鏄剧ず锛� -->
-        <template v-if="hasException === true">
-          <view class="form-container">
-            <view class="title">鐢熶骇鍓�</view>
-            <u-upload
-              :fileList="beforeModelValue"
-              @afterRead="afterRead"
-              @delete="deleteFile"
-              name="before"
-              multiple
-              :maxCount="10"
-              :maxSize="5 * 1024 * 1024"
-              accept="image/*"
-              :previewFullImage="true"
-            ></u-upload>
-          </view>
-          
-          <view class="form-container">
-            <view class="title">鐢熶骇鍚�</view>
-            <u-upload
-              :fileList="afterModelValue"
-              @afterRead="afterRead"
-              @delete="deleteFile"
-              name="after"
-              multiple
-              :maxCount="10"
-              :maxSize="5 * 1024 * 1024"
-              accept="image/*"
-              :previewFullImage="true"
-            ></u-upload>
-          </view>
-          
-          <view class="form-container">
-            <view class="title">鐢熶骇闂</view>
-            <u-upload
-              :fileList="issueModelValue"
-              @afterRead="afterRead"
-              @delete="deleteFile"
-              name="issue"
-              multiple
-              :maxCount="10"
-              :maxSize="5 * 1024 * 1024"
-              accept="image/*"
-              :previewFullImage="true"
-            ></u-upload>
-          </view>
-        </template>
+        <view class="form-container" v-if="hasException === true">
+          <view class="title">涓婁紶闄勪欢</view>
+          <text class="upload-count">宸蹭笂浼�: {{ fileList.length }}涓枃浠�</text>
+          <u-upload
+            :fileList="fileList"
+            @afterRead="afterRead"
+            @delete="deleteFile"
+            name="attachment"
+            multiple
+            :maxCount="30"
+            :maxSize="5 * 1024 * 1024"
+            accept="image/*"
+            :previewFullImage="true"
+          ></u-upload>
+        </view>
 
         <!-- 姝e父鐘舵�佹彁绀� -->
         <view class="form-container normal-tip" v-if="hasException === false">
@@ -103,7 +72,7 @@
           <text class="tip-text">璁惧杩愯姝e父锛屾棤闇�涓婁紶鐓х墖</text>
         </view>
       </view>
-      
+
       <view class="popup-footer">
         <u-button @click="cancel" :customStyle="{ marginRight: '10px' }">鍙栨秷</u-button>
         <u-button type="primary" @click="submitForm">淇濆瓨</u-button>
@@ -121,9 +90,7 @@
 const emit = defineEmits(['closeDia'])
 
 const dialogVisitable = ref(false)
-const beforeModelValue = ref([])
-const afterModelValue = ref([])
-const issueModelValue = ref([])
+const fileList = ref([])
 const infoData = ref(null)
 
 // 寮傚父鐘舵�侊細null=鏈�夋嫨, false=姝e父, true=寮傚父
@@ -134,13 +101,13 @@
 // 璁$畻涓婁紶URL
 const uploadFileUrl = computed(() => {
   let baseUrl = '';
-  
+
   if (process.env.VUE_APP_BASE_API) {
     baseUrl = process.env.VUE_APP_BASE_API;
   } else {
     baseUrl = config.baseUrl;
   }
-  
+
   return baseUrl + '/file/upload';
 })
 
@@ -203,29 +170,12 @@
 
 // 鏂囦欢涓婁紶澶勭悊
 const afterRead = (event) => {
-  const { name, file } = event
-  
-  // 鏍规嵁涓婁紶绫诲瀷璁剧疆涓嶅悓鐨則ype鍊�
-  let typeValue = 10 // 榛樿鍊�
-  if (name === 'before') {
-    typeValue = 10 // 鐢熶骇鍓�
-  } else if (name === 'after') {
-    typeValue = 11 // 鐢熶骇涓�
-  } else if (name === 'issue') {
-    typeValue = 12 // 鐢熶骇鍚�
-  }
-
+  const { file } = event
   const files = Array.isArray(file) ? file : [file]
   Promise.resolve().then(async () => {
     for (const f of files) {
-      const uploaded = await uploadSingleFile(f, typeValue)
-      if (name === 'before') {
-        beforeModelValue.value.push(uploaded)
-      } else if (name === 'after') {
-        afterModelValue.value.push(uploaded)
-      } else if (name === 'issue') {
-        issueModelValue.value.push(uploaded)
-      }
+      const uploaded = await uploadSingleFile(f, 10)
+      fileList.value.push(uploaded)
     }
     uni.showToast({ title: '涓婁紶鎴愬姛', icon: 'success' })
   }).catch((err) => {
@@ -236,15 +186,8 @@
 
 // 鍒犻櫎鏂囦欢
 const deleteFile = (event) => {
-  const { name, index } = event
-  
-  if (name === 'before') {
-    beforeModelValue.value.splice(index, 1)
-  } else if (name === 'after') {
-    afterModelValue.value.splice(index, 1)
-  } else if (name === 'issue') {
-    issueModelValue.value.splice(index, 1)
-  }
+  const { index } = event
+  fileList.value.splice(index, 1)
 }
 
 // 璁剧疆寮傚父鐘舵��
@@ -266,8 +209,7 @@
 
     // 濡傛灉鏄紓甯哥姸鎬侊紝妫�鏌ユ槸鍚︽湁涓婁紶鏂囦欢
     if (hasException.value === true) {
-      const totalFiles = beforeModelValue.value.length + afterModelValue.value.length + issueModelValue.value.length
-      if (totalFiles === 0) {
+      if (fileList.value.length === 0) {
         uni.showToast({
           title: '璇蜂笂浼犲紓甯哥収鐗�',
           icon: 'none'
@@ -284,28 +226,17 @@
       }
     }
 
-    let arr = []
-    if (beforeModelValue.value.length > 0) {
-      arr.push(...beforeModelValue.value.map(item => ({ ...item, statusType: 0 })))
-    }
-    if (afterModelValue.value.length > 0) {
-      arr.push(...afterModelValue.value.map(item => ({ ...item, statusType: 1 })))
-    }
-    if (issueModelValue.value.length > 0) {
-      arr.push(...issueModelValue.value.map(item => ({ ...item, statusType: 2 })))
-    }
-    
     // 鎻愪氦鏁版嵁
-    infoData.value.storageBlobDTO = arr
+    infoData.value.commonFileListDTO = fileList.value
     infoData.value.hasException = hasException.value
     infoData.value.exceptionDescription = exceptionDescription.value
     await submitInspectionRecord({ ...infoData.value })
-    
+
     uni.showToast({
       title: '鎻愪氦鎴愬姛',
       icon: 'success'
     })
-    
+
     cancel()
   } catch (error) {
     console.error('鎻愪氦澶辫触:', error)
@@ -320,11 +251,9 @@
 const openDialog = async (row) => {
   infoData.value = row
   dialogVisitable.value = true
-  
+
   // 娓呯┖涔嬪墠鐨勬暟鎹�
-  beforeModelValue.value = []
-  afterModelValue.value = []
-  issueModelValue.value = []
+  fileList.value = []
   hasException.value = null
   exceptionDescription.value = ''
 }
@@ -367,10 +296,18 @@
 
 .form-container {
   margin-bottom: 20px;
-  
+
   &:last-child {
     margin-bottom: 0;
   }
+}
+
+.upload-count {
+  display: block;
+  font-size: 12px;
+  color: #999;
+  margin-bottom: 8px;
+  padding-left: 10px;
 }
 
 .title {
@@ -381,7 +318,7 @@
   padding-left: 10px;
   position: relative;
   margin: 6px 0 10px;
-  
+
   &::before {
     content: "";
     position: absolute;
@@ -423,12 +360,12 @@
   cursor: pointer;
   transition: all 0.3s;
   background-color: #fff;
-  
+
   &.active {
     border-color: #1890ff;
     background-color: #e6f7ff;
   }
-  
+
   &:active {
     opacity: 0.8;
   }
@@ -450,7 +387,7 @@
   background-color: #f6ffed;
   border: 1px dashed #b7eb8f;
   border-radius: 8px;
-  
+
   .tip-text {
     margin-top: 15px;
     font-size: 14px;

--
Gitblit v1.9.3