feat(platform): recommend quality issue actions
This commit is contained in:
@@ -48,6 +48,42 @@ function qualityShareURL() {
|
||||
return `${window.location.origin}${window.location.pathname}${window.location.hash}`;
|
||||
}
|
||||
|
||||
function qualityActionRecommendation(row: QualityIssueRow) {
|
||||
if (row.issueType === 'NO_SOURCE') {
|
||||
return {
|
||||
label: '确认平台转发',
|
||||
color: 'orange' as const,
|
||||
detail: '车辆已绑定但没有任何来源证据,先确认平台转发、端口和订阅。'
|
||||
};
|
||||
}
|
||||
if (row.issueType === 'VIN_MISSING' || !row.vin?.trim()) {
|
||||
return {
|
||||
label: '维护身份绑定',
|
||||
color: 'red' as const,
|
||||
detail: '数据已有来源但无法归并到 VIN,优先用车牌/手机号补齐绑定。'
|
||||
};
|
||||
}
|
||||
if (row.issueType === 'LINK_GAP') {
|
||||
return {
|
||||
label: '排查来源链路',
|
||||
color: 'orange' as const,
|
||||
detail: '来源存在上报间断,优先检查平台转发、网络和消费延迟。'
|
||||
};
|
||||
}
|
||||
if (row.issueType === 'FIELD_MISSING') {
|
||||
return {
|
||||
label: '核对解析字段',
|
||||
color: 'orange' as const,
|
||||
detail: '字段缺失会影响统计和展示,优先核对解析映射和原始 RAW。'
|
||||
};
|
||||
}
|
||||
return {
|
||||
label: '查看车辆服务',
|
||||
color: 'blue' as const,
|
||||
detail: '进入车辆服务详情,结合来源证据继续排查。'
|
||||
};
|
||||
}
|
||||
|
||||
async function copyText(value: string, label: string) {
|
||||
const text = value.trim();
|
||||
if (!text) {
|
||||
@@ -299,6 +335,19 @@ export function Quality({
|
||||
{ title: '级别', render: (_: unknown, row: QualityIssueRow) => <Tag color={row.severity === 'error' ? 'red' : 'orange'}>{row.severity}</Tag> },
|
||||
{ title: '最后时间', dataIndex: 'lastSeen' },
|
||||
{ title: '说明', dataIndex: 'detail' },
|
||||
{
|
||||
title: '处置建议',
|
||||
width: 260,
|
||||
render: (_: unknown, row: QualityIssueRow) => {
|
||||
const action = qualityActionRecommendation(row);
|
||||
return (
|
||||
<div>
|
||||
<Tag color={action.color}>{action.label}</Tag>
|
||||
<div style={{ marginTop: 6 }}>{action.detail}</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
width: 250,
|
||||
|
||||
@@ -1983,6 +1983,8 @@ test('renders quality issues as vehicle-service governance labels', async () =>
|
||||
expect(await screen.findByText('VIN-NO-SOURCE-001')).toBeInTheDocument();
|
||||
expect(screen.getAllByText('暂无数据来源').length).toBeGreaterThanOrEqual(1);
|
||||
expect(screen.getAllByText('车辆服务').length).toBeGreaterThanOrEqual(1);
|
||||
expect(screen.getByText('确认平台转发')).toBeInTheDocument();
|
||||
expect(screen.getByText('车辆已绑定但没有任何来源证据,先确认平台转发、端口和订阅。')).toBeInTheDocument();
|
||||
});
|
||||
|
||||
test('opens vehicle service from quality issue with issue source evidence', async () => {
|
||||
@@ -2076,6 +2078,8 @@ test('opens vehicle service from quality issue with issue source evidence', asyn
|
||||
render(<App />);
|
||||
|
||||
expect(await screen.findByText('13307795425')).toBeInTheDocument();
|
||||
expect(screen.getByText('维护身份绑定')).toBeInTheDocument();
|
||||
expect(screen.getByText('数据已有来源但无法归并到 VIN,优先用车牌/手机号补齐绑定。')).toBeInTheDocument();
|
||||
fireEvent.click(screen.getByRole('button', { name: '按车牌查车' }));
|
||||
|
||||
await waitFor(() => {
|
||||
|
||||
Reference in New Issue
Block a user