|
|
@@ -232,11 +232,11 @@ module.exports = app => {
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
- async getOverview(planned, building, finished) {
|
|
|
+ async getOverview(projects) {
|
|
|
const ctx = this.ctx;
|
|
|
const calc = ctx.helper;
|
|
|
+ const [planned, building, finished] = ['拟建', '在建', '已建'].map(status => projects.filter(project => project.status === status));
|
|
|
const lists = [planned, building, finished];
|
|
|
- const projects = [].concat(...lists);
|
|
|
const present = value => value !== null && value !== undefined && value !== '';
|
|
|
const rank = (list, amount) => list.map(p => ({ id: p.id, name: p.name, value: amount(p) }))
|
|
|
.filter(p => present(p.value)).sort((a, b) => b.value - a.value).slice(0, 10);
|