Browse Source

그리드 상태값 처리관련 수정 --보완필요

dwkim 2 years ago
parent
commit
0dcac71753

+ 1 - 1
src/main/webapp/app/pomng/POMNG02010.html

@@ -50,7 +50,7 @@
50
 											</select>
50
 											</select>
51
 										</div>
51
 										</div>
52
 										<div class="col-xs-5 itp_ip itp_noMar">
52
 										<div class="col-xs-5 itp_ip itp_noMar">
53
-											<input type="text" id="ITP_FORM_POMNG02010_SEARCH_ITEM_NM" class="form-control itp_input" name="sItemNm" placeholder="품목번호 or 품목명" />
53
+											<input type="text" id="ITP_FORM_POMNG02010_SEARCH_SITEM_NM" class="form-control itp_input" name="sitemNm" placeholder="품목번호 or 품목명" />
54
 										</div>
54
 										</div>
55
 									</div>
55
 									</div>
56
 								</form>
56
 								</form>

+ 4 - 4
src/main/webapp/js/app/oper/ITP_OPER03010.js

@@ -612,13 +612,13 @@ let createObj = {
612
 					const rowData = $(OPER03010_DETAIL_GRID_ID).getRowData();
612
 					const rowData = $(OPER03010_DETAIL_GRID_ID).getRowData();
613
 					const keyValue = $(formId + '_AFFL_SHOP_ID').val();
613
 					const keyValue = $(formId + '_AFFL_SHOP_ID').val();
614
 					$.each(rowData, function(key, value) {
614
 					$.each(rowData, function(key, value) {
615
-						if (value.viewCd !== 'R') {
615
+						if (value.viewCd != 'R') {
616
 							value.afflShopId = keyValue;
616
 							value.afflShopId = keyValue;
617
-							if (value.viewCd === 'C') {
617
+							if (value.viewCd == 'C') {
618
 								gridInsertData.push(value);
618
 								gridInsertData.push(value);
619
-							} else if (value.viewCd === 'U') {
619
+							} else if (value.viewCd == 'U') {
620
 								gridUpdateData.push(value);
620
 								gridUpdateData.push(value);
621
-							} else if (value.viewCd === 'D') {
621
+							} else if (value.viewCd == 'D') {
622
 								gridDeleteData.push(value);
622
 								gridDeleteData.push(value);
623
 							}
623
 							}
624
 						}
624
 						}

+ 4 - 4
src/main/webapp/js/app/pomng/ITP_POMNG01010.js

@@ -366,12 +366,12 @@ let createObj = {
366
 						const rowData = $(POMNG01010_DETAIL_GRID_ID).getRowData();
366
 						const rowData = $(POMNG01010_DETAIL_GRID_ID).getRowData();
367
 						
367
 						
368
 						$.each(rowData, function(key, value) {
368
 						$.each(rowData, function(key, value) {
369
-							if (value.viewCd !== 'R') {
370
-								if (value.viewCd === 'C') {
369
+							if (value.viewCd != 'R') {
370
+								if (value.viewCd == 'C') {
371
 									gridInsertData.push(value);
371
 									gridInsertData.push(value);
372
-								} else if (value.viewCd === 'U') {
372
+								} else if (value.viewCd == 'U') {
373
 									gridUpdateData.push(value);
373
 									gridUpdateData.push(value);
374
-								} else if (value.viewCd === 'D') {
374
+								} else if (value.viewCd == 'D') {
375
 									gridDeleteData.push(value);
375
 									gridDeleteData.push(value);
376
 								}
376
 								}
377
 							}
377
 							}

+ 54 - 20
src/main/webapp/js/app/pomng/ITP_POMNG02010.js

@@ -39,6 +39,7 @@ let ITP_FORM_POMNG02010_DETAIL_IS_WRITING = false;
39
 
39
 
40
 let POMNG02010_GRID_LAST_ROW_ID;
40
 let POMNG02010_GRID_LAST_ROW_ID;
41
 
41
 
42
+
42
 //let ITP_COMMON_ASSGN_TASK = fn_make_common_cd_list(CODE_LIST, 'ASSGN_TASK', true, '담당업무');
43
 //let ITP_COMMON_ASSGN_TASK = fn_make_common_cd_list(CODE_LIST, 'ASSGN_TASK', true, '담당업무');
43
 
44
 
44
 /*API URL*/
45
 /*API URL*/
@@ -148,7 +149,7 @@ const gridColModel = {
148
 			index: 'VIEW_CD', name: 'viewCd',
149
 			index: 'VIEW_CD', name: 'viewCd',
149
 			label: ITP_MSG_LOCALE.label.viewCd,
150
 			label: ITP_MSG_LOCALE.label.viewCd,
150
 			width: '10', fixed: false, align: 'center',
151
 			width: '10', fixed: false, align: 'center',
151
-			sortable: false, hidden: true
152
+			sortable: false, hidden: false
152
 		},
153
 		},
153
 		{
154
 		{
154
 			index: 'PCH_REQ_UNQ_NO', name: 'pchReqUnqNo',
155
 			index: 'PCH_REQ_UNQ_NO', name: 'pchReqUnqNo',
@@ -237,7 +238,7 @@ let pageObj = {
237
 	ui: {
238
 	ui: {
238
 		init: function () {
239
 		init: function () {
239
 			this.view();
240
 			this.view();
240
-			this.form();
241
+			//this.form();
241
 			this.grid();
242
 			this.grid();
242
 			this.ready();
243
 			this.ready();
243
 		},
244
 		},
@@ -259,9 +260,11 @@ let pageObj = {
259
 			
260
 			
260
 			
261
 			
261
 		},
262
 		},
263
+		/*
262
 		form: function() {
264
 		form: function() {
263
 			itp_fn_form_event.onKeyup('#ITP_FORM_POMNG02010_DETAIL');
265
 			itp_fn_form_event.onKeyup('#ITP_FORM_POMNG02010_DETAIL');
264
 		},
266
 		},
267
+		*/
265
 		grid: function() {
268
 		grid: function() {
266
 			itp_fn_jqgrid_resize(POMNG02010_GRID_ID, POMNG02010_GRID_LIST, 'lg');
269
 			itp_fn_jqgrid_resize(POMNG02010_GRID_ID, POMNG02010_GRID_LIST, 'lg');
267
 			listObj.empty.init();
270
 			listObj.empty.init();
@@ -363,7 +366,6 @@ let pageObj = {
363
 				var last_row_id = rids[rids.length - 1];
366
 				var last_row_id = rids[rids.length - 1];
364
 				itp_fn_grid_reset_selection(e, last_row_id, gridId, 'POMNG02010_DETAIL');
367
 				itp_fn_grid_reset_selection(e, last_row_id, gridId, 'POMNG02010_DETAIL');
365
 			});
368
 			});
366
-
367
 		}
369
 		}
368
 	},
370
 	},
369
 	switchScreen: function(mode) {
371
 	switchScreen: function(mode) {
@@ -393,6 +395,9 @@ let pageObj = {
393
 			fn_show_btn_auth_array(['#ITP_BTN_POMNG02010_CANCELLIST', '#ITP_BTN_POMNG02010_SAVE', '#ITP_BTN_POMNG02010_REQ']);
395
 			fn_show_btn_auth_array(['#ITP_BTN_POMNG02010_CANCELLIST', '#ITP_BTN_POMNG02010_SAVE', '#ITP_BTN_POMNG02010_REQ']);
394
 			
396
 			
395
 			$('#ITP_AJAX_POMNG02010_DETAIL_CONTAINER').show();
397
 			$('#ITP_AJAX_POMNG02010_DETAIL_CONTAINER').show();
398
+			$('#ITP_FORM_POMNG02010_DETAIL .itp_form_info').show();
399
+			$('#ITP_FORM_POMNG02010_DETAIL .itp_form_change').hide();
400
+			
396
 		} else if(mode == 'VIEW') { // 보기
401
 		} else if(mode == 'VIEW') { // 보기
397
 			fn_show_btn_auth_array(['#ITP_BTN_POMNG02010_MODIFY', '#ITP_BTN_POMNG02010_CANCELLIST']);
402
 			fn_show_btn_auth_array(['#ITP_BTN_POMNG02010_MODIFY', '#ITP_BTN_POMNG02010_CANCELLIST']);
398
 			$('#ITP_AJAX_POMNG02010_VIEW_CONTAINER').show();
403
 			$('#ITP_AJAX_POMNG02010_VIEW_CONTAINER').show();
@@ -408,7 +413,9 @@ let pageObj = {
408
 			this.load(mode, gridRows);
413
 			this.load(mode, gridRows);
409
 		},
414
 		},
410
 		gridId: '',
415
 		gridId: '',
411
-		mode: 'DETAIL',
416
+		gridList: '',
417
+		gridEmpty: '',
418
+		gridRows: '',
412
 		button: {
419
 		button: {
413
 			addRow: function() {
420
 			addRow: function() {
414
 				// 팝업
421
 				// 팝업
@@ -436,13 +443,9 @@ let pageObj = {
436
 			},
443
 			},
437
 			delRow: function() {
444
 			delRow: function() {
438
 				itp_fn_grid_del_row(POMNG02010_DETAIL_GRID_ID);
445
 				itp_fn_grid_del_row(POMNG02010_DETAIL_GRID_ID);
439
-				
440
-				pageObj.grid.recal();  //==>dwkim 왜 호출이 안될까요
446
+				pageObj.grid.recal();
441
 			}
447
 			}
442
 		},
448
 		},
443
-		gridList: '',
444
-		gridEmpty: '',
445
-		gridRows: '',
446
 		load: function(mode, gridRows) {
449
 		load: function(mode, gridRows) {
447
 			var _this = this;
450
 			var _this = this;
448
 			var option = {
451
 			var option = {
@@ -462,7 +465,8 @@ let pageObj = {
462
 				onCellSelect: function(rowid, cellIdx, cellValue) {
465
 				onCellSelect: function(rowid, cellIdx, cellValue) {
463
 					console.log('mode ===> ' + mode);
466
 					console.log('mode ===> ' + mode);
464
 					if(mode !== 'VIEW') {
467
 					if(mode !== 'VIEW') {
465
-						POMNG02010_GRID_LAST_ROW_ID = itp_fn_set_data_editable(rowid, cellIdx, POMNG02010_GRID_LAST_ROW_ID, _this.gridId, ['actionId']);
468
+						POMNG02010_GRID_LAST_ROW_ID = itp_fn_set_data_editable(rowid, cellIdx, POMNG02010_GRID_LAST_ROW_ID, _this.gridId, ['pchReqQty']);
469
+						//POMNG02010_GRID_LAST_ROW_ID = itp_fn_set_data_editable(rowId, cellIdx, POMNG02010_GRID_LAST_ROW_ID,  _this.gridId); 
466
 					}
470
 					}
467
 				},
471
 				},
468
 				afterSaveCell: function(rowid,name,val,iRow,iCol) {
472
 				afterSaveCell: function(rowid,name,val,iRow,iCol) {
@@ -477,17 +481,21 @@ let pageObj = {
477
 		},
481
 		},
478
 		recal: function() {
482
 		recal: function() {
479
 			//PCH_REQ_AMT
483
 			//PCH_REQ_AMT
480
-			console.log("==========================================");
484
+			
481
 			const rowData = $(POMNG02010_DETAIL_GRID_ID).getRowData();
485
 			const rowData = $(POMNG02010_DETAIL_GRID_ID).getRowData();
482
 			var pchReqAmt = 0 ;
486
 			var pchReqAmt = 0 ;
483
-			console.log("####################################");
484
 			$.each(rowData, function(key, value) {
487
 			$.each(rowData, function(key, value) {
485
 				console.log(rowData);
488
 				console.log(rowData);
486
 				if (value.pchReqAmt != null && value.pchReqAmt != "" && value.viewCd != "D") {
489
 				if (value.pchReqAmt != null && value.pchReqAmt != "" && value.viewCd != "D") {
487
 					pchReqAmt = pchReqAmt + parseInt(value.pchReqAmt) ;
490
 					pchReqAmt = pchReqAmt + parseInt(value.pchReqAmt) ;
491
+					console.log("-----------------------------");
492
+					console.log(pchReqAmt);
493
+					console.log("-----------------------------");
488
 				}
494
 				}
489
 				
495
 				
490
 			});
496
 			});
497
+			console.log("########################################");
498
+			console.log(pchReqAmt);
491
 			$('#ITP_FORM_POMNG02010_DETAIL .fnPchReqTotalAmt').text(pchReqAmt);
499
 			$('#ITP_FORM_POMNG02010_DETAIL .fnPchReqTotalAmt').text(pchReqAmt);
492
 		},
500
 		},
493
 		clearData : function() {
501
 		clearData : function() {
@@ -498,9 +506,32 @@ let pageObj = {
498
 		},
506
 		},
499
 		unload : function() {
507
 		unload : function() {
500
 			$.jgrid.gridUnload(this.gridId);
508
 			$.jgrid.gridUnload(this.gridId);
509
+		},
510
+		changeRows: function(gridRows) {
511
+			var modifyRows = [];
512
+			var chkColumns = ['pchReqQty'];
513
+			$.each(this.gridRows, function(index, item) {
514
+				console.log(item);
515
+				var row = gridRows[index];
516
+				if(row.viewCd == 'C') {
517
+					modifyRows.push(item);
518
+				} else {
519
+					if(row.brandUnitUnqNo == item.brandUnitUnqNo) {
520
+						$.each(chkColumns, function(index, column) {
521
+							if(row[column].toString() != item[column].toString()) {
522
+								row.viewCd = 'U';
523
+								modifyRows.push(row);
524
+								return false;
525
+							}
526
+						});
527
+					}
528
+				}
529
+			});
530
+			return modifyRows;
501
 		}
531
 		}
502
 		
532
 		
503
 	}
533
 	}
534
+	
504
 };
535
 };
505
 
536
 
506
 /*목록화면 Object*/
537
 /*목록화면 Object*/
@@ -544,7 +575,7 @@ let listObj = {
544
 			$('#ITP_FORM_POMNG02010_SEARCH_TO_DT').val(this.itp_POMNG02010_param.toDt);
575
 			$('#ITP_FORM_POMNG02010_SEARCH_TO_DT').val(this.itp_POMNG02010_param.toDt);
545
 			$('#ITP_FORM_POMNG02010_SEARCH_SWHS_ID').val(this.itp_POMNG02010_param.swhsId);
576
 			$('#ITP_FORM_POMNG02010_SEARCH_SWHS_ID').val(this.itp_POMNG02010_param.swhsId);
546
 			$('#ITP_FORM_POMNG02010_SEARCH_SPCH_REQ_ST_CD').val(this.itp_POMNG02010_param.spchReqStCd);
577
 			$('#ITP_FORM_POMNG02010_SEARCH_SPCH_REQ_ST_CD').val(this.itp_POMNG02010_param.spchReqStCd);
547
-			$('#ITP_FORM_POMNG02010_SEARCH_ITEM_NM').val(this.itp_POMNG02010_param.sItemNm);
578
+			$('#ITP_FORM_POMNG02010_SEARCH_SITEM_NM').val(this.itp_POMNG02010_param.sitemNm);
548
 		}
579
 		}
549
 	},
580
 	},
550
 	grid: {
581
 	grid: {
@@ -553,7 +584,7 @@ let listObj = {
553
 			listObj.empty.push();
584
 			listObj.empty.push();
554
 			itp_fn_jqgrid_resize(POMNG02010_GRID_ID, POMNG02010_GRID_LIST, 'lg');
585
 			itp_fn_jqgrid_resize(POMNG02010_GRID_ID, POMNG02010_GRID_LIST, 'lg');
555
 			itp_fn_fire_window_resize();
586
 			itp_fn_fire_window_resize();
556
-			this.reload();
587
+			//this.reload();
557
 			this.search();
588
 			this.search();
558
 		},
589
 		},
559
 		colModel: gridColModel.list,
590
 		colModel: gridColModel.list,
@@ -599,6 +630,7 @@ let listObj = {
599
 			
630
 			
600
 			itp_fn_grid_make_remote(option);
631
 			itp_fn_grid_make_remote(option);
601
 		},
632
 		},
633
+		/*
602
 		reload : function() {
634
 		reload : function() {
603
 			var _this = this;
635
 			var _this = this;
604
 			$(POMNG02010_GRID_EMPTY).off('click').on('click', function() {
636
 			$(POMNG02010_GRID_EMPTY).off('click').on('click', function() {
@@ -606,6 +638,7 @@ let listObj = {
606
 				$(POMNG02010_GRID_ID).setGridParam({'postData': JSON.stringify(pageObj.itp_POMNG02010_param)}).trigger('reloadGrid');
638
 				$(POMNG02010_GRID_ID).setGridParam({'postData': JSON.stringify(pageObj.itp_POMNG02010_param)}).trigger('reloadGrid');
607
 			});
639
 			});
608
 		},
640
 		},
641
+		*/
609
 		clearData : function() {
642
 		clearData : function() {
610
 			$(POMNG02010_GRID_ID).jqGrid('clearGridData', true);
643
 			$(POMNG02010_GRID_ID).jqGrid('clearGridData', true);
611
 			$(POMNG02010_GRID_LIST).find('.ui-jqgrid-bdiv').css('min-height', '100px');
644
 			$(POMNG02010_GRID_LIST).find('.ui-jqgrid-bdiv').css('min-height', '100px');
@@ -658,8 +691,8 @@ let viewObj = {
658
 /*수정화면 Object*/
691
 /*수정화면 Object*/
659
 let modifyObj = {
692
 let modifyObj = {
660
 	init: function (param) {
693
 	init: function (param) {
661
-		pageObj.grid.init('DETAIL', []);
662
-		this.load(param);
694
+		//pageObj.grid.init('DETAIL', []);
695
+		//this.load(param);
663
 	},
696
 	},
664
 	button: {
697
 	button: {
665
 		modify: function (param) {
698
 		modify: function (param) {
@@ -682,7 +715,8 @@ let modifyObj = {
682
 			
715
 			
683
 			const key = {brandId:fn_make_user_info.get('brandId'), pchReqUnqNo: selectVal, viewCd: 'R'};
716
 			const key = {brandId:fn_make_user_info.get('brandId'), pchReqUnqNo: selectVal, viewCd: 'R'};
684
 			var param = $.param(key);
717
 			var param = $.param(key);
685
-			modifyObj.init(param);
718
+			//modifyObj.init(param);
719
+			modifyObj.load(param);
686
 		},
720
 		},
687
 		save: function(arg) {
721
 		save: function(arg) {
688
 			const formId = '#ITP_FORM_POMNG02010_DETAIL';
722
 			const formId = '#ITP_FORM_POMNG02010_DETAIL';
@@ -717,11 +751,11 @@ let modifyObj = {
717
 							
751
 							
718
 							$.each(rowData, function(key, value) {
752
 							$.each(rowData, function(key, value) {
719
 								if (value.viewCd !== 'R') {
753
 								if (value.viewCd !== 'R') {
720
-									if (value.viewCd === 'C') {
754
+									if (value.viewCd == 'C') {
721
 										gridInsertData.push(value);
755
 										gridInsertData.push(value);
722
-									} else if (value.viewCd === 'U') {
756
+									} else if (value.viewCd == 'U') {
723
 										gridUpdateData.push(value);
757
 										gridUpdateData.push(value);
724
-									} else if (value.viewCd === 'D') {
758
+									} else if (value.viewCd == 'D') {
725
 										gridDeleteData.push(value);
759
 										gridDeleteData.push(value);
726
 									}
760
 									}
727
 								}
761
 								}

+ 1 - 1
src/main/webapp/js/app/stinfo/ITP_STINFO06010.js

@@ -547,7 +547,7 @@ let createObj = {
547
 				$.each(changeRows, function (index, item) {
547
 				$.each(changeRows, function (index, item) {
548
 					if(item.viewCd === 'C') {
548
 					if(item.viewCd === 'C') {
549
 						gridInsertData.push(item);
549
 						gridInsertData.push(item);
550
-					} else if(item.viewCd === 'U') {
550
+					} else if(item.viewCd == 'U') {
551
 						gridUpdateData.push(item);
551
 						gridUpdateData.push(item);
552
 					}
552
 					}
553
 					// if(pageObj.screenMode === 'ADD') {
553
 					// if(pageObj.screenMode === 'ADD') {