fix: 자산번호 저장 누락 오류 수정 및 위치보기 도면 배치 보완

This commit is contained in:
2026-06-19 16:25:28 +09:00
parent 41406f56e8
commit f41f2378d7
3 changed files with 72 additions and 5 deletions

View File

@@ -377,6 +377,30 @@ class HwAssetModal extends BaseModal {
return;
}
// 자산코드가 비어있는 경우 자동 생성 처리
let assetCode = getFieldValue('hw-asset_code').trim();
if (!assetCode) {
const cat = categorySelect.value;
if (!cat) { alert('구분을 먼저 선택해주세요.'); return; }
const prefix = TYPE_PREFIX_MAP[cat] || 'ETC';
const purchaseDate = (document.getElementById('hw-purchase_date') as HTMLInputElement)?.value || '';
try {
const res = await fetch(`http://${location.hostname}:3000/api/generate-asset-code?prefix=${prefix}&purchaseDate=${purchaseDate}`);
const data = await res.json();
if (data.nextCode) {
setFieldValue('hw-asset_code', data.nextCode);
assetCode = data.nextCode;
} else {
alert('자산코드 자동 생성에 실패했습니다. 수동으로 생성 버튼을 눌러주세요.');
return;
}
} catch (err) {
console.error('코드 자동 생성 실패:', err);
alert('자산코드 자동 생성 중 오류가 발생했습니다.');
return;
}
}
// 동적 볼륨 데이터 수집
const vols: any[] = [];
document.querySelectorAll('#hw-volume-container .volume-row').forEach((row, idx) => {