This commit is contained in:
parent
342f59d360
commit
ec343197dd
|
|
@ -204,14 +204,11 @@
|
|||
<div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
|
||||
<div class="el-upload__tip text-center" slot="tip">
|
||||
<span>仅允许导入xls、xlsx格式文件。</span>
|
||||
<a
|
||||
:href="uploadUrlTemp"
|
||||
download="机具检验标识信息导入模板"
|
||||
class="text-button primary-lease"
|
||||
style="color: #409eff; text-decoration: none; font-size: 14px;"
|
||||
>
|
||||
模板下载
|
||||
</a>
|
||||
<span class="download-template-link" @click="downloadTemplate">
|
||||
<i class="el-icon-download" v-if="!downloadLoading"></i>
|
||||
<i class="el-icon-loading" v-else style="color: #1890FF"></i>
|
||||
{{ downloadLoading ? '下载中...' : '下载模板' }}
|
||||
</span>
|
||||
</div>
|
||||
</el-upload>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
|
|
@ -262,6 +259,8 @@ export default {
|
|||
sex: undefined,
|
||||
teamId: undefined
|
||||
},
|
||||
// 模板下载加载状态
|
||||
downloadLoading: false,
|
||||
uploadUrlTemp:null,
|
||||
// 导入参数
|
||||
upload: {
|
||||
|
|
@ -561,6 +560,20 @@ export default {
|
|||
this.deviceModelOptions = [];
|
||||
this.resetForm("form");
|
||||
},
|
||||
/** 下载模板方法 */
|
||||
async downloadTemplate() {
|
||||
this.downloadLoading = true;
|
||||
try {
|
||||
// 使用统一的下载方法,确保路径正确
|
||||
await this.download("/material/wsMaInfo/downLoad", {}, "机具检验标识信息导入模板.xlsx");
|
||||
this.$message.success("模板下载成功");
|
||||
} catch (error) {
|
||||
console.error("模板下载失败:", error);
|
||||
this.$message.error("模板下载失败,请稍后重试");
|
||||
} finally {
|
||||
this.downloadLoading = false;
|
||||
}
|
||||
},
|
||||
// 文件上传中处理
|
||||
handleFileUploadProgress(event, file, fileList) {
|
||||
this.upload.isUploading = true;
|
||||
|
|
@ -581,6 +594,22 @@ export default {
|
|||
}
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.download-template-link {
|
||||
color: #409EFF;
|
||||
cursor: pointer;
|
||||
margin-left: 10px;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
|
||||
&:hover {
|
||||
color: #66b1ff;
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
i {
|
||||
margin-right: 4px;
|
||||
}
|
||||
}
|
||||
.app-container {
|
||||
padding: 20px;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue