UNPKG

2.79 kBPlain TextView Raw
1
2export class PagedQueryResult<T>{
3 /**
4 *满足条件的总数据条数
5 */
6 recordCount: number;
7 /**
8 * 满足条件的总页数
9 */
10 pageCount: number;
11 /**
12 * 当前页数据
13 */
14 datas: T[];
15}
16export abstract class PagedQueryParam {
17 /**
18 * 要查询第几页,从1开始
19 */
20 pageNumber: number = 1;
21 /**
22 * 每页数据条数,缺省20
23 * */
24 pageSize: number = 20;
25 /**
26 *排序,分号分隔每一组条件,组内用冒号分隔。
27 *属性引用,如: seq:ASC; userCode:DESC 表示 seq升序,然后userCode降序
28 *支持SQL条件,如:SQL:abs(VALUE_DIFF):ASC; SQL:decode(checked_summary,0,1,abs(VALUE_DIFF/checked_summary)):DESC
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 * primeng Table Paginator的事件数据结构
64 */
65export class DataEvent {
66
67 /**
68 * Index of the first record
69 */
70 first: number;
71 /**
72 * Number of rows to display in new page
73 */
74 rows: number;
75 /**
76 * Index of the new page
77 */
78 page: number;
79 /**
80 * Total number of pages
81 */
82 pageCount: number;
83 /**
84 * Field name to sort in single sort mode
85 */
86 sortField: string;
87 /**
88 * Sort order as number, 1 for asc and -1 for dec in single sort mode
89 */
90 sortOrder: number;
91 /**
92 * An array of SortMeta objects used in multiple columns sorting. Each SortMeta has field and order properties.
93 */
94 multiSortMeta: SortMeta[];
95 //filters: Filters object having field as key and filter value, filter matchMode as value
96 //globalFilter: Value of the global filter if available
97}
98export class SortMeta {
99 /**
100 * Field name to sort in single sort mode
101 */
102 sortField: string;
103 /**
104 * Sort order as number, 1 for asc and -1 for dec in single sort mode
105 */
106 sortOrder: number;
107}
108export class Selectable {
109 isSelected: boolean;
110}
111export 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}
120export class RefBeanTreeNode extends RefBean {
121 children: RefBeanTreeNode[];
122}
123export class RestResult {
124 status: string;
125 value: any;
126}