Forráskód Böngészése

상품 조회 팝업 - 업체/브랜드 멀티검색 적용

eskim 5 éve
szülő
commit
fb330f526c

+ 19 - 0
src/main/java/com/style24/admin/biz/web/TsaGoodsController.java

@@ -2114,6 +2114,25 @@ public class TsaGoodsController extends TsaBaseController {
 				goodsSearch.setSearchGb("MASTER");
 			}
 		}
+		if (!StringUtils.isBlank(goodsSearch.getBrandList())) {
+			try {
+				String [] arrBrandCd = mapper.readValue(goodsSearch.getBrandList(), String[].class);
+				goodsSearch.setMultiBrand(arrBrandCd);
+			} catch (Exception e) {
+				e.printStackTrace();
+				throw new IllegalStateException(message.getMessage("브랜드코드 검색중 오류로 인해 조회되지 않았습니다."));
+			}
+		}
+
+		if (!StringUtils.isBlank(goodsSearch.getSupplyCompList())) {
+			try {
+				String [] arrSupplyComp = mapper.readValue(goodsSearch.getSupplyCompList(), String[].class);
+				goodsSearch.setMultiSupplyCompCd(arrSupplyComp);
+			} catch (Exception e) {
+				e.printStackTrace();
+				throw new IllegalStateException(message.getMessage("업체코드 검색중 오류로 인해 조회되지 않았습니다."));
+			}
+		}
 		//log.info("[getPopupGoodsList] goodsSearch=>{}", goodsSearch);
 		goodsSearch.setRegNo(TsaSession.getInfo().getUserNo()); // 엑셀조회시 로그인 사용자의 엑셀 상품조회시 사용
 		goodsSearch.setPageable(new TscPageRequest(goodsSearch.getPageNo() - 1, goodsSearch.getPageSize()));

+ 3 - 3
src/main/webapp/WEB-INF/views/business/BrandPopupForm.html

@@ -14,7 +14,7 @@
  * 1.0  2020.12.15   eskim       최초 작성
  *******************************************************************************
  -->
-<div class="modalPopup" data-width="700" id="popupBrandList">
+<div class="modalPopup" data-width="650" id="popupBrandList">
 	<div class="panelStyle">
 		<!-- TITLE -->
 		<div class="panelTitle">
@@ -45,11 +45,11 @@
 							</td>
 						</tr>
 						<tr>
-							<th>브랜드코드</th>
+							<th>브랜드코드<i class="required" title="필수"></i></th>
 							<td>
 								<textarea class="textareaR3" name="searchBrandCd" id="searchBrandCd"></textarea>
 							</td>
-							<th>브랜드명</th>
+							<th>브랜드명<i class="required" title="필수"></i></th>
 							<td>
 								<textarea class="textareaR3" name="searchBrandNm" id="searchBrandNm"></textarea>
 							</td>

+ 8 - 2
src/main/webapp/WEB-INF/views/business/SupplyCompanyPopupForm.html

@@ -46,11 +46,11 @@
 							</td>
 						</tr>
 						<tr>
-							<th>업체코드</th>
+							<th>업체코드<i class="required" title="필수"></i></th>
 							<td>
 								<textarea class="textareaR3" name="searchSupplyCompCd" id="searchSupplyCompCd"></textarea>
 							</td>
-							<th>업체명</th>
+							<th>업체명<i class="required" title="필수"></i></th>
 							<td>
 								<textarea class="textareaR3" name="searchSupplyCompNm" id="searchSupplyCompNm"></textarea>
 							</td>
@@ -101,6 +101,12 @@
 
 		// 조회
 		$('#btnSearchCompanyList').on('click', function() {
+			
+			if (gagajf.isNull($('#searchCompanyListForm textarea[name=searchSupplyCompCd]').val())  && gagajf.isNull($('#searchCompanyListForm textarea[name=searchSupplyCompNm]').val())){
+				mcxDialog.alert('검색조건을 입력하세요.');
+				return false;
+			}
+			
 			// Fetch data
 			gagaAgGrid.fetch($('#searchCompanyListForm').prop('action'), gridOptionsCompanyPopupList, '#searchCompanyListForm');
 		});

+ 1 - 2
src/main/webapp/WEB-INF/views/goods/GoodsListForm.html

@@ -58,7 +58,6 @@
 							<button type="button" class="btn icn" id="btnSearchSupplyComp"><i class="fa fa-search"></i></button>
 							<span id="supplyCompText"></span>
 							<input type="hidden" name="supplyCompList"/>
-							
 							<!-- <label class="rdoBtn"><input type="radio" name="selfYn" id="selfYnY" value="Y"  checked/>자사</label>
 							<label class="rdoBtn"><input type="radio" name="selfYn" id="selfYnN" value="N"/>입점</label>
 							<select name="supplyCompCd" id="supplyCompCd">
@@ -559,6 +558,7 @@
 		$('#searchForm input[name=brandList]').val('');
 		$('#searchForm input[name=supplyCompList]').val('');
 		$('#searchForm').find('#brandText').html('');
+		$('#searchForm').find('#supplyCompText').html('');
 	});
 
 	// 조회클릭시
@@ -595,7 +595,6 @@
 		var cnt = 0;
 
 		if( !gagajf.isNull($("#searchForm input[name=supplyCompList]").val()) 
-				|| !gagajf.isNull($("#searchForm select[name=statSupplyCompCd]").val()) 
 				|| !gagajf.isNull($("#searchForm textarea[name=condition]").val())
 				|| (!gagajf.isNull($("#searchForm input[name=stDate]").val()) && !gagajf.isNull($("#searchForm input[name=edDate]").val()))
 				|| !gagajf.isNull($("#searchForm input[name=brandList]").val())

+ 78 - 29
src/main/webapp/WEB-INF/views/goods/GoodsPopupListForm.html

@@ -27,7 +27,7 @@
 		<input type="hidden" id="goodsPriceYn" name="goodsPriceYn" value="Y"/> <!-- 즉시할인판매가 조회 -->
 		<div class="panelContent">
 			<ul class="notice">
-				<li>아래 검색조건 중 <font color="red">업체, 키워드, 발생일</font>중 하나를 꼭 입력해 주세요.</li>
+				<li>아래 검색조건 중 <font color="red">업체, 브랜드, 키워드, 발생일</font>중 하나를 꼭 입력해 주세요.</li>
 			</ul>
 			<table class="frmStyle">
 				<colgroup>
@@ -41,22 +41,28 @@
 					<col/>
 				</colgroup>
 				<tr>
-					<th>업체/브랜드<em class="required" title="필수"></em></th>
-					<td colspan="3">
-						<label class="rdoBtn"><input type="radio" name="selfYn" id="selfYnY" value="Y"  checked/>자사</label>
-						<label class="rdoBtn"><input type="radio" name="selfYn" id="selfYnN" value="N"/>입점</label>
-						<select name="supplyCompCd" id="supplyCompCd">
-							<option value="" th:if="${sessionInfo.roleCd} != 'G001_B000'">[전체]</option>
-							<option th:if="${supplyCompList}" th:each="oneData, status : ${supplyCompList}" th:value="${oneData.cd}" th:text="${'[' + oneData.cd + '] ' + oneData.cdNm}"></option>
-						</select>
-						<span id="multiBrand"></span>
+					<th>업체<em class="required" title="필수"></em></th>
+					<td>
+						<input type="text" class="w100" name="supplyCompSearchTxt" id="supplyCompSearchTxt" maxlength="20" />
+						<button type="button" class="btn icn" id="btnPopupSearchSupplyComp"><i class="fa fa-search"></i></button>
+						<span id="supplyCompText"></span>
+						<input type="hidden" name="supplyCompList"/>
 					</td>
 					<th>브랜드<em class="required" title="필수"></em></th>
-						<td>
-							<input type="text" class="w100" name="searchTxt" id="searchTxt" maxlength="20" />
-							<button type="button" class="btn icn" id="btnPopupSearchBrand"><i class="fa fa-search"></i></button>
-							<input type="text" class="w100" name="brandCd" readonly="readonly"/>
-						</td>
+					<td>
+						<input type="text" class="w100" name="searchTxt" id="searchTxt" maxlength="20" />
+						<button type="button" class="btn icn" id="btnPopupSearchBrand"><i class="fa fa-search"></i></button>
+						<!-- <input type="text" class="w100" name="brandCd" readonly="readonly"/> -->
+						<span id="brandText"></span>
+						<input type="hidden" name="brandList"/>
+					</td>
+					<th>상품타입</th>
+					<td>
+						<select name="goodsType" id="goodsType">
+							<option value="">[전체]</option>
+							<option th:if="${goodsTypeList}" th:each="oneData, status : ${goodsTypeList}" th:value="${oneData.cd}" th:text="${'[' + oneData.cd + '] ' + oneData.cdNm}"></option>
+						</select>
+					</td>	
 					<th rowspan="4">키워드<em class="required" title="필수"></em></th>
 					<td rowspan="4">
 						<select name="search" id="search">
@@ -193,14 +199,7 @@
 				</tr>
 				<tr>
 					<th>발생일<em class="required" title="필수"></em></th>
-					<td colspan="5" id="sellTermsP"></td>
-					<th>상품타입</th>
-					<td>
-						<select name="goodsType" id="goodsType">
-							<option value="">[전체]</option>
-							<option th:if="${goodsTypeList}" th:each="oneData, status : ${goodsTypeList}" th:value="${oneData.cd}" th:text="${'[' + oneData.cd + '] ' + oneData.cdNm}"></option>
-						</select>
-					</td>
+					<td colspan="7" id="sellTermsP"></td>
 				</tr>
 			</table>
 			<ul class="panelBar">
@@ -342,6 +341,10 @@
 		//$("#goodsPopupForm input[type=radio]").parent("label").removeClass("checked");
 		$("#goodsPopupForm input[type=checkbox]").parent("label").removeClass("checked");
 		$("#goodsPopupForm input[type=radio][checked]").parent("label").addClass("checked");
+		$('#goodsPopupForm input[name=brandList]').val('');
+		$('#goodsPopupForm input[name=supplyCompList]').val('');
+		$('#goodsPopupForm').find('#brandText').html('');
+		$('#goodsPopupForm').find('#supplyCompText').html('');
 	});
 
 	// 조회클릭시
@@ -381,10 +384,10 @@
 		var searchFlag = false;
 		var cnt = 0;
 
-		if( !gagajf.isNull($("#goodsPopupForm select[name=supplyCompCd]").val())
+		if( !gagajf.isNull($("#goodsPopupForm input[name=supplyCompList]").val())
 				|| !gagajf.isNull($("#goodsPopupForm textarea[name=condition]").val())
 				|| (!gagajf.isNull($("#goodsPopupForm input[name=stDate]").val()) && !gagajf.isNull($("#goodsPopupForm input[name=edDate]").val())
-				|| !gagajf.isNull($("#goodsPopupForm input[name=brandCd]").val())
+				|| !gagajf.isNull($("#goodsPopupForm input[name=brandList]").val())
 
 				)
 			){
@@ -532,20 +535,66 @@
 		
 	});
 	
+	// 업체 조회 선택시
+	$('#btnPopupSearchSupplyComp').on('click', function() {
+		cfnOpenCompanyListPopup('fnSetPopupSupplyCompInfo', 'M');
+	});
+	
+	// 업체 조회 팝업에서 호출
+	var fnSetPopupSupplyCompInfo = function(result) {
+		var arrSupplyComp = [];
+		var supplyCompText = "";
+		var sIndex = 0;
+		$('#goodsPopupForm').find('#supplyCompText').html('');
+		$('#goodsPopupForm input[name=supplyCompSearchTxt]').val('');
+		result.forEach(function(supplyComp){
+			sIndex++; 
+			arrSupplyComp.push(supplyComp.supplyCompCd);
+		});
+
+		// 조회값이 하나일 경우 화면에 코드 노출 그외는 갯수 처리 
+		if (sIndex == 1) {
+			$('#goodsPopupForm input[name=supplyCompSearchTxt]').val(arrSupplyComp[0]);
+		}else{
+			supplyCompText = sIndex + " 개";
+			$('#goodsPopupForm').find('#supplyCompText').html(supplyCompText);	
+		}
+		var jsonData = JSON.stringify(arrSupplyComp);
+		$("#goodsPopupForm input[name=supplyCompList]").val(jsonData);
+	}
+	
 	// 브랜드 조회 팝업에서 호출
 	var fnSetPopupBrandInfo = function(result) {
-		$("#goodsPopupForm input[name=brandCd]").val(result[0].brandCd);
+		var arrbrandCd = [];
+		var brandText = "";
+		var bIndex = 0;
+		$('#goodsPopupForm').find('#brandText').html('');
+		$('#goodsPopupForm input[name=searchTxt]').val('');
+		result.forEach(function(brand){
+			bIndex++; 
+			arrbrandCd.push(brand.brandCd);
+		});
+
+		// 조회값이 하나일 경우 화면에 코드 노출 그외는 갯수 처리 
+		if (bIndex == 1) {
+			$('#goodsPopupForm input[name=searchTxt]').val(arrbrandCd[0]);
+		}else{
+			brandText = bIndex + " 개";
+			$('#goodsPopupForm').find('#brandText').html(brandText);	
+		}
+		var jsonData = JSON.stringify(arrbrandCd);
+		$("#goodsPopupForm input[name=brandList]").val(jsonData);
 	}
 	
 	// 브랜드 조회 선택시
 	$('#btnPopupSearchBrand').on('click', function() {
 
-		if (gagajf.isNull($("#goodsPopupForm input[name=searchTxt]").val())){
+		/* if (gagajf.isNull($("#goodsPopupForm input[name=searchTxt]").val())){
 			mcxDialog.alert('브랜드 검색어를 입력하세요.');
 			return false;
 		}
-		
-		cfnOpenBrandListPopup('fnSetPopupBrandInfo', $("#goodsPopupForm input[name=searchTxt]").val());
+		 */
+		cfnOpenBrandListPopup('fnSetPopupBrandInfo', 'M');
 		
 	});