界面:表格长文本列统一左对齐,保留名称与属性对齐
This commit is contained in:
@@ -19,6 +19,7 @@ import { useReportVisualImages, type ReportVisualImage } from './AnalysisReportV
|
||||
import { analysisMemberListFullyRead, analysisMemberListPeriod, parseAnalysisMemberList } from './analysisMembersModel';
|
||||
import { AnalysisRecordListReport, appendAnalysisRecordReportHtml } from './AnalysisRecordList';
|
||||
import { useDelayedIndicator } from './useDelayedBusy';
|
||||
import { alignReportTableText, tableTextAlignment } from './tableTextAlignment';
|
||||
|
||||
type Row = Record<string, unknown>;
|
||||
const record = (value: unknown): Row => value && typeof value === 'object' && !Array.isArray(value) ? value as Row : {};
|
||||
@@ -46,6 +47,7 @@ export function ReportDocument({ turn, stamp, visualImages }: { turn: Row; stamp
|
||||
const title = resolveAnalysisReportTitle(result.reportTitle, turn.reportTitle, reportMarkdown, model.period, scope);
|
||||
const answer = sanitizeAnalysisDisplayText(stripDuplicateFirstMarkdownH1(sourceAnswer, title));
|
||||
const memberList = parseAnalysisMemberList(result.memberList ?? turn.memberList);
|
||||
const memberAlignments = Object.fromEntries(memberList?.fields.map(field => [field.key, tableTextAlignment(field.label, memberList.rows.map(row => row.values[field.key]))]) ?? []);
|
||||
const recordListValue = result.recordList ?? turn.recordList;
|
||||
const memberListStatus = memberList && analysisMemberListFullyRead(memberList)
|
||||
? `已读取全部 ${memberList.rowsReturned} 条`
|
||||
@@ -63,9 +65,9 @@ export function ReportDocument({ turn, stamp, visualImages }: { turn: Row; stamp
|
||||
{memberList && <details className="q-report-appendix"><summary>附录:完整成员清单</summary><section className="q-member-list">
|
||||
<h2>成员清单</h2>
|
||||
<p className="q-note">{analysisMemberListPeriod(memberList.period)} · {memberListStatus}</p>
|
||||
<table><thead><tr><th>序号</th>{memberList.fields.map(field => <th key={field.key}>{field.label}</th>)}<th>阶段</th></tr></thead>
|
||||
<table><thead><tr><th>序号</th>{memberList.fields.map(field => <th key={field.key} style={{ textAlign: memberAlignments[field.key] === 'left' ? 'left' : undefined }}>{field.label}</th>)}<th>阶段</th></tr></thead>
|
||||
<tbody>{memberList.rows.map((row, index) => <tr key={index}>
|
||||
<td>{index + 1}</td>{memberList.fields.map(field => <td key={field.key}>{text(row.values[field.key])}</td>)}
|
||||
<td>{index + 1}</td>{memberList.fields.map(field => <td key={field.key} style={{ textAlign: memberAlignments[field.key] === 'left' ? 'left' : undefined }}>{text(row.values[field.key])}</td>)}
|
||||
<td>{row.stages.map(stage => stage === 'black' ? '黑片' : '亮片').join('、')}</td>
|
||||
</tr>)}</tbody>
|
||||
</table>
|
||||
@@ -184,6 +186,7 @@ function safeNativeHtml(source: string, title: string): string {
|
||||
exportStyle.setAttribute('data-report-export-layout', '');
|
||||
exportStyle.textContent = 'html,body{box-sizing:border-box;width:900px!important;min-width:900px!important;max-width:900px!important;margin:0!important;overflow-wrap:anywhere}*,*:before,*:after{box-sizing:border-box}';
|
||||
parsed.head.append(exportStyle);
|
||||
alignReportTableText(parsed);
|
||||
return `<!doctype html>\n${parsed.documentElement.outerHTML}`;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user