-
+
下载文件模板
@@ -24,7 +24,7 @@
@@ -51,6 +51,7 @@ export default {
fileList: [],
bu: '',
userBuList:[],
+ uploadLoading: false, // 上传loading状态
pageData: {
flag: '',
createBy: '',
@@ -94,12 +95,41 @@ export default {
},
/*关闭modal*/
closeDialog(){
+ // 清空文件列表数据
this.fileList = [];
+ // 清空 el-upload 组件的文件列表
+ if (this.$refs.uploadFile) {
+ this.$refs.uploadFile.clearFiles();
+ }
+ // 重置 BU 选择
+ this.bu = '';
+ // 重置loading状态
+ this.uploadLoading = false;
// 刷新报工的页面
this.$emit('refreshPageTables');
// 关闭当前的页面
this.visible = false;
},
+
+ /*对话框关闭事件 - 确保清理所有数据*/
+ handleDialogClose(){
+ // 清空文件列表数据
+ this.fileList = [];
+ // 清空 el-upload 组件的文件列表
+ if (this.$refs.uploadFile) {
+ this.$refs.uploadFile.clearFiles();
+ }
+ // 重置 BU 选择
+ this.bu = '';
+ // 重置loading状态
+ this.uploadLoading = false;
+ // 重置 pageData
+ this.pageData = {
+ flag: '',
+ createBy: '',
+ site: ''
+ };
+ },
/*保修当前的数据*/
saveUploadFile(){
if (this.pageData.flag !== 'poPartPrint' && (this.bu === '' || this.bu == null)){
@@ -111,6 +141,10 @@ export default {
this.$message.error("请先上传文件!");
return false;
}
+
+ // 开启loading
+ this.uploadLoading = true;
+
const formData = new FormData();
formData.append("file", this.fileList[0].raw);
formData.append("createBy", this.pageData.createBy);
@@ -126,6 +160,11 @@ export default {
}else {
this.$message.warning(data.msg);
}
+ }).catch((error) => {
+ this.$message.error('上传失败:' + (error.message || '网络错误'));
+ }).finally(() => {
+ // 关闭loading
+ this.uploadLoading = false;
})
} else if (this.pageData.flag === 'template') {
formData.set('site',this.bu)
@@ -139,6 +178,11 @@ export default {
}else {
this.$message.warning(data.msg);
}
+ }).catch((error) => {
+ this.$message.error('上传失败:' + (error.message || '网络错误'));
+ }).finally(() => {
+ // 关闭loading
+ this.uploadLoading = false;
})
} else if (this.pageData.flag === 'partAttribute') {
uploadPartAttributeExcel(formData).then(({data}) => {
@@ -151,6 +195,11 @@ export default {
} else {
this.$message.warning(data.msg);
}
+ }).catch((error) => {
+ this.$message.error('上传失败:' + (error.message || '网络错误'));
+ }).finally(() => {
+ // 关闭loading
+ this.uploadLoading = false;
})
} else if (this.pageData.flag === 'poPartPrint') {
// 采购标签导入
@@ -174,9 +223,14 @@ export default {
} else {
this.$message.warning(data.msg);
}
+ }).catch((error) => {
+ this.$message.error('上传失败:' + (error.message || '网络错误'));
+ }).finally(() => {
+ // 关闭loading
+ this.uploadLoading = false;
})
}
- this.bu = '';
+ // 不要在这里重置 bu,因为已经在 closeDialog 中重置了
},
// 下载
async downloadFile(){
diff --git a/src/views/modules/yieldReport/com_process_inspection.vue b/src/views/modules/yieldReport/com_process_inspection.vue
index a592856..2c07954 100644
--- a/src/views/modules/yieldReport/com_process_inspection.vue
+++ b/src/views/modules/yieldReport/com_process_inspection.vue
@@ -320,12 +320,6 @@
-
-
-
-
-
-
@@ -392,14 +386,14 @@
label="项目编号">
-
+