Commit f998bbbe authored by wangqinghua's avatar wangqinghua

update

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