diff --git a/src/components/assistant/AssistantResponseCard.vue b/src/components/assistant/AssistantResponseCard.vue index c2a7e14..d8f0e92 100644 --- a/src/components/assistant/AssistantResponseCard.vue +++ b/src/components/assistant/AssistantResponseCard.vue @@ -41,6 +41,13 @@ interface CardData extends AssistantResponseCard { confidence?: string; analysisBase?: string; risks?: Array<{ level: string; title: string; detail: string }>; + similarCases?: Array<{ + date?: string | null; + product?: string | null; + problem?: string | null; + solution?: string | null; + similarity?: number | null; + }>; warning?: string; } const data = computed(() => props.card as CardData); @@ -224,6 +231,26 @@ function formatCount(value: unknown) { 当前标准库暂无可匹配规则,请补充产品品类、包材或检测指标。

+
+

相似历史案例

+
+ TOP {{ index + 1 }} +
+ {{ item.product || "未命名产品" }} + {{ item.problem || "异常问题未填写" }} → + {{ item.solution || "解决方案未填写" }} + 相似度 {{ Math.round(item.similarity * 100) }}% +
+
+
{{ risk.level }} @@ -495,6 +522,7 @@ function formatCount(value: unknown) { font-size: 11px; line-height: 1.55; } + .solution-risk { display: flex; gap: 7px; diff --git a/src/components/assistant/RiskAnalysisCard.vue b/src/components/assistant/RiskAnalysisCard.vue index 474bac6..a29418b 100644 --- a/src/components/assistant/RiskAnalysisCard.vue +++ b/src/components/assistant/RiskAnalysisCard.vue @@ -238,11 +238,18 @@ const stars = computed(() => { class="case-row" type="button" > - TOP {{ index + 1 }} - {{ item.date }} · {{ item.product }} · {{ item.problem }} → - {{ item.solution }} + TOP {{ index + 1 }} +
+ + {{ item.date || "日期未知" }} · + {{ item.product || "未命名产品" }} · + {{ item.problem || "异常问题未填写" }} → + {{ item.solution || "解决方案未填写" }} + 相似度 {{ Math.round(item.similarity * 100) }}% + +
@@ -644,8 +651,8 @@ h3 { .case-row { display: grid; width: 100%; - grid-template-columns: minmax(0, 1fr) auto auto auto; - align-items: center; + grid-template-columns: 58px minmax(0, 1fr); + align-items: start; gap: 8px; border: 0; border-radius: 6px; @@ -656,22 +663,36 @@ h3 { text-align: left; } -.case-row span { - min-width: 0; - overflow: hidden; - font-size: 11px; - text-overflow: ellipsis; +.case-rank { + display: inline-flex; + width: 58px; + min-width: 58px; + justify-content: flex-start; + padding-top: 1px; + color: var(--color-accent); + font-weight: 650; white-space: nowrap; + font-size: 11px; } -.case-row small { +.case-content { + min-width: 0; +} + +.case-content small { + display: block; color: var(--color-text-faint); font-size: 9px; + line-height: 1.45; + overflow-wrap: anywhere; + word-break: break-word; } -.case-row strong { +.case-content em { + margin-left: 6px; color: var(--color-accent); - font-size: 11px; + font-style: normal; + white-space: nowrap; } .tips-card { @@ -735,11 +756,16 @@ h3 { } .case-row { - grid-template-columns: minmax(0, 1fr) auto auto; + grid-template-columns: 50px minmax(0, 1fr); } - .case-row small { - display: none; + .case-rank { + width: 50px; + min-width: 50px; + } + + .case-content small { + white-space: normal; } } diff --git a/src/types/risk.ts b/src/types/risk.ts index 82eeaed..e22e397 100644 --- a/src/types/risk.ts +++ b/src/types/risk.ts @@ -39,10 +39,11 @@ export interface RiskAssessmentResult { modelVersion: string; factors: RiskFactorResult[]; similarCases?: Array<{ - date: string; - product: string; - problem: string; - solution: string; + date?: string | null; + product?: string | null; + problem?: string | null; + solution?: string | null; + similarity?: number | null; }>; aiSuggestions?: string[]; riskBadge?: string | null;