[FO] 마이페이지 수정 + [BO] 임가현황 작업 중 ..

This commit is contained in:
kangsunlee
2025-06-23 20:45:53 +09:00
parent 8d604014db
commit e8b2ee1bf1
6 changed files with 195 additions and 67 deletions

View File

@@ -8,7 +8,7 @@
<hgroup class="tit-group">
<h3>
[[${currentMonthlyInfo.koreanMonth}]]의 <br>
<strong>임산물 현황 <span>[[${currentList.totalElements}]]</span>건 등록</strong> 되었습니다.
<strong>임산물 현황 <span id="totalItems">[[${currentList.totalElements}]]</span>건 등록</strong> 되었습니다.
</h3>
<p>임산물 현황을 등록해 주세요.</p>
</hgroup>
@@ -298,7 +298,7 @@
},
// 등록폼 추가
openAddForm() {
openAddForm(callback) {
ajaxUtil._ajaxAsyncMethod(
"/api/front/info/monthly/create/from",
@@ -341,6 +341,9 @@
ENV.module.modalPopup.open();
document.querySelector('.modal-content').scrollTop = 0;
// 모두 로드된 후 콜백 실행
if (typeof callback === 'function') callback();
},
function(code, rstData) {
kri.logger.error('Do nothing. code: '+ code, rstData);
@@ -461,11 +464,10 @@
const product = ENV.data.productList.find(p => p.id == id);
if (!product) return;
this.openAddForm();
setTimeout(function() {
this.openAddForm(() => {
const form = document.getElementById('forestForm');
if (!form) return;
Object.entries(product).forEach(([key, val]) => {
const field = form.elements.namedItem(key);
if (field) {
@@ -485,7 +487,6 @@
}
});
ENV.elementRefs.select.mainYieldUnitCodeSelect.setValue(product.mainYieldUnitCode);
ENV.elementRefs.select.mainSaleUnitCodeSelect.setValue(product.mainSaleUnitCode);
ENV.elementRefs.select.subYieldUnitCodeSelect.setValue(product.subYieldUnitCode);
@@ -494,23 +495,39 @@
document.getElementById("mainSaleUnit").value = product.mainSaleUnit;
document.getElementById("subYieldUnit").value = product.subYieldUnit;
document.getElementById("subSaleUnit").value = product.subSaleUnit;
},100);
});
},
// 선택 아이템 삭제
deleteItemById(id) {
ENV.data.productList = ENV.data.productList.filter(p => p.id != id);
const target = document.querySelector(`#listBody div[data-id='${id}']`);
if (target) target.remove();
this.updateLayout();
etUI.dialog.alert({
title: '삭제 안내',
message: '등록하신 내용을 삭제하시겠어요?<br>삭제된 내용은 복구할 수 없습니다.',
type: 'confirm',
dialogType: 'confirm',
callback: function () {
ENV.data.productList = ENV.data.productList.filter(p => p.id != id);
const target = document.querySelector(`#listBody div[data-id='${id}']`);
if (target) target.remove();
formControl.updateLayout();
},
});
},
// 전체 초기화
clearAllItems() {
location.reload();
// ENV.data.productList = [];
// document.getElementById('listBody').innerHTML = '';
// this.updateListHeader();
etUI.dialog.alert({
title: '초기화 안내',
message: '등록하신 모든 내용을 삭제하시겠어요?<br>삭제된 내용은 복구할 수 없습니다.',
type: 'confirm',
dialogType: 'confirm',
callback: function () {
ENV.data.productList = [];
document.getElementById('listBody').innerHTML = '';
formControl.updateLayout();
// TODO(ks): 선택 삭제 시 전체 count 미반영 중. 일단 전체 초기화에서만 count 갱신.
document.getElementById('totalItems').textContent = ENV.data.productList.length;
},
});
},
// 아이템 겟수 처리 아이템에 따른 레이아웃 정리