feat: CPU, GPU, RAM 입력 시 부품 마스터 기준 정합성 검증 추가 및 기존 데이터 정제
This commit is contained in:
@@ -454,6 +454,27 @@ class HwAssetModal extends BaseModal {
|
||||
formData.forEach((value, key) => { if (key !== 'id') updated[key] = value; });
|
||||
updated.location = bldgSelect.value;
|
||||
|
||||
// 부품 마스터 기준 정합성 검증 (CPU, GPU, RAM)
|
||||
const checkFields = [
|
||||
{ name: 'cpu', label: 'CPU', category: 'CPU' },
|
||||
{ name: 'gpu', label: 'GPU', category: 'GPU' },
|
||||
{ name: 'ram', label: 'RAM', category: 'RAM' }
|
||||
];
|
||||
|
||||
for (const field of checkFields) {
|
||||
const value = String(updated[field.name] || '').trim();
|
||||
if (value) {
|
||||
const isExists = this.masterComponents.some(c =>
|
||||
c.category.toUpperCase() === field.category &&
|
||||
c.component_name.trim().toLowerCase() === value.toLowerCase()
|
||||
);
|
||||
if (!isExists) {
|
||||
alert(`입력하신 ${field.label} "${value}"은(는) 부품 마스터에 등록되지 않은 규격입니다. 자동완성 목록에서 선택하거나 부품마스터에 먼저 등록해 주세요.`);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (await saveAsset(this.getCategoryKey(updated), updated)) {
|
||||
alert(UI_TEXT.MESSAGES.SAVE_SUCCESS);
|
||||
onSave(); this.close(); closeModals();
|
||||
|
||||
Reference in New Issue
Block a user