|
@@ -61,11 +61,47 @@ export class QRCodeConfigurationComponent implements OnInit {
|
61
|
61
|
this.getList(true);
|
62
|
62
|
}
|
63
|
63
|
|
|
64
|
+ // 新添加地点号码
|
|
65
|
+ deptPhones: any = []; //新添加的地点电话列表
|
|
66
|
+ deptsPhoneId = 1; //地点电话自增id
|
|
67
|
+ isAddDeptsPhone = true; //添加新的地点电话是否禁用
|
|
68
|
+ addDeptPhone(e: MouseEvent) {
|
|
69
|
+ e.preventDefault();
|
|
70
|
+ this.deptPhones.push({ id: ++this.deptsPhoneId, phone: "" });
|
|
71
|
+ this.deptsPhoneChange();
|
|
72
|
+ }
|
|
73
|
+ // 删除新添加地点号码
|
|
74
|
+ removeDeptPhone(index: number, e: MouseEvent) {
|
|
75
|
+ e.preventDefault();
|
|
76
|
+ this.deptPhones.splice(index, 1);
|
|
77
|
+ this.deptsPhoneChange();
|
|
78
|
+ }
|
|
79
|
+ //监听科室电话输入事件
|
|
80
|
+ deptsPhoneChange(e?, phone?) {
|
|
81
|
+ if (e !== undefined && phone !== undefined) {
|
|
82
|
+ phone.phone = e;
|
|
83
|
+ }
|
|
84
|
+ // -------------判断添加按钮是否禁用 start
|
|
85
|
+ this.isAddDeptsPhone = !this.validateForm.value.phones;
|
|
86
|
+ if (!this.isAddDeptsPhone) {
|
|
87
|
+ //如果没禁用
|
|
88
|
+ this.isAddDeptsPhone = this.deptPhones.some((item) => item.phone === "");
|
|
89
|
+ }
|
|
90
|
+ // -------------判断添加按钮是否禁用 end
|
|
91
|
+ }
|
|
92
|
+
|
64
|
93
|
// 搜索
|
65
|
94
|
search() {
|
66
|
95
|
this.getList(true);
|
67
|
96
|
}
|
|
97
|
+ // 重置
|
|
98
|
+ reset() {
|
|
99
|
+ this.searchDto = {};
|
|
100
|
+ this.getList(true);
|
|
101
|
+ }
|
68
|
102
|
// 表格数据
|
|
103
|
+ alldepart1: any = []; //所有所属科室(搜索)
|
|
104
|
+ searchDto:any = {};
|
69
|
105
|
loading1 = false;
|
70
|
106
|
getList(isResetPageIndex = false) {
|
71
|
107
|
isResetPageIndex && (this.pageIndex = 1);
|
|
@@ -73,6 +109,7 @@ export class QRCodeConfigurationComponent implements OnInit {
|
73
|
109
|
pageIndex: this.pageIndex,
|
74
|
110
|
pageSize: this.pageSize,
|
75
|
111
|
hosId: this.hosId,
|
|
112
|
+ searchDto: this.searchDto,
|
76
|
113
|
};
|
77
|
114
|
this.loading1 = true;
|
78
|
115
|
this.qrCodeConfigurationService
|
|
@@ -85,7 +122,7 @@ export class QRCodeConfigurationComponent implements OnInit {
|
85
|
122
|
});
|
86
|
123
|
}
|
87
|
124
|
|
88
|
|
- // 获取任务类型列表-其他临床服务
|
|
125
|
+ // 获取科室列表
|
89
|
126
|
getOtherTasktype(keywords = '') {
|
90
|
127
|
let hosId = this.tool.getCurrentHospital().id;
|
91
|
128
|
this.isLoading = true;
|
|
@@ -103,6 +140,8 @@ export class QRCodeConfigurationComponent implements OnInit {
|
103
|
140
|
this.add = true;
|
104
|
141
|
this.modal = true;
|
105
|
142
|
this.initForm();
|
|
143
|
+ this.isAddDeptsPhone = true;
|
|
144
|
+ this.deptPhones = [];
|
106
|
145
|
}
|
107
|
146
|
hideModal() {
|
108
|
147
|
this.modal = false;
|
|
@@ -117,6 +156,8 @@ export class QRCodeConfigurationComponent implements OnInit {
|
117
|
156
|
this.validateForm = this.fb.group({
|
118
|
157
|
name: ['', [Validators.required]],
|
119
|
158
|
deptId: [null, [Validators.required]],
|
|
159
|
+ placeCode: ['', [Validators.required]],
|
|
160
|
+ phones: [null],
|
120
|
161
|
});
|
121
|
162
|
}
|
122
|
163
|
// 表单提交
|
|
@@ -127,11 +168,14 @@ export class QRCodeConfigurationComponent implements OnInit {
|
127
|
168
|
}
|
128
|
169
|
if (this.validateForm.invalid) return;
|
129
|
170
|
this.btnLoading = true;
|
|
171
|
+ let deptsPhone = this.deptPhones.map((item) => item.phone).join();
|
130
|
172
|
if(this.add){
|
131
|
173
|
this.qrCodeConfigurationService
|
132
|
174
|
.add({
|
133
|
175
|
name: this.validateForm.value.name,
|
134
|
176
|
deptId: this.validateForm.value.deptId,
|
|
177
|
+ placeCode: this.validateForm.value.placeCode,
|
|
178
|
+ phones: deptsPhone ? this.validateForm.value.phones + "," + deptsPhone : this.validateForm.value.phones,
|
135
|
179
|
hosId: this.hosId,
|
136
|
180
|
})
|
137
|
181
|
.subscribe((data) => {
|
|
@@ -149,6 +193,8 @@ export class QRCodeConfigurationComponent implements OnInit {
|
149
|
193
|
.update({
|
150
|
194
|
name: this.validateForm.value.name,
|
151
|
195
|
deptId: this.validateForm.value.deptId,
|
|
196
|
+ placeCode: this.validateForm.value.placeCode,
|
|
197
|
+ phones: deptsPhone ? this.validateForm.value.phones + "," + deptsPhone : this.validateForm.value.phones,
|
152
|
198
|
coopData: this.coopData,
|
153
|
199
|
})
|
154
|
200
|
.subscribe((data) => {
|
|
@@ -168,8 +214,27 @@ export class QRCodeConfigurationComponent implements OnInit {
|
168
|
214
|
maskFlag: any = false;
|
169
|
215
|
coopData = {};
|
170
|
216
|
edit(data) {
|
|
217
|
+ this.isAddDeptsPhone = false;
|
|
218
|
+ this.deptPhones = [];
|
|
219
|
+ let phones = data.phones ? data.phones.split(",") : [];
|
|
220
|
+ if (phones.length === 0) {
|
|
221
|
+ this.validateForm.controls.phones.setValue("");
|
|
222
|
+ this.deptPhones = [];
|
|
223
|
+ } else if (phones.length === 1) {
|
|
224
|
+ this.validateForm.controls.phones.setValue(phones[0]);
|
|
225
|
+ this.deptPhones = [];
|
|
226
|
+ } else {
|
|
227
|
+ this.validateForm.controls.phones.setValue(phones[0]);
|
|
228
|
+ this.deptPhones = phones.slice(1).map((item) => {
|
|
229
|
+ return {
|
|
230
|
+ id: ++this.deptsPhoneId,
|
|
231
|
+ phone: item,
|
|
232
|
+ };
|
|
233
|
+ });
|
|
234
|
+ }
|
171
|
235
|
this.validateForm.controls.name.setValue(data.name);
|
172
|
236
|
this.validateForm.controls.deptId.setValue(data.deptId);
|
|
237
|
+ this.validateForm.controls.placeCode.setValue(data.placeCode);
|
173
|
238
|
this.modal = true;
|
174
|
239
|
this.add = false;
|
175
|
240
|
this.coopId = data.id;
|