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__text">将文件拖到此处,或<em>点击上传</em></div>
|
||||||
<div class="el-upload__tip text-center" slot="tip">
|
<div class="el-upload__tip text-center" slot="tip">
|
||||||
<span>仅允许导入xls、xlsx格式文件。</span>
|
<span>仅允许导入xls、xlsx格式文件。</span>
|
||||||
<a
|
<span class="download-template-link" @click="downloadTemplate">
|
||||||
:href="uploadUrlTemp"
|
<i class="el-icon-download" v-if="!downloadLoading"></i>
|
||||||
download="机具检验标识信息导入模板"
|
<i class="el-icon-loading" v-else style="color: #1890FF"></i>
|
||||||
class="text-button primary-lease"
|
{{ downloadLoading ? '下载中...' : '下载模板' }}
|
||||||
style="color: #409eff; text-decoration: none; font-size: 14px;"
|
</span>
|
||||||
>
|
|
||||||
模板下载
|
|
||||||
</a>
|
|
||||||
</div>
|
</div>
|
||||||
</el-upload>
|
</el-upload>
|
||||||
<div slot="footer" class="dialog-footer">
|
<div slot="footer" class="dialog-footer">
|
||||||
|
|
@ -262,6 +259,8 @@ export default {
|
||||||
sex: undefined,
|
sex: undefined,
|
||||||
teamId: undefined
|
teamId: undefined
|
||||||
},
|
},
|
||||||
|
// 模板下载加载状态
|
||||||
|
downloadLoading: false,
|
||||||
uploadUrlTemp:null,
|
uploadUrlTemp:null,
|
||||||
// 导入参数
|
// 导入参数
|
||||||
upload: {
|
upload: {
|
||||||
|
|
@ -561,6 +560,20 @@ export default {
|
||||||
this.deviceModelOptions = [];
|
this.deviceModelOptions = [];
|
||||||
this.resetForm("form");
|
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) {
|
handleFileUploadProgress(event, file, fileList) {
|
||||||
this.upload.isUploading = true;
|
this.upload.isUploading = true;
|
||||||
|
|
@ -581,6 +594,22 @@ export default {
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
<style lang="scss" scoped>
|
<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 {
|
.app-container {
|
||||||
padding: 20px;
|
padding: 20px;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue