Merge branch 'kangsun' into 'dev'

[BO] 임가현황 작업 중 (9)

See merge request korea-research/korea-research!19
This commit is contained in:
이강선 매니저/ST
2025-06-17 12:45:59 +00:00
49 changed files with 861 additions and 97 deletions

View File

@@ -475,13 +475,110 @@
</div>
</div>
<div class="tab-content" data-tab-value="tab3">
<div class="tab-content bank-auto-transfer" data-tab-value="tab3">
<div class="content-inner">
<div class="content-inner">
<!-- 수입 -->
<section class="table-group">
<div class="table-tit-group">
<h3>수입 <strong>(<span id="bankIncomeCount">0</span>건)</strong></h3>
<div class="component-btns bottom-btn-group">
<div class="btns-row align-right">
<button type="button" class="btn small btn-secondary">
<span class=" btn-txt">삭제</span>
</button>
<button type="button" class="btn small btn-primary">
<span class="btn-txt">추가</span>
</button>
</div>
</div>
</div>
<table id="table-bank-income">
<thead>
<tr>
<th>선택</th>
<th>재배형태</th>
<th>수입의 종류</th>
<th>대상</th>
<th>수입원</th>
<th>수량</th>
<th>단위</th>
<th>현금(원)</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</section>
<!-- 지출 -->
<section class="table-group">
<div class="table-tit-group">
<h3>지출 <strong>(<span id="bankExpenseCount">0</span>건)</strong></h3>
<div class="component-btns bottom-btn-group">
<div class="btns-row align-right">
<button type="button" class="btn small btn-secondary">
<span class=" btn-txt">삭제</span>
</button>
<button type="button" class="btn small btn-primary">
<span class="btn-txt">추가</span>
</button>
</div>
</div>
</div>
<table id="table-bank-expense">
<thead>
<tr>
<th>선택</th>
<th>지출의 종류</th>
<th>용도</th>
<th>수량</th>
<th>단위</th>
<th>현금(원)</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</section>
</div>
</div>
</div>
<div class="tab-content" data-tab-value="tab4">
<div class="tab-content household-visit" data-tab-value="tab4">
<div class="content-inner">
<section class="table-group">
<div class="table-tit-group">
<h3></h3>
<div class="component-btns bottom-btn-group">
<div class="btns-row align-right">
<button type="button" class="btn small btn-secondary">
<span class=" btn-txt">삭제</span>
</button>
<button type="button" class="btn small btn-primary">
<span class="btn-txt">추가</span>
</button>
</div>
</div>
</div>
<table id="household-visit">
<thead>
<tr>
<th>선택</th>
<th>방문일</th>
<th>관리분야</th>
<th>내용</th>
<th>최종 수정자</th>
<th>답례품 전달</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</section>
</div>
</div>
</div>
@@ -530,6 +627,12 @@
className: 'gray'
}
};
const managementType = {
VISIT: "방문조사",
CALL: "전화상담",
ETC: "기타"
};
</script>
<script>
@@ -563,11 +666,11 @@
break;
case 'bank-auto-transfer': // 은행자동이체내역
console.log("은행자동이체내역");
// getAutoTransferStatus();
getBankAutoTransfer();
break;
case 'household-visit': // 임가방문정보
console.log("임가방문정보");
// getVisitStatus();
getVisitInfo();
break;
}
}
@@ -649,7 +752,7 @@
'/api/household/dailyRecordStatus',
{ recordSeq: id },
function(response) { // 성공
console.log("일계부 등록 상세 데이터~ : ", response);
console.log("일계부 등록 상세 데이터 : ", response);
gridIncomeTable(response.status.incomeStatus, response.incomes);
gridWorkTable(response.status.workStatus, response.works);
gridExpenseTable(response.status.expenseStatus, response.expenses);
@@ -672,7 +775,7 @@
$('#incomeCount').text(data.length);
if(data.length === 0) {
noData(tbody, status, 10);
noDataDaily(tbody, status, 10);
return;
}
@@ -690,13 +793,12 @@
</td>
<td>${item.isCredit ? "Y" : "N"}</td> <!-- 외상판매 -->
<td>${ifNullDash(item.cropText)}</td><!-- 재배형태 -->
<!-- TODO(ks) : 수입의 종류 코드형태로 들어오고 있음, 텍스트형태로 바뀌는 건지 체크!! -->
<td class="underline">${ifNullDash(item.categorySelf)}</td><!-- 수입의 종류 -->
<td>${ifNullDash(item.sourcePurpose)}</td><!-- 수입원 -->
<td class="align-right">${ifNullDash(item.quantity)}</td><!-- 수량 -->
<td>${ifNullDash(item.unitText)}</td><!-- 단위 -->
<td class="align-right">${ifNullDash(item.price)}</td><!-- 현금(원) -->
<td class="align-right">${ifNullDash(item.estimatedValue)}</td><!-- 현물평가액 -->
<td>${item.unitSelf != null && item.unitSelf !== '' ? item.unitSelf : ifNullDash(item.unitText)}</td><!-- 단위 -->
<td class="align-right">${formatNumberWithComma(item.price)}</td><!-- 현금(원) -->
<td class="align-right">${formatNumberWithComma(item.estimatedValue)}</td><!-- 현물평가액 -->
<td>
${item.updatedBy}<br>
(${item.updatedAt})
@@ -715,7 +817,7 @@
$('#workCount').text(data.length);
if(data.length === 0) {
noData(tbody, status, 18);
noDataDaily(tbody, status, 18);
return;
}
@@ -764,7 +866,7 @@
$('#expenseCount').text(data.length);
if(data.length === 0) {
noData(tbody, status, 9);
noDataDaily(tbody, status, 9);
return;
}
@@ -781,13 +883,12 @@
</div>
</td>
<td>${item.isCredit ? "Y" : "N"}</td> <!-- 외상 또는 카드구입 -->
<!-- TODO(ks) : 지출의 종류 코드형태로 들어오고 있음, 텍스트형태로 바뀌는 건지 체크!! -->
<td class="underline">${ifNullDash(item.categorySelf)}</td><!-- 지출의 종류 -->
<td>${ifNullDash(item.sourcePurpose)}</td><!-- 용도 -->
<td>${ifNullDash(item.quantity)}</td><!-- 수량 -->
<td>${ifNullDash(item.unitText)}</td><!-- 단위 -->
<td class="align-right">${ifNullDash(item.price)}</td><!-- 현금(원) -->
<td class="align-right">${ifNullDash(item.estimatedValue)}</td><!-- 현물평가액 -->
<td>${item.unitSelf != null && item.unitSelf !== '' ? item.unitSelf : ifNullDash(item.unitText)}</td><!-- 단위 -->
<td class="align-right">${formatNumberWithComma(item.price)}</td><!-- 현금(원) -->
<td class="align-right">${formatNumberWithComma(item.estimatedValue)}</td><!-- 현물평가액 -->
<td>
${item.updatedBy}<br>
(${item.updatedAt})
@@ -806,7 +907,7 @@
$('#powerCount').text(data.length);
if(data.length === 0) {
noData(tbody, status, 5);
noDataDaily(tbody, status, 5);
return;
}
@@ -843,7 +944,7 @@
$('#forestryCount').text(data.length);
if(data.length === 0) {
noData(tbody, status, 7);
noDataDaily(tbody, status, 7);
return;
}
@@ -863,7 +964,7 @@
<td>${ifNullDash(item.usage)}</td><!-- 용도 -->
<td class="align-right">${ifNullDash(item.quantity)}</td><!-- 수량 -->
<td>${ifNullDash(item.unitText)}</td><!-- 단위 -->
<td class="align-right">${ifNullDash(item.estimatedValue)}</td><!-- 현물평가액 -->
<td class="align-right">${formatNumberWithComma(item.estimatedValue)}</td><!-- 현물평가액 -->
<td>
${item.updatedBy}<br>
(${item.updatedAt})
@@ -882,7 +983,7 @@
$('#farmingCount').text(data.length);
if(data.length === 0) {
noData(tbody, status, 7);
noDataDaily(tbody, status, 7);
return;
}
@@ -902,7 +1003,7 @@
<td>${ifNullDash(item.usage)}</td><!-- 용도 -->
<td class="align-right">${ifNullDash(item.quantity)}</td><!-- 수량 -->
<td>${ifNullDash(item.unitText)}</td><!-- 단위 -->
<td class="align-right">${ifNullDash(item.estimatedValue)}</td><!-- 현물평가액 -->
<td class="align-right">${formatNumberWithComma(item.estimatedValue)}</td><!-- 현물평가액 -->
<td>
${item.updatedBy}<br>
(${item.updatedAt})
@@ -916,6 +1017,7 @@
</script>
<script>
// 임산물 현황 탭 조회
const getForestProductsStatus = () => {
const f = document.reqForm;
@@ -923,16 +1025,21 @@
'/api/household/forestProducts',
{
householdSeq: f.householdSeq.value,
month: f.recordMonth.value
recordMonth: f.recordMonth.value
},
function(response) { // 성공
(response) => { // 성공
console.log("임산물 현황 리스트 조회 : ", response);
const tbody = $('.tab-content.forest-product').find('tbody');
const tbody = $('.tab-content.forest-product tbody');
tbody.empty();
if(response.forestProducts.length === 0) {
noDataMonthly(tbody, response.status, 15);
return;
}
let tmpl = '';
$(response).each((idx, item) => {
$(response.forestProducts).each((idx, item) => {
tmpl +=
`
<tr>
@@ -973,12 +1080,172 @@
</script>
<script>
// nodata 처리
const noData = (target, status, length) => {
// 임가 방문정보 조회
const getVisitInfo = () => {
const f = document.reqForm;
ajaxUtil._ajaxMethod(
'/api/household/visitInfos',
{
householdSeq: f.householdSeq.value,
recordMonth: f.recordMonth.value
},
(response) => { // 성공
console.log("임가 방문정보 조회 : ", response);
const tbody = $('.tab-content.household-visit tbody');
tbody.empty();
if(response.length === 0) {
tbody.append(`<tr><td colspan="6" style="text-align: center;">등록된 내용이 없습니다.</td></tr>`);
return;
}
let tmpl = '';
$(response).each((idx, item) => {
tmpl +=
`
<tr>
<td>
<div class="component-input">
<label class="checkbox-inner">
<input type="checkbox" id="temp_checkbox_000${item.id}" name="temp_checkbox_000${item.id}" value="${item.id}">
</label>
</div>
</td>
<td>${ifNullDash(item.visitDate)}</td> <!-- 방문일 -->
<td>${ifNullDash(managementType[item.managementType])}</td> <!-- 관리분야 -->
<td>${ifNullDash(item.content)}</td> <!-- 내용 -->
<td>
${item.updatedBy}<br>
(${item.updatedAt})
</td><!-- 최종 수정자 -->
<td>${item.isGiftSent ? "전달 완료" : "미전달"}</td> <!-- 답례품 전달 -->
</tr>
`;
});
tbody.append(tmpl);
},
function (code, rstData) { // 실패
console.log("error : ", code);
},
'get',
'json'
);
}
</script>
<script>
// 은행자동이체내역 조회
const getBankAutoTransfer = () => {
const f = document.reqForm;
ajaxUtil._ajaxMethod(
'/api/household/bankAutoTransfer',
{
householdSeq: f.householdSeq.value,
recordMonth: f.recordMonth.value
},
(response) => { // 성공
console.log("은행자동이체내역 조회 : ", response);
gridBankIncomeTable(response.incomes);
gridBankExpenseTable(response.expenses);
},
function (code, rstData) { // 실패
console.log("error : ", code);
},
'get',
'json'
);
}
const gridBankIncomeTable = (data) => {
const tbody = $('#table-bank-income tbody');
tbody.empty();
$('#bankIncomeCount').text(data.length);
if(data.length === 0) {
tbody.append(`<tr><td colspan="8" style="text-align: center;">등록된 내용이 없습니다.</td></tr>`);
return;
}
let tmpl = '';
$(data).each((idx, item) => {
tmpl +=
`
<tr>
<td>
<div class="component-input">
<label class="checkbox-inner">
<input type="checkbox" id="temp_checkbox_000${item.id}" name="temp_checkbox_000${item.id}" value="${item.id}">
</label>
</div>
</td>
<td>${ifNullDash(item.cropText)}</td> <!-- 재배형태 -->
<td class="underline">${ifNullDash(item.categoryText)}</td> <!-- 수입의 종류 -->
<td>${ifNullDash(item.categorySelf)}</td><!-- 대상 -->
<td>${ifNullDash(item.sourcePurpose)}</td><!-- 수입원 -->
<td>${ifNullDash(item.count)}</td><!-- 수량 -->
<td>${ifNullDash(item.unitText)}</td><!-- 단위 -->
<td class="align-right">${formatNumberWithComma(item.price)}</td><!-- 현금(원) -->
</tr>
`;
});
tbody.append(tmpl);
}
const gridBankExpenseTable = (data) => {
const tbody = $('#table-bank-expense tbody');
tbody.empty();
$('#bankExpenseCount').text(data.length);
if(data.length === 0) {
tbody.append(`<tr><td colspan="6" style="text-align: center;">등록된 내용이 없습니다.</td></tr>`);
return;
}
let tmpl = '';
$(data).each((idx, item) => {
tmpl +=
`
<tr>
<td>
<div class="component-input">
<label class="checkbox-inner">
<input type="checkbox" id="temp_checkbox_000${item.id}" name="temp_checkbox_000${item.id}" value="${item.id}">
</label>
</div>
</td>
<td class="underline">${item.categorySelf != null && item.categorySelf !== '' ?
item.categorySelf : ifNullDash(item.categoryText)}</td> <!-- 지출의 종류 -->
<td>${ifNullDash(item.sourcePurpose)}</td><!-- 용도 -->
<td>${ifNullDash(item.count)}</td><!-- 수량 -->
<td>${ifNullDash(item.unitText)}</td><!-- 단위 -->
<td class="align-right">${formatNumberWithComma(item.price)}</td><!-- 현금(원) -->
</tr>
`;
});
tbody.append(tmpl);
}
</script>
<script>
// 일계부 등록 현황 nodata 처리
const noDataDaily = (target, status, length) => {
const noDataText = status === 'TARGET' ? '등록이 필요합니다.' : '등록없음';
$(target).append(`<tr><td colspan="${length}" style="text-align: center;">${noDataText}</td></tr>`);
}
// 임산물 현황 noData 처리
const noDataMonthly = (target, status, length) => {
const noDataText = status === 'NOTHING' ? '등록없음' : '등록이 필요합니다.';
$(target).append(`<tr><td colspan="${length}" style="text-align: center;">${noDataText}</td></tr>`);
}
</script>
</section>