成长记录 ' + (index + 1) + '
' + escapeHtml(stringifyRecord(record)) + '
(function (root, factory) { // 成长记录页面只消费 ApiClient 中已在 Apifox PC 目录核验的方法。 if (typeof module === 'object' && module.exports) { module.exports = factory(root); return; } root.GrowthPages = factory(root); if (root.document) { root.document.addEventListener('DOMContentLoaded', function () { root.GrowthPages.init(); }); } })(typeof globalThis !== 'undefined' ? globalThis : window, function (root) { 'use strict'; var documentRef = root.document; var writePending = false; function getApi() { return root.GenealogyApi && root.GenealogyApi.defaultClient; } function query(selector, rootNode) { return documentRef ? (rootNode || documentRef).querySelector(selector) : null; } function queryAll(selector, rootNode) { return documentRef ? Array.prototype.slice.call((rootNode || documentRef).querySelectorAll(selector)) : []; } function trimOrUndefined(value) { var text = String(value === undefined || value === null ? '' : value).trim(); return text || undefined; } function toSafeIntegerOrUndefined(value) { var text = trimOrUndefined(value); var number; if (!text) return undefined; number = Number(text); return Number.isInteger(number) && Number.isSafeInteger(number) ? number : undefined; } function getQueryParam(search, name) { var params = new URLSearchParams(String(search || '').replace(/^\?/, '')); return params.get(name) || ''; } function getCurrentGenealogyId(search) { var page = query('[data-growth-page], [data-growth-edit-page]'); var source = search === undefined && root.location ? root.location.search : search; var profileGenealogyId; if (search === undefined && root.ProfileUI && root.ProfileUI.getGenealogyId) { profileGenealogyId = root.ProfileUI.getGenealogyId(); if (profileGenealogyId) return profileGenealogyId; } return getQueryParam(source, 'genealogyId') || (page && page.getAttribute('data-genealogy-id')) || ''; } function buildGrowthRecordBody(values) { var source = values || {}; var body = { recordTitle: String(source.recordTitle || '').trim() }; var lineagePersonId = trimOrUndefined(source.lineagePersonId); var recordType = trimOrUndefined(source.recordType); var recordContent = trimOrUndefined(source.recordContent); var recordDate = trimOrUndefined(source.recordDate); var remindTime = trimOrUndefined(source.remindTime); var mediaOssIds = trimOrUndefined(source.mediaOssIds); var status = trimOrUndefined(source.status); var sortOrderText = trimOrUndefined(source.sortOrder); if (lineagePersonId !== undefined) body.lineagePersonId = lineagePersonId; if (recordType !== undefined) body.recordType = recordType; if (recordContent !== undefined) body.recordContent = recordContent; if (recordDate !== undefined) body.recordDate = recordDate; if (remindTime !== undefined) body.remindTime = remindTime; if (mediaOssIds !== undefined) body.mediaOssIds = mediaOssIds; if (sortOrderText !== undefined) body.sortOrder = toSafeIntegerOrUndefined(sortOrderText); if (status !== undefined) body.status = status; return body; } function validateGrowthRecordBody(body) { if (!body || !body.recordTitle) return '请填写记录标题'; if (body.lineagePersonId !== undefined && !/^\d+$/.test(body.lineagePersonId)) return '世系人物 ID 必须是整数'; if (body.mediaOssIds !== undefined && !/^[1-9][0-9]*(,[1-9][0-9]*)*$/.test(body.mediaOssIds)) { return '附件 OSS ID 请使用英文逗号分隔的正整数'; } if (Object.prototype.hasOwnProperty.call(body, 'sortOrder') && body.sortOrder === undefined) return '排序值必须是安全整数'; return ''; } function normalizeGrowthList(data) { return Array.isArray(data) ? data : []; } function escapeHtml(value) { return String(value === undefined || value === null ? '' : value) .replace(/&/g, '&') .replace(//g, '>') .replace(/"/g, '"') .replace(/'/g, '''); } function stringifyRecord(record) { try { return typeof record === 'string' ? record : JSON.stringify(record); } catch (error) { return String(record); } } function renderGrowthRecords(data) { var container = query('[data-growth-list]'); var records = normalizeGrowthList(data); if (!container) return; if (!Array.isArray(data)) { container.innerHTML = '
' + escapeHtml(stringifyRecord(record)) + '