Commit f998bbbe authored by wangqinghua's avatar wangqinghua

update

parent 71308a89
...@@ -117,7 +117,7 @@ export class AlarmSetComponent implements OnInit { ...@@ -117,7 +117,7 @@ export class AlarmSetComponent implements OnInit {
changeStatus(title, status, item) { changeStatus(title, status, item) {
this.modalService.confirm({ this.modalService.confirm({
nzTitle: title, nzTitle: title,
nzContent: '<b style="color: red;">确定要' + title + '当前告警吗</b>', nzContent: '<b style="color: red;">确定要' + title + '当前告警吗</b>',
nzOkText: '确定', nzOkText: '确定',
nzOkType: 'danger', nzOkType: 'danger',
nzOnOk: () => { nzOnOk: () => {
......
...@@ -116,6 +116,7 @@ export class MediaTypeComponent implements OnInit { ...@@ -116,6 +116,7 @@ export class MediaTypeComponent implements OnInit {
handleCancel() { handleCancel() {
this.isVisible = false; this.isVisible = false;
this.initForm();
} }
handleOk() { handleOk() {
......
...@@ -5,9 +5,9 @@ ...@@ -5,9 +5,9 @@
<span style="color: #666666" (click)="transition()">快捷添加 +</span> <span style="color: #666666" (click)="transition()">快捷添加 +</span>
<span #parent class="span-hov"> <span #parent class="span-hov">
<span #children class="addBtn"> <span #children class="addBtn">
<span>添加设备分组</span> <span (click)="showGroupModal()">添加设备分组</span>
<span>添加资源</span> <span (click)="showBasicEditModal(item)">添加资源</span>
<span>添加业务</span> <!--<span>添加业务</span>-->
</span> </span>
</span> </span>
</div> </div>
...@@ -27,3 +27,7 @@ ...@@ -27,3 +27,7 @@
<!--三员分立--> <!--三员分立-->
<smart-separation #smartSeparation></smart-separation> <smart-separation #smartSeparation></smart-separation>
<!-- 添加资源-->
<smart-basic-edit #basicEdit (done)="handleOk($event)"></smart-basic-edit>
<!--添加分组-->
<smart-create-group #smartCreateGroup (add)="handleOk($event)"></smart-create-group>
\ No newline at end of file
...@@ -8,6 +8,8 @@ import { Principal, LoginService } from '../../shared'; ...@@ -8,6 +8,8 @@ import { Principal, LoginService } from '../../shared';
import { VERSION } from '../../app.constants'; import { VERSION } from '../../app.constants';
import {LocalStorageService} from 'ngx-webstorage'; import {LocalStorageService} from 'ngx-webstorage';
import {SeparationComponent} from '../../system/modal/separation/separation.component'; import {SeparationComponent} from '../../system/modal/separation/separation.component';
import {BasicEditComponent} from '../../modal/basic-edit/basic-edit.component';
import {CreateGroupComponent} from '../../modal/create-group/create-group.component';
@Component({ @Component({
selector: 'jhi-navbar', selector: 'jhi-navbar',
...@@ -20,6 +22,9 @@ export class NavbarComponent implements OnInit ,AfterViewChecked{ ...@@ -20,6 +22,9 @@ export class NavbarComponent implements OnInit ,AfterViewChecked{
@ViewChild('parent') parent:ElementRef; @ViewChild('parent') parent:ElementRef;
@ViewChild('children') children:ElementRef; @ViewChild('children') children:ElementRef;
@ViewChild("smartSeparation") smartSeparation:SeparationComponent; @ViewChild("smartSeparation") smartSeparation:SeparationComponent;
@ViewChild('basicEdit') basicEdit:BasicEditComponent;
@ViewChild('smartCreateGroup') smartCreateGroup:CreateGroupComponent;
inProduction: boolean; inProduction: boolean;
isNavbarCollapsed: boolean; isNavbarCollapsed: boolean;
languages: any[]; languages: any[];
...@@ -89,4 +94,14 @@ export class NavbarComponent implements OnInit ,AfterViewChecked{ ...@@ -89,4 +94,14 @@ export class NavbarComponent implements OnInit ,AfterViewChecked{
showSeparationModal(){ showSeparationModal(){
this.smartSeparation.showModal("三员分立"); this.smartSeparation.showModal("三员分立");
} }
//添加资源 ,name-分组名称,id-分组id
showBasicEditModal() {
this.basicEdit.showModal();
}
//添加分组
showGroupModal() {
this.smartCreateGroup.showModal('添加分组');
}
} }
...@@ -78,10 +78,9 @@ export class BasicEditComponent implements OnInit { ...@@ -78,10 +78,9 @@ export class BasicEditComponent implements OnInit {
} }
//新增 //新增
showModal(hostId, name, gId): void { showModal(): void {
this.isBasicEdit = true; this.isBasicEdit = true;
this.modalTitle = '添加资源'; this.modalTitle = '添加资源';
this.hostId = hostId;
this.getGroup(); this.getGroup();
this.getParentType(); this.getParentType();
} }
......
...@@ -63,6 +63,7 @@ export class PauseComponent implements OnInit { ...@@ -63,6 +63,7 @@ export class PauseComponent implements OnInit {
if(res.errCode == 10000){ if(res.errCode == 10000){
this.isShow = false; this.isShow = false;
this.initForm(); this.initForm();
this.done.emit();
this.message.success("临时暂停成功"); this.message.success("临时暂停成功");
}else{ }else{
this.message.error(res.errMsg); this.message.error(res.errMsg);
...@@ -81,7 +82,6 @@ export class PauseComponent implements OnInit { ...@@ -81,7 +82,6 @@ export class PauseComponent implements OnInit {
(res) => { (res) => {
if(res.errCode == 10000){ if(res.errCode == 10000){
this.isShow = false; this.isShow = false;
this.done.emit()
this.done.emit(); this.done.emit();
} }
this.message.info(res.errMsg); this.message.info(res.errMsg);
......
...@@ -20,10 +20,10 @@ ...@@ -20,10 +20,10 @@
</div> </div>
<div nz-row class="search-form"> <div nz-row class="search-form">
<div nz-col nzSpan="12"> <div nz-col nzSpan="12">
<nz-select style="width: 200px;" nzShowSearch nzAllowClear nzPlaceHolder="选择类型" (ngModelChange)="getList()"> <nz-select style="width: 200px;" nzPlaceHolder="选择类型" (ngModelChange)="getList()">
<!--<ng-container *ngFor="let item of groupList;let i = index;">--> <ng-container *ngFor="let item of groupList;let i = index;">
<!--<nz-option nzLabel="选择类型"></nz-option>--> <nz-option nzLabel="选择类型"></nz-option>
<!--</ng-container>--> </ng-container>
</nz-select> </nz-select>
</div> </div>
<div nz-col nzSpan="12" class="text-right"> <div nz-col nzSpan="12" class="text-right">
......
...@@ -71,7 +71,7 @@ export class TopologyImgComponent implements OnInit { ...@@ -71,7 +71,7 @@ export class TopologyImgComponent implements OnInit {
//设为默认 //设为默认
setDefault(item){ setDefault(item){
this.modalSer.confirm({ this.modalSer.confirm({
nzTitle: '删除', nzTitle: '默认',
nzContent: '<b style="color: red;">确认将该图标设为默认图标吗?</b>', nzContent: '<b style="color: red;">确认将该图标设为默认图标吗?</b>',
nzOkText: '确定', nzOkText: '确定',
nzOkType: 'danger', nzOkType: 'danger',
......
...@@ -105,7 +105,7 @@ ...@@ -105,7 +105,7 @@
</td> </td>
</ng-container> </ng-container>
<td class="round-tag tag-form"> <td class="round-tag tag-form default">
<ng-container *ngIf="item.status == 1"> <ng-container *ngIf="item.status == 1">
<nz-tag [nzColor]="color.gray"></nz-tag> <nz-tag [nzColor]="color.gray"></nz-tag>
</ng-container> </ng-container>
...@@ -123,7 +123,7 @@ ...@@ -123,7 +123,7 @@
<!--<nz-tag *ngIf="item.status == 0" [nzColor]="color.green"></nz-tag>--> <!--<nz-tag *ngIf="item.status == 0" [nzColor]="color.green"></nz-tag>-->
<!--<nz-tag *ngIf="item.status == 1" [nzColor]="color.gray"></nz-tag>--> <!--<nz-tag *ngIf="item.status == 1" [nzColor]="color.gray"></nz-tag>-->
<!--</td>--> <!--</td>-->
<td> <td class="default">
<ng-container *ngIf="item.level"> <ng-container *ngIf="item.level">
<ng-container *ngIf="item.available == 0"> <ng-container *ngIf="item.available == 0">
<nz-tag>AGENT</nz-tag> <nz-tag>AGENT</nz-tag>
...@@ -169,7 +169,7 @@ ...@@ -169,7 +169,7 @@
<td class="handle"> <td class="handle">
<ng-container *ngIf="!item.level"> <ng-container *ngIf="!item.level">
<span (click)="showBasicEditModal(item)">添加资源</span> <span (click)="showBasicEditModal()">添加资源</span>
</ng-container> </ng-container>
<ng-container *ngIf="item.level"> <ng-container *ngIf="item.level">
<span (click)="showBasicCheckModal(item.hostid,item.host)">添加监测点</span> <span (click)="showBasicCheckModal(item.hostid,item.host)">添加监测点</span>
...@@ -226,11 +226,9 @@ ...@@ -226,11 +226,9 @@
</td> </td>
<td>{{item?.inventory?.name}}</td> <td>{{item?.inventory?.name}}</td>
<!--<td class="round-tag tag-form">-->
<!--<nz-tag *ngIf="item.status == 0" [nzColor]="color.green"></nz-tag>--> <!--<nz-tag *ngIf="item.status == 0" [nzColor]="color.green"></nz-tag>-->
<!--<nz-tag *ngIf="item.status == 1" [nzColor]="color.gray"></nz-tag>--> <!--<nz-tag *ngIf="item.status == 1" [nzColor]="color.gray"></nz-tag>-->
<!--</td>--> <td class="default">
<td>
<ng-container *ngIf="item.level"> <ng-container *ngIf="item.level">
<ng-container *ngIf="item.available == 0"> <ng-container *ngIf="item.available == 0">
<nz-tag>AGENT</nz-tag> <nz-tag>AGENT</nz-tag>
...@@ -311,7 +309,7 @@ ...@@ -311,7 +309,7 @@
<td class="cursor"> <td class="cursor">
<span (click)="goDetail(item)">{{item.name}}</span> <span (click)="goDetail(item)">{{item.name}}</span>
</td> </td>
<td class="round-tag tag-form"> <td class="round-tag tag-form default">
<ng-container *ngIf="item.status == 1"> <ng-container *ngIf="item.status == 1">
<nz-tag [nzColor]="color.gray"></nz-tag> <nz-tag [nzColor]="color.gray"></nz-tag>
</ng-container> </ng-container>
...@@ -323,12 +321,8 @@ ...@@ -323,12 +321,8 @@
</td> </td>
<td>{{item?.inventory?.name}}</td> <td>{{item?.inventory?.name}}</td>
<!--<td class="round-tag tag-form">-->
<!--<nz-tag *ngIf="item.status == 0" [nzColor]="color.green"></nz-tag>-->
<!--<nz-tag *ngIf="item.status == 1" [nzColor]="color.gray"></nz-tag>-->
<!--</td>-->
<td> <td class="default">
<ng-container *ngIf="item.available == 0"> <ng-container *ngIf="item.available == 0">
<nz-tag>AGENT</nz-tag> <nz-tag>AGENT</nz-tag>
</ng-container> </ng-container>
......
...@@ -196,9 +196,9 @@ export class BasicComponent implements OnInit { ...@@ -196,9 +196,9 @@ export class BasicComponent implements OnInit {
) )
} }
//添加资源 ,name-分组名称,id-分组id //添加资源
showBasicEditModal(item) { showBasicEditModal() {
this.basicEdit.showModal(item.hostId, item.name, item.id); this.basicEdit.showModal();
} }
//编辑资源 name--分组名称,gId-当前分组的id //编辑资源 name--分组名称,gId-当前分组的id
......
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
</nz-form-control> </nz-form-control>
</nz-form-item> </nz-form-item>
<nz-form-item style="text-align: center;margin-top: -24px"> <nz-form-item style="text-align: center;margin-top: -24px">
<nz-spin [nzSpinning]="isSpinning" nzTip='登中...'></nz-spin> <nz-spin [nzSpinning]="isSpinning" nzTip='登中...'></nz-spin>
</nz-form-item> </nz-form-item>
</form> </form>
</div> </div>
......
...@@ -32,14 +32,12 @@ ...@@ -32,14 +32,12 @@
<div class="padding-15-0"> <div class="padding-15-0">
<button (click)="showGroupModal()" nz-button nzType="primary">新增组织</button> <button (click)="showGroupModal()" nz-button nzType="primary">新增组织</button>
</div> </div>
<nz-tree [(ngModel)]="nodes" <nz-tree [(ngModel)]="nodes">
(nzClick)="getOrg($event)"
>
<ng-template #nzTreeTemplate let-node> <ng-template #nzTreeTemplate let-node>
<span class="custom-node" draggable="true" aria-grabbed="true" [class.active]="node.isSelected"> <span class="custom-node" draggable="true" aria-grabbed="true" [class.active]="node.isSelected">
<span> <span>
{{node.title}} <span (click)="getOrg(node)">{{node.title}} </span>
<i (click)="editGroup(node)" style="margin:0 10px 0 20px;" class="anticon anticon-form"></i> <i (click)="showEditGroupModal(node)" style="margin:0 10px 0 20px;" class="anticon anticon-form"></i>
<i (click)="deleteGroup(node)" class="anticon anticon-close-circle-o"></i> <i (click)="deleteGroup(node)" class="anticon anticon-close-circle-o"></i>
</span> </span>
</span> </span>
......
...@@ -106,7 +106,7 @@ export class GroupComponent implements OnInit { ...@@ -106,7 +106,7 @@ export class GroupComponent implements OnInit {
getOrg(e) { getOrg(e) {
console.log(e); console.log(e);
this.organizationId = e.node.key; this.organizationId = e.key;
this.getUser(); this.getUser();
} }
...@@ -211,15 +211,28 @@ export class GroupComponent implements OnInit { ...@@ -211,15 +211,28 @@ export class GroupComponent implements OnInit {
//新增部门 //新增部门
showGroupModal() { showGroupModal() {
this.smartGroupModal.showModal(this.groupList); this.smartGroupModal.showAddModal(this.groupList,"新增部门");
} }
//编辑部门 //编辑部门
editGroup(item) { showEditGroupModal(item) {
this.smartGroupModal.showEditModal(this.groupList,"编辑部门",item.key);
} }
//删除部门 //删除部门
deleteGroup(item) { deleteGroup(item) {
this.commonSer.confirmThing("删除","确认删除该组织",()=>{
this.systemSer.deleteOrg(item.key).subscribe(
(res)=>{
if(res.errCode == 10000){
this.message.success("删除成功");
this.getGroup();
}else{
this.message.error(res.errMsg);
}
}
)
})
} }
//授予角色 //授予角色
......
import {Component, EventEmitter, OnInit, Output} from '@angular/core'; import {Component, EventEmitter, OnInit, Output} from '@angular/core';
import {FormBuilder, FormGroup, Validators} from '@angular/forms'; import {FormBuilder, FormControl, FormGroup, Validators} from '@angular/forms';
import {SystemService} from '../../system.service'; import {SystemService} from '../../system.service';
import {NzMessageService} from 'ng-zorro-antd'; import {NzMessageService} from 'ng-zorro-antd';
...@@ -11,10 +11,11 @@ import {NzMessageService} from 'ng-zorro-antd'; ...@@ -11,10 +11,11 @@ import {NzMessageService} from 'ng-zorro-antd';
export class GroupModalComponent implements OnInit { export class GroupModalComponent implements OnInit {
@Output() done = new EventEmitter<any>(); @Output() done = new EventEmitter<any>();
title = '新增部门'; title;
isVisible = false; isVisible = false;
validateForm:FormGroup; validateForm:FormGroup;
groupList:any[]; groupList:any[];
orgId;
constructor(private fb:FormBuilder,private message:NzMessageService, constructor(private fb:FormBuilder,private message:NzMessageService,
private systemSer:SystemService) { private systemSer:SystemService) {
...@@ -31,9 +32,17 @@ export class GroupModalComponent implements OnInit { ...@@ -31,9 +32,17 @@ export class GroupModalComponent implements OnInit {
}); });
} }
showModal(list){ showAddModal(list,title){
this.groupList = list; this.groupList = list;
this.isVisible = true; this.isVisible = true;
this.title = title;
}
showEditModal(list,title,id){
this.orgId = id;
this.groupList = list;
this.isVisible = true;
this.title = title;
} }
handleCancel(){ handleCancel(){
...@@ -45,6 +54,18 @@ export class GroupModalComponent implements OnInit { ...@@ -45,6 +54,18 @@ export class GroupModalComponent implements OnInit {
this.validateForm.controls[i].markAsDirty(); this.validateForm.controls[i].markAsDirty();
this.validateForm.controls[i].updateValueAndValidity(); this.validateForm.controls[i].updateValueAndValidity();
} }
if(this.validateForm.invalid){
return false;
}
if(this.title == "新增部门"){
this.create();
}
if(this.title == "编辑部门"){
this.update();
}
}
create(){
this.systemSer.createOrg(this.validateForm.value).subscribe( this.systemSer.createOrg(this.validateForm.value).subscribe(
(res)=>{ (res)=>{
if(res.errCode == 10000){ if(res.errCode == 10000){
...@@ -59,4 +80,20 @@ export class GroupModalComponent implements OnInit { ...@@ -59,4 +80,20 @@ export class GroupModalComponent implements OnInit {
) )
} }
update(){
this.validateForm.addControl("id",new FormControl(this.orgId));
this.systemSer.updateOrganization(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);
}
}
)
}
} }
...@@ -80,9 +80,14 @@ export class SystemService { ...@@ -80,9 +80,14 @@ export class SystemService {
return this.http.get(SERVER_API_URL_COMS + '/organization/getAll',); return this.http.get(SERVER_API_URL_COMS + '/organization/getAll',);
} }
//删除单个组织机构
deleteOrg(params): Observable<any>{
return this.http.delete(SERVER_API_URL_COMS + '/organization/' + params);
}
//编辑组织 //编辑组织
updateOrganization(): Observable<any>{ updateOrganization(data): Observable<any>{
return this.http.get(SERVER_API_URL_COMS + '/organization/updateOrganization',); return this.http.post(SERVER_API_URL_COMS + '/organization/updateOrganization',data);
} }
//创建组织结构 //创建组织结构
......
...@@ -79,6 +79,10 @@ ...@@ -79,6 +79,10 @@
} }
.round-tag .ant-tag{ .round-tag .ant-tag{
border-radius: 50%; border-radius: 50%;
}
.default .ant-tag{
cursor: default;
} }
......
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