From 72120bbe920425f80d3beb08c08af24151246006 Mon Sep 17 00:00:00 2001 From: fengxiang <110431245@qq.com> Date: Thu, 04 Jan 2018 14:00:46 +0800 Subject: [PATCH] 组织模块 --- src/app/core/pipe/tyep-handle.pipe.ts | 11 +++++++---- 1 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/app/core/pipe/tyep-handle.pipe.ts b/src/app/core/pipe/tyep-handle.pipe.ts index a9a8ab3..47acc5f 100644 --- a/src/app/core/pipe/tyep-handle.pipe.ts +++ b/src/app/core/pipe/tyep-handle.pipe.ts @@ -16,18 +16,21 @@ constructor(private dateService: DateService) { } - transform(value: any, col?: Column): any { + transform(value: any, col?: Column, row?: any ): any { const t = Types.Date; const type = col.type; - if (type != null && type.name != null) { + if ( value != null && value !== '' && type != null && type.name != null) { value = this.transformHandle(value, type.name, type.format); + } + if (col.format !== null && col.format instanceof Function ) { + value = col.format(value, col, row); } return value; } - private transformHandle(value: any, type: Types, format: any): any{ + private transformHandle(value: any, type: Types, format: any): any { switch (type) { case Types.Date: return this.dateService.date_format(value, format); } } -} \ No newline at end of file +} -- Gitblit v1.8.0