|
@@ -0,0 +1,369 @@
|
|
1
|
+import { Component, OnInit } from "@angular/core";
|
|
2
|
+import { ActivatedRoute, Router } from "@angular/router";
|
|
3
|
+import { FormBuilder, Validators, FormGroup } from "@angular/forms";
|
|
4
|
+
|
|
5
|
+import { MainService } from "../../services/main.service";
|
|
6
|
+import { ToolService } from "../../services/tool.service";
|
|
7
|
+import { NzMessageService } from 'ng-zorro-antd';
|
|
8
|
+import { Subject } from 'rxjs';
|
|
9
|
+import { debounceTime } from 'rxjs/operators';
|
|
10
|
+@Component({
|
|
11
|
+ selector: "app-inspection-execute",
|
|
12
|
+ templateUrl: "./inspection-execute.component.html",
|
|
13
|
+ styleUrls: ["./inspection-execute.component.less"],
|
|
14
|
+})
|
|
15
|
+export class InspectionExecuteComponent implements OnInit {
|
|
16
|
+ constructor(
|
|
17
|
+ private fb: FormBuilder,
|
|
18
|
+ private mainService: MainService,
|
|
19
|
+ private route: ActivatedRoute,
|
|
20
|
+ private router: Router,
|
|
21
|
+ private tool: ToolService,
|
|
22
|
+ private message: NzMessageService,
|
|
23
|
+ ) {}
|
|
24
|
+
|
|
25
|
+ listOfData: any[] = []; //表格数据
|
|
26
|
+ pageIndex: number = 1; //表格当前页码
|
|
27
|
+ pageSize: number = 10; //表格每页展示条数
|
|
28
|
+ listLength: number = 10; //表格总数据量
|
|
29
|
+ modal: boolean = false; //新增/编辑模态框
|
|
30
|
+ add: boolean; //true:新增;false:编辑
|
|
31
|
+ validateForm: FormGroup; //新增/编辑表单
|
|
32
|
+ coopData: any; //当前操作列
|
|
33
|
+ currentHospital; //当前院区
|
|
34
|
+
|
|
35
|
+ btnLoading: boolean = false; //提交按钮loading状态
|
|
36
|
+
|
|
37
|
+ promptContent: string; //操作提示框提示信息
|
|
38
|
+ ifSuccess: boolean; //操作成功/失败
|
|
39
|
+ promptInfo: string; //操作结果提示信息
|
|
40
|
+ promptModalShow: boolean; //操作提示框是否展示
|
|
41
|
+ nextSchemeName = ""; //下一个开启的方案名称
|
|
42
|
+ modelName = ""; //模态框名称
|
|
43
|
+
|
|
44
|
+ changeInpSubject = new Subject(); //防抖
|
|
45
|
+ showDropdown:boolean = false;
|
|
46
|
+
|
|
47
|
+ ngOnInit() {
|
|
48
|
+ //防抖
|
|
49
|
+ this.changeInpSubject.pipe(debounceTime(500)).subscribe((v) => {
|
|
50
|
+ if(v[1] === 'inspectionPlan'){
|
|
51
|
+ this.getIncidentPlans(v[0], v[2]);
|
|
52
|
+ } else if(v[1] === 'inspectionBatch'){
|
|
53
|
+ this.getInspectionBatchs(v[0], v[2]);
|
|
54
|
+ }
|
|
55
|
+ });
|
|
56
|
+ this.currentHospital = this.tool.getCurrentHospital();
|
|
57
|
+ this.coopBtns = this.tool.initCoopBtns(this.route);
|
|
58
|
+ this.getList(1);
|
|
59
|
+ this.getIncidentPlans('search', '');
|
|
60
|
+ this.getStatus();
|
|
61
|
+ }
|
|
62
|
+
|
|
63
|
+ // 初始化增删改按钮
|
|
64
|
+ coopBtns: any = {};
|
|
65
|
+
|
|
66
|
+ // 批量关联科室
|
|
67
|
+ inspectionAddressDepartmentPromptModalShow = false; //标本历史记录弹窗开关
|
|
68
|
+ showInspectionAddressDepartment() {
|
|
69
|
+ this.inspectionAddressDepartmentPromptModalShow = true;
|
|
70
|
+ }
|
|
71
|
+ // 关闭弹窗
|
|
72
|
+ closeModelInspectionAddressDepartment(e) {
|
|
73
|
+ this.inspectionAddressDepartmentPromptModalShow = JSON.parse(e).show;
|
|
74
|
+ }
|
|
75
|
+ // 确认弹窗
|
|
76
|
+ checkedDepIdsModel = [];
|
|
77
|
+ confirmModelInspectionAddressDepartment(checkedDepIds) {
|
|
78
|
+ this.inspectionAddressDepartmentPromptModalShow = true;
|
|
79
|
+ this.checkedDepIdsModel = checkedDepIds;
|
|
80
|
+ console.log(checkedDepIds)
|
|
81
|
+ this.showInspectionAddressTag();
|
|
82
|
+ }
|
|
83
|
+
|
|
84
|
+ // 批量关联科室-标签
|
|
85
|
+ inspectionAddressTagPromptModalShow = false; //标本历史记录弹窗开关
|
|
86
|
+ showInspectionAddressTag() {
|
|
87
|
+ this.inspectionAddressTagPromptModalShow = true;
|
|
88
|
+ }
|
|
89
|
+ // 关闭弹窗
|
|
90
|
+ closeModelInspectionAddressTag(e) {
|
|
91
|
+ this.inspectionAddressTagPromptModalShow = JSON.parse(e).show;
|
|
92
|
+ }
|
|
93
|
+ // 确认弹窗
|
|
94
|
+ maskFlag: any = false;
|
|
95
|
+ confirmModelInspectionAddressTag(tags) {
|
|
96
|
+ this.maskFlag = this.message.loading("正在加载中..", {
|
|
97
|
+ nzDuration: 0,
|
|
98
|
+ }).messageId;
|
|
99
|
+ this.inspectionAddressTagPromptModalShow = true;
|
|
100
|
+ console.log(this.checkedDepIdsModel, tags);
|
|
101
|
+ let postData:any = {
|
|
102
|
+ deptIds: this.checkedDepIdsModel.toString(),
|
|
103
|
+ hosId: this.currentHospital.id,
|
|
104
|
+ tagIds: tags.toString(),
|
|
105
|
+ };
|
|
106
|
+ console.log(postData);
|
|
107
|
+ this.btnLoading = true;
|
|
108
|
+ this.mainService
|
|
109
|
+ .inspectionPost("batchBindFormNode", postData)
|
|
110
|
+ .subscribe((result) => {
|
|
111
|
+ this.message.remove(this.maskFlag);
|
|
112
|
+ this.maskFlag = false;
|
|
113
|
+ this.btnLoading = false;
|
|
114
|
+ if (result.status == 200) {
|
|
115
|
+ this.inspectionAddressDepartmentPromptModalShow = false;
|
|
116
|
+ this.inspectionAddressTagPromptModalShow = false;
|
|
117
|
+ this.showPromptModal('操作', true, '');
|
|
118
|
+ } else if (result.status == 501) {
|
|
119
|
+ this.inspectionAddressDepartmentPromptModalShow = false;
|
|
120
|
+ this.inspectionAddressTagPromptModalShow = false;
|
|
121
|
+ this.showPromptModal('操作', true, result.msg);
|
|
122
|
+ } else {
|
|
123
|
+ this.showPromptModal('操作', false, result.msg);
|
|
124
|
+ }
|
|
125
|
+ });
|
|
126
|
+ }
|
|
127
|
+
|
|
128
|
+ // 打印
|
|
129
|
+ codes = []; //二维码
|
|
130
|
+ printLoading: boolean = false; //批量打印按钮loading状态
|
|
131
|
+ print(e, batch, id?) {
|
|
132
|
+ e.stopPropagation();
|
|
133
|
+ this.printLoading = true;
|
|
134
|
+ this.mainService
|
|
135
|
+ .inspectionPost("getNodeQrCode", batch ? { nodeIds: this.checkedDepIds.toString() } : [id])
|
|
136
|
+ .subscribe((data) => {
|
|
137
|
+ this.codes = data.data;
|
|
138
|
+ this.printLoading = false;
|
|
139
|
+ setTimeout(() => {
|
|
140
|
+ const printContent = document.getElementById("report");
|
|
141
|
+ const WindowPrt = window.open("", "", "width=700,height=900");
|
|
142
|
+ WindowPrt.document.write(printContent.innerHTML);
|
|
143
|
+ WindowPrt.document.close();
|
|
144
|
+ WindowPrt.focus();
|
|
145
|
+ WindowPrt.print();
|
|
146
|
+ WindowPrt.close();
|
|
147
|
+ }, 100);
|
|
148
|
+ });
|
|
149
|
+ }
|
|
150
|
+
|
|
151
|
+ // 选中表格单列
|
|
152
|
+ mapOfCheckedId: { [key: string]: boolean } = {};
|
|
153
|
+ checkedDepIds = []; //已选中单列id
|
|
154
|
+ refreshStatus(): void {
|
|
155
|
+ let listOfData = this.listOfData;
|
|
156
|
+ this.isAllDisplayDataChecked = listOfData.every(
|
|
157
|
+ (item) => this.mapOfCheckedId[item.id]
|
|
158
|
+ );
|
|
159
|
+ let arr = [];
|
|
160
|
+ for (var k in this.mapOfCheckedId) {
|
|
161
|
+ if (this.mapOfCheckedId[k]) {
|
|
162
|
+ arr.push(Number(k));
|
|
163
|
+ }
|
|
164
|
+ }
|
|
165
|
+ this.checkedDepIds = arr;
|
|
166
|
+ }
|
|
167
|
+ // 整行操作
|
|
168
|
+ selectedListData(data) {
|
|
169
|
+ this.mapOfCheckedId[data.id] = !this.mapOfCheckedId[data.id];
|
|
170
|
+ this.refreshStatus();
|
|
171
|
+ }
|
|
172
|
+ // 全选
|
|
173
|
+ isAllDisplayDataChecked = false; //当前页是否全选
|
|
174
|
+ checkAll(value: boolean): void {
|
|
175
|
+ this.listOfData.forEach((item) => {
|
|
176
|
+ this.mapOfCheckedId[item.id] = value;
|
|
177
|
+ });
|
|
178
|
+ this.refreshStatus();
|
|
179
|
+ }
|
|
180
|
+
|
|
181
|
+ // 搜索
|
|
182
|
+ search() {
|
|
183
|
+ this.getList(0);
|
|
184
|
+ }
|
|
185
|
+ // 重置
|
|
186
|
+ reset() {
|
|
187
|
+ this.inspectionBatchSearchList = [];
|
|
188
|
+ this.searchDto = {};
|
|
189
|
+ this.getList(1);
|
|
190
|
+ }
|
|
191
|
+
|
|
192
|
+ // 表格数据
|
|
193
|
+ searchDto: any = {};
|
|
194
|
+ loading1 = false;
|
|
195
|
+ getList(type) {
|
|
196
|
+ if (type == 1) {
|
|
197
|
+ this.pageIndex = 1;
|
|
198
|
+ }
|
|
199
|
+ let data = {
|
|
200
|
+ idx: this.pageIndex - 1,
|
|
201
|
+ sum: this.pageSize,
|
|
202
|
+ inspectionTask: {
|
|
203
|
+ hosId: this.currentHospital.id,
|
|
204
|
+ code: this.searchDto.code || undefined,
|
|
205
|
+ inspectionId: this.searchDto.inspectionId || undefined,
|
|
206
|
+ batchId: this.searchDto.batchId || undefined,
|
|
207
|
+ status: this.searchDto.statusId ? { id: this.searchDto.statusId } : undefined,
|
|
208
|
+ },
|
|
209
|
+ };
|
|
210
|
+ this.mapOfCheckedId = {};
|
|
211
|
+ this.checkedDepIds = [];
|
|
212
|
+ this.isAllDisplayDataChecked = false;
|
|
213
|
+ this.loading1 = true;
|
|
214
|
+ this.mainService
|
|
215
|
+ .getFetchDataList("simple/data", "inspectionTask", data)
|
|
216
|
+ .subscribe((data) => {
|
|
217
|
+ this.loading1 = false;
|
|
218
|
+ if (data.status == 200) {
|
|
219
|
+ this.listOfData = data.list;
|
|
220
|
+ this.listLength = data.totalNum;
|
|
221
|
+ }else{
|
|
222
|
+ this.message.error(data.msg || "请求数据失败");
|
|
223
|
+ }
|
|
224
|
+ });
|
|
225
|
+ }
|
|
226
|
+
|
|
227
|
+ // 边输边搜节流阀
|
|
228
|
+ isLoading = false;
|
|
229
|
+ changeInp(type, model, e) {
|
|
230
|
+ this.isLoading = true;
|
|
231
|
+ this.changeInpSubject.next([type, model, e]);
|
|
232
|
+ }
|
|
233
|
+
|
|
234
|
+ // 获取巡检计划
|
|
235
|
+ inspectionPlanSearchList: any = []; //所有所属科室(搜索)
|
|
236
|
+ getIncidentPlans(type, keyword, init = false) {
|
|
237
|
+ let postData = {
|
|
238
|
+ inspection: {
|
|
239
|
+ name: keyword,
|
|
240
|
+ hosId: this.currentHospital.id,
|
|
241
|
+ },
|
|
242
|
+ idx: 0,
|
|
243
|
+ sum: 20,
|
|
244
|
+ };
|
|
245
|
+ this.mainService
|
|
246
|
+ .getFetchDataList("data", "inspection", postData)
|
|
247
|
+ .subscribe((data) => {
|
|
248
|
+ this.inspectionPlanSearchList = data.list;
|
|
249
|
+ this.isLoading = false;
|
|
250
|
+ });
|
|
251
|
+ }
|
|
252
|
+
|
|
253
|
+ // 获取批次
|
|
254
|
+ inspectionBatchSearchList: any = [];
|
|
255
|
+ getInspectionBatchs(type, keyword, init = false) {
|
|
256
|
+ let postData = {
|
|
257
|
+ inspectionBatch: {
|
|
258
|
+ name: keyword,
|
|
259
|
+ hosId: this.currentHospital.id,
|
|
260
|
+ inspectionId: this.searchDto.inspectionId || undefined,
|
|
261
|
+ },
|
|
262
|
+ idx: 0,
|
|
263
|
+ sum: 20,
|
|
264
|
+ };
|
|
265
|
+ this.mainService
|
|
266
|
+ .getFetchDataList("simple/data", "inspectionBatch", postData)
|
|
267
|
+ .subscribe((data) => {
|
|
268
|
+ this.inspectionBatchSearchList = data.list;
|
|
269
|
+ this.isLoading = false;
|
|
270
|
+ });
|
|
271
|
+ }
|
|
272
|
+
|
|
273
|
+ // 修改巡检计划
|
|
274
|
+ changeInspection(e){
|
|
275
|
+ this.inspectionBatchSearchList = [];
|
|
276
|
+ this.searchDto.inspectionBatchId = null;
|
|
277
|
+ this.getInspectionBatchs('search', '');
|
|
278
|
+ }
|
|
279
|
+
|
|
280
|
+ //获取状态
|
|
281
|
+ statusSearchList:any[] = [];
|
|
282
|
+ getStatus() {
|
|
283
|
+ this.mainService
|
|
284
|
+ .getDictionary('list', 'inspection_task_status')
|
|
285
|
+ .subscribe((data) => {
|
|
286
|
+ this.statusSearchList = data || [];
|
|
287
|
+ });
|
|
288
|
+ }
|
|
289
|
+
|
|
290
|
+ // 展示信息提示框(con:提示信息,success:操作是否成功,promptInfo:操作结果提示信息)
|
|
291
|
+ showPromptModal(con, success, promptInfo?) {
|
|
292
|
+ this.promptModalShow = false;
|
|
293
|
+ this.promptContent = con;
|
|
294
|
+ this.ifSuccess = success;
|
|
295
|
+ this.promptInfo = promptInfo;
|
|
296
|
+ setTimeout(() => {
|
|
297
|
+ this.promptModalShow = true;
|
|
298
|
+ }, 100);
|
|
299
|
+ this.getList(0);
|
|
300
|
+ }
|
|
301
|
+
|
|
302
|
+ delModal: boolean = false; //删除模态框
|
|
303
|
+ tipsMsg1: string; //提示框信息
|
|
304
|
+ tipsMsg2: string; //操作后信息
|
|
305
|
+ confirmDelType: string; //确认的类型(启用/停用,删除)
|
|
306
|
+ showDelModal(
|
|
307
|
+ data,
|
|
308
|
+ tipsMsg1: string,
|
|
309
|
+ tipsMsg2: string,
|
|
310
|
+ type: string,
|
|
311
|
+ ) {
|
|
312
|
+ this.confirmDelType = type;
|
|
313
|
+ this.delModal = true;
|
|
314
|
+ this.coopData = data;
|
|
315
|
+ this.tipsMsg1 = tipsMsg1;
|
|
316
|
+ this.tipsMsg2 = tipsMsg2;
|
|
317
|
+ }
|
|
318
|
+ // 隐藏删除框
|
|
319
|
+ hideDelModal() {
|
|
320
|
+ this.delModal = false;
|
|
321
|
+ }
|
|
322
|
+ // 确认删除
|
|
323
|
+ confirmDel() {
|
|
324
|
+ this.btnLoading = true;
|
|
325
|
+ if (this.confirmDelType === "del") {
|
|
326
|
+ //删除
|
|
327
|
+ this.mainService
|
|
328
|
+ .simplePost("rmvData", "inspectionTask", [this.coopData.id])
|
|
329
|
+ .subscribe((data) => {
|
|
330
|
+ this.btnLoading = false;
|
|
331
|
+ this.delModal = false;
|
|
332
|
+ if (data.status == 200) {
|
|
333
|
+ this.showPromptModal(this.tipsMsg2, true, "");
|
|
334
|
+ } else {
|
|
335
|
+ this.showPromptModal(this.tipsMsg2, false, data.msg);
|
|
336
|
+ }
|
|
337
|
+ });
|
|
338
|
+ } else if (this.confirmDelType === "delList") {
|
|
339
|
+ //批量删除
|
|
340
|
+ this.mainService
|
|
341
|
+ .simplePost("rmvData", "inspectionTask", this.checkedDepIds)
|
|
342
|
+ .subscribe((data) => {
|
|
343
|
+ this.btnLoading = false;
|
|
344
|
+ this.delModal = false;
|
|
345
|
+ if (data.status == 200) {
|
|
346
|
+ this.showPromptModal(this.tipsMsg2, true, "");
|
|
347
|
+ } else {
|
|
348
|
+ this.showPromptModal(this.tipsMsg2, false, data.msg);
|
|
349
|
+ }
|
|
350
|
+ });
|
|
351
|
+ } else if (this.confirmDelType === "resetList") {
|
|
352
|
+ //批量重置
|
|
353
|
+ let postData = {
|
|
354
|
+ nodeIds: this.checkedDepIds.toString(),
|
|
355
|
+ }
|
|
356
|
+ this.mainService
|
|
357
|
+ .inspectionPost("batchResetNodeCode", postData)
|
|
358
|
+ .subscribe((data) => {
|
|
359
|
+ this.btnLoading = false;
|
|
360
|
+ this.delModal = false;
|
|
361
|
+ if (data.status == 200) {
|
|
362
|
+ this.showPromptModal(this.tipsMsg2, true, "");
|
|
363
|
+ } else {
|
|
364
|
+ this.showPromptModal(this.tipsMsg2, false, data.msg);
|
|
365
|
+ }
|
|
366
|
+ });
|
|
367
|
+ }
|
|
368
|
+ }
|
|
369
|
+}
|