|
@@ -54,7 +54,6 @@ export class DataDictionaryComponent implements OnInit {
|
54
|
54
|
this.coopBtns = this.tool.initCoopBtns(this.route);
|
55
|
55
|
this.hosId = this.tool.getCurrentHospital().id;
|
56
|
56
|
this.getDictionaryList();
|
57
|
|
- this.getParentList();
|
58
|
57
|
this.tableHeight = document.body.clientHeight - 312;
|
59
|
58
|
}
|
60
|
59
|
|
|
@@ -65,6 +64,13 @@ export class DataDictionaryComponent implements OnInit {
|
65
|
64
|
id: -1,
|
66
|
65
|
dictionaryName: '被服种类',
|
67
|
66
|
key: 'clothes_type',
|
|
67
|
+ type: 'dictionaryTree',
|
|
68
|
+ },
|
|
69
|
+ {
|
|
70
|
+ id: -2,
|
|
71
|
+ dictionaryName: '统计分类',
|
|
72
|
+ key: 'statistics_date_type',
|
|
73
|
+ type: 'dictionary',
|
68
|
74
|
}
|
69
|
75
|
];
|
70
|
76
|
if (Object.keys(this.checkedDictionary).length) {
|
|
@@ -106,19 +112,31 @@ export class DataDictionaryComponent implements OnInit {
|
106
|
112
|
// 获取选中数据字典列表
|
107
|
113
|
getAll() {
|
108
|
114
|
this.dictionaryLoading = true;
|
109
|
|
- let postData = {
|
110
|
|
- idx: 0,
|
111
|
|
- sum: 9999,
|
112
|
|
- dictionaryTree: {
|
113
|
|
- hosId: this.hosId,
|
114
|
|
- level: 2,
|
115
|
|
- parent: this.searchDto.parent || undefined,
|
116
|
|
- key: this.checkedDictionary.key,
|
117
|
|
- deleted: 0,
|
118
|
|
- },
|
119
|
|
- };
|
|
115
|
+ let postData = {};
|
|
116
|
+ if(this.checkedDictionary.type === 'dictionary'){
|
|
117
|
+ postData = {
|
|
118
|
+ idx: 0,
|
|
119
|
+ sum: 9999,
|
|
120
|
+ dictionary: {
|
|
121
|
+ key: this.checkedDictionary.key,
|
|
122
|
+ deleted: 0,
|
|
123
|
+ },
|
|
124
|
+ }
|
|
125
|
+ }else if(this.checkedDictionary.type === 'dictionaryTree'){
|
|
126
|
+ postData = {
|
|
127
|
+ idx: 0,
|
|
128
|
+ sum: 9999,
|
|
129
|
+ dictionaryTree: {
|
|
130
|
+ hosId: this.hosId,
|
|
131
|
+ level: 2,
|
|
132
|
+ parent: this.searchDto.parent || undefined,
|
|
133
|
+ key: this.checkedDictionary.key,
|
|
134
|
+ deleted: 0,
|
|
135
|
+ },
|
|
136
|
+ }
|
|
137
|
+ }
|
120
|
138
|
this.mainService
|
121
|
|
- .getFetchDataList("simple/data", "dictionaryTree", postData)
|
|
139
|
+ .getFetchDataList("simple/data", this.checkedDictionary.type, postData)
|
122
|
140
|
.subscribe((result) => {
|
123
|
141
|
this.dictionaryLoading = false;
|
124
|
142
|
if (result.status == 200) {
|
|
@@ -134,6 +152,7 @@ export class DataDictionaryComponent implements OnInit {
|
134
|
152
|
this.checkedDictionary = data ? data : {};
|
135
|
153
|
this.mapOfCheckedId = {};
|
136
|
154
|
this.getAll();
|
|
155
|
+ this.checkedDictionary.type === 'dictionaryTree' && this.getParentList();
|
137
|
156
|
}
|
138
|
157
|
|
139
|
158
|
selectedUser(data) {
|
|
@@ -161,22 +180,31 @@ export class DataDictionaryComponent implements OnInit {
|
161
|
180
|
|
162
|
181
|
// 新增/编辑模态框
|
163
|
182
|
showModal(e, type, data?) {
|
|
183
|
+ e.stopPropagation();
|
164
|
184
|
this.dictionaryModal = true;
|
165
|
185
|
this.add = type == "add";
|
166
|
186
|
if (type == "edit") {
|
167
|
187
|
this.initForm();
|
168
|
188
|
this.dataEdit = data;
|
169
|
|
- this.validateForm.controls.key.setValue(data.key);
|
170
|
|
- this.validateForm.controls.parent.setValue(data.parent);
|
171
|
|
- this.validateForm.controls.name.setValue(data.name);
|
172
|
|
- this.validateForm.controls.value.setValue(data.value);
|
173
|
|
- this.validateForm.controls.orders.setValue(data.orders);
|
174
|
|
- this.validateForm.controls.extra3.setValue(data.extra3);
|
175
|
|
- this.validateForm.controls.desc.setValue(data.desc);
|
|
189
|
+ if(this.checkedDictionary.type === 'dictionaryTree'){
|
|
190
|
+ this.validateForm.controls.key.setValue(data.key);
|
|
191
|
+ this.validateForm.controls.parent.setValue(data.parent);
|
|
192
|
+ this.validateForm.controls.name.setValue(data.name);
|
|
193
|
+ this.validateForm.controls.value.setValue(data.value);
|
|
194
|
+ this.validateForm.controls.orders.setValue(data.orders);
|
|
195
|
+ this.validateForm.controls.extra3.setValue(data.extra3);
|
|
196
|
+ this.validateForm.controls.desc.setValue(data.desc);
|
|
197
|
+ } else if(this.checkedDictionary.type === 'dictionary'){
|
|
198
|
+ this.validateForm.controls.key.setValue(data.key);
|
|
199
|
+ this.validateForm.controls.name.setValue(data.name);
|
|
200
|
+ this.validateForm.controls.value.setValue(data.value);
|
|
201
|
+ this.validateForm.controls.orders.setValue(data.orders);
|
|
202
|
+ this.validateForm.controls.desc.setValue(data.desc);
|
|
203
|
+ }
|
|
204
|
+
|
176
|
205
|
} else {
|
177
|
206
|
this.initForm();
|
178
|
207
|
}
|
179
|
|
- e.stopPropagation();
|
180
|
208
|
}
|
181
|
209
|
|
182
|
210
|
// 隐藏模态框
|
|
@@ -186,15 +214,26 @@ export class DataDictionaryComponent implements OnInit {
|
186
|
214
|
|
187
|
215
|
// 初始化新增form表单dictionary
|
188
|
216
|
initForm() {
|
189
|
|
- this.validateForm = this.fb.group({
|
190
|
|
- key: [this.checkedDictionary.key, [Validators.required]],
|
191
|
|
- parent: [null, [Validators.required]],
|
192
|
|
- name: [null, [Validators.required]],
|
193
|
|
- value: [null, [Validators.required]],
|
194
|
|
- orders: [0, [Validators.required]],
|
195
|
|
- extra3: [0, [Validators.required]],
|
196
|
|
- desc: [null, [Validators.required]],
|
197
|
|
- });
|
|
217
|
+ if(this.checkedDictionary.type === 'dictionaryTree'){
|
|
218
|
+ this.validateForm = this.fb.group({
|
|
219
|
+ key: [this.checkedDictionary.key, [Validators.required]],
|
|
220
|
+ parent: [null, [Validators.required]],
|
|
221
|
+ name: [null, [Validators.required]],
|
|
222
|
+ value: [null, [Validators.required]],
|
|
223
|
+ orders: [0, [Validators.required]],
|
|
224
|
+ extra3: [0, [Validators.required]],
|
|
225
|
+ desc: [null, [Validators.required]],
|
|
226
|
+ });
|
|
227
|
+ } else if(this.checkedDictionary.type === 'dictionary'){
|
|
228
|
+ this.validateForm = this.fb.group({
|
|
229
|
+ key: [this.checkedDictionary.key, [Validators.required]],
|
|
230
|
+ name: [null, [Validators.required]],
|
|
231
|
+ value: [null, [Validators.required]],
|
|
232
|
+ orders: [0, [Validators.required]],
|
|
233
|
+ desc: [null, [Validators.required]],
|
|
234
|
+ });
|
|
235
|
+ }
|
|
236
|
+
|
198
|
237
|
}
|
199
|
238
|
|
200
|
239
|
// 新增/编辑提交
|
|
@@ -207,31 +246,52 @@ export class DataDictionaryComponent implements OnInit {
|
207
|
246
|
this.btnLoading = true;
|
208
|
247
|
let postData;
|
209
|
248
|
|
210
|
|
- if (this.add) {
|
211
|
|
- postData = {
|
212
|
|
- hosId: this.hosId,
|
213
|
|
- key: this.validateForm.value.key,
|
214
|
|
- parent: this.validateForm.value.parent,
|
215
|
|
- name: this.validateForm.value.name,
|
216
|
|
- value: this.validateForm.value.value,
|
217
|
|
- orders: this.validateForm.value.orders,
|
218
|
|
- extra3: this.validateForm.value.extra3,
|
219
|
|
- desc: this.validateForm.value.desc,
|
220
|
|
- level: 2,
|
221
|
|
- };
|
222
|
|
- } else {
|
223
|
|
- postData = {
|
224
|
|
- hosId: this.hosId,
|
225
|
|
- key: this.validateForm.value.key,
|
226
|
|
- parent: this.validateForm.value.parent,
|
227
|
|
- name: this.validateForm.value.name,
|
228
|
|
- value: this.validateForm.value.value,
|
229
|
|
- orders: this.validateForm.value.orders,
|
230
|
|
- extra3: this.validateForm.value.extra3,
|
231
|
|
- desc: this.validateForm.value.desc,
|
232
|
|
- id: this.dataEdit.id,
|
233
|
|
- level: 2,
|
234
|
|
- };
|
|
249
|
+ if(this.checkedDictionary.type === 'dictionaryTree'){
|
|
250
|
+ if (this.add) {
|
|
251
|
+ postData = {
|
|
252
|
+ hosId: this.hosId,
|
|
253
|
+ key: this.validateForm.value.key,
|
|
254
|
+ parent: this.validateForm.value.parent,
|
|
255
|
+ name: this.validateForm.value.name,
|
|
256
|
+ value: this.validateForm.value.value,
|
|
257
|
+ orders: this.validateForm.value.orders,
|
|
258
|
+ extra3: this.validateForm.value.extra3,
|
|
259
|
+ desc: this.validateForm.value.desc,
|
|
260
|
+ level: 2,
|
|
261
|
+ };
|
|
262
|
+ } else {
|
|
263
|
+ postData = {
|
|
264
|
+ hosId: this.hosId,
|
|
265
|
+ key: this.validateForm.value.key,
|
|
266
|
+ parent: this.validateForm.value.parent,
|
|
267
|
+ name: this.validateForm.value.name,
|
|
268
|
+ value: this.validateForm.value.value,
|
|
269
|
+ orders: this.validateForm.value.orders,
|
|
270
|
+ extra3: this.validateForm.value.extra3,
|
|
271
|
+ desc: this.validateForm.value.desc,
|
|
272
|
+ id: this.dataEdit.id,
|
|
273
|
+ level: 2,
|
|
274
|
+ };
|
|
275
|
+ }
|
|
276
|
+ }else if(this.checkedDictionary.type === 'dictionary'){
|
|
277
|
+ if (this.add) {
|
|
278
|
+ postData = {
|
|
279
|
+ key: this.validateForm.value.key,
|
|
280
|
+ name: this.validateForm.value.name,
|
|
281
|
+ value: this.validateForm.value.value,
|
|
282
|
+ orders: this.validateForm.value.orders,
|
|
283
|
+ desc: this.validateForm.value.desc,
|
|
284
|
+ };
|
|
285
|
+ } else {
|
|
286
|
+ postData = {
|
|
287
|
+ key: this.validateForm.value.key,
|
|
288
|
+ name: this.validateForm.value.name,
|
|
289
|
+ value: this.validateForm.value.value,
|
|
290
|
+ orders: this.validateForm.value.orders,
|
|
291
|
+ desc: this.validateForm.value.desc,
|
|
292
|
+ id: this.dataEdit.id,
|
|
293
|
+ };
|
|
294
|
+ }
|
235
|
295
|
}
|
236
|
296
|
this.addHandler(postData);
|
237
|
297
|
}
|
|
@@ -239,7 +299,7 @@ export class DataDictionaryComponent implements OnInit {
|
239
|
299
|
//新增/编辑
|
240
|
300
|
addHandler(postData) {
|
241
|
301
|
this.mainService
|
242
|
|
- .simplePost("addData", "dictionaryTree", postData)
|
|
302
|
+ .simplePost("addData", this.checkedDictionary.type, postData)
|
243
|
303
|
.subscribe((result) => {
|
244
|
304
|
this.hideModal();
|
245
|
305
|
this.btnLoading = false;
|
|
@@ -278,7 +338,7 @@ export class DataDictionaryComponent implements OnInit {
|
278
|
338
|
this.btnLoading = true;
|
279
|
339
|
let selectedDictionary = this.selectedDictionary.map((item) => item.id);
|
280
|
340
|
let postData = this.isDelSingle ? [this.dataEdit.id] : selectedDictionary;
|
281
|
|
- this.mainService.simplePost("rmvData", "dictionaryTree", postData).subscribe((result) => {
|
|
341
|
+ this.mainService.simplePost("rmvData", this.checkedDictionary.type, postData).subscribe((result) => {
|
282
|
342
|
this.hideDelDictionaryModal();
|
283
|
343
|
this.btnLoading = false;
|
284
|
344
|
if (result.status == 200) {
|