내정보 끝.
This commit is contained in:
@@ -123,7 +123,6 @@
|
||||
elementRefs: {
|
||||
noDataCheckbox: document.getElementById("forestProductStatus"),
|
||||
select:{
|
||||
landTypeSelect : null,
|
||||
mainYieldUnitCodeSelect : null,
|
||||
mainSaleUnitCodeSelect : null,
|
||||
subYieldUnitCodeSelect : null,
|
||||
@@ -308,7 +307,7 @@
|
||||
$('.addPopup').find('.modal-content-inner').html(rstHtml);
|
||||
|
||||
const selectConfigs = [
|
||||
{ id: 'landTypeSelect', targetId: 'landType', key: 'landTypeSelect' },
|
||||
|
||||
{ id: 'mainYieldUnitCodeSelect', targetId: 'mainYieldUnitCode', key: 'mainYieldUnitCodeSelect' },
|
||||
{ id: 'mainSaleUnitCodeSelect', targetId: 'mainSaleUnitCode', key: 'mainSaleUnitCodeSelect' },
|
||||
{ id: 'subYieldUnitCodeSelect', targetId: 'subYieldUnitCode', key: 'subYieldUnitCodeSelect' },
|
||||
@@ -321,11 +320,27 @@
|
||||
selectBox.core.init($select, {
|
||||
selectItemCallback({ selectValue, dataValue }) {
|
||||
document.querySelector(`#${targetId}`).value = dataValue;
|
||||
|
||||
const withoutCode = targetId.replace(/Code$/, '');
|
||||
console.log(withoutCode);
|
||||
if(dataValue == "code.record.unit.self") {
|
||||
console.log(dataValue + "close")
|
||||
document.querySelector('#'+withoutCode).value="";
|
||||
document.querySelector('#'+withoutCode+'Div').style.display ='block';
|
||||
} else {
|
||||
console.log(dataValue + "close")
|
||||
document.querySelector('#'+withoutCode).value="";
|
||||
document.querySelector('#'+withoutCode+'Div').style.display ='none';
|
||||
}
|
||||
}
|
||||
});
|
||||
ENV.elementRefs.select[key] = selectBox;
|
||||
});
|
||||
|
||||
|
||||
ENV.module.modalPopup.open();
|
||||
|
||||
document.querySelector('.modal-content').scrollTop = 0;
|
||||
},
|
||||
function(code, rstData) {
|
||||
kri.logger.error('Do nothing. code: '+ code, rstData);
|
||||
@@ -351,7 +366,7 @@
|
||||
//등록 아이템 저장
|
||||
saveFormData() {
|
||||
const form = document.getElementById('forestForm');
|
||||
const selects = ['landType', 'mainYieldUnitCode', 'mainSaleUnitCode', 'subYieldUnitCode', 'subSaleUnitCode'];
|
||||
const selects = ['mainYieldUnitCode', 'mainSaleUnitCode', 'subYieldUnitCode', 'subSaleUnitCode'];
|
||||
selects.forEach(id => {
|
||||
const sel = document.getElementById(id + 'Select');
|
||||
if (sel && sel.value) form[id].value = sel.value;
|
||||
@@ -359,22 +374,70 @@
|
||||
|
||||
const errors = [];
|
||||
if (!form.cropName.value) errors.push({field: 'cropName', message: '재배 작물명을 입력해주세요.'});
|
||||
if (form.mainYield.value && !form.mainYieldUnitCode.value) errors.push({
|
||||
field: 'mainYieldUnitCode',
|
||||
message: '단위를 선택해주세요.'
|
||||
});
|
||||
if (form.mainSaleAmount.value && !form.mainSaleUnitCode.value) errors.push({
|
||||
field: 'mainSaleUnitCode',
|
||||
message: '단위를 선택해주세요.'
|
||||
});
|
||||
if (form.subYield.value && !form.subYieldUnitCode.value) errors.push({
|
||||
field: 'subYieldUnitCode',
|
||||
message: '단위를 선택해주세요.'
|
||||
});
|
||||
if (form.subSaleAmount.value && !form.subSaleUnitCode.value) errors.push({
|
||||
field: 'subSaleUnitCode',
|
||||
message: '단위를 선택해주세요.'
|
||||
});
|
||||
|
||||
|
||||
if(form.mainYield.value){
|
||||
if(!form.mainYieldUnitCode.value){
|
||||
errors.push({
|
||||
field: 'mainYieldUnitCode',
|
||||
message: '단위를 선택해주세요.'
|
||||
});
|
||||
} else if (form.mainYieldUnitCode.value && form.mainYieldUnitCode.value =="code.record.unit.self" && !form.mainYieldUnit.value){
|
||||
|
||||
errors.push({
|
||||
field: 'mainYieldUnit',
|
||||
message: '단위를 입력해주세요.'
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
if(form.mainSaleAmount.value){
|
||||
if(!form.mainSaleUnitCode.value){
|
||||
errors.push({
|
||||
field: 'mainSaleUnitCode',
|
||||
message: '단위를 선택해주세요.'
|
||||
});
|
||||
} else if (form.mainSaleUnitCode.value && form.mainSaleUnitCode.value =="code.record.unit.self" && !form.mainSaleUnit.value){
|
||||
|
||||
errors.push({
|
||||
field: 'mainSaleUnit',
|
||||
message: '단위를 입력해주세요.'
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(form.subYield.value){
|
||||
if(!form.subYieldUnitCode.value){
|
||||
errors.push({
|
||||
field: 'subYieldUnitCode',
|
||||
message: '단위를 선택해주세요.'
|
||||
});
|
||||
} else if (form.subYieldUnitCode.value && form.subYieldUnitCode.value =="code.record.unit.self" && !form.subYieldUnit.value){
|
||||
|
||||
errors.push({
|
||||
field: 'subYieldUnit',
|
||||
message: '단위를 입력해주세요.'
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(form.subSaleAmount.value){
|
||||
if(!form.subSaleUnitCode.value){
|
||||
errors.push({
|
||||
field: 'subSaleUnitCode',
|
||||
message: '단위를 선택해주세요.'
|
||||
});
|
||||
} else if (form.subSaleUnitCode.value && form.subSaleUnitCode.value =="code.record.unit.self" && !form.subSaleUnit.value){
|
||||
|
||||
errors.push({
|
||||
field: 'subSaleUnit',
|
||||
message: '단위를 입력해주세요.'
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
kri.form.error(errors);
|
||||
if (errors.length > 0) return;
|
||||
@@ -405,14 +468,32 @@
|
||||
const form = document.getElementById('forestForm');
|
||||
Object.entries(product).forEach(([key, val]) => {
|
||||
const field = form.elements.namedItem(key);
|
||||
if (field) field.value = val;
|
||||
if (field) {
|
||||
field.value = val;
|
||||
if(key == 'mainYieldUnitCode' && val == "code.record.unit.self"){
|
||||
document.getElementById("mainYieldUnitDiv").style.display = "block";
|
||||
}
|
||||
if(key == 'mainSaleUnitCode' && val == "code.record.unit.self"){
|
||||
document.getElementById("mainSaleUnitDiv").style.display = "block";
|
||||
}
|
||||
if(key == 'subYieldUnitCode' && val == "code.record.unit.self"){
|
||||
document.getElementById("subYieldUnitDiv").style.display = "block";
|
||||
}
|
||||
if(key == 'subSaleUnitCode' && val == "code.record.unit.self"){
|
||||
document.getElementById("subSaleUnitDiv").style.display = "block";
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
ENV.elementRefs.select.landTypeSelect.setValue(product.landType);
|
||||
|
||||
ENV.elementRefs.select.mainYieldUnitCodeSelect.setValue(product.mainYieldUnitCode);
|
||||
ENV.elementRefs.select.mainSaleUnitCodeSelect.setValue(product.mainSaleUnitCode);
|
||||
ENV.elementRefs.select.subYieldUnitCodeSelect.setValue(product.subYieldUnitCode);
|
||||
ENV.elementRefs.select.subSaleUnitCodeSelect.setValue(product.subSaleUnitCode);
|
||||
document.getElementById("mainYieldUnit").value = product.mainYieldUnit;
|
||||
document.getElementById("mainSaleUnit").value = product.mainSaleUnit;
|
||||
document.getElementById("subYieldUnit").value = product.subYieldUnit;
|
||||
document.getElementById("subSaleUnit").value = product.subSaleUnit;
|
||||
|
||||
},100);
|
||||
|
||||
@@ -439,9 +520,13 @@
|
||||
return found ? found.codeText : '-';
|
||||
},
|
||||
// 단위 코드
|
||||
getUnitLabel(code) {
|
||||
const found = ENV.data.unitList.find(i => i.id === code);
|
||||
return found ? found.codeText : '-';
|
||||
getUnitLabel(code,inputValue) {
|
||||
if(code == "code.record.unit.self"){
|
||||
return inputValue;
|
||||
} else {
|
||||
const found = ENV.data.unitList.find(i => i.id === code);
|
||||
return found ? found.codeText : '-';
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
@@ -485,6 +570,12 @@
|
||||
const getUnit = formControl.getUnitLabel;
|
||||
const getPurpose = formControl.getPurposeLabel;
|
||||
|
||||
// const mainYieldUnit = !product.mainYieldUnitCode ? ''
|
||||
// const mainSaleUnit
|
||||
// const subYieldUnit
|
||||
// const subSaleUnit
|
||||
|
||||
|
||||
const tag1 = product.landArea ? `<span>${format(product.landArea)}평</span>` : '';
|
||||
|
||||
let tag2 = '';
|
||||
@@ -492,25 +583,25 @@
|
||||
else if (product.town) tag2 = `<li><span>${product.town}</span></li>`;
|
||||
else if (product.streetNum) tag2 = `<li><span>${product.streetNum}</span></li>`;
|
||||
|
||||
const tag3 = product.landType ? `<li><p>지목</p><span>${getPurpose(product.landType)}</span></li>` : '';
|
||||
const tag3 = product.landType ? `<li><p>지목</p><span>${product.landType}</span></li>` : '';
|
||||
const tag4 = product.availableArea ? `<li><p>가능면적</p><span>${format(product.availableArea)}평</span></li>` : '';
|
||||
|
||||
let tag5 = '';
|
||||
if (product.mainYield && product.mainSaleAmount) {
|
||||
tag5 = `<li><p>주생산물 수확량 / 판매량</p><span>${format(product.mainYield)}${getUnit(product.mainYieldUnitCode)} / ${format(product.mainSaleAmount)}${getUnit(product.mainSaleUnitCode)}</span></li>`;
|
||||
tag5 = `<li><p>주생산물 수확량 / 판매량</p><span>${format(product.mainYield)}${getUnit(product.mainYieldUnitCode,product.mainYieldUnit)} / ${format(product.mainSaleAmount)}${getUnit(product.mainSaleUnitCode,product.mainSaleUnit)}</span></li>`;
|
||||
} else if (product.mainYield) {
|
||||
tag5 = `<li><p>주생산물 수확량</p><span>${format(product.mainYield)}${getUnit(product.mainYieldUnitCode)}</span></li>`;
|
||||
tag5 = `<li><p>주생산물 수확량</p><span>${format(product.mainYield)}${getUnit(product.mainYieldUnitCode,product.mainYieldUnit)}</span></li>`;
|
||||
} else if (product.mainSaleAmount) {
|
||||
tag5 = `<li><p>주생산물 판매량</p><span>${format(product.mainSaleAmount)}${getUnit(product.mainSaleUnitCode)}</span></li>`;
|
||||
tag5 = `<li><p>주생산물 판매량</p><span>${format(product.mainSaleAmount)}${getUnit(product.mainSaleUnitCode,product.mainSaleUnit)}</span></li>`;
|
||||
}
|
||||
|
||||
let tag6 = '';
|
||||
if (product.subYield && product.subSaleAmount) {
|
||||
tag6 = `<li><p>부생산물 수확량 / 판매량</p><span>${format(product.subYield)}${getUnit(product.subYieldUnitCode)} / ${format(product.subSaleAmount)}${getUnit(product.subSaleUnitCode)}</span></li>`;
|
||||
tag6 = `<li><p>부생산물 수확량 / 판매량</p><span>${format(product.subYield)}${getUnit(product.subYieldUnitCode,product.subYieldUnit)} / ${format(product.subSaleAmount)}${getUnit(product.subSaleUnitCode,product.subSaleUnit)}</span></li>`;
|
||||
} else if (product.subYield) {
|
||||
tag6 = `<li><p>부생산물 수확량</p><span>${format(product.subYield)}${getUnit(product.subYieldUnitCode)}</span></li>`;
|
||||
tag6 = `<li><p>부생산물 수확량</p><span>${format(product.subYield)}${getUnit(product.subYieldUnitCode,product.subYieldUnit)}</span></li>`;
|
||||
} else if (product.subSaleAmount) {
|
||||
tag6 = `<li><p>부생산물 판매량</p><span>${format(product.subSaleAmount)}${getUnit(product.subSaleUnitCode)}</span></li>`;
|
||||
tag6 = `<li><p>부생산물 판매량</p><span>${format(product.subSaleAmount)}${getUnit(product.subSaleUnitCode,product.subSaleUnit)}</span></li>`;
|
||||
}
|
||||
|
||||
let buttonGroupHtml = '';
|
||||
|
||||
Reference in New Issue
Block a user