瀏覽代碼

상품조회팝업 - 품목팝업처리

eskim 4 年之前
父節點
當前提交
07b618d024

+ 10 - 0
src/main/java/com/style24/scm/biz/web/TssGoodsController.java

@@ -1532,6 +1532,16 @@ public class TssGoodsController extends TssBaseController {
 			}
 		}
 
+		if (!StringUtils.isBlank(goodsSearch.getItemkindList())) {
+			try {
+				String[] arrItemkind = mapper.readValue(goodsSearch.getItemkindList(), String[].class);
+				goodsSearch.setMultiItemkindCd(arrItemkind);
+			} catch (Exception e) {
+				e.printStackTrace();
+				throw new IllegalStateException("품목 검색중 오류로 인해 조회되지 않았습니다.");
+			}
+		}
+		
 		goodsSearch.setRegNo(TssSession.getInfo().getUserNo()); // 엑셀조회시 로그인 사용자의 엑셀 상품조회시 사용
 		goodsSearch.setPageable(new TscPageRequest(goodsSearch.getPageNo() - 1, goodsSearch.getPageSize()));
 		goodsSearch.getPageable().setTotalCount(goodsService.getGoodsListCount(goodsSearch));

+ 32 - 7
src/main/webapp/WEB-INF/views/goods/GoodsPopupListForm.html

@@ -69,13 +69,10 @@
 				<tr>
 					<th>품목</th>
 					<td>
-						<div class="multiCheckBox"  style="width:300px">
-							<button type="button" class="sltBtn">[전체]</button>
-							<ul style="overflow:auto; height:170px;">
-								<li><label class="chkBox"><input type="checkbox" name="전체선택" id="multiItemkindCd" onclick="uifnAllCheck('multiItemkindCd')">전체선택</label></li>
-								<li th:if="${itemkindList}" th:each="oneData, status : ${itemkindList}"><label class="chkBox"><input type="checkbox" name="multiItemkindCd" th:id="${'itemkindCd' + oneData.cd}" th:value="${oneData.cd}" ><th:block th:text="${'[' + oneData.cd + '] ' + oneData.cdNm}"></th:block></label></li>
-							</ul>
-						</div>
+						<input type="text" class="w100" name="itemkindSearchTxt" id="itemkindSearchTxt" maxlength="20" />
+						<button type="button" class="btn icn" id="btnPopupSearchItemkind"><i class="fa fa-search"></i></button>
+						<span id="itemkindText"></span>
+						<input type="hidden" name="itemkindList"/>
 					</td>
 					<th>상품상태</th>
 					<td>
@@ -521,6 +518,34 @@
 		cfnCreateMultiCombo(actionUrl,"multiBrand",  "[전체]",null, 'Y', null, null, 'goodsPopupForm');
 	}
 	
+	// 품목 조회 선택시
+	$('#btnPopupSearchItemkind').on('click', function() {
+		cfnOpenItemkindListPopup('fnSetPopupItemkindInfo', 'M');
+	});
+	
+	// 품목 조회 팝업에서 호출
+	var fnSetPopupItemkindInfo = function(result) {
+		var arrItemkind = [];
+		var itemkindText = "";
+		var sIndex = 0;
+		$('#goodsPopupForm').find('#itemkindText').html('');
+		$('#goodsPopupForm input[name=itemkindSearchTxt]').val('');
+		result.forEach(function(itemkind){
+			sIndex++; 
+			arrItemkind.push(itemkind.itemkindCd);
+		});
+
+		// 조회값이 하나일 경우 화면에 코드 노출 그외는 갯수 처리 
+		if (sIndex == 1) {
+			$('#goodsPopupForm input[name=itemkindSearchTxt]').val(arrItemkind[0]);
+		}else{
+			itemkindText = sIndex + " 개";
+			$('#goodsPopupForm').find('#itemkindText').html(itemkindText);	
+		}
+		var jsonData = JSON.stringify(arrItemkind);
+		$("#goodsPopupForm input[name=itemkindList]").val(jsonData);
+	}
+	
 	$(document).ready(function() {
 		cfnCreateCalendar('#sellTermsP', 'stDate', 'edDate', true, '등록일', 'X');