Commit f4fae93f authored by wangqinghua's avatar wangqinghua

update

parent 6e87ad81
...@@ -22,7 +22,6 @@ ...@@ -22,7 +22,6 @@
<nz-form-control [nzSpan]="14"> <nz-form-control [nzSpan]="14">
<input id="snmpCommunity" name="snmpCommunity" type="text" nz-input <input id="snmpCommunity" name="snmpCommunity" type="text" nz-input
formControlName="snmpCommunity"> 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-control>
</nz-form-item> </nz-form-item>
<nz-form-item> <nz-form-item>
......
...@@ -88,32 +88,19 @@ export class BasiCheckComponent implements OnInit { ...@@ -88,32 +88,19 @@ export class BasiCheckComponent implements OnInit {
this.isCheck = true; this.isCheck = true;
this.hostId = hostId; this.hostId = hostId;
this.hostName = hostName; this.hostName = hostName;
// this.getItemType();
} }
//编辑 //编辑
showEditModal(hostId, id, hostName,templateid,title) { showEditModal(item,hostId, id, hostName,templateid,title) {
this.title = title; this.title = title;
this.hostId = hostId; this.hostId = hostId;
this.templateid = templateid; this.templateid = templateid;
this.isCheck = true; this.isCheck = true;
this.itemId = id; this.itemId = id;
this.hostName = hostName; this.hostName = hostName;
this.overAllSer.findItemDetail(id).subscribe( item.type += '';
(res) => { item.valueType += '';
const data = res.data[0]; this.validateForm.patchValue(item);
data.type += '';
data.valueType += '';
// if(data.applications){
// data.applications = data.applications.map(e=>{
// return e.applicationid;
// });
// }
this.validateForm.patchValue(data);
}
);
// this.getItemType();
} }
//获取监测点分类 //获取监测点分类
...@@ -176,7 +163,7 @@ export class BasiCheckComponent implements OnInit { ...@@ -176,7 +163,7 @@ export class BasiCheckComponent implements OnInit {
this.validateForm.patchValue({ this.validateForm.patchValue({
templateid:this.templateid 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( this.overAllSer.itemUpdata(this.validateForm.value).subscribe(
(res) => { (res) => {
if (res.errCode == 10000) { if (res.errCode == 10000) {
...@@ -187,9 +174,6 @@ export class BasiCheckComponent implements OnInit { ...@@ -187,9 +174,6 @@ export class BasiCheckComponent implements OnInit {
this.isCheck = false; this.isCheck = false;
} }
this.isOkLoading = false; this.isOkLoading = false;
},
(err) => {
this.message.error('系统错误');
} }
); );
} }
......
...@@ -405,26 +405,6 @@ export class BasicEditComponent implements OnInit { ...@@ -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() { addMacro1() {
const data = { const data = {
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
<nz-form-item nzFlex> <nz-form-item nzFlex>
<nz-form-control [nzOffset]="4" [nzSpan]="14"> <nz-form-control [nzOffset]="4" [nzSpan]="14">
<nz-radio-group [(ngModel)]="conditionType"> <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> <label nz-radio-button nzValue="high"><span>高级</span></label>
</nz-radio-group> </nz-radio-group>
</nz-form-control> </nz-form-control>
......
...@@ -17,7 +17,7 @@ export class ThresholdComponent implements OnInit { ...@@ -17,7 +17,7 @@ export class ThresholdComponent implements OnInit {
itemId; //监控项ID itemId; //监控项ID
hostName; //主机name hostName; //主机name
itemObj; //监控项对象 itemObj; //监控项对象
conditionType = 'commonly'; conditionType = 'high';
faultConditionList = []; //故障阈值 faultConditionList = []; //故障阈值
conditionList = []; //危险阈值 conditionList = []; //危险阈值
...@@ -78,14 +78,15 @@ export class ThresholdComponent implements OnInit { ...@@ -78,14 +78,15 @@ export class ThresholdComponent implements OnInit {
} }
//新增 //新增
showAddModal(title, itemId, hostName) { showAddModal(item, title, itemId, hostName) {
this.title = title; this.title = title;
this.itemId = itemId; this.itemId = itemId;
this.isVisiable = true; this.isVisiable = true;
this.hostName = hostName; this.hostName = hostName;
this.itemObj = item;
this.overAllSer.findItemDetail(this.itemId).subscribe( this.overAllSer.findItemDetail(this.itemId).subscribe(
(res) => { (res) => {
this.itemObj = res.data[0]; this.itemObj = res.data;
} }
); );
} }
...@@ -98,54 +99,15 @@ export class ThresholdComponent implements OnInit { ...@@ -98,54 +99,15 @@ export class ThresholdComponent implements OnInit {
this.hostName = hostName; this.hostName = hostName;
this.overAllSer.findItemDetail(this.itemId).subscribe( this.overAllSer.findItemDetail(this.itemId).subscribe(
(res) => { (res) => {
this.itemObj = res.data[0]; this.itemObj = res.data;
this.itemObj.triggers.forEach((value) => { 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) { //危险 if (value.priority == 2 || value.priority == 3) { //危险
this.conditionList = arr; this.triggerObj.condition = value.expression;
this.triggerObj.condition = con; this.triggerConditionId = value.id;
this.triggerConditionId = value.triggerid;
} }
if (value.priority == 4 || value.priority == 5) { //故障 if (value.priority == 4 || value.priority == 5) { //故障
this.faultConditionList = arr; this.triggerObj.faultCondition = value.expression;
this.triggerObj.faultCondition = con; this.triggerFaultConditionId = value.id;
this.triggerFaultConditionId = value.triggerid;
} }
}); });
} }
...@@ -163,19 +125,19 @@ export class ThresholdComponent implements OnInit { ...@@ -163,19 +125,19 @@ export class ThresholdComponent implements OnInit {
if (!res.and) { if (!res.and) {
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 => { this.faultConditionList.forEach(res => {
if (!res.and) { if (!res.and) {
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 { //高级 } else { //高级
data.condition = this.triggerObj.condition; data.condition = this.triggerObj.condition;
data.faultCondition = this.triggerObj.faultCondition; data.faultCondition = this.triggerObj.faultCondition;
} }
if (!this.checkFun()) { if (!this.checkFun() && !this.triggerObj.condition && !this.triggerObj.faultCondition) {
this.message.error('请输入阈值'); this.message.error('请输入阈值');
return false; return false;
} }
...@@ -183,13 +145,13 @@ export class ThresholdComponent implements OnInit { ...@@ -183,13 +145,13 @@ export class ThresholdComponent implements OnInit {
this.isOkLoading = true; this.isOkLoading = true;
if (this.title == '添加阈值') { if (this.title == '添加阈值') {
if (this.conditionList.length == 0 && this.faultConditionList.length == 0) { // if (this.conditionList.length == 0 && this.faultConditionList.length == 0) {
this.isVisiable = false; // this.isVisiable = false;
this.initForm(); // this.initForm();
return false; // return false;
}else{ // }else{
this.createTrigger(data); this.createTrigger(data);
} // }
} }
if (this.title == '编辑阈值') { if (this.title == '编辑阈值') {
this.updateTrigger(data); this.updateTrigger(data);
...@@ -220,7 +182,8 @@ export class ThresholdComponent implements OnInit { ...@@ -220,7 +182,8 @@ export class ThresholdComponent implements OnInit {
const res = { const res = {
itemName: this.itemObj.name, itemName: this.itemObj.name,
faultCondition: data.faultCondition, faultCondition: data.faultCondition,
condition: data.condition condition: data.condition,
itemid: this.itemId
}; };
this.overAllSer.createTrigger(res).subscribe( this.overAllSer.createTrigger(res).subscribe(
(response) => { (response) => {
...@@ -239,27 +202,36 @@ export class ThresholdComponent implements OnInit { ...@@ -239,27 +202,36 @@ export class ThresholdComponent implements OnInit {
//2.修改阈值 //2.修改阈值
updateTrigger(data) { updateTrigger(data) {
const res = { const condition = {
faultCondition: { //故障阈值 id: this.triggerConditionId,
itemName: this.itemObj.name, itemid: this.itemId,
condition: data.faultCondition, expression: data.condition,
triggerid: this.triggerFaultConditionId
},
condition: { //危险阈值
itemName: this.itemObj.name,
condition: data.condition,
triggerid: this.triggerConditionId
}
}; };
this.overAllSer.updateTrigger(res).subscribe(res => { const faultCondition = {
if (res.errCode == 10000) { id: this.triggerFaultConditionId,
this.message.success('修改阈值成功'); itemid: this.itemId,
this.initForm(); expression: data.faultCondition,
this.done.emit(); };
this.isVisiable = false; if (this.triggerConditionId) {
} this.overAllSer.updateTrigger(condition).subscribe(res => {
this.isOkLoading = false; 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 @@ ...@@ -131,7 +131,8 @@
<label *ngFor="let item of itemTypeList" (click)="changeType(item)" nz-radio-button [nzValue]="item.applicationid">{{item.name}}</label> <label *ngFor="let item of itemTypeList" (click)="changeType(item)" nz-radio-button [nzValue]="item.applicationid">{{item.name}}</label>
</nz-radio-group> </nz-radio-group>
</div> </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> <thead>
<tr> <tr>
<th nzWidth="20%">监测点名称</th> <th nzWidth="20%">监测点名称</th>
...@@ -172,8 +173,8 @@ ...@@ -172,8 +173,8 @@
<span (click)="showEditModal(data)">编辑监测点</span> <span (click)="showEditModal(data)">编辑监测点</span>
<span (click)="deleteCheckItem(data)">删除监测点</span> <span (click)="deleteCheckItem(data)">删除监测点</span>
<br> <br>
<span (click)="showAddThresholdModal(data)">添加阈值</span> <span *ngIf="data?.triggers.length == 0" (click)="showAddThresholdModal(data)">添加阈值</span>
<span (click)="showEditThresholdModal(data)">编辑阈值</span> <span *ngIf="data?.triggers.length > 0" (click)="showEditThresholdModal(data)">编辑阈值</span>
</ng-container> </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==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> <span *ngIf="data.status == 0 && data.state==1" (click)="updateItem(data.itemid,1)" style="color: red">不支持的</span>
......
...@@ -86,9 +86,6 @@ ...@@ -86,9 +86,6 @@
</button> </button>
</div> </div>
<div nz-col nzSpan="7" class="text-right button"> <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>
</div> </div>
<nz-table #nzTable [nzData]="dataSet" [nzLoading]="loading" [nzFrontPagination]="false" [nzShowPagination]="true" <nz-table #nzTable [nzData]="dataSet" [nzLoading]="loading" [nzFrontPagination]="false" [nzShowPagination]="true"
...@@ -148,8 +145,7 @@ ...@@ -148,8 +145,7 @@
<span (click)="editBasicModal(item)">编辑</span> <span (click)="editBasicModal(item)">编辑</span>
<span (click)="showDeleteConfirm(item)">删除</span> <span (click)="showDeleteConfirm(item)">删除</span>
<span (click)="openHost(item)"> <span (click)="openHost(item)">
<ng-container *ngIf="item.status == 1">开启</ng-container> <ng-container *ngIf="item.status == 1">开启</ng-container><ng-container *ngIf="item.status == 0">停止</ng-container>监控
<ng-container *ngIf="item.status == 0">停止</ng-container>监控
</span> </span>
</td> </td>
</tr> </tr>
......
...@@ -230,15 +230,17 @@ export class BasicComponent implements OnInit { ...@@ -230,15 +230,17 @@ export class BasicComponent implements OnInit {
const data = { const data = {
pageNum: this.pageNum, pageNum: this.pageNum,
pageCount: this.pageCount, pageCount: this.pageCount,
name: this.searchName, obj:{
waringName: this.status, name: this.searchName,
equipmentTypeid: this.equipmentTypeid, waringName: this.status,
groupids: [] equipmentTypeid: this.equipmentTypeid,
groupids: []
}
}; };
if (this.groupid) { if (this.groupid) {
data.groupids.push(this.groupid); data.obj.groupids.push(this.groupid);
} else { } else {
data.groupids = []; data.obj.groupids = [];
} }
this.overAllSer.findHostPageNew(data).subscribe( this.overAllSer.findHostPageNew(data).subscribe(
(res) => { (res) => {
......
...@@ -167,7 +167,7 @@ export class OverAllService { ...@@ -167,7 +167,7 @@ export class OverAllService {
//查询监控项 //查询监控项
findItemDetail(params): Observable<any> { 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 { ...@@ -196,7 +196,7 @@ export class OverAllService {
} }
itemUpdata(data): Observable<any> { 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 { ...@@ -317,7 +317,7 @@ export class OverAllService {
//修改触发器 //修改触发器
updateTrigger(data): Observable<any> { 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 { ...@@ -167,7 +167,6 @@ export class ItemListComponent implements OnInit {
//编辑监测点 //编辑监测点
showEditModal(item){ showEditModal(item){
this.smartBasiCheck.showEditModal(this.hostId,item.itemid,this.tempName,item.templateid,'编辑模版监测点');
} }
//删除监测点 //删除监测点
...@@ -179,8 +178,7 @@ export class ItemListComponent implements OnInit { ...@@ -179,8 +178,7 @@ export class ItemListComponent implements OnInit {
nzOkType: 'danger', nzOkType: 'danger',
nzOnOk: () => { nzOnOk: () => {
const data = { const data = {
itemids:[item.itemid], itemids:[item.id],
templateid:item.templateid
}; };
this.overAllSer.deleteItem(data).subscribe( this.overAllSer.deleteItem(data).subscribe(
(res) => { (res) => {
......
...@@ -20,8 +20,8 @@ ...@@ -20,8 +20,8 @@
<div nz-row class="search-form"> <div nz-row class="search-form">
<div nz-col nzSpan="16"> <div nz-col nzSpan="16">
<button (click)="showSeparationModal()" nz-button nzType="default">三员分立</button> <!-- <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)="showAddRoleModal()" nz-button nzType="default"><i class="anticon anticon-plus-circle-o"></i>新增角色-->
</button> </button>
</div> </div>
<div nz-col nzSpan="8" class="text-right"> <div nz-col nzSpan="8" class="text-right">
......
...@@ -27,11 +27,11 @@ export class PowerComponent implements OnInit { ...@@ -27,11 +27,11 @@ export class PowerComponent implements OnInit {
ngOnInit() { ngOnInit() {
this.getRole(); this.getRole();
this.systemSer.userFind().subscribe( // this.systemSer.userFind().subscribe(
(res)=>{ // (res)=>{
this.isAdmin = res.data.isAdmin; // this.isAdmin = res.data.isAdmin;
} // }
) // )
} }
getRole() { 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