feat(platform): add history export next actions

This commit is contained in:
lingniu
2026-07-06 03:26:39 +08:00
parent 6a15503c7b
commit 08f2b62362
3 changed files with 250 additions and 1 deletions

View File

@@ -1924,6 +1924,88 @@ export function History({
onClick: copyDeliveryPackage
}
];
const nextExportPrimary = rawFieldRows.length > 0
? '字段证据'
: locations.items.length > 0
? '位置历史'
: rawFrames.items.length > 0
? '明细证据'
: '先查询';
const runPrimaryExport = () => {
if (rawFieldRows.length > 0) {
exportRawFields();
return;
}
if (locations.items.length > 0) {
exportLocations();
return;
}
if (rawFrames.items.length > 0) {
exportRawFrames();
return;
}
openQueryTab('raw');
};
const nextExportDecisionItems = [
{
label: '首要交付',
value: nextExportPrimary,
detail: rawFieldRows.length > 0 ? '优先交付客户选择的字段证据。' : locations.items.length > 0 ? '优先交付位置历史和轨迹复盘。' : rawFrames.items.length > 0 ? '先交付明细证据解释来源。' : '先查询车辆和时间窗数据。',
color: rawFieldRows.length > 0 || locations.items.length > 0 ? 'green' as const : rawFrames.items.length > 0 ? 'blue' as const : 'orange' as const,
onClick: runPrimaryExport
},
{
label: '轨迹状态',
value: validLocations.length > 0 ? `${validLocations.length.toLocaleString()}` : '待补轨迹',
detail: validLocations.length > 0 ? '可以进入轨迹回放和位置导出。' : '当前时间窗没有有效坐标,建议补查位置历史。',
color: validLocations.length > 0 ? 'green' as const : 'orange' as const,
onClick: () => openQueryTab('location')
},
{
label: '证据状态',
value: `${(rawFrames.total ?? 0).toLocaleString()} 帧 / ${fieldEvidenceCount.toLocaleString()} 字段`,
detail: fieldEvidenceCount > 0 ? '字段证据已准备,可缩小导出体积。' : '可从明细证据中选择客户需要的字段。',
color: fieldEvidenceCount > 0 ? 'green' as const : (rawFrames.total ?? 0) > 0 ? 'blue' as const : 'grey' as const,
onClick: () => openQueryTab(fieldEvidenceCount > 0 ? 'fields' : 'raw')
},
{
label: '说明状态',
value: deliveryState,
detail: anomalyTotal > 0 ? '复制时会带上质量提示和复核说明。' : '可复制客户可读的交付说明。',
color: deliveryStateColor,
onClick: copyDeliveryPackage
}
];
const nextExportActionItems = [
{
label: '导出优先项',
action: '执行导出',
color: nextExportPrimary === '字段证据' || nextExportPrimary === '位置历史' ? 'green' as const : nextExportPrimary === '明细证据' ? 'blue' as const : 'orange' as const,
disabled: nextExportPrimary === '先查询',
onClick: runPrimaryExport
},
{
label: '补查轨迹',
action: '位置历史',
color: validLocations.length > 0 ? 'green' as const : 'orange' as const,
disabled: false,
onClick: () => openQueryTab('location')
},
{
label: '复制说明',
action: '交付包',
color: deliveryStateColor,
disabled: false,
onClick: copyDeliveryPackage
},
{
label: '保存视图',
action: '复用',
color: 'blue' as const,
disabled: false,
onClick: copySavedReportView
}
];
const tripReviewSummaryItems = [
{
label: '起点',
@@ -2077,6 +2159,57 @@ export function History({
</div>
</section>
) : null}
{mode === 'query' ? (
<section className="vp-history-next-export-strip" aria-label="导出下一步行动条">
<div className="vp-history-next-export-copy">
<Space wrap>
<Tag color="blue"></Tag>
<Tag color={nextExportPrimary === '字段证据' || nextExportPrimary === '位置历史' ? 'green' : nextExportPrimary === '明细证据' ? 'blue' : 'orange'}>
{nextExportPrimary}
</Tag>
<Tag color={validLocations.length > 0 ? 'green' : 'orange'}>
{validLocations.length > 0 ? '轨迹可用' : '待补轨迹'}
</Tag>
</Space>
<Typography.Title heading={5} style={{ margin: 0 }}>
CSV
</Typography.Title>
<Typography.Text type="secondary">
{nextExportPrimary}{(rawFrames.total ?? 0).toLocaleString()} / {fieldEvidenceCount.toLocaleString()} {deliveryScopeText}
</Typography.Text>
</div>
<div className="vp-history-next-export-grid">
{nextExportDecisionItems.map((item) => (
<button
key={item.label}
type="button"
className="vp-history-next-export-item"
onClick={item.onClick}
aria-label={`导出下一步行动 ${item.label} ${item.value}`}
>
<Tag color={item.color}>{item.label}</Tag>
<strong>{item.value}</strong>
<span>{item.detail}</span>
</button>
))}
</div>
<div className="vp-history-next-export-actions">
{nextExportActionItems.map((item) => (
<button
key={item.label}
type="button"
className="vp-history-next-export-action"
disabled={item.disabled}
onClick={item.onClick}
aria-label={`导出下一步动作 ${item.label} ${item.action}`}
>
<Tag color={item.color}>{item.label}</Tag>
<span>{item.action}</span>
</button>
))}
</div>
</section>
) : null}
<section className="vp-history-evidence-chain" aria-label="客户时间窗证据链">
<div className="vp-history-evidence-chain-summary">
<Space wrap>