diff --git a/src/views/ems/info/supervisionChecklist/index.vue b/src/views/ems/info/supervisionChecklist/index.vue index e47ce38..eec6341 100644 --- a/src/views/ems/info/supervisionChecklist/index.vue +++ b/src/views/ems/info/supervisionChecklist/index.vue @@ -586,9 +586,7 @@ url: "", updateSupport: false, isUploading: false, - headers: { - Authorization: "Bearer " + localStorage.getItem("token") - } + headers: {} }, // 详情抽屉 detailDrawer: false, @@ -605,6 +603,7 @@ created() { this.getList(); this.upload.url = process.env.VUE_APP_BASE_API + "/ems/info/supervisionChecklist/importData"; + this.upload.headers = { Authorization: "Bearer " + this.$store.getters.token }; }, mounted() { document.addEventListener('click', this.hideContextMenu); @@ -737,6 +736,8 @@ /** 导入按钮操作 */ handleImport() { this.upload.title = "导入动力能源部监督检查清单"; + // 确保在打开导入对话框时重新设置token + this.upload.headers = { Authorization: "Bearer " + this.$store.getters.token }; this.upload.open = true; }, /** 下载模板操作 */ @@ -758,6 +759,8 @@ }, // 提交上传文件 submitFileForm() { + // 在提交前确保token是最新的 + this.upload.headers = { Authorization: "Bearer " + this.$store.getters.token }; this.$refs.upload.submit(); }, // 查看详情