From 2d4cbcc4f92edbc4f926d9710bdda64520039c2b Mon Sep 17 00:00:00 2001
From: fengxiang <110431245@qq.com>
Date: Fri, 05 Jan 2018 11:21:44 +0800
Subject: [PATCH] Merge branch 'develop' of http://blit.7drlb.com:8888/r/screen-frontend into develop
---
src/app/routes/devices/version/version.component.ts | 57 ++++++++++++++++++++++++++++++++-------------------------
1 files changed, 32 insertions(+), 25 deletions(-)
diff --git a/src/app/routes/devices/version/version.component.ts b/src/app/routes/devices/version/version.component.ts
index b6f9849..304d9e7 100644
--- a/src/app/routes/devices/version/version.component.ts
+++ b/src/app/routes/devices/version/version.component.ts
@@ -1,5 +1,4 @@
import { DataType } from './../../../core/entity/grid';
-import { AddOrEditComponent } from './add-or-edit/add-or-edit.component';
import { Version } from '@angular/compiler/src/util';
import { Subject } from 'rxjs/Subject';
import { ToolsService } from '@core/services/tools.service';
@@ -12,6 +11,8 @@
import { VersionService } from 'app/routes/devices/version/version.service';
import { Types } from '@core/enum/types.enum';
import { Column, Grid, PageBean } from '@core/entity/grid';
+import { filter } from 'rxjs/operators/filter';
+import { VersionEditComponent } from 'app/routes/devices/version/version-edit/version-edit.component';
export interface DeviceVersion {
createTime?: Column|any;
@@ -38,7 +39,8 @@
},
version: {
text: '������',
- width: '18%'
+ width: '18%',
+ isSort: true
},
createTime: {
text: '������������',
@@ -46,7 +48,8 @@
type: {
name: Types.Date,
format: 'YYYY-MM-DD HH:mm:ss'
- }
+ },
+ isSort: true
},
description: {
text: '������',
@@ -77,38 +80,40 @@
queryTextChanged($event) {
this.queryTextStream.next(this.queryMap.value);
}
- load(reload: boolean = false) {
+ load(reload: boolean = false) {
if (reload) {
this.grid.pageIndex = 1 ;
}
+ // ������������������ExpressionChangedAfterItHasBeenCheckedError
+ setTimeout(() => {
+ this.grid.loading = true;
+ }, 1);
this.versionService.getPagingList(this.grid, this.queryMap.value).subscribe(
(res: PageBean) => {
+ this.grid.loading = true;
if (res != null && res.data != null) {
this.grid.initData(res);
this.grid.refreshStatus();
+ setTimeout(() => {
+ this.grid.loading = false;
+ }, 1);
}
}
);
}
- edit() {
- // this.modalHelper.static(VersionEditComponent, { user }).subscribe(() => {
- // this.load(true);
- // this.msgSrv.success('���������������������������');
- // });
- }
// rowData���null���������������
addOrModify(data) {
if ( data == null) {
data = {};
}
const cols = this.version;
- this.modalHelper.static(AddOrEditComponent, { cols , data }).subscribe(
+ this.modalHelper.static(VersionEditComponent, { cols , data }).subscribe(
( ret: { data: any, close: Function} ) => {
this.versionService.save(ret.data).subscribe(
( res: any) => {
if (res.code === 1) {
- this.load(true);
+ this.load();
ret.close();
this.msgSrv.success('���������������������������');
}
@@ -121,7 +126,7 @@
this.versionService.delete( ...id ).subscribe(
( res: any) => {
if (res.code === 1) {
- this.load(true);
+ this.load();
this.msgSrv.success('���������������������������');
}
}
@@ -138,24 +143,26 @@
if (this.grid.selectedIndexs != null && this.grid.selectedIndexs.length > 0) {
const ids = this.grid.selectedIndexs.map(
(index: number) => {
- return Number.parseInt(this.grid.data[index].id);
+ const id = this.grid.data[index].id;
+ return Number.parseInt(id);
}
);
this.delete( ...ids );
}
});
}
-
-
- dataChange(res: any) {
-
- }
-
- sort(field: string, value: any) {
- // this.sortMap = {};
- // this.sortMap[field] = value;
- // this.q.sorter = value ? `${field}_${value}` : '';
- // this.load(true);
+ sort(field: string, value: string) {
+ // ������������field
+ this.grid.sorts = this.grid.sorts.filter(
+ (fn: string) => {
+ return fn !== field;
+ }
+ );
+ // ������value������null������������������������������filed
+ if ( value != null ) {
+ this.grid.sorts.push(field);
+ }
+ this.load();
}
reset(ls: any[]) {
--
Gitblit v1.8.0