From b076f355b7b438b45e430cbd1c441ef5ff34b6fe Mon Sep 17 00:00:00 2001
From: fengxiang <110431245@qq.com>
Date: Mon, 28 May 2018 17:14:19 +0800
Subject: [PATCH] 登录过期相应
---
src/app/business/services/util/tools.service.ts | 32 +++++++++++++++++++++++++++-----
1 files changed, 27 insertions(+), 5 deletions(-)
diff --git a/src/app/business/services/util/tools.service.ts b/src/app/business/services/util/tools.service.ts
index 3afa1b1..825acf1 100644
--- a/src/app/business/services/util/tools.service.ts
+++ b/src/app/business/services/util/tools.service.ts
@@ -3,16 +3,38 @@
@Injectable()
export class ToolsService {
- public static markAsDirty(controlSet:FormGroup|FormArray){
+ public static markAsDirty(controlSet: FormGroup|FormArray) {
const controls = controlSet.controls;
Object.values(controls).forEach(
- (control:AbstractControl) => {
- if(control instanceof FormGroup || control instanceof FormArray){
+ (control: AbstractControl) => {
+ if (control instanceof FormGroup || control instanceof FormArray) {
ToolsService.markAsDirty(control);
- }else{
+ } else {
control.markAsDirty();
}
}
- )
+ );
}
+ public static removePrivate(obj: object) {
+ Object.keys(obj).forEach(
+ (key: string) => {
+ if (key.startsWith('_')) {
+ delete obj[key];
+ } else {
+ if (obj[key] instanceof Object) {
+ ToolsService.removePrivate(obj[key]);
+ }
+ }
+ }
+ );
+ }
+ public static toThousands(num: string): string {
+ var num = (num || 0).toString(), result = '';
+ while (num.length > 3) {
+ result = ',' + num.slice(-3) + result;
+ num = num.slice(0, num.length - 3);
+ }
+ if (num) { result = num + result; }
+ return result;
+ }
}
--
Gitblit v1.8.0