From 124766132b01645c9942f4cadd7cb88953bfc728 Mon Sep 17 00:00:00 2001 From: fengxiang <fengxiang> Date: Wed, 20 Dec 2017 14:00:10 +0800 Subject: [PATCH] Merge branch 'develop' of http://blit.7drlb.com:8888/r/screen-frontend into develop --- src/app/core/services/date.service.ts | 11 +++++ src/app/routes/systems/systems.module.ts | 32 ++++++++++++++++ src/app/routes/users/installer/edit/edit.component.ts | 8 +++ src/app/routes/routes.ts | 1 src/app/routes/users/installer/installer.component.html | 4 +- src/app/routes/users/installer/installer.component.ts | 7 +++ src/assets/i18n/zh-CN.json | 3 + src/app/app.module.ts | 2 + src/app/routes/systems/account/account.component.ts | 25 ++++++++++++ src/assets/app-data.json | 10 +++++ src/app/routes/systems/account/account.component.html | 3 + 11 files changed, 102 insertions(+), 4 deletions(-) diff --git a/src/app/app.module.ts b/src/app/app.module.ts index 84691c5..2d1fc5b 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -10,6 +10,7 @@ import { AppComponent } from './app.component'; import { RoutesModule } from './routes/routes.module'; import { LayoutModule } from './layout/layout.module'; +import { DateService } from './core/services/date.service'; import { StartupService } from './core/services/startup.service'; import { DefaultInterceptor } from '@core/net/default.interceptor'; import { AlainAuthModule, SimpleInterceptor } from '@delon/auth'; @@ -60,6 +61,7 @@ { provide: HTTP_INTERCEPTORS, useClass: SimpleInterceptor, multi: true}, { provide: HTTP_INTERCEPTORS, useClass: DefaultInterceptor, multi: true}, { provide: ALAIN_I18N_TOKEN, useClass: I18NService, multi: false }, + DateService, StartupService, { provide: APP_INITIALIZER, diff --git a/src/app/core/services/date.service.ts b/src/app/core/services/date.service.ts new file mode 100644 index 0000000..f49e6be --- /dev/null +++ b/src/app/core/services/date.service.ts @@ -0,0 +1,11 @@ +import {Injectable} from '@angular/core'; + +import * as moment from 'moment'; + +@Injectable() +export class DateService { + + date_format(date: string, format: string) { + return moment(date).format('YYYY-MM-DD'); + } +} diff --git a/src/app/routes/routes.ts b/src/app/routes/routes.ts index cbcc97c..047905b 100644 --- a/src/app/routes/routes.ts +++ b/src/app/routes/routes.ts @@ -16,6 +16,7 @@ { path: 'users', loadChildren: './users/users.module#UsersModule' }, { path: 'devices', loadChildren: './devices/devices.module#DevicesModule' }, { path: 'sensors', loadChildren: './sensors/sensors.module#SensorsModule' }, + { path: 'systems', loadChildren: './systems/systems.module#SystemsModule' }, { path: 'dashboard/v1', component: DashboardV1Component, data: { translate: 'dashboard_v1' } }, { path: 'dashboard/analysis', component: DashboardAnalysisComponent, data: { translate: 'dashboard_analysis' } }, diff --git a/src/app/routes/systems/account/account.component.html b/src/app/routes/systems/account/account.component.html new file mode 100644 index 0000000..e3b28d5 --- /dev/null +++ b/src/app/routes/systems/account/account.component.html @@ -0,0 +1,3 @@ +<p> + account works! +</p> diff --git a/src/app/routes/systems/account/account.component.ts b/src/app/routes/systems/account/account.component.ts new file mode 100644 index 0000000..42b2af6 --- /dev/null +++ b/src/app/routes/systems/account/account.component.ts @@ -0,0 +1,25 @@ +import { Component, OnInit } from '@angular/core'; +import { NzMessageService } from 'ng-zorro-antd'; +import { ModalHelper } from '@delon/theme'; +import { HttpClient } from '@angular/common/http'; +import * as moment from 'moment'; + +@Component({ + selector: 'app-account', + templateUrl: './account.component.html', + styles: [] +}) +export class AccountComponent implements OnInit { + + constructor( + public http: HttpClient, + public msgSrv: NzMessageService, + private modalHelper: ModalHelper) { + + } + + ngOnInit() { + + } + +} diff --git a/src/app/routes/systems/systems.module.ts b/src/app/routes/systems/systems.module.ts new file mode 100644 index 0000000..d645b78 --- /dev/null +++ b/src/app/routes/systems/systems.module.ts @@ -0,0 +1,32 @@ +import { Component, OnInit } from '@angular/core'; +import { NgModule } from '@angular/core'; +import { CommonModule } from '@angular/common'; +import { RouterModule, Routes } from '@angular/router'; +import { SharedModule } from '@shared/shared.module'; + +import { AccountComponent } from './account/account.component'; + +const routes: Routes = [ + { + path: '', + children: [ + { path: 'account', component: AccountComponent } + ] + } +]; + +const COMPONENTS_NOROUNT = [ ]; + +@NgModule({ + imports: [ + CommonModule, + SharedModule, + RouterModule.forChild(routes) + ], + declarations: [ + ...COMPONENTS_NOROUNT, + AccountComponent + ], + entryComponents: COMPONENTS_NOROUNT +}) +export class SystemsModule { } diff --git a/src/app/routes/users/installer/edit/edit.component.ts b/src/app/routes/users/installer/edit/edit.component.ts index 5cdca64..9d5b573 100644 --- a/src/app/routes/users/installer/edit/edit.component.ts +++ b/src/app/routes/users/installer/edit/edit.component.ts @@ -3,6 +3,7 @@ import { ModalHelper } from '@delon/theme'; import { HttpClient } from '@angular/common/http'; import { environment } from '../../../../../environments/environment'; +import { DateService } from '../../../../core/services/date.service'; @Component({ selector: 'app-edit', @@ -16,12 +17,17 @@ constructor( private modalHelper: ModalHelper, private subject: NzModalSubject, + public dateSrv: DateService, public msgSrv: NzMessageService, public http: HttpClient) { } ngOnInit() { if (this.user.id > 0) { - this.http.get(environment.SERVER_BASH_URL + '/user/operate_user/' + this.user.id).subscribe((res: any) => this.user = res.data ); + this.http.get(environment.SERVER_BASH_URL + '/user/operate_user/' + this.user.id).subscribe((res: any) => { + this.user = res; + this.user.createTime = this.dateSrv.date_format(this.user.createTime, 'YYYY-MM-DD'); + this.user.expireTime = this.dateSrv.date_format(this.user.expireTime, 'YYYY-MM-DD'); + }); } } diff --git a/src/app/routes/users/installer/installer.component.html b/src/app/routes/users/installer/installer.component.html index 8827729..ceab058 100644 --- a/src/app/routes/users/installer/installer.component.html +++ b/src/app/routes/users/installer/installer.component.html @@ -79,8 +79,8 @@ <td nz-td>{{i.weixin}}</td> <td nz-td>{{i.password}}</td> <td nz-td>{{i.organizationId}}</td> - <td nz-td>{{i.createTime | _date}}</td> - <td nz-td>{{i.expireTime | _date}}</td> + <td nz-td>{{format_date(i.createTime)}}</td> + <td nz-td>{{format_date(i.expireTime)}}</td> <td nz-td> <a (click)="edit(i)">������</a> <span nz-table-divider></span> diff --git a/src/app/routes/users/installer/installer.component.ts b/src/app/routes/users/installer/installer.component.ts index 70b7daa..99bf082 100644 --- a/src/app/routes/users/installer/installer.component.ts +++ b/src/app/routes/users/installer/installer.component.ts @@ -2,9 +2,9 @@ import { NzMessageService } from 'ng-zorro-antd'; import { ModalHelper } from '@delon/theme'; import { HttpClient } from '@angular/common/http'; -import * as moment from 'moment'; import { UserInstallerEditComponent } from './edit/edit.component'; import { environment } from '../../../../environments/environment'; +import { DateService } from '../../../core/services/date.service'; @Component({ selector: 'app-installer', @@ -31,6 +31,7 @@ constructor( public http: HttpClient, + public dateSrv: DateService, public msgSrv: NzMessageService, private modalHelper: ModalHelper) {} @@ -136,4 +137,8 @@ for (const item of ls) item.value = false; this.load(true); } + + format_date(date) { + return this.dateSrv.date_format(date, 'YYYY-MM-DD'); + } } diff --git a/src/assets/app-data.json b/src/assets/app-data.json index e370228..48c82b3 100644 --- a/src/assets/app-data.json +++ b/src/assets/app-data.json @@ -59,6 +59,16 @@ "link": "/sensors/basic", "translate": "device_management_info" }] + }, { + "text": "������������", + "translate": "system_management", + "link": "/", + "icon": "icon-note", + "children": [{ + "text": "������������", + "link": "/systems/account", + "translate": "system_management_account" + }] }] }] } diff --git a/src/assets/i18n/zh-CN.json b/src/assets/i18n/zh-CN.json index 44d7e46..c785dae 100644 --- a/src/assets/i18n/zh-CN.json +++ b/src/assets/i18n/zh-CN.json @@ -11,6 +11,9 @@ "sensor_management": "���������������", "sensor_management_info": "������������", + "system_management":"������������", + "system_management_account":"������������", + "settings": "������", "profile": "������������", "login": "������", -- Gitblit v1.8.0