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
import {Component, OnInit, Output, EventEmitter, ViewChild} from '@angular/core';
import {FormBuilder, FormControl, FormGroup, Validators} from '@angular/forms';
import {NzMessageService, UploadFile} from 'ng-zorro-antd';
import {project_type} from '../../project.constants';
import {SystemService} from '../../../system/system.service';
import {ProjectService} from '../../project.service';
import {SelectPersonComponent} from '../../../modal/select-person/select-person.component';
import {WorkService} from '../../../work/work.service';
@Component({
selector: 'smart-create-track-info',
templateUrl: './create-track-info.component.html',
styles: []
})
export class CreateTrackInfoComponent implements OnInit {
@ViewChild('smartSelectPerson') smartSelectPerson: SelectPersonComponent;
@Output() done = new EventEmitter<any>();
timeFormat = 'yyyy-MM-dd';
title;
isVisible = false;
isOkLoading = false;
validateForm: FormGroup;
fileList: UploadFile[] = [];
opr_company_type = project_type;
cID;
constructor(private fb: FormBuilder, private systemSer: SystemService,
private workSer:WorkService,
private message: NzMessageService, private projectSer: ProjectService) {
}
ngOnInit(): void {
this.initForm();
}
initForm() {
this.validateForm = this.fb.group({
createUserId: [null, [Validators.required]],
createUserName: [null, [Validators.required]],
msg: [null, [Validators.required]],
});
this.isOkLoading = false;
}
showAddModal(title) {
this.isVisible = true;
this.title = title;
}
showEditModal(data, title) {
this.isVisible = true;
data.type += '';
this.title = title;
this.cID = data.id;
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.isOkLoading = true;
if (this.title == '添加跟踪信息') { //运维工作
this.create();
}
if (this.title == '添加配件盘点') { //项目管理
this.add();
}
}
this.projectSer.addMaintainProjectTrackMsg(this.validateForm.value).subscribe(
(res)=>{
if(res.errCode == 10000){
this.initForm();
this.done.emit();
this.isVisible = false;
this.isOkLoading = false;
this.message.success(`${this.title}成功`);
}
}
)
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
add(){
this.workSer.addTrackMsg(this.validateForm.value).subscribe(
(res)=>{
if(res.errCode == 10000){
this.initForm();
this.done.emit();
this.isVisible = false;
this.isOkLoading = false;
this.message.success(`${this.title}成功`);
}
}
)
}
//选择人员
showPeoplemodal() {
this.smartSelectPerson.showModal('选择人员', null);
}
//设置人员
setPeolpe(e) {
const d = {
createUserId: e[0].id,
createUserName: e[0].name,
};
this.validateForm.patchValue(d);
console.log(e);
}
}