Files
tap/lib/documents.ts
T

21 lines
2.3 KiB
TypeScript

import { appPath } from './base-path.ts';
export const FEISHU_TEMPLATE_DIRECTORY = 'https://ecnldnvsv8es.feishu.cn/wiki/Bvnbw852biK7qRkhwJkcOIvun4f?from=from_copylink';
export const documents = [
{ id: 'sop', title: '软件开发流程管理规范', filename: '开发SOP_公示版.md', description: '职责、需求评审、验收与发布的完整约定。' },
{ id: 'registration', title: '需求登记模板', filename: '附件01_需求登记模板.md', description: '用于登记业务问题、目标、负责人及期望时间。' },
{ id: 'requirement', title: '需求说明模板', filename: '附件02_需求文档模板.md', description: '用于补充业务背景、目标、场景及验收标准;方案部分由开发责任人在评审时填写。' },
{ id: 'data-source', title: '数据来源模板', filename: '附件03_数据来源填写模板.md', description: '用于说明数据从哪里来、由谁提供、更新频率及参考样例。' },
{ id: 'acceptance', title: '验收记录模板', filename: '附件04_验收记录模板.md', description: '业务验收时记录逐项结果、证据及确认结论。' },
{ id: 'change', title: '需求变更记录模板', filename: '附件05_需求变更记录模板.md', description: '记录变更原因、影响、调整后的计划和确认人。' },
{ id: 'defect', title: '缺陷记录模板', filename: '附件06_缺陷记录模板.md', description: '记录复现步骤、预期与实际结果、修复和复验情况。' },
{ id: 'release', title: '发布记录模板', filename: '附件07_发布记录模板.md', description: '记录上线版本、检查结果、恢复方式和生产验证。' },
] as const;
export type DocumentId = typeof documents[number]['id'];
export type DocumentInfo = typeof documents[number];
export function findDocument(value: string): DocumentInfo | undefined { return documents.find(item => item.id === value || item.filename === value); }
export function templateDownloadUrl(id: DocumentId): string { return appPath('/api/documents/' + encodeURIComponent(findDocument(id)!.filename) + '?format=docx'); }
export function linkedDocument(href: string): DocumentInfo | undefined {
try { return findDocument(decodeURIComponent(href.split('#')[0].split('?')[0].split('/').at(-1) || '')); } catch { return undefined; }
}