diff --git a/.env.dev b/.env.dev index 526323a3..e0b89faf 100644 --- a/.env.dev +++ b/.env.dev @@ -12,9 +12,9 @@ VUE_APP_TITLE = 洛玻集团驾驶舱 # 杨姗姗 # VUE_APP_BASE_API = 'http://172.16.20.218:7070' # 小田 -VUE_APP_BASE_API = 'http://172.16.19.232:7070' +# VUE_APP_BASE_API = 'http://172.16.19.232:7070' # 测试 -# VUE_APP_BASE_API = 'http://192.168.0.35:8080' +VUE_APP_BASE_API = 'http://192.168.0.35:8080' # 闫阳 # VUE_APP_BASE_API = 'http://172.16.19.131:7070' diff --git a/src/views/home/components/budgetDetails.vue b/src/views/home/components/budgetDetails.vue index c4a3adc3..90fbb87c 100644 --- a/src/views/home/components/budgetDetails.vue +++ b/src/views/home/components/budgetDetails.vue @@ -75,8 +75,8 @@ :key="tableKey"> - - +
将文件拖到此处,或点击上传
@@ -90,9 +90,15 @@
+
+
+
+
+ 正在上传 +
@@ -134,11 +140,11 @@ export default { open: false, // 弹出层标题 title: "预算填报导入", - // 是否禁用上传 - isUploading: false, fileList:[], currentFile:null, - timeDim: 2 + timeDim: 2, + // HTTP 上传中(点击确定后 axios 上传,展示不确定进度条) + httpUploading: false }, getDataList: null, // 动态切换的查询接口 updateData: null, // 动态切换的更新接口 @@ -361,6 +367,8 @@ export default { }); }, handleLevelChange(id) { + this.form.levelId = id; + this.getDataPage() this.$emit('updateLevel', id) }, // 表格单元格数据变更回调 @@ -457,9 +465,12 @@ export default { } // 计算选中日期对应的时间戳 this.calculateTimeStamp(val); + // 重新请求数据 + this.getDataPage(); }, // 导入 importExcel() { + this.upload.httpUploading = false this.upload.open = true }, downLoadExcel() { @@ -500,7 +511,6 @@ export default { // 文件上传中处理 handleFileUploadProgress(file, fileList) { console.log('文件上传中:',file, fileList) - this.upload.isUploading = true; this.upload.fileList = fileList; this.upload.currentFile = file.raw; }, @@ -508,10 +518,14 @@ export default { importTemplate() {}, // 提交上传文件 async submitFileForm() { + if (!this.upload.currentFile) { + return this.$message.error('请先选择要上传的文件!') + } + if (this.upload.httpUploading) { + return + } + this.upload.httpUploading = true try { - if (!this.upload.currentFile) { - return this.$message.error('请先选择要上传的文件!') - } const formData = new FormData() formData.append('file', this.upload.currentFile) // 文件字段 formData.append('timeDim', this.upload.timeDim) // 年月维度字段 @@ -526,7 +540,7 @@ export default { 'Authorization': "Bearer " + getAccessToken(), 'tenant-id': getTenantId(), }, - timeout: 30000 + timeout: 300000 }) // 4. 处理响应结果 if (response.data.code === 0) { @@ -536,7 +550,6 @@ export default { this.upload.timeDim = 2 this.upload.currentFile = null this.upload.open = false - this.upload.isUploading = false this.$refs.upload.clearFiles(); this.getDataPage(); this.$emit('updateLeft') @@ -547,17 +560,66 @@ export default { // 5. 异常处理 console.error('文件上传出错:', error) this.$message.error('上传失败!') + } finally { + this.upload.httpUploading = false } }, cancelBtn() { + if (this.upload.httpUploading) { + return + } this.upload.open = false - this.$refs.upload.clearFiles(); + }, + handleImportDialogClose() { + this.upload.currentFile = null + this.upload.fileList = [] + this.$nextTick(() => { + if (this.$refs.upload) { + this.$refs.upload.clearFiles() + } + }) } } }