新增武传demo

This commit is contained in:
2026-10-18 21:20:33 +08:00
parent 32c16e86b0
commit 8f6904b2d1
25 changed files with 3693 additions and 2 deletions
@@ -0,0 +1,51 @@
# 重型装备内外套组件制造供货询价需求书
编号:RFQ-DEMO-2026-016 版本:A 日期:2026-10-16
**模拟客户需求,仅供DEMO。不是武汉武船实际订单;所有工程参数均为演示假设,不可据此生产。**
## 1. 项目与供需双方
采购方:华中装备工程有限公司(虚构)。拟询价承制方:武汉武船重型装备工程有限责任公司。
项目:重型装备伸缩支承内外套组件制造供货。数量:10套,每套内套1件、外套1件。交期:合同生效、预付款到账及技术资料确认后90日。
场景选择依据:客户提供的“213WS03-01(内套).pdf”“213WS03-02(外套).pdf”文件主题。由于本次无法取得可核对图像,未引用其具体尺寸、材质、公差、重量或实际用途。以下模拟结构和编号与原图区分。
## 2. 供货范围与边界
10套内外套组件(每套内套1件、外套1件),含采购、下料、成形、焊接、机加工、检测、防腐、包装运输及技术资料;不含主机、驱动装置及现场安装。
内部演示假设为焊接成形后机加工的套筒组件;原图可能采用不同结构或工艺,正式实施必须技术确认。
提供材料证明、关键尺寸检测记录、焊接与无损检测记录、出厂合格证及装箱清单。质量验收标准、焊缝等级、配合公差及表面防护要求由双方技术协议明确,不凭演示图替代。
## 3. 模拟图纸与参考物量
模拟内套图SIM-IS-01:筒体外径420mm,内径380mm,筒段长1200mm;法兰外径560mm、内径420mm、厚40mm;加强环外径480mm、内径420mm、厚30mm,每件内套2个。
模拟外套图SIM-OS-01:筒体外径540mm,内径500mm,筒段长1300mm;法兰外径680mm、内径540mm、厚50mm。
模拟钢材净重按圆环体积×密度7850kg/m³计算,每件重量四舍五入至0.01kg后乘10。加强环为每件2个。公式:π/4×(外径²−内径²)×长度×7.85×10⁻⁶(尺寸mm)。忽略孔槽及焊缝附加量,属于报价阶段几何估算;并非经原图确认的工程重量。
|参考物料号|物料|10套合计净用量|单位|来源|
|---|---|---:|---|---|
|M001|内套筒体 Q355B|2367.5|kg|SIM-IS-01 序1;236.75kg×10|
|M002|内套法兰 Q355B|338.4|kg|SIM-IS-01 序2;33.84kg×10|
|M003|内套加强环 Q355B|199.8|kg|SIM-IS-01 序3;19.98kg×10|
|M004|外套筒体 Q355B|3334.2|kg|SIM-OS-01 序1;333.42kg×10|
|M005|外套法兰 Q355B|526.5|kg|SIM-OS-01 序2;52.65kg×10|
|M006|导向衬套 铜合金|20|件|需求§3;2件×10|
|M007|密封组件|10|套|需求§3;1套×10|
|M008|配套紧固件|10|套|需求§3;1套×10|
说明:M001–M008为DEMO物料主数据映射编号,不能当作客户原图真实物料编码;外购物件规格为待澄清项。技术人员应确认实际ERP/PLM物料号。采购损耗由承制方另行核算,客户净用量不含损耗。
## 4. 图纸之外的补充需求
焊丝及焊剂由承制方承担,报价必须覆盖,不应因图纸BOM未列出而遗漏。演示参考用量160kg/项目,由技术人员人工补录并复核;不在自动解析的8项初始BOM中。
防腐材料及施工归入独立防腐费用,不重复加入物料表。密封与衬套的规格须在技术澄清环节确认。
## 5. 制造与检验要求
建议工艺路线:工艺深化→下料坡口→卷制组对→焊接→精加工→装配试配→检验→防腐包装。
焊接演示工作量480m,估算效率2m/工时;由生产部门复核,不能自动当作原图识别结果。其他工时由承制方工艺定额给出。
供应商到料不晚于第60天,预留后续制造与交付30天。任何技术或进度偏离应在报价前提出。
## 6. 报价响应与商务条款
请分别列示不含税单价、总价、税率、税额与含税总价,币种人民币。税率13%仅为DEMO参数,正式业务由财税确认。
预付款30%,工厂验收后发运前60%,到货验收后10%;质保12个月;报价有效期30天。
报价应说明供货边界、交期起算条件、技术偏离和价格有效期。未明确的技术条件应列入澄清表。
## 7. 内部演示数据的边界
本客户需求书不含供应商报价和企业利润底线。可上传JSON为了便于离线演示,额外包含内部参考单价、损耗与工艺估算,应作为演示种子包而非对外客户原始文件。
附件:模拟内套图.svg、模拟外套图.svg。图中模拟图号不得替代用户提供的原图号。
@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="1400" height="900" viewBox="0 0 1400 900"><defs><pattern id="h" width="9" height="9" patternUnits="userSpaceOnUse" patternTransform="rotate(45)"><line x1="0" y1="0" x2="0" y2="9" stroke="#777"/></pattern><marker id="a" markerWidth="8" markerHeight="8" refX="4" refY="4" orient="auto-start-reverse"><path d="M0,0 L8,4 L0,8" fill="none" stroke="#111"/></marker></defs><rect x="30" y="30" width="1340" height="840" fill="white" stroke="#222" stroke-width="2"/><g font-family="Microsoft YaHei,Arial" fill="#222"><text x="65" y="85" font-size="25">内套组件 — 模拟机械图(仅供报价DEMO)</text><text x="65" y="119" font-size="17" fill="#bd4444">非附件复刻 · 尺寸、材质及结构均为假设 · 禁止作为生产依据</text><g stroke="#222" stroke-width="2" fill="none"><rect x="140" y="260" width="600" height="210"/><rect x="140" y="260" width="600" height="32" fill="url(#h)"/><rect x="140" y="438" width="600" height="32" fill="url(#h)"/><rect x="160" y="205" width="35" height="320" fill="url(#h)"/><rect x="650" y="225" width="30" height="280" fill="url(#h)"/><circle cx="1030" cy="365" r="145"/><circle cx="1030" cy="365" r="112"/><circle cx="1030" cy="365" r="90"/><path d="M100 365h690M1030 185v360M850 365h360" stroke-dasharray="12 6 3 6" stroke="#777"/><path d="M140 490v90M740 490v90M140 565h600"/><path d="M790 260h45M790 470h45M820 260v210"/><path d="M140 565h600" marker-start="url(#a)" marker-end="url(#a)"/><path d="M820 260v210" marker-start="url(#a)" marker-end="url(#a)"/></g><text x="370" y="552" font-size="20">筒段长 1200</text><text x="835" y="340" font-size="18">Φ420</text><text x="930" y="550" font-size="18">内径 Φ380 / 法兰 Φ560</text><text x="220" y="190" font-size="18">② 法兰</text><text x="370" y="245" font-size="18">① 筒体(剖视示意)</text><text x="620" y="195" font-size="18">③ 加强环</text><text x="65" y="625" font-size="18">技术说明(模拟):1. 材料暂定Q355B;2. 先成形焊接后机加工;3. 配合、公差、焊缝等级待技术协议。</text><text x="65" y="663" font-size="18">净重按模拟圆环体积估算(见需求书);孔槽未扣除,BOM须技术审核,图纸未含焊材。</text><path d="M30 710h1340M800 710v160M1100 710v160M800 765h570M800 820h570" stroke="#222" fill="none"/><text x="65" y="755" font-size="20">武汉武船重型装备工程有限责任公司 · AI报价平台</text><text x="65" y="793" font-size="16">场景参考:用户提供内套 / 外套附件主题,未核实原图工程参数</text><text x="65" y="832" font-size="16">净重、数量和材料号见《客户需求书》 §3;本图单位 mm,不按比例。</text><text x="825" y="746" font-size="23">内套组件</text><text x="1120" y="746" font-size="20">SIM-IS-01</text><text x="825" y="800" font-size="18">版本:A / 模拟</text><text x="1120" y="800" font-size="18">数量:10件</text><text x="825" y="855" font-size="18">2026-10-16</text><text x="1120" y="855" font-size="18">非生产图纸</text></g></svg>

After

Width:  |  Height:  |  Size: 3.0 KiB

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="1400" height="900" viewBox="0 0 1400 900"><defs><pattern id="h" width="9" height="9" patternUnits="userSpaceOnUse" patternTransform="rotate(45)"><line x1="0" y1="0" x2="0" y2="9" stroke="#777"/></pattern><marker id="a" markerWidth="8" markerHeight="8" refX="4" refY="4" orient="auto-start-reverse"><path d="M0,0 L8,4 L0,8" fill="none" stroke="#111"/></marker></defs><rect x="30" y="30" width="1340" height="840" fill="white" stroke="#222" stroke-width="2"/><g font-family="Microsoft YaHei,Arial" fill="#222"><text x="65" y="85" font-size="25">外套组件 — 模拟机械图(仅供报价DEMO)</text><text x="65" y="119" font-size="17" fill="#bd4444">非附件复刻 · 尺寸、材质及结构均为假设 · 禁止作为生产依据</text><g stroke="#222" stroke-width="2" fill="none"><rect x="140" y="260" width="600" height="210"/><rect x="140" y="260" width="600" height="32" fill="url(#h)"/><rect x="140" y="438" width="600" height="32" fill="url(#h)"/><rect x="160" y="205" width="35" height="320" fill="url(#h)"/><rect x="650" y="225" width="30" height="280" fill="url(#h)"/><circle cx="1030" cy="365" r="145"/><circle cx="1030" cy="365" r="112"/><circle cx="1030" cy="365" r="90"/><path d="M100 365h690M1030 185v360M850 365h360" stroke-dasharray="12 6 3 6" stroke="#777"/><path d="M140 490v90M740 490v90M140 565h600"/><path d="M790 260h45M790 470h45M820 260v210"/><path d="M140 565h600" marker-start="url(#a)" marker-end="url(#a)"/><path d="M820 260v210" marker-start="url(#a)" marker-end="url(#a)"/></g><text x="370" y="552" font-size="20">筒段长 1300</text><text x="835" y="340" font-size="18">Φ540</text><text x="930" y="550" font-size="18">内径 Φ500 / 法兰 Φ680</text><text x="220" y="190" font-size="18">② 法兰</text><text x="370" y="245" font-size="18">① 筒体(剖视示意)</text><text x="620" y="195" font-size="18">③ 导向配合区</text><text x="65" y="625" font-size="18">技术说明(模拟):1. 材料暂定Q355B;2. 先成形焊接后机加工;3. 配合、公差、焊缝等级待技术协议。</text><text x="65" y="663" font-size="18">净重按模拟圆环体积估算(见需求书);孔槽未扣除,BOM须技术审核,图纸未含焊材。</text><path d="M30 710h1340M800 710v160M1100 710v160M800 765h570M800 820h570" stroke="#222" fill="none"/><text x="65" y="755" font-size="20">武汉武船重型装备工程有限责任公司 · AI报价平台</text><text x="65" y="793" font-size="16">场景参考:用户提供内套 / 外套附件主题,未核实原图工程参数</text><text x="65" y="832" font-size="16">净重、数量和材料号见《客户需求书》 §3;本图单位 mm,不按比例。</text><text x="825" y="746" font-size="23">外套组件</text><text x="1120" y="746" font-size="20">SIM-OS-01</text><text x="825" y="800" font-size="18">版本:A / 模拟</text><text x="1120" y="800" font-size="18">数量:10件</text><text x="825" y="855" font-size="18">2026-10-16</text><text x="1120" y="855" font-size="18">非生产图纸</text></g></svg>

After

Width:  |  Height:  |  Size: 3.0 KiB

+2
View File
@@ -17,6 +17,7 @@ import JieyaIbpApp from '@/modules/jieya-ibp/App';
import WelltrustQapApp from '@/modules/welltrust-qap/App'; import WelltrustQapApp from '@/modules/welltrust-qap/App';
import BaodeWebApp from '@/modules/baode-web/App'; import BaodeWebApp from '@/modules/baode-web/App';
import SupplierPlatformApp from '@/modules/supplier-platform/App'; import SupplierPlatformApp from '@/modules/supplier-platform/App';
import WucQuotationApp from '@/modules/wuc-quotation/App';
export default function App() { export default function App() {
return ( return (
@@ -37,6 +38,7 @@ export default function App() {
<Route path="/welltrust-qap" element={<RequireAuth><ModuleTitle title="品质异常预防工作台"><WelltrustQapApp /></ModuleTitle></RequireAuth>} /> <Route path="/welltrust-qap" element={<RequireAuth><ModuleTitle title="品质异常预防工作台"><WelltrustQapApp /></ModuleTitle></RequireAuth>} />
<Route path="/baode-web" element={<RequireAuth><ModuleTitle title="需求评审多智能体"><BaodeWebApp /></ModuleTitle></RequireAuth>} /> <Route path="/baode-web" element={<RequireAuth><ModuleTitle title="需求评审多智能体"><BaodeWebApp /></ModuleTitle></RequireAuth>} />
<Route path="/supplier-platform" element={<RequireAuth><ModuleTitle title="供应商智能管控平台"><SupplierPlatformApp /></ModuleTitle></RequireAuth>} /> <Route path="/supplier-platform" element={<RequireAuth><ModuleTitle title="供应商智能管控平台"><SupplierPlatformApp /></ModuleTitle></RequireAuth>} />
<Route path="/wuc-quotation" element={<RequireAuth><ModuleTitle title="武船AI智能报价平台"><WucQuotationApp /></ModuleTitle></RequireAuth>} />
</Routes> </Routes>
); );
} }
+2
View File
@@ -22,6 +22,7 @@ import { moduleConfig as jieyaIbpConfig } from './jieya-ibp';
import { moduleConfig as welltrustQapConfig } from './welltrust-qap'; import { moduleConfig as welltrustQapConfig } from './welltrust-qap';
import { moduleConfig as baodeWebConfig } from './baode-web'; import { moduleConfig as baodeWebConfig } from './baode-web';
import { moduleConfig as supplierPlatformConfig } from './supplier-platform'; import { moduleConfig as supplierPlatformConfig } from './supplier-platform';
import { moduleConfig as wucQuotationConfig } from './wuc-quotation';
// 新增模块只需在此数组添加一条配置即可 // 新增模块只需在此数组添加一条配置即可
export const modules: ModuleConfig[] = [ export const modules: ModuleConfig[] = [
@@ -36,4 +37,5 @@ export const modules: ModuleConfig[] = [
welltrustQapConfig, welltrustQapConfig,
baodeWebConfig, baodeWebConfig,
supplierPlatformConfig, supplierPlatformConfig,
wucQuotationConfig,
]; ];
+2 -1
View File
@@ -41,7 +41,8 @@
border:1px solid var(--blue);border-radius:20px;padding:2px 8px;margin-left:8px} border:1px solid var(--blue);border-radius:20px;padding:2px 8px;margin-left:8px}
.live i{width:6px;height:6px;border-radius:50%;background:var(--blue);animation:pulse 1.4s infinite} .live i{width:6px;height:6px;border-radius:50%;background:var(--blue);animation:pulse 1.4s infinite}
@keyframes pulse{0%,100%{opacity:1}50%{opacity:.25}} @keyframes pulse{0%,100%{opacity:1}50%{opacity:.25}}
#nav{display:flex;gap:6px;margin-left:14px;flex:1;justify-content:flex-end} /* 加 .hansong-app 前缀:#nav 会误命中 wuc-quotation 模块的 <nav id="nav">(ID 特异性高于类选择器) */
.hansong-app #nav{display:flex;gap:6px;margin-left:14px;flex:1;justify-content:flex-end}
.nav-btn{border:1px solid transparent;background:transparent;color:var(--sub);font-size:13px;font-weight:600; .nav-btn{border:1px solid transparent;background:transparent;color:var(--sub);font-size:13px;font-weight:600;
padding:7px 16px;border-radius:22px;cursor:pointer;transition:.2s;display:flex;align-items:center;gap:6px;white-space:nowrap} padding:7px 16px;border-radius:22px;cursor:pointer;transition:.2s;display:flex;align-items:center;gap:6px;white-space:nowrap}
.nav-btn:hover{color:var(--blue);background:var(--blue-bg)} .nav-btn:hover{color:var(--blue);background:var(--blue-bg)}
+206
View File
@@ -0,0 +1,206 @@
// 应用外壳:header + 左侧固定菜单 + 右侧内容区(内滚动)+ toast/弹窗
import { useEffect, useRef } from 'react'
// 沿用原离线版五段样式(001-005,已命名空间化到 .wuc-root),叠加 React 布局覆盖
import './styles/001.css'
import './styles/002.css'
import './styles/003.css'
import './styles/004.css'
import './styles/005.css'
import './app/react-layout.css'
import { useApp, AppProvider } from './app/store'
import type { Flows } from './app/store'
import { VIEWS } from './app/views'
import { ModalHost } from './app/modals'
import { BRAND_LOGO } from './app/logo'
import { NAV_ICONS, TITLES } from './app/data'
import type { State } from './app/types'
// 原 workflowStepStates:rail 六步状态(纯函数,archived 由调用方计算)
function stepStates(s: State, flows: Flows, archived: boolean) {
return [
{
done: !!s.parsed && !!s.clarified,
running: !!flows.aiRun.running,
hint: s.parsed ? (s.clarified ? '已确认' : '待人工确认') : '待解析',
},
{
done: !!s.tech,
running: !!flows.kb.running,
hint: flows.kb.running ? '清单分析中' : s.tech ? '技术已确认' : '待技术确认',
},
{
done: !!s.review,
running: !!flows.aiInquiry.running || !!flows.productionAI.running,
hint: s.review
? '经营已确认'
: s.supply && s.production
? '待经营确认'
: s.supply
? '待生产提交'
: s.production
? '待物供提交'
: '待部门核价',
},
{ done: !!s.report, running: false, hint: s.report ? '报告已生成' : '待生成报告' },
{ done: !!s.approved, running: !!flows.strategyRun.running, hint: s.approved ? '策略已批准' : '待策略审批' },
{ done: archived, running: false, hint: archived ? '报价已入库' : s.approved ? '可输出 / 待入库' : '待生成报价' },
]
}
function AppShell() {
const ctx = useApp()
const { s, flows, go, toastMsg, openModal, startKnowledge, exportState, resetAll, quotationIsArchived } = ctx
// 模块根容器:主题(dark)与侧栏折叠(collapsed)状态挂在根容器而非 document.body,
// 避免污染平台全局 body(原离线版直接 toggle body class)
const rootRef = useRef<HTMLDivElement>(null)
const toggleRootClass = (cls: string) => rootRef.current?.classList.toggle(cls)
// just-completed 高亮:对比上一轮 done 状态
const prevDoneRef = useRef<boolean[] | null>(null)
const states = stepStates(s, flows, s.approved && quotationIsArchived())
const changed = (i: number) => !!prevDoneRef.current && states[i].done && !prevDoneRef.current[i]
useEffect(() => {
prevDoneRef.current = states.map((x) => x.done)
})
const View = VIEWS[s.page]
// 流程轨道仅项目工作台隐藏;物量清单页与"AI分析"按钮一起出现
const railHidden = s.page === 0
return (
<div className="wuc-root" ref={rootRef}>
<header>
<div className="brand company-brand">
<img
className="company-logo"
src={BRAND_LOGO}
alt="CSSC 武昌船舶重工集团有限公司 / WUCHANG SHIPBUILDING INDUSTRY GROUP CO., LTD."
/>
</div>
<div className="head-name">
<b>AI智能报价平台</b>
</div>
<button type="button" style={{ marginLeft: 'auto' }} onClick={() => openModal('guide', '操作指南')}>
操作指南
</button>
<button type="button" onClick={() => toggleRootClass('dark')}>
◐ 主题
</button>
</header>
<div className="app-shell">
<aside>
<div className="side-label">
QUOTE WORKSPACE{' '}
<button type="button" onClick={() => toggleRootClass('collapsed')}>
☰
</button>
</div>
<nav id="nav">
{TITLES.map((t, i) => (
<button key={t} type="button" className={s.page === i ? 'active' : ''} onClick={() => go(i)}>
<span>{NAV_ICONS[i]}</span>
{t}
</button>
))}
</nav>
<div className="side-bottom">
<button type="button" onClick={exportState}>
↓ 导出项目备份
</button>
<button type="button" onClick={resetAll}>
↺ 重置本次演示
</button>
</div>
</aside>
<main>
<div className="workspace-banner">
<div id="titlebar">
<div>
<div className="title-line">
<h1>{TITLES[s.page]}</h1>
{s.page === 2 && (
<button
type="button"
className={'primary btn-sm' + (flows.kb.shown ? ' list-analysis-clicked' : '')}
disabled={!s.parsed || flows.kb.running}
onClick={startKnowledge}
>
AI物量与资源清单分析
</button>
)}
</div>
<div className="subtitle">
{s.project.code} · 成本版本 V{s.revision} ·{' '}
{s.approved ? '策略已审批' : s.review ? '经营已确认' : '编制中'}
</div>
</div>
<div className="actions">
<span className="badge">{s.approved ? '已批准' : s.parsed ? '需求已解析' : '待解析'}</span>
</div>
</div>
{!railHidden && (
<div className="rail" role="navigation" aria-label="报价业务流程">
<ol className="workflow-progress">
{states.map((step, i) => (
<li
key={TITLES[i + 1]}
className={
'workflow-progress-item ' +
(step.done ? 'is-complete ' : '') +
(s.page === i + 1 ? 'is-current ' : '') +
(step.running ? 'is-running ' : '') +
(changed(i) ? 'just-completed' : '')
}
>
<button
type="button"
className="workflow-progress-button"
onClick={() => go(i + 1)}
aria-current={s.page === i + 1 ? 'step' : undefined}
aria-label={TITLES[i + 1] + ',' + step.hint}
title={step.hint}
>
<span className="workflow-step-circle" aria-hidden="true">
{step.done ? '✓' : i + 1}
</span>
<span className="workflow-step-name">{TITLES[i + 1]}</span>
<span className="workflow-step-state">{step.hint}</span>
</button>
{i < 5 && (
<span className="workflow-connector" aria-hidden="true">
<i></i>
</span>
)}
</li>
))}
</ol>
</div>
)}
</div>
<div id="content" data-view={s.page}>
<View />
</div>
</main>
</div>
{toastMsg ? (
<div id="toast" className="is-visible">
{toastMsg}
</div>
) : null}
<ModalHost />
</div>
)
}
// 平台路由直接渲染本模块,AppProvider 职责由原独立入口 main.tsx 移至此处
export default function App() {
return (
<AppProvider>
<AppShell />
</AppProvider>
)
}
@@ -0,0 +1,77 @@
// 共享 UI 原语(对应原 btn/notice/table/metric/audit 模板助手)
import React from 'react'
import { useApp } from './store'
export function Btn({ t, onClick, disabled = false, cls = '' }: { t: React.ReactNode; onClick?: () => void; disabled?: boolean; cls?: string }) {
return (
<button className={cls} disabled={disabled || undefined} onClick={onClick}>
{t}
</button>
)
}
export function Notice({ t, cls = '' }: { t: React.ReactNode; cls?: string }) {
return <div className={'notice ' + cls}>{t}</div>
}
export function Table({ head, rows }: { head: React.ReactNode[]; rows: React.ReactNode[][] }) {
return (
<div className="table-scroll">
<table>
<thead>
<tr>{head.map((x, i) => <th key={i}>{x}</th>)}</tr>
</thead>
<tbody>
{rows.map((r, i) => <tr key={i}>{r.map((x, j) => <td key={j}>{x}</td>)}</tr>)}
</tbody>
</table>
</div>
)
}
export function Metric({ label, value, unit = '' }: { label: string; value: React.ReactNode; unit?: string }) {
return (
<div className="metric">
<div>
<label>{label}</label>
<div><strong>{value}</strong><small>{unit}</small></div>
</div>
</div>
)
}
export function NumInput({ v, onCommit, wide = false, min = 0, disabled = false, placeholder, ariaLabel }: {
v: React.ReactNode; onCommit: (v: string) => void; wide?: boolean; min?: number
disabled?: boolean; placeholder?: string; ariaLabel?: string
}) {
return (
<input
className={wide ? 'wide' : undefined}
type="number"
min={min}
step="0.01"
defaultValue={v as any}
key={String(v) + '-' + String(ariaLabel)}
disabled={disabled || undefined}
placeholder={placeholder}
aria-label={ariaLabel}
onChange={(e) => onCommit(e.target.value)}
/>
)
}
export function Audit() {
const { s } = useApp()
return (
<div className="audit">
{s.log.slice(0, 30).map((l, i) => (
<div className="log" key={i}>
<small>{l.time}</small>
<b>版本 V{l.rev}</b>
<span>{l.text}</span>
</div>
)) || <p>尚无操作记录,开始上传或载入需求。</p>}
{!s.log.length && <p>尚无操作记录,开始上传或载入需求。</p>}
</div>
)
}
+137
View File
@@ -0,0 +1,137 @@
// 内置样例数据 / 模拟供应商 / 历史案例(对应原 001-sample-data.js 与 HISTORY_CASES)
import type { HistoryCase, Material, Project, Resource } from './types'
export const SAMPLE: Project & { missing: Material } = {
schema: 'wuchuan-quote-v1',
project: '重型装备伸缩支承内外套组件制造供货',
customer: '华中装备工程有限公司(虚构)',
code: 'RFQ-DEMO-2026-016',
delivery: 90,
sets: 10,
scope: '10套内外套组件(每套内套1件、外套1件),含采购、下料、成形、焊接、机加工、检测、防腐、包装运输及技术资料;不含主机、驱动装置及现场安装。',
terms: '预付款30%,工厂验收后发运前60%,到货验收后10%;质保12个月;报价有效期30天。',
materials: [
{ id: 'M001', name: '内套筒体 Q355B', unit: 'kg', qty: 2367.5, price: 5.2, ref: 'SIM-IS-01 序1;236.75kg×10', confidence: 96 },
{ id: 'M002', name: '内套法兰 Q355B', unit: 'kg', qty: 338.4, price: 5.4, ref: 'SIM-IS-01 序2;33.84kg×10', confidence: 93 },
{ id: 'M003', name: '内套加强环 Q355B', unit: 'kg', qty: 199.8, price: 5.3, ref: 'SIM-IS-01 序3;19.98kg×10', confidence: 91 },
{ id: 'M004', name: '外套筒体 Q355B', unit: 'kg', qty: 3334.2, price: 5.2, ref: 'SIM-OS-01 序1;333.42kg×10', confidence: 96 },
{ id: 'M005', name: '外套法兰 Q355B', unit: 'kg', qty: 526.5, price: 5.4, ref: 'SIM-OS-01 序2;52.65kg×10', confidence: 93 },
{ id: 'M006', name: '导向衬套 铜合金', unit: '件', qty: 20, price: 850, ref: '需求§3;2件×10', confidence: 85 },
{ id: 'M007', name: '密封组件', unit: '套', qty: 10, price: 420, ref: '需求§3;1套×10', confidence: 84 },
{ id: 'M008', name: '配套紧固件', unit: '套', qty: 10, price: 180, ref: '需求§3;1套×10', confidence: 88 },
],
resources: [
{ id: 'R01', name: '工艺深化', qty: 40, rate: 120, ref: '内部工艺 P01', note: '技术部门估算' },
{ id: 'R02', name: '下料与坡口', qty: 60, rate: 95, ref: '内部工艺 P02', note: '含人工、设备、能耗' },
{ id: 'R03', name: '卷制与组对', qty: 100, rate: 85, ref: '内部工艺 P03', note: '含人工、设备、能耗' },
{ id: 'R04', name: '焊接', qty: 240, rate: 110, ref: '模拟焊缝480m ÷ 2m/工时', note: '不含焊材;另列BOM' },
{ id: 'R05', name: '精加工', qty: 180, rate: 150, ref: '内外圆、端面与孔加工', note: '含人工、设备、能耗' },
{ id: 'R06', name: '装配与试配', qty: 60, rate: 100, ref: '内部工艺 P06', note: '含人工、设备、能耗' },
],
missing: { id: 'M009', name: '焊丝与焊剂配套', unit: 'kg', qty: 160, price: 8.5, ref: '需求§4文字补充;技术人工确认', confidence: 60 },
assumptions: '全部数量为10套项目合计。仅参考附件内套/外套主题,未核实附件尺寸材质。SIM图、重量、价格、工时均为演示假设;非生产依据。',
}
export const TITLES = ['项目工作台', '需求与图纸解析', '物量与资源清单', '跨部门询价与审核', '全成本测算报告', 'AI报价策略', '正式报价单']
export const NAV_ICONS = ['◈', '▤', '▦', '⇄', '▥', '✦', '▧']
export const offers = (m: Material, project: Project) => {
const base = project.materials.find((x) => x.id === m.id)?.price ?? m.price
return [
{ name: '华中材料供应商(模拟)', price: base, days: 30, quality: '材质证明齐全', index: 0 },
{ name: '长江配套供应商(模拟)', price: +(base * 0.94).toFixed(2), days: 105, quality: '低价,但超期', index: 1 },
{ name: '江城优选供应商(模拟)', price: +(base * 1.06).toFixed(2), days: 20, quality: '交期更短', index: 2 },
]
}
export const kbRecords = {
material: [...SAMPLE.materials, SAMPLE.missing] as Material[],
resource: SAMPLE.resources as Resource[],
}
export const HISTORY_CASES: Record<string, HistoryCase> = {
H01: {
name: '相似内外套组件制造项目',
customer: '华中重装设备有限公司(虚拟)',
code: 'H01-DEMO',
date: '2025-09(模拟)',
sets: 8,
days: 100,
price: 180000,
margin: 18,
costs: [
['物料', 60000],
['制造资源', 64000],
['专项直接费', 12000],
['间接费', 7600],
['风险准备', 4000],
],
scope: '8套内外套组件,含筒体、法兰、加强环、衬套、密封及紧固件;含制造、检测、防腐、包装运输及现场技术服务,不含主机与现场安装。',
materials: [
['内外套筒体', 'Q355B', '8套配套', '模拟图纸物料表'],
['法兰 / 加强环', 'Q355B', '8套配套', '模拟组件明细'],
['导向衬套 / 密封', '铜合金 / 密封组合', '8套配套', '模拟采购技术条款'],
['紧固件 / 焊材', '按工艺配套', '项目合计', '模拟工艺补充清单'],
],
process: [
['工艺深化', 32, 120],
['下料与坡口', 48, 95],
['卷制与组对', 80, 85],
['焊接', 192, 110],
['精加工', 144, 150],
['装配与试配', 48, 100],
['专项工装与过程协调', 16, 80],
],
milestones: [
['技术资料确认', '第1–10天'],
['采购与下料', '第11–35天'],
['组焊及机加工', '第36–80天'],
['检验、试配与交付', '第81–100天'],
],
terms: '模拟付款:30%预付、60%交付、10%质保;报价有效期30天;质保期12个月;运输与验收边界按技术协议。',
quality: '材料证明、焊接过程记录、尺寸检验报告及试配记录齐套;模拟案例设定为按100天计划交付。',
reason: '同类内外套组件结构与制造路径可参考;8套项目的单位成本受批量和固定工装分摊影响。18%为模拟成交利润率,不能直接套用本项目。',
risk: '焊接变形、精加工余量与外购件到货是主要风险;实际尺寸、净重、检验要求与价格需重新核定。',
},
H02: {
name: '高精度导向套制造项目',
customer: '长江精密装备有限公司(虚拟)',
code: 'H02-DEMO',
date: '2025-12(模拟)',
sets: 12,
days: 90,
price: 240000,
margin: 22,
costs: [
['物料', 72000],
['制造资源', 88000],
['专项直接费', 14000],
['间接费', 8200],
['风险准备', 5000],
],
scope: '12套高精度导向套及配套件,含采购、下料、热处理协同、精密加工、检测、装配及包装运输;不含主机及现场安装。',
materials: [
['导向套毛坯', '合金钢(模拟规格)', '12套', '模拟毛坯清单'],
['配合衬套', '铜合金(模拟规格)', '12套配套', '模拟装配明细'],
['密封 / 紧固件', '按配套清单', '12套配套', '模拟采购技术条款'],
],
process: [
['工艺与检验策划', 40, 120],
['毛坯下料及预加工', 80, 100],
['热处理协同及复检', 40, 120],
['精密车削', 200, 160],
['内孔精加工', 160, 180],
['装配检测', 80, 120],
],
milestones: [
['技术与精度要求确认', '第1–10天'],
['毛坯采购与预加工', '第11–30天'],
['精密加工及过程复检', '第31–70天'],
['装配验收与交付', '第71–90天'],
],
terms: '模拟付款:30%预付、60%交付、10%质保;报价有效期30天;质保期12个月;关键配合尺寸需双方确认。',
quality: '重点控制配合精度、圆度、同轴度和表面质量;数值公差以项目技术文件为准;模拟案例设定为按90天计划交付。',
reason: '精密加工与过程追溯工作量高,22%模拟利润率反映质量风险与服务投入。该项目结构与当前组件不同,仅用于比较加工强度及商业定位。',
risk: '毛坯稳定性、热处理变形、刀具消耗及重复检测影响工时;特殊精度与验收标准需要单独确认。',
},
}
File diff suppressed because one or more lines are too long
+436
View File
@@ -0,0 +1,436 @@
// 确定性业务计算(对应原 calc/baseStrategies/competitorReference/strategies/issues 等)
import { HISTORY_CASES, offers } from './data'
import type { AnalysisCard, CompetitorQuote, State, StrategyCard } from './types'
import { REPORT_LOGO } from './reportLogo'
export const money = (n: number) =>
Number(n).toLocaleString('zh-CN', { minimumFractionDigits: 2, maximumFractionDigits: 2 })
export const num = (v: unknown, zero = false): number | null => {
const n = Number(v)
return Number.isFinite(n) && (zero ? n >= 0 : n > 0) && n < 1e9 ? n : null
}
export function fresh(): State {
return {
version: 1,
page: 0,
project: JSON.parse(JSON.stringify({
schema: 'wuchuan-quote-v1',
project: '重型装备伸缩支承内外套组件制造供货',
customer: '华中装备工程有限公司(虚构)',
code: 'RFQ-DEMO-2026-016',
delivery: 90,
sets: 10,
scope: '10套内外套组件(每套内套1件、外套1件),含采购、下料、成形、焊接、机加工、检测、防腐、包装运输及技术资料;不含主机、驱动装置及现场安装。',
terms: '预付款30%,工厂验收后发运前60%,到货验收后10%;质保12个月;报价有效期30天。',
materials: [
{ id: 'M001', name: '内套筒体 Q355B', unit: 'kg', qty: 2367.5, price: 5.2, ref: 'SIM-IS-01 序1;236.75kg×10', confidence: 96 },
{ id: 'M002', name: '内套法兰 Q355B', unit: 'kg', qty: 338.4, price: 5.4, ref: 'SIM-IS-01 序2;33.84kg×10', confidence: 93 },
{ id: 'M003', name: '内套加强环 Q355B', unit: 'kg', qty: 199.8, price: 5.3, ref: 'SIM-IS-01 序3;19.98kg×10', confidence: 91 },
{ id: 'M004', name: '外套筒体 Q355B', unit: 'kg', qty: 3334.2, price: 5.2, ref: 'SIM-OS-01 序1;333.42kg×10', confidence: 96 },
{ id: 'M005', name: '外套法兰 Q355B', unit: 'kg', qty: 526.5, price: 5.4, ref: 'SIM-OS-01 序2;52.65kg×10', confidence: 93 },
{ id: 'M006', name: '导向衬套 铜合金', unit: '件', qty: 20, price: 850, ref: '需求§3;2件×10', confidence: 85 },
{ id: 'M007', name: '密封组件', unit: '套', qty: 10, price: 420, ref: '需求§3;1套×10', confidence: 84 },
{ id: 'M008', name: '配套紧固件', unit: '套', qty: 10, price: 180, ref: '需求§3;1套×10', confidence: 88 },
],
resources: [
{ id: 'R01', name: '工艺深化', qty: 40, rate: 120, ref: '内部工艺 P01', note: '技术部门估算' },
{ id: 'R02', name: '下料与坡口', qty: 60, rate: 95, ref: '内部工艺 P02', note: '含人工、设备、能耗' },
{ id: 'R03', name: '卷制与组对', qty: 100, rate: 85, ref: '内部工艺 P03', note: '含人工、设备、能耗' },
{ id: 'R04', name: '焊接', qty: 240, rate: 110, ref: '模拟焊缝480m ÷ 2m/工时', note: '不含焊材;另列BOM' },
{ id: 'R05', name: '精加工', qty: 180, rate: 150, ref: '内外圆、端面与孔加工', note: '含人工、设备、能耗' },
{ id: 'R06', name: '装配与试配', qty: 60, rate: 100, ref: '内部工艺 P06', note: '含人工、设备、能耗' },
],
missing: { id: 'M009', name: '焊丝与焊剂配套', unit: 'kg', qty: 160, price: 8.5, ref: '需求§4文字补充;技术人工确认', confidence: 60 },
assumptions: '全部数量为10套项目合计。仅参考附件内套/外套主题,未核实附件尺寸材质。SIM图、重量、价格、工时均为演示假设;非生产依据。',
})),
materials: [],
resources: [],
parsed: false,
tech: false,
supply: false,
production: false,
review: false,
report: false,
approved: false,
selected: 1,
revision: 1,
floor: 15,
targets: [15, 20, 25],
other: { 检测: 6000, 防腐: 8000, 包装运输: 5000, 现场技术服务: 3000 },
overhead: 6,
risk: 3,
tax: 13,
context: '客户重视精加工质量与交付稳定性,建议采用平衡方案。',
quotes: {},
log: [],
files: [],
fileText: '',
clarified: false,
}
}
export function calc(s: State) {
const material = s.materials.reduce((a, m) => a + m.qty * m.price, 0)
const process = s.resources.reduce((a, r) => a + r.qty * (r.rate || 0), 0)
const other = Object.values(s.other).reduce((a, b) => a + b, 0)
const direct = material + process + other
const overhead = (direct * s.overhead) / 100
const risk = ((direct + overhead) * s.risk) / 100
return { material, process, other, direct, overhead, risk, total: direct + overhead + risk }
}
export function baseStrategies(s: State): StrategyCard[] {
const c = calc(s)
return s.targets.map((g, i) => {
const price = Math.ceil(c.total / (1 - g / 100) / 100) * 100
return {
label: ['A · 竞争优先', 'B · 综合平衡', 'C · 价值保障'][i],
g,
price,
profit: price - c.total,
margin: ((price - c.total) / price) * 100,
valid: g >= s.floor,
days: s.project.delivery,
reason: [
'以最低合规利润争取订单;价格让利,不削减技术范围。',
'覆盖质量与交付风险,兼顾客户接受度和利润空间。',
'以加工精度、过程追溯和服务价值支撑溢价;服务范围不变。',
][i],
}
})
}
export function competitorQuote(s: State): CompetitorQuote {
return (
s.competitorQuote ?? {
name: '',
price: NaN,
taxMode: 'exclusive',
taxRate: s.tax,
sets: s.project.sets,
days: s.project.delivery,
position: 'balanced',
comparable: false,
source: '',
}
)
}
export function competitorReference(
s: State,
): { used: false; status: string } | { used: true; price: number; q: CompetitorQuote; status: string } {
const q = competitorQuote(s)
if (!(Number.isFinite(q.price) && q.price > 0))
return { used: false, status: '尚未录入友商报价,沿用利润目标生成方案。' }
if (!q.comparable)
return { used: false, status: '友商供货范围尚未确认,仅展示信息,不用于调价。' }
if (q.sets !== s.project.sets || q.days !== s.project.delivery)
return { used: false, status: '友商数量或交期与当前项目不一致,仅供参考,不直接参与同口径定价。' }
const price = q.taxMode === 'inclusive' ? q.price / (1 + q.taxRate / 100) : q.price
if (!Number.isFinite(price) || price <= 0)
return { used: false, status: '友商报价口径无效,请复核。' }
return {
used: true,
price: Math.round(price * 100) / 100,
q,
status: '已按同范围、' + q.sets + '套、' + q.days + '天比较;友商不含税总价 ' + money(price) + ' 元。',
}
}
export function strategies(s: State): StrategyCard[] {
const base = baseStrategies(s)
const ref = competitorReference(s)
if (!ref.used)
return base.map((x) => ({ ...x, reason: x.reason + (competitorQuote(s).price ? ' ' + ref.status : '') }))
const cost = calc(s).total
const floorPrice = Math.ceil(cost / (1 - s.floor / 100) / 100) * 100
const factors =
({ low: [0.995, 1.025, 1.08], balanced: [0.99, 1, 1.06], quality: [0.98, 0.99, 1.03] } as Record<string, number[]>)[
ref.q.position
] || [0.99, 1, 1.06]
const comp = ref.price
const baseline = base.map((x) => x.price)
const raw = [
Math.min(baseline[0], comp * factors[0]),
(baseline[1] + comp * factors[1]) / 2,
Math.max(baseline[2], comp * factors[2]),
]
const prices = raw.map((n) => Math.max(floorPrice, Math.ceil((n - 1e-7) / 100) * 100))
prices[1] = Math.max(prices[0], prices[1])
prices[2] = Math.max(prices[1], prices[2])
const labels: Record<string, string> = { low: '低价竞争', balanced: '综合平衡', quality: '质量与服务溢价' }
const below = comp < floorPrice
return base.map((x, i) => {
const price = prices[i]
const margin = price ? ((price - cost) / price) * 100 : 0
const gap = price - comp
const rule = [
'取利润目标基准价与友商参考价×' + factors[0] + '中较低值,再受利润底价约束。',
'将利润目标基准价与友商参考价×' + factors[1] + '取均值,再受利润底价约束。',
'取利润目标基准价与友商参考价×' + factors[2] + '中较高值,再受利润底价约束。',
][i]
return {
...x,
price,
profit: price - cost,
margin,
valid: x.g >= s.floor && margin + 1e-8 >= s.floor,
competition: { reference: comp, gap, floorPrice },
reason:
x.reason +
' 综合判定:目标利润率 ' +
x.g +
'%,利润底线 ' +
s.floor +
'%,底价 ' +
money(floorPrice) +
' 元;' +
(ref.q.name || '友商') +
'定位为“' +
labels[ref.q.position] +
'”,同口径不含税报价 ' +
money(comp) +
' 元。' +
rule +
' 本方案较友商' +
(gap >= 0 ? '高 ' : '低 ') +
money(Math.abs(gap)) +
' 元。' +
(below ? '友商报价低于本项目利润底价,不跟随至底线以下。' : '') +
'以上为离线规则推演,需经营复核。',
}
})
}
export function issues(s: State) {
const a: string[] = []
if (!s.tech) a.push('技术清单未确认')
if (!s.materials.some((m) => m.id === 'M009')) a.push('遗漏:焊材未计入')
if (!s.materials.every((m) => s.quotes[m.id])) a.push('存在未选择供应商的物料')
if (s.materials.some((m) => s.quotes[m.id]?.days > s.project.delivery - 30))
a.push('采购交期超过最迟到料时间(总交期减制造预留30天)')
if (!s.supply) a.push('物供部门未提交')
if (!s.production) a.push('生产部门未提交')
return a
}
export function reportText(s: State) {
const c = calc(s)
const bom = s.materials.map((m) => `${m.id} ${m.name}:${m.qty} ${m.unit} × ${m.price}元;来源 ${m.ref}`).join('\n')
const proc = s.resources.map((r) => `${r.name}:${r.qty}h × ${r.rate}元/h`).join('\n')
return (
`<p align="center"><img src="${REPORT_LOGO}" height="auto" /></p>\n\n` +
`# 内外套组件项目成本测算报告\n\n项目:${s.project.project}\n成本版本:V${s.revision}\n数据性质:模拟,不作为正式报价或生产依据。\n\n` +
`|成本项|金额(人民币元,不含税)|\n|---|---:|\n|物料|${money(c.material)}|\n|制造资源|${money(c.process)}|\n|专项直接费|${money(c.other)}|\n|间接费|${money(c.overhead)}|\n|风险准备|${money(c.risk)}|\n|全成本|${money(c.total)}|\n\n` +
`数量${s.project.sets}套,单位成本${money(c.total / s.project.sets)}元。\n最低项目利润率${s.floor}%,底价=C/(1-r)=${money(c.total / (1 - s.floor / 100))}元。\n` +
`计算采用未四舍五入值,展示保留两位;报价向上取整到百元。\n风险:工程参数为模拟值,需复核原图、外购规格、工艺与价格有效期。\n\n## BOM\n` +
bom +
`\n\n## 工序\n` +
proc
)
}
export function quotationSignature(s: State) {
const a = strategies(s)[s.selected]
return JSON.stringify([
s.project, s.revision, s.selected, s.approvedAt, a.price, s.tax, s.materials, s.resources,
s.other, s.overhead, s.risk, s.floor, s.targets, s.context, ...(s.competitorQuote ? [s.competitorQuote] : []),
])
}
export const esc = (x: unknown) =>
String(x ?? '').replace(/[&<>"']/g, (c) => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;' }[c] as string))
export const htmlTable = (head: (string | number)[], rows: (string | number)[][]) =>
'<div class="table-scroll"><table><thead><tr>' + head.map((x) => `<th>${x}</th>`).join('') +
'</tr></thead><tbody>' + rows.map((r) => '<tr>' + r.map((x) => `<td>${x}</td>`).join('') + '</tr>').join('') + '</tbody></table></div>'
export function quoteHTML(s: State) {
const a = strategies(s)[s.selected]
const tax = +(a.price * s.tax / 100).toFixed(2)
return `<div class="quote-paper"><div class="quote-brand">武汉武船重型装备工程有限责任公司</div><h1>项目报价单</h1><p class="right">编号:QT-DEMO-2026-016-V${s.revision}<br>日期:${new Date().toLocaleDateString('zh-CN')}</p><p><b>致:${esc(s.project.customer)}</b></p><p>感谢贵司询价,现就“${esc(s.project.project)}”提交如下报价:</p>${htmlTable(['货物名称', '数量', '单位', '不含税单价(元)', '不含税金额(元)'], [['内外套组件制造供货', s.project.sets, '套', money(a.price / s.project.sets), money(a.price)]])}<p class="right">不含税总额:¥ ${money(a.price)}<br>税额(演示税率${s.tax}%):¥ ${money(tax)}<br><b>含税总额:人民币 ¥ ${money(a.price + tax)}</b></p><h3>供货范围</h3><p>${esc(s.project.scope)}</p><h3>交付及商务条件</h3><p>合同生效、预付款到账及技术资料确认后 ${s.project.delivery} 天交付。<br>${esc(s.project.terms)}</p><h3>技术依据与变更</h3><p>模拟需求RFQ-DEMO-2026-016及模拟图SIM-IS-01、SIM-OS-01。技术要求或供货范围发生变更时,需双方书面确认价格及交期调整。</p><p>报价联系人:项目经营部(待填写)<br>联系电话:待填写<br>授权签章:________________</p><p style="font-size:11px;border-top:1px solid #ddd;padding-top:15px">演示报价样张:项目、工程参数和价格为模拟数据,未经真实授权签章不得用于商务承诺。模板不包含内部成本、利润及供应商报价。</p></div>`
}
// ===== 报价智能体:自然语言检索与归因分析 =====
export function quotationHistoryRows(s: State, library: any[]) {
return allHistoryRows(s, library)
}
export function baseFilteredQuotationRows(s: State, library: any[], f: Record<string, string>) {
if (f.from && f.to && f.from > f.to) return []
return allHistoryRows(s, library).filter(
(r: any) =>
(!f.project || String(r.project).toLowerCase().includes(f.project.toLowerCase())) &&
(!f.customer || String(r.customer).toLowerCase().includes(f.customer.toLowerCase())) &&
(!f.number || String(r.number).toLowerCase().includes(f.number.toLowerCase())) &&
(!f.from || r.date >= f.from) &&
(!f.to || r.date <= f.to),
)
}
export function allHistoryRows(s: State, library: any[]) {
void s
return [
...library.map((r: any) => ({ ...r, kind: 'saved' })),
...Object.entries(HISTORY_CASES).map(([id, c]) => ({
id,
number: c.code,
project: c.name,
customer: c.customer,
date: c.date.startsWith('2025-09') ? '2025-09-01' : '2025-12-01',
sets: c.sets,
days: c.days,
price: c.price,
total: c.price * 1.13,
kind: 'example',
})),
]
}
export function findNaturalQuotation(s: State, library: any[], text: string) {
let rows: any[] = baseFilteredQuotationRows(s, library, { project: '', customer: '', number: '', from: '', to: '' })
const terms: string[] = []
const constraints: string[] = []
const numMatch = text.match(/(?:QT-[A-Z0-9-]+|H0[12](?:-DEMO)?|V\d+)/i)
if (numMatch) {
const value = numMatch[0].toLowerCase()
rows = rows.filter((r) => (r.number + ' ' + r.id).toLowerCase().includes(value))
constraints.push('编号 ' + numMatch[0])
}
const dates = [...text.matchAll(/(20\d{2})[-/年](\d{1,2})[-/月](\d{1,2})日?/g)].map(
(m) => m[1] + '-' + m[2].padStart(2, '0') + '-' + m[3].padStart(2, '0'),
)
if (dates.length >= 2) {
rows = rows.filter((r) => r.date >= dates[0] && r.date <= dates[1])
constraints.push(dates[0] + ' 至 ' + dates[1])
} else {
const year = text.match(/(20\d{2})年/)
if (year) {
rows = rows.filter((r) => r.date.startsWith(year[1]))
constraints.push('年份 ' + year[1])
}
}
const keys = ['内外套', '导向套', '筒体', '法兰', '精密', '高精度', '华中', '长江', '重型', '重装']
for (const k of keys) if (text.includes(k)) terms.push(k)
if (terms.length) {
rows = rows.filter((r) => {
const hay = r.project + ' ' + r.customer
return /或|任一/.test(text) ? terms.some((k) => hay.includes(k)) : terms.every((k) => hay.includes(k))
})
constraints.push('关键词 ' + terms.join('、'))
}
const amount = text.match(/(?:报价|金额|总价|不含税)[^\d]{0,8}(\d+(?:\.\d+)?)\s*(万)?(?:元)?\s*(以下|以内|低于|不超过|以上|高于|超过)/)
if (amount) {
const limit = Number(amount[1]) * (amount[2] ? 10000 : 1)
const above = /以上|高于|超过/.test(amount[3])
rows = rows.filter((r) => (above ? r.price >= limit : r.price <= limit))
constraints.push('不含税金额 ' + (above ? '≥' : '≤') + money(limit) + '元')
}
const days = text.match(/(?:交期|交付)[^\d]{0,5}(\d+)\s*天\s*(以内|以下|不超过|以上|超过)?/)
if (days) {
const d = Number(days[1])
const above = /以上|超过/.test(days[2] || '')
rows = rows.filter((r) => (above ? r.days >= d : r.days <= d))
constraints.push('交期 ' + (above ? '≥' : '≤') + d + '天')
}
const quoted = text.match(/[“「"]([^”」"]{2,60})[”」"]/)
if (quoted) {
rows = rows.filter((r) => (r.project + ' ' + r.customer + ' ' + r.number).includes(quoted[1]))
constraints.push('精确关键词 ' + quoted[1])
}
if (!constraints.length && !/全部|所有|查看项目|有哪些|历史报价|项目列表|报价列表/.test(text)) {
rows = []
constraints.push('未提取到支持的字段;可用引号指定客户或项目关键词')
}
return { rows, description: constraints.length ? constraints.join(';') : '全部历史报价' }
}
export function quoteAnalysisFacts(s: State, library: any[], id: string) {
const r = allHistoryRows(s, library).find((x: any) => x.id === id)
if (!r) return null
const snapshot = library.find((x: any) => x.id === id)?.snapshot
const c = HISTORY_CASES[id]
let parts: [string, number][]
let resources: any[]
let risk: string
let scope: string
let source: string
if (snapshot) {
const material = snapshot.materials.reduce((n: number, m: any) => n + m.qty * m.price, 0)
const process = snapshot.resources.reduce((n: number, x: any) => n + x.qty * (x.rate || 0), 0)
const other = Object.values(snapshot.other).reduce((n: number, v: any) => n + v, 0)
const direct = material + process + other
const overhead = (direct * snapshot.overhead) / 100
const reserve = ((direct + overhead) * snapshot.risk) / 100
parts = [
['物料', material],
['制造资源', process],
['专项直接费', other],
['间接费', overhead],
['风险准备', reserve],
]
resources = snapshot.resources
risk = '归档中未包含实际采购、实耗工时、实际交付及售后问题数据。'
scope = snapshot.project.scope
source = r.number + ' / 归档快照'
} else {
parts = c!.costs
resources = c!.process.map((x, i) => ({ name: x[0], qty: x[1], rate: x[2], ref: c!.code + ' 工序' + (i + 1) }))
risk = c!.risk
scope = c!.scope
source = c!.code + ' / 内置模拟案例'
}
const cost = parts.reduce((n, x) => n + x[1], 0)
const margin = r.price ? ((r.price - cost) / r.price) * 100 : 0
const sorted = [...parts].sort((a, b) => b[1] - a[1])
const top = [...resources].sort((a, b) => b.qty * (b.rate || 0) - a.qty * (a.rate || 0))[0]
return { r, c, snapshot, parts, cost, margin, sorted, top, risk, scope, source }
}
export function buildQuotationAnalysis(s: State, library: any[], id: string, question = ''): AnalysisCard[] {
const f = quoteAnalysisFacts(s, library, id)
if (!f) return []
const { r, c, snapshot, parts, cost, margin, sorted, top, risk, scope, source } = f
const largest = sorted[0]
const share = cost ? (largest[1] / cost) * 100 : 0
const missingRates = snapshot
? snapshot.resources.filter((x: any) => !Number.isFinite(x.rate) || x.rate <= 0).length
: 0
return [
{
title: '01 项目基线与证据范围',
kind: 'fact',
text: r.project + ';' + r.sets + '套 / ' + r.days + '天;不含税报价 ' + money(r.price) + ' 元。分析依据为 ' + source + '。' + (question ? '本次关注:' + question : '本次关注成本结构与历史风险。'),
evidence: '报价编号、数量、交期、归档来源字段',
},
{
title: '02 成本结构:定位主要贡献项',
kind: 'fact',
text: '全成本 ' + money(cost) + ' 元;' + largest[0] + ' 为最大成本项,金额 ' + money(largest[1]) + ' 元,占全成本 ' + share.toFixed(1) + '%。' + (top ? '工序中“' + top.name + '”成本最高:' + top.qty + 'h × ' + money(top.rate || 0) + '元/h = ' + money(top.qty * (top.rate || 0)) + '元。' : ''),
bars: parts.map((x) => ({ name: x[0], value: x[1], share: cost ? (x[1] / cost) * 100 : 0 })),
evidence: parts.map((x) => x[0] + ' ' + money(x[1]) + '元').join(';'),
},
{
title: '03 利润与费用口径核对',
kind: margin < 0 || missingRates ? 'attention' : 'fact',
text: '按(不含税报价 − 全成本)÷ 不含税报价计算,项目利润率为 ' + margin.toFixed(2) + '%。' + (snapshot ? '归档利润底线 ' + snapshot.floor + '%,' + (margin + 1e-7 < snapshot.floor ? '低于归档底线,需重点复核。' : '达到归档底线。') : '与案例记录 ' + c!.margin + '% 的模拟成交利润率一致。') + (missingRates ? ' 有 ' + missingRates + ' 道工序缺少有效费率,当前成本与利润不可作为完整测算结论。' : '税额单列,未计入利润。'),
evidence: '成本分项合计、报价金额、费率字段与利润率公式',
},
{
title: '04 历史问题与可能原因:区分事实和线索',
kind: 'hypothesis',
text: c ? '案例记录中的风险线索:' + risk + ' 这些属于示例风险说明,不是已发生的质量或延期事件。' : '现有快照可以定位成本集中环节,但缺少实际执行数据,不能确认超支、延期或质量问题已发生,更不能据此确定根因。',
evidence: c ? source + ' / 风险说明字段' : '归档仅含计划与报价字段,缺少实际结果及事件记录',
},
{
title: '05 建议核验路径',
kind: 'action',
text: '优先核验' + (top ? '“' + top.name + '”工序的实际工时、设备和能耗记录' : '制造资源实际工时') + ';核对采购订单与材料实际耗用;补充交付偏差、质量检验与返工记录,再将计划与实际逐项对比。当前可确认的是成本贡献,具体问题根因仍待证据验证。',
evidence: '供货范围:' + scope,
},
]
}
export { offers }
File diff suppressed because one or more lines are too long
+605
View File
@@ -0,0 +1,605 @@
// 弹窗系统(对应原 modal/guide/openHistoricalCase/openQuotationLibrary/知识图谱/表单弹窗)
import { useEffect, useMemo, useRef, useState } from 'react'
import { money, esc } from './logic'
import { HISTORY_CASES, kbRecords } from './data'
import type { Material, Resource, State } from './types'
import { useApp } from './store'
import { Btn, Notice, Table } from './components'
// ============ 知识图谱 ============
function materialNetworkData(s: State, type: 'material' | 'resource') {
const list: any[] = type === 'resource' ? (s.resources as any[]) : (s.materials as any[])
const sources: { key: string; known: boolean; x: number; y: number }[] = []
const nodes = list.map((m, i) => {
const record: any = (kbRecords as any)[type].find((r: any) => r.id === m.id && r.name === m.name && r.ref === m.ref)
const key = type === 'resource'
? (record ? (record.ref.includes('内部工艺') ? '内部工艺定额' : record.name.includes('焊接') ? '焊接工时依据' : '机加工工艺依据') : '上传 / 人工数据')
: record
? (record.ref.includes('SIM-IS') ? 'SIM-IS-01' : record.ref.includes('SIM-OS') ? 'SIM-OS-01' : record.ref.includes('§4') ? '需求书 §4' : '需求书 §3')
: '上传 / 人工数据'
let source = sources.findIndex((x) => x.key === key)
if (source < 0) { source = sources.length; sources.push({ key, known: !!record, x: 0, y: 0 }) }
const angle = -Math.PI / 2 + (i * Math.PI * 2) / Math.max(1, list.length)
return { m, record, source, x: 480 + 338 * Math.cos(angle), y: 248 + 174 * Math.sin(angle), i }
})
sources.forEach((src, i) => {
const a = -Math.PI / 2 + (i * Math.PI * 2) / sources.length
src.x = 480 + 147 * Math.cos(a)
src.y = 248 + 88 * Math.sin(a)
})
return { sources, nodes }
}
function NetworkSvg() {
const { s, flows, selectMaterialNetwork } = useApp()
const a = flows.materialNetwork
const type = a.type || 'material'
const { sources, nodes } = useMemo(() => materialNetworkData(s, type), [s, type])
const shown = a.done ? nodes.length : Math.max(0, a.stage - 1)
const visible = nodes.slice(0, shown)
const resource = type === 'resource'
return (
<svg viewBox="0 0 960 500" role="img"
aria-label={resource ? '项目与工艺依据、工时记录、工序的来源关系网络' : '项目与图纸、需求条款、物料的来源关系网络'}>
<defs>
<radialGradient id="networkBg"><stop stopColor="#233252" /><stop offset="1" stopColor="#0c1428" /></radialGradient>
<filter id="networkGlow"><feGaussianBlur stdDeviation="4" /></filter>
</defs>
<rect width="960" height="500" rx="12" fill="url(#networkBg)" />
<g fill="none" stroke="#5e79ad" strokeOpacity=".25" strokeDasharray="2 8">
<ellipse cx="480" cy="248" rx="338" ry="174" />
<ellipse cx="480" cy="248" rx="230" ry="129" />
<ellipse cx="480" cy="248" rx="147" ry="88" />
</g>
<g className="network-links">
{a.stage >= 1 && (
<>
{sources.map((src, i) => (
<path key={'s' + i} d={`M480 248 L${src.x} ${src.y}`} stroke="#50bfbd" strokeWidth="1.5" fill="none" opacity=".55" />
))}
{visible.map((n) => {
const src = sources[n.source]
return <path key={'n' + n.i} d={`M${src.x} ${src.y} Q480 248 ${n.x} ${n.y}`}
stroke={n.record ? '#55b9b0' : '#d9ac4e'} opacity=".45" fill="none" />
})}
</>
)}
</g>
<g fontFamily="Microsoft YaHei,Segoe UI" textAnchor="middle">
<circle cx="480" cy="248" r="41" fill="#8a79ff" opacity=".25" filter="url(#networkGlow)" />
<circle cx="480" cy="248" r="30" fill="#7160ce" stroke="#c6b8ff" />
<text x="480" y="245" fontSize="13" fill="white" fontWeight="700">当前项目</text>
<text x="480" y="262" fontSize="10" fill="#ece9ff">{resource ? '工艺资源关联' : '物料知识关联'}</text>
{a.stage >= 1 && sources.map((src, i) => (
<g key={'g' + i} className="network-node">
<circle cx={src.x} cy={src.y} r="16" fill="#163e50" stroke={src.known ? '#66d4c5' : '#e1b451'} strokeWidth="2" />
<circle cx={src.x} cy={src.y} r="5" fill={src.known ? '#66d4c5' : '#e1b451'} />
<text x={src.x} y={src.y + 31} fill="#a9e4dc" fontSize="12">{src.key}</text>
</g>
))}
{visible.map((n) => {
const active = a.selected === n.i && a.done
const color = n.record ? '#f18e84' : '#e3bc5b'
return (
<g key={'m' + n.i} className="network-node network-material" role="button" tabIndex={0}
aria-label={'查看 ' + n.m.name + ' 来源'}
style={{ cursor: 'pointer' }}
onClick={() => selectMaterialNetwork(n.i)}
onKeyDown={(e) => { if (e.key === 'Enter' || e.key === ' ') { e.preventDefault(); selectMaterialNetwork(n.i) } }}>
<title>{n.m.name + ';来源:' + n.m.ref}</title>
<circle cx={n.x} cy={n.y} r="23" fill={color} opacity=".15" />
<circle cx={n.x} cy={n.y} r={active ? 16 : 12} fill={color} stroke={active ? '#fff' : color} strokeWidth="2" />
<text x={n.x} y={n.y + 34} fontSize="12" fill="#edf3ff">{n.m.name.length > 16 ? n.m.name.slice(0, 15) + '…' : n.m.name}</text>
<text x={n.x} y={n.y + 49} fontSize="10" fill="#92a9c9">{n.m.id}</text>
</g>
)
})}
<g textAnchor="start">
<circle cx="24" cy="477" r="4" fill="#8a79ff" /><text x="34" y="481" fill="#a8b8d5" fontSize="11">项目</text>
<circle cx="92" cy="477" r="4" fill="#66d4c5" /><text x="102" y="481" fill="#a8b8d5" fontSize="11">来源</text>
<circle cx="160" cy="477" r="4" fill="#f18e84" /><text x="170" y="481" fill="#a8b8d5" fontSize="11">{resource ? '匹配工序' : '匹配物料'}</text>
<circle cx="255" cy="477" r="4" fill="#e3bc5b" /><text x="265" y="481" fill="#a8b8d5" fontSize="11">待核验数据</text>
</g>
</g>
</svg>
)
}
function MaterialNetworkModal() {
const { s, flows, replayKnowledgeNetwork } = useApp()
const a = flows.materialNetwork
const type = a.type || 'material'
const { sources, nodes } = useMemo(() => materialNetworkData(s, type), [s, type])
const resource = type === 'resource'
const n = nodes[a.selected]
const status = a.done
? `关联构建完成:${sources.length} 个${resource ? '工艺依据' : '来源'}节点 · ${nodes.length} ${resource ? '道工序' : '项物料'} · ${sources.length + nodes.length} 条关联。点击${resource ? '工序' : '物料'}节点核对详情。`
: a.stage === 0
? (resource ? '索引检索 Agent:读取当前项目与工艺资源索引…' : '索引检索 Agent:读取当前项目与物料索引…')
: a.stage === 1
? (resource ? '关系映射 Agent:建立工艺定额与工时依据节点…' : '关系映射 Agent:建立图纸与需求条款来源节点…')
: shown2() < nodes.length
? `关系映射 Agent:逐项关联${resource ? '工序' : '物料'} ${shown2()} / ${nodes.length}…`
: (resource ? '来源校核 Agent:核对工时、综合费率与计价口径…' : '来源校核 Agent:比对记录与当前用量,整理追溯信息…')
function shown2() { return a.done ? nodes.length : Math.max(0, a.stage - 1) }
return (
<div className="material-network">
<div className="network-toolbar">
<div>
<b>✦ AI {resource ? '工艺资源' : '数据'}关联网络</b>
<small>{resource ? '项目 → 工艺依据 / 工时记录 → 工序资源 → 来源核对' : '项目 → 图纸 / 需求条款 → 物料 → 来源核对'}</small>
</div>
<Btn t="↻ 重播构建" onClick={replayKnowledgeNetwork} />
</div>
<div className="network-agents">
<span>01 索引检索 Agent</span><span>02 关系映射 Agent</span><span>03 来源校核 Agent</span>
</div>
<div className="network-canvas-wrap"><NetworkSvg /></div>
<div className="network-status" role="status">{status}</div>
<p className="network-boundary">
{resource
? '离线关联演示:依据当前工序、内置工艺记录与工时来源字段构建,未连接企业实际工艺库;未匹配记录显示为上传 / 人工数据。'
: '离线关联演示:图谱依据当前物料及内置来源字段构建;未匹配记录显示为上传 / 人工数据。'}
</p>
{n ? (
resource ? <ResourceNetworkDetail r={n.m as Resource} record={n.record} /> : <MaterialNetworkDetail m={n.m as Material} record={n.record} />
) : (
<Notice t={resource ? '暂无工艺资源记录。' : '暂无物料记录。'} />
)}
</div>
)
}
function MaterialNetworkDetail({ m, record }: { m: Material; record?: any }) {
const { s, flows, selectMaterialNetwork } = useApp()
const ref = m.ref || '待补充'
const doc = record ? (ref.includes('SIM-IS') ? '/mod-assets/wuc-quotation/模拟内套图.svg' : ref.includes('SIM-OS') ? '/mod-assets/wuc-quotation/模拟外套图.svg' : '/mod-assets/wuc-quotation/客户需求书.md') : null
return (
<>
<div className="kg-items">
{s.materials.map((r, i) => (
<Btn key={r.id + i} t={r.id} onClick={() => selectMaterialNetwork(i)} cls={flows.materialNetwork.selected === i ? 'primary' : ''} />
))}
</div>
<div className="kg-detail network-detail">
<span className={'chip ' + (record ? 'purple' : 'amber')}>{record ? '本地示例记录匹配' : '未匹配内置记录 / 人工数据'}</span>
<h3>{m.id} · {m.name}</h3>
<p>来源关联:{ref}</p>
<Table head={['字段', '来源记录值', '当前清单值']} rows={[
['用量', record ? `${record.qty} ${record.unit}` : '未匹配', `${m.qty} ${m.unit}`],
['参考单价', record ? money(record.price) + ' 元' : '未匹配', money(m.price) + ' 元'],
['成本口径', '用量 × 单价', money(m.qty * m.price) + ' 元'],
]} />
{doc
? <a className="kg-link" href={doc} target="_blank" rel="noopener">打开来源文件 ↗</a>
: <Notice cls="warn" t="请技术人员补充原始依据,此条目不声称历史匹配。" />}
</div>
</>
)
}
function ResourceNetworkDetail({ r, record }: { r: Resource; record?: any }) {
const { s, flows, selectMaterialNetwork } = useApp()
const hasRate = r.rate != null && Number.isFinite(r.rate) && r.rate > 0
return (
<>
<div className="kg-items">
{s.resources.map((item, i) => (
<Btn key={item.id + i} t={item.id} onClick={() => selectMaterialNetwork(i)} cls={flows.materialNetwork.selected === i ? 'primary' : ''} />
))}
</div>
<div className="kg-detail network-detail">
<span className={'chip ' + (record ? 'purple' : 'amber')}>{record ? '本地工艺示例记录匹配' : '未匹配内置记录 / 人工数据'}</span>
<h3>{r.id} · {r.name}</h3>
<p>工时来源:{r.ref || '待补充'}</p>
<Table head={['字段', '来源记录值', '当前清单值']} rows={[
['计划工时', record ? record.qty + ' h' : '未匹配', r.qty + ' h'],
['综合费率', record ? money(record.rate) + ' 元/h' : '未匹配', hasRate ? money(r.rate!) + ' 元/h' : '待核价'],
['工序成本', record ? money(record.qty * record.rate) + ' 元' : '未匹配', hasRate ? money(r.qty * (r.rate || 0)) + ' 元' : '待核价'],
['工艺说明', record ? record.note || '待补充' : '未匹配', r.note || '待补充'],
]} />
<Notice cls="warn" t={record
? '来源为DEMO内置工艺与工时估算记录,未连接真实历史工单;工时与费率仍需生产部门复核。'
: '此工序为上传或人工补充记录,请补充工艺文件、工时定额及费率依据,不自动声称历史匹配。'} />
</div>
</>
)
}
// ============ 历史案例 ============
function HistoricalCaseModal({ id }: { id: string }) {
const { s, openModal, closeModal } = useApp()
const c = HISTORY_CASES[id]
if (!c) return null
const total = c.costs.reduce((sum, x) => sum + x[1], 0)
const profit = c.price - total
const manufacturing = c.process.reduce((sum, x) => sum + x[1] * x[2], 0)
void manufacturing
return (
<div className="history-case-detail">
<Notice cls="warn" t="DEMO模拟案例:以下项目、客户、金额、工序与履约信息均为演示补充数据,并非真实合同或历史档案。仅供报价参考,不自动带入当前项目。" />
<h3>项目概况</h3>
<Table head={['字段', '案例信息']} rows={[
['案例编号 / 版本', c.code + ' / DEMO V1'],
['项目名称', c.name],
['客户', c.customer],
['案例时间', c.date],
['数量 / 交期', `${c.sets}套 / ${c.days}天`],
['记录来源', `本地内置案例记录 ${id};未连接企业历史项目库`],
]} />
<h3>供货范围与技术要求</h3>
<p>{c.scope}</p>
<p>{c.quality}</p>
<h3>物料与依据</h3>
<Table head={['物料', '规格', '数量口径', '依据(模拟)']} rows={c.materials} />
<h3>制造工艺与资源</h3>
<Table head={['工序', '计划工时 h', '综合费率 元/h', '成本 元']}
rows={c.process.map((r) => [r[0], r[1], money(r[2]), money(r[1] * r[2])])} />
<h3>成本与成交报价</h3>
<Table head={['项目', '金额 / 口径']} rows={[
...c.costs.map((r) => [r[0], money(r[1]) + ' 元']),
['项目全成本', money(total) + ' 元'],
['不含税成交总价', money(c.price) + ' 元'],
['不含税单位报价', money(c.price / c.sets) + ' 元/套'],
['项目利润', money(profit) + ' 元'],
['实际项目利润率', ((profit / c.price) * 100).toFixed(2) + '%'],
['模拟税额(13%)', money(c.price * 0.13) + ' 元'],
['模拟含税总额', money(c.price * 1.13) + ' 元'],
]} />
<h3>交付计划与商务条件</h3>
<Table head={['里程碑', '计划周期']} rows={c.milestones} />
<p>{c.terms}</p>
<h3>报价参考与差异</h3>
<p>{c.reason}</p>
<p>{c.risk}</p>
<Table head={['比较项', '历史案例', '当前项目']} rows={[
['数量', c.sets + '套', s.project.sets + '套'],
['交期', c.days + '天', s.project.delivery + '天'],
['成本基准', money(total) + ' 元(模拟)', money(s.materials.reduce((a, m) => a + m.qty * m.price, 0) + s.resources.reduce((a, r) => a + r.qty * (r.rate || 0), 0)) + ' 元(当前清单,未含专项与间接费)'],
['利润率参考', c.margin + '%(模拟成交)', s.floor + '%(硬性底线)'],
]} />
<div className="actions section">
<Btn t={'查看 ' + (id === 'H01' ? 'H02' : 'H01') + ' 案例'}
onClick={() => openModal('case', '历史案例 ' + (id === 'H01' ? 'H02' : 'H01') + ' / 完整项目参考', id === 'H01' ? 'H02' : 'H01')} />
<Btn t="关闭" onClick={closeModal} cls="primary" />
</div>
</div>
)
}
// ============ 历史报价信息库 / 报价智能体 ============
function QuoteAgentProgress() {
const { flows } = useApp()
const a = flows.quoteAssistant
if (!a.mode) return null
const steps = a.mode === 'analysis'
? ['读取归档字段', '核算成本结构', '核对风险依据', '整理分析结论']
: ['理解查询条件', '检索本地记录', '核对项目字段', '逐项展示结果']
return (
<div className="quote-agent-progress">
<b>{a.running ? '● Agent 协同处理中' : a.cancelled ? '处理已停止' : a.mode === 'analysis' ? '分析已完成' : '检索已完成'}</b>
{steps.map((t, i) => (
<div key={i} className={i < a.stage ? 'done' : i === a.stage && a.running ? 'active' : ''}>
<span>{i < a.stage ? '✓' : '0' + (i + 1)}</span>{t}
</div>
))}
<small>展示检索与计算步骤,不代表外部模型实时调用。</small>
</div>
)
}
function QuoteAgentAnalysis() {
const { flows, library } = useApp()
const a = flows.quoteAssistant
void library
if (!a.analysis.length) {
return (
<div className="quote-analysis-idle">
<span>◈</span>
<div><b>选择一个项目,开启证据驱动的归因分析</b><p>逐项呈现成本结构、风险线索和待核验依据。</p></div>
</div>
)
}
const shown = a.analysis.slice(0, a.analysisCount)
const kindLabel: Record<string, string> = { fact: '可核算事实', attention: '需复核', hypothesis: '风险线索 / 非因果结论', action: '核验建议' }
return (
<section className="quote-analysis-panel">
<div className="quote-analysis-heading">
<div><small>PROJECT DIAGNOSTICS</small><h3>{a.analysisTitle}</h3></div>
<span className="chip purple">{a.running && a.mode === 'analysis' ? '正在构建分析' : '分析记录'}</span>
</div>
{!shown.length
? <div className="kb-empty">正在读取项目档案与成本字段…</div>
: shown.map((x, i) => (
<article key={i} className={'quote-analysis-card ' + x.kind}>
<span className="chip">{kindLabel[x.kind]}</span>
<h3>{x.title}</h3>
<p>{x.text}</p>
{x.bars && (
<div className="quote-cost-bars">
{x.bars.map((b, j) => (
<div key={j}>
<span>{b.name}</span>
<i><em style={{ width: b.share.toFixed(2) + '%' }} /></i>
<strong>{money(b.value)}</strong>
</div>
))}
</div>
)}
<div className="quote-evidence"><b>依据</b> {x.evidence}</div>
</article>
))}
</section>
)
}
function QuotationLibraryModal() {
const {
library, filters, setFilters, flows, useQuoteAgentPrompt, runQuoteAgentQuery,
analyzeSelectedQuotation, selectAgentQuotation, showAllAgentQuotes, openModal,
} = useApp()
const a = flows.quoteAssistant
const [input, setInput] = useState('')
const messagesRef = useRef<HTMLDivElement>(null)
const messages = a.messages.length ? a.messages : [{ role: 'assistant' as const, text: '你好,我可以帮你查找历史报价,并对选中项目核算成本结构、梳理风险依据。可按项目、客户、编号、年份、金额和交期查找。' }]
useEffect(() => {
const el = messagesRef.current
if (el) el.scrollTop = el.scrollHeight
}, [a.messages.length, a.stage, a.analysisCount])
let rows = filters.from && filters.to && filters.from > filters.to ? [] : libraryAll()
function libraryAll() {
const saved = library.map((r) => ({ ...r, kind: 'saved' }))
const examples = Object.entries(HISTORY_CASES).map(([id, c]) => ({
id, number: c.code, project: c.name, customer: c.customer,
date: c.date.startsWith('2025-09') ? '2025-09-01' : '2025-12-01',
sets: c.sets, days: c.days, price: c.price, total: c.price * 1.13, kind: 'example',
}))
return [...saved, ...examples]
}
if (a.ids !== null) rows = rows.filter((r: any) => a.ids!.includes(r.id))
const shown = a.mode === 'search' && a.running ? rows.slice(0, a.revealed) : rows
return (
<div className="quote-agent-workspace">
<aside className="quote-agent-sidebar">
<div className="quote-agent-brand">
<span>✦</span>
<div><b>历史报价智能助手</b><small>检索项目 · 核对依据 · 归因线索</small></div>
</div>
<div className="quote-agent-note">基于本机报价快照与内置示例分析。自然语言由本地规则解析,未连接外部大模型。</div>
<div className="quote-agent-messages" ref={messagesRef}>
{messages.map((m, i) => (
<div className={'quote-agent-bubble ' + m.role} key={i}>
<small>{m.role === 'user' ? '你的需求' : '✦ 报价智能助手'}</small>
<p>{m.text}</p>
</div>
))}
</div>
<QuoteAgentProgress />
<div className="quote-agent-prompts">
{['查找2025年的导向套项目', '查找交期90天以内的项目', '查找不含税报价20万元以下的项目'].map((t, i) => (
<Btn key={i} t={t} onClick={() => { setInput(t); useQuoteAgentPrompt(i) }} />
))}
</div>
<label className="quote-agent-input-label" htmlFor="qAgentInput">用自然语言查找或分析项目</label>
<textarea id="qAgentInput" rows={3} maxLength={600} value={input}
placeholder="例如:查找内外套项目;分析 H01 的成本与历史风险"
onChange={(e) => setInput(e.target.value)}
onKeyDown={(e) => { if (e.key === 'Enter' && !e.shiftKey && !(e as any).isComposing) { e.preventDefault(); runQuoteAgentQuery(input); setInput('') } }} />
<div className="actions quote-agent-send">
<Btn t="✦ 发送并检索" onClick={() => { runQuoteAgentQuery(input); setInput('') }} cls="primary" />
<Btn t="分析选中项目" onClick={() => analyzeSelectedQuotation()} />
</div>
</aside>
<section className="quote-agent-main">
<div className="quote-agent-heading">
<div>
<div className="eyebrow">QUOTATION INTELLIGENCE</div>
<h2>历史项目与报价证据</h2>
<p>先定位项目,再核对成本与风险依据。</p>
</div>
<Btn t="查看全部" onClick={showAllAgentQuotes} />
</div>
<details className="quote-agent-filters">
<summary>精确筛选 · 项目 / 客户 / 编号 / 日期</summary>
<div className="quotation-search">
{([['project', '项目名称', 'text'], ['customer', '客户名称', 'text'], ['number', '报价编号', 'text'], ['from', '开始日期', 'date'], ['to', '结束日期', 'date']] as const).map(([key, label, type]) => (
<label key={key}>{label}
<input type={type} value={filters[key]} onChange={(e) => setFilters((f) => ({ ...f, [key]: e.target.value.trim() }))} />
</label>
))}
</div>
</details>
<div className="quote-result-heading">
<b>项目匹配结果 <span>{shown.length}</span></b>
<small>本机快照 {library.length} 条 · 示例 2 条</small>
</div>
{filters.from && filters.to && filters.from > filters.to
? <Notice cls="warn" t="开始日期不得晚于结束日期。" />
: shown.length ? (
<div className="quote-project-grid">
{shown.map((r: any) => (
<article className={'quote-project-card ' + (a.selected === r.id ? 'is-selected' : '')} key={r.id}>
<div className="quote-project-top">
<span className={'chip ' + (r.kind === 'saved' ? 'purple' : '')}>{r.kind === 'saved' ? '本机归档快照' : 'DEMO参考案例'}</span>
<small>{r.date}</small>
</div>
<h3>{r.project}</h3>
<p>{r.customer}</p>
<small className="muted">{r.number} · {r.sets}套 · {r.days}天</small>
<div className="quote-project-price"><strong>¥ {money(r.price)}</strong><span>不含税总价</span></div>
<div className="actions">
<Btn t={a.selected === r.id ? '✓ 已选中' : '选择项目'} onClick={() => selectAgentQuotation(r.id)} cls={a.selected === r.id ? 'primary' : ''} />
<Btn t="归因分析" onClick={() => analyzeSelectedQuotation(r.id)} />
<Btn t="完整档案" onClick={() => openHistoryDetail(r.id)} />
</div>
</article>
))}
</div>
) : a.running && a.mode === 'search' ? (
<div className="quote-search-empty">
<span className="quote-agent-orbit">✦</span>
<b>AI 正在检索报价记录</b>
<p>匹配结果将逐项展示…</p>
</div>
) : (
<div className="kb-empty">未找到符合条件的报价,请调整自然语言或筛选条件。</div>
)}
<QuoteAgentAnalysis />
</section>
</div>
)
function openHistoryDetail(id: string) {
const r = library.find((x) => x.id === id)
if (!r) {
if (HISTORY_CASES[id]) openModal('case', '历史案例 ' + id + ' / 完整项目参考', id)
return
}
openModal('historyDetail', '历史报价详情 / ' + r.number, id)
}
}
function QuotationHistoryDetail({ id }: { id: string }) {
const { library, openModal } = useApp()
const r = library.find((x) => x.id === id)
if (!r) return null
const snap = r.snapshot
const material = snap.materials.reduce((sum, m) => sum + m.qty * m.price, 0)
const process = snap.resources.reduce((sum, x) => sum + x.qty * (x.rate || 0), 0)
return (
<div className="quotation-history-detail">
<div className="actions"><Btn t="← 返回历史报价信息库" onClick={() => openModal('library', '历史报价信息库 / AI智能体工作台')} /></div>
<Notice t={'归档快照:' + esc(r.date) + '入库 · V' + esc(r.revision) + ' · 此处数据固定为入库时内容,不随当前项目修改。'} />
<Table head={['归档字段', '信息']} rows={[
['项目', snap.project.project],
['客户', snap.project.customer],
['报价编号', r.number],
['数量 / 交期', `${r.sets}套 / ${r.days}天`],
['批准策略', r.strategy],
['批准时间', r.approvedAt || ''],
['不含税 / 含税总额', `${money(r.price)} 元 / ${money(r.total)} 元`],
['税率', r.tax + '%'],
['供货范围', snap.project.scope],
['商务条件', snap.project.terms],
['项目补充说明', snap.context],
...(snap.competitorQuote ? [
['友商报价参考', `${snap.competitorQuote.name || '友商'} / ${money(snap.competitorQuote.price)} 元(${snap.competitorQuote.taxMode === 'inclusive' ? '含税' : '不含税'})`],
['友商数量 / 交期', `${snap.competitorQuote.sets}套 / ${snap.competitorQuote.days}天`],
['友商信息来源', snap.competitorQuote.source || '未填写'],
] : []),
]} />
<h3 className="section">入库报价单原件</h3>
<div dangerouslySetInnerHTML={{ __html: r.html }} />
<h3 className="section">内部物料依据</h3>
<Table head={['物料号', '物料', '用量', '单价', '金额', '来源']}
rows={snap.materials.map((m) => [m.id, m.name, `${m.qty} ${m.unit}`, money(m.price), money(m.qty * m.price), m.ref])} />
<h3 className="section">内部工艺资源</h3>
<Table head={['工序', '工时', '费率', '金额', '来源']}
rows={snap.resources.map((x) => [x.name, x.qty, money(x.rate || 0), money(x.qty * (x.rate || 0)), x.ref])} />
<p>物料合计:{money(material)} 元;工艺资源合计:{money(process)} 元。</p>
<Table head={['补充成本 / 参数', '归档值']} rows={[
...Object.entries(snap.other).map(([k, v]) => [k, money(v) + ' 元']),
['间接费率', snap.overhead + '%'],
['风险准备', snap.risk + '%'],
['利润底线', snap.floor + '%'],
]} />
<div className="actions section">
<Btn t="返回历史报价信息库" onClick={() => openModal('library', '历史报价信息库 / AI智能体工作台')} />
</div>
</div>
)
}
// ============ 简单表单弹窗 ============
function NewMaterialModal() {
const { submitMaterial, closeModal } = useApp()
const [name, setName] = useState('人工补充物料')
const [qty, setQty] = useState('1')
const [unit, setUnit] = useState('件')
const [price, setPrice] = useState('100')
return (
<>
<label>名称 <input value={name} onChange={(e) => setName(e.target.value)} /></label>
<div className="formrow">
数量 <input type="number" value={qty} onChange={(e) => setQty(e.target.value)} />
单位 <input value={unit} onChange={(e) => setUnit(e.target.value)} />
单价 <input type="number" value={price} onChange={(e) => setPrice(e.target.value)} />
</div>
<div className="actions">
<button className="primary" onClick={() => submitMaterial({ name, unit, qty, price })}>保存并纳入成本</button>
<Btn t="取消" onClick={closeModal} />
</div>
</>
)
}
function NewResourceModal() {
const { submitResource, closeModal } = useApp()
const [name, setName] = useState('')
const [ref, setRef] = useState('')
const [qty, setQty] = useState('1')
const [note, setNote] = useState('')
return (
<div className="resource-form">
<label>工序名称 <input maxLength={100} placeholder="例如:表面处理" value={name} onChange={(e) => setName(e.target.value)} /></label>
<label>工时来源 <input maxLength={240} placeholder="例如:技术人工估算 / 工艺文件编号" value={ref} onChange={(e) => setRef(e.target.value)} /></label>
<label>计划工时(h) <input type="number" min="0.01" step="0.01" value={qty} onChange={(e) => setQty(e.target.value)} /></label>
<label>工序说明(选填) <input maxLength={240} placeholder="填写工序范围或补充说明" value={note} onChange={(e) => setNote(e.target.value)} /></label>
<div className="actions">
<Btn t="保存工序" onClick={() => submitResource({ name, ref, qty, note })} cls="primary" />
<Btn t="取消" onClick={closeModal} />
</div>
</div>
)
}
function PreviewModal({ payload }: { payload: { url: string; name: string; pdf: boolean } }) {
return payload.pdf
? <iframe title="PDF预览" src={payload.url} width="100%" height="520" />
: <img alt="上传图纸" src={payload.url} style={{ maxWidth: '100%' }} />
}
// ============ 弹窗宿主 ============
export function ModalHost() {
const { modal, closeModal } = useApp()
const dlg = useRef<HTMLDialogElement>(null)
useEffect(() => {
const el = dlg.current
if (!el) return
if (modal.open && !el.open) el.showModal()
if (!modal.open && el.open) el.close()
}, [modal.open])
const cls = modal.kind === 'library' ? 'quote-agent-dialog quotation-library-dialog'
: modal.kind === 'network' ? 'material-network-dialog' : ''
return (
<dialog ref={dlg} id="modal" className={cls} onClose={closeModal}>
<div className="modal-head">
<b>{modal.title}</b>
<button onClick={closeModal}>关闭</button>
</div>
<div id="modalBody">
{modal.kind === 'guide' && (
<ol>
<li>需求解析:载入样例 → 解析 → 确认澄清(1分钟)。</li>
<li>清单:追溯来源 → 补入焊材 → 确认技术(1.5分钟)。</li>
<li>询价:尝试低价超期供应商 → 合规选择 → 物供提交 → 生产提交 → 经营确认(2分钟)。</li>
<li>成本:核对材料、工时、间接费与风险准备 → 生成报告(1分钟)。</li>
<li>策略:比较A/B/C → 演示低于底线的阻断 → 选择B → 审批(1.5分钟)。</li>
<li>报价:打印/导出 → 返回修改工时,演示审批失效(1分钟)。</li>
</ol>
)}
{modal.kind === 'network' && <MaterialNetworkModal />}
{modal.kind === 'library' && <QuotationLibraryModal />}
{modal.kind === 'case' && <HistoricalCaseModal id={modal.payload} />}
{modal.kind === 'historyDetail' && <QuotationHistoryDetail id={modal.payload} />}
{modal.kind === 'newMaterial' && <NewMaterialModal />}
{modal.kind === 'newResource' && <NewResourceModal />}
{modal.kind === 'preview' && <PreviewModal payload={modal.payload} />}
</div>
</dialog>
)
}
@@ -0,0 +1,116 @@
/* React 版布局调整:左侧菜单固定不动,右侧内容区独立滚动
说明:原应用 header 实际高度为 80px(002.css 顶层覆盖 001.css 的 90px),现压缩为 65px(上下 padding 减半),
且原 sticky 规则依赖 body>header 直属结构,融合到平台后改由模块根容器 .wuc-root 承载(不触碰全局 html/body)。 */
/* ===== 桌面端(>900px):锁定视口,左栏与 header 固定,main 内部滚动 ===== */
@media (min-width: 901px) {
.wuc-root {
height: 100vh;
display: flex;
flex-direction: column;
overflow: hidden;
}
.wuc-root > header {
height: 65px; /* 原 80px:上下 padding 15px 减半为 7.5px(内容区 50px 不变) */
padding-top: 7.5px;
padding-bottom: 7.5px;
flex-shrink: 0;
}
.app-shell {
height: calc(100vh - 65px);
min-height: 0;
overflow: hidden;
flex: 1;
}
.app-shell aside {
height: 100%;
overflow-y: auto;
box-sizing: border-box;
}
.app-shell main {
height: 100%;
box-sizing: border-box;
display: flex;
flex-direction: column;
overflow: hidden;
}
/* 页面标题与流程轨道固定,不随内容滚动 */
.app-shell main .workspace-banner {
flex-shrink: 0;
}
.app-shell main > #content {
flex: 1;
min-height: 0;
overflow-y: auto;
}
/* 需求解析页:左右两栏等高充满内容区,各自溢出内部滚动 */
.app-shell main > #content[data-view='1'] {
overflow: hidden;
display: flex;
}
.app-shell main > #content[data-view='1'] .demand-grid {
flex: 1;
min-height: 0;
grid-template-rows: minmax(0, 1fr);
}
.app-shell main > #content[data-view='1'] .demand-grid > .panel {
min-height: 0;
overflow-y: auto;
}
}
/* ===== 窄屏(≤900px):沿用原 block 布局 + 整页滚动,仅补偿 header 置顶 ===== */
@media (max-width: 900px) {
.wuc-root > header {
position: sticky;
top: 0;
z-index: 40;
background-color: var(--bg);
}
}
/* 打印时放开视口锁定,避免内容被裁剪 */
@media print {
.wuc-root {
height: auto;
overflow: visible;
}
}
/* 页面标题行:h1 与页面动作按钮同行,紧凑按钮样式 */
#titlebar .title-line {
display: flex;
align-items: center;
gap: 12px;
}
#titlebar .title-line h1 {
margin: 0;
}
.wuc-root .btn-sm {
flex-shrink: 0;
font-size: 12px;
padding: 4px 12px;
}
/* 原 002.css 依赖 body>header 的层级补偿(header 现位于模块根容器内) */
.wuc-root header .head-name,
.wuc-root header .head-status,
.wuc-root header > button {
position: relative;
}
/* React 条件渲染的 toast(覆盖原 #toast{display:none!important}) */
#toast.is-visible {
display: block !important;
}
@@ -0,0 +1,2 @@
// 提取自原 002-app.js reportText() 的报告抬头 Logo(base64 PNG)
export const REPORT_LOGO="data:image/png;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNDAwIiBoZWlnaHQ9IjkwMCIgdmlld0JveD0iMCAwIDE0MDAgOTAwIj48ZGVmcz48cGF0dGVybiBpZD0iaCIgd2lkdGg9IjkiIGhlaWdodD0iOSIgcGF0dGVyblVuaXRzPSJ1c2VyU3BhY2VPblVzZSIgcGF0dGVyblRyYW5zZm9ybT0icm90YXRlKDQ1KSI+PGxpbmUgeDE9IjAiIHkxPSIwIiB4Mj0iMCIgeTI9IjkiIHN0cm9rZT0iIzc3NyIvPjwvcGF0dGVybj48bWFya2VyIGlkPSJhIiBtYXJrZXJXaWR0aD0iOCIgbWFya2VySGVpZ2h0PSI4IiByZWZYPSI0IiByZWZZPSI0IiBvcmllbnQ9ImF1dG8tc3RhcnQtcmV2ZXJzZSI+PHBhdGggZD0iTTAsMCBMOCw0IEwwLDgiIGZpbGw9Im5vbmUiIHN0cm9rZT0iIzExMSIvPjwvbWFya2VyPjwvZGVmcz48cmVjdCB4PSIzMCIgeT0iMzAiIHdpZHRoPSIxMzQwIiBoZWlnaHQ9Ijg0MCIgZmlsbD0id2hpdGUiIHN0cm9rZT0iIzIyMiIgc3Ryb2tlLXdpZHRoPSIyIi8+PGcgZm9udC1mYW1pbHk9Ik1pY3Jvc29mdCBZYUhlaSxBcmlhbCIgZmlsbD0iIzIyMiI+PHRleHQgeD0iNjUiIHk9Ijg1IiBmb250LXNpemU9IjI1Ij7lhoXlpZfnu4Tku7Yg4oCUIOaooeaLn+acuuaisOWbvu+8iOS7heS+m+aKpeS7t0RFTU/vvIk8L3RleHQ+PHRleHQgeD0iNjUiIHk9IjExOSIgZm9udC1zaXplPSIxNyIgZmlsbD0iI2JkNDQ0NCI+6Z2e6ZmE5Lu25aSN5Yi7IMK3IOWwuuWvuOOAgeadkOi0qOWPiue7k+aehOWdh+S4uuWBh+iuviDCtyDnpoHmraLkvZzkuLrnlJ/kuqfkvp3mja48L3RleHQ+PGcgc3Ryb2tlPSIjMjIyIiBzdHJva2Utd2lkdGg9IjIiIGZpbGw9Im5vbmUiPjxyZWN0IHg9IjE0MCIgeT0iMjYwIiB3aWR0aD0iNjAwIiBoZWlnaHQ9IjIxMCIvPjxyZWN0IHg9IjE0MCIgeT0iMjYwIiB3aWR0aD0iNjAwIiBoZWlnaHQ9IjMyIiBmaWxsPSJ1cmwoI2gpIi8+PHJlY3QgeD0iMTQwIiB5PSI0MzgiIHdpZHRoPSI2MDAiIGhlaWdodD0iMzIiIGZpbGw9InVybCgjaCkiLz48cmVjdCB4PSIxNjAiIHk9IjIwNSIgd2lkdGg9IjM1IiBoZWlnaHQ9IjMyMCIgZmlsbD0idXJsKCNoKSIvPjxyZWN0IHg9IjY1MCIgeT0iMjI1IiB3aWR0aD0iMzAiIGhlaWdodD0iMjgwIiBmaWxsPSJ1cmwoI2gpIi8+PGNpcmNsZSBjeD0iMTAzMCIgY3k9IjM2NSIgcj0iMTQ1Ii8+PGNpcmNsZSBjeD0iMTAzMCIgY3k9IjM2NSIgcj0iMTEyIi8+PGNpcmNsZSBjeD0iMTAzMCIgY3k9IjM2NSIgcj0iOTAiLz48cGF0aCBkPSJNMTAwIDM2NWg2OTBNMTAzMCAxODV2MzYwTTg1MCAzNjVoMzYwIiBzdHJva2UtZGFzaGFycmF5PSIxMiA2IDMgNiIgc3Ryb2tlPSIjNzc3Ii8+PHBhdGggZD0iTTE0MCA0OTB2OTBNNzQwIDQ5MHY5ME0xNDAgNTY1aDYwMCIvPjxwYXRoIGQ9Ik03OTAgMjYwaDQ1TTc5MCA0NzBoNDVNODIwIDI2MHYyMTAiLz48cGF0aCBkPSJNMTQwIDU2NWg2MDAiIG1hcmtlci1zdGFydD0idXJsKCNhKSIgbWFya2VyLWVuZD0idXJsKCNhKSIvPjxwYXRoIGQ9Ik04MjAgMjYwdjIxMCIgbWFya2VyLXN0YXJ0PSJ1cmwoI2EpIiBtYXJrZXItZW5kPSJ1cmwoI2EpIi8+PC9nPjx0ZXh0IHg9IjM3MCIgeT0iNTUyIiBmb250LXNpemU9IjIwIj7nrZLmrrXplb8gMTIwMDwvdGV4dD48dGV4dCB4PSI4MzUiIHk9IjM0MCIgZm9udC1zaXplPSIxOCI+zqY0MjA8L3RleHQ+PHRleHQgeD0iOTMwIiB5PSI1NTAiIGZvbnQtc2l6ZT0iMTgiPuWGheW+hCDOpjM4MCAvIOazleWFsCDOpjU2MDwvdGV4dD48dGV4dCB4PSIyMjAiIHk9IjE5MCIgZm9udC1zaXplPSIxOCI+4pGhIOazleWFsDwvdGV4dD48dGV4dCB4PSIzNzAiIHk9IjI0NSIgZm9udC1zaXplPSIxOCI+4pGgIOetkuS9k++8iOWJluinhuekuuaEj++8iTwvdGV4dD48dGV4dCB4PSI2MjAiIHk9IjE5NSIgZm9udC1zaXplPSIxOCI+4pGiIOWKoOW8uueOrzwvdGV4dD48dGV4dCB4PSI2NSIgeT0iNjI1IiBmb250LXNpemU9IjE4Ij7mioDmnK/or7TmmI7vvIjmqKHmi5/vvInvvJoxLiDmnZDmlpnmmoLlrppRMzU1Qu+8mzIuIOWFiOaIkOW9oueEiuaOpeWQjuacuuWKoOW3pe+8mzMuIOmFjeWQiOOAgeWFrOW3ruOAgeeEiue8neetiee6p+W+heaKgOacr+WNj+iuruOAgjwvdGV4dD48dGV4dCB4PSI2NSIgeT0iNjYzIiBmb250LXNpemU9IjE4Ij7lh4Dph43mjInmqKHmi5/lnIbnjq/kvZPnp6/kvLDnrpfvvIjop4HpnIDmsYLkuabvvInvvJvlrZTmp73mnKrmiaPpmaTvvIxCT03pobvmioDmnK/lrqHmoLjvvIzlm77nurjmnKrlkKvnhIrmnZDjgII8L3RleHQ+PHBhdGggZD0iTTMwIDcxMGgxMzQwTTgwMCA3MTB2MTYwTTExMDAgNzEwdjE2ME04MDAgNzY1aDU3ME04MDAgODIwaDU3MCIgc3Ryb2tlPSIjMjIyIiBmaWxsPSJub25lIi8+PHRleHQgeD0iNjUiIHk9Ijc1NSIgZm9udC1zaXplPSIyMCI+5q2m5rGJ5q2m6Ii56YeN5Z6L6KOF5aSH5bel56iL5pyJ6ZmQ6LSj5Lu75YWs5Y+4IMK3IEFJ5oql5Lu35bmz5Y+wPC90ZXh0Pjx0ZXh0IHg9IjY1IiB5PSI3OTMiIGZvbnQtc2l6ZT0iMTYiPuWcuuaZr+WPguiAg++8mueUqOaIt+aPkOS+m+WGheWllyAvIOWkluWll+mZhOS7tuS4u+mimO+8jOacquaguOWunuWOn+WbvuW3peeoi+WPguaVsDwvdGV4dD48dGV4dCB4PSI2NSIgeT0iODMyIiBmb250LXNpemU9IjE2Ij7lh4Dph43jgIHmlbDph4/lkozmnZDmlpnlj7fop4HjgIrlrqLmiLfpnIDmsYLkuabjgIsgwqcz77yb5pys5Zu+5Y2V5L2NIG1t77yM5LiN5oyJ5q+U5L6L44CCPC90ZXh0Pjx0ZXh0IHg9IjgyNSIgeT0iNzQ2IiBmb250LXNpemU9IjIzIj7lhoXlpZfnu4Tku7Y8L3RleHQ+PHRleHQgeD0iMTEyMCIgeT0iNzQ2IiBmb250LXNpemU9IjIwIj5TSU0tSVMtMDE8L3RleHQ+PHRleHQgeD0iODI1IiB5PSI4MDAiIGZvbnQtc2l6ZT0iMTgiPueJiOacrO+8mkEgLyDmqKHmi588L3RleHQ+PHRleHQgeD0iMTEyMCIgeT0iODAwIiBmb250LXNpemU9IjE4Ij7mlbDph4/vvJoxMOS7tjwvdGV4dD48dGV4dCB4PSI4MjUiIHk9Ijg1NSIgZm9udC1zaXplPSIxOCI+MjAyNi0xMC0xNjwvdGV4dD48dGV4dCB4PSIxMTIwIiB5PSI4NTUiIGZvbnQtc2l6ZT0iMTgiPumdnueUn+S6p+Wbvue6uDwvdGV4dD48L2c+PC9zdmc+"
File diff suppressed because it is too large Load Diff
+215
View File
@@ -0,0 +1,215 @@
// 武船AI智能报价平台 — 状态与实体类型定义(对应原 fresh() 状态结构)
export interface Material {
id: string
name: string
unit: string
qty: number
price: number
ref: string
confidence?: number
}
export interface Resource {
id: string
name: string
ref: string
qty: number
rate: number | null
note?: string
aiRateReason?: string
}
export interface Project {
schema?: string
project: string
customer: string
code: string
delivery: number
sets: number
scope: string
terms: string
materials: Material[]
resources: Resource[]
missing?: Material
assumptions: string
}
export interface SupplierOffer {
name: string
price: number
days: number
quality: string
index: number
aiReason?: string
}
export interface LogEntry {
time: string
text: string
rev: number
}
export interface FileEntry {
name: string
size: number
type: string
}
export interface CompetitorQuote {
name: string
price: number
taxMode: 'exclusive' | 'inclusive'
taxRate: number
sets: number
days: number
position: 'low' | 'balanced' | 'quality'
comparable: boolean
source: string
}
export interface StrategyCard {
label: string
g: number
price: number
profit: number
margin: number
valid: boolean
days: number
reason: string
competition?: { reference: number; gap: number; floorPrice: number }
}
export interface State {
version: number
page: number
project: Project
materials: Material[]
resources: Resource[]
parsed: boolean
tech: boolean
supply: boolean
production: boolean
review: boolean
report: boolean
approved: boolean
approvedAt?: string
selected: number
revision: number
floor: number
targets: number[]
other: Record<string, number>
overhead: number
risk: number
tax: number
context: string
quotes: Record<string, SupplierOffer>
log: LogEntry[]
files: FileEntry[]
fileText: string
clarified: boolean
competitorQuote?: CompetitorQuote
unsupported?: boolean
productionRatesInitialized?: boolean
}
// 运行时 AI 演示流程(不持久化,对应原模块级变量)
export interface Flow {
running: boolean
visible: boolean
tick: number
token: number
cancelled?: boolean
}
export interface AiRunFlow extends Flow {
sheet: number
}
export interface KbFlow extends Flow {
shown: boolean
}
export interface InquiryFlow extends Flow {
done: number
failed: number
}
export interface ProductionAIFlow extends InquiryFlow {
unmatched: string[]
}
export interface StrategyRunFlow extends Flow {
reveal: number
}
export interface MaterialNetwork {
token: number
stage: number
selected: number
done: boolean
active: boolean
type: 'material' | 'resource'
}
export interface QuoteAssistant {
open: boolean
running: boolean
token: number
cancelled?: boolean
mode: '' | 'search' | 'analysis'
stage: number
revealed: number
ids: string[] | null
selected: string | null
messages: { role: 'user' | 'assistant'; text: string }[]
analysis: AnalysisCard[]
analysisCount: number
analysisTitle: string
}
export interface AnalysisCard {
title: string
kind: 'fact' | 'attention' | 'hypothesis' | 'action'
text: string
evidence: string
bars?: { name: string; value: number; share: number }[]
}
export interface QuotationRecord {
id: string
signature: string
number: string
project: string
customer: string
date: string
sets: number
days: number
price: number
tax: number
total: number
strategy: string
revision: number
approvedAt?: string
snapshot: State
html: string
}
export interface HistoryCase {
name: string
customer: string
code: string
date: string
sets: number
days: number
price: number
margin: number
costs: [string, number][]
scope: string
materials: string[][]
process: [string, number, number][]
milestones: string[][]
terms: string
quality: string
reason: string
risk: string
}
+790
View File
@@ -0,0 +1,790 @@
// 7 个业务视图(对应原 home/demand/lists/inquiry/cost/strategy/quote 渲染函数)
import React from 'react'
import { ENGINEERING_DRAWING } from './drawing-assets'
import { money, quoteHTML, strategies, issues as calcIssues, calc as calcCost } from './logic'
import { SAMPLE, TITLES, offers } from './data'
import type { State } from './types'
import { useApp } from './store'
import { Audit, Btn, Metric, Notice, NumInput, Table } from './components'
const aiIsSample = (s: State) =>
s.project.code === SAMPLE.code && JSON.stringify(s.project.materials) === JSON.stringify(SAMPLE.materials)
// ============ 0 项目工作台 ============
export function Home() {
const { s, go } = useApp()
const c = calcCost(s)
const depts = ['技术部', '技术部', '物供 · 生产 · 经营', '经营部', '经营 · 审批', '经营部']
const descs = ['上传需求与模拟图纸,提取并核对', '补全BOM、用量与工时', '比较交期与价格,识别遗漏', '全成本汇总,生成可追溯报告', '历史案例辅助,生成A/B/C策略', '审批后生成,打印与导出']
return (
<>
<section className="project-hero hero-grid">
<div>
<div className="eyebrow">ENGINEERING TO QUOTATION</div>
<div className="hero-title">从一张图纸,到一份可信报价</div>
<p className="hero-text">围绕技术、物供、生产与经营的协同流程,让每一项成本有来源,每一次决策有依据。</p>
<div className="actions">
<Btn t="开始需求解析 →" onClick={() => go(1)} cls="primary" />
<Btn t="查看全流程数据" onClick={() => go(4)} />
</div>
</div>
<div className="engineering-drawing-card" dangerouslySetInnerHTML={{ __html: ENGINEERING_DRAWING }} />
</section>
<div className="metrics">
<Metric label="项目交付数量" value={s.project.sets} unit="套" />
<Metric label="目标交期" value={s.project.delivery} unit="天" />
<Metric label="当前测算成本" value={money(c.total / 10000)} unit="万元" />
<Metric label="利润率底线" value={s.floor} unit="%" />
</div>
<div className="flow">
{TITLES.slice(1).map((t, i) => (
<button key={i} onClick={() => go(i + 1)}>
<small>0{i + 1} / {depts[i]}</small>
<b>{t}</b>
<small>{descs[i]}</small>
</button>
))}
</div>
<Notice t="演示边界:AI解析与策略为本地规则模拟;可编辑成本、询价、审批与导出是真实交互。所有商业数据为模拟数据。原始附件尺寸与材质未核实。" />
<div className="panel section"><h2>项目动态 / 审核追溯</h2><Audit /></div>
</>
)
}
// ============ 1 需求与图纸解析 ============
function AiPanel() {
const { s, flows, aiSheet, parse, clarify, go } = useApp()
const aiRun = flows.aiRun
if (!aiRun.visible) return null
const running = aiRun.running
const done = !running && s.parsed
const len = s.project.materials.length
const t = done ? len + 7 : aiRun.tick
const phase = done ? 4 : t < 2 ? 0 : t < 3 ? 1 : t < len + 3 ? 2 : 3
const found = done ? len : Math.max(0, Math.min(len, t - 2))
const warnings = done || t >= len + 3
const sample = aiIsSample(s)
const sheet = aiRun.sheet
const points = sheet ? [[3, 10, 28, 44, 25], [4, 11, 22, 6, 37]] : [[0, 14, 29, 39, 24], [1, 10, 22, 6, 37], [2, 45, 25, 5, 32]]
const status = ['图纸解析 Agent · 读取图框与视图', '语义理解 Agent · 拆解组件与装配关系', '多模态 Agent + OCR Agent · 交叉核对物料', '校核 Agent · 检查遗漏与规格冲突', '解析完成 · 等待人工确认'][phase]
return (
<div className="panel ai ai-workbench">
<div className="ai-top">
<h2>✦ AI 协同图纸解析</h2>
<span className={'chip ' + (running ? 'purple' : done ? 'green' : '')}>{running ? '协同处理中' : done ? '待人工确认' : '准备就绪'}</span>
</div>
<p className="ai-caption">离线流程演示 · 多模态大模型 + OCR 协同概念,未调用真实模型</p>
<div className="ai-agents">
{['图纸解析', '理解与拆解', '多模态 + OCR', '遗漏校核'].map((name, i) => (
<div key={i} className={'ai-agent ' + (phase > i ? 'done' : phase === i && (running || done) ? 'active' : '')}>
<b>{phase > i ? '✓' : '0' + (i + 1)} {name}</b>
{['图框 / 视图定位', '组件 / 信息关联', '逐项识别 / 核对', '缺项 / 人工确认'][i]}
</div>
))}
</div>
<div className="ai-track"><i style={{ width: (done ? 100 : running ? Math.max(3, (t / (len + 7)) * 100) : 0) + '%' }} /></div>
<div className="ai-status" role="status"><b>{!running && !done ? '等待启动解析' : status}</b><span>{found} / {len} 项</span></div>
{sample ? (
<>
<div className="ai-sheet-tabs">
{['内套 · SIM-IS-01', '外套 · SIM-OS-01'].map((name, i) => (
<button key={i} className={sheet === i ? 'primary' : ''} onClick={() => aiSheet(i)}>{name}</button>
))}
</div>
<div className="ai-sheet">
<img src={sheet ? '/mod-assets/wuc-quotation/模拟外套图.svg' : '/mod-assets/wuc-quotation/模拟内套图.svg'} alt="用于识别动画的模拟机械图" />
{running && <div className="ai-scan" />}
{points.filter((p) => p[0] < found).map((p, i) => (
<div key={i} className="ai-mark" style={{ left: p[1] + '%', top: p[2] + '%', width: p[3] + '%', height: p[4] + '%' }}>
<span>✓ {s.project.materials[p[0]].name}</span>
</div>
))}
{warnings && (
<div className="ai-mark warn" style={{ left: '5%', top: '67%', width: '88%', height: '10%' }}>
<span>! 焊材未覆盖 / 配合与焊缝要求待确认</span>
</div>
)}
</div>
<div className="ai-legend">绿色:模拟图示物料定位 橙色虚线:信息缺失区域 · 可切换图纸查看</div>
</>
) : (
<div className="ai-idle">结构化需求映射<br /><small>当前按 JSON 来源字段展示候选信息;无对应图纸坐标,不生成定位标记。</small></div>
)}
{(running || done) && (
<div className="ai-events" aria-label="物料识别记录">
{s.project.materials.slice(0, found).map((m, i) => (
<div className="ai-event" key={i}>
<b>✓ {m.id} · {m.name}</b> <span>{m.qty} {m.unit}</span>
<small>{m.ref}{sample && i >= 5 ? ' · 需求文本补充,非图纸直接识别' : ''}</small>
</div>
)).reverse()}
</div>
)}
{warnings && (
<Notice cls="warn" t={sample
? '校核发现:焊材未覆盖,需补充清单;导向衬套、密封组件规格及配合公差待技术确认。'
: '请核对结构化数据中的材料规格、数量、来源和图纸覆盖范围;当前未进行真实 OCR。'} />
)}
{done && (
<div className="ai-summary">
<h3>识别总结 / 人工确认</h3>
<Table head={['提取字段', '识别结果']} rows={[
['项目', s.project.project],
['客户', s.project.customer || '待补充'],
['数量 / 交期', `${s.project.sets}套 / ${s.project.delivery}天`],
['物料 / 工艺', `${s.materials.length}项候选 / ${s.resources.length}道工序`],
]} />
<p className="ai-caption">候选数据来源:{sample ? '内置模拟图与需求书,尺寸和净重均为演示假设。' : '上传的结构化需求,需人工对照原始图纸核验。'}</p>
<label>
<input type="checkbox" checked={s.clarified} onChange={(e) => clarify(e.target.checked)} />
已按演示假设确认数量、材质与外购件规格
</label>
<div className="actions section">
<Btn t="确认并进入清单 →" onClick={() => go(2)} disabled={!s.clarified} cls="primary" />
<Btn t="重播解析动画" onClick={parse} />
</div>
</div>
)}
</div>
)
}
export function Demand() {
const { s, flows, loadSample, uploadFiles, parse } = useApp()
return (
<div className="grid2 demand-grid">
<div className="panel">
<h2>01 / 上传客户需求与图纸</h2>
<p>支持结构化JSON、UTF-8 Markdown/TXT需求;PDF、图像及SVG可预览归档,离线模式不做通用OCR。</p>
<input type="file" accept=".json,.md,.txt,.pdf,.png,.jpg,.jpeg,.svg" multiple
onChange={(e) => { uploadFiles(e.target.files); e.currentTarget.value = '' }} />
<div className="actions section">
<Btn t="载入模拟客户需求" onClick={loadSample} cls="primary" />
<button type="button"
className={'parse-demand-button ' + (flows.aiRun.visible ? 'is-clicked' : '')}
onClick={parse}
aria-pressed={flows.aiRun.visible ? 'true' : 'false'}
aria-busy={flows.aiRun.running ? 'true' : 'false'}
disabled={!s.project || flows.aiRun.running}>
解析当前需求
</button>
</div>
<Notice cls="warn" t="参考附件:213WS03-01(内套)、213WS03-02(外套)。当前仅使用主题参考,未读取确认原图工程参数。模拟图与原图严格区分。" />
<div className="docs-list">
{s.files.length
? s.files.map((f, i) => <div className="doc-row" key={i}><b>{f.name}</b><span className="muted">{f.size} KB · {f.type}</span></div>)
: <div className="muted">暂无本次上传文件,可直接载入样例开始。</div>}
</div>
<div className="previewtext">{s.fileText || s.project.scope}</div>
<div className="actions section">
<a href="/mod-assets/wuc-quotation/模拟内套图.svg" target="_blank" rel="noreferrer">查看模拟内套图 ↗</a>
<a href="/mod-assets/wuc-quotation/模拟外套图.svg" target="_blank" rel="noreferrer">查看模拟外套图 ↗</a>
<a href="/mod-assets/wuc-quotation/客户需求书.md" download>下载客户需求书</a>
</div>
</div>
<AiPanel />
</div>
)
}
// ============ 2 物量与资源清单 ============
function KbBanner() {
const { s, flows, startKnowledge } = useApp()
const kb = flows.kb
const total = s.materials.length + s.resources.length
const shown = Math.min(total, Math.max(0, kb.tick - 2))
const phase = !kb.running ? 3 : kb.tick < 2 ? 0 : shown < s.materials.length ? 1 : 2
return (
<section className="kb-banner">
<div className="panel-head">
<div>
<b>✦ AI 知识库检索与来源匹配</b><br />
<small role="status">
{(kb.running
? ['检索本地索引,定位可引用的依据…', '逐项关联物料、图纸序号与需求条款…', '匹配工艺记录、工时与计价依据…'][phase] + ' ' + shown + ' / ' + total
: '检索展示完成 · 可打开图谱逐项核对来源')}
</small>
</div>
<Btn t="↻ 重播检索过程" onClick={startKnowledge} disabled={kb.running} />
</div>
<div className="kb-stages">
{['检索索引', '物料映射', '工艺关联', '来源核对'].map((n, i) => <span key={i} className={i === phase ? 'on' : ''}>{i + 1} {n}</span>)}
</div>
<div className="ai-track"><i style={{ width: (!kb.running ? 100 : Math.max(3, (kb.tick / (total + 3)) * 100)) + '%' }} /></div>
<small>离线知识库演示:检索内置模拟需求 / 工艺记录;未连接企业真实历史库。候选值按来源映射呈现,未匹配记录标为人工补充。</small>
</section>
)
}
export function Lists() {
const { s, flows, go, editM, editR, addMissing, deleteListRow, confirmTech, startMaterialNetwork, openModal } = useApp()
const kb = flows.kb
if (!kb.shown) return null
if (!s.parsed) {
return <>
<Notice t="请先上传/载入需求并完成解析。" />
<Btn t="前往需求解析" onClick={() => go(1)} />
</>
}
const busy = kb.running
const mc = busy ? Math.min(s.materials.length, Math.max(0, kb.tick - 2)) : s.materials.length
const rc = busy ? Math.min(s.resources.length, Math.max(0, kb.tick - 2 - s.materials.length)) : s.resources.length
return (
<div className="quantity-lists">
<div className="metrics quantity-metrics">
<Metric label="物料项" value={busy ? mc : s.materials.length} unit="项" />
<Metric label="制造工序" value={rc} unit="道" />
</div>
<KbBanner />
<div className="panel">
<div className="panel-head">
<h2>物量清单 / BOM</h2>
<div className="actions">
<Btn t="◈ 物料知识匹配图谱" onClick={() => startMaterialNetwork(0, 'material')} cls="primary" />
<Btn t="补入遗漏焊材" onClick={addMissing} disabled={busy || s.materials.some((m) => m.id === 'M009')} />
<Btn t="+ 手工新增物料" onClick={() => openModal('newMaterial', '新增人工补充物料')} disabled={busy} />
</div>
</div>
<Notice t="用量为项目合计;采购量=用量。来源匹配与当前值可在图谱中核对。" />
<Table
head={['物料号 / 来源', '物料', '用量', '单位', '采购量', '操作']}
rows={s.materials.slice(0, mc).map((m, i) => [
<>{m.id}<br /><small className="muted">{m.ref}</small></>,
m.name,
busy ? m.qty : <NumInput v={m.qty} onCommit={(v) => editM(i, 'qty', v)} ariaLabel={m.name + '用量'} />,
m.unit,
money(m.qty),
<Btn t="删除" onClick={() => deleteListRow('material', i)} disabled={busy} cls="row-delete" />,
])}
/>
{busy && mc === 0 && <div className="kb-empty">正在检索图纸物料索引与需求条款…</div>}
</div>
<div className="panel section">
<div className="panel-head">
<h2>资源清单 / 制造工艺路线</h2>
<div className="actions">
<Btn t="+ 手工添加工序" onClick={() => openModal('newResource', '手工添加工序')} disabled={busy} />
<Btn t="◈ 工艺知识匹配图谱" onClick={() => startMaterialNetwork(0, 'resource')} cls="primary" />
</div>
</div>
<Table
head={['工序', '工时来源', '计划工时', '操作']}
rows={s.resources.slice(0, rc).map((r, i) => [
<>{r.name}<br /><small className="muted">{r.note}</small></>,
r.ref,
busy ? r.qty : <NumInput v={r.qty} onCommit={(v) => editR(i, 'qty', v)} ariaLabel={r.name + '计划工时'} />,
<Btn t="删除" onClick={() => deleteListRow('resource', i)} disabled={busy} cls="row-delete" />,
])}
/>
{busy && rc === 0 && <div className="kb-empty">等待物料关系匹配,随后检索工序与工时依据…</div>}
<Notice t="费率含直接人工、设备及能耗;焊材计入BOM,检测/防腐独立列项,避免重复归集。" />
<div className="actions">
<Btn t={s.tech ? '✓ 技术已确认' : '确认技术清单'} onClick={confirmTech} cls="primary"
disabled={busy || !s.materials.length || !s.resources.length || s.tech || !s.clarified || !s.materials.some((m) => m.id === 'M009')} />
<Btn t="进入询价与审核 →" onClick={() => go(3)} disabled={busy} />
</div>
</div>
</div>
)
}
// ============ 3 跨部门询价与审核 ============
function AiInquiryPanel() {
const { s, flows } = useApp()
const a = flows.aiInquiry
if (!a.visible) return null
const phase = a.tick < 1 ? 0 : a.tick < 2 ? 1 : a.tick < 3 ? 2 : a.running ? 3 : 4
const valid = s.materials.filter((r) => !!s.quotes[r.id] && Number.isFinite(r.price) && r.price > 0)
const amount = valid.reduce((sum, r) => sum + Math.round(r.qty * r.price * 100) / 100, 0)
const pending = s.materials.length - valid.length
return (
<section className="ai-inquiry-panel">
<div className="panel-head">
<b>✦ AI Agent 协同询价</b>
<span className={'chip ' + (a.running ? 'purple' : 'green')}>
{a.running ? '处理中' : a.cancelled ? '已暂停' : a.failed ? '部分物料待人工询价' : '推荐完成'}
</span>
</div>
<div className="ai-inquiry-steps">
{['需求核对 Agent', '报价检索 Agent', '交期比价 Agent', '推荐回填 Agent'].map((n, i) => (
<div key={i} className={phase > i ? 'done' : phase === i ? 'active' : ''}>
<b>{phase > i ? '✓' : i + 1} {n}</b>
<small>{['读取物料与采购数量', '检索内置供应商报价', '过滤超期 / 比较单价', '逐项填写并说明理由'][i]}</small>
</div>
))}
</div>
<div className="ai-track"><i style={{ width: Math.min(100, (a.tick / (s.materials.length + 3)) * 100) + '%' }} /></div>
<div role="status">
{a.running
? ['正在核对物料清单与项目交付要求…', '正在检索每项物料的模拟供应商报价…', '正在检查最迟到料时间并比较合规报价…'][Math.min(a.tick, 2)] + (a.tick >= 3 ? ` 已处理 ${a.done} / ${s.materials.length} 项。` : '')
: a.cancelled ? '处理已暂停,可重新点击 AI询价。'
: `已处理 ${a.done} 项;` + (a.failed ? `${a.failed} 项无交期合规报价,需人工处理。` : '推荐结果已回填,可手工调整后提交审核。')}
</div>
<small className="muted">离线规则演示:基于内置模拟报价,先满足交期,再选合规最低价;不向供应商发送询价,不自动提交审核。</small>
<div className="ai-panel-total" role="status">
<span>采购总金额(不含税){pending ? ' · 已回填小计' : ''}</span>
<strong>¥ {money(amount)}</strong>
{pending ? <small>{pending} 项待核价</small> : null}
</div>
</section>
)
}
function ProductionAIFlow() {
const { s, flows } = useApp()
const a = flows.productionAI
if (!a.visible) return null
const phase = a.running ? Math.min(3, a.tick) : 4
const valid = s.resources.filter((r) => r.rate != null && Number.isFinite(r.rate) && r.rate > 0)
const amount = valid.reduce((sum, r) => sum + Math.round(r.qty * (r.rate || 0) * 100) / 100, 0)
const pending = s.resources.length - valid.length
return (
<section className="ai-inquiry-panel">
<div className="panel-head">
<b>✦ AI Agent 协同工序核价</b>
<span className="chip purple">{a.running ? '处理中' : a.cancelled ? '已暂停' : a.failed ? '部分待人工核价' : '推荐完成'}</span>
</div>
<div className="ai-inquiry-steps">
{['工序理解 Agent', '费率检索 Agent', '口径校核 Agent', '推荐回填 Agent'].map((name, i) => (
<div key={i} className={phase > i ? 'done' : phase === i ? 'active' : ''}>
<b>{phase > i ? '✓' : i + 1} {name}</b>
<small>{['核对工序与工时范围', '查找可追溯费率记录', '核对人工 / 设备 / 能耗', '逐项填写费率与理由'][i]}</small>
</div>
))}
</div>
<div className="ai-track"><i style={{ width: Math.min(100, (a.tick / (s.resources.length + 3)) * 100) + '%' }} /></div>
<div role="status">
{a.running
? ['正在理解工序范围与计划工时…', '正在检索本地工艺费率记录…', '正在校核综合费率与费用归集口径…', '正在逐项回填推荐综合费率…'][Math.min(3, a.tick)] + ` 已处理 ${a.done} / ${s.resources.length} 项。`
: a.cancelled ? '处理已暂停,可重新点击 AI询价。'
: `已处理 ${a.done} 项,${a.failed} 项待人工核价;请核对后提交。`}
</div>
<small className="muted">离线规则演示:依据内置模拟工艺费率或上传需求中的费率记录;未连接企业实际历史库,不自动提交审核。</small>
<div className="ai-panel-total" role="status">
<span>工序总金额{pending ? ' · 已回填小计' : ''}</span>
<strong>¥ {money(amount)}</strong>
{pending ? <small>{pending} 项待核价</small> : null}
</div>
</section>
)
}
function ProductionPricing() {
const { s, flows, editR, startProductionAI, submitProduction } = useApp()
const ai = flows.productionAI
return (
<>
<div className="production-inquiry-actions">
<Btn t={ai.running ? 'AI询价处理中…' : '✦ AI询价'} onClick={startProductionAI} cls="primary"
disabled={!s.tech || !s.resources.length || ai.running} />
<Notice t="由制造部门确认工时与综合费率;直接修改会使经营审核和报价审批失效。" />
</div>
<ProductionAIFlow />
<div className="production-rate-table">
<Table
head={['工序', '工时', '综合费率(元/时)', 'AI推荐理由', '总成本']}
rows={s.resources.map((r, i) => [
r.name,
ai.running ? r.qty : <NumInput v={r.qty} onCommit={(v) => editR(i, 'qty', v)} ariaLabel={r.name + '计划工时'} />,
<input type="number" min="0.01" step="0.01" aria-label={r.name + '综合费率'}
placeholder="待填写"
defaultValue={r.rate != null && r.rate > 0 ? r.rate : ''}
key={r.id + '-' + (r.rate ?? '')}
disabled={ai.running || undefined}
onChange={(e) => editR(i, 'rate', e.target.value)} />,
r.aiRateReason
? <div className="ai-inquiry-reason">{r.aiRateReason}</div>
: ai.unmatched?.includes(r.id)
? <span className="muted">未匹配可靠费率依据,请人工核价。</span>
: <span className="muted">待询价 / 人工核价</span>,
r.rate && r.rate > 0 ? money(r.qty * r.rate) : <span className="muted">待核价</span>,
])}
/>
</div>
<div className="section">
<Btn t={s.production ? '✓ 生产已提交' : '生产核价并提交'} onClick={submitProduction} cls="primary"
disabled={!s.tech || s.production || ai.running || !s.resources.length || s.resources.some((r) => r.rate == null || !Number.isFinite(r.rate) || r.rate <= 0)} />
</div>
</>
)
}
export function Inquiry() {
const { s, sub, setSub, pick, pickAll, submitSupply, returnSupply, returnProduction, confirmReview, flows, startAIInquiry } = useApp()
if (!s.parsed) return <Notice t="请先解析客户需求。" />
const iss = calcIssues(s)
return (
<>
<div className="panel">
<div className="panel-head">
<h2>三部门并行核价 / 统一经营确认</h2>
<span className="chip purple">当前演示:{['物供部', '生产部', '经营部'][sub]}</span>
</div>
<div className="actions subtabs">
{['物供询价', '生产核价', '经营审核'].map((x, i) => (
<Btn key={i} t={x} onClick={() => setSub(i)} cls={sub === i ? 'primary' : ''} />
))}
</div>
{sub === 0 && (
<>
<Notice t={'全部报价均为模拟回填,不向供应商发出询价。最迟到料:第' + (s.project.delivery - 30) + '天;报价有效期30天。'} />
<div className="actions">
<Btn t="批量采用交期合规报价" onClick={pickAll} disabled={!s.tech || flows.aiInquiry.running} />
<Btn t={s.supply ? '✓ 已提交物供报价' : '物供提交审核'} onClick={submitSupply} cls="primary"
disabled={!s.tech || s.supply || flows.aiInquiry.running} />
<Btn t={flows.aiInquiry.running ? 'AI询价处理中…' : '✦ AI询价'} onClick={startAIInquiry} cls="primary"
disabled={!s.tech || !s.materials.length || flows.aiInquiry.running} />
</div>
<AiInquiryPanel />
<div className="supplier-quote-table">
<Table
head={['物料 / 单位', '报价选择(不含税)', 'AI推荐理由', '采购数量', '采购金额']}
rows={s.materials.map((m, i) => {
const q = s.quotes[m.id]
const over = q && q.days > s.project.delivery - 30
return [
<>{m.name}<br /><small>{m.id} / {m.unit}</small></>,
<>
<select aria-label={m.name + '供应商'} disabled={flows.aiInquiry.running || undefined}
value={q ? String(q.index) : ''} onChange={(e) => pick(i, e.target.value)}>
<option value="">请选择</option>
{offers(m, s.project).map((o, j) => (
<option key={j} value={j}>{o.name} / ¥{o.price} / {o.days}天</option>
))}
</select>
<br />
<small className={over ? 'danger' : 'muted'}>{q?.quality || '待回填供应商报价'}</small>
</>,
q?.aiReason ? <div className="ai-inquiry-reason"><b>✦ AI推荐理由</b><br />{q.aiReason}</div> : '',
money(m.qty),
money(m.qty * m.price),
]
})}
/>
</div>
</>
)}
{sub === 1 && <ProductionPricing />}
{sub === 2 && (
<div className="grid2">
<div>
<h3>✦ 经营审核提示(规则扫描)</h3>
{iss.length ? iss.map((x, i) => <Notice key={i} cls="warn" t={x} />) : <Notice cls="good" t="完整性、采购交期、部门提交状态均已通过。" />}
<Notice t="关注:衬套/密封为外购件;焊材不能遗漏;综合费率与独立费用不得重复计费。" />
<div className="actions">
<Btn t="退回物供修订" onClick={returnSupply} />
<Btn t="退回工艺资源修订" onClick={returnProduction} />
</div>
</div>
<div>
<h3>部门确认状态</h3>
<Table head={['责任部门', '状态']} rows={[
['技术部', s.tech ? '已确认' : '待确认'],
['物供部', s.supply ? '已提交' : '待提交'],
['生产部', s.production ? '已提交' : '待提交'],
['经营部', s.review ? '已确认' : '待审核'],
]} />
<div className="section">
<Btn t={s.review ? '✓ 经营已确认' : '经营最终确认'} onClick={confirmReview} cls="primary"
disabled={!!iss.length || s.review} />
</div>
</div>
</div>
)}
</div>
<div className="panel section"><h2>修改与审核记录</h2><Audit /></div>
</>
)
}
// ============ 4 全成本测算报告 ============
export function Cost() {
const { s, editOther, editParam, generateReport, downloadReport, go } = useApp()
const c = calcCost(s)
const parts: [string, number][] = [['物料成本', c.material], ['制造资源', c.process], ['专项直接费', c.other], ['项目间接费', c.overhead], ['风险准备', c.risk]]
return (
<>
<div className="metrics">
<Metric label="项目全成本" value={money(c.total / 10000)} unit="万元" />
<Metric label="单位成本" value={money(c.total / s.project.sets)} unit="元/套" />
<Metric label="保底不含税价" value={money(c.total / (1 - s.floor / 100) / 10000)} unit="万元" />
<Metric label="审核状态" value={s.review ? '已确认' : '待确认'} />
</div>
<div className="grid2">
<div className="panel">
<h2>成本构成与归集</h2>
{parts.map(([n, v]) => (
<div className="chartrow" key={n}>
<span>{n}</span>
<div className="bar"><i style={{ width: (c.total ? (v / c.total) * 100 : 0) + '%' }} /></div>
<strong>{money(v)}</strong>
</div>
))}
<Table head={['成本项', '计价基础']} rows={[
['物料', 'Σ用量×不含税采购单价'],
['工序', 'Σ工时×综合费率'],
['专项直接费', '检测 + 防腐 + 包装运输 + 现场技术服务'],
['间接费', '直接成本×' + s.overhead + '%'],
['风险准备', '(直接成本+间接费)×' + s.risk + '%'],
]} />
</div>
<div className="panel">
<h2>补充成本与参数</h2>
{Object.entries(s.other).map(([k, v]) => (
<div className="formrow" key={k}>
<label>{k}(元)</label>
<NumInput v={v} onCommit={(nv) => editOther(k, nv)} ariaLabel={k} />
</div>
))}
<div className="formrow">
间接费率% <NumInput v={s.overhead} onCommit={(v) => editParam('overhead', v)} ariaLabel="间接费率" />
{' '}风险准备% <NumInput v={s.risk} onCommit={(v) => editParam('risk', v)} ariaLabel="风险准备" />
</div>
<Notice t="管理口径项目利润率=(不含税报价−项目全成本)÷不含税报价,非企业净利率;税额不计入利润。费用均为模拟估算。" />
{!s.review && <Notice cls="warn" t="参数调整后可直接生成成本测算报告;经营审核状态仍需单独确认。" />}
<Btn t={s.report ? '重新生成成本报告' : '生成成本测算报告'} onClick={generateReport} cls="primary" />{' '}
<Btn t="下载成本报告" onClick={downloadReport} disabled={!s.report} />
</div>
{s.report && (
<div className="panel ai section">
<h2>✦ 初步测算结论</h2>
<p>项目全成本为 <b>{money(c.total)}元</b>,{s.project.sets}套平均成本 {money(c.total / s.project.sets)}元/套。制造资源占比 {((c.process / c.total) * 100).toFixed(1)}%。
{s.floor}%利润率要求对应不含税报价不低于 {money(c.total / (1 - s.floor / 100))}元。</p>
<p>主要敏感项:焊接和精加工工时、材料用量、外购件规格。建议完成技术澄清并锁定采购交期后承诺交付。</p>
<Btn t="生成报价策略 →" onClick={() => go(5)} cls="primary" />
</div>
)}
</div>
</>
)
}
// ============ 5 AI报价策略 ============
function CompetitorQuoteForm() {
const { s, cqPresetCleared, saveCompetitorQuote, clearCompetitorQuote, flows } = useApp()
const preset = !s.competitorQuote && !cqPresetCleared
const q: any = preset
? { ...(s.competitorQuote || { name: '', price: null, taxMode: 'exclusive', taxRate: s.tax, sets: s.project.sets, days: s.project.delivery, position: 'balanced', comparable: false, source: '' }), name: '江城重装设备有限公司(模拟)', price: 220000, source: '演示预设报价,仅供模拟比较,非真实友商数据' }
: s.competitorQuote || { name: '', price: null, taxMode: 'exclusive', taxRate: s.tax, sets: s.project.sets, days: s.project.delivery, position: 'balanced', comparable: false, source: '' }
const [form, setForm] = React.useState(q)
const [compChecked, setCompChecked] = React.useState(q.comparable)
// 状态切换(预设/清空/项目更换)时同步表单
React.useEffect(() => { setForm(q); setCompChecked(q.comparable) }, [preset, s.competitorQuote, s.project])
const q0 = s.competitorQuote
const refUsed = !!(q0 && Number.isFinite(q0.price) && q0.price > 0 && q0.comparable &&
q0.sets === s.project.sets && q0.days === s.project.delivery &&
Number.isFinite(q0.taxMode === 'inclusive' ? q0.price / (1 + q0.taxRate / 100) : q0.price) &&
(q0.taxMode === 'inclusive' ? q0.price / (1 + q0.taxRate / 100) : q0.price) > 0)
const statusText = preset
? '已预填可编辑的模拟报价,核对供货范围后保存,即可参与AI策略判定。'
: !s.competitorQuote ? '尚未录入友商报价,沿用利润目标生成方案。'
: !(Number.isFinite(s.competitorQuote.price) && s.competitorQuote.price > 0) ? '尚未录入友商报价,沿用利润目标生成方案。'
: !s.competitorQuote.comparable ? '友商供货范围尚未确认,仅展示信息,不用于调价。'
: s.competitorQuote.sets !== s.project.sets || s.competitorQuote.days !== s.project.delivery ? '友商数量或交期与当前项目不一致,仅供参考,不直接参与同口径定价。'
: `已按同范围、${s.competitorQuote.sets}套、${s.competitorQuote.days}天比较;友商不含税总价 ${money(s.competitorQuote.taxMode === 'inclusive' ? s.competitorQuote.price / (1 + s.competitorQuote.taxRate / 100) : s.competitorQuote.price)} 元。`
const busy = flows.strategyRun.running
const set = (k: string, v: any) => setForm((f: any) => ({ ...f, [k]: v }))
return (
<section className="competitor-quote-panel">
<div className="panel-head"><h3>友商报价参考</h3><span className="chip">{preset ? '模拟预设 · 可修改' : '手工录入'}</span></div>
<div className="competitor-fields">
<label>友商名称<input maxLength={100} value={form.name} placeholder="填写友商或报价来源" disabled={busy} onChange={(e) => set('name', e.target.value)} /></label>
<label>报价总额(元)<input type="number" min="0.01" step="0.01" value={form.price ?? ''} placeholder="填写整个项目总价" disabled={busy} onChange={(e) => set('price', e.target.value)} /></label>
<label>报价口径
<select value={form.taxMode} disabled={busy} onChange={(e) => set('taxMode', e.target.value)}>
<option value="exclusive">不含税总价</option>
<option value="inclusive">含税总价</option>
</select>
</label>
<label>友商税率 %<input type="number" min="0" max="100" step="0.01" value={form.taxRate} disabled={busy} onChange={(e) => set('taxRate', e.target.value)} /></label>
<label>供货数量(套)<input type="number" min="1" step="1" value={form.sets} disabled={busy} onChange={(e) => set('sets', e.target.value)} /></label>
<label>交期(天)<input type="number" min="1" step="1" value={form.days} disabled={busy} onChange={(e) => set('days', e.target.value)} /></label>
<label>友商报价策略
<select value={form.position} disabled={busy} onChange={(e) => set('position', e.target.value)}>
<option value="low">低价竞争</option>
<option value="balanced">综合平衡</option>
<option value="quality">质量与服务溢价</option>
</select>
</label>
<label>信息来源 / 备注<input maxLength={400} value={form.source} placeholder="报价单、客户反馈等" disabled={busy} onChange={(e) => set('source', e.target.value)} /></label>
</div>
<label className="competitor-scope">
<input type="checkbox" checked={compChecked} disabled={busy} onChange={(e) => setCompChecked(e.target.checked)} />
已核对友商供货范围和技术要求与本项目一致
</label>
<div className="actions">
<Btn t="保存友商信息" onClick={() => saveCompetitorQuote({ ...form, comparable: compChecked })} disabled={busy} cls="primary" />
<Btn t="清空" onClick={clearCompetitorQuote} disabled={busy} />
</div>
<p className={'competitor-status ' + (refUsed ? 'matched' : '')} role="status">{statusText}</p>
</section>
)
}
function StrategyAIFlow() {
const { flows } = useApp()
const a = flows.strategyRun
if (!a.visible) return null
const phase = a.running ? Math.min(3, Math.floor(a.tick / 2)) : 4
return (
<section className="ai-inquiry-panel">
<div className="panel-head">
<b>✦ 多 Agent 协同报价决策</b>
<span className="chip purple">{a.running ? '协同处理中' : a.cancelled ? '已暂停' : '策略生成完成'}</span>
</div>
<div className="ai-inquiry-steps">
{['案例与友商检索 Agent', '成本校核 Agent', '方案推演 Agent', '审批整理 Agent'].map((n, i) => (
<div key={i} className={phase > i ? 'done' : phase === i ? 'active' : ''}>
<b>{phase > i ? '✓' : i + 1} {n}</b>
<small>{['检索模拟案例与项目背景', '核对成本、底线与友商口径', '综合利润与友商生成方案', '整理依据与人工审批项'][i]}</small>
</div>
))}
</div>
<div className="ai-track"><i style={{ width: Math.min(100, (a.tick / 8) * 100) + '%' }} /></div>
<div role="status">
{a.running
? ['正在读取成本版本与项目要求…', '正在检索模拟历史案例…', '案例依据已匹配,正在校核成本与利润底线…', '正在结合利润底线与可比友商报价推演方案…', '已生成 A · 竞争优先方案…', '已生成 B · 综合平衡方案…', '已生成 C · 价值保障方案…', '正在整理内部审批资料…'][Math.min(a.tick, 7)]
: a.cancelled ? '生成已暂停,可点击 AI报价策略 重新开始。'
: '三种策略及审批资料已准备,请人工选择并确认。'}
</div>
<small className="muted">离线规则演示 · 多 Agent 协同动画,未调用外部模型;报价仍按项目成本与利润约束计算。</small>
</section>
)
}
export function Strategy() {
const { s, flows, setFloor, startStrategyAI, setTarget, selectStrategy, approve, rejectStrategy, go, setContext, openModal } = useApp()
const st = strategies(s)
const reveal = flows.strategyRun.reveal
const running = flows.strategyRun.running
const cases: [string, string, string][] = [
['历史案例 H01', '相似内外套组件 / 8套', '历史成交利润率18%,交期100天'],
['历史案例 H02', '高精度导向套 / 12套', '历史成交利润率22%,交期90天'],
['当前项目', `10套 / 交期${s.project.delivery}天`, '以本次已审批成本为报价基准'],
]
return (
<>
<div className="panel">
<div className="strategy-input-grid">
<div className="strategy-input-main">
<h2>✦ 报价策略模拟 / 以利润底线约束决策</h2>
<p>历史案例用于解释,不直接替换本项目成本。三个方案供货范围、交期相同,仅利润与商业定位不同。</p>
<div className="formrow">
硬性利润率底线% <NumInput v={s.floor} onCommit={setFloor} ariaLabel="利润底线" disabled={running} />
<Btn t={running ? 'AI报价策略生成中…' : 'AI报价策略'} onClick={startStrategyAI} disabled={!s.report || running} cls="primary" />
</div>
</div>
<CompetitorQuoteForm />
</div>
<textarea
style={{ width: '100%', height: 70 }}
aria-label="当前项目要求"
disabled={running}
defaultValue={s.context}
key={s.context}
onBlur={(e) => { if (e.target.value !== s.context) setContext(e.target.value) }}
/>
<StrategyAIFlow />
{reveal >= 1 && (
<div className="strategy-revealed">
<Notice t="离线AI采用透明规则生成建议,项目补充信息原文附入审批。不会声称已理解任意文本或调用外部大模型。" />
<div className="grid3">
{cases.map((x, i) =>
i < 2 ? (
<button key={i} type="button" className="file-card history-case-button"
onClick={() => openModal('case', '历史案例 ' + (i === 0 ? 'H01' : 'H02') + ' / 完整项目参考', i === 0 ? 'H01' : 'H02')}
title="双击查看完整模拟案例">
<b>{x[0]}</b>
<p>{x[1]}<br />{x[2]}</p>
<span className="history-case-hint">双击查看完整信息 ↗</span>
</button>
) : (
<div className="file-card" key={i}><b>{x[0]}</b><p>{x[1]}<br />{x[2]}</p></div>
),
)}
</div>
</div>
)}
</div>
{reveal >= 2 && (
<div className="grid3 strategies section">
{st.map((a, i) => (
<div key={i} data-strategy-index={i} style={{ display: reveal < i + 2 ? 'none' : undefined }}
className={'panel ' + (s.selected === i ? 'selected' : '')}>
<span className={'chip ' + (a.valid ? 'green' : 'red')}>{a.valid ? '达到利润底线' : '低于底线 · 禁止审批'}</span>
<h2 className="section">{a.label}</h2>
<div className="price">¥ {money(a.price)}</div>
<small className="muted">项目不含税总价 / {s.project.sets}套</small>
<div className="formrow">目标利润率% <NumInput v={s.targets[i]} onCommit={(v) => setTarget(i, v)} ariaLabel={a.label + '目标利润率'} disabled={running} /></div>
<p>实际利润率 <b>{a.margin.toFixed(2)}%</b><br />项目利润 <b>{money(a.profit)}元</b><br />含税总额 <b>{money(a.price * (1 + s.tax / 100))}元</b></p>
<p>{a.reason}</p>
<Btn t={s.selected === i ? '✓ 已选择' : '选择此方案'} onClick={() => selectStrategy(i)} disabled={!s.report || !a.valid} cls="primary" />
</div>
))}
</div>
)}
{reveal >= 5 && (
<div className="strategy-revealed">
<div className="panel section">
<h2>内部策略审批</h2>
<p>当前选择:{st[s.selected].label};成本版本 V{s.revision};项目补充说明:{s.context}</p>
<Notice t="审批模拟角色:经营负责人。成本、询价、利润率或策略修改后,既有审批自动失效。" />
<Btn t={s.approved ? '✓ 策略已批准' : '批准选定策略'} onClick={approve} cls="primary"
disabled={!s.report || !s.review || !st[s.selected].valid || s.approved} />{' '}
<Btn t="驳回策略" onClick={rejectStrategy} disabled={!s.report} />{' '}
<Btn t="生成正式报价单 →" onClick={() => go(6)} disabled={!s.approved} />
</div>
</div>
)}
</>
)
}
// ============ 6 正式报价单 ============
export function Quote() {
const { s, go, archiveQuotation, quotationIsArchived, openModal } = useApp()
const archived = quotationIsArchived()
if (!s.approved) {
return (
<div className="panel">
<h2>报价单待解锁</h2>
<Notice cls="warn" t="需完成技术清单、两部门询价、经营确认、成本报告及策略内部审批后生成报价单。" />
<div className="actions"><Btn t="前往策略审批" onClick={() => go(5)} cls="primary" /></div>
</div>
)
}
const exportQuote = () => {
const blob = new Blob([
`<!doctype html><html lang="zh"><meta charset="utf-8"><title>报价单</title><style>body{font:15px/1.8 'Microsoft YaHei';padding:40px;color:#24324b}h1{text-align:center}table{width:100%;border-collapse:collapse}td,th{border:1px solid #ddd;padding:12px}.right{text-align:right}.quote-brand{font-size:22px;border-bottom:3px solid #5747ef}</style>`,
quoteHTML(s),
`</html>`,
], { type: 'text/html;charset=utf-8' })
const a = document.createElement('a')
a.href = URL.createObjectURL(blob)
a.download = '武船_正式报价样张_V' + s.revision + '.html'
a.click()
setTimeout(() => URL.revokeObjectURL(a.href), 1000)
}
return (
<>
<div className="panel noprint" style={{ marginBottom: 18 }}>
<div className="panel-head">
<h2>✓ 已批准,可生成对客报价样张</h2>
<div className="actions">
<Btn t="打印 / 保存为PDF" onClick={() => window.print()} cls="primary" />
<Btn t="下载报价单HTML" onClick={exportQuote} />
</div>
</div>
<p>审批时间:{s.approvedAt} · V{s.revision} · 对客单据不展示内部成本与利润。</p>
</div>
<div className="actions quotation-library-actions noprint">
<Btn t={archived ? '✓ 已进入报价信息库' : '进入报价信息库'} onClick={archiveQuotation} disabled={archived}
cls={archived ? 'quotation-archived' : ''} />
<Btn t="查询历史报价信息库" onClick={() => openModal('library', '历史报价信息库 / AI智能体工作台')} cls="primary" />
</div>
<div dangerouslySetInnerHTML={{ __html: quoteHTML(s) }} />
</>
)
}
export const VIEWS = [Home, Demand, Lists, Inquiry, Cost, Strategy, Quote]
+14
View File
@@ -0,0 +1,14 @@
import type { ModuleConfig } from '../registry';
export const moduleConfig: ModuleConfig = {
id: 'wuc-quotation',
name: '武船AI智能报价平台',
description: '武昌船舶重工 AI 智能报价 DEMO:需求解析、物量清单分析、部门核价、报价生成与策略审批全流程',
icon: 'FileSpreadsheet',
path: '/wuc-quotation',
accentColor: '#7C6FFF',
accentColorLight: '#5747EF',
gradient: 'linear-gradient(135deg, #1b1840, #2e2870, #5747EF)',
gradientLight: 'linear-gradient(135deg, #efecff, #e3ddff, #d2caff)',
tags: ['智能报价', '成本核价', '策略审批'],
};
File diff suppressed because one or more lines are too long
+1
View File
@@ -0,0 +1 @@
.wuc-root header{height:80px}.wuc-root .app-shell{min-height:calc(100vh - 80px)}.wuc-root aside{width:218px}.wuc-root main{padding:24px 28px}.wuc-root .big{font-size:34px;font-weight:700;letter-spacing:-1px}.wuc-root .kicker{color:var(--accent);font-size:11px;letter-spacing:2px}.wuc-root .section{margin-top:18px}.wuc-root .table-scroll input{width:92px;padding:5px}.wuc-root .table-scroll input.wide{width:175px}.wuc-root .panel p{color:var(--muted)}.wuc-root .flow{display:grid;grid-template-columns:repeat(3,1fr);gap:14px}.wuc-root .flow button{padding:24px;text-align:left}.wuc-root .flow b{font-size:17px;display:block;margin:8px 0}.wuc-root .flow small{color:var(--muted)}.wuc-root .badge{border-radius:20px;padding:3px 10px;background:var(--accent-soft);color:var(--accent);font-size:11px}.wuc-root .hero-grid{display:grid;grid-template-columns:1.6fr 1fr;gap:30px}.wuc-root .blueprint{height:200px;width:100%;background:#263858;border-radius:10px}.wuc-root .ai{border:1px solid #c6bfff;background:linear-gradient(120deg,var(--panel),var(--accent-soft))}.wuc-root .price{font-size:32px;color:var(--accent);margin:15px 0}.wuc-root .strategies .panel.selected{border:2px solid var(--accent)}.wuc-root .formrow{display:flex;gap:15px;flex-wrap:wrap;align-items:center;margin:15px 0}.wuc-root .formrow input{width:100px}.wuc-root .good{color:var(--good)}.wuc-root .danger{color:var(--red)}.wuc-root .right{text-align:right}.wuc-root .audit{max-height:320px;overflow:auto}.wuc-root .quote-paper{background:white;color:#1d2943;padding:42px;max-width:960px;margin:auto;border:1px solid #ddd}.wuc-root .quote-paper p{color:#48556b}.wuc-root .quote-paper h1{text-align:center;font-size:28px}.wuc-root .quote-paper .quote-brand{font-size:18px;border-bottom:3px solid #5747ef;padding-bottom:18px;margin-bottom:28px}.wuc-root .previewtext{white-space:pre-wrap;max-height:250px;overflow:auto;background:var(--soft);padding:15px;font:12px/1.7 Consolas,monospace}.wuc-root .chartrow{display:grid;grid-template-columns:110px 1fr 100px;gap:15px;align-items:center;margin:16px 0}.wuc-root .bar{height:12px;background:var(--accent-soft);border-radius:10px;overflow:hidden}.wuc-root .bar i{display:block;background:var(--accent);height:100%}.wuc-root .subtabs{margin:15px 0}.wuc-root .notice{font-size:13px}.wuc-root .rail{display:flex;gap:7px;flex-wrap:wrap;margin-bottom:20px}.wuc-root .rail button{font-size:12px}.wuc-root .pending{color:var(--warn)}.wuc-root .doclinks a{display:block;margin:9px 0}.wuc-root .themebtn{margin-left:10px}@media print{.wuc-root header,.wuc-root aside,.wuc-root #titlebar,.wuc-root .rail,.wuc-root .noprint,.wuc-root footer,.wuc-root #toast{display:none!important}.wuc-root main{padding:0}.wuc-root .quote-paper{border:0;padding:0}.wuc-root{background:white}.wuc-root .app-shell{display:block}}@media(max-width:1100px){.wuc-root .hero-grid{grid-template-columns:1fr}.wuc-root .hero-grid svg{display:none}.wuc-root .flow{grid-template-columns:1fr 1fr}.wuc-root .grid3{grid-template-columns:1fr}.wuc-root .head-status{display:none}}
+2
View File
@@ -0,0 +1,2 @@
.wuc-root>header{position:sticky;top:0;z-index:40;background-color:var(--bg)}
@media print{.wuc-root>header{position:static;top:auto;z-index:auto}}
+1
View File
@@ -0,0 +1 @@
.wuc-root #rail.rail{display:block;margin-bottom:20px;padding:14px 16px;background:var(--panel);border:1px solid var(--line);border-radius:10px;overflow-x:auto}.wuc-root .workflow-progress{list-style:none;display:flex;align-items:center;gap:0;margin:0;padding:0;min-width:1070px}.wuc-root .workflow-progress-item{display:flex;align-items:center;flex:1;min-width:0}.wuc-root .workflow-progress-item:last-child{flex:0 0 auto}.wuc-root .workflow-progress-button{display:grid;grid-template-columns:30px auto;column-gap:8px;row-gap:3px;align-items:center;background:transparent;border:0;border-radius:7px;text-align:left;padding:5px 4px;white-space:nowrap;color:var(--muted)}.wuc-root #rail .workflow-progress-button{font-size:12px}.wuc-root #rail .workflow-progress-button:hover{background:var(--accent-soft);border-color:transparent}.wuc-root .workflow-step-circle{grid-row:1/3;display:grid;place-items:center;width:30px;height:30px;border-radius:50%;background:var(--line);color:var(--muted);font-size:15px;font-weight:700;transition:background .35s,color .35s,box-shadow .35s}.wuc-root .workflow-step-name{font-size:12px;font-weight:600;line-height:1.35}.wuc-root .workflow-step-state{font-size:9px;color:var(--muted);line-height:1.4;font-weight:400}.wuc-root .workflow-connector{display:block;flex:1;min-width:14px;max-width:52px;height:3px;background:var(--line);margin:0 10px;border-radius:4px;overflow:hidden}.wuc-root .workflow-connector i{display:block;width:100%;height:100%;background:var(--good);transform:scaleX(0);transform-origin:left;transition:transform .65s ease}.wuc-root .is-complete .workflow-step-circle{background:var(--good);color:white}.wuc-root .is-complete .workflow-step-name{color:var(--good)}.wuc-root .is-complete .workflow-connector i{transform:scaleX(1)}.wuc-root .is-current:not(.is-complete) .workflow-step-circle{background:var(--accent);color:white;box-shadow:0 0 0 5px var(--accent-soft)}.wuc-root .is-current:not(.is-complete) .workflow-step-name{color:var(--accent)}.wuc-root .is-current.is-complete .workflow-step-circle{box-shadow:0 0 0 4px #00896717}.wuc-root .is-current .workflow-step-state{color:var(--ink)}.wuc-root .is-running .workflow-step-circle{animation:workflowPulse 1.8s ease-in-out infinite}.wuc-root .just-completed .workflow-step-circle{animation:workflowDone .55s ease both}.wuc-root .just-completed .workflow-connector i{animation:workflowConnect .7s ease both}@keyframes workflowPulse{50%{box-shadow:0 0 0 7px #5747ef16}}@keyframes workflowDone{0%{transform:scale(.7);opacity:.5}70%{transform:scale(1.12)}100%{transform:scale(1);opacity:1}}@keyframes workflowConnect{from{transform:scaleX(0)}to{transform:scaleX(1)}}@media(max-width:900px){.wuc-root #rail.rail{padding:12px 10px}.wuc-root .workflow-progress{min-width:1030px}}@media(prefers-reduced-motion:reduce){.wuc-root .workflow-step-circle,.wuc-root .workflow-connector i{animation:none!important;transition:none}}@media print{.wuc-root #rail.rail{display:none!important}}
+1
View File
@@ -0,0 +1 @@
.wuc-root .strategy-input-grid{display:grid;grid-template-columns:minmax(300px,.9fr) minmax(420px,1.1fr);gap:24px;align-items:start;margin-bottom:14px}.wuc-root .strategy-input-main>p{font-size:12px;color:var(--muted)}.wuc-root .competitor-quote-panel{padding:16px;border:1px solid var(--line);background:var(--soft);border-radius:10px}.wuc-root .competitor-quote-panel .panel-head{margin-bottom:10px}.wuc-root .competitor-quote-panel h3{margin:0}.wuc-root .competitor-fields{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:8px 10px}.wuc-root .competitor-fields label{display:grid;gap:4px;color:var(--muted);font-size:10px}.wuc-root .competitor-fields input,.wuc-root .competitor-fields select{width:100%;min-width:0;padding:6px 8px;font-size:11px}.wuc-root .competitor-scope{display:flex;gap:6px;align-items:center;font-size:11px;margin:12px 0}.wuc-root .competitor-scope input{flex-shrink:0}.wuc-root .competitor-status{font-size:10px;line-height:1.7;color:var(--muted);margin:10px 0 0}.wuc-root .competitor-status.matched{color:var(--good)}@media(max-width:1200px){.wuc-root .strategy-input-grid{grid-template-columns:1fr}.wuc-root .competitor-fields{grid-template-columns:repeat(4,minmax(0,1fr))}}@media(max-width:650px){.wuc-root .competitor-fields{grid-template-columns:repeat(2,minmax(0,1fr))}}
+2 -1
View File
@@ -1,6 +1,6 @@
import { useEffect, useState } from 'react'; import { useEffect, useState } from 'react';
import { useNavigate, useSearchParams } from 'react-router-dom'; import { useNavigate, useSearchParams } from 'react-router-dom';
import { BrainCircuit, Calculator, Network, Boxes, ReceiptText, CalendarClock, Sparkles, LogOut, Radar, ShieldCheck, ClipboardCheck, Building2 } from 'lucide-react'; import { BrainCircuit, Calculator, Network, Boxes, ReceiptText, CalendarClock, Sparkles, LogOut, Radar, ShieldCheck, ClipboardCheck, Building2, FileSpreadsheet } from 'lucide-react';
import { useTheme } from '@/shared/context/ThemeContext'; import { useTheme } from '@/shared/context/ThemeContext';
import StarBackground from '@/shared/components/StarBackground'; import StarBackground from '@/shared/components/StarBackground';
import ThemeToggle from '@/shared/components/ThemeToggle'; import ThemeToggle from '@/shared/components/ThemeToggle';
@@ -19,6 +19,7 @@ const ICON_MAP: Record<string, React.ComponentType<{ size?: number; color?: stri
ShieldCheck, ShieldCheck,
ClipboardCheck, ClipboardCheck,
Building2, Building2,
FileSpreadsheet,
}; };
export default function HomePage() { export default function HomePage() {