fix: 자산번호 생성 시 세부유형 접두사 우선 조회하도록 개선 및 모니터 접두사 MON 추가

This commit is contained in:
이태훈
2026-06-25 11:24:13 +09:00
parent 8176180e52
commit 322a8ae882
2 changed files with 5 additions and 2 deletions

View File

@@ -296,7 +296,8 @@ class HwAssetModal extends BaseModal {
document.getElementById('btn-gen-hw-code')?.addEventListener('click', async () => {
const cat = categorySelect.value;
if (!cat) { alert('구분을 먼저 선택해주세요.'); return; }
const prefix = TYPE_PREFIX_MAP[cat] || 'ETC';
const type = (document.getElementById('hw-asset_type') as HTMLSelectElement)?.value || '';
const prefix = TYPE_PREFIX_MAP[type] || TYPE_PREFIX_MAP[cat] || 'ETC';
const purchaseDate = (document.getElementById('hw-purchase_date') as HTMLInputElement)?.value || '';
try {
const res = await fetch(`/api/generate-asset-code?prefix=${prefix}&purchaseDate=${purchaseDate}`);
@@ -382,7 +383,8 @@ class HwAssetModal extends BaseModal {
if (!assetCode) {
const cat = categorySelect.value;
if (!cat) { alert('구분을 먼저 선택해주세요.'); return; }
const prefix = TYPE_PREFIX_MAP[cat] || 'ETC';
const type = (document.getElementById('hw-asset_type') as HTMLSelectElement)?.value || '';
const prefix = TYPE_PREFIX_MAP[type] || TYPE_PREFIX_MAP[cat] || 'ETC';
const purchaseDate = (document.getElementById('hw-purchase_date') as HTMLInputElement)?.value || '';
try {
const res = await fetch(`/api/generate-asset-code?prefix=${prefix}&purchaseDate=${purchaseDate}`);

View File

@@ -43,6 +43,7 @@ export const TYPE_PREFIX_MAP: Record<string, string> = {
'저장매체': 'STM', 'HDD': 'HDD', 'SSD': 'SSD',
'노트북': 'NBK', '태블릿': 'TAB',
'드론': 'DRO', '측량장비': 'SUR', '보조기기': 'SUR', '허브': 'NET',
'모니터': 'MON',
'구독SW': 'SW', '영구SW': 'SW', '내부' : 'SW_INT', '외부':'SW_EXT'
};