import { Component, OnInit } from '@angular/core'; import { FormBuilder, FormGroup, Validators } from '@angular/forms'; import { Router } from '@angular/router' @Component({ selector: 'app-today-warning-admin', templateUrl: './today-warning-admin.component.html', styleUrls: ['./today-warning-admin.component.scss'] }) export class TodayWarningAdminComponent implements OnInit { validateForm!: FormGroup; constructor(private fb: FormBuilder, private router: Router) { } ngOnInit(): void { this.validateForm = this.fb.group({ level: [null], type: [null], company: [null], area: [null], site: [null], datePicker: [null] }); } submitForm(): void { for (const i in this.validateForm.controls) { this.validateForm.controls[i].markAsDirty(); this.validateForm.controls[i].updateValueAndValidity(); } console.log(this.validateForm) } resetForm(e: MouseEvent): void { e.preventDefault(); this.validateForm.reset(); for (const key in this.validateForm.controls) { this.validateForm.controls[key].markAsPristine(); this.validateForm.controls[key].updateValueAndValidity(); } } list: any = [ { level: 1, name: '北京市第十九加油站', prop: 1, type: '加油区违规', content: '工作人员倚靠加油机或者立柱', company: '中化北京分公司', area: '北京-朝阳', site: '加油区2号摄像头', time: '2021-10-12 09:28:13' }, { level: 2, name: '北京市第十九加油站', prop: 2, type: '加油区违规', content: '工作人员倚靠加油机或者立柱', company: '中化北京分公司', area: '北京-朝阳', site: '加油区2号摄像头', time: '2021-10-12 09:28:13' }, { level: 3, name: '北京市第十九加油站', prop: 1, type: '加油区违规', content: '工作人员倚靠加油机或者立柱', company: '中化北京分公司', area: '北京-朝阳', site: '加油区2号摄像头', time: '2021-10-12 09:28:13' }, { level: 1, name: '北京市第十九加油站', prop: 2, type: '加油区违规', content: '工作人员倚靠加油机或者立柱', company: '中化北京分公司', area: '北京-朝阳', site: '加油区2号摄像头', time: '2021-10-12 09:28:13' }, { level: 1, name: '北京市第十九加油站', prop: 1, type: '加油区违规', content: '工作人员倚靠加油机或者立柱', company: '中化北京分公司', area: '北京-朝阳', site: '加油区2号摄像头', time: '2021-10-12 09:28:13' }, { level: 1, name: '北京市第十九加油站', prop: 2, type: '加油区违规', content: '工作人员倚靠加油机或者立柱', company: '中化北京分公司', area: '北京-朝阳', site: '加油区2号摄像头', time: '2021-10-12 09:28:13' }, { level: 1, name: '北京市第十九加油站', prop: 1, type: '加油区违规', content: '工作人员倚靠加油机或者立柱', company: '中化北京分公司', area: '北京-朝阳', site: '加油区2号摄像头', time: '2021-10-12 09:28:13' }, { level: 1, name: '北京市第十九加油站', prop: 2, type: '加油区违规', content: '工作人员倚靠加油机或者立柱', company: '中化北京分公司', area: '北京-朝阳', site: '加油区2号摄像头', time: '2021-10-12 09:28:13' }, { level: 1, name: '北京市第十九加油站', prop: 1, type: '加油区违规', content: '工作人员倚靠加油机或者立柱', company: '中化北京分公司', area: '北京-朝阳', site: '加油区2号摄像头', time: '2021-10-12 09:28:13' }, { level: 1, name: '北京市第十九加油站', prop: 2, type: '加油区违规', content: '工作人员倚靠加油机或者立柱', company: '中化北京分公司', area: '北京-朝阳', site: '加油区2号摄像头', time: '2021-10-12 09:28:13' }, { level: 1, name: '北京市第十九加油站', prop: 1, type: '加油区违规', content: '工作人员倚靠加油机或者立柱', company: '中化北京分公司', area: '北京-朝阳', site: '加油区2号摄像头', time: '2021-10-12 09:28:13' }, { level: 1, name: '北京市第十九加油站', prop: 2, type: '加油区违规', content: '工作人员倚靠加油机或者立柱', company: '中化北京分公司', area: '北京-朝阳', site: '加油区2号摄像头', time: '2021-10-12 09:28:13' } ] isVisible = false; showModal(): void { this.isVisible = true; } handleOk(): void { console.log('Button ok clicked!'); this.isVisible = false; } handleCancel(): void { console.log('Button cancel clicked!'); this.isVisible = false; } look() { this.router.navigate(['warning/petrolStation']) } }