Commit 15a41fab authored by wangqinghua's avatar wangqinghua

update

parent 8f89c614
...@@ -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_coms = '/coms'; export const SERVER_API_URL_COMS = '/coms';
export const SERVER_API_URL = '/zabbixBox'; export const SERVER_API_URL = '/zabbixBox';
export const BUILD_TIMESTAMP = process.env.BUILD_TIMESTAMP; export const BUILD_TIMESTAMP = process.env.BUILD_TIMESTAMP;
export const pageSize = 25; export const pageSize = 25;
......
<!--资源可用性统计--> <!--&lt;!&ndash;资源可用性统计&ndash;&gt;-->
<div nz-row class="breadcrumbs"> <!--<div nz-row class="breadcrumbs">-->
<div nz-col nzSpan="16"> <!--<div nz-col nzSpan="16">-->
<nz-breadcrumb class="padding-8-0"> <!--<nz-breadcrumb class="padding-8-0">-->
<nz-breadcrumb-item> <!--<nz-breadcrumb-item>-->
当前位置:首页 <!--当前位置:首页-->
</nz-breadcrumb-item> <!--</nz-breadcrumb-item>-->
</nz-breadcrumb> <!--</nz-breadcrumb>-->
</div> <!--</div>-->
<div nz-col nzSpan="8" class="text-right"> <!--<div nz-col nzSpan="8" class="text-right">-->
<button (click)="search()" nz-button nzType="primary"><i class="anticon anticon-search"></i></button> <!--<button (click)="search()" nz-button nzType="primary"><i class="anticon anticon-search"></i></button>-->
<button nz-button nzType="primary"><i class="anticon anticon-sync"></i></button> <!--<button nz-button nzType="primary"><i class="anticon anticon-sync"></i></button>-->
<button nz-button nzType="primary"><i class="anticon anticon-arrows-alt"></i></button> <!--<button nz-button nzType="primary"><i class="anticon anticon-arrows-alt"></i></button>-->
</div> <!--</div>-->
</div> <!--</div>-->
<div nz-row nzGutter="4"> <!--<div nz-row nzGutter="4">-->
<div nz-col nzSpan="16"> <!--<div nz-col nzSpan="16">-->
<nz-spin [nzSpinning]="isTopLoading"> <!--<nz-spin [nzSpinning]="isTopLoading">-->
<div echarts [options]="chartTopOption" style="height: 400px;width: 100%"></div> <!--<div echarts [options]="chartTopOption" style="height: 400px;width: 100%"></div>-->
</nz-spin> <!--</nz-spin>-->
</div> <!--</div>-->
<div nz-col nzSpan="12"> <!--<div nz-col nzSpan="12">-->
<nz-spin [nzSpinning]="isLastLoading"> <!--<nz-spin [nzSpinning]="isLastLoading">-->
<div echarts [options]="chartLastOption" style="height: 400px;width: 100%"></div> <!--<div echarts [options]="chartLastOption" style="height: 400px;width: 100%"></div>-->
</nz-spin> <!--</nz-spin>-->
</div> <!--</div>-->
</div> <!--</div>-->
import { HttpClient } from "@angular/common/http"; import { HttpClient } from "@angular/common/http";
import {Observable} from "rxjs/Rx"; import {Observable} from "rxjs/Rx";
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import {SERVER_API_URL, SERVER_API_URL_coms} from '../app.constants'; import {SERVER_API_URL, SERVER_API_URL_COMS} from '../app.constants';
@Injectable() @Injectable()
export class LayoutService { export class LayoutService {
...@@ -10,11 +10,11 @@ export class LayoutService { ...@@ -10,11 +10,11 @@ export class LayoutService {
} }
getMenu(): Observable<any>{ getMenu(): Observable<any>{
return this.http.get(SERVER_API_URL_coms + '/resources/getMenu'); return this.http.get(SERVER_API_URL_COMS + '/resources/getMenu');
} }
getAllMenu(): Observable<any>{ getAllMenu(): Observable<any>{
return this.http.get(SERVER_API_URL_coms + "/resources/getAll"); return this.http.get(SERVER_API_URL_COMS + "/resources/getAll");
} }
} }
<!--添加资源--> <!--添加资源-->
<nz-modal [nzWidth]="1080" [(nzVisible)]="isVisible" [nzTitle]="title" (nzOnCancel)="handleEditCancel()" (nzOnOk)="handEditleOk()"> <nz-modal [nzWidth]="1080" [(nzVisible)]="isVisible" [nzTitle]="title" (nzOnCancel)="handleEditCancel()"
(nzOnOk)="handEditleOk()">
<div nz-form class="ant-advanced-search-form form-select"> <div nz-form class="ant-advanced-search-form form-select">
<div nz-row [nzGutter]="24"> <div nz-row [nzGutter]="24">
<div nz-col [nzSpan]="8"> <div nz-col [nzSpan]="8">
...@@ -13,26 +14,28 @@ ...@@ -13,26 +14,28 @@
(nzPageSizeChange)="refreshStatus()"> (nzPageSizeChange)="refreshStatus()">
<thead> <thead>
<tr> <tr>
<th nzShowCheckbox [(nzChecked)]="allChecked" [nzIndeterminate]="indeterminate" (nzCheckedChange)="checkAll($event)"></th> <th nzShowCheckbox [(nzChecked)]="allChecked" [nzIndeterminate]="indeterminate"
(nzCheckedChange)="checkAll($event)"></th>
<th>姓名</th> <th>姓名</th>
<th>手机号码</th> <th>手机号码</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<tr *ngFor="let data of basicTable.data"> <tr *ngFor="let data of basicTable.data">
<td nzShowCheckbox [(nzChecked)]="data.checked" (nzCheckedChange)="selectItem(data,$event)"></td> <td nzShowCheckbox [(nzChecked)]="data.checked"
(nzCheckedChange)="selectItem(data,$event)"></td>
<td>{{data.name}}</td> <td>{{data.name}}</td>
<td>{{data.mobile}}</td> <td>{{data.phoneNumber}}</td>
</tr> </tr>
</tbody> </tbody>
</nz-table> </nz-table>
</div> </div>
<div nz-col [nzSpan]="8"> <div nz-col [nzSpan]="8">
<p>已选中用户 <span >清空</span></p> <p>已选中用户 <span>清空</span></p>
<p (click)="handle" *ngFor="let item of selectList;let i = index;"> <p (click)="handle" *ngFor="let item of selectList;let i = index;">
<span>{{item.name}}</span> <span>{{item.name}}</span>
<span>{{item.mobile}}</span> <span>{{item.phoneNumber}}</span>
<span (click)="deleteSelect(i)">X</span> <span (click)="deleteSelect(i)">X</span>
</p> </p>
</div> </div>
......
...@@ -21,6 +21,7 @@ export class SelectPersonComponent implements OnInit { ...@@ -21,6 +21,7 @@ export class SelectPersonComponent implements OnInit {
checkedNumber = 0; checkedNumber = 0;
disabledButton = true; disabledButton = true;
indeterminate = false; indeterminate = false;
roleId;
displayData: Array<{ key1: string; key2: number; key3: string; key4: string; checked: boolean }> = []; displayData: Array<{ key1: string; key2: number; key3: string; key4: string; checked: boolean }> = [];
constructor(private systemSer: SystemService, private commonSer: CommonService) { constructor(private systemSer: SystemService, private commonSer: CommonService) {
...@@ -73,18 +74,25 @@ export class SelectPersonComponent implements OnInit { ...@@ -73,18 +74,25 @@ export class SelectPersonComponent implements OnInit {
this.indeterminate = false; this.indeterminate = false;
} }
showModal(title) { showModal(title,roleId) {
this.getUser();
this.getGroup(); this.getGroup();
this.isVisible = true; this.isVisible = true;
this.title = title; this.title = title;
this.roleId = roleId;
if(this.title == "授予用户"){
}else{
this.getUser();
}
} }
getUser() { getUser() {
const data = { const data = {
'name': '', 'userBo': {
'orgId': '', search:null,
'pageNumber': '1', organizationId:null
},
'pageNum': '1',
'pageSize': '10' 'pageSize': '10'
}; };
this.systemSer.user(data).subscribe( this.systemSer.user(data).subscribe(
...@@ -99,6 +107,9 @@ export class SelectPersonComponent implements OnInit { ...@@ -99,6 +107,9 @@ export class SelectPersonComponent implements OnInit {
this.systemSer.organization().subscribe( this.systemSer.organization().subscribe(
(res) => { (res) => {
this.groupList = res.data; this.groupList = res.data;
if(this.title == "授予用户"){
this.getUserByOrgIdAboutRole(this.groupList[0].id);
}
this.groupList.forEach( this.groupList.forEach(
res => { res => {
res.title = res.name; res.title = res.name;
...@@ -110,6 +121,19 @@ export class SelectPersonComponent implements OnInit { ...@@ -110,6 +121,19 @@ export class SelectPersonComponent implements OnInit {
); );
} }
//授予用户
getUserByOrgIdAboutRole(orgId){
const data = {
orgId:orgId,
roleId:this.roleId
}
this.systemSer.getUserByOrgIdAboutRole(data).subscribe(
(res)=>{
this.userList = res.data;
}
)
}
nodeTree() { nodeTree() {
const tree = this.commonSer.listToTree('id', 'parentId', this.groupList,); const tree = this.commonSer.listToTree('id', 'parentId', this.groupList,);
const list = tree.map(res => { const list = tree.map(res => {
...@@ -124,6 +148,9 @@ export class SelectPersonComponent implements OnInit { ...@@ -124,6 +148,9 @@ export class SelectPersonComponent implements OnInit {
} }
handEditleOk(){ handEditleOk(){
if(this.title == "授予用户"){
}
this.done.emit(this.selectList); this.done.emit(this.selectList);
this.isVisible = false; this.isVisible = false;
this.init(); this.init();
......
...@@ -17,6 +17,8 @@ export class SelectRoleComponent implements OnInit { ...@@ -17,6 +17,8 @@ export class SelectRoleComponent implements OnInit {
checkedNumber = 0; checkedNumber = 0;
disabledButton = true; disabledButton = true;
indeterminate = false; indeterminate = false;
userId;
userRoleList = [];
displayData: Array<{ key1: string; key2: number; key3: string; key4: string; checked: boolean }> = []; displayData: Array<{ key1: string; key2: number; key3: string; key4: string; checked: boolean }> = [];
constructor(private systemSer: SystemService) { constructor(private systemSer: SystemService) {
} }
...@@ -55,16 +57,30 @@ export class SelectRoleComponent implements OnInit { ...@@ -55,16 +57,30 @@ export class SelectRoleComponent implements OnInit {
ngOnInit() { ngOnInit() {
} }
showModal(title) { showModal(title,id) {
this.title = title; this.title = title;
this.isVisible = true; this.isVisible = true;
this.userId = id;
const data = {
userId:this.userId
}
this.systemSer.getRoleByUserId(data).subscribe(
(res)=>{
this.userRoleList = res.data;
this.getRole(); this.getRole();
} }
)
}
getRole() { getRole() {
this.systemSer.role().subscribe( this.systemSer.role().subscribe(
(res) => { (res) => {
this.dataSet = res.data; this.dataSet = res.data;
this.dataSet.forEach(e=>{
if(this.userRoleList.indexOf(e.id) > -1){
e.checked = true;
}
})
} }
); );
} }
...@@ -74,7 +90,6 @@ export class SelectRoleComponent implements OnInit { ...@@ -74,7 +90,6 @@ export class SelectRoleComponent implements OnInit {
} }
handEditleOk(){ handEditleOk(){
console.log(this.selectList);
this.done.emit(this.selectList); this.done.emit(this.selectList);
this.isVisible = false; this.isVisible = false;
} }
......
...@@ -355,8 +355,8 @@ export class BasicComponent implements OnInit { ...@@ -355,8 +355,8 @@ export class BasicComponent implements OnInit {
nzOkText: '确定', nzOkText: '确定',
nzOkType: 'danger', nzOkType: 'danger',
nzOnOk: () => { nzOnOk: () => {
const data = {params: []}; const data = {groupid: []};
data.params.push(item.groupid); data.groupid.push(item.groupid);
this.overAllSer.deleteGroup(data).subscribe( this.overAllSer.deleteGroup(data).subscribe(
(res) => { (res) => {
if (res.errCode == 10000) { if (res.errCode == 10000) {
......
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { HttpClient, HttpResponse } from '@angular/common/http'; import { HttpClient, HttpResponse } from '@angular/common/http';
import { Observable } from 'rxjs/Observable'; import { Observable } from 'rxjs/Observable';
import {SERVER_API_URL, SERVER_API_URL_coms} from '../../app.constants'; import {SERVER_API_URL, SERVER_API_URL_COMS} from '../../app.constants';
@Injectable() @Injectable()
export class AccountService { export class AccountService {
constructor(private http: HttpClient) { } constructor(private http: HttpClient) { }
get(): Observable<any>{ get(): Observable<any>{
return this.http.post(SERVER_API_URL_coms+ '/login', {observe : 'response'}); return this.http.post(SERVER_API_URL_COMS+ '/login', {observe : 'response'});
} }
save(account: any): Observable<HttpResponse<any>> { save(account: any): Observable<HttpResponse<any>> {
return this.http.post(SERVER_API_URL_coms + '', account, {observe: 'response'}); return this.http.post(SERVER_API_URL_COMS + '', account, {observe: 'response'});
} }
} }
...@@ -3,7 +3,7 @@ import { HttpClient } from '@angular/common/http'; ...@@ -3,7 +3,7 @@ import { HttpClient } from '@angular/common/http';
import { Router } from "@angular/router"; import { Router } from "@angular/router";
import { Observable } from 'rxjs/Observable'; import { Observable } from 'rxjs/Observable';
import { LocalStorageService, SessionStorageService } from 'ngx-webstorage'; import { LocalStorageService, SessionStorageService } from 'ngx-webstorage';
import {SERVER_API_URL, SERVER_API_URL_coms} from '../../app.constants'; import {SERVER_API_URL, SERVER_API_URL_COMS} from '../../app.constants';
import { EmitService } from "../../shared/event/eventEmitter"; import { EmitService } from "../../shared/event/eventEmitter";
@Injectable() @Injectable()
export class AuthServerProvider { export class AuthServerProvider {
...@@ -26,7 +26,7 @@ export class AuthServerProvider { ...@@ -26,7 +26,7 @@ export class AuthServerProvider {
password: credentials.password, password: credentials.password,
rememberMe: credentials.rememberMe rememberMe: credentials.rememberMe
}; };
return this.http.post(SERVER_API_URL_coms + '/login', data, {observe : 'response'}).map(authenticateSuccess.bind(this)); return this.http.post(SERVER_API_URL_COMS + '/login', data, {observe : 'response'}).map(authenticateSuccess.bind(this));
function authenticateSuccess(resp) { function authenticateSuccess(resp) {
const bearerToken = resp.body.data; const bearerToken = resp.body.data;
if (bearerToken ) { if (bearerToken ) {
......
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,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)="selectJ()" nz-button nzType="default"><i class="anticon anticon-search"></i>选择角色</button> <button nz-button nzType="default"><i class="anticon anticon-search"></i>选择角色</button>
<button (click)="showModal()" nz-button nzType="default"><i class="anticon anticon-search"></i>选择部门</button> <button (click)="showModal()" 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">
......
...@@ -111,10 +111,6 @@ export class GroupComponent implements OnInit { ...@@ -111,10 +111,6 @@ export class GroupComponent implements OnInit {
this.isVisible = false; this.isVisible = false;
} }
selectJ() {
this.power.hello();
}
//新增用户 //新增用户
showUserModal() { showUserModal() {
this.smartUser.showAddModal(this.groupList,"新增用户"); this.smartUser.showAddModal(this.groupList,"新增用户");
...@@ -183,32 +179,30 @@ export class GroupComponent implements OnInit { ...@@ -183,32 +179,30 @@ export class GroupComponent implements OnInit {
this.smartGroupModal.showModal(this.groupList); this.smartGroupModal.showModal(this.groupList);
} }
//编辑部门
editGroup(item){}
//删除部门
deleteGroup(item){}
//授予角色 //授予角色
grantRole(data){ grantRole(data){
this.userId = data.id; this.userId = data.user.id;
const res = { this.smartSelectRole.showModal("选择角色",this.userId);
userId:data.id
}
this.systemSer.roleList(res).subscribe(
(res)=>{
}
)
this.smartSelectRole.showModal("选择角色");
} }
//设置用户角色
setRole(event){ setRole(event){
let str =""; const data = {
event.forEach(res=>{ userId:this.userId,
str += res.id +","; roles:event.map(e=>{
}); return e.id;
str = str.substring(0,str.length-1); }),
let formdata = new FormData(); };
formdata.append("userId",this.userId); this.systemSer.batchAuthRoleToUser(data).subscribe(
formdata.append("roles",str);
this.systemSer.batchGrantRoleToUser(formdata).subscribe(
(res)=>{ (res)=>{
if(res.errCode == 10000){ if(res.errCode == 10000){
this.getUser();
this.message.success("授予角色成功"); this.message.success("授予角色成功");
}else{ }else{
this.message.error(res.errMsg); this.message.error(res.errMsg);
......
...@@ -59,7 +59,6 @@ ...@@ -59,7 +59,6 @@
</tr> </tr>
</tbody> </tbody>
</nz-table> </nz-table>
<!--新增角色--> <!--新增角色-->
<smart-role #smartRole (add)="getRole()"></smart-role> <smart-role #smartRole (add)="getRole()"></smart-role>
......
...@@ -53,20 +53,19 @@ export class PowerComponent implements OnInit { ...@@ -53,20 +53,19 @@ export class PowerComponent implements OnInit {
//授予用户 //授予用户
grantUser(data){ grantUser(data){
this.roleId = data.id; this.roleId = data.id;
this.smartSelectPerson.showModal("授予用户"); this.smartSelectPerson.showModal("授予用户",this.roleId);
} }
//但一角色批量添加用户 //但一角色批量添加用户
batchAdduserToRole(e){ batchAdduserToRole(e){
let str =""; const data = {
e.forEach(res=>{ roleId:this.roleId,
str += res.id +","; addUsers:e.map(e=>{
}); return e.id;
str = str.substring(0,str.length-1); }),
let formData = new FormData(); deleteUsers:[]
formData.append("roleId",this.roleId); }
formData.append("users",str); this.systemSer.batchAuthRoleToUser(data).subscribe(
this.systemSer.batchGrantUserToRole(formData).subscribe(
(res)=>{ (res)=>{
if(res.errCode == 10000){ if(res.errCode == 10000){
this.message.success("授予成功") this.message.success("授予成功")
......
...@@ -143,12 +143,12 @@ export class PlanModalComponent implements OnInit { ...@@ -143,12 +143,12 @@ export class PlanModalComponent implements OnInit {
selectPerson1() { selectPerson1() {
this.modalTitle = '选择参与人'; this.modalTitle = '选择参与人';
this.smartSelectPerson.showModal(this.modalTitle); this.smartSelectPerson.showModal(this.modalTitle,null);
} }
selectPerson2() { selectPerson2() {
this.modalTitle = '选择负责人'; this.modalTitle = '选择负责人';
this.smartSelectPerson.showModal(this.modalTitle); this.smartSelectPerson.showModal(this.modalTitle,null);
} }
getUser(e) { getUser(e) {
......
...@@ -30,7 +30,7 @@ export class TransforComponent implements OnInit { ...@@ -30,7 +30,7 @@ export class TransforComponent implements OnInit {
//选择处理人弹窗 //选择处理人弹窗
selectPerson(){ selectPerson(){
this.smartSelectPerson.showModal("选择转派人"); this.smartSelectPerson.showModal("选择转派人",null);
} }
//选择转派人done //选择转派人done
......
...@@ -142,7 +142,7 @@ export class EventComponent implements OnInit { ...@@ -142,7 +142,7 @@ export class EventComponent implements OnInit {
//选择处理人 //选择处理人
selectPerson(){ selectPerson(){
this.smartSelectPerson.showModal("选择处理人"); this.smartSelectPerson.showModal("选择处理人",null);
} }
deletePerson(i){ deletePerson(i){
......
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
</div> </div>
<div nz-col nzSpan="3"> <div nz-col nzSpan="3">
<nz-select style="width: 100%;" [(ngModel)]="obj.type" nzPlaceHolder="事件分类"> <nz-select style="width: 100%;" [(ngModel)]="obj.type" nzPlaceHolder="事件分类">
<nz-option nzLabel="全部" nzValue="all"></nz-option>
<ng-container *ngFor="let item of eventTypeList"> <ng-container *ngFor="let item of eventTypeList">
<nz-option [nzLabel]="item.name" [nzValue]="item.id"></nz-option> <nz-option [nzLabel]="item.name" [nzValue]="item.id"></nz-option>
</ng-container> </ng-container>
......
...@@ -33,7 +33,7 @@ export class WorkHandleComponent implements OnInit { ...@@ -33,7 +33,7 @@ export class WorkHandleComponent implements OnInit {
pageCount: null, pageCount: null,
pageNum: null, pageNum: null,
searchStr: '', searchStr: '',
type: null, type: 'all',
status: null, status: null,
source: null, source: null,
startTime: '', startTime: '',
......
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