import { createLocalMaterials } from "./filingMaterialTemplate"; const STORAGE_PREFIX = "qual_filing_local_draft:"; function storageKey(mode) { return `${STORAGE_PREFIX}${mode || "application"}`; } export function loadLocalDraft(mode) { try { const raw = sessionStorage.getItem(storageKey(mode)); if (!raw) { return null; } return JSON.parse(raw); } catch { return null; } } export function saveLocalDraft(mode, detail) { try { sessionStorage.setItem(storageKey(mode), JSON.stringify(detail)); } catch (err) { console.warn("[filingLocalDraft] save failed:", err); } } export function clearLocalDraft(mode) { sessionStorage.removeItem(storageKey(mode)); } /** 新建表单:空白,不预填机构信息 */ export function createEmptyFilingDetail() { return { id: null, filingStatusCode: 5, materials: createLocalMaterials(), commitment: { legalRepPersonnelId: "", legalRepName: "", filingUnitName: "", signDate: null, legalRepSignatureUrl: "", signatureFiles: [], commitmentContent: "", }, personnelList: [], equipmentList: [], businessScope: "", filingTerritoryName: "", filingUnitName: "", filingUnitTypeName: "", creditCode: "", registerAddress: "", officeAddress: "", qualCertNo: "", infoDisclosureUrl: "", legalPersonPhone: "", contactPhone: "", fixedAssetAmount: null, workplaceArea: null, archiveRoomArea: null, fulltimeEvaluatorCount: null, registeredEngineerCount: null, unitIntro: "", attachmentUrl: "", attachments: [], }; }