|
|
@@ -2,7 +2,7 @@
|
|
|
|
|
|
import { useState } from "react";
|
|
|
import Link from "next/link";
|
|
|
-import { ChevronLeft, ChevronRight, FileText, GitBranch, Info } from "lucide-react";
|
|
|
+import { ChevronLeft, ChevronRight, GitBranch, Info } from "lucide-react";
|
|
|
import { AppShell } from "@/components/AppShell";
|
|
|
import { BusinessDrawer, type BusinessDrawerState } from "@/components/BusinessDrawer";
|
|
|
import { EmptyState, ErrorState, LoadingState } from "@/components/StateBlocks";
|
|
|
@@ -42,7 +42,6 @@ export function LedgerPage({ runId }: { runId: string }) {
|
|
|
demand={ledger.demandSummary}
|
|
|
collapsed={demandCollapsed}
|
|
|
onToggle={() => setDemandCollapsed((value) => !value)}
|
|
|
- onOpenDemand={setDrawer}
|
|
|
/>
|
|
|
<section className="table-wrap">
|
|
|
<table className="ledger-table">
|
|
|
@@ -73,14 +72,13 @@ export function LedgerPage({ runId }: { runId: string }) {
|
|
|
function DemandPanel({
|
|
|
demand,
|
|
|
collapsed,
|
|
|
- onToggle,
|
|
|
- onOpenDemand
|
|
|
+ onToggle
|
|
|
}: {
|
|
|
demand?: DemandSummary;
|
|
|
collapsed: boolean;
|
|
|
onToggle: () => void;
|
|
|
- onOpenDemand: (drawer: BusinessDrawerState) => void;
|
|
|
}) {
|
|
|
+ const meta = demandMetaItems(demand);
|
|
|
return (
|
|
|
<aside className={`demand-side-panel ${collapsed ? "collapsed" : ""}`}>
|
|
|
<div className="demand-panel-head">
|
|
|
@@ -115,67 +113,43 @@ function DemandPanel({
|
|
|
<span>{demand.seedTerms.join("、")}</span>
|
|
|
</p>
|
|
|
) : null}
|
|
|
- {demand?.sourcePostId ? <span className="demand-panel-meta">来源帖子 {demand.sourcePostId}</span> : null}
|
|
|
- <button className="mini-button demand-detail-button" type="button" onClick={() => onOpenDemand(demandDrawer(demand))}>
|
|
|
- <FileText size={13} />
|
|
|
- 看原始需求
|
|
|
- </button>
|
|
|
+ {demand?.reason ? (
|
|
|
+ <p className="demand-line">
|
|
|
+ <b>形成原因:</b>
|
|
|
+ <span>{demand.reason}</span>
|
|
|
+ </p>
|
|
|
+ ) : null}
|
|
|
+ {meta.length ? (
|
|
|
+ <div className="demand-inline-section">
|
|
|
+ <b>来源信息:</b>
|
|
|
+ <div>
|
|
|
+ {meta.map((item) => <span key={item}>{item}</span>)}
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ ) : null}
|
|
|
+ {demand?.categoryPaths.length ? (
|
|
|
+ <div className="demand-inline-section">
|
|
|
+ <b>分类树路径:</b>
|
|
|
+ <div>
|
|
|
+ {demand.categoryPaths.map((item) => <span key={item}>{item}</span>)}
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ ) : null}
|
|
|
</div>
|
|
|
) : null}
|
|
|
</aside>
|
|
|
);
|
|
|
}
|
|
|
|
|
|
-function demandDrawer(demand?: DemandSummary): BusinessDrawerState {
|
|
|
- if (!demand) {
|
|
|
- return {
|
|
|
- title: "原始需求",
|
|
|
- sections: [
|
|
|
- {
|
|
|
- label: "需求待确认",
|
|
|
- value: "当前运行没有写入原始需求单摘要。",
|
|
|
- tone: "warn"
|
|
|
- }
|
|
|
- ]
|
|
|
- };
|
|
|
- }
|
|
|
- const meta = [
|
|
|
+function demandMetaItems(demand?: DemandSummary): string[] {
|
|
|
+ if (!demand) return [];
|
|
|
+ return [
|
|
|
demand.id ? `需求单:${demand.id}` : "",
|
|
|
demand.source ? `来源:${demand.source}` : "",
|
|
|
demand.sourcePostId ? `来源帖子:${demand.sourcePostId}` : "",
|
|
|
demand.itemsetIds.length ? `itemset:${demand.itemsetIds.join(" / ")}` : "",
|
|
|
demand.support ? `支持度:${demand.support}` : ""
|
|
|
].filter(Boolean);
|
|
|
- return {
|
|
|
- title: `原始需求:${demand.name || demand.id || "待确认"}`,
|
|
|
- sections: [
|
|
|
- {
|
|
|
- label: "需求说明",
|
|
|
- value: demand.description || "暂无需求说明",
|
|
|
- tone: "info"
|
|
|
- },
|
|
|
- {
|
|
|
- label: "形成原因",
|
|
|
- value: demand.reason || "暂无形成原因",
|
|
|
- tone: "neutral"
|
|
|
- },
|
|
|
- {
|
|
|
- label: "来源信息",
|
|
|
- items: meta,
|
|
|
- tone: "neutral"
|
|
|
- },
|
|
|
- {
|
|
|
- label: "Pattern 词",
|
|
|
- value: demand.seedTerms.length ? demand.seedTerms.join("、") : "暂无 Pattern 词",
|
|
|
- tone: "good"
|
|
|
- },
|
|
|
- {
|
|
|
- label: "分类树路径",
|
|
|
- items: demand.categoryPaths.length ? demand.categoryPaths : ["暂无分类树路径"],
|
|
|
- tone: "neutral"
|
|
|
- }
|
|
|
- ]
|
|
|
- };
|
|
|
}
|
|
|
|
|
|
function HeaderSummaryChips({ rows, dataOriginLabel }: { rows: FlowLedgerRow[]; dataOriginLabel: string }) {
|