관리자 지방문화원 등록/수정 화면 지역 '전남광주' 통합 표기
지역 select에서 광주/전남 개별 옵션을 제거하고 서울 다음에 '전남광주' 통합 옵션(값=광주코드,전남코드)을 배치. 통합 옵션 선택 시 실제 저장할 단일 AREA_CODE는 선택한 구.군 코드 앞 2자리에서 유추(fnResolveAreaCode)해 hidden #areaCode에 반영. 수정화면 진입 시 기존 지역이 광주/전남이면 통합 옵션을 자동 선택하고, 저장 시 지역/구.군 조합 검증을 추가함. - 운영(210.181.197.152 webapps/kccf) 개별 JSP 반영 완료 (백업: lclttRegist.jsp.bak_20260709_165911, 동일 폴더) Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
a7bb871a74
commit
ca74624838
@ -40,11 +40,26 @@
|
|||||||
<td>
|
<td>
|
||||||
<div class="row-df">
|
<div class="row-df">
|
||||||
<input type="hidden" id="hiddenAreaCode" name="hiddenAreaCode" value="${lclttVO.areaCode }" />
|
<input type="hidden" id="hiddenAreaCode" name="hiddenAreaCode" value="${lclttVO.areaCode }" />
|
||||||
<select class="form-control form-control-sm" id="areaCode" name="areaCode" />
|
<input type="hidden" id="areaCode" name="areaCode" value="${lclttVO.areaCode }" />
|
||||||
|
<%-- 광주, 전남 통합: 두 지역 코드 미리 조회 --%>
|
||||||
|
<c:set var="gwangjuCode" value="" />
|
||||||
|
<c:set var="jeonnamCode" value="" />
|
||||||
|
<c:forEach items="${areaCodeList}" var="areaCodeItem">
|
||||||
|
<c:if test="${areaCodeItem.aditAtrbInfoValue1 == '광주'}"><c:set var="gwangjuCode" value="${areaCodeItem.detailCode}" /></c:if>
|
||||||
|
<c:if test="${areaCodeItem.aditAtrbInfoValue1 == '전남'}"><c:set var="jeonnamCode" value="${areaCodeItem.detailCode}" /></c:if>
|
||||||
|
</c:forEach>
|
||||||
|
<select class="form-control form-control-sm" id="areaCodeSel">
|
||||||
<option value="">전체</option>
|
<option value="">전체</option>
|
||||||
|
<%-- 광주, 전남 개별 옵션은 없애고, '전남광주' 통합 옵션을 서울-부산 사이에 배치 --%>
|
||||||
<c:forEach items="${areaCodeList}" var="areaCodeList">
|
<c:forEach items="${areaCodeList}" var="areaCodeList">
|
||||||
<option value="${areaCodeList.detailCode}">${areaCodeList.detailCodeNm}</option>
|
<c:if test="${areaCodeList.aditAtrbInfoValue1 != '광주' && areaCodeList.aditAtrbInfoValue1 != '전남'}">
|
||||||
|
<option value="${areaCodeList.detailCode}">${areaCodeList.detailCodeNm}</option>
|
||||||
|
</c:if>
|
||||||
|
<c:if test="${areaCodeList.aditAtrbInfoValue1 == '서울'}">
|
||||||
|
<option value="${gwangjuCode},${jeonnamCode}">전남광주</option>
|
||||||
|
</c:if>
|
||||||
</c:forEach>
|
</c:forEach>
|
||||||
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<th>
|
<th>
|
||||||
@ -217,22 +232,59 @@ $(document).ready(function() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if($('#hiddenAreaCode').val() != null && $('#hiddenAreaCode').val() != ''){
|
if($('#hiddenAreaCode').val() != null && $('#hiddenAreaCode').val() != ''){
|
||||||
$('form#insertForm select[name=areaCode]').val($('#hiddenAreaCode').val()).prop('selected', true);
|
var initAreaCode = $('#hiddenAreaCode').val();
|
||||||
|
// '전남광주' 통합 옵션(콤마로 조합된 값)에 속하는 코드인지 확인해 있으면 통합 옵션을 선택
|
||||||
|
var mergedOption = $('#areaCodeSel option').filter(function(){
|
||||||
|
var v = $(this).val();
|
||||||
|
return v.indexOf(',') > -1 && (','+v+',').indexOf(','+initAreaCode+',') > -1;
|
||||||
|
});
|
||||||
|
if(mergedOption.length > 0){
|
||||||
|
$('#areaCodeSel').val(mergedOption.val()).prop('selected', true);
|
||||||
|
}else{
|
||||||
|
$('#areaCodeSel').val(initAreaCode).prop('selected', true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fnAreaSubCodeList($('#areaCode').val(), $('#hiddenAreaSubCode').val());
|
fnAreaSubCodeList($('#areaCodeSel').val(), $('#hiddenAreaSubCode').val());
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#areaCode').on('change', function(){
|
$('#areaCodeSel').on('change', function(){
|
||||||
fnAreaSubCodeList($(this).val(), '');
|
fnAreaSubCodeList($(this).val(), '');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$('#areaSubCode').on('change', function(){
|
||||||
|
fnResolveAreaCode();
|
||||||
|
});
|
||||||
|
|
||||||
|
// '전남광주' 처럼 지역이 콤마로 통합된 상태일 때, 실제 저장할 단일 AREA_CODE를
|
||||||
|
// 선택된 구.군 코드(예: GJ001, JN008)의 앞 2자리에서 유추해 hidden #areaCode에 반영한다.
|
||||||
|
function fnResolveAreaCode(){
|
||||||
|
var selVal = $('#areaCodeSel').val();
|
||||||
|
|
||||||
|
if(selVal == null || selVal == ''){
|
||||||
|
$('#areaCode').val('');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(selVal.indexOf(',') > -1){
|
||||||
|
var subVal = $('#areaSubCode').val();
|
||||||
|
if(subVal != null && subVal.length >= 2){
|
||||||
|
$('#areaCode').val(subVal.substring(0, 2));
|
||||||
|
}else{
|
||||||
|
$('#areaCode').val('');
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
$('#areaCode').val(selVal);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function fnAreaSubCodeList(areaCode, selectedAreaSubCode){
|
function fnAreaSubCodeList(areaCode, selectedAreaSubCode){
|
||||||
|
|
||||||
$('#areaSubCode option').remove();
|
$('#areaSubCode option').remove();
|
||||||
|
|
||||||
if(areaCode == null || areaCode == ''){
|
if(areaCode == null || areaCode == ''){
|
||||||
|
$('#areaCode').val('');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -248,6 +300,7 @@ function fnAreaSubCodeList(areaCode, selectedAreaSubCode){
|
|||||||
if(selectedAreaSubCode != null && selectedAreaSubCode != ''){
|
if(selectedAreaSubCode != null && selectedAreaSubCode != ''){
|
||||||
$('#areaSubCode').val(selectedAreaSubCode).prop('selected', true);
|
$('#areaSubCode').val(selectedAreaSubCode).prop('selected', true);
|
||||||
}
|
}
|
||||||
|
fnResolveAreaCode();
|
||||||
},
|
},
|
||||||
error: function(){
|
error: function(){
|
||||||
//전송에 실패하면 실행될 코드;
|
//전송에 실패하면 실행될 코드;
|
||||||
@ -272,9 +325,9 @@ function fnLclttSave(){
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if($('#areaCode').val() == null || $('#areaCode').val() == ''){
|
if($('#areaCodeSel').val() == null || $('#areaCodeSel').val() == ''){
|
||||||
alert('지역을 선택해 주세요.');
|
alert('지역을 선택해 주세요.');
|
||||||
$('#areaCode').focus();
|
$('#areaCodeSel').focus();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -284,6 +337,12 @@ function fnLclttSave(){
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if($('#areaCode').val() == null || $('#areaCode').val() == ''){
|
||||||
|
alert('지역/구.군 조합이 올바르지 않습니다. 구.군을 다시 선택해 주세요.');
|
||||||
|
$('#areaSubCode').focus();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if($('#adres1').val() == null || $('#adres1').val() == ''){
|
if($('#adres1').val() == null || $('#adres1').val() == ''){
|
||||||
alert('주소를 입력해 주세요.');
|
alert('주소를 입력해 주세요.');
|
||||||
$('#adres1').focus();
|
$('#adres1').focus();
|
||||||
@ -334,6 +393,7 @@ function jusoCallBack(roadFullAddr,roadAddrPart1,addrDetail,roadAddrPart2,engAdd
|
|||||||
$(this).prop('selected', true);
|
$(this).prop('selected', true);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
fnResolveAreaCode();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user