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