1 |
|
2 | export class PagedQueryResult<T>{
|
3 | |
4 |
|
5 |
|
6 | recordCount: number;
|
7 | |
8 |
|
9 |
|
10 | pageCount: number;
|
11 | |
12 |
|
13 |
|
14 | datas: T[];
|
15 | }
|
16 | export abstract class PagedQueryParam {
|
17 | |
18 |
|
19 |
|
20 | pageNumber: number = 1;
|
21 | |
22 |
|
23 |
|
24 | pageSize: number = 20;
|
25 | |
26 |
|
27 |
|
28 |
|
29 |
|
30 | orderBy: string;
|
31 |
|
32 | changePage(event: DataEvent): void {
|
33 | if (event.page != undefined) {
|
34 | this.pageNumber = event.page + 1;
|
35 | } else {
|
36 | this.pageNumber = event.first / this.pageSize + 1;
|
37 | }
|
38 | if (event.sortField) {
|
39 | this.orderBy = event.sortField;
|
40 | if (event.sortOrder == -1) {
|
41 | this.orderBy += ":ASC";
|
42 | } else {
|
43 | this.orderBy += ":DESC";
|
44 | }
|
45 | }
|
46 | if (event.multiSortMeta) {
|
47 | for (let sm of event.multiSortMeta) {
|
48 | if (this.orderBy) {
|
49 | this.orderBy += "; ";
|
50 | }
|
51 | this.orderBy = event.sortField;
|
52 | if (event.sortOrder == -1) {
|
53 | this.orderBy += ":ASC";
|
54 | } else {
|
55 | this.orderBy += ":DESC";
|
56 | }
|
57 |
|
58 | }
|
59 | }
|
60 | }
|
61 | }
|
62 |
|
63 |
|
64 |
|
65 | export class DataEvent {
|
66 |
|
67 | |
68 |
|
69 |
|
70 | first: number;
|
71 | |
72 |
|
73 |
|
74 | rows: number;
|
75 | |
76 |
|
77 |
|
78 | page: number;
|
79 | |
80 |
|
81 |
|
82 | pageCount: number;
|
83 | |
84 |
|
85 |
|
86 | sortField: string;
|
87 | |
88 |
|
89 |
|
90 | sortOrder: number;
|
91 | |
92 |
|
93 |
|
94 | multiSortMeta: SortMeta[];
|
95 |
|
96 |
|
97 | }
|
98 | export class SortMeta {
|
99 | |
100 |
|
101 |
|
102 | sortField: string;
|
103 | |
104 |
|
105 |
|
106 | sortOrder: number;
|
107 | }
|
108 | export class Selectable {
|
109 | isSelected: boolean;
|
110 | }
|
111 | export class RefBean extends Selectable {
|
112 | code: string;
|
113 | name: string;
|
114 | constructor(code: string, name: string) {
|
115 | super();
|
116 | this.code = code;
|
117 | this.name = name;
|
118 | }
|
119 | }
|
120 | export class RefBeanTreeNode extends RefBean {
|
121 | children: RefBeanTreeNode[];
|
122 | }
|
123 | export class RestResult {
|
124 | status: string;
|
125 | value: any;
|
126 | }
|