一开始发现后端没有字段穿过来,都是自己计算的
{
title: "连带率",
key: "LDL",
width: 100,
align: "right",
isMust: false,
isDef: true,
renderHeader: (h, params) => {
return tooltipFun(h, params, "连带率=零售总数/单据笔数");
},
render: (h, params) => {
let dd = 0;
if (params.row.SALEQTY && params.row.SALEBILLCOUNT) {
dd = params.row.SALEQTY / params.row.SALEBILLCOUNT;
dd = Math.round(dd * 10000) / 100;
}
return h("span", { class: "" }, dd + "%");
}
},
然后发现不管怎么样都无法导出,然后在导出的函数中进行处理即可
const exportData = list.map((item) => {
const row = {};
for (let i = 0; i < val.length; i++) {
if (typeof val[i] === "object" && val[i].key) {
row[val[i].key] = this.isPurViewFun(91040112) ? item[val[i].key] : "***";
} else {
row[val[i]] = item[val[i]];
}
}
row.SIRate =
item.SALEQTY && item.STOCKGOODSCOUNT
? Math.round((item.SALEQTY / item.STOCKGOODSCOUNT) * 10000) / 100 + "%"
: "";
row.LDL =
item.SALEQTY && item.SALEBILLCOUNT
? Math.round((item.SALEQTY / item.SALEBILLCOUNT) * 10000) / 100 + "%"
: "";
//下面两个是给导出的数据数据加上百分比
row.GAINRATE = (item.GAINRATE * 10000) / 100 + "%";
row.SALEGOODSCOUNTBYB = (item.SALEGOODSCOUNTBYB * 10000) / 100 + "%";
return row;
});