From 801a3bc53415f6214800c561a562d17ea58b88f1 Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期三, 01 四月 2026 11:40:14 +0800
Subject: [PATCH] 军泰伟业 1.bom导入和产品导入成功和失败逻辑修改

---
 src/views/productionManagement/productStructure/index.vue |   39 ++++++++++++++++++++++++++++++++++-----
 1 files changed, 34 insertions(+), 5 deletions(-)

diff --git a/src/views/productionManagement/productStructure/index.vue b/src/views/productionManagement/productStructure/index.vue
index 93f9112..fb9e7d8 100644
--- a/src/views/productionManagement/productStructure/index.vue
+++ b/src/views/productionManagement/productStructure/index.vue
@@ -45,7 +45,7 @@
     <!-- BOM瀵煎叆瀵硅瘽妗� -->
     <ImportDialog ref="uploadRef" v-model="upload.open" :title="upload.title" :action="upload.url"
       :headers="upload.headers" :disabled="upload.isUploading" :on-progress="handleFileUploadProgress"
-      :on-success="handleFileSuccess" :show-download-template="true" @confirm="submitFileForm"
+      :on-success="handleFileSuccess" :on-error="handleFileError" :show-download-template="true" @confirm="submitFileForm"
       @download-template="handleDownloadTemplate" @close="handleImportClose" />
   </div>
 </template>
@@ -334,7 +334,7 @@
 };
 
 //  鏂囦欢涓婁紶鎴愬姛澶勭悊
-const handleFileSuccess = (response, file, fileList) => {
+const handleFileSuccess = (response, file) => {
   upload.open = false;
   upload.isUploading = false;
   proxy.$refs["uploadRef"].clearFiles();
@@ -342,13 +342,42 @@
     proxy.$modal.msgSuccess(response.msg || "瀵煎叆鎴愬姛");
     getList();
   } else {
-    proxy.$alert("<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>" + response.msg + "</div>", "瀵煎叆缁撴灉", { dangerouslyUseHTMLString: true });
+    proxy.$modal.msgError(response.msg || "瀵煎叆澶辫触");
   }
 };
 
-// 鎻愪氦涓婁紶鏂囦欢
+// 鏂囦欢涓婁紶澶辫触澶勭悊 - 鍚庣杩斿洖閿欒鏂囦欢娴�
+const handleFileError = (error, file) => {
+  upload.open = false;
+  upload.isUploading = false;
+  proxy.$refs["uploadRef"].clearFiles();
+  
+  // error 鍙兘鏄� Blob 瀵硅薄锛堝悗绔繑鍥炵殑閿欒鏂囦欢锛�
+  if (error instanceof Blob) {
+    // 涓嬭浇閿欒鏂囦欢
+    const blob = error;
+    const downloadElement = document.createElement('a');
+    const href = window.URL.createObjectURL(blob);
+    downloadElement.href = href;
+    downloadElement.download = "瀵煎叆閿欒鏁版嵁.xlsx";
+    document.body.appendChild(downloadElement);
+    downloadElement.click();
+    document.body.removeChild(downloadElement);
+    window.URL.revokeObjectURL(href);
+    proxy.$modal.msgError("瀵煎叆澶辫触锛岃鏌ョ湅涓嬭浇鐨勯敊璇枃浠�");
+  } else if (error && error.msg) {
+    // 鍚庣杩斿洖鐨勯敊璇俊鎭�
+    proxy.$modal.msgError(error.msg);
+  } else {
+    // 鏅�氶敊璇�
+    proxy.$modal.msgError("瀵煎叆澶辫触");
+  }
+};
+
+// 鎻愪氦涓婁紶鏂囦欢 - 鐜板湪鐢� ImportDialog 鍐呴儴澶勭悊
 const submitFileForm = () => {
-  proxy.$refs["uploadRef"].submit();
+  // ImportDialog 鐨� handleConfirm 浼氳皟鐢� uploadRef.value.submit()
+  // 杩欓噷涓嶉渶瑕侀澶栨搷浣�
 };
 
 //  瀵煎嚭鎸夐挳鎿嶄綔

--
Gitblit v1.9.3