沈斌
2018-07-13 b54dbd54bc18ebea847b8c8697e06394df499006
src/app/routes/environment/management/management.component.ts
@@ -13,7 +13,6 @@
})
export class EnvironmentManagementComponent implements OnInit, OnDestroy {
    data: any = {};
    offlineChartData: any[] = [];
    constructor(
@@ -42,26 +41,8 @@
            });
        }
        this.offlineChartData = offlineChartData;
        this.data = {
            searchData: searchData
        };
    }
    ngOnDestroy(): void {
    }
    sort(sortName, sortValue) {
        this.data.searchData = [
            ...(<any[]>this.data.searchData).sort((a, b) => {
                if (a[sortName] > b[sortName]) {
                    return (sortValue === 'ascend') ? 1 : -1;
                } else if (a[sortName] < b[sortName]) {
                    return (sortValue === 'ascend') ? -1 : 1;
                } else {
                    return 0;
                }
            })
        ];
    }
}