Skip to content

Commit

Permalink
(ng-alain):给主菜单增加退出菜单,优化操作审计列表
Browse files Browse the repository at this point in the history
  • Loading branch information
gmf520 committed Apr 1, 2019
1 parent 7f57a27 commit 7cb812f
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
</li>
<!-- Github Page -->
<li>
<a class="alain-default__nav-item" href="//github.com/ng-alain/ng-alain" target="_blank">
<a class="alain-default__nav-item" href="https://github.com/i66soft/osharp-ns20" target="_blank">
<i nz-icon type="github"></i>
</a>
</li>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@
</div>
</div>
<ul nz-menu>
<li nz-menu-item routerLink="/profile">{{ 'menu.account.center' | translate }}</li>
<li nz-menu-item routerLink="/profile/edit">{{ 'menu.account.settings' | translate }}</li>
<li nz-menu-item routerLink="/profile"><i nz-icon type="user" class="mr-sm"></i>{{ 'menu.account.center' | translate }}</li>
<li nz-menu-item routerLink="/profile/edit"><i nz-icon type="setting" class="mr-sm"></i>{{ 'menu.account.settings' | translate }}</li>
<li nz-menu-item (click)="logout()"><i nz-icon type="logout" class="mr-sm"></i>{{ 'menu.account.logout' | translate }}</li>
</ul>
</nz-dropdown>
<sidebar-nav class="d-block py-lg"></sidebar-nav>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,25 @@
import { Component, ChangeDetectionStrategy } from '@angular/core';
import { Component, ChangeDetectionStrategy, Inject } from '@angular/core';
import { SettingsService } from '@delon/theme';
import { IdentityService } from '@shared/osharp/services/identity.service';
import { TokenService, DA_SERVICE_TOKEN } from '@delon/auth';
import { Router } from '@angular/router';

@Component({
selector: 'layout-sidebar',
templateUrl: './sidebar.component.html',
changeDetection: ChangeDetectionStrategy.OnPush
})
export class SidebarComponent {
constructor(public settings: SettingsService) {}
constructor(
public settings: SettingsService,
private identity: IdentityService,
@Inject(DA_SERVICE_TOKEN) private tokenService: TokenService,
private router: Router) { }

logout() {
this.identity.logout().then(res => {
this.tokenService.clear();
this.router.navigateByUrl(this.tokenService.login_url);
});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<nz-card>
<div nz-row nzGutter="16">
<div nz-col nzXl="24" nzXXl="12">
<st #entityST header="数据审计信息" [columns]="entityColumns" [page]="{show:false}" noResult="此次操作没有数据审计信息" size="small" [scroll]="{x:'800px', y:'400px'}"></st>
<st #entityST header="数据审计信息" [columns]="entityColumns" [page]="{show:false}" noResult="此次操作没有数据审计信息" size="small" [scroll]="{x:'800px', y:'400px'}" (change)="entityChange($event)"></st>
</div>
<div nz-col nzXl="24" nzXXl="12">
<st #propertyST header="数据属性变更明细" [columns]="propertyColumns" [page]="{show:false}" noResult="请点击数据审计查看属性变更明细" size="small" [scroll]="{x:'800px', y:'400px'}"></st>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Component, OnInit, Injector, ViewChild, ViewChildren, QueryList } from '@angular/core';
import { Component, OnInit, Injector, ViewChildren, QueryList } from '@angular/core';
import { STComponentBase, AlainService } from '@shared/osharp/services/ng-alain.service';
import { OsharpSTColumn } from '@shared/osharp/services/ng-alain.types';
import { STColumn, STData, STChange, STReq, STComponent, STRes, STColumnBadge } from '@delon/abc';
import { STColumn, STData, STChange, STComponent } from '@delon/abc';
import { PageRequest, FilterRule, PageData } from '@shared/osharp/osharp.model';

@Component({
Expand All @@ -28,15 +28,15 @@ export class AuditOperationComponent extends STComponentBase implements OnInit {
protected GetSTColumns(): OsharpSTColumn[] {
return [
{ title: '功能', index: 'FunctionName' },
{ title: '用户名', index: 'UserName' },
{ title: '用户名', index: 'UserName', },
{ title: '昵称', index: 'NickName' },
{ title: 'IP地址', index: 'Ip' },
{ title: '操作系统', index: 'OperationSystem' },
{ title: '浏览器', index: 'Browser' },
{ title: '结果', index: 'ResultType', type: 'tag', tag: this.alain.AjaxResultTypeTags },
{ title: '执行时间', index: 'CreatedTime', type: 'date' },
{ title: '耗时(ms)', index: 'Elapsed' },
{ title: '消息', index: 'Message', width: 300 },
{ title: '消息', index: 'Message', width: 200 },
];
}

Expand Down Expand Up @@ -80,14 +80,20 @@ export class AuditOperationComponent extends STComponentBase implements OnInit {

private entityInit() {
this.entityColumns = [
{ title: '操作', fixed: 'left', width: 65, buttons: [{ text: '变更', icon: 'ordered-list', click: d => this.showProps(d) }] },
{ title: '实体名称', index: 'Name' },
{ title: '实体类型', index: 'TypeName' },
{ title: '数据编号', index: 'EntityKey' },
{ title: '操作', index: 'OperateType', type: 'tag', tag: this.alain.OperateTypeTags },
];
}

entityChange(value: STChange) {
if (value.type === 'click' && value.click && value.click.item) {
let data = value.click.item;
this.showProps(data);
}
}

private showProps(data: STData) {
let index = this.keys.indexOf(data.OperationId);
let propertyST: STComponent = this.sts.toArray()[index * 2 + 2];
Expand Down

0 comments on commit 7cb812f

Please sign in to comment.