Commit 77b6ce2c authored by xiaowenjie's avatar xiaowenjie
parents 0033625f 64d3aa1c
......@@ -4,7 +4,7 @@
export const VERSION = process.env.VERSION;
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 pageSize = 25;
export const color = {
......
......@@ -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 {SelectPersonComponent} from './modal/select-person/select-person.component';
import {SelectRoleComponent} from './modal/select-role/select-role.component';
import {SeparationComponent} from './system/modal/separation/separation.component';
@NgModule({
imports: [
......@@ -147,7 +148,8 @@ import {SelectRoleComponent} from './modal/select-role/select-role.component';
LookPlanComponent,
PlanModalComponent,
SelectPersonComponent,
SelectRoleComponent
SelectRoleComponent,
SeparationComponent
],
providers:[
OverAllService,
......
......@@ -58,8 +58,8 @@
<button nz-button nzType="default" (click)="showGroupModal()" *ngIf="selectedValue == 'group'"><i
class="anticon anticon-plus"></i>添加分组
</button>
<button (click)="openBatchHost(1,'关闭')" nz-button nzType="default"><i
class="anticon anticon-pause-circle-o"></i>关闭监控
<button (click)="openBatchHost(1,'停止')" nz-button nzType="default"><i
class="anticon anticon-pause-circle-o"></i>停止监控
</button>
<button (click)="openBatchHost(0,'开启')" nz-button nzType="default"><i class="anticon anticon-play-circle-o"></i>开启监控
</button>
......@@ -277,8 +277,7 @@
<li (click)="showTempStop(item)" nz-menu-item><a>临时暂停</a></li>
<li (click)="openHost(item)" nz-menu-item><a>
<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>
<li nz-menu-item (click)="goDetail(item)"><a>查看监测点</a></li>
<li (click)="showAlarm(item)" nz-menu-item><a>添加告警</a></li>
......@@ -365,8 +364,7 @@
<li (click)="showTempStop(item)" nz-menu-item><a>临时暂停</a></li>
<li (click)="openHost(item)" nz-menu-item><a>
<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>
<li nz-menu-item (click)="goDetail(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({
selector: 'jhi-examine',
templateUrl: './examine.component.html',
styles: []
selector: 'jhi-examine',
templateUrl: './examine.component.html',
styles: []
})
export class ExamineComponent implements OnInit {
tabs = [ '已审批', '待审批' ];
dataSet:any[];
constructor() { }
tabs = ['已审批', '待审批'];
dataSet: any[];
ngOnInit() {
this.dataSet = [
{
key1 : '操作用户',
key2 : '操作内容',
key3 : '提交时间',
key4 : '审核状态',
key5 : '审核人',
key6 : '审核时间',
},
{
key1 : '操作用户',
key2 : '操作内容',
key3 : '提交时间',
key4 : '审核状态',
key5 : '审核人',
key6 : '审核时间',
},
{
key1 : '操作用户',
key2 : '操作内容',
key3 : '提交时间',
key4 : '审核状态',
key5 : '审核人',
key6 : '审核时间',
},
{
key1 : '操作用户',
key2 : '操作内容',
key3 : '提交时间',
key4 : '审核状态',
key5 : '审核人',
key6 : '审核时间',
},
{
key1 : '操作用户',
key2 : '操作内容',
key3 : '提交时间',
key4 : '审核状态',
key5 : '审核人',
key6 : '审核时间',
},
{
key1 : '操作用户',
key2 : '操作内容',
key3 : '提交时间',
key4 : '审核状态',
key5 : '审核人',
key6 : '审核时间',
},
];
}
constructor(private systemSer: SystemService) {
}
ngOnInit() {
this.getRole();
this.getList();
}
getRole() {
this.systemSer.currentUserRoles().subscribe(
(res) => {
}
);
}
getList() {
}
}
......@@ -79,9 +79,9 @@
</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>
......@@ -147,24 +147,29 @@ export class GroupComponent implements OnInit {
//授予角色
grantRole(data){
this.userId = data.id;
const res = {
userId:data.id
}
this.systemSer.roleList(res).subscribe(
(res)=>{
}
)
this.smartSelectRole.showModal("选择角色");
}
setRole(event){
console.log(event);
let str ="";
event.forEach(res=>{
str += res.id +",";
});
str = str.substring(0,str.length-1);
const data = {
userId:this.userId,
roleIds:str
};
this.systemSer.batchGrantRoleToUser(data).subscribe(
let formdata = new FormData();
formdata.append("userId",this.userId);
formdata.append("roles",str);
this.systemSer.batchGrantRoleToUser(formdata).subscribe(
(res)=>{
if(res.errCode == 10000){
this.message.success("授予角色成功");
}else{
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 {SystemService} from '../../system.service';
import {NzMessageService} from 'ng-zorro-antd';
@Component({
selector: 'smart-group-modal',
......@@ -8,17 +9,22 @@ import {SystemService} from '../../system.service';
styles: []
})
export class GroupModalComponent implements OnInit {
@Output() done = new EventEmitter<any>();
title = '新增部门';
isVisible = false;
validateForm:FormGroup;
groupList:any[];
constructor(private fb:FormBuilder,
constructor(private fb:FormBuilder,private message:NzMessageService,
private systemSer:SystemService) {
}
ngOnInit() :void{
this.initForm();
}
initForm(){
this.validateForm = this.fb.group({
name:[null,[Validators.required,Validators.maxLength(15)]],
parentId:[null,[Validators.required]],
......@@ -42,7 +48,14 @@ export class GroupModalComponent implements OnInit {
}
this.systemSer.createOrg(this.validateForm.value).subscribe(
(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 {
child.isLeaf = true;
})
});
console.log(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 {
AbstractControl, Form,
FormBuilder,
......@@ -15,6 +15,7 @@ import {NzMessageService} from 'ng-zorro-antd';
styles: []
})
export class UserComponent implements OnInit {
@Output() done = new EventEmitter<any>();
title = '新增用户';
isVisible = false;
......@@ -26,6 +27,10 @@ export class UserComponent implements OnInit {
}
ngOnInit() :void{
this.initForm();
}
initForm(){
this.validateForm = this.fb.group({
name:[null,[Validators.required,Validators.maxLength(10)]],
loginName:[null,[Validators.required,Validators.maxLength(10)]],
......@@ -61,8 +66,10 @@ export class UserComponent implements OnInit {
(res)=>{
if(res.errCode == 10000){
this.isVisible = false;
this.initForm();
this.done.emit();
}else{
this.message.info(res.errMsg);
this.message.error(res.errMsg);
}
}
)
......
......@@ -20,8 +20,8 @@
<div nz-row class="search-form">
<div nz-col nzSpan="16">
<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)="showSeparationModal()" nz-button nzType="default">三员分立</button>
<button (click)="showAddRoleModal()" nz-button nzType="default"><i class="anticon anticon-plus"></i>新增角色</button>
</div>
<div nz-col nzSpan="8" class="text-right">
<input nz-input placeholder="角色/权限模块/资源权限">
......@@ -63,5 +63,8 @@
<!--新增角色-->
<smart-role #smartRole (add)="getRole()"></smart-role>
<!--三员分立-->
<smart-separation #smartSeparation></smart-separation>
<!--选择人员-->
<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';
import {RoleComponent} from '../modal/role/role.component';
import {NzMessageService, NzModalService} from 'ng-zorro-antd';
import {SelectPersonComponent} from '../../modal/select-person/select-person.component';
import {SeparationComponent} from '../modal/separation/separation.component';
@Component({
selector: 'jhi-power',
......@@ -12,6 +13,7 @@ import {SelectPersonComponent} from '../../modal/select-person/select-person.com
export class PowerComponent implements OnInit {
@ViewChild('smartRole') smartRole: RoleComponent;
@ViewChild('smartSelectPerson') smartSelectPerson:SelectPersonComponent;
@ViewChild('smartSeparation') smartSeparation:SeparationComponent;
dataSet: any[];
isVisible = false;
......@@ -52,17 +54,15 @@ export class PowerComponent implements OnInit {
//但一角色批量添加用户
batchAdduserToRole(e){
console.log(e);
let str ="";
e.forEach(res=>{
str += res.id +",";
});
str = str.substring(0,str.length-1);
const data = {
roleId:this.roleId,
users:str
}
this.systemSer.batchGrantUserToRole(data).subscribe(
let formData = new FormData();
formData.append("roleId",this.roleId);
formData.append("users",str);
this.systemSer.batchGrantUserToRole(formData).subscribe(
(res)=>{
if(res.errCode == 10000){
this.message.success("授予成功")
......@@ -98,6 +98,11 @@ export class PowerComponent implements OnInit {
}
//三员分立
showSeparationModal(){
this.smartSeparation.showModal("三员分立");
}
getCaptcha(e: MouseEvent): void {
e.preventDefault();
}
......
......@@ -79,4 +79,24 @@ export class SystemService {
batchGrantRoleToUser(data): Observable<any>{
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