Commit 05227be3 authored by wangqinghua's avatar wangqinghua

update

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