Newer
Older
import {Component, EventEmitter, OnInit, Output} from '@angular/core';
import {NzMessageService, UploadFile} from 'ng-zorro-antd';
import {FormBuilder, FormGroup, Validator, Validators} from '@angular/forms';
selector: 'smart-icon',
templateUrl: './icon.component.html',
styles: []
constructor(private topologySer: TopologyService, private message: NzMessageService,
private fb: FormBuilder) {
}
firstTypeId: [null, [Validators.required]],
secondTypeId: [null],
iconType: ['0'],
defaultIcon: ['0'],
name: [''],
handleOk() {
if (this.fileList.length == 0) {
this.message.error('请选择图标');
this.validateForm.controls[i].markAsDirty();
this.validateForm.controls[i].updateValueAndValidity();
}
const formData = new FormData();
this.fileList.forEach((file: any) => {
formData.append('iconType', this.validateForm.value.iconType);
formData.append('defaultIcon', this.validateForm.value.defaultIcon);
formData.append('firstTypeId', this.validateForm.value.firstTypeId);
formData.append('secondTypeId', this.validateForm.value.secondTypeId);
formData.append('name', this.validateForm.value.name);
console.log(this.validateForm.value);
(res) => {
if (res.errCode == 10000) {
this.message.success('添加成功');
console.log('网站监测');
this.validateForm.get('secondTypeId').clearValidators();
this.validateForm.value.iconType = '1';
this.validateForm.get('secondTypeId').setValidators(Validators.required);