Commit f4fae93f authored by wangqinghua's avatar wangqinghua

update

parent 6e87ad81
......@@ -22,7 +22,6 @@
<nz-form-control [nzSpan]="14">
<input id="snmpCommunity" name="snmpCommunity" type="text" nz-input
formControlName="snmpCommunity">
<!--<nz-form-explain *ngIf="validateForm.get('note').dirty && validateForm.get('note').errors">Please input your username!</nz-form-explain>-->
</nz-form-control>
</nz-form-item>
<nz-form-item>
......
......@@ -88,32 +88,19 @@ export class BasiCheckComponent implements OnInit {
this.isCheck = true;
this.hostId = hostId;
this.hostName = hostName;
// this.getItemType();
}
//编辑
showEditModal(hostId, id, hostName,templateid,title) {
showEditModal(item,hostId, id, hostName,templateid,title) {
this.title = title;
this.hostId = hostId;
this.templateid = templateid;
this.isCheck = true;
this.itemId = id;
this.hostName = hostName;
this.overAllSer.findItemDetail(id).subscribe(
(res) => {
const data = res.data[0];
data.type += '';
data.valueType += '';
// if(data.applications){
// data.applications = data.applications.map(e=>{
// return e.applicationid;
// });
// }
this.validateForm.patchValue(data);
}
);
// this.getItemType();
item.type += '';
item.valueType += '';
this.validateForm.patchValue(item);
}
//获取监测点分类
......@@ -176,7 +163,7 @@ export class BasiCheckComponent implements OnInit {
this.validateForm.patchValue({
templateid:this.templateid
})
this.validateForm.addControl('itemid', new FormControl(this.itemId));
this.validateForm.addControl('id', new FormControl(this.itemId));
this.overAllSer.itemUpdata(this.validateForm.value).subscribe(
(res) => {
if (res.errCode == 10000) {
......@@ -187,9 +174,6 @@ export class BasiCheckComponent implements OnInit {
this.isCheck = false;
}
this.isOkLoading = false;
},
(err) => {
this.message.error('系统错误');
}
);
}
......
......@@ -405,26 +405,6 @@ export class BasicEditComponent implements OnInit {
}
}
//只能一个默认
changeMain(index) {
let d = [];
this.interfaceslist.map(e => {
if (e.type == this.interfaceslist[index].type) {
d.push(e);
}
});
if (d.length > 1) {
this.interfaceslist.forEach(res => {
if (res.type == this.interfaceslist[index].type) {
res.main = '0';
}
});
}
console.log(d);
this.interfaceslist[index].main = '1';
}
//新增宏
addMacro1() {
const data = {
......
......@@ -3,7 +3,7 @@
<nz-form-item nzFlex>
<nz-form-control [nzOffset]="4" [nzSpan]="14">
<nz-radio-group [(ngModel)]="conditionType">
<label nz-radio-button nzValue="commonly"><span>常规</span></label>
<!-- <label nz-radio-button nzValue="commonly"><span>常规</span></label>-->
<label nz-radio-button nzValue="high"><span>高级</span></label>
</nz-radio-group>
</nz-form-control>
......
......@@ -17,7 +17,7 @@ export class ThresholdComponent implements OnInit {
itemId; //监控项ID
hostName; //主机name
itemObj; //监控项对象
conditionType = 'commonly';
conditionType = 'high';
faultConditionList = []; //故障阈值
conditionList = []; //危险阈值
......@@ -78,14 +78,15 @@ export class ThresholdComponent implements OnInit {
}
//新增
showAddModal(title, itemId, hostName) {
showAddModal(item, title, itemId, hostName) {
this.title = title;
this.itemId = itemId;
this.isVisiable = true;
this.hostName = hostName;
this.itemObj = item;
this.overAllSer.findItemDetail(this.itemId).subscribe(
(res) => {
this.itemObj = res.data[0];
this.itemObj = res.data;
}
);
}
......@@ -98,54 +99,15 @@ export class ThresholdComponent implements OnInit {
this.hostName = hostName;
this.overAllSer.findItemDetail(this.itemId).subscribe(
(res) => {
this.itemObj = res.data[0];
this.itemObj = res.data;
this.itemObj.triggers.forEach((value) => {
let str = value.expression;
let equal = [];
let arr = [];
let con = '';
let a = str.split(' ');
a.forEach((e) => { // 符号数组
let index1 = e.indexOf('}');
if (e == 'and' || e == 'or') {
equal.push(e);
}
if (index1 > -1) {
let f = e.substring(index1 + 1, e.length);
con += '{' + this.hostName + ':' + this.itemObj.key_ + '.last()}' + f + ' ';
} else {
con += e + ' ';
}
});
let c = str.replace(/and/g, '').replace(/or/g, '').split(' ');
c.forEach((val, index) => {
let index1 = val.indexOf('}');
let d = val.substring(index1 + 1, val.length);
let data;
if (index > 0) {
data = {
and: ' ' + equal[index - 1] + ' ',
equal: d[0],
value: d.substring(1, d.length),
};
} else {
data = {
equal: d[0],
value: d.substring(1, d.length),
};
}
arr.push(data);
});
if (value.priority == 2 || value.priority == 3) { //危险
this.conditionList = arr;
this.triggerObj.condition = con;
this.triggerConditionId = value.triggerid;
this.triggerObj.condition = value.expression;
this.triggerConditionId = value.id;
}
if (value.priority == 4 || value.priority == 5) { //故障
this.faultConditionList = arr;
this.triggerObj.faultCondition = con;
this.triggerFaultConditionId = value.triggerid;
this.triggerObj.faultCondition = value.expression;
this.triggerFaultConditionId = value.id;
}
});
}
......@@ -163,19 +125,19 @@ export class ThresholdComponent implements OnInit {
if (!res.and) {
res.and = '';
}
data.condition += res.and + '{' + this.hostName + ':' + this.itemObj.key_ + '.last()}' + res.equal + '' + res.value;
data.condition += res.and + '{' + this.hostName + ':' + this.itemObj.key + '.last()}' + res.equal + '' + res.value;
});
this.faultConditionList.forEach(res => {
if (!res.and) {
res.and = '';
}
data.faultCondition += res.and + '{' + this.hostName + ':' + this.itemObj.key_ + '.last()}' + res.equal + '' + res.value;
data.faultCondition += res.and + '{' + this.hostName + ':' + this.itemObj.key + '.last()}' + res.equal + '' + res.value;
});
} else { //高级
data.condition = this.triggerObj.condition;
data.faultCondition = this.triggerObj.faultCondition;
}
if (!this.checkFun()) {
if (!this.checkFun() && !this.triggerObj.condition && !this.triggerObj.faultCondition) {
this.message.error('请输入阈值');
return false;
}
......@@ -183,13 +145,13 @@ export class ThresholdComponent implements OnInit {
this.isOkLoading = true;
if (this.title == '添加阈值') {
if (this.conditionList.length == 0 && this.faultConditionList.length == 0) {
this.isVisiable = false;
this.initForm();
return false;
}else{
this.createTrigger(data);
}
// if (this.conditionList.length == 0 && this.faultConditionList.length == 0) {
// this.isVisiable = false;
// this.initForm();
// return false;
// }else{
this.createTrigger(data);
// }
}
if (this.title == '编辑阈值') {
this.updateTrigger(data);
......@@ -220,7 +182,8 @@ export class ThresholdComponent implements OnInit {
const res = {
itemName: this.itemObj.name,
faultCondition: data.faultCondition,
condition: data.condition
condition: data.condition,
itemid: this.itemId
};
this.overAllSer.createTrigger(res).subscribe(
(response) => {
......@@ -239,27 +202,36 @@ export class ThresholdComponent implements OnInit {
//2.修改阈值
updateTrigger(data) {
const res = {
faultCondition: { //故障阈值
itemName: this.itemObj.name,
condition: data.faultCondition,
triggerid: this.triggerFaultConditionId
},
condition: { //危险阈值
itemName: this.itemObj.name,
condition: data.condition,
triggerid: this.triggerConditionId
}
const condition = {
id: this.triggerConditionId,
itemid: this.itemId,
expression: data.condition,
};
this.overAllSer.updateTrigger(res).subscribe(res => {
if (res.errCode == 10000) {
this.message.success('修改阈值成功');
this.initForm();
this.done.emit();
this.isVisiable = false;
}
this.isOkLoading = false;
});
const faultCondition = {
id: this.triggerFaultConditionId,
itemid: this.itemId,
expression: data.faultCondition,
};
if (this.triggerConditionId) {
this.overAllSer.updateTrigger(condition).subscribe(res => {
if (res.errCode == 10000) {
this.initForm();
this.done.emit();
this.isOkLoading = false;
this.isVisiable = false;
}
});
}
if (this.triggerFaultConditionId) {
this.overAllSer.updateTrigger(faultCondition).subscribe(res => {
if (res.errCode == 10000) {
this.initForm();
this.done.emit();
this.isVisiable = false;
}
this.isOkLoading = false;
});
}
}
//取消
......
......@@ -131,7 +131,8 @@
<label *ngFor="let item of itemTypeList" (click)="changeType(item)" nz-radio-button [nzValue]="item.applicationid">{{item.name}}</label>
</nz-radio-group>
</div>
<nz-table #checkTable [nzData]="checkList" [nzFrontPagination]="false" [nzTotal]="totalNum" [nzPageIndex]="pageIndex" [nzPageSize]="pageSize" (nzPageIndexChange)="change($event)" [nzLoading]="loading">
<nz-table #checkTable [nzData]="checkList" [nzFrontPagination]="false" [nzTotal]="totalNum" [nzPageIndex]="pageIndex"
[nzPageSize]="pageSize" (nzPageIndexChange)="change($event)" [nzLoading]="loading">
<thead>
<tr>
<th nzWidth="20%">监测点名称</th>
......@@ -172,8 +173,8 @@
<span (click)="showEditModal(data)">编辑监测点</span>
<span (click)="deleteCheckItem(data)">删除监测点</span>
<br>
<span (click)="showAddThresholdModal(data)">添加阈值</span>
<span (click)="showEditThresholdModal(data)">编辑阈值</span>
<span *ngIf="data?.triggers.length == 0" (click)="showAddThresholdModal(data)">添加阈值</span>
<span *ngIf="data?.triggers.length > 0" (click)="showEditThresholdModal(data)">编辑阈值</span>
</ng-container>
<span *ngIf="data.status == 0 && data.state==0" (click)="updateItem(data.itemid,1)" style="color: green">已启用</span>
<span *ngIf="data.status == 0 && data.state==1" (click)="updateItem(data.itemid,1)" style="color: red">不支持的</span>
......
......@@ -86,9 +86,6 @@
</button>
</div>
<div nz-col nzSpan="7" class="text-right button">
<button (click)="batchDeleteConfirm()" nz-button nzType="default">
<i class="anticon anticon-close-circle-o"></i>删除资源
</button>
</div>
</div>
<nz-table #nzTable [nzData]="dataSet" [nzLoading]="loading" [nzFrontPagination]="false" [nzShowPagination]="true"
......@@ -148,8 +145,7 @@
<span (click)="editBasicModal(item)">编辑</span>
<span (click)="showDeleteConfirm(item)">删除</span>
<span (click)="openHost(item)">
<ng-container *ngIf="item.status == 1">开启</ng-container>
<ng-container *ngIf="item.status == 0">停止</ng-container>监控
<ng-container *ngIf="item.status == 1">开启</ng-container><ng-container *ngIf="item.status == 0">停止</ng-container>监控
</span>
</td>
</tr>
......
......@@ -230,15 +230,17 @@ export class BasicComponent implements OnInit {
const data = {
pageNum: this.pageNum,
pageCount: this.pageCount,
name: this.searchName,
waringName: this.status,
equipmentTypeid: this.equipmentTypeid,
groupids: []
obj:{
name: this.searchName,
waringName: this.status,
equipmentTypeid: this.equipmentTypeid,
groupids: []
}
};
if (this.groupid) {
data.groupids.push(this.groupid);
data.obj.groupids.push(this.groupid);
} else {
data.groupids = [];
data.obj.groupids = [];
}
this.overAllSer.findHostPageNew(data).subscribe(
(res) => {
......
......@@ -167,7 +167,7 @@ export class OverAllService {
//查询监控项
findItemDetail(params): Observable<any> {
return this.http.get(SERVER_API_URL + '/item/details/' + params);
return this.http.get(SERVER_API_URL + '/item/find/' + params);
}
//监控项分类
......@@ -196,7 +196,7 @@ export class OverAllService {
}
itemUpdata(data): Observable<any> {
return this.http.put(SERVER_API_URL + '/item/updata/', data);
return this.http.put(SERVER_API_URL + '/item/update', data);
}
//临时暂停
......@@ -317,7 +317,7 @@ export class OverAllService {
//修改触发器
updateTrigger(data): Observable<any> {
return this.http.post(SERVER_API_URL + '/item/updateItemTrigger', data);
return this.http.post(SERVER_API_URL + '/trigger/update', data);
}
//查看映射值
......
......@@ -167,7 +167,6 @@ export class ItemListComponent implements OnInit {
//编辑监测点
showEditModal(item){
this.smartBasiCheck.showEditModal(this.hostId,item.itemid,this.tempName,item.templateid,'编辑模版监测点');
}
//删除监测点
......@@ -179,8 +178,7 @@ export class ItemListComponent implements OnInit {
nzOkType: 'danger',
nzOnOk: () => {
const data = {
itemids:[item.itemid],
templateid:item.templateid
itemids:[item.id],
};
this.overAllSer.deleteItem(data).subscribe(
(res) => {
......
......@@ -20,8 +20,8 @@
<div nz-row class="search-form">
<div nz-col nzSpan="16">
<button (click)="showSeparationModal()" nz-button nzType="default">三员分立</button>
<button (click)="showAddRoleModal()" nz-button nzType="default"><i class="anticon anticon-plus-circle-o"></i>新增角色
<!-- <button (click)="showSeparationModal()" nz-button nzType="default">三员分立</button>-->
<!-- <button (click)="showAddRoleModal()" nz-button nzType="default"><i class="anticon anticon-plus-circle-o"></i>新增角色-->
</button>
</div>
<div nz-col nzSpan="8" class="text-right">
......
......@@ -27,11 +27,11 @@ export class PowerComponent implements OnInit {
ngOnInit() {
this.getRole();
this.systemSer.userFind().subscribe(
(res)=>{
this.isAdmin = res.data.isAdmin;
}
)
// this.systemSer.userFind().subscribe(
// (res)=>{
// this.isAdmin = res.data.isAdmin;
// }
// )
}
getRole() {
......
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