feat: 부품 마스터 화면 내 직무별 기준 사양 CRUD 및 서브 탭 연동 기능 추가

This commit is contained in:
2026-06-15 13:26:11 +09:00
parent 132e37d0d3
commit e678f9d653
6 changed files with 470 additions and 56 deletions

View File

@@ -22,6 +22,7 @@ export interface MasterAssetData {
vip: any[];
mobile?: any[]; // Legacy mobile support
equip?: any[]; // Backward compat
jobSpecs?: any[];
// Backward compatibility
subSw: any[];
@@ -61,7 +62,8 @@ export const state: AppState = {
cost: [], vip: [],
subSw: [], permSw: [],
hw: [], sw: [],
swUsers: [], logs: []
swUsers: [], logs: [],
jobSpecs: []
}
};
@@ -79,6 +81,7 @@ export async function loadMasterDataFromDB() {
state.masterData = {
...state.masterData,
...data,
jobSpecs: data.jobSpecs || [],
logs: (data.logs || []).map((l: any) => ({
...l,
assetId: l.asset_id || l.assetId,
@@ -229,3 +232,38 @@ export async function deleteSystemUser(id: string) {
}
return false;
}
export async function saveJobSpec(spec: any) {
try {
const url = `${API_BASE_URL}/api/job-specs/save`;
const response = await fetch(url, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(spec)
});
if (response.ok) {
await loadMasterDataFromDB(); // 전역 상태 갱신
return true;
}
} catch (err) {
console.error('직무별 기준 사양 저장 실패:', err);
}
return false;
}
export async function deleteJobSpec(id: number) {
try {
const url = `${API_BASE_URL}/api/job-specs/${id}`;
const response = await fetch(url, { method: 'DELETE' });
if (response.ok) {
await loadMasterDataFromDB(); // 전역 상태 갱신
return true;
}
} catch (err) {
console.error('직무별 기준 사양 삭제 실패:', err);
}
return false;
}