1 import {Component, OnInit, Input, Output} from '@angular/core';
2 import {Router, ActivatedRoute, ParamMap} from '@angular/router';
3 import {empty} from 'rxjs';
4 import {Pager} from '@eg/share/util/pager';
5 import {IdlObject} from '@eg/core/idl.service';
6 import {GridDataSource} from '@eg/share/grid/grid';
7 import {PcrudService} from '@eg/core/pcrud.service';
9 @Component({templateUrl: 'history.component.html'})
10 export class PoHistoryComponent implements OnInit {
13 dataSource: GridDataSource = new GridDataSource();
16 private route: ActivatedRoute,
17 private pcrud: PcrudService
21 this.dataSource.getRows = (pager: Pager, sort: any) =>
22 this.getHistory(pager, sort);
24 this.route.parent.paramMap.subscribe((params: ParamMap) => {
25 this.poId = +params.get('poId');
29 getHistory(pager: Pager, sort: any) {
30 if (!this.poId) { return empty(); }
32 const orderBy: any = {acqpoh: 'edit_time DESC'};
34 orderBy.acqpoh = sort[0].name + ' ' + sort[0].dir;
37 return this.pcrud.search('acqpoh', {id: this.poId}, {
43 acqpoh: ['owner', 'creator', 'editor', 'provider', 'cancel_reason']