Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
import {Component, EventEmitter, OnInit, Output, ViewChild} from '@angular/core';
import {FormBuilder, FormControl, FormGroup, Validators} from '@angular/forms';
import {NzMessageService, UploadFile} from 'ng-zorro-antd';
import {opr_company_type} from '../../../project-manager/project.constants';
import {SystemService} from '../../../system/system.service';
import {ProjectService} from '../../../project-manager/project.service';
import {ProjectModalComponent} from '../../../project-manager/modal/project-modal/project-modal.component';
@Component({
selector: 'smart-violation-notification',
templateUrl: './violation-notification.component.html',
styles: []
})
export class ViolationNotificationComponent implements OnInit {
@ViewChild('smartProjectModal') smartProjectModal: ProjectModalComponent;
@Output() done = new EventEmitter<any>();
title;
isVisible = false;
isOkLoading = false;
validateForm: FormGroup;
fileList: UploadFile[] = [];
opr_company_type = opr_company_type;
cID;
userList;
constructor(private fb: FormBuilder, private systemSer: SystemService,
private message: NzMessageService, private projectSer: ProjectService) {
}
ngOnInit(): void {
this.initForm();
this.getUser();
}
initForm() {
this.validateForm = this.fb.group({
title: [null],
projectId: [null],
projectName: [null],
content: [null],
users: [[]],
});
}
//获取人员
getUser() {
const data = {
'pageNum': '1',
'pageSize': '1000'
};
this.systemSer.user(data).subscribe(
(res) => {
this.userList = res.data.data;
}
);
}
showAddModal(title) {
this.isVisible = true;
this.title = title;
}
showEditModal(data, title) {
this.isVisible = true;
data.type += '';
this.title = title;
this.cID = data.id;
console.log(data);
this.validateForm.patchValue(data);
}
handleCancel() {
this.isVisible = false;
this.initForm();
}
handleOk() {
for (let i in this.validateForm.controls) {
this.validateForm.controls[i].markAsDirty();
this.validateForm.controls[i].updateValueAndValidity();
}
if (this.validateForm.invalid) {
return false;
}
this.done.emit(this.validateForm.value);
this.isVisible = false;
this.initForm();
}
// 选择的项目
showProjectmodal() {
this.smartProjectModal.showModal();
}
//获取选择的项目
getProject(e) {
const d = {
projectId: e.id,
projectName: e.name
};
this.validateForm.patchValue(d);
}
}