[FO] 일계수 수입/지출의 종류 selectbox 에서 input 으로 변경

This commit is contained in:
김현주
2025-06-16 18:16:15 +09:00
parent 3053024a87
commit 438bb25f6b
18 changed files with 62 additions and 225 deletions

View File

@@ -16,7 +16,6 @@ public class CreateDailyExpenseCmd extends FrontAuditCommand {
private String inputType;
private Boolean credit;
private String incomeMarkCode;
private String categoryCode;
private String categorySelf;
private String sourcePurpose;
private Integer quantity;

View File

@@ -11,8 +11,6 @@ public class DailyExpenseDto {
// TODO : SELF, OCR
private String inputType;
private Boolean credit;
private String categoryCode;
private String categoryLabel;
private String categorySelf;
private String sourcePurpose;
private Integer quantity;

View File

@@ -41,11 +41,9 @@ public class DailyExpenseServiceImpl implements DailyExpenseService {
private List<DailyExpenseDto> getRefineIncomeList(DailyExpenseUIReqVO reqVO) {
List<DailyExpenseDto> list = DailyExpenseMapper.getDailyExpenseList(reqVO);
List<UICodeElement> recordIncome = uiCodeListPortIn.connect("code.record.expense");
List<UICodeElement> recordUnit = uiCodeListPortIn.connect("code.record.unit");
for (DailyExpenseDto dto : list) {
dto.setCategoryLabel(this.getCodeLabel(dto.getCategoryCode(), recordIncome));
dto.setUnitLabel(this.getCodeLabel(dto.getUnitCode(), recordUnit));
}
@@ -79,7 +77,6 @@ public class DailyExpenseServiceImpl implements DailyExpenseService {
formVO.getInputType(),
formVO.getCredit(),
(formVO.getCredit() ? "52210" : null), // [정책] 외상판매 Y 일 경우 수입부호 52210 적재
formVO.getCategoryCode(),
formVO.getCategorySelf(),
formVO.getSourcePurpose(),
formVO.getQuantity(),

View File

@@ -82,7 +82,6 @@ public class DailyExpenseUIController {
}
}
model.addAttribute("recordExpense", uiCodeListPortIn.connect("code.record.expense"));
model.addAttribute("recordCrop", uiCodeListPortIn.connect("code.record.crop"));
model.addAttribute("recordUnit", uiCodeListPortIn.connect("code.record.unit"));

View File

@@ -26,14 +26,10 @@ public class CreateDailyExpenseReqVO extends DailyUIReqVO {
* 외상판매 여부
*/
private Boolean credit;
/**
* 지출의 종류 코드
*/
@NotBlank(message = "지출 종류를 선택해 주세요.")
private String categoryCode;
/**
* 지출의 종류 직접입력
*/
@NotBlank(message = "지출 종류를 입력해 주세요.")
private String categorySelf;
/**
* 용도

View File

@@ -20,18 +20,6 @@ public class CreateDailyExpenseValidator implements Validator {
public void validate(Object target, Errors errors) {
CreateDailyExpenseReqVO vo = (CreateDailyExpenseReqVO) target;
if (StringUtils.isBlank(vo.getCategoryCode())) {
errors.rejectValue(
"categoryCode", "valid.common.required",
"지출 종류를 선택해 주세요.");
}
if ("SELF".equals(vo.getCategoryCode()) && StringUtils.isBlank(vo.getCategorySelf())) {
errors.rejectValue(
"categorySelf", "valid.common.required",
"지출 종류를 입력해 주세요.");
}
if (vo.getPrice() == null && vo.getEstimatedValue() == null) {
errors.rejectValue(
"price", "valid.common.required",

View File

@@ -18,7 +18,6 @@ public class CreateDailyIncomeCmd extends FrontAuditCommand {
private Boolean credit;
private String cropCode;
private String expenseMarkCode;
private String categoryCode;
private String categorySelf;
private String sourcePurpose;
private Integer quantity;

View File

@@ -15,8 +15,6 @@ public class DailyIncomeDto {
private Boolean credit;
private String cropCode;
private String cropLabel;
private String categoryCode;
private String categoryLabel;
private String categorySelf;
private String sourcePurpose;
private Integer quantity;

View File

@@ -41,12 +41,10 @@ public class DailyIncomeServiceImpl implements DailyIncomeService {
private List<DailyIncomeDto> getRefineIncomeList(DailyIncomeUIReqVO reqVO) {
List<DailyIncomeDto> list = dailyIncomeMapper.getDailyIncomeList(reqVO);
List<UICodeElement> recordIncome = uiCodeListPortIn.connect("code.record.income");
List<UICodeElement> recordCrop = uiCodeListPortIn.connect("code.record.crop");
List<UICodeElement> recordUnit = uiCodeListPortIn.connect("code.record.unit");
for (DailyIncomeDto dto : list) {
dto.setCategoryLabel(this.getCodeLabel(dto.getCategoryCode(), recordIncome));
dto.setCropLabel(this.getCodeLabel(dto.getCropCode(), recordCrop));
dto.setUnitLabel(this.getCodeLabel(dto.getUnitCode(), recordUnit));
}
@@ -82,7 +80,6 @@ public class DailyIncomeServiceImpl implements DailyIncomeService {
formVO.getCredit(),
formVO.getCropCode(),
(formVO.getCredit() ? "91206" : null), // [정책] 외상판매 Y 일 경우 지출부호 91206 적재
formVO.getCategoryCode(),
formVO.getCategorySelf(),
formVO.getSourcePurpose(),
formVO.getQuantity(),

View File

@@ -80,7 +80,6 @@ public class DailyIncomeUIController {
}
}
model.addAttribute("recordIncome", uiCodeListPortIn.connect("code.record.income"));
model.addAttribute("recordCrop", uiCodeListPortIn.connect("code.record.crop"));
model.addAttribute("recordUnit", uiCodeListPortIn.connect("code.record.unit"));

View File

@@ -30,14 +30,10 @@ public class CreateDailyIncomeReqVO extends DailyUIReqVO {
* 재배형태 코드
*/
private String cropCode;
/**
* 수입의 종류 코드
*/
@NotBlank(message = "수입 종류를 선택해 주세요.")
private String categoryCode;
/**
* 수입의 종류 직접입력
*/
@NotBlank(message = "수입 종류를 입력해 주세요.")
private String categorySelf;
/**
* 수입원

View File

@@ -23,18 +23,6 @@ public class CreateDailyIncomeValidator implements Validator {
public void validate(Object target, Errors errors) {
CreateDailyIncomeReqVO vo = (CreateDailyIncomeReqVO) target;
if (StringUtils.isBlank(vo.getCategoryCode())) {
errors.rejectValue(
"categoryCode", "valid.common.required",
"수입 종류를 선택해 주세요.");
}
if ("SELF".equals(vo.getCategoryCode()) && StringUtils.isBlank(vo.getCategorySelf())) {
errors.rejectValue(
"categorySelf", "valid.common.required",
"수입 종류를 입력해 주세요.");
}
if (vo.getPrice() == null && vo.getEstimatedValue() == null) {
errors.rejectValue(
"price", "valid.common.required",

View File

@@ -5,7 +5,7 @@
<select id="getDailyExpenseList"
resultType="app.module.front.usecase.daily.expense.persistence.model.DailyExpenseDto">
select ds.id, ds.daily_record_seq, ds.input_type, ds.is_credit as credit
, ds.category_code, ds.category_self, ds.source_purpose
, ds.category_self, ds.source_purpose
, ds.quantity, ds.unit_code, ds.price, ds.estimated_value
from daily_expense ds
<include refid="app.module.front.usecase.daily.record.persistence.DailyRecordMapper.InnerJoinByDailyRecord"/>
@@ -29,13 +29,13 @@
<insert id="createDailyExpense" useGeneratedKeys="true" keyProperty="id">
insert into daily_expense (
daily_record_seq, input_type, is_credit, income_mark_code, category_code, category_self, source_purpose
daily_record_seq, input_type, is_credit, income_mark_code, category_self, source_purpose
, quantity, unit_code, price, estimated_value
, is_deleted
, <include refid="common.fields.CreateUpdateBaseColumns"/>
) values (
#{dailyRecordSeq}
, #{inputType}, #{credit}, #{incomeMarkCode}, #{categoryCode}, #{categorySelf}, #{sourcePurpose}
, #{inputType}, #{credit}, #{incomeMarkCode}, #{categorySelf}, #{sourcePurpose}
, #{quantity}, #{unitCode}, #{price}, #{estimatedValue}
, false
, <include refid="common.fields.CreateUpdateBaseValues"/>
@@ -46,7 +46,6 @@
update daily_expense set <include refid="common.fields.UpdateBaseSet"/>
, is_credit = #{credit}
, income_mark_code = #{incomeMarkCode}
, category_code = #{categoryCode}
, category_self = #{categorySelf}
, source_purpose = #{sourcePurpose}
, quantity = #{quantity}

View File

@@ -5,7 +5,7 @@
<select id="getDailyIncomeList"
resultType="app.module.front.usecase.daily.income.persistence.model.DailyIncomeDto">
select ds.id, ds.daily_record_seq, ds.input_type, ds.is_credit as credit
, ds.crop_code, ds.category_code, ds.category_self, ds.source_purpose
, ds.crop_code, ds.category_self, ds.source_purpose
, ds.quantity, ds.unit_code, ds.price, ds.estimated_value
from daily_income ds
<include refid="app.module.front.usecase.daily.record.persistence.DailyRecordMapper.InnerJoinByDailyRecord"/>
@@ -29,13 +29,13 @@
<insert id="createDailyIncome" useGeneratedKeys="true" keyProperty="id">
insert into daily_income (
daily_record_seq, input_type, is_credit, expense_mark_code, crop_code, category_code, category_self, source_purpose
daily_record_seq, input_type, is_credit, expense_mark_code, crop_code, category_self, source_purpose
, quantity, unit_code, price, estimated_value
, is_deleted
, <include refid="common.fields.CreateUpdateBaseColumns"/>
) values (
#{dailyRecordSeq}
, #{inputType}, #{credit}, #{expenseMarkCode}, #{cropCode}, #{categoryCode}, #{categorySelf}, #{sourcePurpose}
, #{inputType}, #{credit}, #{expenseMarkCode}, #{cropCode}, #{categorySelf}, #{sourcePurpose}
, #{quantity}, #{unitCode}, #{price}, #{estimatedValue}
, false
, <include refid="common.fields.CreateUpdateBaseValues"/>
@@ -47,7 +47,6 @@
, is_credit = #{credit}
, expense_mark_code = #{expenseMarkCode}
, crop_code = #{cropCode}
, category_code = #{categoryCode}
, category_self = #{categorySelf}
, source_purpose = #{sourcePurpose}
, quantity = #{quantity}

View File

@@ -54,42 +54,14 @@
<hr>
<section class="form-group">
<div class="select-group">
<div class="select-label">
<p class="label-txt">
지출의 종류
<i class="ico-required-mark" role="img" aria-label="필수">*</i>
</p>
<div class="component-input">
<div class="input-label">
<label for="categorySelf" class="label-txt">
지출의 종류<i class="ico-required-mark" role="img" aria-label="필수">*</i>
</label>
</div>
<div id="categoryCode" class="component-select bottom-sheet" data-props-default="지출 종류를 선택해 주세요" data-props-type="bottomSheet">
<input type="hidden1" name="categoryCode" th:value="${detail.categoryCode}" data-type="select">
<button type="button" class="select-box">
<span class="select-txt"></span>
</button>
<div class="select-options">
<div class="select-header">
<p>지출의 종류</p>
<button type="button" class="select-close">
<span class="hide-txt">닫기</span>
</button>
</div>
<div class="select-scroll">
<ul class="">
<li class="option"
th:each="uiCode : ${recordExpense}"
th:data-value="${uiCode.id}"
th:text="${uiCode.codeText}"></li>
</ul>
</div>
</div>
</div>
<div class="component-input input-invalid" data-option="직접 입력">
<div class="input-field">
<input type="text" id="categorySelf" name="categorySelf" th:value="${detail.categorySelf}" maxlength="30" placeholder="지출의 종류를 입력해 주세요">
</div>
<ul class="input-info">
<li>지출 종류를 입력해 주세요.</li>
</ul>
<div class="input-field">
<input type="text" id="categorySelf" name="categorySelf" th:value="${detail.categorySelf}" maxlength="30" placeholder="지출의 종류를 입력해 주세요">
</div>
</div>
<div class="component-input">

View File

@@ -63,7 +63,7 @@
<div class="list-item"
th:each="item, itemStatus : ${expenseList}">
<div class="item-tit-group">
<p class="item-name">[[${item.categoryLabel}]] [[${item.categorySelf}]]</p>
<p class="item-name">[[${item.categorySelf}]]</p>
<div class="btn-group">
<button type="button" class="delete" th:onclick="formControl.removeConfirm([[${item.id}]])"><span class="hide-txt">삭제</span></button>
<button type="button" class="edit" th:onclick="formControl.createModal([[${item.id}]])"><span class="hide-txt">수정</span></button>
@@ -150,8 +150,8 @@
remove: /*[[|/api/record/expense/${reqVO.searchMonth}/${reqVO.groupNo}/remove|]]*/'removeUrl',
reset: /*[[|/api/record/expense/${reqVO.searchMonth}/${reqVO.groupNo}/reset|]]*/'resetUrl',
},
month: [[${reqVO.searchMonth}]],
groupNo: [[${reqVO.groupNo}]],
month: /*[[${reqVO.searchMonth}]]*/'month',
groupNo: /*[[${reqVO.groupNo}]]*/'groupNo',
submitted: false,
};
@@ -209,6 +209,17 @@
// });
},
_bindModelUI() {
etUI.initUI();
const $select2 = document.querySelector('#unitCode');
const selectboxInstance2 = new etUI.components.SelectBox();
selectboxInstance2.core.init($select2, {
selectItemCallback({selectValue, dataValue}){
console.log('selectItemCallback', selectValue, dataValue)
$('input[name="unitCode"]').val(dataValue)
}
});
let $formWrap = $(bind.form.selector).find('form');
$formWrap.on('keyup', 'input[name="price"]', function() {
// TODO : UI disabled
@@ -239,47 +250,9 @@
function(rstHtml, status) {
$('.modal01').find('.modal-content').html(rstHtml);
// TODO
etUI.components.SelectBox().core.init(document.querySelector('#categoryCode'));
etUI.components.SelectBox().core.init(document.querySelector('#unitCode'));
/*
etUI.components.SelectBox().core.init(document.querySelector('#categoryCode'), {
onChange: function() {
console.log('sssssssssss')
},
selectItemCallback: function() {
// TODO : console.log ?
console.log(1111)
}
});
etUI.components.SelectBox().core.init(document.querySelector('#unitCode'), {
onChange: function() {
console.log('sssssssssss')
},
selectItemCallback: function() {
console.log(3333)
}
});
*/
/*document.querySelector('#selectUnit').addEventListener('select:onChange', (e) => {
console.log(e.detail);
console.log(e.detail.value);
});
const selectbox2 = document.querySelector('.component-select');
selectbox2.addEventListener('select:onChange', (e) => {
console.log(e.detail);
console.log(e.detail.value);
});
*/
//document.queerySelector('#unitSelect')
const modal01 = document.querySelector(".modal01").ui;
modal01.open();
formControl._bindModelUI();
},
function(code, rstData) {
@@ -290,12 +263,6 @@
);
},
createVaild() {
const f = document.reqModalForm;
// TODO : setter
f.categoryCode.value = document.querySelector('#categoryCode').value !== undefined ? document.querySelector('#categoryCode').value : '';
f.unitCode.value = document.querySelector('#unitCode').value !== undefined ? document.querySelector('#unitCode').value : '';
formControl.create();
},
create() {

View File

@@ -84,42 +84,14 @@
<hr>
<section class="form-group">
<div class="select-group">
<div class="select-label">
<p class="label-txt">
수입의 종류
<i class="ico-required-mark" role="img" aria-label="필수">*</i>
</p>
<div class="component-input">
<div class="input-label">
<label for="categorySelf" class="label-txt">
수입의 종류<i class="ico-required-mark" role="img" aria-label="필수">*</i>
</label>
</div>
<div id="categoryCode" class="component-select bottom-sheet" data-props-default="수입 종류를 선택해 주세요" data-props-type="bottomSheet">
<input type="hidden1" name="categoryCode" th:value="${detail.categoryCode}" data-type="select">
<button type="button" class="select-box">
<span class="select-txt"></span>
</button>
<div class="select-options">
<div class="select-header">
<p>수입의 종류</p>
<button type="button" class="select-close">
<span class="hide-txt">닫기</span>
</button>
</div>
<div class="select-scroll">
<ul class="">
<li class="option"
th:each="uiCode : ${recordIncome}"
th:data-value="${uiCode.id}"
th:text="${uiCode.codeText}"></li>
</ul>
</div>
</div>
</div>
<div class="component-input input-invalid" data-option="직접 입력">
<div class="input-field">
<input type="text" id="categorySelf" name="categorySelf" th:value="${detail.categorySelf}" maxlength="30" placeholder="수입의 종류를 입력해 주세요">
</div>
<ul class="input-info">
<li>수입 종류를 입력해 주세요.</li>
</ul>
<div class="input-field">
<input type="text" id="categorySelf" name="categorySelf" th:value="${detail.categorySelf}" maxlength="30" placeholder="수입의 종류를 입력해 주세요">
</div>
</div>
<div class="component-input">

View File

@@ -62,7 +62,7 @@
<div class="list-item"
th:each="item, itemStatus : ${incomeList}">
<div class="item-tit-group">
<p class="item-name">[[${item.categoryLabel}]] [[${item.categorySelf}]]</p>
<p class="item-name">[[${item.categorySelf}]]</p>
<div class="btn-group">
<button type="button" class="delete" th:onclick="formControl.removeConfirm([[${item.id}]])"><span class="hide-txt">삭제</span></button>
<button type="button" class="edit" th:onclick="formControl.createModal([[${item.id}]])"><span class="hide-txt">수정</span></button>
@@ -153,8 +153,8 @@
remove: /*[[|/api/record/income/${reqVO.searchMonth}/${reqVO.groupNo}/remove|]]*/'removeUrl',
reset: /*[[|/api/record/income/${reqVO.searchMonth}/${reqVO.groupNo}/reset|]]*/'resetUrl',
},
month: [[${reqVO.searchMonth}]],
groupNo: [[${reqVO.groupNo}]],
month: /*[[${reqVO.searchMonth}]]*/'month',
groupNo: /*[[${reqVO.groupNo}]]*/'groupNo',
submitted: false,
};
@@ -209,7 +209,27 @@
// });
},
_bindModelUI() {
let $formWrap = $(bind.form.selector).find('form');
etUI.initUI();
const $select1 = document.querySelector('#cropCode');
const selectboxInstance1 = new etUI.components.SelectBox();
selectboxInstance1.core.init($select1, {
selectItemCallback({selectValue, dataValue}){
console.log('selectItemCallback', selectValue, dataValue)
$('input[name="cropCode"]').val(dataValue)
}
});
const $select2 = document.querySelector('#unitCode');
const selectboxInstance2 = new etUI.components.SelectBox();
selectboxInstance2.core.init($select2, {
selectItemCallback({selectValue, dataValue}){
console.log('selectItemCallback', selectValue, dataValue)
$('input[name="unitCode"]').val(dataValue)
}
});
const $formWrap = $(bind.form.selector).find('form');
$formWrap.on('keyup', 'input[name="price"]', function() {
// TODO : UI disabled
if ($(this).val() === '') {
@@ -239,48 +259,9 @@
function(rstHtml, status) {
$('.modal01').find('.modal-content').html(rstHtml);
// TODO
etUI.components.SelectBox().core.init(document.querySelector('#categoryCode'));
etUI.components.SelectBox().core.init(document.querySelector('#cropCode'));
etUI.components.SelectBox().core.init(document.querySelector('#unitCode'));
/*
etUI.components.SelectBox().core.init(document.querySelector('#categoryCode'), {
onChange: function() {
console.log('sssssssssss')
},
selectItemCallback: function() {
// TODO : console.log ?
console.log(1111)
}
});
etUI.components.SelectBox().core.init(document.querySelector('#unitCode'), {
onChange: function() {
console.log('sssssssssss')
},
selectItemCallback: function() {
console.log(3333)
}
});
*/
/*document.querySelector('#selectUnit').addEventListener('select:onChange', (e) => {
console.log(e.detail);
console.log(e.detail.value);
});
const selectbox2 = document.querySelector('.component-select');
selectbox2.addEventListener('select:onChange', (e) => {
console.log(e.detail);
console.log(e.detail.value);
});
*/
//document.queerySelector('#unitSelect')
const modal01 = document.querySelector(".modal01").ui;
modal01.open();
formControl._bindModelUI();
},
function(code, rstData) {
@@ -291,13 +272,6 @@
);
},
createVaild() {
const f = document.reqModalForm;
// TODO : setter
f.categoryCode.value = document.querySelector('#categoryCode').value !== undefined ? document.querySelector('#categoryCode').value : '';
f.cropCode.value = document.querySelector('#cropCode').value !== undefined ? document.querySelector('#cropCode').value : '';
f.unitCode.value = document.querySelector('#unitCode').value !== undefined ? document.querySelector('#unitCode').value : '';
formControl.create();
},
create() {