vue springboot 实现excel导出
2021-03-03 16:28
标签:注解 target tput type com rem width start sys 实现 excel 的导出 选用 easypoi 官网: https://gitee.com/lemur/easypoi#http://doc.wupaas.com/docs/easypoi/easypoi-1c0u4mo8p4ro8 ~~~以上 vue springboot 实现excel导出 标签:注解 target tput type com rem width start sys 原文地址:https://www.cnblogs.com/BillyYoung/p/14386308.html
实现excel 导出
一、需求
二、技术
三、实现
1、前端
el-button type="success" @click="handleExport">导出i class="el-icon-upload el-icon--right">i>el-button>
handleExport() {
let a = document.createElement(‘a‘)
a.href = "http://www.soscw.com/xxx/export"
a.click()
}
2、后端
a、引入pom依赖
dependency>
groupId>cn.afterturngroupId>
artifactId>easypoi-spring-boot-starterartifactId>
version>4.1.0version>
dependency>
dependency>
groupId>commons-fileuploadgroupId>
artifactId>commons-fileuploadartifactId>
version>1.4version>
dependency>
b、实体注解
@Data
public class UnitMaterialRecommendVo {
@Excel(name = "序号", width = 10)
private Integer num;
@Excel(name = "体系", width = 25, orderNum = "1")
private String unitSystem;
@Excel(name = "单位", width = 25, orderNum = "2")
private String unitName;
@Excel(name = "参评类型", width = 25, orderNum = "3", replace = { "参评单位申报推荐_10", "文明单位复查审核_20" })
private Integer reportType;
@Excel(name = "审核结果", width = 25, orderNum = "4", replace = { "审核中_0", "审核通过_1", "审核不通过_-1" })
private Integer state;
@Excel(name = "联系方式", width = 25, orderNum = "5")
private String unitDirectorPhone;
@Excel(name = "所属省市", width = 25, orderNum = "6")
private String unitCityName;
@Excel(name = "文明单位类型", width = 25, orderNum = "7", replace = { "四川省文明单位_10", "四川省最佳文明单位_20"})
private Integer civilizedUnitType;
@Excel(name = "备注", width = 30, orderNum = "8")
private String remark;
}
c、导出方法
List
文章标题:vue springboot 实现excel导出
文章链接:http://soscw.com/index.php/essay/59594.html