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