|
@@ -0,0 +1,147 @@
|
|
1
|
+import { Component, OnInit } from "@angular/core";
|
|
2
|
+import { MainService } from 'src/app/services/main.service';
|
|
3
|
+import { ToolService } from 'src/app/services/tool.service';
|
|
4
|
+import { NzMessageService } from 'ng-zorro-antd';
|
|
5
|
+
|
|
6
|
+@Component({
|
|
7
|
+ selector: "app-blood-products-config",
|
|
8
|
+ templateUrl: "./blood-products-config.component.html",
|
|
9
|
+ styleUrls: ["./blood-products-config.component.less"],
|
|
10
|
+})
|
|
11
|
+export class BloodProductsConfigComponent implements OnInit {
|
|
12
|
+ loading:boolean = false; //页面加载的loading
|
|
13
|
+ btnLoading:boolean = false; //提交按钮的loading
|
|
14
|
+ tabModalName:string = 'characteristics'; //当前选中的tab
|
|
15
|
+ hosId = this.tool.getCurrentHospital().id; //当前院区
|
|
16
|
+ // 交接方式
|
|
17
|
+ handoverMode:any;
|
|
18
|
+ handoverModes:any[] = [];
|
|
19
|
+ // 核对方式
|
|
20
|
+ checkModes:any[] = [];
|
|
21
|
+ // 签到方式
|
|
22
|
+ checkInModes:any[] = [];
|
|
23
|
+ // 自动关单
|
|
24
|
+ automaticCustomsOrders:any[] = [];
|
|
25
|
+ // 自动建单
|
|
26
|
+ autoCreateOrders:any[] = [
|
|
27
|
+ {label:'是否开启',value: 0}
|
|
28
|
+ ];
|
|
29
|
+ // 配置
|
|
30
|
+ configs:any = {};
|
|
31
|
+ constructor(private mainService: MainService,private tool: ToolService,private msg: NzMessageService) {}
|
|
32
|
+
|
|
33
|
+ ngOnInit():void {
|
|
34
|
+ // todo
|
|
35
|
+ this.getHandoverModes();
|
|
36
|
+ this.getCheckModes();
|
|
37
|
+ this.getCheckInModes();
|
|
38
|
+
|
|
39
|
+ }
|
|
40
|
+
|
|
41
|
+ // 切换tab
|
|
42
|
+ tabModal(tabModalName:string){
|
|
43
|
+ this.tabModalName = tabModalName;
|
|
44
|
+ }
|
|
45
|
+ // 保存
|
|
46
|
+ submitForm() {
|
|
47
|
+ if(!this.handoverMode){
|
|
48
|
+ this.msg.create("warning", "请选择交接方式!");
|
|
49
|
+ return;
|
|
50
|
+ }
|
|
51
|
+ let checkType = this.checkModes.find(v => v.checked);
|
|
52
|
+ if(!checkType){
|
|
53
|
+ this.msg.create("warning", "请选择核对方式!");
|
|
54
|
+ return;
|
|
55
|
+ }
|
|
56
|
+ let signTypeIds = this.checkInModes.filter(v => v.checked).map(v => v.value).toString();
|
|
57
|
+ let closeTypeIds = this.automaticCustomsOrders.filter(v => v.checked).map(v => v.value).toString();
|
|
58
|
+ let postData = {
|
|
59
|
+ id: this.configs.id,
|
|
60
|
+ taskType: this.configs.taskType,
|
|
61
|
+ hosId: this.hosId,
|
|
62
|
+ autoCreate: this.autoCreateOrders[0].checked?1:0,
|
|
63
|
+ handoverType: {id:this.handoverMode},
|
|
64
|
+ checkType: {id:checkType.value},
|
|
65
|
+ signTypeIds: signTypeIds || undefined,
|
|
66
|
+ closeTypeIds: closeTypeIds || undefined,
|
|
67
|
+ };
|
|
68
|
+ this.btnLoading = true;
|
|
69
|
+ this.mainService
|
|
70
|
+ .simplePost("addData", "taskTypeConfig", postData)
|
|
71
|
+ .subscribe((result) => {
|
|
72
|
+ this.btnLoading = false;
|
|
73
|
+ if (result.status == 200) {
|
|
74
|
+ this.getConfig();
|
|
75
|
+ }
|
|
76
|
+ });
|
|
77
|
+ }
|
|
78
|
+
|
|
79
|
+ //获取交接方式
|
|
80
|
+ getHandoverModes() {
|
|
81
|
+ this.mainService.getDictionary("list", "ttconfig_handover_type").subscribe((data) => {
|
|
82
|
+ this.handoverModes = data;
|
|
83
|
+ this.handoverMode = data[0].id;
|
|
84
|
+ });
|
|
85
|
+ }
|
|
86
|
+ //获取核对方式
|
|
87
|
+ getCheckModes() {
|
|
88
|
+ this.mainService.getDictionary("list", "ttconfig_check_type").subscribe((data) => {
|
|
89
|
+ this.checkModes = data.map(v => ({label:v.name, value: v.id}));
|
|
90
|
+ });
|
|
91
|
+ }
|
|
92
|
+ //获取签到方式
|
|
93
|
+ getCheckInModes() {
|
|
94
|
+ this.loading = true;
|
|
95
|
+ this.mainService.getDictionary("list", "ttconfig_sign_type").subscribe((data) => {
|
|
96
|
+ this.checkInModes = data.map(v => ({label:v.name, value: v.id}));
|
|
97
|
+ this.getAutomaticCustomsOrders();
|
|
98
|
+ });
|
|
99
|
+ }
|
|
100
|
+ //获取自动关单
|
|
101
|
+ getAutomaticCustomsOrders() {
|
|
102
|
+ this.mainService.getDictionary("list", "ttconfig_close_type").subscribe((data) => {
|
|
103
|
+ this.automaticCustomsOrders = data.map(v => ({label:v.name, value: v.id}));
|
|
104
|
+ this.getConfig();
|
|
105
|
+ });
|
|
106
|
+ }
|
|
107
|
+ // 获取配置
|
|
108
|
+ getConfig() {
|
|
109
|
+ this.loading = true;
|
|
110
|
+ let postData = {
|
|
111
|
+ idx: 0,
|
|
112
|
+ sum: 10,
|
|
113
|
+ taskTypeConfig: {
|
|
114
|
+ taskTypeDTO: {
|
|
115
|
+ hosId: {
|
|
116
|
+ id: this.hosId
|
|
117
|
+ },
|
|
118
|
+ ordinaryField: {
|
|
119
|
+ value: 'blood'
|
|
120
|
+ }
|
|
121
|
+ }
|
|
122
|
+ }
|
|
123
|
+ };
|
|
124
|
+ this.mainService
|
|
125
|
+ .getFetchDataList("simple/data", "taskTypeConfig", postData)
|
|
126
|
+ .subscribe((result) => {
|
|
127
|
+ this.loading = false;
|
|
128
|
+ if (result.status == 200) {
|
|
129
|
+ this.configs = result.list[0];
|
|
130
|
+ this.handoverMode = this.configs.handoverType?this.configs.handoverType.id:undefined;
|
|
131
|
+ this.checkModes = this.configs.checkType?[{label:this.configs.checkType.name, value: this.configs.checkType.id, checked: true}]:[];
|
|
132
|
+ this.autoCreateOrders[0].checked = this.configs.autoCreate == 1;
|
|
133
|
+
|
|
134
|
+ if(this.configs.signTypeIds){
|
|
135
|
+ let ids = this.configs.signTypeIds.split(',');
|
|
136
|
+ this.checkInModes = this.checkInModes.map(v => ({...v, checked: ids.includes(v.value.toString())}));
|
|
137
|
+ }
|
|
138
|
+
|
|
139
|
+ if(this.configs.closeTypeIds){
|
|
140
|
+ let ids = this.configs.closeTypeIds.split(',');
|
|
141
|
+ this.automaticCustomsOrders = this.automaticCustomsOrders.map(v => ({...v, checked: ids.includes(v.value.toString())}));
|
|
142
|
+ }
|
|
143
|
+ }
|
|
144
|
+ });
|
|
145
|
+ }
|
|
146
|
+}
|
|
147
|
+
|