From f01d6b7e6bf8132524c1c2821fdcbbc5ca548369 Mon Sep 17 00:00:00 2001
From: fengxiang <110431245@qq.com>
Date: Fri, 29 Dec 2017 16:57:22 +0800
Subject: [PATCH] 设备型号完成
---
src/app/core/entity/grid.ts | 22 ++++++++++++++++++----
1 files changed, 18 insertions(+), 4 deletions(-)
diff --git a/src/app/core/entity/grid.ts b/src/app/core/entity/grid.ts
index a66711d..4567923 100644
--- a/src/app/core/entity/grid.ts
+++ b/src/app/core/entity/grid.ts
@@ -1,10 +1,11 @@
-import { Type } from '@angular/core';
+import { Column } from '@core/entity/grid';
import { Types } from '@core/enum/types.enum';
export interface Column {
text?: string;
name?: string;
width?: string;
- sort?: boolean;
+ sort?: string;
+ isSort?: boolean;
type?: DataType;
}
export interface DataType {
@@ -18,8 +19,21 @@
total?: number;
data?: any[];
queryParams?: string;
+ orderByClause?: string;
+ getOrderByClause ?(): string;
}
export class Grid<T> implements PageBean {
+ getOrderByClause(): string {
+ const orderby = this.sorts.map( (fn) => {
+ return this.columns.find( (col: Column) => {
+ return fn === col.name;
+ } );
+ }).map( (col: Column) => {
+ const sort = col.sort.startsWith('asc') ? 'asc' : 'desc' ;
+ return col.name + '||' + sort;
+ }).join('|||');
+ return encodeURI(orderby);
+ }
title = '';
pageIndex = 0; // ������
pageSize = 10; // ������������������
@@ -27,14 +41,14 @@
total = 0;
queryParams = '';
pages = 0; // ���������
- queryMap?: any = {};
size = 0; // ���������������������
sorts?: any[] = [];
+ loading = false;
indeterminate = false;
allChecked = false;
selectedIndexs?: number[] = []; // ������������������
columns?: Column[] = [];
-
+
checkAll(value: boolean) {
this.data.forEach(
row => {row['checked'] = value; }
--
Gitblit v1.8.0