|
@@ -6,6 +6,7 @@ import { ToolService } from 'src/app/services/tool.service';
|
6
|
6
|
import { OverlayScrollbarsComponent } from 'overlayscrollbars-ngx';
|
7
|
7
|
import { NzMessageService } from 'ng-zorro-antd';
|
8
|
8
|
import { v4 as uuidv4, validate as uuidValidate } from 'uuid';
|
|
9
|
+import { addDays, startOfMinute, endOfMinute, set, getYear, getMonth, getDate, format } from 'date-fns';
|
9
|
10
|
|
10
|
11
|
@Component({
|
11
|
12
|
selector: "app-configuration-inspect",
|
|
@@ -41,13 +42,37 @@ export class ConfigurationInspectComponent implements OnInit {
|
41
|
42
|
// 数据字典key列表
|
42
|
43
|
dictionaryKeyList:any[] = [
|
43
|
44
|
{ id: 1, name: '注意事项', key: "inspect_notes"},
|
|
45
|
+ { id: 2, name: '批量建单配置', key: "", postData: {
|
|
46
|
+ ibActiveStartTime1: undefined,
|
|
47
|
+ ibActiveEndTime1: undefined,
|
|
48
|
+ ibActiveStartTime2: undefined,
|
|
49
|
+ ibActiveEndTime2: undefined,
|
|
50
|
+ ibDefaultStartTime: undefined,
|
|
51
|
+ ibDefaultEndTime: undefined,
|
|
52
|
+ ibDefaultDayStart: [{ label:'+1天', value: 0 }],
|
|
53
|
+ ibDefaultDayEnd: [{ label:'+1天', value: 0 }],
|
|
54
|
+ ib2ActiveStartTime1: undefined,
|
|
55
|
+ ib2ActiveEndTime1: undefined,
|
|
56
|
+ ib2ActiveStartTime2: undefined,
|
|
57
|
+ ib2ActiveEndTime2: undefined,
|
|
58
|
+ ib2DefaultStartTime: undefined,
|
|
59
|
+ ib2DefaultEndTime: undefined,
|
|
60
|
+ ib2DefaultDayStart: [{ label:'+1天', value: 0 }],
|
|
61
|
+ ib2DefaultDayEnd: [{ label:'+1天', value: 0 }],
|
|
62
|
+ }},
|
44
|
63
|
]
|
45
|
64
|
|
46
|
65
|
// 点击数据字典key
|
47
|
66
|
activeDictionaryKey:any;
|
48
|
67
|
clickDictionaryKey(item){
|
49
|
68
|
this.activeDictionaryKey = item;
|
50
|
|
- this.getDictionaryList();
|
|
69
|
+ if(this.activeDictionaryKey.id == 1){
|
|
70
|
+ this.getDictionaryList();
|
|
71
|
+ this.initDictionaryForm();
|
|
72
|
+ }else{
|
|
73
|
+ this.tabModal('characteristics');
|
|
74
|
+ this.init();
|
|
75
|
+ }
|
51
|
76
|
}
|
52
|
77
|
|
53
|
78
|
btnLoading: boolean = false; //提交按钮loading状态
|
|
@@ -254,4 +279,200 @@ export class ConfigurationInspectComponent implements OnInit {
|
254
|
279
|
}
|
255
|
280
|
});
|
256
|
281
|
}
|
|
282
|
+
|
|
283
|
+
|
|
284
|
+ // ==============================页面控制============================
|
|
285
|
+ tabModalName:string = 'characteristics'; //当前选中的tab
|
|
286
|
+ loading:boolean = false; //页面加载的loading
|
|
287
|
+ hosId = this.tool.getCurrentHospital().id; //当前院区
|
|
288
|
+ tasktype:any = {};// 任务类型
|
|
289
|
+ configs:any = {};// 配置
|
|
290
|
+ // 切换tab
|
|
291
|
+ tabModal(tabModalName:string){
|
|
292
|
+ this.tabModalName = tabModalName;
|
|
293
|
+ }
|
|
294
|
+ // 保存
|
|
295
|
+ submitForm() {
|
|
296
|
+ if(!this.tasktype.id){
|
|
297
|
+ this.message.create("warning", "请先配置任务类型!");
|
|
298
|
+ return;
|
|
299
|
+ }
|
|
300
|
+
|
|
301
|
+ // 默认时间区间1
|
|
302
|
+
|
|
303
|
+ if(
|
|
304
|
+ (this.activeDictionaryKey.postData.ibActiveStartTime1 && !this.activeDictionaryKey.postData.ibActiveEndTime1) ||
|
|
305
|
+ (!this.activeDictionaryKey.postData.ibActiveStartTime1 && this.activeDictionaryKey.postData.ibActiveEndTime1) ||
|
|
306
|
+ (this.activeDictionaryKey.postData.ibActiveStartTime2 && !this.activeDictionaryKey.postData.ibActiveEndTime2) ||
|
|
307
|
+ (!this.activeDictionaryKey.postData.ibActiveStartTime2 && this.activeDictionaryKey.postData.ibActiveEndTime2)
|
|
308
|
+ ){
|
|
309
|
+ this.message.create("warning", "【默认时间区间1】的【有效时间范围】请完整填写开始时间与结束时间!");
|
|
310
|
+ return;
|
|
311
|
+ }else if(
|
|
312
|
+ (this.activeDictionaryKey.postData.ibActiveStartTime1 && this.activeDictionaryKey.postData.ibActiveEndTime1 && +this.activeDictionaryKey.postData.ibActiveStartTime1 > +this.activeDictionaryKey.postData.ibActiveEndTime1) ||
|
|
313
|
+ (this.activeDictionaryKey.postData.ibActiveStartTime2 && this.activeDictionaryKey.postData.ibActiveEndTime2 && +this.activeDictionaryKey.postData.ibActiveStartTime2 > +this.activeDictionaryKey.postData.ibActiveEndTime2)
|
|
314
|
+ ){
|
|
315
|
+ this.message.create("warning", "【默认时间区间1】的【有效时间范围】开始时间不能大于结束时间!");
|
|
316
|
+ return;
|
|
317
|
+ }
|
|
318
|
+
|
|
319
|
+ if(
|
|
320
|
+ (this.activeDictionaryKey.postData.ibDefaultStartTime && !this.activeDictionaryKey.postData.ibDefaultEndTime) ||
|
|
321
|
+ (!this.activeDictionaryKey.postData.ibDefaultStartTime && this.activeDictionaryKey.postData.ibDefaultEndTime)
|
|
322
|
+ ){
|
|
323
|
+ this.message.create("warning", "【默认时间区间1】的【默认时间】请完整填写开始时间与结束时间!");
|
|
324
|
+ return;
|
|
325
|
+ }else if(
|
|
326
|
+ this.activeDictionaryKey.postData.ibDefaultStartTime &&
|
|
327
|
+ this.activeDictionaryKey.postData.ibDefaultEndTime &&
|
|
328
|
+ (this.activeDictionaryKey.postData.ibDefaultDayStart[0].checked ? +addDays(this.activeDictionaryKey.postData.ibDefaultStartTime, 1) : +this.activeDictionaryKey.postData.ibDefaultStartTime) > (this.activeDictionaryKey.postData.ibDefaultDayEnd[0].checked ? +addDays(this.activeDictionaryKey.postData.ibDefaultEndTime, 1) : +this.activeDictionaryKey.postData.ibDefaultEndTime)
|
|
329
|
+ ){
|
|
330
|
+ this.message.create("warning", "【默认时间区间1】的【默认时间】开始时间不能大于结束时间!");
|
|
331
|
+ return;
|
|
332
|
+ }
|
|
333
|
+
|
|
334
|
+ // 默认时间区间2
|
|
335
|
+
|
|
336
|
+ if(
|
|
337
|
+ (this.activeDictionaryKey.postData.ib2ActiveStartTime1 && !this.activeDictionaryKey.postData.ib2ActiveEndTime1) ||
|
|
338
|
+ (!this.activeDictionaryKey.postData.ib2ActiveStartTime1 && this.activeDictionaryKey.postData.ib2ActiveEndTime1) ||
|
|
339
|
+ (this.activeDictionaryKey.postData.ib2ActiveStartTime2 && !this.activeDictionaryKey.postData.ib2ActiveEndTime2) ||
|
|
340
|
+ (!this.activeDictionaryKey.postData.ib2ActiveStartTime2 && this.activeDictionaryKey.postData.ib2ActiveEndTime2)
|
|
341
|
+ ){
|
|
342
|
+ this.message.create("warning", "【默认时间区间1】的【有效时间范围】请完整填写开始时间与结束时间!");
|
|
343
|
+ return;
|
|
344
|
+ }else if(
|
|
345
|
+ (this.activeDictionaryKey.postData.ib2ActiveStartTime1 && this.activeDictionaryKey.postData.ib2ActiveEndTime1 && +this.activeDictionaryKey.postData.ib2ActiveStartTime1 > +this.activeDictionaryKey.postData.ib2ActiveEndTime1) ||
|
|
346
|
+ (this.activeDictionaryKey.postData.ib2ActiveStartTime2 && this.activeDictionaryKey.postData.ib2ActiveEndTime2 && +this.activeDictionaryKey.postData.ib2ActiveStartTime2 > +this.activeDictionaryKey.postData.ib2ActiveEndTime2)
|
|
347
|
+ ){
|
|
348
|
+ this.message.create("warning", "【默认时间区间1】的【有效时间范围】开始时间不能大于结束时间!");
|
|
349
|
+ return;
|
|
350
|
+ }
|
|
351
|
+
|
|
352
|
+ if(
|
|
353
|
+ (this.activeDictionaryKey.postData.ib2DefaultStartTime && !this.activeDictionaryKey.postData.ib2DefaultEndTime) ||
|
|
354
|
+ (!this.activeDictionaryKey.postData.ib2DefaultStartTime && this.activeDictionaryKey.postData.ib2DefaultEndTime)
|
|
355
|
+ ){
|
|
356
|
+ this.message.create("warning", "【默认时间区间1】的【默认时间】请完整填写开始时间与结束时间!");
|
|
357
|
+ return;
|
|
358
|
+ }else if(
|
|
359
|
+ this.activeDictionaryKey.postData.ib2DefaultStartTime &&
|
|
360
|
+ this.activeDictionaryKey.postData.ib2DefaultEndTime &&
|
|
361
|
+ (this.activeDictionaryKey.postData.ib2DefaultDayStart[0].checked ? +addDays(this.activeDictionaryKey.postData.ib2DefaultStartTime, 1) : +this.activeDictionaryKey.postData.ib2DefaultStartTime) > (this.activeDictionaryKey.postData.ib2DefaultDayEnd[0].checked ? +addDays(this.activeDictionaryKey.postData.ib2DefaultEndTime, 1) : +this.activeDictionaryKey.postData.ib2DefaultEndTime)
|
|
362
|
+ ){
|
|
363
|
+ this.message.create("warning", "【默认时间区间1】的【默认时间】开始时间不能大于结束时间!");
|
|
364
|
+ return;
|
|
365
|
+ }
|
|
366
|
+
|
|
367
|
+ let postData:any = {
|
|
368
|
+ ...this.configs,
|
|
369
|
+ taskType: this.tasktype.id,
|
|
370
|
+ hosId: this.hosId,
|
|
371
|
+ ibActiveStartTime1: this.activeDictionaryKey.postData.ibActiveStartTime1 ? format(startOfMinute(this.activeDictionaryKey.postData.ibActiveStartTime1), 'yyyy-MM-dd HH:mm:ss') : undefined,
|
|
372
|
+ ibActiveEndTime1: this.activeDictionaryKey.postData.ibActiveEndTime1 ? format(endOfMinute(this.activeDictionaryKey.postData.ibActiveEndTime1), 'yyyy-MM-dd HH:mm:ss') : undefined,
|
|
373
|
+ ibActiveStartTime2: this.activeDictionaryKey.postData.ibActiveStartTime2 ? format(startOfMinute(this.activeDictionaryKey.postData.ibActiveStartTime2), 'yyyy-MM-dd HH:mm:ss') : undefined,
|
|
374
|
+ ibActiveEndTime2: this.activeDictionaryKey.postData.ibActiveEndTime2 ? format(endOfMinute(this.activeDictionaryKey.postData.ibActiveEndTime2), 'yyyy-MM-dd HH:mm:ss') : undefined,
|
|
375
|
+ ibDefaultStartTime: this.activeDictionaryKey.postData.ibDefaultStartTime ? format(startOfMinute(this.activeDictionaryKey.postData.ibDefaultStartTime), 'yyyy-MM-dd HH:mm:ss') : undefined,
|
|
376
|
+ ibDefaultEndTime: this.activeDictionaryKey.postData.ibDefaultEndTime ? format(endOfMinute(this.activeDictionaryKey.postData.ibDefaultEndTime), 'yyyy-MM-dd HH:mm:ss') : undefined,
|
|
377
|
+ ibDefaultDayStart: this.activeDictionaryKey.postData.ibDefaultDayStart[0].checked ? 1 : 0,
|
|
378
|
+ ibDefaultDayEnd: this.activeDictionaryKey.postData.ibDefaultDayEnd[0].checked ? 1 : 0,
|
|
379
|
+ ib2ActiveStartTime1: this.activeDictionaryKey.postData.ib2ActiveStartTime1 ? format(startOfMinute(this.activeDictionaryKey.postData.ib2ActiveStartTime1), 'yyyy-MM-dd HH:mm:ss') : undefined,
|
|
380
|
+ ib2ActiveEndTime1: this.activeDictionaryKey.postData.ib2ActiveEndTime1 ? format(endOfMinute(this.activeDictionaryKey.postData.ib2ActiveEndTime1), 'yyyy-MM-dd HH:mm:ss') : undefined,
|
|
381
|
+ ib2ActiveStartTime2: this.activeDictionaryKey.postData.ib2ActiveStartTime2 ? format(startOfMinute(this.activeDictionaryKey.postData.ib2ActiveStartTime2), 'yyyy-MM-dd HH:mm:ss') : undefined,
|
|
382
|
+ ib2ActiveEndTime2: this.activeDictionaryKey.postData.ib2ActiveEndTime2 ? format(endOfMinute(this.activeDictionaryKey.postData.ib2ActiveEndTime2), 'yyyy-MM-dd HH:mm:ss') : undefined,
|
|
383
|
+ ib2DefaultStartTime: this.activeDictionaryKey.postData.ib2DefaultStartTime ? format(startOfMinute(this.activeDictionaryKey.postData.ib2DefaultStartTime), 'yyyy-MM-dd HH:mm:ss') : undefined,
|
|
384
|
+ ib2DefaultEndTime: this.activeDictionaryKey.postData.ib2DefaultEndTime ? format(endOfMinute(this.activeDictionaryKey.postData.ib2DefaultEndTime), 'yyyy-MM-dd HH:mm:ss') : undefined,
|
|
385
|
+ ib2DefaultDayStart: this.activeDictionaryKey.postData.ib2DefaultDayStart[0].checked ? 1 : 0,
|
|
386
|
+ ib2DefaultDayEnd: this.activeDictionaryKey.postData.ib2DefaultDayEnd[0].checked ? 1 : 0,
|
|
387
|
+ };
|
|
388
|
+ console.log(postData);
|
|
389
|
+ this.btnLoading = true;
|
|
390
|
+ this.mainService
|
|
391
|
+ .simplePost("addData", "taskTypeConfig", postData)
|
|
392
|
+ .subscribe((result) => {
|
|
393
|
+ this.btnLoading = false;
|
|
394
|
+ if (result.status == 200) {
|
|
395
|
+ this.message.success("保存成功!");
|
|
396
|
+ this.getConfig();
|
|
397
|
+ }else{
|
|
398
|
+ this.message.success("保存失败!");
|
|
399
|
+ }
|
|
400
|
+ });
|
|
401
|
+ }
|
|
402
|
+
|
|
403
|
+ //初始化
|
|
404
|
+ init() {
|
|
405
|
+ this.loading = true;
|
|
406
|
+ this.getTaskType();
|
|
407
|
+ }
|
|
408
|
+
|
|
409
|
+ //获取任务类型
|
|
410
|
+ getTaskType() {
|
|
411
|
+ this.loading = true;
|
|
412
|
+ let postData = {
|
|
413
|
+ idx: 0,
|
|
414
|
+ sum: 1,
|
|
415
|
+ taskType: {
|
|
416
|
+ simpleQuery: true,
|
|
417
|
+ hosId: {
|
|
418
|
+ id: this.hosId
|
|
419
|
+ },
|
|
420
|
+ associationType: {
|
|
421
|
+ key: 'association_types',
|
|
422
|
+ value: 'inspect',
|
|
423
|
+ }
|
|
424
|
+ }
|
|
425
|
+ };
|
|
426
|
+ this.mainService
|
|
427
|
+ .getFetchDataList("simple/data", "taskType", postData)
|
|
428
|
+ .subscribe((result) => {
|
|
429
|
+ this.loading = false;
|
|
430
|
+ if (result.status == 200) {
|
|
431
|
+ this.tasktype = result.list[0] || {};
|
|
432
|
+ this.getConfig();
|
|
433
|
+ }
|
|
434
|
+ });
|
|
435
|
+ }
|
|
436
|
+
|
|
437
|
+ // 获取配置
|
|
438
|
+ getConfig() {
|
|
439
|
+ this.loading = true;
|
|
440
|
+ let postData = {
|
|
441
|
+ idx: 0,
|
|
442
|
+ sum: 1,
|
|
443
|
+ taskTypeConfig: {
|
|
444
|
+ taskTypeDTO: {
|
|
445
|
+ hosId: {
|
|
446
|
+ id: this.hosId
|
|
447
|
+ },
|
|
448
|
+ associationType: this.tasktype.associationType,
|
|
449
|
+ }
|
|
450
|
+ }
|
|
451
|
+ };
|
|
452
|
+ this.mainService
|
|
453
|
+ .getFetchDataList("simple/data", "taskTypeConfig", postData)
|
|
454
|
+ .subscribe((result) => {
|
|
455
|
+ this.loading = false;
|
|
456
|
+ if (result.status == 200) {
|
|
457
|
+ this.configs = result.list[0] || {};
|
|
458
|
+ this.activeDictionaryKey.postData.ibActiveStartTime1 = this.configs.ibActiveStartTime1 || undefined;
|
|
459
|
+ this.activeDictionaryKey.postData.ibActiveEndTime1 = this.configs.ibActiveEndTime1 || undefined;
|
|
460
|
+ this.activeDictionaryKey.postData.ibActiveStartTime2 = this.configs.ibActiveStartTime2 || undefined;
|
|
461
|
+ this.activeDictionaryKey.postData.ibActiveEndTime2 = this.configs.ibActiveEndTime2 || undefined;
|
|
462
|
+ this.activeDictionaryKey.postData.ibDefaultStartTime = this.configs.ibDefaultStartTime || undefined;
|
|
463
|
+ this.activeDictionaryKey.postData.ibDefaultEndTime = this.configs.ibDefaultEndTime || undefined;
|
|
464
|
+ this.activeDictionaryKey.postData.ibDefaultDayStart[0].checked = this.configs.ibDefaultDayStart == 1;
|
|
465
|
+ this.activeDictionaryKey.postData.ibDefaultDayEnd[0].checked = this.configs.ibDefaultDayEnd == 1;
|
|
466
|
+
|
|
467
|
+ this.activeDictionaryKey.postData.ib2ActiveStartTime1 = this.configs.ib2ActiveStartTime1 || undefined;
|
|
468
|
+ this.activeDictionaryKey.postData.ib2ActiveEndTime1 = this.configs.ib2ActiveEndTime1 || undefined;
|
|
469
|
+ this.activeDictionaryKey.postData.ib2ActiveStartTime2 = this.configs.ib2ActiveStartTime2 || undefined;
|
|
470
|
+ this.activeDictionaryKey.postData.ib2ActiveEndTime2 = this.configs.ib2ActiveEndTime2 || undefined;
|
|
471
|
+ this.activeDictionaryKey.postData.ib2DefaultStartTime = this.configs.ib2DefaultStartTime || undefined;
|
|
472
|
+ this.activeDictionaryKey.postData.ib2DefaultEndTime = this.configs.ib2DefaultEndTime || undefined;
|
|
473
|
+ this.activeDictionaryKey.postData.ib2DefaultDayStart[0].checked = this.configs.ib2DefaultDayStart == 1;
|
|
474
|
+ this.activeDictionaryKey.postData.ib2DefaultDayEnd[0].checked = this.configs.ib2DefaultDayEnd == 1;
|
|
475
|
+ }
|
|
476
|
+ });
|
|
477
|
+ }
|
257
|
478
|
}
|