实现思路:获取echars base64图片------传参-----在后台获取参数---解码生成图片输出到excel
前端代码:(前端使用的是vue),代码中的变量需要自己定义
exportData() {
this.exportLoading = true;
let _token = Cookies.get("token");
let _userid = Cookies.get("userId");
let data = {
id: this.$route.params.id,
num: this.dataForm.num,
comId: this.dataForm.comId,
token: _token,
userid: _userid,
baseImgArray: this.baseImgArray
};
let params = qs.stringify(data);
let url =
`${window.SITE_CONFIG["apiURL"]}` +
this.baseUrl.JIEFANG_PROCESS_AUDIT +
`/reporthead/exportData`;
var xhr = new XMLHttpRequest();
xhr.open("post", url, true);
xhr.responseType = "blob";
xhr.setRequestHeader("Content-Type", "application/json;charset=utf-8"