|
@@ -62,7 +62,7 @@ export class ConfigurationManHourComponent implements OnInit {
|
62
|
62
|
this.getScores();
|
63
|
63
|
}
|
64
|
64
|
|
65
|
|
-
|
|
65
|
+
|
66
|
66
|
// 监听单位输入
|
67
|
67
|
workUnitshow:boolean = false;
|
68
|
68
|
handleInput(event: KeyboardEvent){
|
|
@@ -73,7 +73,7 @@ export class ConfigurationManHourComponent implements OnInit {
|
73
|
73
|
this.workUnitshow = false
|
74
|
74
|
}
|
75
|
75
|
}
|
76
|
|
-
|
|
76
|
+
|
77
|
77
|
// 获取积分
|
78
|
78
|
scoreList: any = [];
|
79
|
79
|
getScores() {
|
|
@@ -124,12 +124,12 @@ export class ConfigurationManHourComponent implements OnInit {
|
124
|
124
|
break;
|
125
|
125
|
}
|
126
|
126
|
}
|
127
|
|
-
|
|
127
|
+
|
128
|
128
|
// 取消删除弹框
|
129
|
129
|
cancelDel(){
|
130
|
130
|
this.hideDelModal();
|
131
|
131
|
}
|
132
|
|
-
|
|
132
|
+
|
133
|
133
|
// 确认删除
|
134
|
134
|
confirmDel() {
|
135
|
135
|
let that = this;
|
|
@@ -156,7 +156,7 @@ export class ConfigurationManHourComponent implements OnInit {
|
156
|
156
|
}
|
157
|
157
|
});
|
158
|
158
|
}
|
159
|
|
-
|
|
159
|
+
|
160
|
160
|
// 关闭删除模态框
|
161
|
161
|
hideDelModal() {
|
162
|
162
|
this.delModal = false;
|
|
@@ -181,6 +181,7 @@ export class ConfigurationManHourComponent implements OnInit {
|
181
|
181
|
workHourManagement: {
|
182
|
182
|
hosId: this.hosId,
|
183
|
183
|
treeLevel: type,
|
|
184
|
+ quoteOther: 0,
|
184
|
185
|
parent: type === 1 ? null : { id: parentId }
|
185
|
186
|
}
|
186
|
187
|
};
|
|
@@ -204,7 +205,38 @@ export class ConfigurationManHourComponent implements OnInit {
|
204
|
205
|
this.modalCategory = true;
|
205
|
206
|
this.initCategoryForm();
|
206
|
207
|
}
|
207
|
|
-
|
|
208
|
+ isLoading:boolean = false;
|
|
209
|
+ // 修改
|
|
210
|
+ editCategoryModal(type:number) {
|
|
211
|
+ this.coopType = type;
|
|
212
|
+ this.modelName = "修改";
|
|
213
|
+ this.add = false; //修改
|
|
214
|
+ this.modalCategory = true;
|
|
215
|
+ this.initCategoryForm();
|
|
216
|
+ if(type == 1){
|
|
217
|
+ this.('parent', false);
|
|
218
|
+ }else if(type == 2){
|
|
219
|
+ this.('parent', true);
|
|
220
|
+ }
|
|
221
|
+ console.log(this['activeCategory' + type])
|
|
222
|
+ this.validateCategoryForm.controls.parent.setValue(this['activeCategory' + type].parent ? this['activeCategory' + type].parent.id : null);
|
|
223
|
+ this.validateCategoryForm.controls.workName.setValue(this['activeCategory' + type].workName);
|
|
224
|
+ this.validateCategoryForm.controls.workUnit.setValue(this['activeCategory' + type].workUnit);
|
|
225
|
+ this.validateCategoryForm.controls.wage.setValue(this['activeCategory' + type].wage);
|
|
226
|
+ this.validateCategoryForm.controls.integral.setValue(this['activeCategory' + type].integral ? this['activeCategory' + type].integral.id : null);
|
|
227
|
+ }
|
|
228
|
+
|
|
229
|
+ requiredChange(field: string, required: boolean): void {
|
|
230
|
+ if (!required) {
|
|
231
|
+ this.validateCategoryForm.get(field)!.clearValidators();
|
|
232
|
+ this.validateCategoryForm.get(field)!.markAsPristine();
|
|
233
|
+ } else {
|
|
234
|
+ this.validateCategoryForm.get(field)!.setValidators(Validators.required);
|
|
235
|
+ this.validateCategoryForm.get(field)!.markAsDirty();
|
|
236
|
+ }
|
|
237
|
+ this.validateCategoryForm.get(field)!.updateValueAndValidity();
|
|
238
|
+ }
|
|
239
|
+
|
208
|
240
|
// 删除工时
|
209
|
241
|
delModal: boolean = false; //删除模态框
|
210
|
242
|
delContent: string = null; //删除模态框
|
|
@@ -217,7 +249,7 @@ export class ConfigurationManHourComponent implements OnInit {
|
217
|
249
|
this.coopType = type;
|
218
|
250
|
this.delModal = true
|
219
|
251
|
}
|
220
|
|
-
|
|
252
|
+
|
221
|
253
|
//关闭新增/编辑弹框
|
222
|
254
|
hideCategoryModal() {
|
223
|
255
|
this.modalCategory = false;
|
|
@@ -227,6 +259,7 @@ export class ConfigurationManHourComponent implements OnInit {
|
227
|
259
|
validateCategoryForm: FormGroup; //新增/编辑表单
|
228
|
260
|
initCategoryForm() {
|
229
|
261
|
this.validateCategoryForm = this.fb.group({
|
|
262
|
+ parent: [null],//工时大类
|
230
|
263
|
workName: [null, [Validators.required]],//名称
|
231
|
264
|
workUnit: [null, [Validators.required]],//单位
|
232
|
265
|
wage: [null, [Validators.required]],//工价
|
|
@@ -252,25 +285,39 @@ export class ConfigurationManHourComponent implements OnInit {
|
252
|
285
|
console.log(this.validateCategoryForm.value);
|
253
|
286
|
this.btnLoading = true;
|
254
|
287
|
// -----------------------------------
|
255
|
|
- let postData:any = {
|
256
|
|
- ...this.validateCategoryForm.value,
|
257
|
|
- integral:{
|
258
|
|
- id:this.validateCategoryForm.value.integral
|
259
|
|
- },
|
260
|
|
- hosId: this.hosId,
|
261
|
|
- treeLevel: this.coopType,
|
262
|
|
- parent: this.coopType === 1 ? undefined : this['activeCategory' + (this.coopType - 1)],
|
263
|
|
- };
|
264
|
|
-
|
|
288
|
+ let postData:any;
|
|
289
|
+ if(this.add){
|
|
290
|
+ postData = {
|
|
291
|
+ ...this.validateCategoryForm.value,
|
|
292
|
+ integral:{
|
|
293
|
+ id:this.validateCategoryForm.value.integral
|
|
294
|
+ },
|
|
295
|
+ hosId: this.hosId,
|
|
296
|
+ treeLevel: this.coopType,
|
|
297
|
+ parent: this.coopType === 1 ? undefined : this['activeCategory' + (this.coopType - 1)],
|
|
298
|
+ }
|
|
299
|
+ }else{
|
|
300
|
+ postData = {
|
|
301
|
+ ...this['activeCategory' + this.coopType],
|
|
302
|
+ ...this.validateCategoryForm.value,
|
|
303
|
+ integral:{
|
|
304
|
+ id:this.validateCategoryForm.value.integral
|
|
305
|
+ },
|
|
306
|
+ hosId: this.hosId,
|
|
307
|
+ treeLevel: this.coopType,
|
|
308
|
+ parent: this.coopType === 1 ? undefined : this['activeCategory' + (this.coopType - 1)],
|
|
309
|
+ }
|
|
310
|
+ }
|
|
311
|
+
|
265
|
312
|
this.mainService
|
266
|
|
- .simplePost("addData", "workHourManagement", postData)
|
|
313
|
+ .simplePost(this.add ? "addData" : "updData", "workHourManagement", postData)
|
267
|
314
|
.subscribe((data) => {
|
268
|
315
|
this.btnLoading = false;
|
269
|
316
|
if (data.status == 200) {
|
270
|
317
|
this.modalCategory = false
|
271
|
|
- this.showPromptModal("新增", true, "");
|
|
318
|
+ this.showPromptModal(this.add ? "新增" : "修改", true, "");
|
272
|
319
|
} else {
|
273
|
|
- this.showPromptModal("新增", false, data.msg);
|
|
320
|
+ this.showPromptModal(this.add ? "新增" : "修改", false, data.msg);
|
274
|
321
|
}
|
275
|
322
|
});
|
276
|
323
|
// -----------------------------------
|
|
@@ -290,7 +337,7 @@ export class ConfigurationManHourComponent implements OnInit {
|
290
|
337
|
});
|
291
|
338
|
console.log(this.validateConfigForm.controls)
|
292
|
339
|
}
|
293
|
|
-
|
|
340
|
+
|
294
|
341
|
// 获取当前选中的故障现象索引
|
295
|
342
|
get currentCategoryIndex(){
|
296
|
343
|
if(this.activeCategory3.id){
|
|
@@ -303,7 +350,7 @@ export class ConfigurationManHourComponent implements OnInit {
|
303
|
350
|
return 1;
|
304
|
351
|
}
|
305
|
352
|
}
|
306
|
|
-
|
|
353
|
+
|
307
|
354
|
// 展示信息提示框(con:提示信息,success:操作是否成功,promptInfo:操作结果提示信息)
|
308
|
355
|
promptContent: string; //操作提示框提示信息
|
309
|
356
|
ifSuccess: boolean; //操作成功/失败
|