dataIntegration: function (replaceObj, dataArr) {
var lastDataArr = [];
for (let i = 0; i < dataArr.length; i++) {
var dataObj = {};
for (const k in replaceObj) {
dataObj[k] = dataArr[i][replaceObj[k]];
}
lastDataArr.push(dataObj);
}
return lastDataArr;
}
解析:数据整合方法,适用于echarts.js数据参数转换(replaceObj:对象,dataArr:数组)
例:dataIntegration({value:"lossIncomeSum",name:"lossName"},response.data.payload)
注: value,name(所需参数),lossIncomeSum,lossName(后台返回数据参数) response.data.payload(后台返回数据集合)