[BO] 임산물현황 등록 작업
This commit is contained in:
@@ -8,6 +8,7 @@
|
||||
<input type="hidden" name="forestProductId">
|
||||
<input type="hidden" name="householdSeq" th:value="${seq}">
|
||||
<input type="hidden" name="recordMonth">
|
||||
<input type="hidden" name="monthlyInputStatusId">
|
||||
|
||||
<div class="component-modal mypage-wrap modal01 modal-forest-product" data-props-dimm-click="true" data-state="close">
|
||||
<div class="modal-dimm"></div>
|
||||
@@ -229,7 +230,7 @@
|
||||
|
||||
<div class="component-btns bottom-btn-group">
|
||||
<div class="btns-row align-right">
|
||||
<button type="button" class="btn btn-primary">
|
||||
<button type="button" class="btn btn-primary" onclick="goForestProductSave();">
|
||||
<span class="btn-txt">등록</span>
|
||||
</button>
|
||||
</div>
|
||||
@@ -249,6 +250,7 @@
|
||||
const showForestProductModal = (id) => {
|
||||
const f = document.reqForestProductForm;
|
||||
f.recordMonth.value = document.reqForm.recordMonth.value;
|
||||
f.monthlyInputStatusId.value = document.reqForm.monthlyInputStatusId.value;
|
||||
|
||||
resetForestProductForm();
|
||||
|
||||
@@ -261,6 +263,8 @@
|
||||
(response) => {
|
||||
console.log("임산물현황 상세 응답값 : ", response);
|
||||
setForestProductFormData(response);
|
||||
|
||||
document.querySelector(".modal-forest-product").ui.open();
|
||||
},
|
||||
function (code, rstData) {
|
||||
console.log("error : ", code);
|
||||
@@ -268,9 +272,9 @@
|
||||
'get',
|
||||
'json'
|
||||
);
|
||||
} else {
|
||||
document.querySelector(".modal-forest-product").ui.open();
|
||||
}
|
||||
|
||||
document.querySelector(".modal-forest-product").ui.open();
|
||||
}
|
||||
|
||||
// 임산물현황등록 상세 값 set
|
||||
@@ -332,21 +336,47 @@
|
||||
const form = document.reqForestProductForm;
|
||||
if (!form) return;
|
||||
|
||||
// 모든 input 초기화
|
||||
form.querySelectorAll('input').forEach((input) => {
|
||||
input.value = '';
|
||||
const skipInputs = ['forestProductId', 'householdSeq', 'recordMonth', 'monthlyInputStatusId'];
|
||||
|
||||
// 단위 직접입력는 다시 비활성화하고 클래스 추가
|
||||
if (input.closest('.unit-self-input')) {
|
||||
input.disabled = true;
|
||||
input.closest('.unit-self-input').classList.add('input-disabled');
|
||||
form.querySelectorAll('input').forEach((el) => {
|
||||
if (!skipInputs.includes(el.name)) {
|
||||
el.value = '';
|
||||
if (el.closest('.unit-self-input')) {
|
||||
el.disabled = true;
|
||||
el.closest('.unit-self-input').classList.add('input-disabled');
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// 모든 select 초기화
|
||||
form.querySelectorAll('select').forEach((select) => {
|
||||
select.selectedIndex = 0;
|
||||
});
|
||||
form.querySelectorAll('select').forEach((el) => el.selectedIndex = 0);
|
||||
}
|
||||
</script>
|
||||
|
||||
<script>
|
||||
// 임산물 현황 저장 및 수정
|
||||
const goForestProductSave = () => {
|
||||
const f = document.reqForestProductForm;
|
||||
if (!f) return;
|
||||
|
||||
let dataOj = $(f).serializeObject();
|
||||
console.log("dataOj", dataOj);
|
||||
|
||||
ajaxUtil._ajaxMethod(
|
||||
'/api/forestProduct/save',
|
||||
JSON.stringify(dataOj),
|
||||
(response) => { // 성공
|
||||
alert("등록이 완료되었습니다.");
|
||||
|
||||
document.querySelector(".modal-forest-product").ui.close();
|
||||
getForestProductsStatus();
|
||||
},
|
||||
function (code, rstData) {
|
||||
if(code == 422) alert(rstData.responseJSON[0].defaultMessage);
|
||||
},
|
||||
'post',
|
||||
'json',
|
||||
{ handle422Type: 'alert' }
|
||||
);
|
||||
}
|
||||
</script>
|
||||
</div>
|
||||
|
||||
@@ -194,7 +194,7 @@
|
||||
getVisitInfo();
|
||||
},
|
||||
function (code, rstData) {
|
||||
if(code == 422) alert(rstData.responseText);
|
||||
if(code == 422) alert(rstData.responseJSON[0].defaultMessage);
|
||||
if(code == 400) alert(rstData.responseJSON.message); //임가번호 중복체크
|
||||
},
|
||||
'post',
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
layout:decorate="~{layout/layout}">
|
||||
|
||||
<div class="layer-wrap" th:fragment="tabFragment">
|
||||
<input type="hidden" name="monthlyInputStatusId">
|
||||
|
||||
<div class="tab-content forest-product" data-tab-value="tab2">
|
||||
<div class="content-inner">
|
||||
<section class="table-group">
|
||||
@@ -68,12 +70,15 @@
|
||||
},
|
||||
(response) => { // 성공
|
||||
console.log("임산물 현황 리스트 조회 : ", response);
|
||||
|
||||
// 임산물 현황 등록 상태 id set
|
||||
f.monthlyInputStatusId.value = response.monthlyStatus.id;
|
||||
const tbody = $('.tab-content.forest-product tbody');
|
||||
|
||||
tbody.empty();
|
||||
|
||||
if(response.forestProducts.length === 0) {
|
||||
noDataMonthly(tbody, response.status, 15);
|
||||
noDataMonthly(tbody, response.monthlyStatus.status, 15);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -168,9 +168,6 @@
|
||||
<button type="button" class="btn">
|
||||
<span class="btn-txt">엑셀 다운로드 <i class="ico-download" aria-hidden="true"></i></span>
|
||||
</button>
|
||||
<button type="button" class="btn">
|
||||
<span class="btn-txt">인쇄 <i class="ico-print" aria-hidden="true"></i></span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user