자동이체 - 수입 완료 (형태 변경 아직 필요)
This commit is contained in:
@@ -53,7 +53,7 @@
|
||||
<div class="component-btns fixed">
|
||||
<div class="btns-row">
|
||||
<!-- 비활성화 스타일/ 버튼 속성 disabled 추가-->
|
||||
<button type="button" class="btn btn-l btn-primary" id="complateBtn" disabled>
|
||||
<button type="button" class="btn btn-l btn-primary" id="complateBtn" disabled onclick="formControl.goSave()">
|
||||
<span class="btn-txt">등록 완료</span>
|
||||
</button>
|
||||
</div>
|
||||
@@ -97,7 +97,7 @@
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</div>"/api/front/info/bank/create"
|
||||
|
||||
<section layout:fragment="script">
|
||||
<script th:inline="javascript">
|
||||
@@ -111,11 +111,11 @@
|
||||
modalPopup: null
|
||||
},
|
||||
data: {
|
||||
transferCategoryList: /*[[${transferCategoryList}]]*/ [],
|
||||
transferCategoryCodeList: /*[[${transferCategoryList}]]*/ [],
|
||||
codeRecordCropList: /*[[${codeRecordCropList}]]*/ [],
|
||||
unitList: /*[[${unitList}]]*/ [],
|
||||
bankList : [],
|
||||
pastBankList : [],
|
||||
bankList : /*[[${bankList.content}]]*/ [],
|
||||
pastBankList : /*[[${pastBankList.content}]]*/ [],
|
||||
id: /*[[${currentMonthlyInfo.id}]]*/'',
|
||||
currentStatus: /*[[${currentMonthlyInfo.bankAutoTransferInputStatus}]]*/'',
|
||||
pastStatus: /*[[${pastMonthlyInfo?.bankAutoTransferInputStatus}]]*/'',
|
||||
@@ -125,7 +125,7 @@
|
||||
noDataCheckbox: document.getElementById("forestProductStatus"),
|
||||
select:{
|
||||
cropCodeSelect : null,
|
||||
transferCategorySelect : null,
|
||||
transferCategoryCodeSelect : null,
|
||||
unitCodeSelect : null,
|
||||
}
|
||||
},
|
||||
@@ -247,11 +247,12 @@
|
||||
}
|
||||
});
|
||||
|
||||
const $select2 = document.querySelector('#transferCategorySelect');
|
||||
ENV.elementRefs.select.transferCategorySelect = new etUI.components.SelectBox();
|
||||
ENV.elementRefs.select.transferCategorySelect.core.init($select2,{
|
||||
const $select2 = document.querySelector('#transferCategoryCodeSelect');
|
||||
ENV.elementRefs.select.transferCategoryCodeSelect = new etUI.components.SelectBox();
|
||||
ENV.elementRefs.select.transferCategoryCodeSelect.core.init($select2,{
|
||||
selectItemCallback({selectValue, dataValue}){
|
||||
document.querySelector('#transferCategory').value=dataValue;
|
||||
// document.querySelector('#transferCategory').value=selectValue;
|
||||
document.querySelector('#transferCategoryCode').value=dataValue;
|
||||
document.querySelectorAll('div[data-option]').forEach(el => {
|
||||
el.style.display = 'none';
|
||||
});
|
||||
@@ -327,17 +328,17 @@
|
||||
|
||||
const form = document.getElementById('popupForm');
|
||||
kri.form.errorInit(form);
|
||||
const selects = ['cropCode', 'transferCategory', 'unitCode'];
|
||||
const selects = ['cropCode', 'transferCategoryCode', 'unitCode'];
|
||||
selects.forEach(id => {
|
||||
const sel = document.getElementById(id + 'Select');
|
||||
if (sel && sel.value) form[id].value = sel.value;
|
||||
});
|
||||
|
||||
const errors = [];
|
||||
if (!form.transferCategory.value) errors.push({field: 'transferCategory', message: '수입종류를 선택해주세요.'});
|
||||
if (form.transferCategory.value && document.getElementById(form.transferCategory.value+"_value")
|
||||
&& !document.getElementById(form.transferCategory.value+"_value").value){
|
||||
errors.push({field: form.transferCategory.value+"_value", message: '수입대상을 입력해주세요.'});
|
||||
if (!form.transferCategoryCode.value) errors.push({field: 'transferCategoryCode', message: '수입종류를 선택해주세요.'});
|
||||
if (form.transferCategoryCode.value && document.getElementById(form.transferCategoryCode.value+"_value")
|
||||
&& !document.getElementById(form.transferCategoryCode.value+"_value").value){
|
||||
errors.push({field: form.transferCategoryCode.value+"_value", message: '수입대상을 입력해주세요.'});
|
||||
}
|
||||
if (!form.sourcePurpose.value) errors.push({field: 'sourcePurpose', message: '수입원을 입력해주세요.'});
|
||||
|
||||
@@ -352,6 +353,7 @@
|
||||
return;
|
||||
}
|
||||
|
||||
form.transferCategory.value = document.getElementById(form.transferCategoryCode.value+"_value").value;//입력값
|
||||
const formData = new FormData(form);
|
||||
const product = {};
|
||||
formData.forEach((value, key) => product[key] = value);
|
||||
@@ -366,7 +368,7 @@
|
||||
},
|
||||
|
||||
getCategoryLabel(code) {
|
||||
const found = ENV.data.transferCategoryList.find(i => i.id === code);
|
||||
const found = ENV.data.transferCategoryCodeList.find(i => i.id === code);
|
||||
return found ? found.codeText : '-';
|
||||
},
|
||||
// 단위 코드
|
||||
@@ -392,11 +394,16 @@
|
||||
|
||||
Object.entries(product).forEach(([key, val]) => {
|
||||
const field = form.elements.namedItem(key);
|
||||
if (field) field.value = val;
|
||||
if (field) {
|
||||
field.value = val;
|
||||
if(key == 'transferCategoryCode'){
|
||||
document.getElementById(val+"_value").value = product["transferCategory"];
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
ENV.elementRefs.select.cropCodeSelect.setValue(product.cropCode);
|
||||
ENV.elementRefs.select.transferCategorySelect.setValue(product.transferCategory);
|
||||
ENV.elementRefs.select.transferCategoryCodeSelect.setValue(product.transferCategoryCode);
|
||||
ENV.elementRefs.select.unitCodeSelect.setValue(product.unitCode);
|
||||
},100)
|
||||
|
||||
@@ -412,6 +419,29 @@
|
||||
clearAllItems() {
|
||||
location.reload();
|
||||
},
|
||||
|
||||
goSave() {
|
||||
|
||||
|
||||
ajaxUtil._ajaxAsync(
|
||||
ENV.httpUrl.save,
|
||||
{
|
||||
status: ENV.elementRefs.noDataCheckbox.checked,
|
||||
id: ENV.data.id,
|
||||
bankList: ENV.data.bankList
|
||||
},
|
||||
function (rstData, status) {
|
||||
if (rstData.code === 'SUCCESS') {
|
||||
ajaxUtil._alert('등록이 완료되었습니다.', null, function () {
|
||||
|
||||
history.back()
|
||||
});
|
||||
} else if (rstData.code === 'ERROR') {
|
||||
ajaxUtil._alert('잠시 뒤에 다시 시도해 주세요.', null);
|
||||
}
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -432,8 +462,9 @@
|
||||
const getCategory = formControl.getCategoryLabel;
|
||||
const getCrop = formControl.getCropLabel;
|
||||
|
||||
const categoryCode = product.transferCategory;
|
||||
const categoryValue = product[`${categoryCode}_value`];
|
||||
const categoryCode = product.transferCategoryCode;
|
||||
const categoryCodeInputValue = product.transferCategory;
|
||||
const categoryValue = product[`${categoryCode}_value`] ? product[`${categoryCode}_value`] : categoryCodeInputValue;
|
||||
const tagTitle = categoryCode === 'code.bank.input.99'
|
||||
? categoryValue
|
||||
: `${getCategory(categoryCode)}<span>(${categoryValue})</span>`;
|
||||
|
||||
Reference in New Issue
Block a user