提交 720d3703 编写于 作者: tony001's avatar tony001

调整图表排序

上级 1531eadb
...@@ -648,10 +648,23 @@ import { ChartDataSetField,ChartLineSeries,ChartFunnelSeries,ChartPieSeries,Char ...@@ -648,10 +648,23 @@ import { ChartDataSetField,ChartLineSeries,ChartFunnelSeries,ChartPieSeries,Char
returnArray = arr.sort((a:any, b:any) => { returnArray = arr.sort((a:any, b:any) => {
return moment(a[groupField[0].name]).unix() - moment(b[groupField[0].name]).unix(); return moment(a[groupField[0].name]).unix() - moment(b[groupField[0].name]).unix();
}); });
}else{
let groupFieldName:string = groupField[0].name;
let isConvert:boolean = true;
arr.forEach((item:any) =>{
if(isNaN(item[groupFieldName])){
isConvert = false;
}
})
if(isConvert){
returnArray = arr.sort((a:any, b:any) => {
return a[groupFieldName] - b[groupFieldName];
});
}else{ }else{
returnArray = arr; returnArray = arr;
} }
} }
}
return returnArray; return returnArray;
} }
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册