Ver Fonte

최수빈-0112 다다익선 화면 수정

bin2107 há 5 anos atrás
pai
commit
011068b2ad

+ 68 - 62
style24.admin/src/main/webapp/WEB-INF/views/marketing/MorebetterRegForm.html

@@ -82,11 +82,11 @@
 								~
 								<input type="text" class="schDate w100" name="tmtbEddt" maxlength="10" required="required" data-valid-name="종료일자"/>
 							</td>
-							<th>상태</th>
+							<th>상태<em class="required" title="필수"></em></th>
 							<td>
 								<!-- 상태 입력 : before
 								<input class="w50p" type="text" id="disTmtbStat" name="disTmtbStat" maxlength="30" th:value="${params.tmtbStat}" disabled=""/>-->
-								<label class="rdoBtn" th:if="${tmtbStatList}" th:each="oneData, status : ${tmtbStatList}" ><input type="radio" id="disTmtbStat" name="disTmtbStat" th:value="${oneData.cd}" th:text="${oneData.cdNm}" /></label>
+								<label class="rdoBtn" th:if="${tmtbStatList}" th:each="oneData, status : ${tmtbStatList}" ><input type="radio" id="disTmtbStat" name="disTmtbStat" th:value="${oneData.cd}" th:text="${oneData.cdNm}" required="required" data-valid-name="상태"/></label>
 								<input type="hidden" id="tmtbStat" name="tmtbStat"/>
 							</td>
 						</tr>
@@ -310,8 +310,8 @@
 			{width: 40, minWidth: 40, cellClass: 'text-center', headerCheckboxSelection: true, checkboxSelection: true, filter: false},
 			{headerName: "공급처ID", field: "supplyCompCd", width: 120, cellClass: 'text-center'},
 			{headerName: "공급업체명", field: "supplyCompNm", width: 150, cellClass: 'text-center'},
-			{headerName: "적용대상", field: "targetGb", width: 150, cellClass: 'text-center'},
-			{headerName: "시퀀스", field: "tmtbGoodsSq", width: 150, cellClass: 'text-center'}
+			{headerName: "적용대상", field: "targetGb", width: 150, cellClass: 'text-center', hide: true},
+			{headerName: "시퀀스", field: "tmtbGoodsSq", width: 150, cellClass: 'text-center', hide: true}
 		];
 		// 브랜드 리스트 설정
 		var columnBrandList = [
@@ -319,8 +319,8 @@
 			{headerName: "브랜드ID", field: "brandCd", width: 120, cellClass: 'text-center'},
 			{headerName: "브랜드명", field: "brandEnm", width: 120, cellClass: 'text-center'},
 			{headerName: "공급업체명", field: "supplyCompNm", width: 150, cellClass: 'text-center'},
-			{headerName: "적용대상", field: "targetGb", width: 150, cellClass: 'text-center'},
-			{headerName: "시퀀스", field: "tmtbGoodsSq", width: 150, cellClass: 'text-center'}
+			{headerName: "적용대상", field: "targetGb", width: 150, cellClass: 'text-center', hide: true},
+			{headerName: "시퀀스", field: "tmtbGoodsSq", width: 150, cellClass: 'text-center', hide: true}
 		];
 		// 적용상품 리스트 설정
 		var columnApplyGoodsList = [
@@ -331,11 +331,10 @@
 				valueFormatter: function (params) { return gagaAgGrid.lookupValue(applyGoodsGbList, params.value); },
 				valueParser: function (params) { return gagaAgGrid.lookupKey(applyGoodsGbList, params.newValue); }
 			},
-			//{headerName: "상품구분", field: "goodsGb", width: 120, cellClass: 'text-center'},
 			{headerName: "Product ID", field: "goodsCd", width: 120, cellClass: 'text-center'},
 			{headerName: "상품명", field: "goodsNm", width: 120, cellClass: 'text-center'},
-			{headerName: "적용대상", field: "targetGb", width: 150, cellClass: 'text-center'},
-			{headerName: "시퀀스", field: "tmtbGoodsSq", width: 150, cellClass: 'text-center'}
+			{headerName: "적용대상", field: "targetGb", width: 150, cellClass: 'text-center', hide: true},
+			{headerName: "시퀀스", field: "tmtbGoodsSq", width: 150, cellClass: 'text-center', hide: true}
 		];
 		// 제외상품 리스트 설정
 		var columnExceptGoodsList = [
@@ -348,28 +347,27 @@
 			},
 			{headerName: "Product ID", field: "goodsCd", width: 120, cellClass: 'text-center'},
 			{headerName: "상품명", field: "goodsNm", width: 120, cellClass: 'text-center'},
-			{headerName: "적용대상", field: "targetGb", width: 150, cellClass: 'text-center'},
-			{headerName: "시퀀스", field: "tmtbGoodsSq", width: 150, cellClass: 'text-center'}
-			/*{headerName: "Product ID", field: "goodsCd", width: 120, cellClass: 'text-center'},
-			{headerName: "브랜드명", field: "brandEnm", width: 150, cellClass: 'text-center'},
-			{headerName: "상품명", field: "goodsNm", width: 120, cellClass: 'text-center'},
-			{headerName: "판매상태", field: "goodsStat" , width: 120, cellClass: 'text-center',
-				cellEditorParams: { values: gagaAgGrid.extractValues(FGAddGoodsStatList) },
-				valueFormatter: function (params) { return gagaAgGrid.lookupValue(FGAddGoodsStatList, params.value); },
-				valueParser: function (params) { return gagaAgGrid.lookupKey(FGAddGoodsStatList, params.newValue); }
-			},
-			{headerName: "정상가", field: "listPrice", width: 120, cellClass: 'text-center',valueFormatter: function(params) {return params.value.addComma();}},
-			{headerName: "판매가", field: "currPrice", width: 120, cellClass: 'text-center',valueFormatter: function(params) {return params.value.addComma();}},
-			{headerName: "적용대상", field: "targetGb", width: 150, cellClass: 'text-center'}*/
+			{headerName: "적용대상", field: "targetGb", width: 150, cellClass: 'text-center', hide: true},
+			{headerName: "시퀀스", field: "tmtbGoodsSq", width: 150, cellClass: 'text-center', hide: true}
 		];
 
 		// 업체분담율 리스트 설정
 		var columnApplyBurdenList = [
 			{width: 40, minWidth: 40, cellClass: 'text-center', headerCheckboxSelection: true, checkboxSelection: true, filter: false},
 			{headerName: "업체ID", field: "tmtbSupplyCd" , width: 120, cellClass: 'text-center'},
-			{headerName: "분담율(%)", field: "tmtbBurdenRate" , width: 120, cellClass: 'text-center',editable: true, required: true},
+			{headerName: "분담율(%)", field: "tmtbBurdenRate" , width: 120, cellClass: 'text-center',required: true
+				,valueFormatter: function(params) {
+					if(params.value && params.value > 0) {
+						return params.value.addComma();
+					} else {
+						return '0';
+					}
+				},
+				cellEditor: 'textCellEditor',
+				cellEditorParams: { maxlength: 3, validType: 'numeric'}
+			},
 			{headerName: "사용여부", field: "useYn" , width: 120, cellClass: 'text-center'},
-			{headerName: "시퀀스", field: "tmtbBurdenSq", width: 150, cellClass: 'text-center'}
+			{headerName: "시퀀스", field: "tmtbBurdenSq", width: 150, cellClass: 'text-center', hide: true}
 		];
 
 		// 구간 할인/혜택 설정
@@ -383,9 +381,16 @@
 				valueFormatter: function (params) { return gagaAgGrid.lookupValue(sectionGbList, params.value); },
 				valueParser: function (params) { return gagaAgGrid.lookupKey(sectionGbList, params.newValue); }
 			},
-			{headerName: "구간값", field: "sectionVal", width: 100, cellClass: 'text-right',
+			{headerName: "구간값", field: "sectionVal", width: 100, cellClass: 'text-right', required: true
+				,valueFormatter: function(params) {
+					if(params.value && params.value > 0) {
+						return params.value.addComma();
+					} else {
+						return '0';
+					}
+				},
 				cellEditor: 'textCellEditor',
-				cellEditorParams: { maxlength: 50, required: true }
+				cellEditorParams: { maxlength: 14, validType: 'numeric'}
 			},
 			{headerName: "할인구분", field: "dcWay", width: 100, cellClass: 'text-center',
 				cellEditor: 'agRichSelectCellEditor',
@@ -393,12 +398,19 @@
 				valueFormatter: function (params) { return gagaAgGrid.lookupValue(dcWayList, params.value); },
 				valueParser: function (params) { return gagaAgGrid.lookupKey(dcWayList, params.newValue); }
 			},
-			{headerName: "할인값", field: "dcVal", width: 100, cellClass: 'text-right',
+			{headerName: "할인값", field: "dcVal", width: 100, cellClass: 'text-right', required: true
+				,valueFormatter: function(params) {
+					if(params.value && params.value > 0) {
+						return params.value.addComma();
+					} else {
+						return '0';
+					}
+				},
 				cellEditor: 'textCellEditor',
-				cellEditorParams: { maxlength: 50, required: true }
+				cellEditorParams: { maxlength: 14, validType: 'numeric'}
 			},
-			{headerName: "구간시퀀스", field: "tmtbSectionSq", width: 150, cellClass: 'text-center'},
-			{headerName: "할인값시퀀스", field: "tmtbValSq", width: 150, cellClass: 'text-center'}
+			{headerName: "구간시퀀스", field: "tmtbSectionSq", width: 150, cellClass: 'text-center', hide: true},
+			{headerName: "할인값시퀀스", field: "tmtbValSq", width: 150, cellClass: 'text-center', hide: true}
 		];
 
 		// 공급업체 리스트 설정
@@ -464,6 +476,10 @@
 
 		// 수정 버튼 클릭시
 		$('#btnMorebetterUpdate').on('click', function() {
+			// validation
+			if (!gagajf.validation('#moreBetterForm'))
+				return false;
+
 			// 행사기간 확인
 			let fromDate = $('#moreBetterForm input[name=tmtbStdt]').val();
 			let toDate = $('#moreBetterForm input[name=tmtbEddt]').val();
@@ -480,10 +496,6 @@
 				return false;
 			}
 
-			// validation
-			if (!gagajf.validation('#moreBetterForm'))
-				return false;
-
 			// disabled 값 넘겨주기
 			$('#moreBetterForm input[name=tmtbSq]').val($('#moreBetterForm input[name=disTmtbSq]').val());
 			$('#moreBetterForm input[name=tmtbStat]').val($('input:radio[name="disTmtbStat"]:checked').val());
@@ -514,9 +526,9 @@
 
 					var jsonData = JSON.stringify($('#moreBetterForm').serializeObject());
 					gagajf.ajaxJsonSubmit($('#moreBetterForm').prop('action'), jsonData, function() {
-						//$('#btnSearch').trigger('click');
-						//$('#btnNew').trigger('click');
-						console.log('update 11111');
+						fnMorebetterFormClose();
+						$('#btnInit').trigger('click');
+						$('#btnSearch').trigger('click');
 					});
 				}
 			});
@@ -524,27 +536,9 @@
 
 		// 저장 버튼 클릭시
 		$('#btnMorebetterSave').on('click', function() {
-			// 각 ag-grid list 수량
-			let supplyCompCnt = gagaAgGrid.selectedRowData(gridOptionsFGCompanyList).length;
-			let brandCnt = gagaAgGrid.selectedRowData(gridOptionsFGBrandList).length;
-			let applyGoodsCnt = gagaAgGrid.selectedRowData(gridOptionsFGApplyGoodsList).length;
-			let exceptGoodsCnt = gagaAgGrid.selectedRowData(gridOptionsFGExceptGoodsList).length;
-			let applyBurdenCnt = gagaAgGrid.selectedRowData(gridOptionsApplyBurdenList).length;
-			let sectionGbCnt = gagaAgGrid.selectedRowData(gridOptionsSectionGbList).length;
-			console.log('supplyCompCnt>>'+supplyCompCnt);
-			console.log('brandCnt>>'+brandCnt);
-			console.log('applyGoodsCnt>>'+applyGoodsCnt);
-			console.log('exceptGoodsCnt>>'+exceptGoodsCnt);
-			console.log('applyBurdenCnt>>'+applyBurdenCnt);
-			console.log('sectionGbCnt>>'+sectionGbCnt);
-			if(applyGoodsCnt < 1){
-				mcxDialog.alert("선택된 적용상품이 없습니다.");
-				return false;
-			}
-			if(sectionGbCnt < 1){
-				mcxDialog.alert("선택된 할인구간이 없습니다.");
+			// validation
+			if (!gagajf.validation('#moreBetterForm'))
 				return false;
-			}
 
 			// 행사기간 확인
 			let fromDate = $('#moreBetterForm input[name=tmtbStdt]').val();
@@ -562,10 +556,22 @@
 				return false;
 			}
 
+			// 각 ag-grid list 수량
+			let supplyCompCnt = gagaAgGrid.selectedRowData(gridOptionsFGCompanyList).length;
+			let brandCnt = gagaAgGrid.selectedRowData(gridOptionsFGBrandList).length;
+			let applyGoodsCnt = gagaAgGrid.selectedRowData(gridOptionsFGApplyGoodsList).length;
+			let exceptGoodsCnt = gagaAgGrid.selectedRowData(gridOptionsFGExceptGoodsList).length;
+			let applyBurdenCnt = gagaAgGrid.selectedRowData(gridOptionsApplyBurdenList).length;
+			let sectionGbCnt = gagaAgGrid.selectedRowData(gridOptionsSectionGbList).length;
 
-			// validation
-			if (!gagajf.validation('#moreBetterForm'))
+			if(applyGoodsCnt < 1){
+				mcxDialog.alert("선택된 적용상품이 없습니다.");
 				return false;
+			}
+			if(sectionGbCnt < 1){
+				mcxDialog.alert("선택된 할인구간이 없습니다.");
+				return false;
+			}
 
 			// disabled 값 넘겨주기
 			$('#moreBetterForm input[name=tmtbSq]').val($('#moreBetterForm input[name=disTmtbSq]').val());
@@ -598,9 +604,9 @@
 
 					var jsonData = JSON.stringify($('#moreBetterForm').serializeObject());
 					gagajf.ajaxJsonSubmit($('#moreBetterForm').prop('action'), jsonData, function() {
-						//$('#btnSearch').trigger('click');
-						//$('#btnNew').trigger('click');
-						console.log('save 11111');
+						fnMorebetterFormClose();
+						$('#btnInit').trigger('click');
+						$('#btnSearch').trigger('click');
 					});
 				}
 			});