|
@@ -2,6 +2,7 @@ import { Component, OnInit, AfterViewInit, HostListener } from "@angular/core";
|
2
|
2
|
import { ToolService } from 'src/app/services/tool.service';
|
3
|
3
|
import { MainService } from 'src/app/services/main.service';
|
4
|
4
|
import { ActivatedRoute } from '@angular/router';
|
|
5
|
+import { FormGroup, Validators, FormBuilder } from '@angular/forms';
|
5
|
6
|
|
6
|
7
|
@Component({
|
7
|
8
|
selector: "app-washing-batch-view",
|
|
@@ -12,13 +13,15 @@ export class WashingBatchViewComponent implements OnInit, AfterViewInit {
|
12
|
13
|
constructor(
|
13
|
14
|
public tool: ToolService,
|
14
|
15
|
private mainService: MainService,
|
15
|
|
- private route: ActivatedRoute,
|
|
16
|
+ public route: ActivatedRoute,
|
|
17
|
+ private fb: FormBuilder,
|
16
|
18
|
){}
|
17
|
19
|
|
18
|
20
|
ngOnInit() {
|
19
|
21
|
this.hosId = this.tool.getCurrentHospital().id;
|
20
|
22
|
this.getParentList();
|
21
|
23
|
this.getChildList();
|
|
24
|
+ this.getDictionaryList();
|
22
|
25
|
this.getList();
|
23
|
26
|
}
|
24
|
27
|
|
|
@@ -43,24 +46,40 @@ export class WashingBatchViewComponent implements OnInit, AfterViewInit {
|
43
|
46
|
hosId:any;
|
44
|
47
|
searchDto:any = {
|
45
|
48
|
parent: null,
|
|
49
|
+ child: null,
|
46
|
50
|
}
|
47
|
51
|
parentList: Array<any> = []; //父级分类数据字典信息
|
48
|
52
|
childList: Array<any> = []; //分类数据字典信息
|
49
|
53
|
rows:any[] = [];
|
50
|
54
|
totalData:any = {};
|
51
|
55
|
|
|
56
|
+ // 查看业务数据
|
|
57
|
+ washingExceptionModalShow = false; //业务数据弹窗开关
|
|
58
|
+ viewDetail() {
|
|
59
|
+ this.washingExceptionModalShow = true;
|
|
60
|
+ }
|
|
61
|
+ // 关闭业务数据弹窗
|
|
62
|
+ closeModelWashingException(e) {
|
|
63
|
+ this.washingExceptionModalShow = JSON.parse(e).show;
|
|
64
|
+ }
|
|
65
|
+
|
52
|
66
|
// 全选
|
53
|
67
|
checkAll(value: boolean): void {
|
54
|
68
|
this.listOfData.forEach((item) => {
|
55
|
|
- this.mapOfCheckedId[item[0]] = value;
|
|
69
|
+ if (item[0][1] != 5) {
|
|
70
|
+ this.mapOfCheckedId[item[0][0]] = value;
|
|
71
|
+ }
|
56
|
72
|
});
|
57
|
73
|
this.refreshStatus();
|
58
|
74
|
}
|
59
|
75
|
|
60
|
76
|
// 单选
|
61
|
77
|
refreshStatus(): void {
|
62
|
|
- this.isAllDisplayDataChecked = this.listOfData.every(
|
63
|
|
- (item) => this.mapOfCheckedId[item[0]]
|
|
78
|
+ let listOfData = this.listOfData.filter(
|
|
79
|
+ (item) => item[0][1] != 5
|
|
80
|
+ );
|
|
81
|
+ this.isAllDisplayDataChecked = listOfData.every(
|
|
82
|
+ (item) => this.mapOfCheckedId[item[0][0]]
|
64
|
83
|
);
|
65
|
84
|
let arr = [];
|
66
|
85
|
for (var k in this.mapOfCheckedId) {
|
|
@@ -73,7 +92,10 @@ export class WashingBatchViewComponent implements OnInit, AfterViewInit {
|
73
|
92
|
|
74
|
93
|
// 整行操作
|
75
|
94
|
selectedListData(data) {
|
76
|
|
- this.mapOfCheckedId[data[0]] = !this.mapOfCheckedId[data[0]];
|
|
95
|
+ if (data[0][1] == 5) {
|
|
96
|
+ return;
|
|
97
|
+ }
|
|
98
|
+ this.mapOfCheckedId[data[0][0]] = !this.mapOfCheckedId[data[0][0]];
|
77
|
99
|
this.refreshStatus();
|
78
|
100
|
}
|
79
|
101
|
|
|
@@ -98,6 +120,14 @@ export class WashingBatchViewComponent implements OnInit, AfterViewInit {
|
98
|
120
|
});
|
99
|
121
|
}
|
100
|
122
|
|
|
123
|
+ reset(){
|
|
124
|
+ this.searchDto = {
|
|
125
|
+ parent: null,
|
|
126
|
+ child: null,
|
|
127
|
+ }
|
|
128
|
+ this.getList();
|
|
129
|
+ }
|
|
130
|
+
|
101
|
131
|
// 获取分类
|
102
|
132
|
getChildList() {
|
103
|
133
|
let postData = {
|
|
@@ -136,10 +166,49 @@ export class WashingBatchViewComponent implements OnInit, AfterViewInit {
|
136
|
166
|
hosId: this.hosId,
|
137
|
167
|
batchId: this.route.snapshot.paramMap.get("id"),
|
138
|
168
|
deptIds: this.checkedDepIds.toString(),
|
|
169
|
+ type: 'clothingSend',
|
|
170
|
+ orderId: 0,
|
139
|
171
|
};
|
140
|
|
- this.mainService.clothesWashing(postData, 'batchBack').subscribe((data) => {
|
|
172
|
+ this.mainService.transflow(postData, 'createRemandOrder').subscribe((data) => {
|
141
|
173
|
this.loading3 = false;
|
142
|
174
|
this.delModal = false;
|
|
175
|
+ if (data.data && data.data.state == 200) {
|
|
176
|
+ this.showPromptModal("操作", true, "");
|
|
177
|
+ } else {
|
|
178
|
+ this.showPromptModal("操作", false, data.data && data.data.msg);
|
|
179
|
+ }
|
|
180
|
+ });
|
|
181
|
+ }
|
|
182
|
+
|
|
183
|
+ //修改数量
|
|
184
|
+ btnLoading = false;
|
|
185
|
+ washingModal: boolean = false; //模态框
|
|
186
|
+ washingCoopData:any = {};
|
|
187
|
+ showWashingModal(row) {
|
|
188
|
+ this.washingCoopData = row;
|
|
189
|
+ this.washingModal = true;
|
|
190
|
+ this.initForm();
|
|
191
|
+ }
|
|
192
|
+ hideWashingModal() {
|
|
193
|
+ this.washingModal = false;
|
|
194
|
+ }
|
|
195
|
+ confirmWashing() {
|
|
196
|
+ for (const i in this.validateForm.controls) {
|
|
197
|
+ this.validateForm.controls[i].markAsDirty();
|
|
198
|
+ this.validateForm.controls[i].updateValueAndValidity();
|
|
199
|
+ }
|
|
200
|
+ if (this.validateForm.invalid) return;
|
|
201
|
+ this.btnLoading = true;
|
|
202
|
+ let postData: any = {
|
|
203
|
+ hosId: this.hosId,
|
|
204
|
+ id: this.washingCoopData.id,
|
|
205
|
+ sendBackNum: this.validateForm.value.sendBackNum,
|
|
206
|
+ clothesExceptionResId: this.validateForm.value.clothesExceptionResId,
|
|
207
|
+ remarks: this.validateForm.value.remarks,
|
|
208
|
+ };
|
|
209
|
+ this.mainService.simplePost("addData", "clothesWashing", postData).subscribe((data) => {
|
|
210
|
+ this.btnLoading = false;
|
|
211
|
+ this.washingModal = false;
|
143
|
212
|
if (data.status == 200) {
|
144
|
213
|
this.showPromptModal("操作", true, "");
|
145
|
214
|
} else {
|
|
@@ -148,6 +217,16 @@ export class WashingBatchViewComponent implements OnInit, AfterViewInit {
|
148
|
217
|
});
|
149
|
218
|
}
|
150
|
219
|
|
|
220
|
+ // 初始化form表单
|
|
221
|
+ validateForm: FormGroup;
|
|
222
|
+ initForm() {
|
|
223
|
+ this.validateForm = this.fb.group({
|
|
224
|
+ sendBackNum: [0, [Validators.required]],
|
|
225
|
+ clothesExceptionResId: [null, [Validators.required]],
|
|
226
|
+ remarks: [null, [Validators.required]],
|
|
227
|
+ });
|
|
228
|
+ }
|
|
229
|
+
|
151
|
230
|
// 展示信息提示框(con:提示信息,success:操作是否成功,promptInfo:操作结果提示信息)
|
152
|
231
|
promptContent: string; //操作提示框提示信息
|
153
|
232
|
ifSuccess: boolean; //操作成功/失败
|
|
@@ -164,13 +243,27 @@ export class WashingBatchViewComponent implements OnInit, AfterViewInit {
|
164
|
243
|
this.getList();
|
165
|
244
|
}
|
166
|
245
|
|
|
246
|
+ // 点击数字
|
|
247
|
+ clickNum(e, row){
|
|
248
|
+ e.stopPropagation();
|
|
249
|
+ this.showWashingModal(row)
|
|
250
|
+ }
|
|
251
|
+
|
|
252
|
+ dictionaryList: Array<any> = []; //数据字典信息
|
|
253
|
+ // 数据字典列表
|
|
254
|
+ getDictionaryList() {
|
|
255
|
+ this.mainService.getDictionary("list", "clothes_exception").subscribe((data:any) => {
|
|
256
|
+ this.dictionaryList = data || [];
|
|
257
|
+ })
|
|
258
|
+ }
|
|
259
|
+
|
167
|
260
|
// 表格数据
|
168
|
261
|
getList() {
|
169
|
262
|
let postData: any = {
|
170
|
263
|
hosId: this.hosId,
|
171
|
264
|
batchId: this.route.snapshot.paramMap.get("id"),
|
172
|
|
- clothesTypeParent: undefined,
|
173
|
|
- clothesType: undefined,
|
|
265
|
+ clothesTypeParent: this.searchDto.parent,
|
|
266
|
+ clothesType: this.searchDto.child,
|
174
|
267
|
};
|
175
|
268
|
this.loading = true;
|
176
|
269
|
this.mainService
|
|
@@ -179,15 +272,12 @@ export class WashingBatchViewComponent implements OnInit, AfterViewInit {
|
179
|
272
|
this.loading = false;
|
180
|
273
|
if(result.status == 200){
|
181
|
274
|
let rows = result.head || [];
|
182
|
|
- this.rows = ['', ...rows.map(v => v.name), '','件数', '费用/元'];
|
|
275
|
+ this.rows = [['id', 'clothesState', ''], rows.map(v => v.name), ['','件数', '费用/元']];
|
183
|
276
|
let listOfData_res = result.data || [];
|
184
|
277
|
this.listOfData = listOfData_res.map(v => ([
|
185
|
|
- v.id,
|
186
|
|
- v.dept,
|
187
|
|
- ...v.clothesWashingDTOS.map(vv => vv.sendBackNum),
|
188
|
|
- '',
|
189
|
|
- v.nums,
|
190
|
|
- v.price,
|
|
278
|
+ [v.id, v.clothesState.value, v.dept],
|
|
279
|
+ v.clothesWashingDTOS,
|
|
280
|
+ ['', v.nums, v.price]
|
191
|
281
|
]))
|
192
|
282
|
this.totalData = result.totalData || {};
|
193
|
283
|
}
|