Newer
Older
import {Component, EventEmitter, OnInit, Output, ViewChild} from '@angular/core';
import {BasicKeyComponent} from '../basic-key/basic-key.component';
import {NzMessageService} from 'ng-zorro-antd';
import {NewTypeComponent} from '../new-type/new-type.component';
selector: 'smart-basi-check',
templateUrl: './basi-check.component.html',
styles: [
`.tag-button[disabled],
.tag-button {
width: 80%;
height: 30px;
color: rgba(0, 0, 0, 0.65);
background-color: #fff;
border-color: #d9d9d9;
:host ::ng-deep .ant-tabs-nav .ant-tabs-tab-disabled {
color: rgba(0, 0, 0, .65);
@ViewChild('basicKey') basicKey: BasicKeyComponent;
@ViewChild('newType') newType: NewTypeComponent;
constructor(private overAllSer: OverAllService, private fb: FormBuilder,
private message: NzMessageService) {
}
ngOnInit() {
key_: [null, [Validators.required]],
value_type: [null, [Validators.required]],
type: [null, [Validators.required]],
units: [null],
history: ['3600'],
trends: [null],
delay: [null, [Validators.required]],
this.isCheck = true;
this.hostId = hostId;
this.hostName = hostName;
}
);
this.isInterface = true;
}
if(this.title == '添加模版监测点'){
this.isInterface = false;
this.validateForm.get('interfaceid').clearValidators();
}
// this.overAllSer.findValuemap().subscribe(
// (res) => {
// if (res.errCode == 10000) {
// this.valueMapList = res.data;
// } else {
// this.message.error(res.errMsg);
// }
// }
// );
if(data.applications){
data.applications = data.applications.map(e=>{
return e.applicationid;
});
}
const list = ['0','1','3','4','6','10','12','13','14','16','17'];
if(list.indexOf(this.validateForm.value.type) > -1){
this.validateForm.get('type').setValidators(Validators.required);
}
for (let i in this.validateForm.controls) {
this.validateForm.controls[i].markAsDirty();
this.validateForm.controls[i].updateValueAndValidity();
if (this.validateForm.invalid) {
this.message.error('请输入必填信息');
this.validateForm.value.applications = [this.validateForm.value.applications];
update() {
this.validateForm.addControl('itemid', new FormControl(this.itemId));
this.validateForm.addControl('templateid', new FormControl(this.templateid));