From c52a0824baaa86a719da04fba3ff65fc48a70422 Mon Sep 17 00:00:00 2001
From: spring <2396852758@qq.com>
Date: 星期四, 19 三月 2026 17:37:05 +0800
Subject: [PATCH] fix: 入库数量必填

---
 src/pages/inspectionUpload/index.vue |   56 +++++++++++++++++++++++++++++++++++++++-----------------
 1 files changed, 39 insertions(+), 17 deletions(-)

diff --git a/src/pages/inspectionUpload/index.vue b/src/pages/inspectionUpload/index.vue
index 86a9b80..c0293dd 100644
--- a/src/pages/inspectionUpload/index.vue
+++ b/src/pages/inspectionUpload/index.vue
@@ -27,7 +27,7 @@
                 fontSize: '12px',
                 marginRight: '8px'
               }">
-                鎵爜涓婁紶
+                宸℃涓婁紶
               </u-button>
               <u-button type="success"
                         size="small"
@@ -153,7 +153,7 @@
                           style="margin-right: 5px;"></u-icon>
                   {{ uploading ? '涓婁紶涓�...' : '鎷嶇収' }}
                 </u-button>
-                <u-button type="success"
+                <!-- <u-button type="success"
                           @click="chooseMedia('video')"
                           :loading="uploading"
                           :disabled="getCurrentFiles().length >= uploadConfig.limit"
@@ -164,7 +164,7 @@
                              color="#fff"
                              style="margin-right: 5px;"></uni-icons>
                   {{ uploading ? '涓婁紶涓�...' : '鎷嶈棰�' }}
-                </u-button>
+                </u-button> -->
               </view>
               <!-- 涓婁紶杩涘害 -->
               <view v-if="uploading"
@@ -180,6 +180,13 @@
                       :key="index"
                       class="file-item">
                   <view class="file-preview-container">
+                    <!-- 鍒犻櫎鎸夐挳 -->
+                    <view class="delete-btn"
+                          @click="removeFile(index)">
+                      <u-icon name="close"
+                              size="12"
+                              color="#fff"></u-icon>
+                    </view>
                     <image v-if="file.type === 'image' || (file.type !== 'video' && !file.type)"
                            :src="file.url || file.tempFilePath || file.path || file.downloadUrl"
                            class="file-preview"
@@ -193,13 +200,6 @@
                                  style="margin-right: 5px;"></uni-icons>
                       <text class="video-text">瑙嗛</text>
                     </view>
-                    <!-- 鍒犻櫎鎸夐挳 -->
-                    <view class="delete-btn"
-                          @click="removeFile(index)">
-                      <u-icon name="close"
-                              size="12"
-                              color="#fff"></u-icon>
-                    </view>
                   </view>
                   <view class="file-info">
                     <text class="file-name">{{ file.bucketFilename || file.name || (file.type === 'image' ? '鍥剧墖' : '瑙嗛')
@@ -210,7 +210,7 @@
               </view>
               <view v-if="getCurrentFiles().length === 0"
                     class="empty-state">
-                <text>璇烽�夋嫨瑕佷笂浼犵殑{{ getUploadTypeText() }}鍥剧墖鎴栬棰�</text>
+                <text>璇烽�夋嫨瑕佷笂浼犵殑{{ getUploadTypeText() }}鍥剧墖</text>
               </view>
               <!-- 缁熻淇℃伅 -->
               <!-- <view class="upload-summary">
@@ -281,8 +281,9 @@
                       class="attachment-item"
                       @click="previewAttachment(file)">
                   <view class="attachment-preview-container">
+                    <!-- {{formatFileUrl(file.url || file.downloadUrl)}} -->
                     <image v-if="file.type === 'image' || isImageFile(file)"
-                           :src="file.url || file.downloadUrl"
+                           :src="formatFileUrl(file.url || file.downloadUrl)"
                            class="attachment-preview"
                            mode="aspectFill" />
                     <view v-else
@@ -410,7 +411,7 @@
 
   // 璁$畻涓婁紶URL
   const uploadFileUrl = computed(() => {
-    const baseUrl = "http://192.168.1.35:8888";
+    const baseUrl = config.baseUrl;
 
     return baseUrl + uploadConfig.action;
   });
@@ -825,6 +826,11 @@
 
   // 鎻愪氦涓婁紶
   const submitUpload = async () => {
+    // console.log("鎻愪氦涓婁紶鏁版嵁:", {
+    //   before: beforeModelValue.value,
+    //   after: afterModelValue.value,
+    //   issue: issueModelValue.value,
+    // });
     try {
       // 妫�鏌ユ槸鍚﹂�夋嫨浜嗗紓甯哥姸鎬�
       if (hasException.value === null) {
@@ -857,12 +863,15 @@
       let arr = [];
       if (beforeModelValue.value.length > 0) {
         arr.push(...beforeModelValue.value);
+        infoData.value.beforeModelValue = beforeModelValue.value;
       }
       if (afterModelValue.value.length > 0) {
         arr.push(...afterModelValue.value);
+        infoData.value.afterModelValue = afterModelValue.value;
       }
       if (issueModelValue.value.length > 0) {
         arr.push(...issueModelValue.value);
+        infoData.value.issueModelValue = issueModelValue.value;
       }
 
       // 浼犵粰鍚庣鐨勪复鏃舵枃浠禝D鍒楄〃锛坱empFileIds锛�
@@ -1045,7 +1054,7 @@
   };
 
   // 鏂囦欢璁块棶鍩虹鍩燂紙鍚庣瑕佹眰鍓嶇紑锛�
-  const filePreviewBase = "http://192.168.1.35:8888";
+  const filePreviewBase = config.fileUrl;
 
   // 灏嗗悗绔繑鍥炵殑鏂囦欢鍦板潃瑙勮寖鎴愬彲璁块棶URL
   // 鍏煎鍦烘櫙锛�
@@ -1558,7 +1567,7 @@
     };
 
     uploadList.value.push(fileData);
-
+    console.log("娣诲姞鍒板垎绫诲墠:", fileData);
     // 绔嬪嵆娣诲姞鍒板搴旂殑鍒嗙被锛屼笉绛夊緟鎵�鏈夋枃浠朵笂浼犲畬鎴�
     switch (currentUploadType.value) {
       case "before":
@@ -1581,7 +1590,19 @@
   const uploadedSuccessfully = () => {
     // 姝ゅ嚱鏁板凡涓嶅啀浣跨敤锛屾枃浠朵笂浼犳垚鍔熷悗绔嬪嵆娣诲姞鍒板搴斿垎绫�
   };
-
+  // 鏍煎紡鍖栨枃浠禪RL
+  const formatFileUrl = url => {
+    if (!url) return "";
+    if (url.startsWith("http://") || url.startsWith("https://")) {
+      return url;
+    }
+    // const uploadsIndex = url.indexOf("uploads");
+    // if (uploadsIndex !== -1) {
+    //   const relativePath = url.substring(uploadsIndex);
+    //   return `${config.fileUrl}/${relativePath}`;
+    // }
+    return `${config.fileUrl}/${url}`;
+  };
   // 鏍煎紡鍖栨枃浠跺ぇ灏�
   const formatFileSize = size => {
     if (!size) return "";
@@ -1783,7 +1804,7 @@
     right: 0;
     bottom: 0;
     background: rgba(0, 0, 0, 0.5);
-    z-index: 10000;
+    z-index: 100;
     display: flex;
     align-items: center;
     justify-content: center;
@@ -1922,6 +1943,7 @@
     cursor: pointer;
     box-shadow: 0 2px 4px rgba(255, 71, 87, 0.3);
     transition: all 0.3s ease;
+    z-index: 1000;
   }
 
   .delete-btn:hover {

--
Gitblit v1.9.3