ajax페이지 호출로 변경
This commit is contained in:
@@ -83,340 +83,7 @@
|
||||
<div class="modal-content">
|
||||
<div class="modal-content-inner">
|
||||
|
||||
<form id="forestForm">
|
||||
<input type="hidden" name="id" id="id">
|
||||
<article class="alert-box full green">
|
||||
<ul>
|
||||
<li>임업과 관련하여 재배 및 채취된 모든 임산물(목재 포함)을 기록해주세요.</li>
|
||||
</ul>
|
||||
</article>
|
||||
|
||||
<p class="form-desc">필수입력</p>
|
||||
|
||||
<section class="form-group">
|
||||
<!-- 읍면동 -->
|
||||
<div class="component-input">
|
||||
<div class="input-label">
|
||||
<label for="town" class="label-txt">
|
||||
읍면동
|
||||
</label>
|
||||
</div>
|
||||
<div class="input-field">
|
||||
<input type="text" id="town" placeholder="읍면동을 입력해 주세요" name="town"
|
||||
maxlength="10">
|
||||
</div>
|
||||
</div>
|
||||
<!-- 지번 -->
|
||||
<div class="component-input">
|
||||
<div class="input-label">
|
||||
<label for="streetNum" class="label-txt">
|
||||
지번
|
||||
</label>
|
||||
</div>
|
||||
<div class="input-field">
|
||||
<input type="text" id="streetNum" placeholder="지번을 입력해 주세요" name="streetNum"
|
||||
maxlength="10">
|
||||
</div>
|
||||
</div>
|
||||
<!-- 지목 -->
|
||||
<div class="select-group">
|
||||
<div class="select-label">
|
||||
<p class="label-txt">
|
||||
지목
|
||||
</p>
|
||||
</div>
|
||||
<div id="landTypeSelect" class="component-select bottom-sheet"
|
||||
data-props-default="지목을 선택해 주세요" data-props-type="bottomSheet">
|
||||
<input type="hidden" id="landType" name="landType" data-type="select">
|
||||
<button type="button" class="select-box">
|
||||
<span class="select-txt"></span>
|
||||
</button>
|
||||
<div class="select-options">
|
||||
<div class="select-header">
|
||||
<p>지목</p>
|
||||
<button type="button" class="select-close">
|
||||
<span class="hide-txt">닫기</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="select-scroll">
|
||||
<ul class="">
|
||||
<th:block th:each="item : ${purposeList}">
|
||||
<li class="option" th:data-value="${item.id}"
|
||||
th:text="${item.codeText}">option1
|
||||
</li>
|
||||
</th:block>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- 가능 면적 -->
|
||||
<div class="component-input">
|
||||
<div class="input-label">
|
||||
<label for="availableArea" class="label-txt">
|
||||
가능 면적<span>(평)</span>
|
||||
</label>
|
||||
</div>
|
||||
<div class="input-field">
|
||||
<input type="number" id="availableArea" placeholder="가능 면적을 입력해 주세요"
|
||||
name="availableArea" class="limitDecimalLength">
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<hr>
|
||||
|
||||
<section class="form-group">
|
||||
<!-- 재배 작물명 -->
|
||||
<div class="component-input">
|
||||
<div class="input-label">
|
||||
<label for="cropName" class="label-txt">
|
||||
재배 작물명
|
||||
<i class="ico-required-mark" role="img" aria-label="필수">*</i>
|
||||
</label>
|
||||
</div>
|
||||
<div class="input-field">
|
||||
<input type="text" id="cropName" placeholder="재배 작물명을 입력해 주세요"
|
||||
name="cropName" maxlength="10">
|
||||
</div>
|
||||
<ul class="guide-info">
|
||||
<li>예 : 수확</li>
|
||||
</ul>
|
||||
</div>
|
||||
<!-- 면적 -->
|
||||
<div class="component-input">
|
||||
<div class="input-label">
|
||||
<label for="landArea" class="label-txt">
|
||||
면적<span>(평)</span>
|
||||
</label>
|
||||
</div>
|
||||
<div class="input-field">
|
||||
<input type="number" id="landArea" placeholder="작업 면적을 입력해 주세요"
|
||||
name="landArea" class="limitDecimalLength">
|
||||
</div>
|
||||
<ul class="guide-info">
|
||||
<li>예 : 180, 6</li>
|
||||
</ul>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<hr>
|
||||
|
||||
<section class="form-group">
|
||||
<!-- 주생산물 수확량 -->
|
||||
<div class="component-input">
|
||||
<div class="input-label">
|
||||
<label for="mainYield" class="label-txt">
|
||||
주생산물 수확량
|
||||
</label>
|
||||
</div>
|
||||
<div class="input-field">
|
||||
<input type="number" id="mainYield" placeholder="수확량을 입력해 주세요"
|
||||
name="mainYield" class="limitDecimalLength">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 단위 -->
|
||||
<div class="select-group">
|
||||
<div class="select-label">
|
||||
<p class="label-txt">
|
||||
단위
|
||||
|
||||
</p>
|
||||
</div>
|
||||
<div id="mainYieldUnitCodeSelect" class="component-select bottom-sheet"
|
||||
data-props-default="단위를 선택해 주세요" data-props-type="bottomSheet">
|
||||
<input type="hidden" name="mainYieldUnitCode" id="mainYieldUnitCode"
|
||||
data-type="select">
|
||||
<button type="button" class="select-box">
|
||||
<span class="select-txt"></span>
|
||||
</button>
|
||||
<div class="select-options">
|
||||
<div class="select-header">
|
||||
<p>단위</p>
|
||||
<button type="button" class="select-close">
|
||||
<span class="hide-txt">닫기</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="select-scroll">
|
||||
<ul class="">
|
||||
<th:block th:each="item : ${unitList}">
|
||||
<li class="option" th:data-value="${item.id}"
|
||||
th:text="${item.codeText}">option1
|
||||
</li>
|
||||
</th:block>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<hr>
|
||||
|
||||
<section class="form-group">
|
||||
<!-- 주생산물 판매량 -->
|
||||
<div class="component-input">
|
||||
<div class="input-label">
|
||||
<label for="mainSaleAmount" class="label-txt">
|
||||
주생산물 판매량
|
||||
</label>
|
||||
</div>
|
||||
<div class="input-field">
|
||||
<input type="number" id="mainSaleAmount" placeholder="판매량을 입력해 주세요"
|
||||
name="mainSaleAmount" class="limitDecimalLength">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 단위 -->
|
||||
<div class="select-group">
|
||||
<div class="select-label">
|
||||
<p class="label-txt">
|
||||
단위
|
||||
|
||||
</p>
|
||||
</div>
|
||||
<div id="mainSaleUnitCodeSelect" class="component-select bottom-sheet"
|
||||
data-props-default="단위를 선택해 주세요" data-props-type="bottomSheet">
|
||||
<input type="hidden" name="mainSaleUnitCode" id="mainSaleUnitCode"
|
||||
data-type="select">
|
||||
<button type="button" class="select-box">
|
||||
<span class="select-txt"></span>
|
||||
</button>
|
||||
<div class="select-options">
|
||||
<div class="select-header">
|
||||
<p>단위</p>
|
||||
<button type="button" class="select-close">
|
||||
<span class="hide-txt">닫기</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="select-scroll">
|
||||
<ul class="">
|
||||
<th:block th:each="item : ${unitList}">
|
||||
<li class="option" th:data-value="${item.id}"
|
||||
th:text="${item.codeText}">option1
|
||||
</li>
|
||||
</th:block>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<hr>
|
||||
|
||||
<section class="form-group">
|
||||
<!-- 부생산물 수확량 -->
|
||||
<div class="component-input">
|
||||
<div class="input-label">
|
||||
<label for="subYield" class="label-txt">
|
||||
부생산물 수확량
|
||||
</label>
|
||||
</div>
|
||||
<div class="input-field">
|
||||
<input type="number" id="subYield" placeholder="수확량을 입력해 주세요"
|
||||
name="subYield" class="limitDecimalLength">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 단위 -->
|
||||
<div class="select-group">
|
||||
<div class="select-label">
|
||||
<p class="label-txt">
|
||||
단위
|
||||
|
||||
</p>
|
||||
</div>
|
||||
<div id="subYieldUnitCodeSelect" class="component-select bottom-sheet"
|
||||
data-props-default="단위를 선택해 주세요" data-props-type="bottomSheet">
|
||||
<input type="hidden" name="subYieldUnitCode" id="subYieldUnitCode"
|
||||
data-type="select">
|
||||
<button type="button" class="select-box">
|
||||
<span class="select-txt"></span>
|
||||
</button>
|
||||
<div class="select-options">
|
||||
<div class="select-header">
|
||||
<p>단위</p>
|
||||
<button type="button" class="select-close">
|
||||
<span class="hide-txt">닫기</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="select-scroll">
|
||||
<ul class="">
|
||||
<th:block th:each="item : ${unitList}">
|
||||
<li class="option" th:data-value="${item.id}"
|
||||
th:text="${item.codeText}">option1
|
||||
</li>
|
||||
</th:block>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<hr>
|
||||
|
||||
<section class="form-group">
|
||||
<!-- 부생산물 판매량 -->
|
||||
<div class="component-input">
|
||||
<div class="input-label">
|
||||
<label for="subSaleAmount" class="label-txt">
|
||||
부생산물 판매량
|
||||
</label>
|
||||
</div>
|
||||
<div class="input-field">
|
||||
<input type="number" id="subSaleAmount" placeholder="판매량을 입력해 주세요"
|
||||
name="subSaleAmount" class="limitDecimalLength">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 단위 -->
|
||||
<div class="select-group">
|
||||
<div class="select-label">
|
||||
<p class="label-txt">
|
||||
단위
|
||||
|
||||
</p>
|
||||
</div>
|
||||
<div id="subSaleUnitCodeSelect" class="component-select bottom-sheet"
|
||||
data-props-default="단위를 선택해 주세요" data-props-type="bottomSheet">
|
||||
<input type="hidden" name="subSaleUnitCode" id="subSaleUnitCode"
|
||||
data-type="select">
|
||||
<button type="button" class="select-box">
|
||||
<span class="select-txt"></span>
|
||||
</button>
|
||||
<div class="select-options">
|
||||
<div class="select-header">
|
||||
<p>단위</p>
|
||||
<button type="button" class="select-close">
|
||||
<span class="hide-txt">닫기</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="select-scroll">
|
||||
<ul class="">
|
||||
<th:block th:each="item : ${unitList}">
|
||||
<li class="option" th:data-value="${item.id}"
|
||||
th:text="${item.codeText}">option1
|
||||
</li>
|
||||
</th:block>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<div class="component-btns">
|
||||
<div class="btns-row">
|
||||
<button type="button" class="btn btn-full btn-l btn-primary"
|
||||
onclick="formControl.saveFormData()">
|
||||
<span class="btn-txt">등록</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@@ -455,9 +122,12 @@
|
||||
},
|
||||
elementRefs: {
|
||||
noDataCheckbox: document.getElementById("forestProductStatus"),
|
||||
addButton: {
|
||||
button: null,
|
||||
icon: null
|
||||
select:{
|
||||
landTypeSelect : null,
|
||||
mainYieldUnitCodeSelect : null,
|
||||
mainSaleUnitCodeSelect : null,
|
||||
subYieldUnitCodeSelect : null,
|
||||
subSaleUnitCodeSelect : null,
|
||||
}
|
||||
},
|
||||
isSubmitted: false
|
||||
@@ -630,15 +300,39 @@
|
||||
},
|
||||
// 등록폼 추가
|
||||
openAddForm() {
|
||||
const modalContent = document.querySelector('.modal-content');
|
||||
setTimeout(() => {
|
||||
modalContent.scrollTop = 0;
|
||||
}, 0);
|
||||
//초기화 안됨
|
||||
['landTypeSelect', 'mainYieldUnitCodeSelect', 'mainSaleUnitCodeSelect', 'subYieldUnitCodeSelect', 'subSaleUnitCodeSelect']
|
||||
.forEach(id => etUI.components.SelectBox().core.init(document.getElementById(id)));
|
||||
|
||||
ENV.module.modalPopup.open();
|
||||
ajaxUtil._ajaxAsyncMethod(
|
||||
"/api/front/info/monthly/create/from",
|
||||
{},
|
||||
function(rstHtml, status) {
|
||||
$('.addPopup').find('.modal-content-inner').html(rstHtml);
|
||||
|
||||
const selectConfigs = [
|
||||
{ id: 'landTypeSelect', targetId: 'landType', key: 'landTypeSelect' },
|
||||
{ id: 'mainYieldUnitCodeSelect', targetId: 'mainYieldUnitCode', key: 'mainYieldUnitCodeSelect' },
|
||||
{ id: 'mainSaleUnitCodeSelect', targetId: 'mainSaleUnitCode', key: 'mainSaleUnitCodeSelect' },
|
||||
{ id: 'subYieldUnitCodeSelect', targetId: 'subYieldUnitCode', key: 'subYieldUnitCodeSelect' },
|
||||
{ id: 'subSaleUnitCodeSelect', targetId: 'subSaleUnitCode', key: 'subSaleUnitCodeSelect' }
|
||||
];
|
||||
|
||||
selectConfigs.forEach(({ id, targetId, key }) => {
|
||||
const $select = document.querySelector(`#${id}`);
|
||||
const selectBox = new etUI.components.SelectBox();
|
||||
selectBox.core.init($select, {
|
||||
selectItemCallback({ selectValue, dataValue }) {
|
||||
document.querySelector(`#${targetId}`).value = dataValue;
|
||||
}
|
||||
});
|
||||
ENV.elementRefs.select[key] = selectBox;
|
||||
});
|
||||
ENV.module.modalPopup.open();
|
||||
},
|
||||
function(code, rstData) {
|
||||
kri.logger.error('Do nothing. code: '+ code, rstData);
|
||||
},
|
||||
'get',
|
||||
'html'
|
||||
);
|
||||
},
|
||||
// selectBox선택값으로 변경
|
||||
setSelectBoxValue(selectBoxId, value) {
|
||||
@@ -699,25 +393,29 @@
|
||||
},
|
||||
// 선택 아이템 수정 (폼 노출)
|
||||
editItemById(id) {
|
||||
|
||||
|
||||
const product = ENV.data.productList.find(p => p.id == id);
|
||||
if (!product) return;
|
||||
|
||||
const form = document.getElementById('forestForm');
|
||||
form.reset();
|
||||
|
||||
Object.entries(product).forEach(([key, val]) => {
|
||||
const field = form.elements.namedItem(key);
|
||||
if (field) field.value = val;
|
||||
});
|
||||
|
||||
// SelectBox 값 설정
|
||||
this.setSelectBoxValue('landTypeSelect', product.landType);
|
||||
this.setSelectBoxValue('mainYieldUnitCodeSelect', product.mainYieldUnitCode);
|
||||
this.setSelectBoxValue('mainSaleUnitCodeSelect', product.mainSaleUnitCode);
|
||||
this.setSelectBoxValue('subYieldUnitCodeSelect', product.subYieldUnitCode);
|
||||
this.setSelectBoxValue('subSaleUnitCodeSelect', product.subSaleUnitCode);
|
||||
|
||||
this.openAddForm();
|
||||
|
||||
setTimeout(function() {
|
||||
|
||||
const form = document.getElementById('forestForm');
|
||||
Object.entries(product).forEach(([key, val]) => {
|
||||
const field = form.elements.namedItem(key);
|
||||
if (field) field.value = val;
|
||||
});
|
||||
|
||||
ENV.elementRefs.select.landTypeSelect.setValue(product.landType);
|
||||
ENV.elementRefs.select.mainYieldUnitCodeSelect.setValue(product.mainYieldUnitCode);
|
||||
ENV.elementRefs.select.mainSaleUnitCodeSelect.setValue(product.mainSaleUnitCode);
|
||||
ENV.elementRefs.select.subYieldUnitCodeSelect.setValue(product.subYieldUnitCode);
|
||||
ENV.elementRefs.select.subSaleUnitCodeSelect.setValue(product.subSaleUnitCode);
|
||||
|
||||
},100);
|
||||
|
||||
},
|
||||
// 선택 아이템 삭제
|
||||
deleteItemById(id) {
|
||||
@@ -780,7 +478,7 @@
|
||||
addItem(product, isEdit) {
|
||||
const listBody = document.getElementById('listBody');
|
||||
const form = document.getElementById('forestForm');
|
||||
form.reset();
|
||||
// form.reset();
|
||||
listBody.style.display = '';
|
||||
|
||||
const format = val => Number(val).toLocaleString() || '-';
|
||||
|
||||
Reference in New Issue
Block a user