Commit 77b6ce2c authored by xiaowenjie's avatar xiaowenjie
parents 0033625f 64d3aa1c
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
export const VERSION = process.env.VERSION; export const VERSION = process.env.VERSION;
export const DEBUG_INFO_ENABLED: boolean = !!process.env.DEBUG_INFO_ENABLED; export const DEBUG_INFO_ENABLED: boolean = !!process.env.DEBUG_INFO_ENABLED;
export const SERVER_API_URL = '/zabbixBox'; export const SERVER_API_URL = '/iomsp';
export const BUILD_TIMESTAMP = process.env.BUILD_TIMESTAMP; export const BUILD_TIMESTAMP = process.env.BUILD_TIMESTAMP;
export const pageSize = 25; export const pageSize = 25;
export const color = { export const color = {
......
...@@ -74,6 +74,7 @@ import {LookPlanComponent} from './work/modal/look-plan/look-plan.component'; ...@@ -74,6 +74,7 @@ import {LookPlanComponent} from './work/modal/look-plan/look-plan.component';
import {PlanModalComponent} from './work/modal/plan-modal/plan-modal.component'; import {PlanModalComponent} from './work/modal/plan-modal/plan-modal.component';
import {SelectPersonComponent} from './modal/select-person/select-person.component'; import {SelectPersonComponent} from './modal/select-person/select-person.component';
import {SelectRoleComponent} from './modal/select-role/select-role.component'; import {SelectRoleComponent} from './modal/select-role/select-role.component';
import {SeparationComponent} from './system/modal/separation/separation.component';
@NgModule({ @NgModule({
imports: [ imports: [
...@@ -147,7 +148,8 @@ import {SelectRoleComponent} from './modal/select-role/select-role.component'; ...@@ -147,7 +148,8 @@ import {SelectRoleComponent} from './modal/select-role/select-role.component';
LookPlanComponent, LookPlanComponent,
PlanModalComponent, PlanModalComponent,
SelectPersonComponent, SelectPersonComponent,
SelectRoleComponent SelectRoleComponent,
SeparationComponent
], ],
providers:[ providers:[
OverAllService, OverAllService,
......
...@@ -58,8 +58,8 @@ ...@@ -58,8 +58,8 @@
<button nz-button nzType="default" (click)="showGroupModal()" *ngIf="selectedValue == 'group'"><i <button nz-button nzType="default" (click)="showGroupModal()" *ngIf="selectedValue == 'group'"><i
class="anticon anticon-plus"></i>添加分组 class="anticon anticon-plus"></i>添加分组
</button> </button>
<button (click)="openBatchHost(1,'关闭')" nz-button nzType="default"><i <button (click)="openBatchHost(1,'停止')" nz-button nzType="default"><i
class="anticon anticon-pause-circle-o"></i>关闭监控 class="anticon anticon-pause-circle-o"></i>停止监控
</button> </button>
<button (click)="openBatchHost(0,'开启')" nz-button nzType="default"><i class="anticon anticon-play-circle-o"></i>开启监控 <button (click)="openBatchHost(0,'开启')" nz-button nzType="default"><i class="anticon anticon-play-circle-o"></i>开启监控
</button> </button>
...@@ -277,8 +277,7 @@ ...@@ -277,8 +277,7 @@
<li (click)="showTempStop(item)" nz-menu-item><a>临时暂停</a></li> <li (click)="showTempStop(item)" nz-menu-item><a>临时暂停</a></li>
<li (click)="openHost(item)" nz-menu-item><a> <li (click)="openHost(item)" nz-menu-item><a>
<ng-container *ngIf="item.status == 1">开启</ng-container> <ng-container *ngIf="item.status == 1">开启</ng-container>
<ng-container *ngIf="item.status == 0">停止</ng-container> <ng-container *ngIf="item.status == 0">停止</ng-container>监控
监控
</a></li> </a></li>
<li nz-menu-item (click)="goDetail(item)"><a>查看监测点</a></li> <li nz-menu-item (click)="goDetail(item)"><a>查看监测点</a></li>
<li (click)="showAlarm(item)" nz-menu-item><a>添加告警</a></li> <li (click)="showAlarm(item)" nz-menu-item><a>添加告警</a></li>
...@@ -365,8 +364,7 @@ ...@@ -365,8 +364,7 @@
<li (click)="showTempStop(item)" nz-menu-item><a>临时暂停</a></li> <li (click)="showTempStop(item)" nz-menu-item><a>临时暂停</a></li>
<li (click)="openHost(item)" nz-menu-item><a> <li (click)="openHost(item)" nz-menu-item><a>
<ng-container *ngIf="item.status == 1">开启</ng-container> <ng-container *ngIf="item.status == 1">开启</ng-container>
<ng-container *ngIf="item.status == 0">停止</ng-container> <ng-container *ngIf="item.status == 0">停止</ng-container>监控
监控
</a></li> </a></li>
<li nz-menu-item (click)="goDetail(item)"><a>查看监测点</a></li> <li nz-menu-item (click)="goDetail(item)"><a>查看监测点</a></li>
<li (click)="showAlarm(item)" nz-menu-item><a>添加告警</a></li> <li (click)="showAlarm(item)" nz-menu-item><a>添加告警</a></li>
......
import { Component, OnInit } from '@angular/core'; import {Component, OnInit} from '@angular/core';
import {SystemService} from '../system.service';
@Component({ @Component({
selector: 'jhi-examine', selector: 'jhi-examine',
templateUrl: './examine.component.html', templateUrl: './examine.component.html',
styles: [] styles: []
}) })
export class ExamineComponent implements OnInit { export class ExamineComponent implements OnInit {
tabs = [ '已审批', '待审批' ]; tabs = ['已审批', '待审批'];
dataSet:any[]; dataSet: any[];
constructor() { }
ngOnInit() { constructor(private systemSer: SystemService) {
this.dataSet = [ }
{
key1 : '操作用户', ngOnInit() {
key2 : '操作内容', this.getRole();
key3 : '提交时间', this.getList();
key4 : '审核状态', }
key5 : '审核人',
key6 : '审核时间', getRole() {
}, this.systemSer.currentUserRoles().subscribe(
{ (res) => {
key1 : '操作用户',
key2 : '操作内容', }
key3 : '提交时间', );
key4 : '审核状态', }
key5 : '审核人',
key6 : '审核时间', getList() {
},
{ }
key1 : '操作用户',
key2 : '操作内容',
key3 : '提交时间',
key4 : '审核状态',
key5 : '审核人',
key6 : '审核时间',
},
{
key1 : '操作用户',
key2 : '操作内容',
key3 : '提交时间',
key4 : '审核状态',
key5 : '审核人',
key6 : '审核时间',
},
{
key1 : '操作用户',
key2 : '操作内容',
key3 : '提交时间',
key4 : '审核状态',
key5 : '审核人',
key6 : '审核时间',
},
{
key1 : '操作用户',
key2 : '操作内容',
key3 : '提交时间',
key4 : '审核状态',
key5 : '审核人',
key6 : '审核时间',
},
];
}
} }
...@@ -79,9 +79,9 @@ ...@@ -79,9 +79,9 @@
</div> </div>
</div> </div>
<!--新增用户--> <!--新增用户-->
<smart-user #smartUser></smart-user> <smart-user #smartUser (done)="getUser()"></smart-user>
<!--新增部门--> <!--新增部门-->
<smart-group-modal #smartGroupModal></smart-group-modal> <smart-group-modal #smartGroupModal (done)="getGroup()"></smart-group-modal>
<!--授予角色--> <!--授予角色-->
<smart-select-role #smartSelectRole (done)="setRole($event)"></smart-select-role> <smart-select-role #smartSelectRole (done)="setRole($event)"></smart-select-role>
...@@ -147,24 +147,29 @@ export class GroupComponent implements OnInit { ...@@ -147,24 +147,29 @@ export class GroupComponent implements OnInit {
//授予角色 //授予角色
grantRole(data){ grantRole(data){
this.userId = data.id; this.userId = data.id;
const res = {
userId:data.id
}
this.systemSer.roleList(res).subscribe(
(res)=>{
}
)
this.smartSelectRole.showModal("选择角色"); this.smartSelectRole.showModal("选择角色");
} }
setRole(event){ setRole(event){
console.log(event);
let str =""; let str ="";
event.forEach(res=>{ event.forEach(res=>{
str += res.id +","; str += res.id +",";
}); });
str = str.substring(0,str.length-1); str = str.substring(0,str.length-1);
const data = { let formdata = new FormData();
userId:this.userId, formdata.append("userId",this.userId);
roleIds:str formdata.append("roles",str);
}; this.systemSer.batchGrantRoleToUser(formdata).subscribe(
this.systemSer.batchGrantRoleToUser(data).subscribe(
(res)=>{ (res)=>{
if(res.errCode == 10000){ if(res.errCode == 10000){
this.message.success("授予角色成功"); this.message.success("授予角色成功");
}else{ }else{
this.message.error(res.errMsg); this.message.error(res.errMsg);
......
import { Component, OnInit } from '@angular/core'; import {Component, EventEmitter, OnInit, Output} from '@angular/core';
import {FormBuilder, FormGroup, Validators} from '@angular/forms'; import {FormBuilder, FormGroup, Validators} from '@angular/forms';
import {SystemService} from '../../system.service'; import {SystemService} from '../../system.service';
import {NzMessageService} from 'ng-zorro-antd';
@Component({ @Component({
selector: 'smart-group-modal', selector: 'smart-group-modal',
...@@ -8,17 +9,22 @@ import {SystemService} from '../../system.service'; ...@@ -8,17 +9,22 @@ import {SystemService} from '../../system.service';
styles: [] styles: []
}) })
export class GroupModalComponent implements OnInit { export class GroupModalComponent implements OnInit {
@Output() done = new EventEmitter<any>();
title = '新增部门'; title = '新增部门';
isVisible = false; isVisible = false;
validateForm:FormGroup; validateForm:FormGroup;
groupList:any[]; groupList:any[];
constructor(private fb:FormBuilder, constructor(private fb:FormBuilder,private message:NzMessageService,
private systemSer:SystemService) { private systemSer:SystemService) {
} }
ngOnInit() :void{ ngOnInit() :void{
this.initForm();
}
initForm(){
this.validateForm = this.fb.group({ this.validateForm = this.fb.group({
name:[null,[Validators.required,Validators.maxLength(15)]], name:[null,[Validators.required,Validators.maxLength(15)]],
parentId:[null,[Validators.required]], parentId:[null,[Validators.required]],
...@@ -42,7 +48,14 @@ export class GroupModalComponent implements OnInit { ...@@ -42,7 +48,14 @@ export class GroupModalComponent implements OnInit {
} }
this.systemSer.createOrg(this.validateForm.value).subscribe( this.systemSer.createOrg(this.validateForm.value).subscribe(
(res)=>{ (res)=>{
if(res.errCode == 10000){
this.initForm();
this.isVisible = false;
this.done.emit();
this.message.success("新增部门成功");
}else{
this.message.error(res.errMsg);
}
} }
) )
} }
......
...@@ -59,7 +59,6 @@ export class RoleComponent implements OnInit { ...@@ -59,7 +59,6 @@ export class RoleComponent implements OnInit {
child.isLeaf = true; child.isLeaf = true;
}) })
}); });
console.log(this.menuList);
this.toNode(this.menuList); this.toNode(this.menuList);
} }
} }
......
<nz-modal [(nzVisible)]="isVisible" nzTitle="{{title}}" (nzOnCancel)="handleCancel()" (nzOnOk)="handleOk()">
<div style="position: absolute;left:20%;top: 15px;">
<nz-switch [(ngModel)]="first.check"></nz-switch>
</div>
<form nz-form>
<nz-form-item *ngFor="let item of list">
<nz-form-label [nzSm]="8" [nzXs]="24" [ngModelOptions]="{standalone: true}" >{{item.name}}</nz-form-label>
<nz-form-control [nzSm]="14" [nzXs]="24">
<nz-switch [(ngModel)]="item.check" [ngModelOptions]="{standalone: true}"></nz-switch>
</nz-form-control>
</nz-form-item>
</form>
</nz-modal>
import {Component, OnInit} from '@angular/core';
import {SystemService} from '../../system.service';
import {NzMessageService} from 'ng-zorro-antd';
@Component({
selector: 'smart-separation',
templateUrl: './separation.component.html',
styles: []
})
export class SeparationComponent implements OnInit {
isVisible = false;
title;
list = [];
value = 0;
first = {
id:"",
value:null,
check:null
};
constructor(private systemSer: SystemService,private message:NzMessageService) {
}
ngOnInit() {}
//查询三员分立
separationPowerStatus() {
this.systemSer.separationPowers().subscribe(
(res) => {
if (res.errCode == 10000) {
this.first = res.data[0];
if(this.first.value == 0){
this.first.check = true;
}else{
this.first.check = false;
}
res.data.splice(0, 1);
this.list = res.data;
this.list.forEach(e=>{
if(e.value == 0){
e.check = true;
}else{
e.check = false;
}
})
}
}
);
}
showModal(title) {
this.title = title;
this.isVisible = true;
this.separationPowerStatus();
}
handleCancel() {
this.isVisible = false;
}
//保存
handleOk() {
let arr = [];
arr.push(this.first);
arr = arr.concat(this.list);
let arr1 = arr.map(res=>{
const data = {
id:res.id,
value:null
}
if(res.check){
data.value = 0;
}else{
data.value = 1;
}
return data;
});
this.systemSer.updateSeparationPowerStatus(arr1).subscribe(
(res)=>{
if(res.errCode == 10000){
if(this.first.check){
this.message.success("已开启三员分立功能");
}else{
this.message.success("已关闭三员分立功能");
}
this.isVisible = false;
}else{
this.message.error(res.errMsg);
}
}
)
}
}
import {Component, OnInit} from '@angular/core'; import {Component, EventEmitter, OnInit, Output} from '@angular/core';
import { import {
AbstractControl, Form, AbstractControl, Form,
FormBuilder, FormBuilder,
...@@ -15,6 +15,7 @@ import {NzMessageService} from 'ng-zorro-antd'; ...@@ -15,6 +15,7 @@ import {NzMessageService} from 'ng-zorro-antd';
styles: [] styles: []
}) })
export class UserComponent implements OnInit { export class UserComponent implements OnInit {
@Output() done = new EventEmitter<any>();
title = '新增用户'; title = '新增用户';
isVisible = false; isVisible = false;
...@@ -26,6 +27,10 @@ export class UserComponent implements OnInit { ...@@ -26,6 +27,10 @@ export class UserComponent implements OnInit {
} }
ngOnInit() :void{ ngOnInit() :void{
this.initForm();
}
initForm(){
this.validateForm = this.fb.group({ this.validateForm = this.fb.group({
name:[null,[Validators.required,Validators.maxLength(10)]], name:[null,[Validators.required,Validators.maxLength(10)]],
loginName:[null,[Validators.required,Validators.maxLength(10)]], loginName:[null,[Validators.required,Validators.maxLength(10)]],
...@@ -61,8 +66,10 @@ export class UserComponent implements OnInit { ...@@ -61,8 +66,10 @@ export class UserComponent implements OnInit {
(res)=>{ (res)=>{
if(res.errCode == 10000){ if(res.errCode == 10000){
this.isVisible = false; this.isVisible = false;
this.initForm();
this.done.emit();
}else{ }else{
this.message.info(res.errMsg); this.message.error(res.errMsg);
} }
} }
) )
......
...@@ -20,8 +20,8 @@ ...@@ -20,8 +20,8 @@
<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>三员分立</button> <button (click)="showSeparationModal()" nz-button nzType="default">三员分立</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-plus"></i>新增角色</button>
</div> </div>
<div nz-col nzSpan="8" class="text-right"> <div nz-col nzSpan="8" class="text-right">
<input nz-input placeholder="角色/权限模块/资源权限"> <input nz-input placeholder="角色/权限模块/资源权限">
...@@ -63,5 +63,8 @@ ...@@ -63,5 +63,8 @@
<!--新增角色--> <!--新增角色-->
<smart-role #smartRole (add)="getRole()"></smart-role> <smart-role #smartRole (add)="getRole()"></smart-role>
<!--三员分立-->
<smart-separation #smartSeparation></smart-separation>
<!--选择人员-->
<smart-select-person #smartSelectPerson (done)="batchAdduserToRole($event)"></smart-select-person> <smart-select-person #smartSelectPerson (done)="batchAdduserToRole($event)"></smart-select-person>
\ No newline at end of file
...@@ -3,6 +3,7 @@ import {SystemService} from '../system.service'; ...@@ -3,6 +3,7 @@ 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'; import {SelectPersonComponent} from '../../modal/select-person/select-person.component';
import {SeparationComponent} from '../modal/separation/separation.component';
@Component({ @Component({
selector: 'jhi-power', selector: 'jhi-power',
...@@ -12,6 +13,7 @@ import {SelectPersonComponent} from '../../modal/select-person/select-person.com ...@@ -12,6 +13,7 @@ import {SelectPersonComponent} from '../../modal/select-person/select-person.com
export class PowerComponent implements OnInit { export class PowerComponent implements OnInit {
@ViewChild('smartRole') smartRole: RoleComponent; @ViewChild('smartRole') smartRole: RoleComponent;
@ViewChild('smartSelectPerson') smartSelectPerson:SelectPersonComponent; @ViewChild('smartSelectPerson') smartSelectPerson:SelectPersonComponent;
@ViewChild('smartSeparation') smartSeparation:SeparationComponent;
dataSet: any[]; dataSet: any[];
isVisible = false; isVisible = false;
...@@ -52,17 +54,15 @@ export class PowerComponent implements OnInit { ...@@ -52,17 +54,15 @@ export class PowerComponent implements OnInit {
//但一角色批量添加用户 //但一角色批量添加用户
batchAdduserToRole(e){ batchAdduserToRole(e){
console.log(e);
let str =""; let str ="";
e.forEach(res=>{ e.forEach(res=>{
str += res.id +","; str += res.id +",";
}); });
str = str.substring(0,str.length-1); str = str.substring(0,str.length-1);
const data = { let formData = new FormData();
roleId:this.roleId, formData.append("roleId",this.roleId);
users:str formData.append("users",str);
} this.systemSer.batchGrantUserToRole(formData).subscribe(
this.systemSer.batchGrantUserToRole(data).subscribe(
(res)=>{ (res)=>{
if(res.errCode == 10000){ if(res.errCode == 10000){
this.message.success("授予成功") this.message.success("授予成功")
...@@ -98,6 +98,11 @@ export class PowerComponent implements OnInit { ...@@ -98,6 +98,11 @@ export class PowerComponent implements OnInit {
} }
//三员分立
showSeparationModal(){
this.smartSeparation.showModal("三员分立");
}
getCaptcha(e: MouseEvent): void { getCaptcha(e: MouseEvent): void {
e.preventDefault(); e.preventDefault();
} }
......
...@@ -79,4 +79,24 @@ export class SystemService { ...@@ -79,4 +79,24 @@ export class SystemService {
batchGrantRoleToUser(data): Observable<any>{ batchGrantRoleToUser(data): Observable<any>{
return this.http.post(SERVER_API_URL + '/role/batchGrantRoleToUser',data); return this.http.post(SERVER_API_URL + '/role/batchGrantRoleToUser',data);
} }
//查询三员分立是否开启
separationPowerStatus(): Observable<any>{
return this.http.get(SERVER_API_URL + '/approval/separationPowerStatus');
}
//修改三员分立状态
updateSeparationPowerStatus(data): Observable<any>{
return this.http.put(SERVER_API_URL + '/approval/separationPowers',data);
}
//获取当前登录人角色
currentUserRoles(): Observable<any>{
return this.http.get(SERVER_API_URL + '/role/currentUserRoles');
}
//单个用户角色获取
roleList(data): Observable<any>{
return this.http.get(SERVER_API_URL + '/user/roleList?'+this.toTree.toQuery(data) );
}
} }
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