Pārlūkot izejas kodu

구매요청현황 수정

dwkim 2 gadi atpakaļ
vecāks
revīzija
ec29f71b74

+ 10 - 0
src/main/webapp/js/app/config.js

@@ -3057,3 +3057,13 @@ let itp_fn_attach_file = {
3057 3057
 	}
3058 3058
 };
3059 3059
 
3060
+function itp_fn_set_chg_editable(rowId, lastrowid, gridId) {
3061
+	if ($(gridId).jqGrid('getCell', rowId, 'viewCd') === 'R') {
3062
+		 $(gridId).jqGrid('setRowData', rowId, { viewCd: "U" });
3063
+	}
3064
+	
3065
+	$(gridId).jqGrid('saveRow', rowId, true);
3066
+	lastrowid = rowId;
3067
+	
3068
+	return lastrowid;
3069
+};

+ 35 - 39
src/main/webapp/js/app/pomng/ITP_POMNG02010.js

@@ -196,7 +196,7 @@ const gridColModel = {
196 196
 			label: ITP_MSG_LOCALE.label.pchReqQty, //단가
197 197
 			width: '10', fixed: false, align: 'right',
198 198
 			sortable: true, editable: true, edittype: 'text',
199
-			editrules: { number:true}
199
+			editrules: {required: true, number:true}
200 200
 		},
201 201
 		{
202 202
 			index: 'PCH_REQ_AMT', name: 'pchReqAmt',
@@ -405,6 +405,7 @@ let pageObj = {
405 405
 	},
406 406
 	grid: {
407 407
 		init: function(mode, gridRows) {
408
+			
408 409
 			this.gridId = (mode === 'VIEW') ? POMNG02010_VIEW_GRID_ID : POMNG02010_DETAIL_GRID_ID;
409 410
 			this.gridList = (mode === 'VIEW') ? POMNG02010_VIEW_GRID_LIST : POMNG02010_DETAIL_GRID_LIST;
410 411
 			this.gridEmpty = (mode === 'VIEW') ? POMNG02010_VIEW_GRID_EMPTY : POMNG02010_DETAIL_GRID_EMPTY;
@@ -412,6 +413,7 @@ let pageObj = {
412 413
 			this.unload();
413 414
 			this.load(mode, gridRows);
414 415
 		},
416
+		
415 417
 		gridId: '',
416 418
 		gridList: '',
417 419
 		gridEmpty: '',
@@ -452,25 +454,26 @@ let pageObj = {
452 454
 				gridId: _this.gridId,
453 455
 				colModel: gridColModel.detail,
454 456
 				data: gridRows,
455
-				cellEdit: true,
456 457
 				multiselect: true,
457
-				// cellEdit: (mode !== 'VIEW'),
458
+				cellEdit: (mode !== 'VIEW'),
458 459
 				loadComplete: function(data) {
459
-					console.log(data);
460
+					//console.log(data);
460 461
 					//$(_this.gridList).find('.ui-jqgrid .ui-jqgrid-bdiv').css('overflow-x', 'hidden');
461 462
 					//(Array.isArray(data.rows) && data.rows.length === 0) ? $(_this.gridEmpty).show() : $(_this.gridEmpty).hide();
462 463
 					$(_this.mode === 'VIEW' ? POMNG02010_VIEW_GRID_LIST : POMNG02010_DETAIL_GRID_LIST).find('.ui-jqgrid .ui-jqgrid-bdiv').css('overflow-x', 'hidden');
463
-					data.records === 0 ? _this.clearData() : $(this.mode === 'VIEW' ? POMNG02010_VIEW_GRID_EMPTY : POMNG02010_DETAIL_GRID_EMPTY).hide();
464
+					data.records === 0 ? _this.clearData() : $(_this.mode === 'VIEW' ? POMNG02010_VIEW_GRID_EMPTY : POMNG02010_DETAIL_GRID_EMPTY).hide();
464 465
 				},
465 466
 				onCellSelect: function(rowid, cellIdx, cellValue) {
466
-					console.log('mode ===> ' + mode);
467 467
 					if(mode !== 'VIEW') {
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); 
468
+						//POMNG02010_GRID_LAST_ROW_ID = itp_fn_set_data_editable(rowId, cellIdx, POMNG02010_GRID_LAST_ROW_ID, _this.gridId, ['pchReqDtlNo']);
470 469
 					}
471
-				},
470
+				}
471
+				,
472 472
 				afterSaveCell: function(rowid,name,val,iRow,iCol) {
473
-					// 구매요청금액 계산 (기존금액과 )
473
+					
474
+					POMNG02010_GRID_LAST_ROW_ID = itp_fn_set_chg_editable(rowid, POMNG02010_GRID_LAST_ROW_ID, POMNG02010_DETAIL_GRID_ID);
475
+					//POMNG02010_GRID_LAST_ROW_ID = itp_fn_set_data_editable(rowid, iCol, POMNG02010_GRID_LAST_ROW_ID,  _this.gridId); 
476
+					
474 477
 					var unitAmt = jQuery(POMNG02010_DETAIL_GRID_ID).jqGrid('getCell',rowid,iCol-1);
475 478
 					jQuery(POMNG02010_DETAIL_GRID_ID).jqGrid('setRowData',rowid,{pchReqAmt: parseInt(val)*parseInt(unitAmt)});
476 479
 					// 그리드 포문으로 금액 재계산후 구매요청금액에 넣어줌
@@ -488,14 +491,10 @@ let pageObj = {
488 491
 				console.log(rowData);
489 492
 				if (value.pchReqAmt != null && value.pchReqAmt != "" && value.viewCd != "D") {
490 493
 					pchReqAmt = pchReqAmt + parseInt(value.pchReqAmt) ;
491
-					console.log("-----------------------------");
492
-					console.log(pchReqAmt);
493
-					console.log("-----------------------------");
494 494
 				}
495 495
 				
496 496
 			});
497
-			console.log("########################################");
498
-			console.log(pchReqAmt);
497
+			
499 498
 			$('#ITP_FORM_POMNG02010_DETAIL .fnPchReqTotalAmt').text(pchReqAmt);
500 499
 		},
501 500
 		clearData : function() {
@@ -506,28 +505,6 @@ let pageObj = {
506 505
 		},
507 506
 		unload : function() {
508 507
 			$.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;
531 508
 		}
532 509
 		
533 510
 	}
@@ -602,6 +579,8 @@ let listObj = {
602 579
 			var option = {
603 580
 				gridId: POMNG02010_GRID_ID,
604 581
 				colModel: gridColModel.list,
582
+				//autowidth: true,
583
+				//shrinkToFit:false, 
605 584
 				param: param,
606 585
 				url: DOMAIN + API_DETAIL_GRID_LIST,
607 586
 				pager: POMNG02010_GRID_PAGER,
@@ -624,6 +603,20 @@ let listObj = {
624 603
 					});
625 604
 				},
626 605
 				onPaging: function(action) {
606
+					/*
607
+					var pagingFn = {
608
+						callBack: function(args) {
609
+							$(args).trigger('reloadGrid');
610
+						}
611
+					};
612
+					if (itp_fn_check_grid_is_writing(POMNG02010_DETAIL_GRID_ID)) {
613
+						itp_fn_modal_confirm(ITP_MSG_LOCALE.message.ajax.cancelData, pagingFn, POMNG02010_DETAIL_GRID_ID);
614
+						return 'stop';
615
+					} else {
616
+						itp_fn_grid_paging(POMNG02010_DETAIL_GRID_ID, action, param);
617
+					}
618
+					*/
619
+					
627 620
 					itp_fn_grid_paging(POMNG02010_GRID_ID, action, param);
628 621
 				}
629 622
 			};
@@ -691,7 +684,7 @@ let viewObj = {
691 684
 /*수정화면 Object*/
692 685
 let modifyObj = {
693 686
 	init: function (param) {
694
-		//pageObj.grid.init('DETAIL', []);
687
+		pageObj.grid.init('DETAIL', []);
695 688
 		//this.load(param);
696 689
 	},
697 690
 	button: {
@@ -721,6 +714,9 @@ let modifyObj = {
721 714
 		save: function(arg) {
722 715
 			const formId = '#ITP_FORM_POMNG02010_DETAIL';
723 716
 			itp_fn_form_clear_validate(null, formId);
717
+			
718
+			itp_fn_grid_save_rows(POMNG02010_DETAIL_GRID_ID);
719
+			
724 720
 			$('#ITP_FORM_POMNG02010_DETAIL_PCH_REQ_ST_CD').val(arg);
725 721
 			
726 722
 			//정산 타입이 무정산이면 스킵
@@ -750,7 +746,7 @@ let modifyObj = {
750 746
 							const rowData = $(POMNG02010_DETAIL_GRID_ID).getRowData();
751 747
 							
752 748
 							$.each(rowData, function(key, value) {
753
-								if (value.viewCd !== 'R') {
749
+								if (value.viewCd != 'R') {
754 750
 									if (value.viewCd == 'C') {
755 751
 										gridInsertData.push(value);
756 752
 									} else if (value.viewCd == 'U') {