From 1bf1750a2c2cafdbd7413fe18d16915a7f71ff52 Mon Sep 17 00:00:00 2001 From: fengxiang <110431245@qq.com> Date: Thu, 05 Jul 2018 11:54:46 +0800 Subject: [PATCH] 设备保存bug修复 --- src/app/business/services/util/tools.service.ts | 10 ++++++++++ 1 files changed, 10 insertions(+), 0 deletions(-) diff --git a/src/app/business/services/util/tools.service.ts b/src/app/business/services/util/tools.service.ts index 243051f..3841b8f 100644 --- a/src/app/business/services/util/tools.service.ts +++ b/src/app/business/services/util/tools.service.ts @@ -15,6 +15,13 @@ } ); } + public static getValueFormControl(controlSet: FormGroup, name: string) { + return controlSet.controls[name].value; + } + public static setValueToControl(controlSet: FormGroup, name: string, value: any) { + controlSet.controls[name].setValue(value); + controlSet.controls[name].updateValueAndValidity(); + } public static removePrivate(obj: object) { Object.keys(obj).forEach( (key: string) => { @@ -37,4 +44,7 @@ if (num) { result = num + result; } return result; } + public static getObjById<T>(id: number, list: T[]): T { + return list.find(item => item['id'] === id); + } } -- Gitblit v1.8.0