| | |
| | | */ |
| | | confirm () { |
| | | if (this.form.file == null) { |
| | | this.$message.warning('请选择文件') |
| | | this.$tip.warning('请选择文件') |
| | | return |
| | | } |
| | | this.isWorking = true |
| | |
| | | } |
| | | }) |
| | | .then(() => { |
| | | this.$message.success('导入成功') |
| | | this.$tip.success('导入成功') |
| | | this.visible = false |
| | | this.$emit('success') |
| | | }) |
| | | .catch(e => { |
| | | this.$message.error(e) |
| | | this.$tip.apiFailed(e) |
| | | }) |
| | | .finally(() => { |
| | | this.isWorking = false |
| | |
| | | downloadTemplate () { |
| | | const link = document.createElement('a') |
| | | link.setAttribute('download', this.templateName) //下载的文件名 |
| | | // console.log(`window.location.origin`, window.location.origin); |
| | | // console.log(`process.env.VUE_APP_CONTEXT_PATH`, process.env.VUE_APP_CONTEXT_PATH); |
| | | // console.log(`this.templatePath`, this.templatePath); |
| | | console.log(`${window.location.origin}${process.env.VUE_APP_CONTEXT_PATH}${this.templatePath}`); |
| | | link.href = `${window.location.origin}${process.env.VUE_APP_CONTEXT_PATH}${this.templatePath}` //文件url |
| | | link.click() |
| | | // this.$emit('download') |
| | | }, |
| | | /** |
| | | * 文件上传前存储上传的文件 |