1 Commits

View File

@@ -245,7 +245,7 @@ function applyTypeSpecificUI(type: string) {
opTitle: document.getElementById('hw-op-title') opTitle: document.getElementById('hw-op-title')
}; };
// 1. 초기화 (모든 유동 섹션 숨김) // 1. 초기화
serverOnly.forEach(el => (el as HTMLElement).style.display = 'none'); serverOnly.forEach(el => (el as HTMLElement).style.display = 'none');
nonServer.forEach(el => (el as HTMLElement).style.display = 'none'); nonServer.forEach(el => (el as HTMLElement).style.display = 'none');
locationFields.forEach(el => (el as HTMLElement).style.display = 'none'); locationFields.forEach(el => (el as HTMLElement).style.display = 'none');
@@ -254,12 +254,31 @@ function applyTypeSpecificUI(type: string) {
if (groups.type) groups.type.style.display = 'flex'; if (groups.type) groups.type.style.display = 'flex';
if (groups.opTitle) groups.opTitle.style.display = 'flex'; if (groups.opTitle) groups.opTitle.style.display = 'flex';
// 2. 유형별 정밀 규칙 적용 (사용자 정의 100% 일치) // 2. PC 유형일 때 상세용도 선택창 노출 (복구 핵심)
if (type === '서버') { if (type === 'PC' || type === '개인PC' || type === '노트북') {
if (groups.detailPurpose) groups.detailPurpose.style.display = 'flex';
// 상세용도가 '서버'인 경우 서버용 필드 노출, 아니면 일반 PC용 필드 노출
if (detailPurpose === '서버') {
serverOnly.forEach(el => (el as HTMLElement).style.display = 'flex');
locationFields.forEach(el => (el as HTMLElement).style.display = 'flex');
if (groups.networkTitle) groups.networkTitle.style.display = 'flex';
['ip', 'ip2', 'remote', 'serverId', 'serverPw', 'monitoring', 'model', 'os', 'cpu', 'ram', 'ssd1', 'ssd2'].forEach(k => {
if (groups[k]) groups[k]!.style.display = 'flex';
});
} else {
nonServer.forEach(el => (el as HTMLElement).style.display = 'flex');
if (groups.specTitle) groups.specTitle.style.display = 'flex';
['model', 'os', 'cpu', 'ram', 'ssd1', 'ssd2', 'hwSpec', 'ipNonServer'].forEach(k => {
if (groups[k]) groups[k]!.style.display = 'flex';
});
}
}
else if (type === '서버') {
serverOnly.forEach(el => (el as HTMLElement).style.display = 'flex'); serverOnly.forEach(el => (el as HTMLElement).style.display = 'flex');
locationFields.forEach(el => (el as HTMLElement).style.display = 'flex'); locationFields.forEach(el => (el as HTMLElement).style.display = 'flex');
Object.values(groups).forEach(g => { if (g) g.style.display = 'flex'; }); Object.values(groups).forEach(g => { if (g) g.style.display = 'flex'; });
} }
else if (['스토리지', 'NAS', 'DAS'].includes(type)) { else if (['스토리지', 'NAS', 'DAS'].includes(type)) {
serverOnly.forEach(el => (el as HTMLElement).style.display = 'flex'); serverOnly.forEach(el => (el as HTMLElement).style.display = 'flex');
locationFields.forEach(el => (el as HTMLElement).style.display = 'flex'); locationFields.forEach(el => (el as HTMLElement).style.display = 'flex');
@@ -268,41 +287,12 @@ function applyTypeSpecificUI(type: string) {
if (groups.specTitle) groups.specTitle.style.display = 'flex'; if (groups.specTitle) groups.specTitle.style.display = 'flex';
if (groups.model) groups.model.style.display = 'flex'; if (groups.model) groups.model.style.display = 'flex';
if (groups.ssd1) groups.ssd1.style.display = 'flex'; if (groups.ssd1) groups.ssd1.style.display = 'flex';
if (groups.ssd2) groups.ssd2.style.display = 'flex';
} }
else if (type === 'PC' || type === '노트북') { else {
if (type === 'PC' && groups.detailPurpose) groups.detailPurpose.style.display = 'flex'; // 기타 유형 (CPU, RAM, 모바일 등)
nonServer.forEach(el => (el as HTMLElement).style.display = 'flex');
if (groups.specTitle) groups.specTitle.style.display = 'flex';
['model', 'os', 'cpu', 'ram', 'ssd1', 'ssd2', 'hwSpec', 'ipNonServer'].forEach(k => {
if (groups[k]) groups[k]!.style.display = 'flex';
});
if (type === 'PC' && detailPurpose === '서버') {
locationFields.forEach(el => (el as HTMLElement).style.display = 'flex');
if (groups.networkTitle) groups.networkTitle.style.display = 'flex';
['ip', 'ip2', 'remote', 'serverId', 'serverPw', 'monitoring'].forEach(k => {
if (groups[k]) groups[k]!.style.display = 'flex';
});
if (groups.ipNonServer) groups.ipNonServer.style.display = 'none';
}
}
else if (['CPU', 'GPU', '모바일'].includes(type)) {
if (groups.specTitle) groups.specTitle.style.display = 'flex'; if (groups.specTitle) groups.specTitle.style.display = 'flex';
if (groups.model) groups.model.style.display = 'flex'; if (groups.model) groups.model.style.display = 'flex';
} }
else if (type === 'RAM') {
if (groups.specTitle) groups.specTitle.style.display = 'flex';
if (groups.ram) groups.ram.style.display = 'flex';
}
else if (type === 'HDD') {
if (groups.specTitle) groups.specTitle.style.display = 'flex';
if (groups.ssd1) groups.ssd1.style.display = 'flex';
}
else if (type === '태블릿') {
if (groups.specTitle) groups.specTitle.style.display = 'flex';
if (groups.model) groups.model.style.display = 'flex';
if (groups.ssd1) groups.ssd1.style.display = 'flex';
}
} }
function fillHwFormData(asset: HardwareAsset) { function fillHwFormData(asset: HardwareAsset) {