|
|
@@ -29,9 +29,6 @@
|
|
|
<input type="hidden" name="exceptGoodsList"/> <!-- 제외상품 리스트 -->
|
|
|
<input type="hidden" name="burdenList"/> <!-- 업체 분담율 리스트 -->
|
|
|
<input type="hidden" name="sectionGbList"/> <!-- 다다익선 구간/혜택 리스트 -->
|
|
|
- <input type="hidden" name="supplyCompArr"/>
|
|
|
- <input type="hidden" name="brandArr"/>
|
|
|
- <input type="hidden" name="goodsArr"/>
|
|
|
|
|
|
<div class="panelContent">
|
|
|
<table class="frmStyle">
|
|
|
@@ -269,8 +266,9 @@
|
|
|
<li class="right">
|
|
|
<!-- <th:block th:if="${sessionInfo.roleCd == 'G001_0000' OR sessionInfo.roleCd == 'G001_A000' OR sessionInfo.roleCd == 'G001_A101' OR sessionInfo.roleCd == 'G001_A100' OR sessionInfo.roleCd == 'G001_A001'}"> -->
|
|
|
<!--<button type="button" class="btn btnRight btn-success btn-lg" id="btnSearchList">목록</button>-->
|
|
|
- <button type="button" th:if="${mode == 'N'}" class="btn btnRight btn-success btn-lg" id="btnMorebetterSave">저장</button>
|
|
|
- <button type="button" th:if="${mode == 'U'}" class="btn btnRight btn-success btn-lg" id="btnMorebetterUpdate">수정</button>
|
|
|
+ <button type="button" class="btn btnRight btn-success btn-lg" id="btnMorebetterSave">저장</button>
|
|
|
+ <!--<button type="button" th:if="${mode == 'N'}" class="btn btnRight btn-success btn-lg" id="btnMorebetterSave">저장</button>
|
|
|
+ <button type="button" th:if="${mode == 'U'}" class="btn btnRight btn-success btn-lg" id="btnMorebetterUpdate">수정</button>-->
|
|
|
<!--<button type="button" class="btn btnRight btn-success btn-lg" id="btnChangeStatIng">진행</button>
|
|
|
<button type="button" class="btn btnRight btn-success btn-lg" id="btnPromotionDelete">삭제</button>
|
|
|
<button type="button" class="btn btnRight btn-success btn-lg" id="btnPromotionStop">중지</button>-->
|
|
|
@@ -541,53 +539,25 @@
|
|
|
});
|
|
|
});
|
|
|
|
|
|
- $('#btnMorebetterSave').on('click', function() {
|
|
|
- var allSupplyCompData = gagaAgGrid.getAllRowData(gridOptionsFGCompanyList);
|
|
|
- var allBrandData = gagaAgGrid.getAllRowData(gridOptionsFGBrandList);
|
|
|
- var allApplyGoodsData = gagaAgGrid.getAllRowData(gridOptionsFGApplyGoodsList);
|
|
|
-
|
|
|
- // 공급업체+브랜드 상품조회
|
|
|
- var multiSupplyCompCd = [];
|
|
|
- $.each(allSupplyCompData, function(idx, item) {
|
|
|
- multiSupplyCompCd.push(item.supplyCompCd);
|
|
|
- });
|
|
|
-
|
|
|
- var multiBrand = [];
|
|
|
- $.each(allBrandData, function(idx, item) {
|
|
|
- multiBrand.push(item.brandCd);
|
|
|
- });
|
|
|
-
|
|
|
- var multiGoods = [];
|
|
|
- $.each(allApplyGoodsData, function(idx, item) {
|
|
|
- multiGoods.push(item.goodsCd);
|
|
|
- });
|
|
|
-
|
|
|
- $('#moreBetterForm input[name=supplyCompArr]').val(multiSupplyCompCd.join(','));
|
|
|
- $('#moreBetterForm input[name=brandArr]').val(multiBrand.join(','));
|
|
|
- $('#moreBetterForm input[name=goodsArr]').val(multiGoods.join(','));
|
|
|
-
|
|
|
- var jsonData = JSON.stringify($('#moreBetterForm').serializeObject());
|
|
|
- gagajf.ajaxJsonSubmit($('#moreBetterForm').prop('action'), jsonData, fnMorebetterSaveCollback);
|
|
|
- });
|
|
|
-
|
|
|
- var fnMorebetterSaveCollback = function(result){
|
|
|
- console.log('duplicateYn::::'+result.duplicateYn);
|
|
|
- if(result.duplicateYn == "Y"){
|
|
|
- console.log('duplicateGoodsList Size::'+ result.duplicateGoodsList.length);
|
|
|
- for(let i=0; i<result.duplicateGoodsList.length; i++){
|
|
|
- gagaAgGrid.addRowData(gridOptionsDuplicateGoodsList, {"goodsCd" : result.duplicateGoodsList[i].goodsCd, "goodsNm" : result.duplicateGoodsList[i].goodsNm});
|
|
|
+ var fnGoodsGbCheck = function (){
|
|
|
+ let applyGoodsData = gagaAgGrid.getAllRowData(gridOptionsFGApplyGoodsList);
|
|
|
+ var checkCnt = 0;
|
|
|
+ $.each(applyGoodsData, function(idx, item) {
|
|
|
+ if(item.goodsGb == 'G800_10'){
|
|
|
+ checkCnt++;
|
|
|
}
|
|
|
- gagaAgGrid.exportToExcel('다다익선 중복상품 목록', gridOptionsDuplicateGoodsList);
|
|
|
+ });
|
|
|
+ console.log('checkCnt>>'+checkCnt);
|
|
|
+ if(checkCnt < 1){
|
|
|
+ mcxDialog.alert("기본상품을 1개 이상 지정해주세요.");
|
|
|
+ return false;
|
|
|
}else{
|
|
|
- mcxDialog.alert(result.msg);
|
|
|
- fnMorebetterFormClose();
|
|
|
- $('#btnInit').trigger('click');
|
|
|
- $('#btnSearch').trigger('click');
|
|
|
+ console.log('통과');
|
|
|
}
|
|
|
- }
|
|
|
+ };
|
|
|
|
|
|
- // 저장 버튼 클릭시
|
|
|
- $('#btnMorebetterSave2').on('click', function() {
|
|
|
+ // 저장
|
|
|
+ $('#btnMorebetterSave').on('click', function() {
|
|
|
// validation
|
|
|
if (!gagajf.validation('#moreBetterForm'))
|
|
|
return false;
|
|
|
@@ -607,84 +577,78 @@
|
|
|
$('#moreBetterForm input[name=tmtbStdt]').focus();
|
|
|
return false;
|
|
|
}
|
|
|
- // 공급업체&&브랜드 체크
|
|
|
- let allSupplyCompCnt = gagaAgGrid.getAllRowData(gridOptionsFGCompanyList).length;
|
|
|
- let allBrandCnt = gagaAgGrid.getAllRowData(gridOptionsFGBrandList).length;
|
|
|
- console.log('allSupplyCompCnt>>>>'+allSupplyCompCnt);
|
|
|
- console.log('allBrandCnt>>>>'+allBrandCnt);
|
|
|
- if(allSupplyCompCnt>0){
|
|
|
- if(allBrandCnt<1){
|
|
|
+
|
|
|
+ // 각 ag-grid list 수량
|
|
|
+ let allSupplyCompData = gagaAgGrid.getAllRowData(gridOptionsFGCompanyList);
|
|
|
+ let allBrandData = gagaAgGrid.getAllRowData(gridOptionsFGBrandList);
|
|
|
+ let allApplyGoodsData = gagaAgGrid.getAllRowData(gridOptionsFGApplyGoodsList);
|
|
|
+ let allExceptGoodsData = gagaAgGrid.getAllRowData(gridOptionsFGExceptGoodsList);
|
|
|
+ let allApplyBurdenData = gagaAgGrid.getAllRowData(gridOptionsApplyBurdenList);
|
|
|
+ let allSectionGbData = gagaAgGrid.getAllRowData(gridOptionsSectionGbList);
|
|
|
+
|
|
|
+ if(allSupplyCompData.length > 0){
|
|
|
+ if(allBrandData.length < 1){
|
|
|
mcxDialog.alert('브랜드를 추가해주세요.');
|
|
|
return;
|
|
|
}
|
|
|
}
|
|
|
- if(allBrandCnt>0){
|
|
|
- if(allSupplyCompCnt<1){
|
|
|
+ if(allBrandData.length > 0){
|
|
|
+ if(allSupplyCompData.length < 1){
|
|
|
mcxDialog.alert('공급업체를 추가해주세요.');
|
|
|
return;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- // 각 ag-grid list 수량
|
|
|
- let supplyCompCnt = gagaAgGrid.getAllRowData(gridOptionsFGCompanyList).length;
|
|
|
- let brandCnt = gagaAgGrid.getAllRowData(gridOptionsFGBrandList).length;
|
|
|
- let applyGoodsCnt = gagaAgGrid.getAllRowData(gridOptionsFGApplyGoodsList).length;
|
|
|
- let exceptGoodsCnt = gagaAgGrid.getAllRowData(gridOptionsFGExceptGoodsList).length;
|
|
|
- let applyBurdenCnt = gagaAgGrid.getAllRowData(gridOptionsApplyBurdenList).length;
|
|
|
- let sectionGbCnt = gagaAgGrid.getAllRowData(gridOptionsSectionGbList).length;
|
|
|
-
|
|
|
- if(applyGoodsCnt < 1){
|
|
|
- mcxDialog.alert("적용상품이 없습니다.");
|
|
|
- return false;
|
|
|
- }
|
|
|
- if(sectionGbCnt < 1){
|
|
|
+ if(allSectionGbData.length < 1){
|
|
|
mcxDialog.alert("할인구간을 설정해주세요.");
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
- // disabled 값 넘겨주기
|
|
|
- $('#moreBetterForm input[name=tmtbSq]').val($('#moreBetterForm input[name=disTmtbSq]').val());
|
|
|
- $('#moreBetterForm input[name=tmtbStat]').val($('input:radio[name="disTmtbStat"]:checked').val());
|
|
|
+ // 적용상품 그리드에 기본상품 1개이상 있는지 체크
|
|
|
+ fnGoodsGbCheck();
|
|
|
+
|
|
|
+ var data = {
|
|
|
+ mode : $('#moreBetterForm input[name=mode]').val()
|
|
|
+ , tmtbSq : $('#moreBetterForm input[name=disTmtbSq]').val()
|
|
|
+ , tmtbNm : $('#moreBetterForm input[name=tmtbNm]').val()
|
|
|
+ , tmtbStat : $('input:radio[name="disTmtbStat"]:checked').val()
|
|
|
+ , tmtbStdt : $('#moreBetterForm input[name=tmtbStdt]').val()
|
|
|
+ , tmtbEddt : $('#moreBetterForm input[name=tmtbEddt]').val()
|
|
|
+ , sectionGb : $('input:radio[name="sectionGb"]:checked').val()
|
|
|
+ , applyGb : $('input:radio[name="sectionGb"]:checked').val()
|
|
|
+ , dcWay : $('input:radio[name="dcWay"]:checked').val()
|
|
|
+ , multiYn : $('#moreBetterForm input[name=multiYn]').val()
|
|
|
+ , supplyCompList : allSupplyCompData
|
|
|
+ , brandList : allBrandData
|
|
|
+ , applyGoodsList : allApplyGoodsData
|
|
|
+ , exceptGoodsList : allExceptGoodsData
|
|
|
+ , burdenList : allApplyBurdenData
|
|
|
+ , sectionGbList : allSectionGbData
|
|
|
+ };
|
|
|
+
|
|
|
+ var jsonData = JSON.stringify(data);
|
|
|
|
|
|
- mcxDialog.confirm('선택된 데이터를 저장하시겠습니까?', {
|
|
|
- cancelBtnText: "취소",
|
|
|
- sureBtnText: "확인",
|
|
|
- sureBtnClick: function(){
|
|
|
- var compAllData = gagaAgGrid.getAllRowData(gridOptionsFGCompanyList);
|
|
|
- var brandAllData = gagaAgGrid.getAllRowData(gridOptionsFGBrandList);
|
|
|
- var applyAllData = gagaAgGrid.getAllRowData(gridOptionsFGApplyGoodsList);
|
|
|
- var exceptAllData = gagaAgGrid.getAllRowData(gridOptionsFGExceptGoodsList);
|
|
|
- var burdenAllData = gagaAgGrid.getAllRowData(gridOptionsApplyBurdenList);
|
|
|
- var sectionGbAllData = gagaAgGrid.getAllRowData(gridOptionsSectionGbList);
|
|
|
-
|
|
|
- var jsonSupplyCompData = JSON.stringify(compAllData);
|
|
|
- $('#moreBetterForm input[name=supplyCompList]').val(jsonSupplyCompData);
|
|
|
- var jsonBrandData = JSON.stringify(brandAllData);
|
|
|
- $('#moreBetterForm input[name=brandList]').val(jsonBrandData);
|
|
|
- var jsonApplyData = JSON.stringify(applyAllData);
|
|
|
- $('#moreBetterForm input[name=applyGoodsList]').val(jsonApplyData);
|
|
|
- var jsonExceptData = JSON.stringify(exceptAllData);
|
|
|
- $('#moreBetterForm input[name=exceptGoodsList]').val(jsonExceptData);
|
|
|
- var jsonBurdenData = JSON.stringify(burdenAllData);
|
|
|
- $('#moreBetterForm input[name=burdenList]').val(jsonBurdenData);
|
|
|
-
|
|
|
- var jsonSectionGbData = JSON.stringify(sectionGbAllData);
|
|
|
- $('#moreBetterForm input[name=sectionGbList]').val(jsonSectionGbData);
|
|
|
-
|
|
|
- $('#moreBetterForm input[name=applyGb]').val($('input:radio[name="sectionGb"]:checked').val());
|
|
|
-
|
|
|
-
|
|
|
- var jsonData = JSON.stringify($('#moreBetterForm').serializeObject());
|
|
|
- gagajf.ajaxJsonSubmit($('#moreBetterForm').prop('action'), jsonData, function() {
|
|
|
- fnMorebetterFormClose();
|
|
|
- $('#btnInit').trigger('click');
|
|
|
- $('#btnSearch').trigger('click');
|
|
|
- });
|
|
|
+ gagajf.ajaxJsonSubmit($('#moreBetterForm').prop('action'), jsonData, fnMorebetterSaveCollback);
|
|
|
+ });
|
|
|
|
|
|
+ var fnMorebetterSaveCollback = function(result){
|
|
|
+ console.log('duplicateYn::::'+result.duplicateYn);
|
|
|
+ if(result.duplicateYn == "Y"){
|
|
|
+ console.log('duplicateGoodsList Size::'+ result.duplicateGoodsList.length);
|
|
|
+ for(let i=0; i<result.duplicateGoodsList.length; i++){
|
|
|
+ gagaAgGrid.addRowData(gridOptionsDuplicateGoodsList, {"goodsCd" : result.duplicateGoodsList[i].goodsCd, "goodsNm" : result.duplicateGoodsList[i].goodsNm});
|
|
|
}
|
|
|
- });
|
|
|
+ mcxDialog.alert("다른 다다익선에서 사용중인 상품이 존재합니다.");
|
|
|
+ gagaAgGrid.exportToExcel('다다익선 중복상품 목록', gridOptionsDuplicateGoodsList);
|
|
|
|
|
|
- });
|
|
|
+ return;
|
|
|
+ }else{
|
|
|
+ mcxDialog.alert(result.msg);
|
|
|
+ fnMorebetterFormClose();
|
|
|
+ $('#btnInit').trigger('click');
|
|
|
+ $('#btnSearch').trigger('click');
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
// 공급업체 설정 / 업체 추가 콜백함수
|
|
|
var fnSetPopupComapnyInfo = function(result) {
|