일계부 데이터 Excel 일괄 업로드 기능 추가
관리자 > 임가현황
This commit is contained in:
@@ -205,7 +205,7 @@
|
||||
checkDuplicate = response <= 0;
|
||||
},
|
||||
function (code, rstData) {
|
||||
console.log("error : ", code);
|
||||
// console.log("error : ", code);
|
||||
if(code == 400) alert("아이디를 입력해주세요.");
|
||||
if(code == 422) alert(rstData.responseText);
|
||||
checkDuplicate = false;
|
||||
|
||||
@@ -138,7 +138,7 @@
|
||||
});
|
||||
},
|
||||
function (code, rstData) {
|
||||
console.log("error : ", code);
|
||||
console.log("error : ");
|
||||
},
|
||||
'get',
|
||||
'json'
|
||||
@@ -228,7 +228,7 @@
|
||||
|
||||
const selectedResearcher = researcherList.find(r => r.adminSeq == selectedAdminSeq);
|
||||
|
||||
console.log("선택된 조사원 : ", selectedResearcher);
|
||||
// console.log("선택된 조사원 : ", selectedResearcher);
|
||||
|
||||
// import 해준 html 에서 아래 함수를 선언해주면 selectedResearcher 값을 사용할 수 있음.
|
||||
getSelectedResearcher(selectedResearcher, () => {
|
||||
|
||||
@@ -360,7 +360,7 @@
|
||||
checkDuplicate = !response.isDuplicated;
|
||||
},
|
||||
function (code, rstData) { // 실패
|
||||
console.log("error : ", code);
|
||||
// console.log("error : ", code);
|
||||
if(code == 400) alert("임가번호를 입력해주세요.");
|
||||
},
|
||||
'get',
|
||||
@@ -386,12 +386,12 @@
|
||||
function(response) { // 성공
|
||||
alert("등록이 완료되었습니다.");
|
||||
location.href = '/households';
|
||||
console.log("code", response)
|
||||
// console.log("code", response)
|
||||
|
||||
},
|
||||
function (code, rstData) {
|
||||
console.log("code", code)
|
||||
console.log("rstData", rstData)
|
||||
// console.log("code", code)
|
||||
// console.log("rstData", rstData)
|
||||
|
||||
if(code == 422) alert(rstData.responseText);
|
||||
if(code == 400) alert(rstData.responseJSON.message); //임가번호 중복체크
|
||||
|
||||
@@ -284,6 +284,9 @@
|
||||
<div class="component-btns bottom-btn-group">
|
||||
<div class="btns-row align-right">
|
||||
<!-- 관리자만 노출 -->
|
||||
<button type="button" class="btn" th:if="${userRole == 'ROLE_ADMIN'}" onclick="showExcelDailyModal();" >
|
||||
<span class="btn-txt">엑셀 업로드(일계부)</span>
|
||||
</button>
|
||||
<button type="button" class="btn" th:if="${userRole == 'ROLE_ADMIN'}" onclick="showExcelHouseholdModal();" >
|
||||
<span class="btn-txt">엑셀 업로드</span>
|
||||
</button>
|
||||
@@ -359,7 +362,7 @@
|
||||
'/api/households',
|
||||
dataOj,
|
||||
function(response) { // 성공
|
||||
console.log("response", response);
|
||||
// console.log("response", response);
|
||||
|
||||
$('#totalElements').text(response.totalElements);
|
||||
|
||||
@@ -424,7 +427,7 @@
|
||||
}));
|
||||
},
|
||||
function (code, rstData) { // 실패
|
||||
console.log("error : ", code);
|
||||
console.log("error : ");
|
||||
},
|
||||
'get',
|
||||
'json'
|
||||
|
||||
@@ -176,13 +176,13 @@
|
||||
`/api/household/bankAutoTransferIncome/${id}`,
|
||||
{},
|
||||
(response) => {
|
||||
console.log("은행자동이체(수입) 상세 응답값 : ", response);
|
||||
// console.log("은행자동이체(수입) 상세 응답값 : ", response);
|
||||
setBankIncomeFormData(response);
|
||||
|
||||
document.querySelector(".modal-bank-income").ui.open();
|
||||
},
|
||||
function (code, rstData) {
|
||||
console.log("error : ", code);
|
||||
console.log("error : ");
|
||||
},
|
||||
'get',
|
||||
'json'
|
||||
@@ -254,7 +254,7 @@
|
||||
if (!f) return;
|
||||
|
||||
let dataOj = $(f).serializeObject();
|
||||
console.log("dataOj", dataOj);
|
||||
// console.log("dataOj", dataOj);
|
||||
|
||||
ajaxUtil._ajaxMethod(
|
||||
'/api/household/bank/income/save',
|
||||
|
||||
@@ -10,13 +10,19 @@
|
||||
<input type="hidden" name="id">
|
||||
<input type="hidden" name="dailyId">
|
||||
|
||||
<input type="hidden" name="startYear" th:value="${startYear}"/>
|
||||
<input type="hidden" name="startMonth" th:value="${startMonth}"/>
|
||||
<input type="hidden" name="currentDate" th:value="${currentDate}"/>
|
||||
<input type="hidden" name="selectedGroupNo" value=""/>
|
||||
|
||||
|
||||
<div class="component-modal mypage-wrap modal01 modal-daily-expense" data-props-dimm-click="true" data-state="close">
|
||||
<div class="modal-dimm"></div>
|
||||
<div class="modal-frame">
|
||||
<div class="modal-container">
|
||||
<div class="modal-header">
|
||||
<h3 class="modal-tit">
|
||||
일계부 수입
|
||||
일계부 지출
|
||||
</h3>
|
||||
</div>
|
||||
<div class="modal-content">
|
||||
@@ -31,7 +37,28 @@
|
||||
<col width="25.3%" />
|
||||
</colgroup>
|
||||
<tbody>
|
||||
<tr>
|
||||
<th>등록일</th>
|
||||
<td colspan="2">
|
||||
<div class="d-flex">
|
||||
<div class="component-select">
|
||||
<select class="select-list" name="targetYear" required>
|
||||
|
||||
</select>
|
||||
</div>
|
||||
<div class="component-select">
|
||||
<select class="select-list" name="targetMonth" required>
|
||||
|
||||
</select>
|
||||
</div>
|
||||
<div class="component-select">
|
||||
<select class="select-list" name="targetDayGroup" required>
|
||||
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>외상 또는 카드 구입 여부</th>
|
||||
<td class="radio-group" colspan="4">
|
||||
@@ -159,10 +186,156 @@
|
||||
form.price.value = '';
|
||||
form.estimatedValue.value = '';
|
||||
|
||||
const currentDateStr = form.currentDate ? form.currentDate.value : ''; // "2025-08-09"
|
||||
const selectedGroupNo = form.selectedGroupNo ? form.selectedGroupNo.value : ''; // "2025-08-09"
|
||||
const startYear = form.startYear ? parseInt(form.startYear.value, 10) : 2024;
|
||||
const startMonth = form.startMonth ? parseInt(form.startMonth.value, 10) : 8;
|
||||
|
||||
// 오늘 Y/M/D 파싱
|
||||
const ymd = /^(\d{4})-(\d{2})-(\d{2})$/.exec(currentDateStr);
|
||||
const cur = ymd ? { y: +ymd[1], m: +ymd[2], d: +ymd[3] } : { y: null, m: null, d: null };
|
||||
if (!cur.y || !cur.m || !cur.d) return;
|
||||
|
||||
// selectedGroupNo가 있으면 초기 연/월은 #recordMonthStr(value: "yyyyMM")에서 취득
|
||||
let baseY = cur.y, baseM = cur.m;
|
||||
if (selectedGroupNo) {
|
||||
const rmSel = document.getElementById('recordMonthStr');
|
||||
const rmVal = rmSel?.value || '';
|
||||
const rm = /^(\d{4})(\d{2})$/.exec(rmVal);
|
||||
if (rm) { baseY = +rm[1]; baseM = +rm[2]; }
|
||||
}
|
||||
|
||||
// 연/월 셀렉트 요소
|
||||
const yearSel = form.targetYear;
|
||||
const monthSel = form.targetMonth;
|
||||
const daySel = form.targetDayGroup;
|
||||
|
||||
// 일자 그룹 정의(1~17)
|
||||
const DAY_GROUPS = [
|
||||
{ groupNo: 1, startDay: 1, endDay: 2 },
|
||||
{ groupNo: 2, startDay: 3, endDay: 4 },
|
||||
{ groupNo: 3, startDay: 5, endDay: 6 },
|
||||
{ groupNo: 4, startDay: 7, endDay: 7 },
|
||||
{ groupNo: 5, startDay: 8, endDay: 9 },
|
||||
{ groupNo: 6, startDay: 10, endDay: 11 },
|
||||
{ groupNo: 7, startDay: 12, endDay: 13 },
|
||||
{ groupNo: 8, startDay: 14, endDay: 14 },
|
||||
{ groupNo: 9, startDay: 15, endDay: 16 },
|
||||
{ groupNo: 10, startDay: 17, endDay: 18 },
|
||||
{ groupNo: 11, startDay: 19, endDay: 20 },
|
||||
{ groupNo: 12, startDay: 21, endDay: 21 },
|
||||
{ groupNo: 13, startDay: 22, endDay: 23 },
|
||||
{ groupNo: 14, startDay: 24, endDay: 25 },
|
||||
{ groupNo: 15, startDay: 26, endDay: 27 },
|
||||
{ groupNo: 16, startDay: 28, endDay: 29 },
|
||||
{ groupNo: 17, startDay: 30, endDay: 31 },
|
||||
];
|
||||
const daysInMonth = (y, m) => new Date(y, m, 0).getDate();
|
||||
const findGroupNoByDay = (day) => {
|
||||
const g = DAY_GROUPS.find(g => day >= g.startDay && day <= g.endDay);
|
||||
return g ? g.groupNo : null;
|
||||
};
|
||||
|
||||
// 연도 옵션: startYear ~ currentDate.year
|
||||
function fillYears(preselectYear) {
|
||||
if (!yearSel) return;
|
||||
yearSel.innerHTML = '';
|
||||
for (let y = startYear; y <= cur.y; y++) {
|
||||
const opt = document.createElement('option');
|
||||
opt.value = String(y);
|
||||
opt.textContent = `${y}년`;
|
||||
yearSel.appendChild(opt);
|
||||
}
|
||||
// 선택: selectedGroupNo 있으면 baseY, 없으면 cur.y
|
||||
const pickY = (typeof preselectYear === 'number') ? preselectYear : cur.y;
|
||||
yearSel.value = String(pickY);
|
||||
}
|
||||
|
||||
// 월 옵션: (startYear → startMonth~12), (cur.y → 1~cur.m), (그 외 과거연도 → 1~12)
|
||||
function fillMonths(year, preselectMonth) {
|
||||
if (!monthSel) return;
|
||||
monthSel.innerHTML = '';
|
||||
let from = 1, to = 12;
|
||||
if (year === startYear) from = startMonth;
|
||||
if (year === cur.y) to = cur.m;
|
||||
|
||||
for (let m = from; m <= to; m++) {
|
||||
const opt = document.createElement('option');
|
||||
opt.value = String(m);
|
||||
opt.textContent = `${m}월`;
|
||||
monthSel.appendChild(opt);
|
||||
}
|
||||
// 선택: selectedGroupNo 있으면 baseM, 없으면 cur.m (범위 밖이면 첫 항목)
|
||||
const candidate = (typeof preselectMonth === 'number') ? preselectMonth : cur.m;
|
||||
monthSel.value = (candidate >= from && candidate <= to)
|
||||
? String(candidate)
|
||||
: (monthSel.options[0]?.value || '');
|
||||
}
|
||||
|
||||
// 일자그룹 옵션: 존재 & 미래 제외
|
||||
function fillDayGroups(year, month, preselectGroupNo) {
|
||||
if (!daySel) return;
|
||||
daySel.innerHTML = '';
|
||||
|
||||
// "선택하세요" 옵션 추가
|
||||
const placeholder = document.createElement('option');
|
||||
placeholder.value = '';
|
||||
placeholder.textContent = '선택하세요';
|
||||
daySel.appendChild(placeholder);
|
||||
|
||||
const dim = daysInMonth(year, month);
|
||||
const isCurYM = (year === cur.y && month === cur.m);
|
||||
const maxDay = isCurYM ? cur.d : dim;
|
||||
|
||||
const candidates = DAY_GROUPS
|
||||
.filter(g => g.endDay <= dim)
|
||||
.filter(g => g.startDay <= maxDay);
|
||||
|
||||
candidates.forEach(g => {
|
||||
const opt = document.createElement('option');
|
||||
opt.value = String(g.groupNo);
|
||||
opt.textContent = (g.startDay === g.endDay) ? `${g.startDay}일` : `${g.startDay}~${g.endDay}일`;
|
||||
daySel.appendChild(opt);
|
||||
});
|
||||
|
||||
// 선택 우선순위: 전달된 groupNo가 리스트에 있으면 → 그것, 아니면 첫 항목
|
||||
let pick = preselectGroupNo ? String(preselectGroupNo) : '';
|
||||
if (pick && ![...daySel.options].some(o => o.value === pick)) pick = '';
|
||||
if (!pick) pick = daySel.options[0]?.value || '';
|
||||
if (pick) daySel.value = pick;
|
||||
}
|
||||
|
||||
// ----- 초기 세팅 -----
|
||||
// 1) 연도/월 옵션은 currentDate 기준으로 생성
|
||||
fillYears(selectedGroupNo ? baseY : undefined);
|
||||
fillMonths(parseInt(yearSel.value, 10), selectedGroupNo ? baseM : undefined);
|
||||
|
||||
// 2) 일자그룹 선택값 계산
|
||||
const initGroupNo = selectedGroupNo
|
||||
? parseInt(selectedGroupNo, 10)
|
||||
: findGroupNoByDay(cur.d);
|
||||
|
||||
fillDayGroups(parseInt(yearSel.value, 10), parseInt(monthSel.value, 10), initGroupNo);
|
||||
|
||||
// ----- 이벤트 -----
|
||||
yearSel?.addEventListener('change', function () {
|
||||
const y = parseInt(this.value, 10);
|
||||
// selectedGroupNo가 있으면 월 선택은 baseM 유지 시도(범위 밖이면 첫 항목)
|
||||
fillMonths(y, selectedGroupNo ? baseM : undefined);
|
||||
// 일그룹: selectedGroupNo 우선(존재하지 않으면 폴백)
|
||||
fillDayGroups(y, parseInt(monthSel.value, 10), selectedGroupNo ? parseInt(selectedGroupNo, 10) : undefined);
|
||||
});
|
||||
|
||||
monthSel?.addEventListener('change', function () {
|
||||
const y = parseInt(yearSel.value, 10);
|
||||
fillDayGroups(y, parseInt(this.value, 10), selectedGroupNo ? parseInt(selectedGroupNo, 10) : undefined);
|
||||
});
|
||||
|
||||
document.getElementById('isCredit_N').checked = true;
|
||||
priceDisabledReset(form.price, form.estimatedValue);
|
||||
}
|
||||
|
||||
|
||||
// 일계부 상세 값 set
|
||||
const setDailyExpenseFormData = (data) => {
|
||||
const form = document.reqExpenseForm;
|
||||
@@ -199,6 +372,11 @@
|
||||
mf.groupNo.value = document.reqForm.groupNo.value;
|
||||
mf.dailyId.value = document.reqForm.dailyId.value;
|
||||
mf.id.value = (id === undefined) ? '' : id;
|
||||
// if(id === undefined){
|
||||
// mf.selectedGroupNo.value = null;
|
||||
// } else {
|
||||
mf.selectedGroupNo.value = document.reqForm.groupNo.value;
|
||||
// }
|
||||
|
||||
resetDailyExpenseForm();
|
||||
|
||||
|
||||
@@ -10,6 +10,10 @@
|
||||
<input type="hidden" name="id">
|
||||
<input type="hidden" name="dailyId">
|
||||
|
||||
<input type="hidden" name="startYear" th:value="${startYear}"/>
|
||||
<input type="hidden" name="startMonth" th:value="${startMonth}"/>
|
||||
<input type="hidden" name="currentDate" th:value="${currentDate}"/>
|
||||
<input type="hidden" name="selectedGroupNo" value=""/>
|
||||
<div class="component-modal mypage-wrap modal01 modal-daily-income" data-props-dimm-click="true" data-state="close">
|
||||
<div class="modal-dimm"></div>
|
||||
<div class="modal-frame">
|
||||
@@ -31,7 +35,28 @@
|
||||
<col width="25.3%" />
|
||||
</colgroup>
|
||||
<tbody>
|
||||
<tr>
|
||||
<th>등록일</th>
|
||||
<td colspan="2">
|
||||
<div class="d-flex">
|
||||
<div class="component-select">
|
||||
<select class="select-list" name="targetYear" required>
|
||||
|
||||
</select>
|
||||
</div>
|
||||
<div class="component-select">
|
||||
<select class="select-list" name="targetMonth" required>
|
||||
|
||||
</select>
|
||||
</div>
|
||||
<div class="component-select">
|
||||
<select class="select-list" name="targetDayGroup" required>
|
||||
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>외상판매 여부</th>
|
||||
<td class="radio-group">
|
||||
@@ -172,6 +197,151 @@
|
||||
form.price.value = '';
|
||||
form.estimatedValue.value = '';
|
||||
|
||||
const currentDateStr = form.currentDate ? form.currentDate.value : ''; // "2025-08-09"
|
||||
const selectedGroupNo = form.selectedGroupNo ? form.selectedGroupNo.value : ''; // "2025-08-09"
|
||||
const startYear = form.startYear ? parseInt(form.startYear.value, 10) : 2024;
|
||||
const startMonth = form.startMonth ? parseInt(form.startMonth.value, 10) : 8;
|
||||
|
||||
// 오늘 Y/M/D 파싱
|
||||
const ymd = /^(\d{4})-(\d{2})-(\d{2})$/.exec(currentDateStr);
|
||||
const cur = ymd ? { y: +ymd[1], m: +ymd[2], d: +ymd[3] } : { y: null, m: null, d: null };
|
||||
if (!cur.y || !cur.m || !cur.d) return;
|
||||
|
||||
// selectedGroupNo가 있으면 초기 연/월은 #recordMonthStr(value: "yyyyMM")에서 취득
|
||||
let baseY = cur.y, baseM = cur.m;
|
||||
if (selectedGroupNo) {
|
||||
const rmSel = document.getElementById('recordMonthStr');
|
||||
const rmVal = rmSel?.value || '';
|
||||
const rm = /^(\d{4})(\d{2})$/.exec(rmVal);
|
||||
if (rm) { baseY = +rm[1]; baseM = +rm[2]; }
|
||||
}
|
||||
|
||||
// 연/월 셀렉트 요소
|
||||
const yearSel = form.targetYear;
|
||||
const monthSel = form.targetMonth;
|
||||
const daySel = form.targetDayGroup;
|
||||
|
||||
// 일자 그룹 정의(1~17)
|
||||
const DAY_GROUPS = [
|
||||
{ groupNo: 1, startDay: 1, endDay: 2 },
|
||||
{ groupNo: 2, startDay: 3, endDay: 4 },
|
||||
{ groupNo: 3, startDay: 5, endDay: 6 },
|
||||
{ groupNo: 4, startDay: 7, endDay: 7 },
|
||||
{ groupNo: 5, startDay: 8, endDay: 9 },
|
||||
{ groupNo: 6, startDay: 10, endDay: 11 },
|
||||
{ groupNo: 7, startDay: 12, endDay: 13 },
|
||||
{ groupNo: 8, startDay: 14, endDay: 14 },
|
||||
{ groupNo: 9, startDay: 15, endDay: 16 },
|
||||
{ groupNo: 10, startDay: 17, endDay: 18 },
|
||||
{ groupNo: 11, startDay: 19, endDay: 20 },
|
||||
{ groupNo: 12, startDay: 21, endDay: 21 },
|
||||
{ groupNo: 13, startDay: 22, endDay: 23 },
|
||||
{ groupNo: 14, startDay: 24, endDay: 25 },
|
||||
{ groupNo: 15, startDay: 26, endDay: 27 },
|
||||
{ groupNo: 16, startDay: 28, endDay: 29 },
|
||||
{ groupNo: 17, startDay: 30, endDay: 31 },
|
||||
];
|
||||
const daysInMonth = (y, m) => new Date(y, m, 0).getDate();
|
||||
const findGroupNoByDay = (day) => {
|
||||
const g = DAY_GROUPS.find(g => day >= g.startDay && day <= g.endDay);
|
||||
return g ? g.groupNo : null;
|
||||
};
|
||||
|
||||
// 연도 옵션: startYear ~ currentDate.year
|
||||
function fillYears(preselectYear) {
|
||||
if (!yearSel) return;
|
||||
yearSel.innerHTML = '';
|
||||
for (let y = startYear; y <= cur.y; y++) {
|
||||
const opt = document.createElement('option');
|
||||
opt.value = String(y);
|
||||
opt.textContent = `${y}년`;
|
||||
yearSel.appendChild(opt);
|
||||
}
|
||||
// 선택: selectedGroupNo 있으면 baseY, 없으면 cur.y
|
||||
const pickY = (typeof preselectYear === 'number') ? preselectYear : cur.y;
|
||||
yearSel.value = String(pickY);
|
||||
}
|
||||
|
||||
// 월 옵션: (startYear → startMonth~12), (cur.y → 1~cur.m), (그 외 과거연도 → 1~12)
|
||||
function fillMonths(year, preselectMonth) {
|
||||
if (!monthSel) return;
|
||||
monthSel.innerHTML = '';
|
||||
let from = 1, to = 12;
|
||||
if (year === startYear) from = startMonth;
|
||||
if (year === cur.y) to = cur.m;
|
||||
|
||||
for (let m = from; m <= to; m++) {
|
||||
const opt = document.createElement('option');
|
||||
opt.value = String(m);
|
||||
opt.textContent = `${m}월`;
|
||||
monthSel.appendChild(opt);
|
||||
}
|
||||
// 선택: selectedGroupNo 있으면 baseM, 없으면 cur.m (범위 밖이면 첫 항목)
|
||||
const candidate = (typeof preselectMonth === 'number') ? preselectMonth : cur.m;
|
||||
monthSel.value = (candidate >= from && candidate <= to)
|
||||
? String(candidate)
|
||||
: (monthSel.options[0]?.value || '');
|
||||
}
|
||||
|
||||
// 일자그룹 옵션: 존재 & 미래 제외
|
||||
function fillDayGroups(year, month, preselectGroupNo) {
|
||||
if (!daySel) return;
|
||||
daySel.innerHTML = '';
|
||||
|
||||
// "선택하세요" 옵션 추가
|
||||
const placeholder = document.createElement('option');
|
||||
placeholder.value = '';
|
||||
placeholder.textContent = '선택하세요';
|
||||
daySel.appendChild(placeholder);
|
||||
|
||||
const dim = daysInMonth(year, month);
|
||||
const isCurYM = (year === cur.y && month === cur.m);
|
||||
const maxDay = isCurYM ? cur.d : dim;
|
||||
|
||||
const candidates = DAY_GROUPS
|
||||
.filter(g => g.endDay <= dim)
|
||||
.filter(g => g.startDay <= maxDay);
|
||||
|
||||
candidates.forEach(g => {
|
||||
const opt = document.createElement('option');
|
||||
opt.value = String(g.groupNo);
|
||||
opt.textContent = (g.startDay === g.endDay) ? `${g.startDay}일` : `${g.startDay}~${g.endDay}일`;
|
||||
daySel.appendChild(opt);
|
||||
});
|
||||
|
||||
// 선택 우선순위: 전달된 groupNo가 리스트에 있으면 → 그것, 아니면 첫 항목
|
||||
let pick = preselectGroupNo ? String(preselectGroupNo) : '';
|
||||
if (pick && ![...daySel.options].some(o => o.value === pick)) pick = '';
|
||||
if (!pick) pick = daySel.options[0]?.value || '';
|
||||
if (pick) daySel.value = pick;
|
||||
}
|
||||
|
||||
// ----- 초기 세팅 -----
|
||||
// 1) 연도/월 옵션은 currentDate 기준으로 생성
|
||||
fillYears(selectedGroupNo ? baseY : undefined);
|
||||
fillMonths(parseInt(yearSel.value, 10), selectedGroupNo ? baseM : undefined);
|
||||
|
||||
// 2) 일자그룹 선택값 계산
|
||||
const initGroupNo = selectedGroupNo
|
||||
? parseInt(selectedGroupNo, 10)
|
||||
: findGroupNoByDay(cur.d);
|
||||
|
||||
fillDayGroups(parseInt(yearSel.value, 10), parseInt(monthSel.value, 10), initGroupNo);
|
||||
|
||||
// ----- 이벤트 -----
|
||||
yearSel?.addEventListener('change', function () {
|
||||
const y = parseInt(this.value, 10);
|
||||
// selectedGroupNo가 있으면 월 선택은 baseM 유지 시도(범위 밖이면 첫 항목)
|
||||
fillMonths(y, selectedGroupNo ? baseM : undefined);
|
||||
// 일그룹: selectedGroupNo 우선(존재하지 않으면 폴백)
|
||||
fillDayGroups(y, parseInt(monthSel.value, 10), selectedGroupNo ? parseInt(selectedGroupNo, 10) : undefined);
|
||||
});
|
||||
|
||||
monthSel?.addEventListener('change', function () {
|
||||
const y = parseInt(yearSel.value, 10);
|
||||
fillDayGroups(y, parseInt(this.value, 10), selectedGroupNo ? parseInt(selectedGroupNo, 10) : undefined);
|
||||
});
|
||||
|
||||
document.getElementById('isCredit_N').checked = true;
|
||||
priceDisabledReset(form.price, form.estimatedValue);
|
||||
}
|
||||
@@ -213,6 +383,11 @@
|
||||
mf.groupNo.value = document.reqForm.groupNo.value;
|
||||
mf.dailyId.value = document.reqForm.dailyId.value;
|
||||
mf.id.value = (id === undefined) ? '' : id;
|
||||
// if(id === undefined){
|
||||
// mf.selectedGroupNo.value = null;
|
||||
// } else {
|
||||
mf.selectedGroupNo.value = document.reqForm.groupNo.value;
|
||||
// }
|
||||
|
||||
resetDailyIncomeForm();
|
||||
|
||||
|
||||
@@ -6,37 +6,76 @@
|
||||
<form autocomplete="off" method="get" name="reqHouseholdExcelForm">
|
||||
|
||||
<div class="component-modal mypage-wrap modal01 modal-excel-household" data-props-dimm-click="true" data-state="close">
|
||||
<div class="modal-dimm"></div>
|
||||
<div class="modal-frame">
|
||||
<div class="modal-container type-small">
|
||||
<div class="modal-header">
|
||||
<h3 class="modal-tit">
|
||||
임가 등록 엑셀업로드
|
||||
</h3>
|
||||
</div>
|
||||
<div class="modal-content">
|
||||
<div class="modal-content-inner">
|
||||
<label for="householdFile" class="input-file-btn">
|
||||
<input type="file" name="file" id="householdFile" accept=".xlsx, .xls">
|
||||
</label>
|
||||
<div class="component-btns bottom-btn-group">
|
||||
<div class="btns-row align-right">
|
||||
<button type="button" class="btn btn-primary" onclick="ExcelUploadHousehold();">
|
||||
<span class="btn-txt">등록</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="modal-dimm"></div>
|
||||
<div class="modal-frame">
|
||||
<div class="modal-container type-small">
|
||||
<div class="modal-header">
|
||||
<h3 class="modal-tit">
|
||||
임가 등록 엑셀업로드
|
||||
</h3>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-content">
|
||||
<div class="modal-content-inner">
|
||||
<label for="householdFile" class="input-file-btn">
|
||||
<input type="file" name="file" id="householdFile" accept=".xlsx, .xls">
|
||||
</label>
|
||||
<div class="component-btns bottom-btn-group">
|
||||
<div class="btns-row align-right">
|
||||
<button type="button" class="btn btn-primary" onclick="ExcelUploadHousehold();">
|
||||
<span class="btn-txt">등록</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<button type="button" class="modal-close"></button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<button type="button" class="modal-close"></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="component-modal mypage-wrap modal01 modal-excel-daily" data-props-dimm-click="true" data-state="close">
|
||||
<div class="modal-dimm"></div>
|
||||
<div class="modal-frame">
|
||||
<div class="modal-container type-small">
|
||||
<div class="modal-header">
|
||||
<h3 class="modal-tit">
|
||||
일계부 등록 엑셀업로드
|
||||
</h3>
|
||||
</div>
|
||||
<div class="modal-content">
|
||||
<div class="modal-content-inner">
|
||||
<label for="dailyFile" class="input-file-btn">
|
||||
<input type="file" name="file" id="dailyFile" accept=".xlsx, .xls">
|
||||
</label>
|
||||
<div class="component-btns bottom-btn-group">
|
||||
<div class="btns-row align-right">
|
||||
<button type="button" class="btn btn-primary" onclick="ExcelUploadDaily();">
|
||||
<span class="btn-txt">등록</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<button type="button" class="modal-close"></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<script th:inline="javascript">
|
||||
// 일계부 엑셀업로드 모달창 띄우기
|
||||
const showExcelDailyModal = () => {
|
||||
document.querySelector(".modal-excel-daily").ui.open();
|
||||
const fileInput = document.getElementById("householdFile");
|
||||
if (fileInput) {
|
||||
fileInput.value = '';
|
||||
}
|
||||
}
|
||||
|
||||
// 임가방문정보 모달창 띄우기
|
||||
const showExcelHouseholdModal = () => {
|
||||
document.querySelector(".modal-excel-household").ui.open();
|
||||
@@ -93,6 +132,51 @@
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// 일계부정보 등록
|
||||
const ExcelUploadDaily = () => {
|
||||
event.preventDefault();
|
||||
|
||||
const fileInput = document.getElementById('dailyFile');
|
||||
if (fileInput.files.length === 0) {
|
||||
alert('업로드할 엑셀 파일을 선택해주세요.');
|
||||
return;
|
||||
}
|
||||
|
||||
// 로딩바 show
|
||||
ajaxUtil._showWaiting();
|
||||
|
||||
let formData = new FormData();
|
||||
formData.append('file', fileInput.files[0]);
|
||||
|
||||
$.ajax({
|
||||
method: 'POST',
|
||||
url: '/api/household/dailyExcelUpload',
|
||||
data: formData,
|
||||
contentType: false, // * 중요 *
|
||||
processData: false, // * 중요 *
|
||||
enctype: 'multipart/form-data', // * 중요 *
|
||||
beforeSend: function (xhr) {
|
||||
xhr.setRequestHeader(
|
||||
$("meta[name='_csrf_header']").attr("content"),
|
||||
$("meta[name='_csrf']").attr("content"));
|
||||
},
|
||||
success(res) {
|
||||
ajaxUtil._hideWaiting(); // 로딩바 hide
|
||||
alert("일계부 데이터 엑셀 업로드를 완료(실패 "+res.success+"건) 하였습니다.");
|
||||
document.querySelector(".modal-excel-household").ui.close();
|
||||
},
|
||||
error: function (xhr, status, error) {
|
||||
ajaxUtil._hideWaiting();
|
||||
let message = "엑셀 업로드 중 오류가 발생하였습니다.";
|
||||
if (xhr.responseText) {
|
||||
message = xhr.responseText;
|
||||
}
|
||||
alert(message);
|
||||
document.querySelector(".modal-excel-household").ui.close();
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
</div>
|
||||
|
||||
@@ -261,7 +261,7 @@
|
||||
`/api/forestProduct/${id}`,
|
||||
{},
|
||||
(response) => {
|
||||
console.log("임산물현황 상세 응답값 : ", response);
|
||||
// console.log("임산물현황 상세 응답값 : ", response);
|
||||
setForestProductFormData(response);
|
||||
|
||||
document.querySelector(".modal-forest-product").ui.open();
|
||||
|
||||
@@ -143,12 +143,12 @@
|
||||
`/api/visitInfo/${id}`,
|
||||
{},
|
||||
(response) => {
|
||||
console.log("임가방문정보 상세 응답값 : ", response);
|
||||
// console.log("임가방문정보 상세 응답값 : ", response);
|
||||
setVisitFormData(response);
|
||||
document.querySelector(".modal-visit-info").ui.open();
|
||||
},
|
||||
function (code, rstData) {
|
||||
console.log("error : ", code);
|
||||
console.log("error : ");
|
||||
},
|
||||
'get',
|
||||
'json'
|
||||
@@ -184,7 +184,7 @@
|
||||
const f = document.reqVisitForm;
|
||||
let dataOj = $(f).serializeObject();
|
||||
|
||||
console.log("dataOj", dataOj);
|
||||
// console.log("dataOj", dataOj);
|
||||
|
||||
ajaxUtil._ajaxMethod(
|
||||
'/api/visitInfo/save',
|
||||
@@ -214,7 +214,7 @@
|
||||
|
||||
datepicker.core.init($el, {
|
||||
dateSelectCallback: function (selectedDate) {
|
||||
console.log('선택된 날짜:', selectedDate);
|
||||
// console.log('선택된 날짜:', selectedDate);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -87,7 +87,7 @@
|
||||
recordMonth: f.recordMonth.value
|
||||
},
|
||||
(response) => { // 성공
|
||||
console.log("은행자동이체내역 조회 : ", response);
|
||||
// console.log("은행자동이체내역 조회 : ", response);
|
||||
gridBankIncomeTable(response.incomes);
|
||||
gridBankExpenseTable(response.expenses);
|
||||
},
|
||||
|
||||
@@ -373,7 +373,7 @@
|
||||
recordMonth: f.recordMonth.value
|
||||
},
|
||||
function(response) { // 성공
|
||||
console.log("일계부 현황 리스트 조회 : ", response);
|
||||
// console.log("일계부 현황 리스트 조회 : ", response);
|
||||
const listArea = $('.tab-content .daily-record-list');
|
||||
const detailArea = $('.tab-content .daily-record-detail');
|
||||
const tbody = listArea.find('tbody');
|
||||
@@ -445,7 +445,7 @@
|
||||
'/api/household/dailyRecordStatus',
|
||||
{ recordSeq: id, recordMonth: f.recordMonth.value },
|
||||
function(response) { // 성공
|
||||
console.log("일계부 등록 상세 데이터 : ", response);
|
||||
// console.log("일계부 등록 상세 데이터 : ", response);
|
||||
|
||||
// 금일 데이터 없음 체크
|
||||
$('#incomeStatus').attr('checked', response.status.incomeStatus === 'TODAY_NONE');
|
||||
@@ -472,7 +472,7 @@
|
||||
gridFarmingTable(response.status.farmingStatus, response.farmings);
|
||||
|
||||
if (groupNo === 1) {
|
||||
console.log(groupNo, response.monthlyCarryOver)
|
||||
// console.log(groupNo, response.monthlyCarryOver)
|
||||
if (response.monthlyCarryOver != null) {
|
||||
$('#carryOver').text(Number(response.monthlyCarryOver).toLocaleString() + '원');
|
||||
} else {
|
||||
@@ -514,6 +514,7 @@
|
||||
}
|
||||
|
||||
let tmpl = '';
|
||||
// console.log(data)
|
||||
$(data).each((idx, item) => {
|
||||
tmpl +=
|
||||
`
|
||||
@@ -527,14 +528,17 @@
|
||||
</td>
|
||||
<td>${item.isCredit ? "Y" : "N"}</td> <!-- 외상판매 -->
|
||||
<td>${ifNullHyphen(item.cropText)}</td><!-- 재배형태 -->
|
||||
<td class="underline"><a href="javascript:void(0);" onclick="showDailyIncomeModal(${item.id});">${ifNullHyphen(item.incomeKind)}</a></td> <!-- 수입의 종류 -->
|
||||
<td class="underline">
|
||||
<a href="javascript:void(0);" onclick="showDailyIncomeModal(${item.id});">${ifNullHyphen(item.incomeKind)}</a>
|
||||
${item.ocrErrorResult ? '<br><span style="color:red">(확인필요)</span>' : ''}
|
||||
</td> <!-- 수입의 종류 -->
|
||||
<td>${ifNullHyphen(item.sourcePurpose)}</td><!-- 수입원 -->
|
||||
<td class="align-right">${formatNumberWithComma(item.quantity)}</td><!-- 수량 -->
|
||||
<td>${ifNullHyphen(item.unitText)}</td><!-- 단위 -->
|
||||
<td class="align-right">${formatNumberWithComma(item.price)}</td><!-- 현금(원) -->
|
||||
<td class="align-right">${formatNumberWithComma(item.estimatedValue)}</td><!-- 현물평가액 -->
|
||||
<td class="align-center">
|
||||
${item.fileId ? `<a href="${item.attachmentURL}" download>다운로드</a>` : '-'}
|
||||
${item.fileId ? `<a href="javascript:void(0);" onclick="downloadFile('${item.attachmentURL}','수입','${ifNullHyphen(item.incomeKind)}','${idx+1}')" download>다운로드</a>` : '-'}
|
||||
</td>
|
||||
<td>
|
||||
${item.updatedBy}<br>
|
||||
@@ -609,6 +613,8 @@
|
||||
}
|
||||
|
||||
let tmpl = '';
|
||||
|
||||
|
||||
$(data).each((idx, item) => {
|
||||
tmpl +=
|
||||
`
|
||||
@@ -621,14 +627,16 @@
|
||||
</div>
|
||||
</td>
|
||||
<td>${item.isCredit ? "Y" : "N"}</td> <!-- 외상 또는 카드구입 -->
|
||||
<td class="underline"><a href="javascript:void(0);" onclick="showDailyExpenseModal(${item.id});">${ifNullHyphen(item.expenseKind)}</a></td> <!-- 지출의 종류 -->
|
||||
<td class="underline"><a href="javascript:void(0);" onclick="showDailyExpenseModal(${item.id});">${ifNullHyphen(item.expenseKind)}</a>
|
||||
${item.ocrErrorResult ? '<br><span style="color:red">(확인필요)</span>' : ''}
|
||||
</td> <!-- 지출의 종류 -->
|
||||
<td>${ifNullHyphen(item.sourcePurpose)}</td><!-- 용도 -->
|
||||
<td class="align-right">${ifNullHyphen(item.quantity)}</td><!-- 수량 -->
|
||||
<td>${ifNullHyphen(item.unitText)}</td><!-- 단위 -->
|
||||
<td class="align-right">${formatNumberWithComma(item.price)}</td><!-- 현금(원) -->
|
||||
<td class="align-right">${formatNumberWithComma(item.estimatedValue)}</td><!-- 현물평가액 -->
|
||||
<td class="align-center">
|
||||
${item.fileId ? `<a href="${item.attachmentURL}" download>다운로드</a>` : '-'}
|
||||
${item.fileId ? `<a href="javascript:void(0);" onclick="downloadFile('${item.attachmentURL}','지출','${ifNullHyphen(item.expenseKind)}','${idx+1}')" download>다운로드</a>` : '-'}
|
||||
</td>
|
||||
<td>
|
||||
${item.updatedBy}<br>
|
||||
@@ -853,7 +861,7 @@
|
||||
const saveDaily = (el) => {
|
||||
const currentStep = $(el).data('step');
|
||||
const currentModalId = $(el).data('modalId');
|
||||
console.log('saveDaily', currentStep, currentModalId);
|
||||
// console.log('saveDaily', currentStep, currentModalId);
|
||||
|
||||
if (currentStep === 'INCOME') {
|
||||
showDailyIncomeModal();
|
||||
@@ -874,7 +882,7 @@
|
||||
const removeDaily = (el) => {
|
||||
const currentStep = $(el).data('step');
|
||||
const currentListId = $(el).data('listId');
|
||||
console.log('removeDaily', currentStep, currentListId);
|
||||
// console.log('removeDaily', currentStep, currentListId);
|
||||
|
||||
if ($('#'+currentListId).find('input[type="checkbox"]:checked').length === 0) {
|
||||
alert('삭제내용은 최소 1건은 선택해야 합니다.');
|
||||
@@ -892,7 +900,7 @@
|
||||
const obj = {};
|
||||
obj.selectedIds = selectedValues;
|
||||
obj.currentStep = currentStep;
|
||||
console.log(obj)
|
||||
// console.log(obj)
|
||||
|
||||
etUI.dialog.confirm({
|
||||
title: '삭제 안내',
|
||||
@@ -910,6 +918,22 @@
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
const downloadFile = (url,type, title, num) => {
|
||||
const houseHoldNum = document.getElementById("targetHouseHoldNum").innerText;
|
||||
const yearMonth = document.getElementById("recordMonthStr").value;
|
||||
let text = document.querySelector("h3._selectedGroupNo").innerText;
|
||||
let day = text.match(/\d+/)[0].padStart(2, "0");
|
||||
const changeFileName = houseHoldNum+"_"+yearMonth+""+day+"_"+type+"_"+title.replace(/\s+/g, "")+"_"+num.padStart(3, "0");
|
||||
|
||||
const urlReplace = `${url}?rename=${encodeURIComponent(changeFileName)}`;
|
||||
|
||||
const a = document.createElement("a");
|
||||
a.href = urlReplace;
|
||||
document.body.appendChild(a);
|
||||
a.click();
|
||||
a.remove();
|
||||
}
|
||||
</script>
|
||||
</div>
|
||||
</html>
|
||||
@@ -76,7 +76,7 @@
|
||||
recordMonth: f.recordMonth.value
|
||||
},
|
||||
(response) => { // 성공
|
||||
console.log("임산물 현황 리스트 조회 : ", response);
|
||||
// console.log("임산물 현황 리스트 조회 : ", response);
|
||||
|
||||
const tbody = $('.tab-content.forest-product tbody');
|
||||
tbody.empty();
|
||||
@@ -189,7 +189,7 @@
|
||||
|
||||
// 이번달 등록내용 없음 수정 처리
|
||||
const updateForestProductNone = (obj) => {
|
||||
console.log(obj);
|
||||
// console.log(obj);
|
||||
ajaxUtil._ajaxMethod(
|
||||
'/api/household/forestProduct/nothing',
|
||||
JSON.stringify(obj),
|
||||
|
||||
@@ -50,7 +50,7 @@
|
||||
recordMonth: f.recordMonth.value
|
||||
},
|
||||
(response) => { // 성공
|
||||
console.log("임가 방문정보 조회 : ", response);
|
||||
// console.log("임가 방문정보 조회 : ", response);
|
||||
const tbody = $('.tab-content.household-visit tbody');
|
||||
|
||||
tbody.empty();
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
<tr>
|
||||
<th>임가번호</th>
|
||||
<td>
|
||||
<span th:text="${householdInfo.householdNum}">16750</span>
|
||||
<span th:text="${householdInfo.householdNum}" id="targetHouseHoldNum">16750</span>
|
||||
</td>
|
||||
<th>경영주</th>
|
||||
<td>
|
||||
@@ -133,7 +133,7 @@
|
||||
<button type="button" class="tab-label select-tab" data-tab-type="household-visit" data-tab-value="tab4">임가방문정보</button>
|
||||
|
||||
<div class="component-select select-date">
|
||||
<select class="select-list" name="recordMonth" required onchange="onRecordMonthChange();">
|
||||
<select class="select-list" name="recordMonth" id="recordMonthStr" required onchange="onRecordMonthChange();">
|
||||
<option th:each="m : ${monthList}"
|
||||
th:value="${m.value}"
|
||||
th:text="${m.label}"
|
||||
|
||||
@@ -106,7 +106,7 @@
|
||||
let visitDatePicker;
|
||||
|
||||
document.getElementById('visitDate').addEventListener('change', function (e) {
|
||||
console.log("날짜 변경됨:", e.target.value);
|
||||
// console.log("날짜 변경됨:", e.target.value);
|
||||
});
|
||||
|
||||
const showHouseholdModal2 = (seq) => {
|
||||
|
||||
@@ -162,7 +162,6 @@
|
||||
|
||||
},
|
||||
function (code, rstData) {
|
||||
console.log("왜지 ");
|
||||
|
||||
},
|
||||
'get',
|
||||
|
||||
@@ -432,7 +432,7 @@
|
||||
case 'down':
|
||||
$(siblingsWithoutMe).each(function (idx, item) {
|
||||
if (item.orderNo > curOrderNo) {
|
||||
console.log('nextNode is ', item);
|
||||
// console.log('nextNode is ', item);
|
||||
targetItem = item;
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user