[BO] 일계부 수입 등록&수정
This commit is contained in:
@@ -10,7 +10,7 @@
|
||||
from daily_income ds
|
||||
<include refid="app.module.core.usecase.daily.record.adapters.persistence.DailyRecordMapper.InnerJoinByDailyRecord"/>
|
||||
where ds.is_deleted = false
|
||||
and ds.id = ${id}
|
||||
and ds.id = #{id}
|
||||
</select>
|
||||
|
||||
<select id="getRecordExistCount" resultType="int">
|
||||
@@ -19,7 +19,7 @@
|
||||
<include refid="app.module.core.usecase.daily.record.adapters.persistence.DailyRecordMapper.InnerJoinByDailyRecord"/>
|
||||
where ds.is_deleted = false
|
||||
<if test="id != null and id != '0'">
|
||||
and ds.id = ${id}
|
||||
and ds.id = #{id}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
|
||||
@@ -25,47 +25,17 @@ var ajaxUtil = {
|
||||
},
|
||||
|
||||
_alertError : function (code) {
|
||||
var message = ajaxUtil._msg500;
|
||||
if (code == '400') {
|
||||
let message = ajaxUtil._msg500;
|
||||
if (code === '400') {
|
||||
message = ajaxUtil._msg400;
|
||||
}
|
||||
|
||||
ajaxUtil._alert(message, '오류 안내');
|
||||
},
|
||||
_alert : function (alertMessage, alertTitle, afterEvent) {
|
||||
etUI.dialog.alert({
|
||||
title: alertTitle,
|
||||
message: alertMessage,
|
||||
type: "alert",
|
||||
callback: function() {
|
||||
console.log("alert callback");
|
||||
},
|
||||
});
|
||||
},
|
||||
_alertId : function (alertId, afterEvent) {
|
||||
ajaxUtil._alertMethod({
|
||||
id: alertId,
|
||||
title: null,
|
||||
message: null,
|
||||
after: afterEvent !== undefined ? (afterEvent ? 'Y' : 'N') : 'N',
|
||||
});
|
||||
},
|
||||
_alertMethod : function (jsonObj) {
|
||||
ajaxUtil._ajaxSyncNoWaiting(
|
||||
'/m/common/alert',
|
||||
jsonObj,
|
||||
function(rstData) {
|
||||
var $wrap = $('#bindWrap');
|
||||
if ($wrap.find('.ui-popup-common-alert').length != 0) {
|
||||
$wrap.find('.ui-popup-common-alert').remove();
|
||||
}
|
||||
_alert : function (alertMessage, alertTitle) {
|
||||
console.warn(alertTitle)
|
||||
|
||||
$wrap.append(rstData);
|
||||
uxgFn.popup.bind('.ui-popup-common-alert').open();
|
||||
},
|
||||
function(code, rstData) {
|
||||
kri.logger.error('Do nothing. code: '+ code, rstData);
|
||||
},
|
||||
'html');
|
||||
alert(alertMessage);
|
||||
},
|
||||
|
||||
|
||||
@@ -130,22 +100,22 @@ var ajaxUtil = {
|
||||
contentType : 'application/json; charset=UTF-8',
|
||||
async: async,
|
||||
statusCode : {
|
||||
400:function(){
|
||||
ajaxUtil._alertError(ajaxUtil.$400);
|
||||
},
|
||||
404:function(rstData){
|
||||
ajaxUtil._hideWaiting();
|
||||
if (typeof errorCallback !== 'undefined') {
|
||||
errorCallback(ajaxUtil.$404, rstData);
|
||||
} else {
|
||||
// kri.menu.main();
|
||||
kri.logger.error('statusCode: 404');
|
||||
console.error('statusCode: 404');
|
||||
}
|
||||
},
|
||||
401:function(){
|
||||
// kri.menu.main();
|
||||
kri.logger.error('statusCode: 401');
|
||||
console.error('statusCode: 401');
|
||||
},
|
||||
403:function(rstData){
|
||||
// kri.menu.main();
|
||||
kri.logger.error('statusCode: 403');
|
||||
console.error('statusCode: 403');
|
||||
},
|
||||
422:function(rstData, status) {
|
||||
console.log(rstData);
|
||||
@@ -195,13 +165,15 @@ var ajaxUtil = {
|
||||
},
|
||||
success : function(rstData, status) {
|
||||
ajaxUtil._hideWaiting();
|
||||
console.log('succ', rstData)
|
||||
if (typeof successCallback !== 'undefined') {
|
||||
successCallback(rstData, status);
|
||||
}
|
||||
},
|
||||
error : function(rstData) {
|
||||
ajaxUtil._hideWaiting();
|
||||
if (!(rstData.status == 500 || rstData.status == 422)) {
|
||||
console.log('error')
|
||||
if (!(rstData.status == 500 || rstData.status == 422 || rstData.status == 400)) {
|
||||
if (typeof errorCallback !== 'undefined') {
|
||||
errorCallback(rstData.status, rstData);
|
||||
} else {
|
||||
|
||||
@@ -3,9 +3,12 @@
|
||||
layout:decorate="~{layout/layout}">
|
||||
|
||||
<div class="layer-wrap" th:fragment="modalFragment">
|
||||
<form autocomplete="off" method="get" name="reqIncomeForm">
|
||||
<input type="hidden" name="visitInfoId">
|
||||
<form autocomplete="off" method="get" name="reqIncomeForm" data-modal-id=".modal-daily-income">
|
||||
<input type="hidden" name="householdSeq" th:value="${seq}">
|
||||
<input type="hidden" name="searchMonth">
|
||||
<input type="hidden" name="groupNo">
|
||||
<input type="hidden" name="id">
|
||||
<input type="hidden" name="dailyId">
|
||||
|
||||
<div class="component-modal mypage-wrap modal01 modal-daily-income" data-props-dimm-click="true" data-state="close">
|
||||
<div class="modal-dimm"></div>
|
||||
@@ -114,7 +117,7 @@
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th>현금(원)</th>
|
||||
<th>현금(원)<i class="ico-required-mark" role="img" aria-label="필수">*</i></th>
|
||||
<td>
|
||||
<div class="component-input">
|
||||
<div class="input-field">
|
||||
@@ -123,7 +126,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
<th>현물평가액</th>
|
||||
<th>현물평가액(원)<i class="ico-required-mark" role="img" aria-label="필수">*</i></th>
|
||||
<td>
|
||||
<div class="component-input">
|
||||
<div class="input-field">
|
||||
@@ -155,7 +158,6 @@
|
||||
</form>
|
||||
|
||||
<script th:inline="javascript">
|
||||
const modalId = '.modal-daily-income';
|
||||
// form 초기화
|
||||
const resetIncomeForm = () => {
|
||||
const form = document.reqIncomeForm;
|
||||
@@ -171,40 +173,6 @@
|
||||
form.estimatedValue.value = '';
|
||||
document.getElementById('isCredit_N').checked = true;
|
||||
}
|
||||
</script>
|
||||
|
||||
<script th:inline="javascript">
|
||||
// 일계부 등록 모달창 띄우기
|
||||
const showDailyIncomeModal = (id) => {
|
||||
const mf = document.reqIncomeForm;
|
||||
|
||||
const obj = $(f).serializeObject();
|
||||
console.log(obj)
|
||||
|
||||
resetIncomeForm();
|
||||
|
||||
if(id != null) {
|
||||
mf.visitInfoId.value = id;
|
||||
|
||||
ajaxUtil._ajaxAsyncMethod(
|
||||
`/api/household/daily/income/${id}`,
|
||||
obj,
|
||||
function (rstData) {
|
||||
console.log("일계부 상세 응답값 : ", rstData);
|
||||
setIncomeFormData(rstData);
|
||||
|
||||
document.querySelector(modalId).ui.open();
|
||||
},
|
||||
function () {
|
||||
|
||||
},
|
||||
'get'
|
||||
);
|
||||
|
||||
} else {
|
||||
document.querySelector(modalId).ui.open();
|
||||
}
|
||||
}
|
||||
|
||||
// 일계부 상세 값 set
|
||||
const setIncomeFormData = (data) => {
|
||||
@@ -234,29 +202,58 @@
|
||||
</script>
|
||||
|
||||
<script th:inline="javascript">
|
||||
// TODO : 임가방문정보 등록
|
||||
// 일계부 등록 모달창 띄우기
|
||||
const showDailyIncomeModal = (id) => {
|
||||
const mf = document.reqIncomeForm;
|
||||
mf.searchMonth.value = document.reqForm.recordMonth.value;
|
||||
mf.groupNo.value = document.reqForm.groupNo.value;
|
||||
mf.dailyId.value = document.reqForm.dailyId.value;
|
||||
mf.id.value = (id === undefined) ? '' : id;
|
||||
|
||||
resetIncomeForm();
|
||||
|
||||
if (id !== null && id !== undefined) {
|
||||
const obj = $(f).serializeObject();
|
||||
obj.id = mf.id.value;
|
||||
obj.searchMonth = obj.recordMonth;
|
||||
|
||||
ajaxUtil._ajaxAsyncMethod(
|
||||
`/api/household/daily/income/${id}`,
|
||||
obj,
|
||||
function (rstData, status) {
|
||||
setIncomeFormData(rstData);
|
||||
|
||||
document.querySelector($(mf).data('modalId')).ui.open();
|
||||
},
|
||||
function () {
|
||||
console.error('Do nothing error.')
|
||||
},
|
||||
'get'
|
||||
);
|
||||
|
||||
} else {
|
||||
document.querySelector($(mf).data('modalId')).ui.open();
|
||||
}
|
||||
}
|
||||
|
||||
const saveDailyIncome = () => {
|
||||
const f = document.reqIncomeForm;
|
||||
let dataOj = $(f).serializeObject();
|
||||
const mf = document.reqIncomeForm;
|
||||
let obj = $(mf).serializeObject();
|
||||
obj.inputType = 'SELF';
|
||||
|
||||
console.log("dataOj", dataOj);
|
||||
return;
|
||||
ajaxUtil._ajaxAsyncNoWaiting(
|
||||
'/api/household/daily/income/' + (obj.id === '' ? '0' : obj.id),
|
||||
obj,
|
||||
function () {
|
||||
alert('등록이 완료되었습니다.');
|
||||
|
||||
ajaxUtil._ajaxMethod(
|
||||
'/api/household/daily/income/save',
|
||||
JSON.stringify(dataOj),
|
||||
(response) => { // 성공
|
||||
alert("등록이 완료되었습니다.");
|
||||
document.querySelector(modalId).ui.close();
|
||||
getVisitInfo();
|
||||
document.querySelector($(mf).data('modalId')).ui.close();
|
||||
|
||||
getDailyRecordsView(f.dailyId.value, f.groupNo.value, f.dayGroupText.value);
|
||||
},
|
||||
function (code, rstData) {
|
||||
if(code == 422) alert(rstData.responseJSON[0].defaultMessage);
|
||||
if(code == 400) alert(rstData.responseJSON.message); //임가번호 중복체크
|
||||
console.error('Do nothing. code: '+ code, rstData);
|
||||
},
|
||||
'post',
|
||||
'json',
|
||||
{ handle422Type: 'alert' }
|
||||
);
|
||||
}
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user