Commit 05227be3 authored by wangqinghua's avatar wangqinghua

update

parent 1c0a45ba
import { Component, OnInit } from '@angular/core'; import {Component, OnInit} from '@angular/core';
import { Router } from "@angular/router"; import {Router} from '@angular/router';
import { Http } from "@angular/http"; import {Http} from '@angular/http';
import { LayoutService } from "../layout.service"; import {LayoutService} from '../layout.service';
import { LocalStorageService, SessionStorageService } from 'ngx-webstorage'; import {LocalStorageService, SessionStorageService} from 'ngx-webstorage';
import {ToTree} from '../../shared/common/toTree'; import {ToTree} from '../../shared/common/toTree';
...@@ -10,7 +10,7 @@ import {ToTree} from '../../shared/common/toTree'; ...@@ -10,7 +10,7 @@ import {ToTree} from '../../shared/common/toTree';
selector: 'jhi-sidebar', selector: 'jhi-sidebar',
templateUrl: './sidebar.component.html', templateUrl: './sidebar.component.html',
styles: [ styles: [
` span i{ ` span i {
margin-right: 10px; margin-right: 10px;
} ` } `
] ]
...@@ -19,8 +19,8 @@ export class SidebarComponent implements OnInit { ...@@ -19,8 +19,8 @@ export class SidebarComponent implements OnInit {
token: boolean; token: boolean;
constructor(public router: Router, private http: Http, constructor(public router: Router, private http: Http,
public layoutSer:LayoutService, public layoutSer: LayoutService,
public toTreeSer:ToTree, public toTreeSer: ToTree,
private $localStorage: LocalStorageService, private $localStorage: LocalStorageService,
private $sessionStorage: SessionStorageService) { private $sessionStorage: SessionStorageService) {
} }
...@@ -31,14 +31,14 @@ export class SidebarComponent implements OnInit { ...@@ -31,14 +31,14 @@ export class SidebarComponent implements OnInit {
this.getMenu(); this.getMenu();
} }
getMenu(){ getMenu() {
this.layoutSer.getMenu().subscribe( this.layoutSer.getMenu().subscribe(
(res)=>{ (res) => {
if(res.errCode == 10000){ if (res.errCode == 10000) {
this.menuList =this.toTreeSer.listToTree('id','parentId',res.data); this.menuList = this.toTreeSer.listToTree('id', 'parentId', res.data);
} }
} }
) );
} }
//简单使用 //简单使用
...@@ -46,12 +46,12 @@ export class SidebarComponent implements OnInit { ...@@ -46,12 +46,12 @@ export class SidebarComponent implements OnInit {
openHandler(value: string): void { openHandler(value: string): void {
for (let key in this.menuList) { for (let key in this.menuList) {
if (key !== value) { if (key !== value) {
this.menuList[ key ].checked = false; this.menuList[key].checked = false;
} }
} }
} }
goTo(route){ goTo(route) {
this.router.navigate([route]); this.router.navigate([route]);
} }
} }
...@@ -35,11 +35,11 @@ ...@@ -35,11 +35,11 @@
<i *ngIf="!green && green !=0" class="anticon anticon-spin anticon-loading" style="font-size: 15px;"></i> <i *ngIf="!green && green !=0" class="anticon anticon-spin anticon-loading" style="font-size: 15px;"></i>
{{green}} {{green}}
</span> </span>
<span routerLink="../nowAlarm" style="margin-right: 8px"> <nz-tag [nzColor]="color.yellow"></nz-tag> <span (click)="search('2')" style="margin-right: 8px"> <nz-tag [nzColor]="color.yellow"></nz-tag>
<i *ngIf="!yellow && yellow != 0" class="anticon anticon-spin anticon-loading" style="font-size: 15px;"></i> <i *ngIf="!yellow && yellow != 0" class="anticon anticon-spin anticon-loading" style="font-size: 15px;"></i>
{{yellow}} {{yellow}}
</span> </span>
<span routerLink="../nowAlarm" style="margin-right: 8px"> <nz-tag [nzColor]="color.red"></nz-tag> <span (click)="search('3')" style="margin-right: 8px"> <nz-tag [nzColor]="color.red"></nz-tag>
<i *ngIf="!red && red != 0" class="anticon anticon-spin anticon-loading" style="font-size: 15px;"></i> <i *ngIf="!red && red != 0" class="anticon anticon-spin anticon-loading" style="font-size: 15px;"></i>
{{red}} {{red}}
</span> </span>
......
import { Component, OnInit } from '@angular/core'; import { Component, OnInit } from '@angular/core';
import {SystemService} from '../system.service';
import {pageSize} from '../../app.constants';
@Component({ @Component({
selector: 'jhi-audit', selector: 'jhi-audit',
...@@ -8,59 +10,29 @@ import { Component, OnInit } from '@angular/core'; ...@@ -8,59 +10,29 @@ import { Component, OnInit } from '@angular/core';
export class AuditComponent implements OnInit { export class AuditComponent implements OnInit {
dataSet:any[]; dataSet:any[];
date = '1'; date = '1';
constructor() { } pageSize = pageSize;
pageNumber = 1;
constructor(private systemSer:SystemService) { }
ngOnInit() { ngOnInit() {
this.dataSet = [ this.getList();
{ }
key1 : '系统时间',
key2 : '用户', getList(){
key3 : 'IP地址', const data = {
key4 : '操作模块', pageSize:this.pageSize,
key5 : '资源', pageNumber:this.pageNumber,
key6 : '详情' endDate:"",
}, startDate:"",
{ name:"",
key1 : '系统时间', type:""
key2 : '用户', }
key3 : 'IP地址', this.systemSer.logList(data).subscribe(
key4 : '操作模块', (res)=>{
key5 : '资源', this.dataSet = res.data;
key6 : '详情' }
}, )
{
key1 : '系统时间',
key2 : '用户',
key3 : 'IP地址',
key4 : '操作模块',
key5 : '资源',
key6 : '详情'
},
{
key1 : '系统时间',
key2 : '用户',
key3 : 'IP地址',
key4 : '操作模块',
key5 : '资源',
key6 : '详情'
},
{
key1 : '系统时间',
key2 : '用户',
key3 : 'IP地址',
key4 : '操作模块',
key5 : '资源',
key6 : '详情'
},
{
key1 : '系统时间',
key2 : '用户',
key3 : 'IP地址',
key4 : '操作模块',
key5 : '资源',
key6 : '详情'
},
];
} }
} }
...@@ -24,15 +24,23 @@ ...@@ -24,15 +24,23 @@
<nz-form-explain *ngIf="validateForm.get('comments').dirty && validateForm.get('comments').errors">请输入角色说明!</nz-form-explain> <nz-form-explain *ngIf="validateForm.get('comments').dirty && validateForm.get('comments').errors">请输入角色说明!</nz-form-explain>
</nz-form-control> </nz-form-control>
</nz-form-item> </nz-form-item>
<!--<nz-form-item>--> <nz-form-item>
<!--<nz-form-label [nzSm]="6" [nzXs]="24" >模块权限</nz-form-label>--> <nz-form-label [nzSm]="6" [nzXs]="24" >模块权限</nz-form-label>
<!--<nz-form-control [nzSm]="14" [nzXs]="24">--> <nz-form-control [nzSm]="14" [nzXs]="24" style="max-height: 200px">
<!--<nz-select id="department" nzPlaceHolder="所属部门">--> <div class="tree-div">
<!--</nz-select>--> <nz-tree #nzTree
<!--&lt;!&ndash;<nz-form-explain *ngIf="validateForm.get('gender').dirty && validateForm.get('gender').errors">Please select your gender!</nz-form-explain>&ndash;&gt;--> [(ngModel)]="nodes" [ngModelOptions]="{standalone: true}"
<!--</nz-form-control>--> [nzCheckable]="true"
<!--</nz-form-item>--> [nzAsyncData]="true"
<!--<nz-form-item>--> [nzCheckStrictly]="true"
(nzCheckBoxChange)="selectCheckTree($event)"
(nzClick)="mouseAction('expand',$event)"
(nzExpandChange)="mouseAction('expand',$event)" >
</nz-tree>
</div>
</nz-form-control>
</nz-form-item>
<nz-form-item>
<!--<nz-form-label [nzSm]="6" [nzXs]="24" >资源权限</nz-form-label>--> <!--<nz-form-label [nzSm]="6" [nzXs]="24" >资源权限</nz-form-label>-->
<!--<nz-form-control [nzSm]="14" [nzXs]="24">--> <!--<nz-form-control [nzSm]="14" [nzXs]="24">-->
<!--<nz-select id="isBoolean" nzPlaceHolder="选择性别">--> <!--<nz-select id="isBoolean" nzPlaceHolder="选择性别">-->
......
...@@ -7,7 +7,9 @@ import { ...@@ -7,7 +7,9 @@ import {
Validators Validators
} from '@angular/forms'; } from '@angular/forms';
import {SystemService} from '../../system.service'; import {SystemService} from '../../system.service';
import {NzMessageService} from 'ng-zorro-antd'; import {NzMessageService, NzTreeNode} from 'ng-zorro-antd';
import {LayoutService} from '../../../layouts/layout.service';
import {ToTree} from '../../../shared/common/toTree';
@Component({ @Component({
selector: 'smart-role', selector: 'smart-role',
...@@ -17,15 +19,24 @@ import {NzMessageService} from 'ng-zorro-antd'; ...@@ -17,15 +19,24 @@ import {NzMessageService} from 'ng-zorro-antd';
export class RoleComponent implements OnInit { export class RoleComponent implements OnInit {
@Output() add = new EventEmitter<any>(); @Output() add = new EventEmitter<any>();
title = '新增角色'; title;
isVisible = false; isVisible = false;
validateForm: FormGroup; validateForm: FormGroup;
menuList;
nodes;
nodeList;
constructor(private fb: FormBuilder, private message: NzMessageService, constructor(private fb: FormBuilder, private message: NzMessageService,
private systemSer: SystemService) { private systemSer: SystemService,private layoutSer:LayoutService,private toTreeSer:ToTree) {
} }
ngOnInit() { ngOnInit() {
this.ininForm();
this.getMenu();
}
ininForm(){
this.validateForm = this.fb.group({ this.validateForm = this.fb.group({
name: [null, [Validators.required]], name: [null, [Validators.required]],
status: [null, [Validators.required]], status: [null, [Validators.required]],
...@@ -33,8 +44,51 @@ export class RoleComponent implements OnInit { ...@@ -33,8 +44,51 @@ export class RoleComponent implements OnInit {
}); });
} }
showModal(): void { //获取菜单栏
getMenu(){
this.layoutSer.getMenu().subscribe(
(res)=>{
if(res.errCode == 10000){
this.menuList =this.toTreeSer.listToTree('id','parentId',res.data);
this.menuList.forEach(res => {
res.title = res.name;
res.key = res.id;
res.children.forEach((child)=>{
child.title = child.name;
child.key = child.id;
child.isLeaf = true;
})
});
console.log(this.menuList);
this.toNode(this.menuList);
}
}
)
}
toNode(data) {
this.nodes = data.map(res => {
return new NzTreeNode(res);
});
}
showAddModal(): void {
this.title = '新增角色';
this.isVisible = true;
}
showEditModal(id){
this.title = "编辑角色";
this.isVisible = true; this.isVisible = true;
this.systemSer.getRole(id).subscribe(
(res)=>{
if(res.errCode == 10000){
const data = res.data;
data.status += "";
this.validateForm.patchValue(data);
}
}
)
} }
handleCancel(): void { handleCancel(): void {
......
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
<div nz-row class="search-form"> <div nz-row class="search-form">
<div nz-col nzSpan="16"> <div nz-col nzSpan="16">
<button (click)="showAddRoleModal()" nz-button nzType="default"><i class="anticon anticon-search"></i>sanyuanfenli</button> <button (click)="showAddRoleModal()" nz-button nzType="default"><i class="anticon anticon-search"></i>三员分立</button>
<button (click)="showAddRoleModal()" nz-button nzType="default"><i class="anticon anticon-search"></i>新增角色</button> <button (click)="showAddRoleModal()" nz-button nzType="default"><i class="anticon anticon-search"></i>新增角色</button>
</div> </div>
<div nz-col nzSpan="8" class="text-right"> <div nz-col nzSpan="8" class="text-right">
...@@ -51,8 +51,9 @@ ...@@ -51,8 +51,9 @@
</ng-container> </ng-container>
</td> </td>
<td class="handle"> <td class="handle">
<span (click)="grantUser(data)">授予用户</span>
<span>查看</span> <span>查看</span>
<span>编辑</span> <span (click)="showEditModal(data.id)">编辑</span>
<span (click)="deleteRole(data)">删除</span> <span (click)="deleteRole(data)">删除</span>
</td> </td>
</tr> </tr>
...@@ -62,4 +63,4 @@ ...@@ -62,4 +63,4 @@
<!--新增角色--> <!--新增角色-->
<smart-role #smartRole (add)="getRole()"></smart-role> <smart-role #smartRole (add)="getRole()"></smart-role>
<basic-edit #basicEdit></basic-edit> <smart-select-person #smartSelectPerson></smart-select-person>
\ No newline at end of file \ No newline at end of file
...@@ -2,6 +2,7 @@ import {Component, OnInit, ViewChild} from '@angular/core'; ...@@ -2,6 +2,7 @@ import {Component, OnInit, ViewChild} from '@angular/core';
import {SystemService} from '../system.service'; import {SystemService} from '../system.service';
import {RoleComponent} from '../modal/role/role.component'; import {RoleComponent} from '../modal/role/role.component';
import {NzMessageService, NzModalService} from 'ng-zorro-antd'; import {NzMessageService, NzModalService} from 'ng-zorro-antd';
import {SelectPersonComponent} from '../../modal/select-person/select-person.component';
@Component({ @Component({
selector: 'jhi-power', selector: 'jhi-power',
...@@ -10,6 +11,8 @@ import {NzMessageService, NzModalService} from 'ng-zorro-antd'; ...@@ -10,6 +11,8 @@ import {NzMessageService, NzModalService} from 'ng-zorro-antd';
}) })
export class PowerComponent implements OnInit { export class PowerComponent implements OnInit {
@ViewChild('smartRole') smartRole: RoleComponent; @ViewChild('smartRole') smartRole: RoleComponent;
@ViewChild('smartSelectPerson') smartSelectPerson:SelectPersonComponent;
dataSet: any[]; dataSet: any[];
isVisible = false; isVisible = false;
...@@ -31,7 +34,17 @@ export class PowerComponent implements OnInit { ...@@ -31,7 +34,17 @@ export class PowerComponent implements OnInit {
//新增角色 //新增角色
showAddRoleModal() { showAddRoleModal() {
this.smartRole.showModal(); this.smartRole.showAddModal();
}
//编辑角色
showEditModal(id){
this.smartRole.showEditModal(id);
}
//授予用户
grantUser(){
this.smartSelectPerson.showModal("授予用户");
} }
//删除角色 //删除角色
......
...@@ -15,6 +15,11 @@ export class SystemService { ...@@ -15,6 +15,11 @@ export class SystemService {
return this.http.get(SERVER_API_URL + '/role'); return this.http.get(SERVER_API_URL + '/role');
} }
//获取单个角色
getRole(params): Observable<any>{
return this.http.get(SERVER_API_URL + '/role/'+params);
}
//编辑角色 //编辑角色
editRole(data): Observable<any>{ editRole(data): Observable<any>{
return this.http.put(SERVER_API_URL + '/role',data); return this.http.put(SERVER_API_URL + '/role',data);
...@@ -60,4 +65,8 @@ export class SystemService { ...@@ -60,4 +65,8 @@ export class SystemService {
return this.http.get(SERVER_API_URL + '/approval/separationPowers',); return this.http.get(SERVER_API_URL + '/approval/separationPowers',);
} }
//审计列表
logList(data): Observable<any>{
return this.http.get(SERVER_API_URL + '/log?'+this.toTree.toQuery(data));
}
} }
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment