Parcourir la source

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

dwkim il y a 2 ans
Parent
commit
0dcac71753

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

@@ -50,7 +50,7 @@
50 50
 											</select>
51 51
 										</div>
52 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 54
 										</div>
55 55
 									</div>
56 56
 								</form>

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

@@ -612,13 +612,13 @@ let createObj = {
612 612
 					const rowData = $(OPER03010_DETAIL_GRID_ID).getRowData();
613 613
 					const keyValue = $(formId + '_AFFL_SHOP_ID').val();
614 614
 					$.each(rowData, function(key, value) {
615
-						if (value.viewCd !== 'R') {
615
+						if (value.viewCd != 'R') {
616 616
 							value.afflShopId = keyValue;
617
-							if (value.viewCd === 'C') {
617
+							if (value.viewCd == 'C') {
618 618
 								gridInsertData.push(value);
619
-							} else if (value.viewCd === 'U') {
619
+							} else if (value.viewCd == 'U') {
620 620
 								gridUpdateData.push(value);
621
-							} else if (value.viewCd === 'D') {
621
+							} else if (value.viewCd == 'D') {
622 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 366
 						const rowData = $(POMNG01010_DETAIL_GRID_ID).getRowData();
367 367
 						
368 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 371
 									gridInsertData.push(value);
372
-								} else if (value.viewCd === 'U') {
372
+								} else if (value.viewCd == 'U') {
373 373
 									gridUpdateData.push(value);
374
-								} else if (value.viewCd === 'D') {
374
+								} else if (value.viewCd == 'D') {
375 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 40
 let POMNG02010_GRID_LAST_ROW_ID;
41 41
 
42
+
42 43
 //let ITP_COMMON_ASSGN_TASK = fn_make_common_cd_list(CODE_LIST, 'ASSGN_TASK', true, '담당업무');
43 44
 
44 45
 /*API URL*/
@@ -148,7 +149,7 @@ const gridColModel = {
148 149
 			index: 'VIEW_CD', name: 'viewCd',
149 150
 			label: ITP_MSG_LOCALE.label.viewCd,
150 151
 			width: '10', fixed: false, align: 'center',
151
-			sortable: false, hidden: true
152
+			sortable: false, hidden: false
152 153
 		},
153 154
 		{
154 155
 			index: 'PCH_REQ_UNQ_NO', name: 'pchReqUnqNo',
@@ -237,7 +238,7 @@ let pageObj = {
237 238
 	ui: {
238 239
 		init: function () {
239 240
 			this.view();
240
-			this.form();
241
+			//this.form();
241 242
 			this.grid();
242 243
 			this.ready();
243 244
 		},
@@ -259,9 +260,11 @@ let pageObj = {
259 260
 			
260 261
 			
261 262
 		},
263
+		/*
262 264
 		form: function() {
263 265
 			itp_fn_form_event.onKeyup('#ITP_FORM_POMNG02010_DETAIL');
264 266
 		},
267
+		*/
265 268
 		grid: function() {
266 269
 			itp_fn_jqgrid_resize(POMNG02010_GRID_ID, POMNG02010_GRID_LIST, 'lg');
267 270
 			listObj.empty.init();
@@ -363,7 +366,6 @@ let pageObj = {
363 366
 				var last_row_id = rids[rids.length - 1];
364 367
 				itp_fn_grid_reset_selection(e, last_row_id, gridId, 'POMNG02010_DETAIL');
365 368
 			});
366
-
367 369
 		}
368 370
 	},
369 371
 	switchScreen: function(mode) {
@@ -393,6 +395,9 @@ let pageObj = {
393 395
 			fn_show_btn_auth_array(['#ITP_BTN_POMNG02010_CANCELLIST', '#ITP_BTN_POMNG02010_SAVE', '#ITP_BTN_POMNG02010_REQ']);
394 396
 			
395 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 401
 		} else if(mode == 'VIEW') { // 보기
397 402
 			fn_show_btn_auth_array(['#ITP_BTN_POMNG02010_MODIFY', '#ITP_BTN_POMNG02010_CANCELLIST']);
398 403
 			$('#ITP_AJAX_POMNG02010_VIEW_CONTAINER').show();
@@ -408,7 +413,9 @@ let pageObj = {
408 413
 			this.load(mode, gridRows);
409 414
 		},
410 415
 		gridId: '',
411
-		mode: 'DETAIL',
416
+		gridList: '',
417
+		gridEmpty: '',
418
+		gridRows: '',
412 419
 		button: {
413 420
 			addRow: function() {
414 421
 				// 팝업
@@ -436,13 +443,9 @@ let pageObj = {
436 443
 			},
437 444
 			delRow: function() {
438 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 449
 		load: function(mode, gridRows) {
447 450
 			var _this = this;
448 451
 			var option = {
@@ -462,7 +465,8 @@ let pageObj = {
462 465
 				onCellSelect: function(rowid, cellIdx, cellValue) {
463 466
 					console.log('mode ===> ' + mode);
464 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 472
 				afterSaveCell: function(rowid,name,val,iRow,iCol) {
@@ -477,17 +481,21 @@ let pageObj = {
477 481
 		},
478 482
 		recal: function() {
479 483
 			//PCH_REQ_AMT
480
-			console.log("==========================================");
484
+			
481 485
 			const rowData = $(POMNG02010_DETAIL_GRID_ID).getRowData();
482 486
 			var pchReqAmt = 0 ;
483
-			console.log("####################################");
484 487
 			$.each(rowData, function(key, value) {
485 488
 				console.log(rowData);
486 489
 				if (value.pchReqAmt != null && value.pchReqAmt != "" && value.viewCd != "D") {
487 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 499
 			$('#ITP_FORM_POMNG02010_DETAIL .fnPchReqTotalAmt').text(pchReqAmt);
492 500
 		},
493 501
 		clearData : function() {
@@ -498,9 +506,32 @@ let pageObj = {
498 506
 		},
499 507
 		unload : function() {
500 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 537
 /*목록화면 Object*/
@@ -544,7 +575,7 @@ let listObj = {
544 575
 			$('#ITP_FORM_POMNG02010_SEARCH_TO_DT').val(this.itp_POMNG02010_param.toDt);
545 576
 			$('#ITP_FORM_POMNG02010_SEARCH_SWHS_ID').val(this.itp_POMNG02010_param.swhsId);
546 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 581
 	grid: {
@@ -553,7 +584,7 @@ let listObj = {
553 584
 			listObj.empty.push();
554 585
 			itp_fn_jqgrid_resize(POMNG02010_GRID_ID, POMNG02010_GRID_LIST, 'lg');
555 586
 			itp_fn_fire_window_resize();
556
-			this.reload();
587
+			//this.reload();
557 588
 			this.search();
558 589
 		},
559 590
 		colModel: gridColModel.list,
@@ -599,6 +630,7 @@ let listObj = {
599 630
 			
600 631
 			itp_fn_grid_make_remote(option);
601 632
 		},
633
+		/*
602 634
 		reload : function() {
603 635
 			var _this = this;
604 636
 			$(POMNG02010_GRID_EMPTY).off('click').on('click', function() {
@@ -606,6 +638,7 @@ let listObj = {
606 638
 				$(POMNG02010_GRID_ID).setGridParam({'postData': JSON.stringify(pageObj.itp_POMNG02010_param)}).trigger('reloadGrid');
607 639
 			});
608 640
 		},
641
+		*/
609 642
 		clearData : function() {
610 643
 			$(POMNG02010_GRID_ID).jqGrid('clearGridData', true);
611 644
 			$(POMNG02010_GRID_LIST).find('.ui-jqgrid-bdiv').css('min-height', '100px');
@@ -658,8 +691,8 @@ let viewObj = {
658 691
 /*수정화면 Object*/
659 692
 let modifyObj = {
660 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 697
 	button: {
665 698
 		modify: function (param) {
@@ -682,7 +715,8 @@ let modifyObj = {
682 715
 			
683 716
 			const key = {brandId:fn_make_user_info.get('brandId'), pchReqUnqNo: selectVal, viewCd: 'R'};
684 717
 			var param = $.param(key);
685
-			modifyObj.init(param);
718
+			//modifyObj.init(param);
719
+			modifyObj.load(param);
686 720
 		},
687 721
 		save: function(arg) {
688 722
 			const formId = '#ITP_FORM_POMNG02010_DETAIL';
@@ -717,11 +751,11 @@ let modifyObj = {
717 751
 							
718 752
 							$.each(rowData, function(key, value) {
719 753
 								if (value.viewCd !== 'R') {
720
-									if (value.viewCd === 'C') {
754
+									if (value.viewCd == 'C') {
721 755
 										gridInsertData.push(value);
722
-									} else if (value.viewCd === 'U') {
756
+									} else if (value.viewCd == 'U') {
723 757
 										gridUpdateData.push(value);
724
-									} else if (value.viewCd === 'D') {
758
+									} else if (value.viewCd == 'D') {
725 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 547
 				$.each(changeRows, function (index, item) {
548 548
 					if(item.viewCd === 'C') {
549 549
 						gridInsertData.push(item);
550
-					} else if(item.viewCd === 'U') {
550
+					} else if(item.viewCd == 'U') {
551 551
 						gridUpdateData.push(item);
552 552
 					}
553 553
 					// if(pageObj.screenMode === 'ADD') {