Merge branch 'dev' into test
# Conflicts: # docker-compose.yml # frontend/src/locales/en/errors.json # frontend/src/locales/th/errors.json # frontend/src/locales/zh-CN/errors.json # frontend/src/locales/zh-TW/errors.json
No files matched your search
@@ -54,7 +54,7 @@ frontend/src/
|
||||
locales/ # i18n 四语言 JSON(zh-CN / zh-TW / en / th),按域拆分
|
||||
scripts/ # 部署与运维脚本(deploy_compose.sh、healthcheck.sh ...)
|
||||
docs/ # 权威文档(规范、上下文、流程、发布说明)
|
||||
# features/ 业务域手册 · platform/ 平台设计 · prototype/ 产品原型
|
||||
# features/ 业务域手册(含域内原型)· platform/ 平台设计(含跨域原型)
|
||||
# convention/ · openapi/ · dify/ · refactor/
|
||||
```
|
||||
|
||||
|
||||
@@ -44,16 +44,14 @@ services:
|
||||
- KB_TASK_EXECUTION_MODE=${KB_TASK_EXECUTION_MODE:-worker}
|
||||
- KB_WORKER_POLL_SECONDS=${KB_WORKER_POLL_SECONDS:-2}
|
||||
# kb-worker 自动回收长时间 running 的任务(秒)
|
||||
<<<<<<< HEAD
|
||||
- KB_JOB_RUNNING_TIMEOUT_SECONDS=${KB_JOB_RUNNING_TIMEOUT_SECONDS:-900}
|
||||
- KB_JOB_RUNNING_TIMEOUT_SECONDS=${KB_JOB_RUNNING_TIMEOUT_SECONDS:-1200}
|
||||
|
||||
# 采购合同异步审核:清洗产物与任务/模型输入保护
|
||||
- PROCUREMENT_CONTRACT_STORAGE_ROOT=${PROCUREMENT_CONTRACT_STORAGE_ROOT:-/app/data/procurement_contract}
|
||||
- PROCUREMENT_CONTRACT_JOB_TIMEOUT_SECONDS=${PROCUREMENT_CONTRACT_JOB_TIMEOUT_SECONDS:-600}
|
||||
- PROCUREMENT_CONTRACT_LLM_MAX_TEXT_CHARS=${PROCUREMENT_CONTRACT_LLM_MAX_TEXT_CHARS:-120000}
|
||||
- PROCUREMENT_CONTRACT_LLM_MAX_CLAUSES=${PROCUREMENT_CONTRACT_LLM_MAX_CLAUSES:-160}
|
||||
=======
|
||||
- KB_JOB_RUNNING_TIMEOUT_SECONDS=${KB_JOB_RUNNING_TIMEOUT_SECONDS:-1200}
|
||||
>>>>>>> e7ff6bc2 (fix(platform): 汇总知识库问答与图表展示修复)
|
||||
|
||||
# LibreOffice 可执行文件路径(Linux 容器默认 /usr/bin/soffice,跳过 Windows 路径探测)
|
||||
- EDKB_SOFFICE=${EDKB_SOFFICE:-/usr/bin/soffice}
|
||||
# LibreOffice 单次格式转换超时(秒)
|
||||
@@ -122,16 +120,14 @@ services:
|
||||
- KB_TASK_EXECUTION_MODE=${KB_TASK_EXECUTION_MODE:-worker}
|
||||
- KB_WORKER_POLL_SECONDS=${KB_WORKER_POLL_SECONDS:-2}
|
||||
# kb-worker 自动回收长时间 running 的任务(秒)
|
||||
<<<<<<< HEAD
|
||||
- KB_JOB_RUNNING_TIMEOUT_SECONDS=${KB_JOB_RUNNING_TIMEOUT_SECONDS:-900}
|
||||
- KB_JOB_RUNNING_TIMEOUT_SECONDS=${KB_JOB_RUNNING_TIMEOUT_SECONDS:-1200}
|
||||
|
||||
# 采购合同异步审核:Worker 与后端必须指向同一持久化目录
|
||||
- PROCUREMENT_CONTRACT_STORAGE_ROOT=${PROCUREMENT_CONTRACT_STORAGE_ROOT:-/app/data/procurement_contract}
|
||||
- PROCUREMENT_CONTRACT_JOB_TIMEOUT_SECONDS=${PROCUREMENT_CONTRACT_JOB_TIMEOUT_SECONDS:-600}
|
||||
- PROCUREMENT_CONTRACT_LLM_MAX_TEXT_CHARS=${PROCUREMENT_CONTRACT_LLM_MAX_TEXT_CHARS:-120000}
|
||||
- PROCUREMENT_CONTRACT_LLM_MAX_CLAUSES=${PROCUREMENT_CONTRACT_LLM_MAX_CLAUSES:-160}
|
||||
=======
|
||||
- KB_JOB_RUNNING_TIMEOUT_SECONDS=${KB_JOB_RUNNING_TIMEOUT_SECONDS:-1200}
|
||||
>>>>>>> e7ff6bc2 (fix(platform): 汇总知识库问答与图表展示修复)
|
||||
|
||||
# LibreOffice 可执行文件路径(Linux 容器默认 /usr/bin/soffice,跳过 Windows 路径探测)
|
||||
- EDKB_SOFFICE=${EDKB_SOFFICE:-/usr/bin/soffice}
|
||||
# LibreOffice 单次格式转换超时(秒)
|
||||
|
||||
@@ -2,9 +2,8 @@
|
||||
|
||||
| 目录 | 用途 |
|
||||
| --- | --- |
|
||||
| [features/](features/README.md) | **业务域**落地手册(部署、Dify、API、运维) |
|
||||
| [platform/](platform/README.md) | **平台级**设计(Agent 注册、多运行时、Registry) |
|
||||
| [prototype/](prototype/) | **产品原型**(评审、验收;实现前) |
|
||||
| [features/](features/README.md) | **业务域**落地手册(部署、Dify、API、运维;**产品原型随域同目录**) |
|
||||
| [platform/](platform/README.md) | **平台级**设计与跨域原型(Agent 注册、进度底座、Runtime Context) |
|
||||
| [convention/](convention/) | 开发规范(提交、错误处理、环境变量、发布流程等) |
|
||||
| [skills/](skills/README.md) | Cursor Agent Skills 团队说明([i18n](skills/add-i18n-keys-skill.md)、[发布说明](skills/release-notes-skill.md)) |
|
||||
| [openapi/](openapi/) | Dify / 集成 OpenAPI 契约 |
|
||||
|
||||
@@ -1,20 +1,23 @@
|
||||
# 业务域文档(features)
|
||||
|
||||
按 **业务域** 组织已落地或正在落地的功能手册;**实现状态**见 [funclist.md](../funclist.md),**产品原型**见 [prototype/](../prototype/)。
|
||||
按 **业务域** 组织已落地或正在落地的功能手册;**产品原型与该域文档同目录**。**实现状态**见 [funclist.md](../funclist.md)。
|
||||
|
||||
| 域 | 说明 | 入口 |
|
||||
| --- | --- | --- |
|
||||
| [auth](auth/README.md) | Casdoor 登录与产品内平级服务无感登录 | [hxops-peer-service-sso.md](auth/hxops-peer-service-sso.md) |
|
||||
| [shipping-notice](shipping-notice/README.md) | 货代发货通知 Agent | [technical.md](shipping-notice/technical.md) |
|
||||
| [shipping-notice](shipping-notice/README.md) | 货代发货通知 Agent | [technical.md](shipping-notice/technical.md) · [原型](shipping-notice/shipping_notice_agent_prototype.md) |
|
||||
| [file-check](file-check/README.md) | 文件检核(RoHS / MSDS 等) | [technical.md](file-check/technical.md) |
|
||||
| [accounting-voucher-check](accounting-voucher-check/README.md) | 立账凭证资料存在性检核 Agent | [需求与规格](accounting-voucher-check/technical.md) · [技术设计](accounting-voucher-check/technical-design.md) |
|
||||
| [accounting-voucher-check](accounting-voucher-check/README.md) | 立账凭证资料存在性检核 Agent | [需求与规格](accounting-voucher-check/technical.md) · [技术设计](accounting-voucher-check/technical-design.md) · [原型](accounting-voucher-check/accounting-voucher-check-prototype.html) |
|
||||
| [fixed-assets](fixed-assets/README.md) | 固资快照同步与本地查询 | [technical.md](fixed-assets/technical.md) · [履历挂载命令](fixed-assets/history-share-mount.md) |
|
||||
| [procurement-contract](procurement-contract/README.md) | 采购合同审查 Agent(模板比对 / 单份审核) | [用户操作手册](procurement-contract/用户操作手册.md) · [demand.md](procurement-contract/demand.md) · [comprehensive-review-technical.md](procurement-contract/comprehensive-review-technical.md) · [原型](../prototype/procurement-contract-review-prototype.html) |
|
||||
| [procurement-contract](procurement-contract/README.md) | 采购合同审查 Agent(模板比对 / 单份审核) | [用户操作手册](procurement-contract/用户操作手册.md) · [demand.md](procurement-contract/demand.md) · [comprehensive-review-technical.md](procurement-contract/comprehensive-review-technical.md) · [原型](procurement-contract/procurement-contract-review-prototype.html) |
|
||||
| [contract-payment-plan](contract-payment-plan/) | 合同付款计划 / 预警 Agent | [方案 V3](contract-payment-plan/contract-payment-warning-proposal-v3.md) · [原型](contract-payment-plan/contract-payment-plan-workspace-prototype-v2.html) |
|
||||
| [equipment-maintenance](equipment-maintenance/README.md) | 设备维保助手 | [聊天原型](equipment-maintenance/equipment-maintenance-agent-chat-lofi.html) |
|
||||
|
||||
**平台级**设计(跨域)见 [platform/](../platform/README.md)。
|
||||
**平台级**设计与跨域原型见 [platform/](../platform/README.md)。
|
||||
|
||||
**约定**
|
||||
|
||||
- 每域 `technical.md`:部署、API、Dify、运维(研发权威)
|
||||
- 可选 `business.md`:业务人员操作说明
|
||||
- **产品原型**(`*-prototype.html` / `*_prototype.md`)放在对应域目录,不单独维护 `docs/prototype/`
|
||||
- 域内补充方案放同目录,不拆到 `docs/` 根目录
|
||||
@@ -7,8 +7,8 @@
|
||||
| **迁移与部署验收清单** | 研发、运维、测试 | [ops-checklist.md](ops-checklist.md) |
|
||||
| **Dify Chatflow 编排草稿** | 研发、Dify | [dify-chatflow-draft.md](dify-chatflow-draft.md) |
|
||||
| **查询 Tool OpenAPI** | Dify | 在线 `GET /api/accounting-voucher-check/tools/openapi.json`;静态 [../../openapi/accounting_voucher_check_tools_openapi.json](../../openapi/accounting_voucher_check_tools_openapi.json) |
|
||||
| **交互原型** | 产品、业务、测试 | [../../prototype/accounting-voucher-check-prototype.html](../../prototype/accounting-voucher-check-prototype.html) |
|
||||
| **原型速览** | 产品、测试 | [../../prototype/accounting-voucher-check-prototype.md](../../prototype/accounting-voucher-check-prototype.md) |
|
||||
| **交互原型** | 产品、业务、测试 | [accounting-voucher-check-prototype.html](accounting-voucher-check-prototype.html) |
|
||||
| **原型速览** | 产品、测试 | [accounting-voucher-check-prototype.md](accounting-voucher-check-prototype.md) |
|
||||
|
||||
**定位**:以企业 AI 工作台**对话为主入口**,**日批为主、会话可手动触发**。
|
||||
**要解决的问题**:审计/复核时按发票号**快速确认共享盘配套资料在不在**(核价单、采购单等)。
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<!doctype html>
|
||||
<!doctype html>
|
||||
<!--
|
||||
docs/prototype/accounting-voucher-check-prototype.html
|
||||
docs/features/accounting-voucher-check/accounting-voucher-check-prototype.html
|
||||
用途:立账凭证检核 Agent 低保真原型——对话为主入口、日批为主;只查共享盘材料是否存在,不做字段吻合。
|
||||
依赖:浏览器原生 HTML/CSS/JavaScript,无需构建;用于产品/业务评审。
|
||||
逻辑:顶栏切换「会话 / 检核记录 / 共享盘材料 / 缺资料通知」;
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
> **维护说明**:本文件为立账凭证检核域的权威手册,分为“业务需求”和“实现规格”两部分。本文明确一期的业务边界、数据口径、目录规则、判定规则、失败处理和验收要求;Chatflow / Tool API 的接口细节待正式开发时补充。
|
||||
>
|
||||
> **交互原型**:[accounting-voucher-check-prototype.html](../../prototype/accounting-voucher-check-prototype.html) · [原型速览](../../prototype/accounting-voucher-check-prototype.md)
|
||||
> **交互原型**:[accounting-voucher-check-prototype.html](accounting-voucher-check-prototype.html) · [原型速览](accounting-voucher-check-prototype.md)
|
||||
>
|
||||
> **相近域参考**:交互壳与 `async_batch` 进度卡对齐 [文件检核(MSDS/RoHS)](../file-check/technical.md);共享盘挂载思路对齐 [固资履历](../fixed-assets/history-share-mount.md)。
|
||||
|
||||
@@ -30,8 +30,8 @@
|
||||
| 文档版本 | v0.3(业务需求与实现规格;仅材料存在性,不做字段吻合) |
|
||||
| 读者 | 产品负责人、财务/立账业务、研发评审、测试验收 |
|
||||
| 产品名称 | 立账凭证检核 Agent |
|
||||
| 交互原型 | [accounting-voucher-check-prototype.html](../../prototype/accounting-voucher-check-prototype.html) |
|
||||
| 进度底座 | [Agent 进度管理原型](../../prototype/agent_progress_prototype.md)(`view_type=async_batch`) |
|
||||
| 交互原型 | [accounting-voucher-check-prototype.html](accounting-voucher-check-prototype.html) |
|
||||
| 进度底座 | [Agent 进度管理原型](../../platform/agent_progress_prototype.md)(`view_type=async_batch`) |
|
||||
|
||||
---
|
||||
|
||||
@@ -205,7 +205,7 @@ flowchart TB
|
||||
|
||||
##### 2.1.2 与工作台进度通用底座的关系
|
||||
|
||||
本 Agent 进度属于 **`async_batch`** 视图,协议见 [agent_progress_prototype.md](../../prototype/agent_progress_prototype.md)。相对 RoHS/MSDS:本域是**资料齐套扫描**(非字段合规检核);进度卡强化「跳过」与「当月总数 / 本次待检」;无 ERP 回写、无字段吻合。
|
||||
本 Agent 进度属于 **`async_batch`** 视图,协议见 [agent_progress_prototype.md](../../platform/agent_progress_prototype.md)。相对 RoHS/MSDS:本域是**资料齐套扫描**(非字段合规检核);进度卡强化「跳过」与「当月总数 / 本次待检」;无 ERP 回写、无字段吻合。
|
||||
|
||||
#### 2.2 核心功能清单
|
||||
|
||||
@@ -401,8 +401,8 @@ flowchart TD
|
||||
|------|------|
|
||||
| 本 Part1 | `docs/features/accounting-voucher-check/technical.md` |
|
||||
| 域 README | `docs/features/accounting-voucher-check/README.md` |
|
||||
| HTML 原型 | `docs/prototype/accounting-voucher-check-prototype.html` |
|
||||
| 原型速览 | `docs/prototype/accounting-voucher-check-prototype.md` |
|
||||
| HTML 原型 | `docs/features/accounting-voucher-check/accounting-voucher-check-prototype.html` |
|
||||
| 原型速览 | `docs/features/accounting-voucher-check/accounting-voucher-check-prototype.md` |
|
||||
|
||||
#### 6.2 已确认决策
|
||||
|
||||
|
||||
|
After Width: | Height: | Size: 53 KiB |
|
After Width: | Height: | Size: 55 KiB |
|
After Width: | Height: | Size: 63 KiB |
|
After Width: | Height: | Size: 53 KiB |
|
After Width: | Height: | Size: 64 KiB |
|
After Width: | Height: | Size: 50 KiB |
|
After Width: | Height: | Size: 59 KiB |
@@ -0,0 +1,828 @@
|
||||
<!doctype html>
|
||||
<!--
|
||||
docs/features/contract-payment-plan/contract-payment-plan-workspace-prototype-v2.html
|
||||
用途:采购合同「付款计划 / 节点预警」工作台低保真原型——列表、详情时间线、新建、企微提醒卡片。
|
||||
依赖:浏览器原生 HTML/CSS/JavaScript,无需构建;双击或用本地静态服务打开即可评审。
|
||||
逻辑:左侧模拟工作台导航;主区在「我的付款计划 / 计划详情 / 新建计划 / 企微卡片」间切换;
|
||||
示例数据含煜英合同 5203-2607180001;支持筛选、登记事件重算到期日、标记已付、模拟企微跳转。
|
||||
-->
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<title>付款计划 · 工作台原型</title>
|
||||
<style>
|
||||
:root {
|
||||
--bg: #f7f9fc; --panel: #ffffff; --line: #d8e0ec; --line-strong: #a7b3c5;
|
||||
--text: #172033; --muted: #667792; --brand: #2f80d1; --brand-soft: #eaf4ff;
|
||||
--success: #067647; --success-soft: #ecfdf3; --warning: #b54708; --warning-soft: #fffaeb;
|
||||
--danger: #b42318; --danger-soft: #fef3f2; --info: #175cd3; --info-soft: #eff8ff;
|
||||
--shadow: 0 14px 36px rgba(23, 32, 51, 0.08);
|
||||
}
|
||||
* { box-sizing: border-box; }
|
||||
body { margin: 0; min-height: 100vh; background: var(--bg); color: var(--text);
|
||||
font: 14px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif; }
|
||||
button, input, select, textarea { font: inherit; }
|
||||
button { cursor: pointer; }
|
||||
.proto-bar { display: flex; align-items: center; justify-content: space-between; gap: 16px;
|
||||
padding: 10px 18px; background: #0f172a; color: #e2e8f0; flex-wrap: wrap; }
|
||||
.proto-bar strong { color: #fff; font-size: 13px; }
|
||||
.proto-meta { color: #94a3b8; font-size: 12px; margin-left: 8px; }
|
||||
.view-tabs { display: flex; gap: 6px; background: #1e293b; padding: 4px; border-radius: 10px; flex-wrap: wrap; }
|
||||
.view-tabs button { border: 0; border-radius: 8px; padding: 8px 14px; background: transparent; color: #cbd5e1; font-weight: 600; font-size: 13px; }
|
||||
.view-tabs button.active { background: var(--brand); color: #fff; }
|
||||
.shell { display: grid; grid-template-columns: 240px minmax(0, 1fr); min-height: calc(100vh - 52px); }
|
||||
.sidebar { border-right: 1px solid var(--line); background: var(--panel); padding: 18px 14px; display: flex; flex-direction: column; gap: 16px; }
|
||||
.brand-row { display: flex; align-items: center; gap: 10px; padding: 0 4px 12px; border-bottom: 1px solid var(--line); }
|
||||
.brand-mark { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--brand); color: #fff; font-weight: 800; font-size: 12px; }
|
||||
.brand-title { font-weight: 700; font-size: 14px; }
|
||||
.brand-sub { color: var(--muted); font-size: 12px; margin-top: 2px; }
|
||||
.nav-label { margin: 0 0 6px 4px; color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: 0.04em; }
|
||||
.nav-item { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; border: 1px solid transparent; border-radius: 10px; padding: 10px 12px; background: transparent; color: var(--text); font-weight: 600; font-size: 13px; text-align: left; margin-bottom: 4px; }
|
||||
.nav-item:hover { background: #f5f8fc; }
|
||||
.nav-item.active { background: var(--brand-soft); border-color: #c8dff8; color: var(--brand); }
|
||||
.nav-item .badge { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--danger-soft); color: var(--danger); font-size: 11px; font-weight: 700; display: grid; place-items: center; }
|
||||
.main { display: flex; flex-direction: column; min-width: 0; background: linear-gradient(180deg, #f4f7fb 0%, #eef3f9 100%); }
|
||||
.page { display: none; padding: 20px 24px 32px; }
|
||||
.page.active { display: block; }
|
||||
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
|
||||
.page-head h1 { margin: 0; font-size: 22px; font-weight: 700; }
|
||||
.page-head p { margin: 6px 0 0; color: var(--muted); font-size: 13px; }
|
||||
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
|
||||
.btn { height: 36px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--line); background: #fff; color: var(--text); font-weight: 650; font-size: 13px; }
|
||||
.btn:hover { border-color: var(--brand); color: var(--brand); }
|
||||
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
|
||||
.btn.primary:hover { filter: brightness(1.05); color: #fff; }
|
||||
.btn.danger { background: var(--danger-soft); border-color: #fecdca; color: var(--danger); }
|
||||
.btn.ghost { background: transparent; }
|
||||
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
|
||||
@media (max-width: 1100px) { .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } .shell { grid-template-columns: 1fr; } .sidebar { display: none; } }
|
||||
.stat-card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; box-shadow: var(--shadow); }
|
||||
.stat-card .label { color: var(--muted); font-size: 12px; font-weight: 600; }
|
||||
.stat-card .value { margin-top: 6px; font-size: 26px; font-weight: 750; letter-spacing: -0.02em; }
|
||||
.stat-card.warn .value { color: var(--warning); }
|
||||
.stat-card.danger .value { color: var(--danger); }
|
||||
.stat-card.ok .value { color: var(--success); }
|
||||
.stat-card.info .value { color: var(--info); }
|
||||
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
|
||||
.filters { display: inline-flex; gap: 4px; padding: 4px; border-radius: 999px; background: #eef2f7; border: 1px solid var(--line); flex-wrap: wrap; }
|
||||
.filters button { border: 0; border-radius: 999px; padding: 7px 12px; background: transparent; color: var(--muted); font-weight: 700; font-size: 12px; }
|
||||
.filters button.active { background: #fff; color: var(--brand); box-shadow: 0 1px 4px rgba(23, 32, 51, 0.08); }
|
||||
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); overflow: hidden; }
|
||||
table { width: 100%; border-collapse: collapse; }
|
||||
th, td { padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
|
||||
th { background: #f8fbff; color: var(--muted); font-size: 12px; font-weight: 700; }
|
||||
tr:last-child td { border-bottom: 0; }
|
||||
tbody tr { cursor: pointer; }
|
||||
tbody tr:hover { background: #f8fbff; }
|
||||
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; }
|
||||
.muted { color: var(--muted); }
|
||||
.strong { font-weight: 700; }
|
||||
.pill { display: inline-flex; align-items: center; gap: 4px; height: 24px; padding: 0 8px; border-radius: 999px; font-size: 11px; font-weight: 700; white-space: nowrap; }
|
||||
.pill.ok { background: var(--success-soft); color: var(--success); }
|
||||
.pill.warn { background: var(--warning-soft); color: var(--warning); }
|
||||
.pill.danger { background: var(--danger-soft); color: var(--danger); }
|
||||
.pill.info { background: var(--info-soft); color: var(--info); }
|
||||
.pill.neutral { background: #eef2f7; color: var(--muted); }
|
||||
.empty { padding: 48px 24px; text-align: center; color: var(--muted); }
|
||||
.detail-grid { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 16px; align-items: start; }
|
||||
@media (max-width: 1100px) { .detail-grid { grid-template-columns: 1fr; } }
|
||||
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); padding: 16px 18px; }
|
||||
.card h2 { margin: 0 0 12px; font-size: 15px; font-weight: 750; }
|
||||
.meta-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 4px; }
|
||||
@media (max-width: 900px) { .meta-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
|
||||
.meta-item { padding: 10px 12px; border-radius: 10px; background: #f8fbff; border: 1px solid var(--line); }
|
||||
.meta-item .k { color: var(--muted); font-size: 11px; font-weight: 650; }
|
||||
.meta-item .v { margin-top: 4px; font-weight: 700; font-size: 13px; word-break: break-all; }
|
||||
.timeline { position: relative; display: grid; gap: 0; padding-left: 8px; }
|
||||
.tl-item { position: relative; display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 12px; padding: 0 0 18px; }
|
||||
.tl-item:last-child { padding-bottom: 0; }
|
||||
.tl-rail { position: relative; display: flex; justify-content: center; }
|
||||
.tl-rail::before { content: ""; position: absolute; top: 10px; bottom: -18px; width: 2px; background: var(--line); }
|
||||
.tl-item:last-child .tl-rail::before { display: none; }
|
||||
.tl-dot { position: relative; z-index: 1; width: 14px; height: 14px; margin-top: 6px; border-radius: 50%; border: 2px solid var(--line-strong); background: #fff; }
|
||||
.tl-item.paid .tl-dot { border-color: var(--success); background: var(--success); }
|
||||
.tl-item.due .tl-dot { border-color: var(--warning); background: var(--warning); }
|
||||
.tl-item.overdue .tl-dot { border-color: var(--danger); background: var(--danger); }
|
||||
.tl-item.pending .tl-dot { border-color: var(--brand); background: var(--brand-soft); }
|
||||
.tl-body { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; background: #fff; }
|
||||
.tl-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
|
||||
.tl-title { font-weight: 750; font-size: 14px; }
|
||||
.tl-sub { margin-top: 4px; color: var(--muted); font-size: 12px; }
|
||||
.tl-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
|
||||
.side-list { display: grid; gap: 10px; }
|
||||
.log-item { padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: #f8fbff; font-size: 12px; }
|
||||
.log-item .t { font-weight: 700; }
|
||||
.log-item .s { color: var(--muted); margin-top: 3px; }
|
||||
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
|
||||
.field { display: grid; gap: 6px; }
|
||||
.field.full { grid-column: 1 / -1; }
|
||||
.field label { font-size: 12px; font-weight: 700; color: var(--muted); }
|
||||
.field input, .field select, .field textarea { height: 38px; border: 1px solid var(--line); border-radius: 10px; padding: 0 12px; background: #fff; color: var(--text); }
|
||||
.field textarea { height: auto; min-height: 72px; padding: 10px 12px; resize: vertical; }
|
||||
.node-editor { border: 1px dashed var(--line-strong); border-radius: 12px; padding: 12px; background: #fbfdff; display: grid; gap: 10px; }
|
||||
.node-row { display: grid; grid-template-columns: 1.1fr 0.8fr 0.9fr 1.2fr 0.9fr auto; gap: 8px; align-items: end; }
|
||||
@media (max-width: 1100px) { .form-grid, .node-row { grid-template-columns: 1fr; } }
|
||||
.toast { position: fixed; right: 20px; bottom: 20px; z-index: 50; min-width: 240px; max-width: 360px; padding: 12px 14px; border-radius: 12px; background: #0f172a; color: #fff; box-shadow: var(--shadow); opacity: 0; transform: translateY(8px); pointer-events: none; transition: .2s ease; font-size: 13px; font-weight: 600; }
|
||||
.toast.show { opacity: 1; transform: translateY(0); }
|
||||
.wecom-stage { min-height: calc(100vh - 120px); display: grid; place-items: center; padding: 24px; }
|
||||
.phone { width: 360px; border-radius: 28px; background: #111827; padding: 16px 14px 22px; box-shadow: var(--shadow); }
|
||||
.phone-bar { color: #94a3b8; font-size: 12px; text-align: center; margin-bottom: 14px; }
|
||||
.wecom-card { background: #fff; border-radius: 12px; overflow: hidden; color: var(--text); }
|
||||
.wecom-card .hd { padding: 14px 16px 8px; font-weight: 750; font-size: 15px; }
|
||||
.wecom-card .bd { padding: 0 16px 14px; color: #334155; font-size: 13px; line-height: 1.55; white-space: pre-line; }
|
||||
.wecom-card .ft { border-top: 1px solid #e2e8f0; padding: 12px 16px; color: var(--brand); font-weight: 700; font-size: 13px; cursor: pointer; }
|
||||
.hint-box { margin-top: 12px; padding: 12px 14px; border-radius: 12px; background: var(--info-soft); border: 1px solid #b2ddff; color: var(--info); font-size: 12px; line-height: 1.5; }
|
||||
.detail-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 14px 0 16px; padding: 4px; width: fit-content; border: 1px solid var(--line); border-radius: 999px; background: #eef2f7; }
|
||||
.detail-tabs button { border: 0; border-radius: 999px; padding: 7px 12px; background: transparent; color: var(--muted); font-weight: 700; font-size: 12px; }
|
||||
.detail-tabs button.active { background: #fff; color: var(--brand); box-shadow: 0 1px 4px rgba(23,32,51,.08); }
|
||||
.evidence { margin-top: 12px; padding: 10px 12px; border: 1px dashed var(--line-strong); border-radius: 10px; background: #fbfdff; color: #334155; font-size: 12px; line-height: 1.55; }
|
||||
.evidence strong { color: var(--text); }
|
||||
.contract-status { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
|
||||
.modal-mask { position: fixed; inset: 0; background: rgba(15, 23, 42, 0.45); display: none; place-items: center; z-index: 40; padding: 20px; }
|
||||
.modal-mask.show { display: grid; }
|
||||
.modal { width: min(420px, 100%); background: #fff; border-radius: 14px; box-shadow: var(--shadow); padding: 18px; }
|
||||
.modal h3 { margin: 0 0 12px; font-size: 16px; }
|
||||
.modal .actions { margin-top: 16px; justify-content: flex-end; }
|
||||
</style>
|
||||
</head>
|
||||
<body> <div class="proto-bar">
|
||||
<div>
|
||||
<strong>付款计划 · 工作台原型</strong>
|
||||
<span class="proto-meta">单文件可运行 · 示例:煜英贴标线翻转设备 5203-2607180001</span>
|
||||
</div>
|
||||
<div class="view-tabs" id="topTabs">
|
||||
<button type="button" data-view="list" class="active">我的付款计划</button>
|
||||
<button type="button" data-view="contracts">合同台账</button>
|
||||
<button type="button" data-view="detail">计划详情</button>
|
||||
<button type="button" data-view="exceptions">异常待处理</button>
|
||||
<button type="button" data-view="create">新建计划</button>
|
||||
<button type="button" data-view="wecom">企微提醒卡片</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="shell">
|
||||
<aside class="sidebar">
|
||||
<div class="brand-row">
|
||||
<div class="brand-mark">HX</div>
|
||||
<div>
|
||||
<div class="brand-title">HXOPS 工作台</div>
|
||||
<div class="brand-sub">采购履约提醒</div>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<p class="nav-label">常用</p>
|
||||
<button type="button" class="nav-item" data-nav="home">应用首页</button>
|
||||
<button type="button" class="nav-item active" data-nav="payment" id="navPayment">
|
||||
<span>付款预警</span>
|
||||
<span class="badge" id="navBadge">0</span>
|
||||
</button>
|
||||
<button type="button" class="nav-item" data-nav="contracts">合同台账</button>
|
||||
<button type="button" class="nav-item" data-nav="review">异常待处理</button>
|
||||
</div>
|
||||
<div class="hint-box">
|
||||
原型说明:提醒默认提前 7 / 3 / 1 / 0 天企微推送;事件驱动节点需先登记锚点日期后才计算到期日。
|
||||
</div>
|
||||
</aside>
|
||||
|
||||
<main class="main">
|
||||
<section class="page active" id="page-list">
|
||||
<div class="page-head">
|
||||
<div>
|
||||
<h1>付款预警工作台</h1>
|
||||
<p>从合同台账进入付款节点;到期前企业微信提醒;不自动付款</p>
|
||||
</div>
|
||||
<div class="actions">
|
||||
<button type="button" class="btn" id="btnMockWecom">模拟收到企微</button>
|
||||
<button type="button" class="btn" id="btnGotoContracts">查看合同台账</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="stats" id="stats"></div>
|
||||
<div class="toolbar">
|
||||
<div class="filters" id="filters">
|
||||
<button type="button" data-filter="all" class="active">全部</button>
|
||||
<button type="button" data-filter="due_soon">即将到期</button>
|
||||
<button type="button" data-filter="overdue">逾期</button>
|
||||
<button type="button" data-filter="draft">待启用</button>
|
||||
<button type="button" data-filter="done">已完成</button>
|
||||
</div>
|
||||
<span class="muted" id="listCount">共 0 条</span>
|
||||
</div>
|
||||
<div class="panel">
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>合同编号 / 采购单号 / 供应商</th>
|
||||
<th>下一笔应付</th>
|
||||
<th>到期日</th>
|
||||
<th>计划状态</th>
|
||||
<th>负责人</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="planTable"></tbody>
|
||||
</table>
|
||||
<div class="empty" id="listEmpty" style="display:none;">当前筛选下没有付款计划</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="page" id="page-detail">
|
||||
<div class="page-head">
|
||||
<div>
|
||||
<h1 id="detailTitle">计划详情</h1>
|
||||
<p id="detailSub">节点时间线 · 登记事件 · 标记已付</p>
|
||||
</div>
|
||||
<div class="actions">
|
||||
<button type="button" class="btn" id="btnBackList">返回列表</button>
|
||||
<button type="button" class="btn" id="btnEnablePlan">启用提醒</button>
|
||||
<button type="button" class="btn primary" id="btnOpenEvent">登记事件</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="detail-grid">
|
||||
<div class="card">
|
||||
<div class="meta-grid" id="detailMeta"></div>
|
||||
<div class="detail-tabs" id="detailTabs">
|
||||
<button type="button" class="active" data-detail-tab="overview">合同概览</button>
|
||||
<button type="button" data-detail-tab="source">原文附件</button>
|
||||
<button type="button" data-detail-tab="plan">付款计划</button>
|
||||
<button type="button" data-detail-tab="alerts">预警记录</button>
|
||||
<button type="button" data-detail-tab="audit">同步审计</button>
|
||||
</div>
|
||||
<div class="evidence" id="contractEvidence"></div>
|
||||
<h2 style="margin-top:16px;">付款节点时间线</h2>
|
||||
<div class="timeline" id="timeline"></div>
|
||||
</div>
|
||||
<div class="card">
|
||||
<h2>提醒记录</h2>
|
||||
<div class="side-list" id="reminderLogs"></div>
|
||||
<div class="hint-box">正式环境由每日 09:00 排程扫描;同一节点同一提前天数只提醒一次。</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="page" id="page-contracts">
|
||||
<div class="page-head">
|
||||
<div><h1>合同台账</h1><p>OA 流程归档后获取合同、保存附件、解析状态和付款计划关联</p></div>
|
||||
<div class="actions"><button type="button" class="btn" id="btnSyncContracts">模拟同步 OA 归档合同</button></div>
|
||||
</div>
|
||||
<div class="toolbar"><div class="filters" id="contractFilters">
|
||||
<button type="button" class="active" data-contract-filter="all">全部</button>
|
||||
<button type="button" data-contract-filter="stored">已保存</button>
|
||||
<button type="button" data-contract-filter="parsed">解析通过</button>
|
||||
<button type="button" data-contract-filter="needs_review">需处理</button>
|
||||
</div><span class="muted" id="contractCount">共 0 份</span></div>
|
||||
<div class="panel"><table><thead><tr><th>合同编号 / 采购单号 / 供应商</th><th>合同金额</th><th>OA / 保存状态</th><th>解析状态</th><th>付款计划</th><th>负责人</th></tr></thead><tbody id="contractTable"></tbody></table><div class="empty" id="contractEmpty" style="display:none">当前没有合同</div></div>
|
||||
</section>
|
||||
|
||||
<section class="page" id="page-exceptions">
|
||||
<div class="page-head"><div><h1>异常待处理</h1><p>仅展示无法自动确定付款计划的少量合同,不要求逐份人工确认</p></div></div>
|
||||
<div class="panel"><table><thead><tr><th>合同编号 / 采购单号</th><th>异常等级</th><th>问题</th><th>影响节点</th><th>建议动作</th></tr></thead><tbody id="exceptionTable"></tbody></table></div>
|
||||
</section>
|
||||
|
||||
<section class="page" id="page-create">
|
||||
<div class="page-head">
|
||||
<div>
|
||||
<h1>新建付款计划</h1>
|
||||
<p>手工录入节点;保存草稿后可再确认启用提醒</p>
|
||||
</div>
|
||||
<div class="actions">
|
||||
<button type="button" class="btn" id="btnCancelCreate">取消</button>
|
||||
<button type="button" class="btn" id="btnSaveDraft">保存草稿</button>
|
||||
<button type="button" class="btn primary" id="btnSaveEnable">保存并启用提醒</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card">
|
||||
<div class="form-grid">
|
||||
<div class="field"><label>合同号</label><input id="fContractNo" placeholder="如 5203-2607180001" /></div>
|
||||
<div class="field"><label>采购单号</label><input id="fPurchaseOrderNo" placeholder="如 PO-260718-0036" /></div>
|
||||
<div class="field"><label>供应商</label><input id="fSupplier" placeholder="卖方名称" /></div>
|
||||
<div class="field"><label>合同总价(元)</label><input id="fTotal" type="number" placeholder="24000" /></div>
|
||||
<div class="field"><label>负责人</label><input id="fOwner" value="张采购" /></div>
|
||||
<div class="field full"><label>备注</label><textarea id="fRemark" placeholder="可选:交货地址、技术协议编号等"></textarea></div>
|
||||
</div>
|
||||
<h2 style="margin:18px 0 10px;font-size:15px;">付款节点</h2>
|
||||
<div class="node-editor">
|
||||
<div id="nodeRows"></div>
|
||||
<div>
|
||||
<button type="button" class="btn" id="btnAddNode">+ 添加节点</button>
|
||||
<button type="button" class="btn ghost" id="btnFillYuying">填入煜英示例</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="page" id="page-wecom">
|
||||
<div class="page-head">
|
||||
<div>
|
||||
<h1>企业微信提醒(模拟)</h1>
|
||||
<p>正式环境为应用 textcard,点击「查看详情」跳转工作台计划页</p>
|
||||
</div>
|
||||
<div class="actions">
|
||||
<button type="button" class="btn primary" id="btnWecomToDetail">查看详情</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="wecom-stage">
|
||||
<div class="phone">
|
||||
<div class="phone-bar">企业微信 · 应用消息</div>
|
||||
<div class="wecom-card">
|
||||
<div class="hd" id="wecomTitle">付款节点提醒</div>
|
||||
<div class="bd" id="wecomBody"></div>
|
||||
<div class="ft" id="wecomJump">查看详情</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</main>
|
||||
</div>
|
||||
|
||||
<div class="modal-mask" id="eventModal">
|
||||
<div class="modal">
|
||||
<h3>登记履约事件</h3>
|
||||
<div class="form-grid" style="grid-template-columns:1fr;">
|
||||
<div class="field">
|
||||
<label>事件类型</label>
|
||||
<select id="eventType">
|
||||
<option value="acceptance_archive">验收单归档</option>
|
||||
<option value="shipment_notice">卖方通知发货(可选)</option>
|
||||
<option value="delivered">设备到货(可选)</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="field">
|
||||
<label>发生日期</label>
|
||||
<input type="date" id="eventDate" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="actions">
|
||||
<button type="button" class="btn" id="btnCloseEvent">取消</button>
|
||||
<button type="button" class="btn primary" id="btnConfirmEvent">确认并重算到期日</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="toast" id="toast"></div> <script>
|
||||
const TYPE_LABEL = { prepayment: "预付款", shipment: "出货款", acceptance: "验收款", warranty: "质保款", other: "其他" };
|
||||
const ANCHOR_LABEL = { signed: "签约日", acceptance_archive: "验收单归档日", shipment_notice: "卖方通知发货", delivered: "设备到货" };
|
||||
|
||||
function todayStr() { return formatDate(new Date()); }
|
||||
function formatDate(d) {
|
||||
const x = d instanceof Date ? d : new Date(d);
|
||||
if (Number.isNaN(x.getTime())) return "—";
|
||||
return `${x.getFullYear()}-${String(x.getMonth() + 1).padStart(2, "0")}-${String(x.getDate()).padStart(2, "0")}`;
|
||||
}
|
||||
function addDays(dateStr, days) {
|
||||
const d = new Date(dateStr + "T00:00:00");
|
||||
d.setDate(d.getDate() + Number(days || 0));
|
||||
return formatDate(d);
|
||||
}
|
||||
function daysUntil(dateStr) {
|
||||
if (!dateStr) return null;
|
||||
const a = new Date(todayStr() + "T00:00:00");
|
||||
const b = new Date(dateStr + "T00:00:00");
|
||||
return Math.round((b - a) / 86400000);
|
||||
}
|
||||
function money(n) { return "¥" + Number(n || 0).toLocaleString("zh-CN", { maximumFractionDigits: 2 }); }
|
||||
function uid(prefix) { return prefix + "_" + Math.random().toString(36).slice(2, 8); }
|
||||
|
||||
function computeDue(m, events) {
|
||||
if (m.dueMode === "fixed_date") return m.fixedDate || null;
|
||||
const anchor = events[m.anchorEvent];
|
||||
if (!anchor) return null;
|
||||
return addDays(anchor, m.offsetDays || 0);
|
||||
}
|
||||
function refreshMilestones(plan) {
|
||||
plan.milestones.forEach((m) => { m.dueDate = computeDue(m, plan.events); });
|
||||
}
|
||||
function nextOpenMilestone(plan) {
|
||||
return plan.milestones
|
||||
.filter((m) => m.status !== "paid" && m.status !== "cancelled")
|
||||
.map((m) => ({ ...m, dueDate: computeDue(m, plan.events) }))
|
||||
.sort((a, b) => {
|
||||
if (!a.dueDate && !b.dueDate) return 0;
|
||||
if (!a.dueDate) return 1;
|
||||
if (!b.dueDate) return -1;
|
||||
return a.dueDate.localeCompare(b.dueDate);
|
||||
})[0] || null;
|
||||
}
|
||||
function planBucket(plan) {
|
||||
if (plan.status === "draft") return "draft";
|
||||
const open = plan.milestones.filter((m) => m.status !== "paid" && m.status !== "cancelled");
|
||||
if (!open.length) return "done";
|
||||
const next = nextOpenMilestone(plan);
|
||||
if (!next || !next.dueDate) return "active";
|
||||
const d = daysUntil(next.dueDate);
|
||||
if (d < 0) return "overdue";
|
||||
if (d <= 7) return "due_soon";
|
||||
return "active";
|
||||
}
|
||||
function milestoneTone(m) {
|
||||
if (m.status === "paid") return "paid";
|
||||
if (!m.dueDate) return "pending";
|
||||
const d = daysUntil(m.dueDate);
|
||||
if (d < 0) return "overdue";
|
||||
if (d <= 7) return "due";
|
||||
return "pending";
|
||||
}
|
||||
function statusPill(bucket) {
|
||||
const map = {
|
||||
draft: ["待启用", "neutral"], active: ["进行中", "info"], due_soon: ["即将到期", "warn"],
|
||||
overdue: ["已逾期", "danger"], done: ["已完成", "ok"],
|
||||
};
|
||||
const [text, cls] = map[bucket] || ["进行中", "info"];
|
||||
return `<span class="pill ${cls}">${text}</span>`;
|
||||
}
|
||||
|
||||
const state = {
|
||||
filter: "all", contractFilter: "all", detailTab: "overview", currentPlanId: "plan_yuying", wecomPlanId: "plan_yuying", wecomMilestoneId: null,
|
||||
plans: [
|
||||
{
|
||||
id: "plan_yuying", contractNo: "5203-2607180001", supplier: "杭州煜英智能科技有限公司",
|
||||
purchaseOrderNo: "PO-260718-0036", totalAmount: 24000, owner: "张采购", status: "active", oaStatus: "审批通过", artifactStatus: "stored", parseStatus: "parsed", planStatus: "active", attachment: "设备采购合同-项目型V4.docx", attachmentSource: "OA流程归档附件", sourceUpdatedAt: "2026-07-20 10:30", evidence: "付款方式章节第 3 页:付款比例及交货期限已进入付款计划。",
|
||||
remark: "上盖贴标线翻转设备 1 套 · 含安装调试",
|
||||
events: { signed: "2026-07-20", acceptance_archive: null },
|
||||
milestones: [
|
||||
{ id: "m1", type: "prepayment", percent: 30, amount: 7200, dueMode: "event_relative", anchorEvent: "signed", offsetDays: 3, fixedDate: null, status: "paid", paidAt: "2026-07-22" },
|
||||
{ id: "m2", type: "shipment", percent: 40, amount: 9600, dueMode: "fixed_date", anchorEvent: null, offsetDays: 0, fixedDate: "2026-09-02", status: "active", paidAt: null },
|
||||
{ id: "m3", type: "acceptance", percent: 25, amount: 6000, dueMode: "event_relative", anchorEvent: "acceptance_archive", offsetDays: 60, fixedDate: null, status: "active", paidAt: null },
|
||||
{ id: "m4", type: "warranty", percent: 5, amount: 1200, dueMode: "event_relative", anchorEvent: "acceptance_archive", offsetDays: 365, fixedDate: null, status: "active", paidAt: null },
|
||||
],
|
||||
reminderLogs: [
|
||||
{ id: "r1", at: "2026-08-26 09:00", text: "出货款 · 到期前 7 天提醒已发送" },
|
||||
{ id: "r2", at: "2026-08-30 09:00", text: "出货款 · 到期前 3 天提醒已发送" },
|
||||
],
|
||||
},
|
||||
{
|
||||
id: "plan_draft", contractNo: "5203-2608010002", supplier: "示例自动化设备有限公司",
|
||||
purchaseOrderNo: "PO-260801-0012", totalAmount: 88000, owner: "张采购", status: "draft", remark: "草稿:尚未启用提醒", oaStatus: "审批通过", artifactStatus: "stored", parseStatus: "needs_review", planStatus: "needs_review", attachment: "采购合同-扫描件.pdf", attachmentSource: "文档管理系统延迟补充", sourceUpdatedAt: "2026-08-01 09:12", evidence: "验收款付款期限缺少明确天数,计划暂为草稿。",
|
||||
events: { signed: null, acceptance_archive: null },
|
||||
milestones: [
|
||||
{ id: "d1", type: "prepayment", percent: 30, amount: 26400, dueMode: "event_relative", anchorEvent: "signed", offsetDays: 3, fixedDate: null, status: "active", paidAt: null },
|
||||
{ id: "d2", type: "acceptance", percent: 70, amount: 61600, dueMode: "event_relative", anchorEvent: "acceptance_archive", offsetDays: 30, fixedDate: null, status: "active", paidAt: null },
|
||||
],
|
||||
reminderLogs: [],
|
||||
},
|
||||
{
|
||||
id: "plan_overdue", contractNo: "5203-2605010008", supplier: "苏州某某机电有限公司",
|
||||
purchaseOrderNo: "PO-260501-0008", totalAmount: 15600, owner: "张采购", status: "active", remark: "演示逾期节点", oaStatus: "已归档", artifactStatus: "stored", parseStatus: "parsed", planStatus: "active", attachment: "合同附件.doc", attachmentSource: "OA流程归档附件", sourceUpdatedAt: "2026-05-10 15:40", evidence: "标准模板解析通过,出货节点固定到期日为 2026-07-15。",
|
||||
events: { signed: "2026-05-10", acceptance_archive: null },
|
||||
milestones: [
|
||||
{ id: "o1", type: "prepayment", percent: 100, amount: 15600, dueMode: "fixed_date", anchorEvent: null, offsetDays: 0, fixedDate: "2026-07-15", status: "active", paidAt: null },
|
||||
],
|
||||
reminderLogs: [
|
||||
{ id: "or1", at: "2026-07-15 09:00", text: "预付款 · 到期日提醒已发送" },
|
||||
{ id: "or2", at: "2026-07-18 09:00", text: "预付款 · 逾期复提醒已发送" },
|
||||
],
|
||||
},
|
||||
],
|
||||
};
|
||||
state.plans.forEach(refreshMilestones);
|
||||
|
||||
function toast(msg) {
|
||||
const el = document.getElementById("toast");
|
||||
el.textContent = msg;
|
||||
el.classList.add("show");
|
||||
clearTimeout(toast._t);
|
||||
toast._t = setTimeout(() => el.classList.remove("show"), 2200);
|
||||
}
|
||||
function getPlan(id) { return state.plans.find((p) => p.id === id); }
|
||||
|
||||
function switchView(view) {
|
||||
document.querySelectorAll(".view-tabs button").forEach((b) => b.classList.toggle("active", b.dataset.view === view));
|
||||
document.querySelectorAll(".page").forEach((p) => p.classList.remove("active"));
|
||||
document.getElementById("page-" + view).classList.add("active");
|
||||
document.getElementById("navPayment").classList.toggle("active", view === "list" || view === "detail" || view === "wecom");
|
||||
if (view === "list") renderList();
|
||||
if (view === "detail") renderDetail();
|
||||
if (view === "contracts") renderContracts();
|
||||
if (view === "exceptions") renderExceptions();
|
||||
if (view === "create") renderCreateForm();
|
||||
if (view === "wecom") renderWecom();
|
||||
}
|
||||
|
||||
function renderStats() {
|
||||
let dueSoon = 0, overdue = 0, draft = 0, paidMonth = 0;
|
||||
const monthPrefix = todayStr().slice(0, 7);
|
||||
state.plans.forEach((p) => {
|
||||
const bucket = planBucket(p);
|
||||
if (bucket === "due_soon") dueSoon += 1;
|
||||
if (bucket === "overdue") overdue += 1;
|
||||
if (bucket === "draft") draft += 1;
|
||||
p.milestones.forEach((m) => {
|
||||
if (m.status === "paid" && m.paidAt && String(m.paidAt).startsWith(monthPrefix)) paidMonth += 1;
|
||||
});
|
||||
});
|
||||
document.getElementById("stats").innerHTML = `
|
||||
<div class="stat-card warn"><div class="label">即将到期(7日内)</div><div class="value">${dueSoon}</div></div>
|
||||
<div class="stat-card danger"><div class="label">逾期未付</div><div class="value">${overdue}</div></div>
|
||||
<div class="stat-card info"><div class="label">待启用草稿</div><div class="value">${draft}</div></div>
|
||||
<div class="stat-card ok"><div class="label">本月已付节点</div><div class="value">${paidMonth}</div></div>`;
|
||||
document.getElementById("navBadge").textContent = String(dueSoon + overdue);
|
||||
}
|
||||
|
||||
function renderList() {
|
||||
renderStats();
|
||||
const tbody = document.getElementById("planTable");
|
||||
const empty = document.getElementById("listEmpty");
|
||||
const rows = state.plans.filter((p) => state.filter === "all" || planBucket(p) === state.filter);
|
||||
document.getElementById("listCount").textContent = `共 ${rows.length} 条`;
|
||||
if (!rows.length) { tbody.innerHTML = ""; empty.style.display = "block"; return; }
|
||||
empty.style.display = "none";
|
||||
tbody.innerHTML = rows.map((p) => {
|
||||
const bucket = planBucket(p);
|
||||
const next = nextOpenMilestone(p);
|
||||
let nextText = "—", dueText = "待登记锚点";
|
||||
if (bucket === "done") { nextText = "全部已付清"; dueText = "—"; }
|
||||
else if (next) {
|
||||
nextText = `${TYPE_LABEL[next.type] || next.type} ${money(next.amount)}(${next.percent}%)`;
|
||||
if (next.dueDate) {
|
||||
const d = daysUntil(next.dueDate);
|
||||
dueText = d < 0 ? `${next.dueDate} · 逾期 ${Math.abs(d)} 天` : d === 0 ? `${next.dueDate} · 今天` : `${next.dueDate} · 还有 ${d} 天`;
|
||||
} else if (next.dueMode === "event_relative") {
|
||||
dueText = `待登记「${ANCHOR_LABEL[next.anchorEvent] || next.anchorEvent}」`;
|
||||
}
|
||||
}
|
||||
return `<tr data-id="${p.id}">
|
||||
<td><div class="strong mono">合同:${p.contractNo}</div><div class="mono muted" style="margin-top:3px;">采购单:${p.purchaseOrderNo || "—"}</div><div class="muted" style="margin-top:3px;">${p.supplier}</div></td>
|
||||
<td>${nextText}</td><td>${dueText}</td><td>${statusPill(bucket)}</td><td>${p.owner}</td></tr>`;
|
||||
}).join("");
|
||||
tbody.querySelectorAll("tr").forEach((tr) => {
|
||||
tr.addEventListener("click", () => { state.currentPlanId = tr.dataset.id; switchView("detail"); });
|
||||
});
|
||||
}
|
||||
|
||||
function contractStatus(status) {
|
||||
const map = { stored: ["已保存", "ok"], parsed: ["解析通过", "ok"], active: ["已启用", "info"], needs_review: ["需处理", "warn"], failed: ["失败", "danger"] };
|
||||
const [label, cls] = map[status] || [status || "待处理", "neutral"];
|
||||
return `<span class="pill ${cls}">${label}</span>`;
|
||||
}
|
||||
function renderContracts() {
|
||||
const rows = state.plans.filter((p) => state.contractFilter === "all" || p.artifactStatus === state.contractFilter || p.parseStatus === state.contractFilter);
|
||||
document.getElementById("contractCount").textContent = `共 ${rows.length} 份`;
|
||||
document.getElementById("contractEmpty").style.display = rows.length ? "none" : "block";
|
||||
document.getElementById("contractTable").innerHTML = rows.map((p) => `<tr data-contract-id="${p.id}">
|
||||
<td><div class="strong mono">合同:${p.contractNo}</div><div class="mono muted" style="margin-top:3px">采购单:${p.purchaseOrderNo || "—"}</div><div class="muted" style="margin-top:3px">${p.supplier}</div></td>
|
||||
<td>${money(p.totalAmount)}</td><td>${p.oaStatus || "—"}<br>${contractStatus(p.artifactStatus)}</td>
|
||||
<td>${contractStatus(p.parseStatus)}</td><td>${contractStatus(p.planStatus)}</td><td>${p.owner}</td></tr>`).join("");
|
||||
document.querySelectorAll("[data-contract-id]").forEach((tr) => tr.addEventListener("click", () => { state.currentPlanId = tr.dataset.contractId; switchView("detail"); }));
|
||||
}
|
||||
function renderExceptions() {
|
||||
const rows = state.plans.filter((p) => p.parseStatus === "needs_review");
|
||||
document.getElementById("exceptionTable").innerHTML = rows.length ? rows.map((p) => `<tr><td><div class="mono">${p.contractNo}</div><div class="mono muted">${p.purchaseOrderNo || "—"}</div></td><td><span class="pill warn">P1 需确认</span></td><td>${p.evidence || "付款条款存在不确定性"}</td><td>验收款/质保款</td><td><button type="button" class="btn" data-open-exception="${p.id}">查看合同</button></td></tr>`).join("") : `<tr><td colspan="5" class="empty">暂无异常合同</td></tr>`;
|
||||
document.querySelectorAll("[data-open-exception]").forEach((btn) => btn.addEventListener("click", () => { state.currentPlanId = btn.dataset.openException; switchView("detail"); }));
|
||||
}
|
||||
|
||||
function renderDetail() {
|
||||
const plan = getPlan(state.currentPlanId) || state.plans[0];
|
||||
if (!plan) return;
|
||||
refreshMilestones(plan);
|
||||
state.currentPlanId = plan.id;
|
||||
const bucket = planBucket(plan);
|
||||
document.getElementById("detailTitle").textContent = plan.contractNo;
|
||||
document.getElementById("detailSub").textContent = `${plan.supplier} · ${plan.remark || "无备注"}`;
|
||||
document.getElementById("btnEnablePlan").style.display = plan.status === "draft" ? "inline-flex" : "none";
|
||||
document.getElementById("detailMeta").innerHTML = `
|
||||
<div class="meta-item"><div class="k">合同总价</div><div class="v">${money(plan.totalAmount)}</div></div>
|
||||
<div class="meta-item"><div class="k">采购单号</div><div class="v mono">${plan.purchaseOrderNo || "—"}</div></div>
|
||||
<div class="meta-item"><div class="k">计划状态</div><div class="v">${statusPill(bucket)}</div></div>
|
||||
<div class="meta-item"><div class="k">负责人</div><div class="v">${plan.owner}</div></div>
|
||||
<div class="meta-item"><div class="k">已登记事件</div><div class="v">${
|
||||
Object.entries(plan.events).filter(([, v]) => v).map(([k, v]) => `${ANCHOR_LABEL[k]} ${v}`).join(";") || "暂无"
|
||||
}</div></div>`;
|
||||
document.getElementById("contractEvidence").innerHTML = `<div class="contract-status"><strong>合同关联</strong>${contractStatus(plan.artifactStatus)} ${contractStatus(plan.parseStatus)} ${contractStatus(plan.planStatus)}</div><div style="margin-top:6px"><strong>原文附件:</strong>${plan.attachment || "OA附件待下载"} <span class="muted">来源:${plan.attachmentSource || "OA流程归档附件"};OA更新时间 ${plan.sourceUpdatedAt || "—"}</span></div><div style="margin-top:6px"><strong>文件策略:</strong>文档管理系统仅作延迟补充,不核对版本、不比较文件内容。</div><div style="margin-top:6px"><strong>履约事件:</strong>卖方通知发货、设备到货为可选事件,有则记录,无则不阻断出货款预警。</div><div style="margin-top:6px"><strong>提醒规则:</strong>出货款按约定到货日期前14天;验收款按验收单归档立即提醒;质保款按归档日+质保期,并在到期前14天提醒。</div><div style="margin-top:6px"><strong>解析依据:</strong>${plan.evidence || "暂无"}</div>`;
|
||||
document.getElementById("timeline").innerHTML = plan.milestones.map((m) => {
|
||||
const tone = milestoneTone(m);
|
||||
let dueLine = "";
|
||||
if (m.status === "paid") dueLine = `已于 ${m.paidAt || "—"} 支付`;
|
||||
else if (m.dueMode === "fixed_date") dueLine = `固定到期日:${m.dueDate || m.fixedDate || "未填"}`;
|
||||
else dueLine = m.dueDate
|
||||
? `由「${ANCHOR_LABEL[m.anchorEvent]}」+ ${m.offsetDays} 天 → ${m.dueDate}`
|
||||
: `等待登记「${ANCHOR_LABEL[m.anchorEvent]}」后起算 ${m.offsetDays} 天`;
|
||||
const canPay = m.status !== "paid" && plan.status !== "draft";
|
||||
const badge = m.status === "paid" ? '<span class="pill ok">已付</span>'
|
||||
: !m.dueDate ? '<span class="pill neutral">待起算</span>'
|
||||
: daysUntil(m.dueDate) < 0 ? '<span class="pill danger">逾期</span>'
|
||||
: daysUntil(m.dueDate) <= 7 ? '<span class="pill warn">即将到期</span>'
|
||||
: '<span class="pill info">待付</span>';
|
||||
return `<div class="tl-item ${tone}"><div class="tl-rail"><div class="tl-dot"></div></div>
|
||||
<div class="tl-body"><div class="tl-top"><div>
|
||||
<div class="tl-title">${TYPE_LABEL[m.type]} · ${money(m.amount)}(${m.percent}%)</div>
|
||||
<div class="tl-sub">${dueLine}</div></div><div>${badge}</div></div>
|
||||
<div class="tl-actions">
|
||||
${canPay ? `<button type="button" class="btn" data-pay="${m.id}">标记已付</button>` : ""}
|
||||
</div></div></div>`;
|
||||
}).join("");
|
||||
document.getElementById("timeline").querySelectorAll("[data-pay]").forEach((btn) => {
|
||||
btn.addEventListener("click", () => markPaid(plan.id, btn.dataset.pay));
|
||||
});
|
||||
document.getElementById("timeline").querySelectorAll("[data-quick-event]").forEach((btn) => {
|
||||
btn.addEventListener("click", () => {
|
||||
document.getElementById("eventType").value = btn.dataset.quickEvent;
|
||||
document.getElementById("eventDate").value = todayStr();
|
||||
document.getElementById("eventModal").classList.add("show");
|
||||
});
|
||||
});
|
||||
const logs = plan.reminderLogs || [];
|
||||
document.getElementById("reminderLogs").innerHTML = logs.length
|
||||
? logs.map((l) => `<div class="log-item"><div class="t">${l.text}</div><div class="s">${l.at}</div></div>`).join("")
|
||||
: `<div class="muted">暂无提醒记录(启用提醒且进入窗口后才会发送)</div>`;
|
||||
}
|
||||
|
||||
function markPaid(planId, milestoneId) {
|
||||
const plan = getPlan(planId);
|
||||
const m = plan.milestones.find((x) => x.id === milestoneId);
|
||||
if (!m) return;
|
||||
m.status = "paid"; m.paidAt = todayStr();
|
||||
plan.reminderLogs.unshift({ id: uid("log"), at: formatDate(new Date()) + " " + new Date().toTimeString().slice(0, 5), text: `${TYPE_LABEL[m.type]} · 已标记支付` });
|
||||
toast(`已标记「${TYPE_LABEL[m.type]}」为已付`);
|
||||
renderDetail(); renderStats();
|
||||
}
|
||||
function enablePlan() {
|
||||
const plan = getPlan(state.currentPlanId);
|
||||
if (!plan) return;
|
||||
plan.status = "active";
|
||||
toast("已启用提醒:到期前 7/3/1/0 天将推送企微");
|
||||
renderDetail();
|
||||
}
|
||||
function applyEvent() {
|
||||
const plan = getPlan(state.currentPlanId);
|
||||
if (!plan) return;
|
||||
const type = document.getElementById("eventType").value;
|
||||
const date = document.getElementById("eventDate").value || todayStr();
|
||||
plan.events[type] = date;
|
||||
refreshMilestones(plan);
|
||||
plan.reminderLogs.unshift({ id: uid("log"), at: formatDate(new Date()) + " " + new Date().toTimeString().slice(0, 5), text: `已登记「${ANCHOR_LABEL[type]}」= ${date},已重算相关节点` });
|
||||
document.getElementById("eventModal").classList.remove("show");
|
||||
toast("事件已登记,到期日已更新");
|
||||
renderDetail();
|
||||
}
|
||||
|
||||
function renderWecom() {
|
||||
const plan = getPlan(state.wecomPlanId) || getPlan(state.currentPlanId) || state.plans[0];
|
||||
refreshMilestones(plan);
|
||||
let m = plan.milestones.find((x) => x.id === state.wecomMilestoneId);
|
||||
if (!m) m = nextOpenMilestone(plan) || plan.milestones[0];
|
||||
const d = m && m.dueDate ? daysUntil(m.dueDate) : null;
|
||||
const remain = d == null ? "待起算" : d < 0 ? `已逾期 ${Math.abs(d)} 天` : d === 0 ? "今天到期" : `还剩 ${d} 天`;
|
||||
document.getElementById("wecomTitle").textContent = d != null && d < 0 ? "付款节点逾期提醒" : "付款节点到期提醒";
|
||||
document.getElementById("wecomBody").textContent = [
|
||||
`合同编号:${plan.contractNo}`, `采购单号:${plan.purchaseOrderNo || "—"}`, `供应商:${plan.supplier}`,
|
||||
`节点:${TYPE_LABEL[m.type]} ${money(m.amount)}(${m.percent}%)`,
|
||||
`到期日:${m.dueDate || "待登记锚点后起算"}`, `状态:${remain}`, "",
|
||||
"请提前发起付款流程。点击查看详情。",
|
||||
].join("\n");
|
||||
state.currentPlanId = plan.id;
|
||||
}
|
||||
|
||||
function defaultNodeRow(data = {}) {
|
||||
return {
|
||||
type: data.type || "prepayment", percent: data.percent ?? 30, amount: data.amount ?? "",
|
||||
dueMode: data.dueMode || "event_relative", anchorEvent: data.anchorEvent || "signed",
|
||||
offsetDays: data.offsetDays ?? 3, fixedDate: data.fixedDate || "",
|
||||
};
|
||||
}
|
||||
let createNodes = [
|
||||
defaultNodeRow({ type: "prepayment", percent: 30, amount: 7200, anchorEvent: "signed", offsetDays: 3 }),
|
||||
defaultNodeRow({ type: "shipment", percent: 40, amount: 9600, dueMode: "fixed_date", fixedDate: "2026-09-02", anchorEvent: "", offsetDays: 0 }),
|
||||
defaultNodeRow({ type: "acceptance", percent: 25, amount: 6000, anchorEvent: "acceptance_archive", offsetDays: 60 }),
|
||||
defaultNodeRow({ type: "warranty", percent: 5, amount: 1200, anchorEvent: "acceptance_archive", offsetDays: 365 }),
|
||||
];
|
||||
|
||||
function renderCreateForm(prefills) {
|
||||
if (prefills) {
|
||||
document.getElementById("fContractNo").value = prefills.contractNo || "";
|
||||
document.getElementById("fPurchaseOrderNo").value = prefills.purchaseOrderNo || "";
|
||||
document.getElementById("fSupplier").value = prefills.supplier || "";
|
||||
document.getElementById("fTotal").value = prefills.totalAmount || "";
|
||||
document.getElementById("fOwner").value = prefills.owner || "张采购";
|
||||
document.getElementById("fRemark").value = prefills.remark || "";
|
||||
}
|
||||
const box = document.getElementById("nodeRows");
|
||||
box.innerHTML = createNodes.map((n, idx) => `
|
||||
<div class="node-row" data-idx="${idx}">
|
||||
<div class="field"><label>类型</label>
|
||||
<select data-k="type">${Object.entries(TYPE_LABEL).map(([k, v]) => `<option value="${k}" ${n.type === k ? "selected" : ""}>${v}</option>`).join("")}</select>
|
||||
</div>
|
||||
<div class="field"><label>比例%</label><input data-k="percent" type="number" value="${n.percent}" /></div>
|
||||
<div class="field"><label>金额</label><input data-k="amount" type="number" value="${n.amount}" /></div>
|
||||
<div class="field"><label>到期模式</label>
|
||||
<select data-k="dueMode">
|
||||
<option value="event_relative" ${n.dueMode === "event_relative" ? "selected" : ""}>事件 + 偏移天</option>
|
||||
<option value="fixed_date" ${n.dueMode === "fixed_date" ? "selected" : ""}>固定日期</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="field"><label>${n.dueMode === "fixed_date" ? "固定到期日" : "锚点 / 偏移"}</label>
|
||||
${n.dueMode === "fixed_date"
|
||||
? `<input data-k="fixedDate" type="date" value="${n.fixedDate || ""}" />`
|
||||
: `<div style="display:grid;grid-template-columns:1.2fr .8fr;gap:6px;">
|
||||
<select data-k="anchorEvent">${Object.entries(ANCHOR_LABEL).map(([k, v]) => `<option value="${k}" ${n.anchorEvent === k ? "selected" : ""}>${v}</option>`).join("")}</select>
|
||||
<input data-k="offsetDays" type="number" value="${n.offsetDays}" title="偏移天数" />
|
||||
</div>`}
|
||||
</div>
|
||||
<button type="button" class="btn danger" data-del="${idx}">删</button>
|
||||
</div>`).join("");
|
||||
box.querySelectorAll(".node-row").forEach((row) => {
|
||||
const idx = Number(row.dataset.idx);
|
||||
row.querySelectorAll("[data-k]").forEach((el) => {
|
||||
el.addEventListener("change", () => {
|
||||
createNodes[idx][el.dataset.k] = el.type === "number" ? Number(el.value) : el.value;
|
||||
if (el.dataset.k === "dueMode") renderCreateForm();
|
||||
});
|
||||
el.addEventListener("input", () => {
|
||||
createNodes[idx][el.dataset.k] = el.type === "number" ? Number(el.value) : el.value;
|
||||
});
|
||||
});
|
||||
const del = row.querySelector("[data-del]");
|
||||
if (del) del.addEventListener("click", () => { createNodes.splice(idx, 1); renderCreateForm(); });
|
||||
});
|
||||
}
|
||||
|
||||
function saveCreate(enable) {
|
||||
const contractNo = document.getElementById("fContractNo").value.trim();
|
||||
const purchaseOrderNo = document.getElementById("fPurchaseOrderNo").value.trim();
|
||||
const supplier = document.getElementById("fSupplier").value.trim();
|
||||
const totalAmount = Number(document.getElementById("fTotal").value || 0);
|
||||
const owner = document.getElementById("fOwner").value.trim() || "张采购";
|
||||
const remark = document.getElementById("fRemark").value.trim();
|
||||
if (!contractNo || !supplier || !createNodes.length) { toast("请至少填写合同号、供应商,并保留一个节点"); return; }
|
||||
const plan = {
|
||||
id: uid("plan"), contractNo, purchaseOrderNo, supplier, totalAmount, owner, status: enable ? "active" : "draft", remark,
|
||||
events: { signed: null, acceptance_archive: null },
|
||||
milestones: createNodes.map((n) => ({
|
||||
id: uid("m"), type: n.type, percent: Number(n.percent || 0), amount: Number(n.amount || 0),
|
||||
dueMode: n.dueMode, anchorEvent: n.anchorEvent || null, offsetDays: Number(n.offsetDays || 0),
|
||||
fixedDate: n.fixedDate || null, status: "active", paidAt: null, dueDate: null,
|
||||
})),
|
||||
reminderLogs: [],
|
||||
};
|
||||
refreshMilestones(plan);
|
||||
state.plans.unshift(plan);
|
||||
state.currentPlanId = plan.id;
|
||||
toast(enable ? "已保存并启用提醒" : "已保存为草稿");
|
||||
switchView("detail");
|
||||
}
|
||||
|
||||
document.querySelectorAll(".view-tabs button").forEach((b) => b.addEventListener("click", () => switchView(b.dataset.view)));
|
||||
document.getElementById("filters").querySelectorAll("button").forEach((b) => {
|
||||
b.addEventListener("click", () => {
|
||||
state.filter = b.dataset.filter;
|
||||
document.getElementById("filters").querySelectorAll("button").forEach((x) => x.classList.toggle("active", x === b));
|
||||
renderList();
|
||||
});
|
||||
});
|
||||
document.getElementById("btnGotoContracts").addEventListener("click", () => switchView("contracts"));
|
||||
document.getElementById("btnSyncContracts").addEventListener("click", () => { toast("已模拟从 OA 增量同步 1 份合同"); renderContracts(); });
|
||||
document.getElementById("btnCancelCreate").addEventListener("click", () => switchView("list"));
|
||||
document.getElementById("btnBackList").addEventListener("click", () => switchView("list"));
|
||||
document.getElementById("btnEnablePlan").addEventListener("click", enablePlan);
|
||||
document.getElementById("btnOpenEvent").addEventListener("click", () => {
|
||||
document.getElementById("eventDate").value = todayStr();
|
||||
document.getElementById("eventModal").classList.add("show");
|
||||
});
|
||||
document.getElementById("btnCloseEvent").addEventListener("click", () => document.getElementById("eventModal").classList.remove("show"));
|
||||
document.getElementById("btnConfirmEvent").addEventListener("click", applyEvent);
|
||||
document.getElementById("btnAddNode").addEventListener("click", () => {
|
||||
createNodes.push(defaultNodeRow({ type: "other", percent: 0, amount: 0, dueMode: "fixed_date", fixedDate: todayStr() }));
|
||||
renderCreateForm();
|
||||
});
|
||||
document.getElementById("btnFillYuying").addEventListener("click", () => {
|
||||
createNodes = [
|
||||
defaultNodeRow({ type: "prepayment", percent: 30, amount: 7200, anchorEvent: "signed", offsetDays: 3 }),
|
||||
defaultNodeRow({ type: "shipment", percent: 40, amount: 9600, dueMode: "fixed_date", fixedDate: "2026-09-02" }),
|
||||
defaultNodeRow({ type: "acceptance", percent: 25, amount: 6000, anchorEvent: "acceptance_archive", offsetDays: 60 }),
|
||||
defaultNodeRow({ type: "warranty", percent: 5, amount: 1200, anchorEvent: "acceptance_archive", offsetDays: 365 }),
|
||||
];
|
||||
renderCreateForm({
|
||||
contractNo: "5203-2607180001", purchaseOrderNo: "PO-260718-0036", supplier: "杭州煜英智能科技有限公司", totalAmount: 24000,
|
||||
owner: "张采购", remark: "上盖贴标线翻转设备 1 套 · 含安装调试",
|
||||
});
|
||||
toast("已填入煜英合同示例");
|
||||
});
|
||||
document.getElementById("btnSaveDraft").addEventListener("click", () => saveCreate(false));
|
||||
document.getElementById("btnSaveEnable").addEventListener("click", () => saveCreate(true));
|
||||
function openWecomForCurrent() {
|
||||
const plan = getPlan(state.currentPlanId) || state.plans[0];
|
||||
state.wecomPlanId = plan.id;
|
||||
const next = nextOpenMilestone(plan);
|
||||
state.wecomMilestoneId = next ? next.id : null;
|
||||
switchView("wecom");
|
||||
}
|
||||
document.getElementById("btnMockWecom").addEventListener("click", openWecomForCurrent);
|
||||
document.getElementById("btnWecomToDetail").addEventListener("click", () => { state.currentPlanId = state.wecomPlanId; switchView("detail"); });
|
||||
document.getElementById("wecomJump").addEventListener("click", () => { state.currentPlanId = state.wecomPlanId; switchView("detail"); });
|
||||
document.querySelectorAll("[data-nav]").forEach((btn) => {
|
||||
btn.addEventListener("click", () => {
|
||||
if (btn.dataset.nav === "payment") switchView("list");
|
||||
else if (btn.dataset.nav === "contracts") switchView("contracts");
|
||||
else if (btn.dataset.nav === "review") switchView("exceptions");
|
||||
else toast("正式环境为工作台应用首页(原型不展开)");
|
||||
});
|
||||
});
|
||||
document.querySelectorAll("[data-contract-filter]").forEach((btn) => btn.addEventListener("click", () => {
|
||||
state.contractFilter = btn.dataset.contractFilter;
|
||||
document.querySelectorAll("[data-contract-filter]").forEach((x) => x.classList.toggle("active", x === btn));
|
||||
renderContracts();
|
||||
}));
|
||||
document.getElementById("eventDate").value = todayStr();
|
||||
renderList();
|
||||
renderCreateForm();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,6 +1,6 @@
|
||||
<!doctype html>
|
||||
<!doctype html>
|
||||
<!--
|
||||
docs/prototype/contract-payment-plan-workspace-prototype.html
|
||||
docs/features/contract-payment-plan/contract-payment-plan-workspace-prototype.html
|
||||
用途:采购合同「付款计划 / 节点预警」工作台低保真原型——列表、详情时间线、新建、企微提醒卡片。
|
||||
依赖:浏览器原生 HTML/CSS/JavaScript,无需构建;双击或用本地静态服务打开即可评审。
|
||||
逻辑:左侧模拟工作台导航;主区在「我的付款计划 / 计划详情 / 新建计划 / 企微卡片」间切换;
|
||||
@@ -0,0 +1,279 @@
|
||||
# 合同付款预警 Agent 方案(V1)
|
||||
|
||||
## 1. 方案结论
|
||||
|
||||
推荐采用“**标准模板自动拆解,非模板自动尝试,只有异常才轻量确认**”的方案:
|
||||
|
||||
- OA 负责提供新增合同和合同附件。
|
||||
- 标准设备采购合同模板使用确定性解析器,自动生成付款计划并启用预警。
|
||||
- 非模板合同由 Agent 提取候选付款计划,再由规则引擎校验。
|
||||
- 只有金额不平、日期缺失、条款冲突等异常才进入待确认,不要求采购逐份填写问卷。
|
||||
- 采购只需要在异常卡片上“一键启用 / 调整一个字段 / 暂不处理”。
|
||||
|
||||
核心原则:**结构化字段负责准确性,规则引擎负责计算,Agent 负责抽取和解释,企业微信负责提醒。**
|
||||
|
||||
## 2. 业务目标与第一版边界
|
||||
|
||||
### 2.1 业务目标
|
||||
|
||||
解决采购到了付款节点却没有及时付款的问题,覆盖三类主要货款:
|
||||
|
||||
| 节点 | 第一版规则 |
|
||||
| --- | --- |
|
||||
| 出货款 | 合同交货期限前 14 个自然日提醒;卖方通知发货字段预留,后续可独立触发 |
|
||||
| 验收款 | OA 验收单归档后无条件立即提醒;付款期限从归档日期开始计算 |
|
||||
| 质保款 | 质保期从验收单归档日开始计算;提醒提前量先作为可配置待确认项 |
|
||||
|
||||
### 2.2 第一版不做
|
||||
|
||||
- 不导入已完成历史合同。
|
||||
- 不处理合同变更、作废、补充协议版本。
|
||||
- 不自动提交 OA 付款申请。
|
||||
- 不自动付款。
|
||||
- 付款完成状态来源暂未确定,先支持采购负责人手工更新。
|
||||
- 企业微信暂定只通知采购负责人,抄送范围后续确认。
|
||||
|
||||
## 3. 总体流程
|
||||
|
||||
```mermaid
|
||||
flowchart LR
|
||||
A[OA新增合同] --> B[获取合同主数据与附件]
|
||||
B --> C[合同模板识别]
|
||||
C -->|标准模板| D[确定性模板解析器]
|
||||
C -->|非模板| E[Agent候选条款抽取]
|
||||
D --> F[统一付款计划模型]
|
||||
E --> G[规则校验与风险分级]
|
||||
G -->|无风险| F
|
||||
G -->|异常| H[异常卡片/每日汇总]
|
||||
H -->|一键确认或调整| F
|
||||
F --> I[关联OA交货与验收事件]
|
||||
I --> J[计算付款日与预警日]
|
||||
J --> K[企微通知与工作台]
|
||||
```
|
||||
|
||||
### 3.1 处理步骤
|
||||
|
||||
1. OA 发现新增合同,保存 OA 合同记录 ID 和附件地址。
|
||||
2. 下载合同附件并提取文本;扫描件先 OCR。
|
||||
3. 识别合同是否属于标准设备采购合同模板。
|
||||
4. 标准模板走规则解析;非模板走 Agent 候选抽取。
|
||||
5. 用金额、比例、日期、锚点和条款冲突规则进行校验。
|
||||
6. 无异常则自动生成付款节点;有异常则只生成异常卡片,不发送不确定的正式金额/日期预警。
|
||||
7. 关联 OA 交货期限、验收单归档等事件。
|
||||
8. 按固定规则计算预警日,写入预警实例并做去重。
|
||||
9. 通过企业微信通知采购负责人,并在工作台记录处理状态和证据。
|
||||
|
||||
## 4. 标准模板与非模板合同分流
|
||||
|
||||
```mermaid
|
||||
flowchart TD
|
||||
A[合同附件进入系统] --> B{模板指纹是否命中}
|
||||
B -->|命中标准V4| C[定位固定章节]
|
||||
C --> D[提取金额/比例/期限/交货日/质保期]
|
||||
D --> E{金额与条款校验通过?}
|
||||
E -->|是| F[自动启用预警]
|
||||
E -->|否| G[异常卡片]
|
||||
B -->|未命中| H[Agent提取候选计划]
|
||||
H --> I{置信度与规则校验}
|
||||
I -->|高置信度| F
|
||||
I -->|轻微不确定| J[草稿+每日汇总]
|
||||
I -->|重大异常| G
|
||||
J --> K[采购一键启用或改一个字段]
|
||||
G --> K
|
||||
K --> F
|
||||
```
|
||||
|
||||
### 4.1 标准模板识别
|
||||
|
||||
模板识别不依赖单一文件名,建议使用组合指纹:
|
||||
|
||||
- 合同标题包含“设备买卖合同”或同义标题。
|
||||
- 存在“付款方式”“交货”“验收”“保固”等固定章节。
|
||||
- 付款条款中存在“预付款 / 出货款 / 验收款 / 质保款”等阶段词。
|
||||
- 存在版本号或稳定条款句式。
|
||||
- 章节顺序和付款条款位置符合模板特征。
|
||||
|
||||
识别结果保存 `template_code`、`template_version`、`parser_version`,便于后续模板升级和回溯。
|
||||
|
||||
### 4.2 标准模板解析
|
||||
|
||||
标准模板采用“章节定位 + 正则抽取 + 确定性计算”,不让模型自由决定日期:
|
||||
|
||||
- 从“付款方式”章节提取合同总价、各阶段比例和金额。
|
||||
- 从“交货”章节提取交货期限。
|
||||
- 从“保固”或付款条款提取质保期限。
|
||||
- 将验收款、质保款绑定到 OA 的验收单归档事件。
|
||||
- 保留合同原文条件,不把业务预警规则伪装成合同原文。
|
||||
|
||||
### 4.3 非模板合同处理
|
||||
|
||||
非模板合同不直接要求采购填写完整付款计划,而是自动输出候选计划:
|
||||
|
||||
```json
|
||||
{
|
||||
"nodes": [
|
||||
{
|
||||
"type": "acceptance",
|
||||
"amount": 72000,
|
||||
"payment_days": 30,
|
||||
"anchor": "acceptance_archive",
|
||||
"evidence": "合同第3条第2款",
|
||||
"confidence": 0.94
|
||||
}
|
||||
],
|
||||
"warnings": ["合同同时出现验收合格和发票到达两个条件"]
|
||||
}
|
||||
```
|
||||
|
||||
系统按风险等级处理:
|
||||
|
||||
| 等级 | 判定 | 系统行为 | 采购是否被打扰 |
|
||||
| --- | --- | --- | --- |
|
||||
| A 自动启用 | 模板命中、金额平衡、日期完整、无冲突 | 自动生成节点并启用预警 | 否 |
|
||||
| B 待观察 | 大部分字段可靠,存在轻微不确定 | 生成草稿,放入每日汇总 | 不立即打扰 |
|
||||
| C 异常待处理 | 金额不平、关键日期缺失、条件冲突 | 暂停不确定预警,生成异常卡片 | 仅异常时提醒 |
|
||||
|
||||
## 5. 付款计划如何从合同条款编译出来
|
||||
|
||||
每个付款节点统一转换为:
|
||||
|
||||
```text
|
||||
付款节点 = 金额/比例 + 合同条件 + 日期锚点 + 付款到期规则 + 预警规则 + 证据位置
|
||||
```
|
||||
|
||||
### 5.1 第一版规则
|
||||
|
||||
#### 出货款
|
||||
|
||||
```text
|
||||
预警日 = 合同交货期限 - 14 个自然日
|
||||
```
|
||||
|
||||
卖方通知发货日期字段先保留,但第一版不依赖该字段。后续能从 OA 或其他系统获取时,作为独立事件追加预警;若与交货期限预警冲突,两条都发送。
|
||||
|
||||
#### 验收款
|
||||
|
||||
```text
|
||||
触发日 = OA验收单归档日
|
||||
付款到期日 = 验收单归档日 + 合同约定天数
|
||||
```
|
||||
|
||||
验收单归档后立即发送“条件已满足/请及时发起付款”通知。
|
||||
|
||||
#### 质保款
|
||||
|
||||
```text
|
||||
质保到期日 = OA验收单归档日 + 合同约定质保期限
|
||||
```
|
||||
|
||||
质保提醒提前量不写死在解析结果中,先作为规则配置;0 元质保款不产生付款预警。
|
||||
|
||||
## 6. 以标准设备采购合同为例
|
||||
|
||||
根据同类标准模板的固定结构,付款方式通常出现在“付款方式”章节,交货期限出现在“交货”章节,质保期出现在“保固”章节。系统按以下方式拆解:
|
||||
|
||||
| 合同内容 | 识别方式 | 标准化字段 | 预警处理 |
|
||||
| --- | --- | --- | --- |
|
||||
| 合同总价 | 付款方式章节/设备明细合计 | `contract_total_amount` | 用于金额平衡校验 |
|
||||
| 预付款 | “签约后 N 日内支付预付款” | `prepayment` + `signed_date` | 可暂不纳入本期核心预警 |
|
||||
| 出货款 | “出货款”“发货前”“通知发货” | `shipment` | 第一版按交货期限前 14 个自然日 |
|
||||
| 验收款 | “验收合格”“验收后 N 天” | `acceptance` + `acceptance_archive` | 归档后立即提醒,归档日起算 |
|
||||
| 质保款 | “质保期满后支付” | `warranty` + `acceptance_archive` | 归档日起算质保期 |
|
||||
| 交货期限 | “交货期限:……日前” | `delivery_deadline` | 交货期限前 14 天预警 |
|
||||
| 质保期限 | “保固/质保 N 年/月” | `warranty_period` | 计算质保到期日 |
|
||||
|
||||
系统展示给采购的不是解析过程,而是简洁结果卡:
|
||||
|
||||
```text
|
||||
已识别为:设备采购合同标准模板 V4
|
||||
已生成:出货款、验收款、质保款 3 个付款节点
|
||||
校验结果:金额合计通过;交货期限已识别;质保期限已识别
|
||||
处理方式:自动启用预警,无需采购确认
|
||||
```
|
||||
|
||||
## 7. 预警时序
|
||||
|
||||
```mermaid
|
||||
sequenceDiagram
|
||||
participant OA as OA
|
||||
participant HX as HXOPS规则引擎
|
||||
participant WX as 企业微信
|
||||
participant P as 采购负责人
|
||||
|
||||
OA->>HX: 新增合同+附件
|
||||
HX->>HX: 模板识别与付款计划拆解
|
||||
HX->>HX: 金额/日期/条款校验
|
||||
HX->>HX: 生成预警实例并去重
|
||||
Note over HX: 交货期限前14个自然日
|
||||
HX->>WX: 出货款预警
|
||||
WX->>P: 通知采购提前发起付款
|
||||
OA->>HX: 验收单归档
|
||||
HX->>HX: 从归档日计算验收款和质保期
|
||||
HX->>WX: 验收款立即预警
|
||||
WX->>P: 通知采购发起付款
|
||||
HX->>HX: 到达质保提醒窗口
|
||||
HX->>WX: 质保款预警
|
||||
P->>HX: 更新已发起付款/已付款
|
||||
HX->>HX: 停止后续提醒
|
||||
```
|
||||
|
||||
## 8. 采购为什么不会被大量打扰
|
||||
|
||||
- 标准模板合同自动启用,不发确认消息。
|
||||
- 非模板合同先自动解析,只有校验失败才进入异常队列。
|
||||
- 异常采用每日汇总,而不是每份合同单独弹窗。
|
||||
- 采购只确认异常字段,不重复录入合同金额和全部节点。
|
||||
- 同一合同只保留一个当前异常卡片,避免重复提醒。
|
||||
- 临近交货期限仍未解决的异常,才升级为高优先级通知。
|
||||
|
||||
异常卡片示例:
|
||||
|
||||
```text
|
||||
合同 5204-2608030004
|
||||
系统已识别出货款,但 OA 合同未提供交货期限。
|
||||
当前不会生成出货款预警日期。
|
||||
|
||||
[补齐交货期限] [暂不处理]
|
||||
```
|
||||
|
||||
## 9. 建议的数据分层
|
||||
|
||||
| 数据层 | 保存内容 | 用途 |
|
||||
| --- | --- | --- |
|
||||
| 原始层 | OA 原始字段、附件地址、OCR 文本、同步时间 | 审计和重新解析 |
|
||||
| 解析层 | 模板识别结果、付款条款 JSON、置信度、页码/条款证据 | 解释和异常处理 |
|
||||
| 业务层 | 标准化付款节点、预警日、状态、通知记录 | 工作台和企业微信 |
|
||||
|
||||
每个日期都要能追溯到“来源 + 计算规则”,例如:
|
||||
|
||||
> 质保到期日 2027-08-04 = OA 验收单归档日 2026-08-04 + 合同第 3 条约定的 12 个月质保期。
|
||||
|
||||
## 10. 实施建议
|
||||
|
||||
### 第一期
|
||||
|
||||
- OA 新增合同同步。
|
||||
- 合同附件下载、文本抽取/OCR。
|
||||
- 标准模板 V4 识别和解析器。
|
||||
- 非模板 Agent 候选抽取。
|
||||
- 统一规则校验和 A/B/C 风险分级。
|
||||
- 出货款、验收款、质保款预警。
|
||||
- 企业微信通知采购负责人。
|
||||
- 工作台查看依据、状态和异常卡片。
|
||||
|
||||
### 第二期
|
||||
|
||||
- 增加更多已确认模板解析器。
|
||||
- 对接 OA 付款申请状态。
|
||||
- 支持部门负责人/财务抄送和逾期升级。
|
||||
- 增加合同变更和补充协议版本处理。
|
||||
|
||||
## 11. 需要业务确认的少量事项
|
||||
|
||||
这些事项不阻塞标准模板自动化,但会影响异常合同和后续版本:
|
||||
|
||||
1. 质保款提前多少天提醒。
|
||||
2. 付款完成状态最终来自 OA、财务系统还是人工补录。
|
||||
3. 企业微信是否抄送部门负责人和财务。
|
||||
4. 同一合同多张验收单是分别触发还是全部验收完成后触发。
|
||||
|
||||
@@ -0,0 +1,435 @@
|
||||
# 合同付款预警 Agent 落地方案(V2)
|
||||
|
||||
> 范围修订:第一版只处理 OA 流程归档后的合同。归档时获取的合同视为最终版本,暂不做 SHA256 校验、合同版本比对或合同变更监控。
|
||||
|
||||
## 1. 本版要回答的四个问题
|
||||
|
||||
本方案按真实落地顺序说明:
|
||||
|
||||
1. HXOPS 如何对接 OA,获得新增合同和合同附件?
|
||||
2. 合同附件是否保存,保存什么,如何解析 `.doc/.docx/.pdf/扫描件`?
|
||||
3. 解析结果如何编译成可执行的付款计划?
|
||||
4. 付款计划生成后,如何计算并发送企业微信预警?
|
||||
|
||||
核心结论:**OA 负责提供事实,HXOPS 负责留存和解析,规则引擎负责生成付款计划,通知服务最后才负责提醒。** Agent 只参与模板识别、非模板条款抽取和异常解释,不直接决定最终付款日期。
|
||||
|
||||
## 2. 总体架构
|
||||
|
||||
```mermaid
|
||||
flowchart LR
|
||||
OA[OA合同申请单归档/验收单归档通知] --> A[OA接入适配层]
|
||||
A --> B[合同同步任务]
|
||||
B --> C[归档合同原文存储]
|
||||
C --> D[文本抽取/OCR]
|
||||
D --> E[模板识别]
|
||||
E -->|标准模板| F[模板解析器]
|
||||
E -->|非模板| G[Agent候选抽取]
|
||||
F --> H[付款条款标准化]
|
||||
G --> H
|
||||
H --> I[确定性规则校验]
|
||||
I -->|通过| J[付款计划生成]
|
||||
I -->|异常| K[异常池/轻量确认]
|
||||
K --> J
|
||||
J --> L[OA事件关联]
|
||||
L --> M[预警实例计算/去重]
|
||||
M --> N[企业微信通知]
|
||||
```
|
||||
|
||||
## 3. OA 对接方案
|
||||
|
||||
### 3.1 对接目标
|
||||
|
||||
HXOPS 第一版只需要从 OA 读取,不回写 OA。至少要获取:
|
||||
|
||||
| 数据 | 用途 | 最低字段 |
|
||||
| --- | --- | --- |
|
||||
| 合同申请单归档通知 | 创建合同记录和解析任务 | 通知 ID、OA 流程记录 ID、合同号、采购单号、归档时间、状态 |
|
||||
| 合同主数据 | 展示和生成计划 | 供应商、合同金额、币种、采购负责人、合同附件地址 |
|
||||
| 合同附件 | 拆解付款条款 | 附件下载地址或 OA 附件 ID、文件名、文件类型 |
|
||||
| 交货信息 | 计算出货款预警 | 合同交货期限;若没有结构化字段则从附件解析 |
|
||||
| 验收单归档通知 | 触发验收款/质保款 | 通知 ID、验收单 ID、合同号、归档状态、归档时间 |
|
||||
|
||||
### 3.2 推荐的对接抽象
|
||||
|
||||
业务层不直接依赖某一种 OA 接入方式,定义统一适配器:
|
||||
|
||||
```python
|
||||
class ContractSourceAdapter(Protocol):
|
||||
def list_new_contracts(self, since: datetime) -> list[ContractSourceRecord]: ...
|
||||
def download_attachment(self, attachment_id: str) -> BinaryStream: ...
|
||||
def list_acceptance_events(self, since: datetime) -> list[AcceptanceSourceEvent]: ...
|
||||
```
|
||||
|
||||
第一版根据 OA 实际能力选择实现:
|
||||
|
||||
| 方式 | 适用情况 | 推荐度 | 说明 |
|
||||
| --- | --- | --- | --- |
|
||||
| SQL Server 只读视图 | OA 数据库可访问,能提供合同/附件/验收视图 | 高 | 先落地最快;查询逻辑封装在 `services/integrations/oa` |
|
||||
| OA HTTP/SOAP 接口 | OA 有稳定接口和附件下载接口 | 高 | 长期更清晰;接口适配器可替换视图适配器 |
|
||||
| OA 导出文件 | 暂无接口/视图,只能定期导出 | 过渡 | 可用于 PoC,不建议作为长期方案 |
|
||||
|
||||
建议采用:**统一适配器 + 第一版优先只读视图或现成接口,二者不可得时才采用导出文件过渡。** 不让合同解析逻辑知道 OA 的表名、接口路径或 SOAP 结构。
|
||||
|
||||
### 3.3 同步方式
|
||||
|
||||
第一版采用定时增量同步,不依赖 OA 回调:
|
||||
|
||||
```text
|
||||
每天/每小时触发同步
|
||||
→ 识别“合同申请单归档”通知,按通知 ID 去重
|
||||
→ 用 source_system + oa_record_id 去重
|
||||
→ 新合同进入合同解析队列
|
||||
→ 识别“验收单归档”通知,按通知 ID 去重并进入事件队列
|
||||
→ 可选记录“卖方通知发货”“设备到货”事件(有则记录,无则不等待)
|
||||
```
|
||||
|
||||
同步任务需要支持:分页、超时重试、断点续传、原始响应摘要、失败重试次数和人工重跑。
|
||||
|
||||
### 3.4 OA 对接待确认清单
|
||||
|
||||
这些是开发前必须向 OA 管理员确认的具体信息:
|
||||
|
||||
1. 合同台账或流程表单的名称、主键和审批通过状态值。
|
||||
2. 合同号、供应商、金额、采购负责人、附件 ID 所在字段。
|
||||
3. 附件是否可以通过接口直接下载;如果只有 OA 内部地址,是否需要登录态或服务账号。
|
||||
4. 验收单与合同通过什么字段关联;“归档”对应哪个状态值和时间字段。
|
||||
5. 是 SQL Server 视图还是 HTTP/SOAP 接口;连接账号、白名单和调用频率限制。
|
||||
|
||||
## 4. 合同是否保存:归档后保存原文
|
||||
|
||||
### 4.1 为什么必须保存
|
||||
|
||||
合同在 OA 流程归档后获取并保存原文。归档版本视为最终版本,保存合同是为了:
|
||||
|
||||
- 解析失败后重试,不必再次请求 OA。
|
||||
- 模板解析器升级后重新解析历史新增合同。
|
||||
- 采购查看付款计划的原文依据。
|
||||
- 审计付款计划的原文依据。
|
||||
- 处理 OA 链接过期或 OA 暂时不可用。
|
||||
|
||||
### 4.2 保存内容
|
||||
|
||||
不建议把合同文件放 PostgreSQL 大字段中,建议:
|
||||
|
||||
```text
|
||||
MinIO/对象存储:合同原文件、转换后的 PDF、OCR 中间文件
|
||||
PostgreSQL:合同元数据、对象 key、归档时间、解析状态、证据位置
|
||||
```
|
||||
|
||||
合同保存记录至少包括:
|
||||
|
||||
| 字段 | 说明 |
|
||||
| --- | --- |
|
||||
| source_system | `oa` |
|
||||
| oa_record_id | OA 合同记录唯一 ID |
|
||||
| attachment_id | OA 附件 ID |
|
||||
| object_key | MinIO 对象路径 |
|
||||
| mime_type | doc/docx/pdf/image |
|
||||
| archived_at | OA 流程归档时间 |
|
||||
| stored_at | HXOPS 保存时间 |
|
||||
| parse_status | pending/running/succeeded/failed/needs_review |
|
||||
| parser_version | 模板解析器或 Agent 提取版本 |
|
||||
|
||||
### 4.3 归档后的文件处理
|
||||
|
||||
第一版只处理 OA 流程归档时拿到的合同文件:保存原文件,记录归档时间、附件 ID、文件名和解析状态。后续不主动监控合同变化,也不因为附件变化重新生成付款计划。只有新增且已归档的合同进入付款计划生成;历史已完成合同不回补。
|
||||
|
||||
## 5. 合同解析流水线
|
||||
|
||||
```mermaid
|
||||
flowchart TD
|
||||
A[合同原文件] --> B{文件类型}
|
||||
B -->|docx| C[读取段落/表格]
|
||||
B -->|doc| D[转PDF或兼容文本抽取]
|
||||
B -->|可复制PDF| E[PDF文本抽取]
|
||||
B -->|扫描PDF/图片| F[OCR识别]
|
||||
C --> G[统一文档结构]
|
||||
D --> G
|
||||
E --> G
|
||||
F --> G
|
||||
G --> H[模板指纹识别]
|
||||
H -->|标准模板| I[章节/正则规则解析]
|
||||
H -->|非模板| J[Agent结构化抽取]
|
||||
I --> K[付款条款候选]
|
||||
J --> K
|
||||
K --> L[金额/比例/日期/证据校验]
|
||||
```
|
||||
|
||||
### 5.1 统一文档结构
|
||||
|
||||
无论输入格式是什么,先转成统一结构:
|
||||
|
||||
```json
|
||||
{
|
||||
"pages": [
|
||||
{
|
||||
"page_no": 2,
|
||||
"blocks": [
|
||||
{"type": "paragraph", "text": "付款方式:..."},
|
||||
{"type": "table", "cells": [["设备名称", "数量", "总价"]]}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
这样后续解析器只处理“段落、表格、页码、坐标”,不需要分别适配 Word、PDF 和 OCR。
|
||||
|
||||
### 5.2 标准模板解析
|
||||
|
||||
标准模板使用确定性解析器:
|
||||
|
||||
1. 用标题、章节顺序、固定短语识别模板版本。
|
||||
2. 在“付款方式”章节提取合同总价和付款阶段。
|
||||
3. 用金额正则识别人民币金额、百分比和中文大写金额。
|
||||
4. 在“交货”章节提取交货期限。
|
||||
5. 在“保固/质保”章节提取年/月等期限。
|
||||
6. 每个提取字段保存原文、页码和字符区间。
|
||||
7. 运行金额合计、比例合计和日期完整性校验。
|
||||
|
||||
模板合同成功时,采购不需要确认;工作台只展示“已按模板自动生成”。
|
||||
|
||||
### 5.3 非模板解析
|
||||
|
||||
非模板合同由 Agent 输出固定 JSON,不允许自由文本作为业务结果:
|
||||
|
||||
```json
|
||||
{
|
||||
"contract_total": {"value": 360000, "currency": "CNY", "evidence": "第1页"},
|
||||
"payment_nodes": [
|
||||
{
|
||||
"type": "shipment",
|
||||
"amount": 180000,
|
||||
"percent": 50,
|
||||
"anchor": "delivery_deadline",
|
||||
"offset_days": -14,
|
||||
"calendar": "natural_day",
|
||||
"evidence": "付款方式第2款",
|
||||
"confidence": 0.93
|
||||
}
|
||||
],
|
||||
"warnings": []
|
||||
}
|
||||
```
|
||||
|
||||
Agent 的抽取结果必须经过程序校验,不能直接生成正式预警。
|
||||
|
||||
## 6. 如何生成付款计划
|
||||
|
||||
### 6.1 付款计划不是解析结果,而是编译结果
|
||||
|
||||
合同解析先得到“付款条款候选”,再结合业务规则和 OA 事件,编译成付款计划:
|
||||
|
||||
```text
|
||||
合同条款候选
|
||||
+ OA合同字段
|
||||
+ 验收单归档通知
|
||||
+ 第一版预警规则
|
||||
→ 可执行付款计划
|
||||
```
|
||||
|
||||
### 6.2 标准付款节点模型
|
||||
|
||||
```json
|
||||
{
|
||||
"contract_id": 101,
|
||||
"node_no": 2,
|
||||
"node_type": "acceptance",
|
||||
"amount": 72000,
|
||||
"percentage": 20,
|
||||
"currency": "CNY",
|
||||
"contract_condition_text": "验收合格并收到合法发票后30天内支付",
|
||||
"anchor_type": "acceptance_archive",
|
||||
"anchor_date": "2026-08-04",
|
||||
"payment_due_date": "2026-09-03",
|
||||
"alert_rules": [
|
||||
{"event": "acceptance_archive", "offset_days": 0, "action": "notify"}
|
||||
],
|
||||
"source_evidence": {"page": 2, "section": "付款方式"},
|
||||
"status": "active"
|
||||
}
|
||||
```
|
||||
|
||||
### 6.3 第一版编译规则
|
||||
|
||||
| 节点 | 锚点 | 计算 | 生成条件 |
|
||||
| --- | --- | --- | --- |
|
||||
| 出货款 | `delivery_deadline` | 预警日 = 交货期限 - 14 个自然日 | 有交货期限即可生成;金额缺失则金额待确认 |
|
||||
| 验收款 | `acceptance_archive` | 触发日 = 归档日;到期日 = 归档日 + 合同天数 | 有验收款条款;归档前日期为空 |
|
||||
| 质保款 | `acceptance_archive` | 质保到期 = 归档日 + 质保期限;到期前 14 个自然日提醒 | 有质保款且金额 > 0 |
|
||||
|
||||
### 6.4 校验与风险分级
|
||||
|
||||
付款计划生成前至少校验:
|
||||
|
||||
- 节点金额合计是否等于合同总额。
|
||||
- 节点比例合计是否等于 100%。
|
||||
- 金额和比例是否互相一致。
|
||||
- 交货期限、验收归档锚点、质保期限是否可计算。
|
||||
- “验收合格”“发票收到”等条件是否存在冲突。
|
||||
- 证据位置是否存在。
|
||||
|
||||
处理结果:
|
||||
|
||||
| 结果 | 处理 |
|
||||
| --- | --- |
|
||||
| 通过 | 自动生成付款计划并启用可确定的预警 |
|
||||
| 部分通过 | 生成计划草稿;可确定的日期正常预警,不确定金额/期限标记待确认 |
|
||||
| 失败 | 不生成正式金额/日期预警,进入异常池;每日汇总给采购 |
|
||||
|
||||
## 7. 最后才是预警
|
||||
|
||||
```mermaid
|
||||
sequenceDiagram
|
||||
participant OA as OA
|
||||
participant S as 同步与解析服务
|
||||
participant P as 付款计划服务
|
||||
participant W as 企业微信
|
||||
participant U as 采购负责人
|
||||
|
||||
OA->>S: 合同申请单归档通知
|
||||
S->>S: 保存 OA 归档附件
|
||||
S->>S: 文本抽取/OCR/模板识别
|
||||
S->>P: 付款条款候选+证据
|
||||
P->>P: 金额/比例/日期/规则校验
|
||||
P->>P: 生成付款计划与预警实例
|
||||
Note over P: 计划通过后才进入提醒扫描
|
||||
P->>W: 交货期限前14天出货款提醒
|
||||
OA->>P: 验收单归档通知
|
||||
P->>W: 验收款归档后立即提醒
|
||||
P->>P: 计算质保期满日
|
||||
P->>W: 到达质保提醒窗口后提醒
|
||||
W->>U: 企业微信通知
|
||||
U->>P: 手工更新已发起付款/已付款
|
||||
```
|
||||
|
||||
### 7.1 预警实例去重
|
||||
|
||||
唯一键建议:
|
||||
|
||||
```text
|
||||
payment_node_id + alert_rule_id + scheduled_date + recipient_user_id
|
||||
```
|
||||
|
||||
同一节点同一规则同一天只发送一次。发送、失败、重试、打开时间均记录审计。
|
||||
|
||||
### 7.2 企业微信消息内容
|
||||
|
||||
消息只使用已经通过规则校验的字段:
|
||||
|
||||
- 合同号、供应商。
|
||||
- 付款节点和金额;金额不确定时明确显示“待确认”,不猜测。
|
||||
- 触发依据和付款到期日。
|
||||
- 合同/付款节点详情链接。
|
||||
- 建议动作:发起付款、补齐数据或查看合同依据。
|
||||
|
||||
## 8. 第一版建议的系统模块
|
||||
|
||||
```text
|
||||
OAContractSourceAdapter OA合同/验收读取
|
||||
ContractSyncService 增量同步与幂等
|
||||
ContractArtifactService 归档附件保存、解析状态和证据
|
||||
DocumentExtractionService doc/docx/pdf/OCR统一抽取
|
||||
ContractTemplateDetector 模板识别
|
||||
TemplatePaymentParser 标准模板确定性解析
|
||||
PaymentClauseAgent 非模板JSON候选抽取
|
||||
PaymentPlanCompiler 付款计划编译
|
||||
PaymentPlanValidator 金额/日期/条款校验
|
||||
PaymentAlertScheduler 预警实例扫描与去重
|
||||
WecomPaymentNotifier 企业微信通知和审计
|
||||
```
|
||||
|
||||
## 9. 第一版端到端示例
|
||||
|
||||
以标准设备采购合同为例:
|
||||
|
||||
1. OA 账号收到“合同申请单归档”通知,读取合同记录 `OA-CONTRACT-84261`、合同编号、采购单号和附件。
|
||||
2. HXOPS 保存 OA 流程归档时的原文件,状态记为 `stored`。
|
||||
3. `.doc` 转换/抽取为统一段落和表格结构。
|
||||
4. 模板识别命中“设备采购合同 V4”。
|
||||
5. 解析出:合同总额 360,000;出货款 180,000;验收款 72,000;质保款 0。
|
||||
6. 解析出交货期限 2026-08-20,生成出货款预警日 2026-08-06。
|
||||
7. 未来 OA 账号收到“验收单归档”通知时:验收款立即预警,付款到期日按合同约定计算;质保款因金额为 0 不生成提醒。
|
||||
8. 采购在工作台更新“已发起付款/已付款”,系统停止该节点后续提醒。
|
||||
|
||||
## 10. 开发前必须确认的 OA 信息
|
||||
|
||||
这几项确认后,才能从方案进入接口设计:
|
||||
|
||||
1. OA 合同记录的查询视图或接口、审批通过状态值。
|
||||
2. 附件下载方式:附件 ID、接口 URL、是否需要服务账号。
|
||||
3. 合同与验收单的关联字段。
|
||||
4. 验收单“归档”状态值和归档时间字段。
|
||||
5. OA 是否允许按更新时间增量查询。
|
||||
6. OA SQL Server 只读账号或 HTTP/SOAP 接口账号,以及访问白名单。
|
||||
7. 合同附件是否可能是旧 `.doc`、`.docx`、PDF、扫描件,样例比例如何。
|
||||
|
||||
## 11. 本版实施补充:把四个关键问题落到系统对象
|
||||
|
||||
### 11.1 OA 对接先固定 HXOPS 内部契约
|
||||
|
||||
第一版不让业务逻辑直接依赖 OA 表名或接口路径,统一由 `ContractSourceAdapter` 输出以下对象:
|
||||
|
||||
| 内部对象 | 必填字段 | 落库时机 |
|
||||
| --- | --- | --- |
|
||||
| `ContractSourceRecord` | `source_system`、`oa_notification_id`、`oa_record_id`、`contract_no`、`purchase_order_no`、`archived_at`、`status` | 读取合同申请单归档通知后立即落同步表 |
|
||||
| `ContractAttachmentSource` | `attachment_id`、文件名、类型、下载凭证、更新时间 | 合同记录落库后立即落附件表 |
|
||||
| `AcceptanceSourceEvent` | `oa_notification_id`、`acceptance_id`、`contract_no`、归档状态、归档时间 | 读取验收单归档通知后立即落事件表 |
|
||||
| `SyncRun` | 游标、起止时间、分页数、重试次数、错误信息 | 每次同步任务开始和结束各写一次 |
|
||||
|
||||
同步事务建议为:读取通知 → 写入合同主记录/验收事件 → 写入附件清单 → 提交事务 → 投递附件下载任务。附件下载失败不回滚通知记录,而是进入可重试状态。合同归档通知和验收归档通知都用通知唯一 ID 幂等。
|
||||
|
||||
### 11.2 合同附件取到后立即保存
|
||||
|
||||
合同原文必须在 OA 流程归档后下载成功时立即保存:原文件放 MinIO,PostgreSQL 保存 OA 记录、附件 ID、对象 key、归档时间、解析状态和证据位置。保存与解析解耦,原文一旦 `stored`,后续解析服务不可用也不必重新访问 OA。
|
||||
|
||||
建议状态机如下:
|
||||
|
||||
```text
|
||||
discovered → stored → extracting → parsed → plan validation → active
|
||||
├──────────────→ needs_review
|
||||
└──────────────→ failed(可人工重跑)
|
||||
```
|
||||
|
||||
原文件只读保存;解析结果按 `parser_version` 追加,不覆盖历史结果。第一版不做 SHA256 去重、版本比对和合同变更监控,也不因附件变化重新生成付款计划。
|
||||
|
||||
### 11.3 解析分流:模板自动化,异常才触达采购
|
||||
|
||||
- DOCX:读取段落和表格;DOC:先转 PDF/兼容文本;可复制 PDF:抽取文本和表格;扫描 PDF/图片:OCR 并保留页码、坐标和置信度。
|
||||
- 标准模板先做模板指纹识别,再用确定性章节/正则解析,不让大模型自由决定金额和日期。
|
||||
- 非模板由 Agent 只输出固定 JSON 候选,程序统一校验金额、比例、日期锚点、条件冲突和证据位置。
|
||||
- 默认“自动通过优先,异常才打扰”:模板或非模板在校验通过时自动启用,采购只收到异常摘要,不逐份确认。
|
||||
|
||||
异常分三级:P0(总额/金额无法确定)阻断金额预警;P1(比例不闭合、质保期冲突)暂停冲突节点;P2(例如其他条件但暂未接入数据)不阻断第一版规则提醒,但在消息中注明限制。验收款按验收单归档通知无条件提醒,不判断发票条件。
|
||||
|
||||
### 11.4 付款计划是编译结果,不是原文复制
|
||||
|
||||
```text
|
||||
付款条款候选 + OA 主数据/事件 + 第一版业务规则
|
||||
→ 金额/比例/期限标准化
|
||||
→ 计算日期锚点
|
||||
→ 校验和风险分级
|
||||
→ 生成 draft / active / needs_review 付款计划节点
|
||||
```
|
||||
|
||||
第一版规则保持不变:出货款按交货期限前 14 个自然日;验收款按验收单归档日立即提醒,不判断发票条件,付款到期日按归档日加合同约定天数;质保期从验收单归档日开始计算,并在质保到期前 14 个自然日提醒。只有 `active` 节点才允许生成正式提醒。
|
||||
|
||||
以已提供的设备采购合同为例:总额 360,000 元,预付款 30%、出货款 50%(180,000 元)、验收款 20%(72,000 元),交货期限 2026-08-20,则出货款提醒日为 2026-08-06;验收款在归档事件到达时立即提醒;质保款金额为 0 不生成付款提醒。该合同同时出现“质保期 18 个月”和“整机/激光器保固 1 年”,应进入 P1 冲突,不得由 Agent 猜测期限。
|
||||
|
||||
### 11.5 最后才是企业微信预警
|
||||
|
||||
预警服务只扫描 `active` 节点或消费验收单归档通知事件;“卖方通知发货”“设备到货”是可选履约事件,不作为第一版出货款预警的必需条件:
|
||||
|
||||
1. 计算待发送实例并按 `payment_node_id + alert_rule_id + scheduled_date + recipient_user_id` 去重;
|
||||
2. 第一版主送合同采购负责人,负责人缺失进入异常池,不群发;
|
||||
3. 发送成功、失败、重试、点击详情和采购标记“已发起付款/已付款”均写审计记录;
|
||||
4. 出货款不依赖 OA 发货通知或设备到货事件,完全按合同交付期限前 14 个自然日计算;如果后续供应商能提供这两个事件,系统只记录并展示,不替代主规则。
|
||||
|
||||
## 12. 建议的 PoC 验收顺序
|
||||
|
||||
| 阶段 | 样例 | 通过标准 |
|
||||
| --- | --- | --- |
|
||||
| OA 只读接入 | 1 条新增合同、1 条验收归档单 | 按更新时间增量拉取,重复执行不重复入库 |
|
||||
| 原文留存 | DOC、DOCX、可复制 PDF 各 1 份 | 归档原文可下载、解析失败可重试 |
|
||||
| 解析和计划 | 标准模板 3 份、非模板 2 份 | 节点金额/比例/证据正确,冲突进入异常池 |
|
||||
| 预警闭环 | 模拟交货期限和验收归档事件 | 只发送 active 节点,去重和审计完整 |
|
||||
@@ -0,0 +1,251 @@
|
||||
# 合同付款预警 Agent 方案 V3:合同台账与付款计划关联
|
||||
|
||||
## 一、这版要解决什么
|
||||
|
||||
合同从 OA 自动同步后,系统不能只生成一条孤立的付款提醒。采购需要能够回答:
|
||||
|
||||
- 这份合同是否已经保存到 HXOPS?
|
||||
- 付款计划是从哪份附件、哪一页条款解析出来的?
|
||||
- 哪个付款节点即将到期?
|
||||
- 这条企业微信提醒对应哪份合同、哪个节点、哪个 OA 事件?
|
||||
- 如果解析异常,采购只需要处理哪些问题?
|
||||
|
||||
因此,系统主链路调整为:
|
||||
|
||||
```mermaid
|
||||
flowchart LR
|
||||
A[OA自动同步合同] --> B[合同台账]
|
||||
B --> C[合同详情]
|
||||
C --> D[保存原文附件]
|
||||
D --> E[自动解析]
|
||||
E --> F{解析结果}
|
||||
F -->|标准模板且校验通过| G[自动生成付款计划]
|
||||
F -->|非模板但结果完整| G
|
||||
F -->|金额/日期/条款冲突| H[异常待处理]
|
||||
G --> I[付款计划节点]
|
||||
I --> J[出货款预警]
|
||||
I --> K[验收款预警]
|
||||
I --> L[质保款预警]
|
||||
J --> M[企业微信]
|
||||
K --> M
|
||||
L --> M
|
||||
```
|
||||
|
||||
本次确认的 OA 接入方式是页面自动化:使用用户名和密码登录测试账号,进入通知中心读取归档通知;登录无验证码。通知只负责发现记录,合同附件需要进入对应 OA 流程详情后再下载。
|
||||
|
||||
## 二、核心对象关系
|
||||
|
||||
```mermaid
|
||||
erDiagram
|
||||
CONTRACT ||--o{ CONTRACT_ATTACHMENT : contains
|
||||
CONTRACT ||--o{ PAYMENT_NODE : generates
|
||||
CONTRACT ||--o{ OA_EVENT : receives
|
||||
PAYMENT_NODE ||--o{ ALERT_INSTANCE : triggers
|
||||
CONTRACT {
|
||||
string contract_no
|
||||
decimal total_amount
|
||||
string oa_status
|
||||
string artifact_status
|
||||
string parse_status
|
||||
string plan_status
|
||||
string owner
|
||||
}
|
||||
CONTRACT_ATTACHMENT {
|
||||
string file_name
|
||||
string object_key
|
||||
string parse_status
|
||||
}
|
||||
PAYMENT_NODE {
|
||||
string node_type
|
||||
decimal amount
|
||||
date anchor_date
|
||||
date due_date
|
||||
string status
|
||||
}
|
||||
ALERT_INSTANCE {
|
||||
string alert_type
|
||||
date scheduled_date
|
||||
string send_status
|
||||
}
|
||||
```
|
||||
|
||||
对象关系原则:合同是主对象;附件、付款节点、OA 事件和预警记录都挂在合同上。付款计划不是手工独立创建,而是合同解析与规则编译后的结果。
|
||||
|
||||
## 三、页面结构
|
||||
|
||||
### 1. 付款预警工作台
|
||||
|
||||
面向采购每天处理待办,保留现有原型的统计卡片和付款节点列表。
|
||||
|
||||
建议展示:
|
||||
|
||||
| 字段 | 说明 |
|
||||
| --- | --- |
|
||||
| 合同号/供应商 | 点击进入合同详情 |
|
||||
| 下一笔应付 | 节点类型、金额、比例 |
|
||||
| 触发依据 | 交货期限前 14 天、验收单归档、质保期满等 |
|
||||
| 预警日期 | 已计算日期或“等待 OA 事件” |
|
||||
| 计划状态 | 待启用、进行中、即将到期、已逾期、已完成 |
|
||||
| 操作 | 查看合同、查看付款计划、登记事件、标记已付款 |
|
||||
|
||||
工作台只显示需要关注的付款节点,不承担合同原文管理。
|
||||
|
||||
### 2. 合同台账
|
||||
|
||||
这是 OA 合同申请单归档通知后的第一落点。系统自动登录 OA 读取通知,进入流程详情提取合同主数据和附件后,合同先进入合同台账,采购不需要手工新建付款计划。
|
||||
|
||||
列表字段:
|
||||
|
||||
| 字段 | 示例 |
|
||||
| --- | --- |
|
||||
| 合同号/供应商 | 5203-2607180001 / 杭州煜英智能科技有限公司 |
|
||||
| 采购单号 | PO-260718-0036;来自 OA 合同/采购单关联字段 |
|
||||
| 合同金额 | ¥360,000 |
|
||||
| OA 状态 | 审批通过、已归档 |
|
||||
| 合同保存状态 | 下载中、已保存、下载失败 |
|
||||
| 解析状态 | 待解析、解析通过、需处理、失败 |
|
||||
| 付款计划 | 未生成、草稿、已启用、异常 |
|
||||
| 采购负责人 | 张采购 |
|
||||
| 更新时间 | OA 最后更新时间 |
|
||||
|
||||
顶部筛选:全部、已保存、解析通过、需处理。点击合同进入合同详情。
|
||||
|
||||
### 3. 合同详情
|
||||
|
||||
建议采用“合同概览 + 标签页”的结构:
|
||||
|
||||
```text
|
||||
合同详情
|
||||
┌──────────────────────────────────────────┐
|
||||
│ 合同号:5203-2607180001 解析状态:自动通过 │
|
||||
│ 供应商:杭州煜英智能科技 计划状态:已启用 │
|
||||
├──────────────────────────────────────────┤
|
||||
│ 合同概览 | 原文附件 | 付款计划 | 预警记录 | 同步审计 │
|
||||
└──────────────────────────────────────────┘
|
||||
```
|
||||
|
||||
#### 合同概览
|
||||
|
||||
显示合同编号、采购单号、供应商、合同总额、币种、合同生效日期、约定到货日期、采购负责人、OA 原记录链接。付款预警列表、异常列表和企业微信提醒中也应同时携带合同编号与采购单号,便于采购按内部采购业务单据检索。
|
||||
|
||||
#### 原文附件
|
||||
|
||||
合同只在 OA 流程归档后获取,归档版本视为最终版本。页面显示原始文件名、文件类型、保存时间、文件来源和重新解析操作。文档管理系统中的同合同文件仅作为延迟补充,第一版不核对两边文件版本、不比较文件内容,也不做合同版本比对或合同变更监控。付款节点下方同时展示证据:原文片段、页码、章节、解析器版本。
|
||||
|
||||
#### 付款计划
|
||||
|
||||
按时间线展示预付款、出货款、验收款和质保款。每个节点显示金额、比例、日期锚点、锚点日期、付款到期日、提醒规则、当前状态和操作。
|
||||
|
||||
#### 预警记录
|
||||
|
||||
显示预警类型、计划发送时间、实际发送时间、收件人、企业微信发送结果、重试记录和采购处理状态。
|
||||
|
||||
#### 同步审计
|
||||
|
||||
显示 OA 登录、通知读取、进入流程详情、OA 附件下载、文档管理系统补充、原文保存、文本抽取、模板识别、条款解析、付款计划生成、预警发送的完整链路。
|
||||
|
||||
### 4. 异常待处理
|
||||
|
||||
只展示真正无法自动确定的合同,避免把人工确认变成每份合同的必经步骤。
|
||||
|
||||
| 等级 | 示例 | 系统动作 |
|
||||
| --- | --- | --- |
|
||||
| P0 阻断 | 合同总额无法识别、节点金额无法确定 | 不发送金额/日期预警,采购一键补字段 |
|
||||
| P1 需确认 | 质保期出现 18 个月和 1 年两种说法 | 暂停冲突节点,保留可确定节点 |
|
||||
| P2 提示 | 条款要求发票但第一版没有发票数据源 | 不阻断第一版提醒,消息中注明限制 |
|
||||
|
||||
## 四、合同到付款计划的过程
|
||||
|
||||
```mermaid
|
||||
flowchart TD
|
||||
A[OA合同申请单归档通知] --> B[合同主记录落库]
|
||||
B --> C[附件清单落库]
|
||||
C --> D[下载原文并保存 MinIO]
|
||||
D --> E{附件来源}
|
||||
E -->|OA及时附件| F[统一抽取段落/表格/页码]
|
||||
E -->|文档管理系统延迟补充| F
|
||||
F --> G{模板识别}
|
||||
G -->|标准模板| H[确定性解析]
|
||||
G -->|非模板| I[Agent固定JSON抽取]
|
||||
H --> J[金额/比例/日期/证据校验]
|
||||
I --> J
|
||||
J -->|通过| K[生成 active 付款计划]
|
||||
J -->|异常| L[生成 needs_review 异常]
|
||||
K --> M[关联验收单归档通知]
|
||||
M --> N[计算预警实例]
|
||||
N --> O[企业微信通知]
|
||||
```
|
||||
|
||||
## 五、第一版付款规则
|
||||
|
||||
| 节点 | 日期锚点 | 规则 |
|
||||
| --- | --- | --- |
|
||||
| 出货款 | 合同交货期限 | 交货期限前 14 个自然日提醒 |
|
||||
| 验收款 | OA 验收单归档日 | 归档后无条件立即提醒;付款到期日按归档日加合同约定天数 |
|
||||
| 质保款 | OA 验收单归档日 | 质保期从归档日开始计算;质保到期前 14 个自然日提醒;金额为 0 时不生成提醒 |
|
||||
|
||||
OA 上没有统一的厂商发货流程,第一版不等待发货事件;出货款完全按合同中的交付期限倒推 14 个自然日。“卖方通知发货”和“设备到货”作为可选履约事件保留:不同供应商可能有,也可能没有;有则记录展示,无则不阻断、不改变主预警规则。验收款和质保款由“验收单归档”通知触发。
|
||||
|
||||
验收款按业务要求处理:验收单归档通知到达后立即提醒,不等待、不判断合同中的发票条件;合同原文中的发票条件只作为证据展示,不参与第一版验收款预警计算。
|
||||
|
||||
合同申请单归档和验收单归档是 OA 上的两类不同流程,但都通过同一个测试账号的通知中心被识别:
|
||||
|
||||
```text
|
||||
合同申请单归档通知 → 创建合同主记录、获取合同编号/采购单号/合同附件
|
||||
验收单归档通知 → 按合同编号关联付款计划,触发验收款和质保款计算
|
||||
|
||||
卖方通知发货/设备到货 → 有则记录履约进度,无则继续按交付期限预警
|
||||
```
|
||||
|
||||
## 六、已确认的 OA 页面字段映射
|
||||
|
||||
根据当前 OA 页面样例,第一版按以下字段读取:
|
||||
|
||||
| OA 流程 | 页面字段 | HXOPS 用途 |
|
||||
| --- | --- | --- |
|
||||
| 合同申请单 | 流程编号 | `oa_record_id`,用于回到 OA 流程详情 |
|
||||
| 合同申请单 | 合同单位 | 供应商 |
|
||||
| 合同申请单 | 采购单号 | 采购单号;第一版与合同编号一对一 |
|
||||
| 合同申请单 | 合同金额、合同币别 | 合同总额和币种 |
|
||||
| 合同申请单 | 合同生效日期 | 合同日期证据 |
|
||||
| 合同申请单 | 约定到货日期 | 出货款预警日期 = 约定到货日期 - 14 个自然日 |
|
||||
| 合同申请单 | 合同附件 | 进入流程详情后下载的主合同及相关附件 |
|
||||
| 验收单 | 验收单号 | `acceptance_id` 和审计展示 |
|
||||
| 验收单 | 合同编号、采购单号 | 按合同编号关联付款计划,并用采购单号做一致性展示 |
|
||||
| 验收单 | 验收日期、厂商交货日期 | 验收事件证据和履约展示 |
|
||||
| 验收单 | 设备质保期 | 质保到期日 = 验收单归档日 + 质保期 |
|
||||
|
||||
## 七、文档管理系统补充规则
|
||||
|
||||
文档管理系统是固定目录结构,上传可能延迟几天,且不提供采购单号。因此:
|
||||
|
||||
1. OA 合同申请单归档通知先创建合同主记录,合同编号、采购单号、采购负责人和归档时间全部以 OA 为准。
|
||||
2. OA 流程附件下载成功时直接解析;下载失败或暂时不可用时,按固定目录和创建日期查询文档管理系统。
|
||||
3. 文档管理系统只按合同编号匹配文件,并以创建日期作为查询窗口;不以文档管理系统数据创建采购单号。
|
||||
4. 两边文件视为同一份合同,不核对版本、不比较文件内容,不生成版本差异异常。
|
||||
5. 在文档管理系统文件到达前,合同状态为“待补文件”,不生成正式付款节点预警;补到文件后继续解析。
|
||||
|
||||
## 八、原型更新范围
|
||||
|
||||
新增原型页面:
|
||||
|
||||
- 合同台账
|
||||
- 异常待处理
|
||||
|
||||
调整原有页面:
|
||||
|
||||
- “我的付款计划”改为“付款预警工作台”;
|
||||
- 计划详情增加合同关联状态、原文附件、解析依据;
|
||||
- 自动同步合同申请单从合同台账进入详情,不再默认进入“新建付款计划”;
|
||||
- 左侧导航改为“付款预警 / 合同台账 / 异常待处理”;
|
||||
- 企业微信卡片点击后跳转对应合同付款节点。
|
||||
|
||||
对应原型文件:`docs/features/contract-payment-plan/contract-payment-plan-workspace-prototype-v2.html`。
|
||||
|
||||
## 九、PoC 验收顺序
|
||||
|
||||
1. 测试账号能以用户名和密码自动登录 OA,读取合同申请单归档和验收单归档两类通知,重复执行不重复入库。
|
||||
2. 能进入合同流程详情下载附件;OA 附件作为主来源,文档管理系统按固定目录和创建日期做延迟补充。
|
||||
3. DOC、DOCX、PDF 原文能保存并重新解析;第一版不核对版本、不比较内容,也不做合同变更监控。
|
||||
4. 标准模板自动生成付款计划,非模板固定 JSON 抽取,冲突进入异常池。
|
||||
5. 付款预警工作台能按合同查看节点,企业微信提醒能追溯到合同和证据。
|
||||
@@ -1,6 +1,6 @@
|
||||
<!doctype html>
|
||||
<!doctype html>
|
||||
<!--
|
||||
docs/prototype/contract-payment-warning-workspace-prototype-v2.html
|
||||
docs/features/contract-payment-plan/contract-payment-warning-workspace-prototype-v2.html
|
||||
用途:合同付款预警第二版工作台原型,展示 OA 自动同步、三类付款节点预警、企微通知与人工处理闭环。
|
||||
依赖:浏览器原生 HTML/CSS/JavaScript,无需构建;通过本地静态服务即可运行。
|
||||
逻辑:OA 新增合同自动形成付款节点;出货款按交货期限前 14 个自然日提醒;验收单归档后立即提醒并起算验收款、质保款;
|
||||
@@ -0,0 +1,7 @@
|
||||
# 设备维保助手(equipment-maintenance)
|
||||
|
||||
| 文档 | 读者 | 路径 |
|
||||
| --- | --- | --- |
|
||||
| **聊天页低保真原型** | 产品、业务、测试 | [equipment-maintenance-agent-chat-lofi.html](equipment-maintenance-agent-chat-lofi.html) |
|
||||
|
||||
**状态**:见 [funclist.md](../../funclist.md)「设备维保助手」。
|
||||
@@ -1,6 +1,6 @@
|
||||
<!doctype html>
|
||||
<!doctype html>
|
||||
<!--
|
||||
docs/prototype/equipment-maintenance-agent-chat-lofi.html
|
||||
docs/features/equipment-maintenance/equipment-maintenance-agent-chat-lofi.html
|
||||
用途:设备维保助手在 HXOPS 智能体聊天页中的低保真原型,展示查询与配置如何共存。
|
||||
依赖:浏览器原生 HTML/CSS/JavaScript,无需构建;用于业务评审与交互确认。
|
||||
逻辑:左侧模拟当前智能体列表与会话历史;主区用快捷动作、对话消息、结果卡片和确认表单承载查询/配置流程。
|
||||
@@ -32,7 +32,7 @@
|
||||
| 读者 | 产品负责人、品质/RoHS 合规业务、研发评审、测试验收 |
|
||||
| 产品名称 | RoHS 文件检核 Agent |
|
||||
| 技术手册 | [本文第二部分:Chatflow 编排与部署](#第二部分chatflow-编排与部署手册) |
|
||||
| 进度底座 | [Agent 进度管理原型](prototype/agent_progress_prototype.md)(`view_type=async_batch`) |
|
||||
| 进度底座 | [Agent 进度管理原型](../../platform/agent_progress_prototype.md)(`view_type=async_batch`) |
|
||||
|
||||
---
|
||||
|
||||
@@ -299,7 +299,7 @@ flowchart TB
|
||||
|
||||
##### 2.1.2 与工作台进度通用底座的关系
|
||||
|
||||
RoHS 检核进度属于企业 AI 工作台 **Agent 进度管理通用底座** 中的 **`async_batch`(异步批次)** 视图,完整协议见 **[agent_progress_prototype.md](prototype/agent_progress_prototype.md)**。
|
||||
RoHS 检核进度属于企业 AI 工作台 **Agent 进度管理通用底座** 中的 **`async_batch`(异步批次)** 视图,完整协议见 **[agent_progress_prototype.md](../../platform/agent_progress_prototype.md)**。
|
||||
|
||||
| 维度 | RoHS 本 Agent 约定 | 进度底座统一约定 |
|
||||
|------|-------------------|----------------|
|
||||
@@ -320,7 +320,7 @@ RoHS 检核进度属于企业 AI 工作台 **Agent 进度管理通用底座**
|
||||
|------|----------|----------|----------|----------|
|
||||
| F1 | 发起检核 | 对话一键触发 SRM 未检核批量处理 | 自然语言如「执行 RoHS 检核」 | 批次号、启动确认、进度卡片 |
|
||||
| F2 | 检核进行中防护 | 避免重复启动导致并发冲突 | 同任务已有 running 批次 | `check_running` 提示 + 引导查询 |
|
||||
| F3 | 实时进度展示 | 随时了解检核进展 | `progress_id` 轮询 | `async_batch` 进度卡(见 [进度底座](prototype/agent_progress_prototype.md)) |
|
||||
| F3 | 实时进度展示 | 随时了解检核进展 | `progress_id` 轮询 | `async_batch` 进度卡(见 [进度底座](../../platform/agent_progress_prototype.md)) |
|
||||
| F4 | 查询指定批次 | 按批次 ID 查结果 | 「查询检核批次 ID 88」 | 状态、统计、Excel 链接、判定分布 |
|
||||
| F5 | 查询最近检核 | 快速看上一批结果 | 「查询最新一次 RoHS 检核」 | 同上 |
|
||||
| F6 | 查询全部批次 | 浏览历史批次列表 | 「查询所有文件检核结果」 | 批次列表摘要 |
|
||||
@@ -755,7 +755,7 @@ sequenceDiagram
|
||||
- [ ] 测试案例是否可执行、可验收?
|
||||
- [ ] 范围外事项是否明确?
|
||||
- [ ] 检核完成后知识库入库是否为必选项且不可跳过?
|
||||
- [ ] 与 [agent_progress_prototype.md](prototype/agent_progress_prototype.md) 中 `async_batch` 映射是否一致?
|
||||
- [ ] 与 [agent_progress_prototype.md](../../platform/agent_progress_prototype.md) 中 `async_batch` 映射是否一致?
|
||||
- [ ] 与本文第二部分 Chatflow 编排手册职责划分是否一致(原型 vs 编排手册)?
|
||||
|
||||
#### 5.4 文档版本记录
|
||||
@@ -768,7 +768,7 @@ sequenceDiagram
|
||||
| v1.3 | 2026-06-12 | 按 SRM/PLM 双源比对与 SRM 审核/驳回人工 SOP 重整 §1 及执行步骤对照 |
|
||||
| v1.4 | 2026-06-12 | 明确「人工判定」为 AI 引入后、记录 AI 无法判定情况的系统类型 |
|
||||
| v1.5 | 2026-06-12 | PLM 比对数据推送 SRM;Agent 只读 SRM、字段级 AI 提示,不自动 SRM 审核/驳回 |
|
||||
| v1.6 | 2026-06-12 | 补充 §2.1.2 与 [agent_progress_prototype.md](prototype/agent_progress_prototype.md) 关系 |
|
||||
| v1.6 | 2026-06-12 | 补充 §2.1.2 与 [agent_progress_prototype.md](../../platform/agent_progress_prototype.md) 关系 |
|
||||
|
||||
|
||||
---
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
| **需求** | [demand.md](demand.md) |
|
||||
| **当前方案 / 技术** | [comprehensive-review-technical.md](comprehensive-review-technical.md) |
|
||||
| **旧版 MVP** | [technical.md](technical.md) |
|
||||
| **原型** | [../../prototype/procurement-contract-review-prototype.html](../../prototype/procurement-contract-review-prototype.html) |
|
||||
| **原型** | [procurement-contract-review-prototype.html](procurement-contract-review-prototype.html) |
|
||||
| **状态** | 全面审核基础链路已落地:异步 Job + 双模式 Chat + Admin 三 Tab;比对以改稿/红线为主 |
|
||||
|
||||
**范围摘要**:同一 Agent 双模式(合同比对:我方原合同 + 卖方回传;单份:待审卖方合同);Admin 模板库 / 风险规则 / 审查历史;结果卡与报告下载;无人审、无 ScheduleRun。
|
||||
@@ -4,7 +4,7 @@
|
||||
|------|------|
|
||||
| 文档版本 | v1.0 |
|
||||
| 状态 | 基于当前代码 / UI / 已确认产品决策整理 |
|
||||
| 关联 | [comprehensive-review-technical.md](comprehensive-review-technical.md)(实现权威)· [原型](../../prototype/procurement-contract-review-prototype.html) |
|
||||
| 关联 | [comprehensive-review-technical.md](comprehensive-review-technical.md)(实现权威)· [原型](procurement-contract-review-prototype.html) |
|
||||
| 读者 | 产品、测试、研发 |
|
||||
|
||||
---
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<!doctype html>
|
||||
<!doctype html>
|
||||
<!--
|
||||
docs/prototype/procurement-contract-review-prototype.html
|
||||
docs/features/procurement-contract/procurement-contract-review-prototype.html
|
||||
用途:采购合同审查 Agent 低保真原型——同一 Agent 双模式(模板比对 / 单份审核)+ 模板库 + 历史。
|
||||
依赖:浏览器原生 HTML/CSS/JavaScript,无需构建;用于产品/业务评审。
|
||||
逻辑:顶栏切换「会话 / 模板库 / 历史」;会话能力入口(模式、选模板、上传)放在下方输入区,对齐正式聊天页。
|
||||
@@ -7,7 +7,7 @@
|
||||
|------|------|
|
||||
| 文档版本 | v0.4 |
|
||||
| 状态 | **已落地 MVP**(HXOPS 同步审查:规则 + Diff;可选 Dify Workflow 润色) |
|
||||
| 原型 | [docs/prototype/procurement-contract-review-prototype.html](../../prototype/procurement-contract-review-prototype.html) |
|
||||
| 原型 | [procurement-contract-review-prototype.html](procurement-contract-review-prototype.html) |
|
||||
| 读者 | 产品、研发、测试 |
|
||||
|
||||
> **主路径口径**:审查是 **Chat → HXOPS API(同步)**,不是 Chat → Dify Chatflow → Tool。Dify Chatflow 仅作无附件时的文字引导;LLM 仅作可选后处理增强。
|
||||
|
||||
@@ -5,7 +5,8 @@
|
||||
| **技术手册** | 研发、运维、Dify 配置 | [technical.md](technical.md) |
|
||||
| **业务说明** | 货代、跟单 | [business.md](business.md) |
|
||||
| **库存源路由方案** | 研发 | [inventory_source_plan.md](inventory_source_plan.md) |
|
||||
| **产品原型** | 产品、测试 | [../../prototype/shipping_notice_agent_prototype.md](../../prototype/shipping_notice_agent_prototype.md) |
|
||||
| **产品原型** | 产品、测试 | [shipping_notice_agent_prototype.md](shipping_notice_agent_prototype.md) |
|
||||
| **批次融合 HTML 原型** | 产品、测试 | [shipping-batch-agent-fused-prototype.html](shipping-batch-agent-fused-prototype.html) |
|
||||
| **OpenAPI** | Dify 导入 | [../../openapi/shipping_notice_tools.dify.json](../../openapi/shipping_notice_tools.dify.json) |
|
||||
|
||||
**代码**:`backend/app/services/shipping_notice/` · **状态**:见 [funclist.md](../../funclist.md)
|
||||
@@ -3243,7 +3243,7 @@ shortage 规则:
|
||||
|
||||
## 3. 当前与原型对齐状态
|
||||
|
||||
> 对齐基线:[`docs/prototype/shipping_notice_agent_prototype.md`](../../prototype/shipping_notice_agent_prototype.md)\
|
||||
> 对齐基线:[`shipping_notice_agent_prototype.md`](shipping_notice_agent_prototype.md)\
|
||||
> 评估日期:**2026-06-18**
|
||||
|
||||
### 3.1 已实现或基本落地
|
||||
|
||||
@@ -76,7 +76,7 @@
|
||||
| 库存 RPA 批量导出(DSV/Crane 一次登录) | 已实现 | `inventory_export_batch` trigger + worker + `/rpa/inventory-batch-ready` |
|
||||
| 库存每日定时导出排程 | 已实现 | `schedule_type=platform_job` + `platform_api_path=shipping-inventory-rpa`,cron 建议 `0 3 * * *` |
|
||||
| 建单防重复(第一阶段) | 已实现 | 批次 `create_idempotency_key`、任务 `source_content_hash`、同请求去重、幂等重放 |
|
||||
| 产品原型 | 已文档化 | 见 [docs/prototype/shipping_notice_agent_prototype.md](prototype/shipping_notice_agent_prototype.md) |
|
||||
| 产品原型 | 已文档化 | 见 [docs/features/shipping-notice/shipping_notice_agent_prototype.md](features/shipping-notice/shipping_notice_agent_prototype.md) |
|
||||
|
||||
### 排程平台任务契约中心(schedule)
|
||||
|
||||
@@ -95,7 +95,7 @@
|
||||
| --- | --- | --- |
|
||||
| 设计方案 | 已文档化 | [docs/platform/agent_application_management.md](platform/agent_application_management.md) |
|
||||
| 实现手册 | 已文档化 | [docs/platform/agent_application_management_implementation.md](platform/agent_application_management_implementation.md) |
|
||||
| 产品原型 | 已文档化 | [docs/prototype/agent_application_management_prototype.md](prototype/agent_application_management_prototype.md) |
|
||||
| 产品原型 | 已文档化 | [docs/platform/agent_application_management_prototype.md](platform/agent_application_management_prototype.md) |
|
||||
| 结构化 agents 列 + Catalog | 待建设 | 实现手册 §3 迭代 1 |
|
||||
| Context Adapter Registry | 部分完成 | `dify_inputs` 已统一入口,仍 if/elif;迭代 2 |
|
||||
| Admin 类型下拉 + capabilities 列 | 待建设 | 实现手册 §5 迭代 3 |
|
||||
@@ -126,7 +126,7 @@
|
||||
| 功能项 | 状态 | 说明 |
|
||||
| --- | --- | --- |
|
||||
| 实现方案(双模式 Agent) | 已文档化 | [docs/features/procurement-contract/technical.md](features/procurement-contract/technical.md)(v0.4,与代码对齐) |
|
||||
| HTML 原型 | 已文档化 | [docs/prototype/procurement-contract-review-prototype.html](prototype/procurement-contract-review-prototype.html) |
|
||||
| HTML 原型 | 已文档化 | [docs/features/procurement-contract/procurement-contract-review-prototype.html](features/procurement-contract/procurement-contract-review-prototype.html) |
|
||||
| 异步全面审核方案 | 已实现基础链路 | [全面审核技术方案](features/procurement-contract/comprehensive-review-technical.md):知识库清洗复用、通用 Job/Worker、条款结构化、Diff/整份红线、Dify 独立扫描、证据校验与结果合并 |
|
||||
| Dify Workflow 全面法律审核 | 已实现(需配置开启) | 接收 `clean_text/clauses_json/findings_json`,兼容 `items/new_items`;Dify 失败降级保留确定性结果 |
|
||||
| Admin 模板库 + 风险规则 + 审查历史 | 已实现 | `/admin/procurement-contract`(三 Tab);种子红线可界面编辑/启停/增删;启停乐观更新;历史含供应商与合同编号 |
|
||||
|
||||
@@ -6,4 +6,7 @@
|
||||
| --- | --- |
|
||||
| [agent_application_management.md](agent_application_management.md) | Agent 应用管理:数据模型、Catalog、Registry、迁移(设计方案) |
|
||||
| [agent_application_management_implementation.md](agent_application_management_implementation.md) | **实现手册**:全栈可改范围(§0)、迁移、迭代、验收 |
|
||||
| [agent_application_management_prototype.md](../prototype/agent_application_management_prototype.md) | 产品原型(需求、Admin 交互、验收) |
|
||||
| [agent_application_management_prototype.md](agent_application_management_prototype.md) | 产品原型(需求、Admin 交互、验收) |
|
||||
| [agent_progress_prototype.md](agent_progress_prototype.md) | Agent 进度管理通用底座(`async_batch` 等) |
|
||||
| [agent_runtime_context_prototype.md](agent_runtime_context_prototype.md) | Runtime Context 协议原型 |
|
||||
| [progress_contract_platform_prototype.html](progress_contract_platform_prototype.html) | 进度契约平台 HTML 原型 |
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
> **文档路径**:`docs/platform/agent_application_management.md`
|
||||
> **用途**:企业对话应用统一入口的权威设计——Agent 数据模型、多运行时、上下文注入、Registry 分发与迁移计划。
|
||||
> **依赖**:`docs/dify/agent_runtime_context_integration.md`、`docs/prototype/agent_runtime_context_prototype.md`、`AGENTS.md`。
|
||||
> **依赖**:`docs/dify/agent_runtime_context_integration.md`、`docs/platform/agent_runtime_context_prototype.md`、`AGENTS.md`。
|
||||
> **逻辑关系**:Admin 应用管理、聊天 `/api/chat/completions`、context adapter、Executor 层均以此文档为准。
|
||||
|
||||
---
|
||||
@@ -515,10 +515,10 @@ backend/app/
|
||||
|
||||
| 文档 | 关系 |
|
||||
| --- | --- |
|
||||
| [agent_application_management_prototype.md](../prototype/agent_application_management_prototype.md) | 产品原型(需求、交互、验收) |
|
||||
| [agent_application_management_prototype.md](agent_application_management_prototype.md) | 产品原型(需求、交互、验收) |
|
||||
| [agent_application_management_implementation.md](./agent_application_management_implementation.md) | 实现手册(迁移、迭代、验收) |
|
||||
| [agent_runtime_context_integration.md](../dify/agent_runtime_context_integration.md) | Dify 画布与 parse Tool |
|
||||
| [agent_runtime_context_prototype.md](../prototype/agent_runtime_context_prototype.md) | 上下文协议原型 |
|
||||
| [agent_runtime_context_prototype.md](agent_runtime_context_prototype.md) | 上下文协议原型 |
|
||||
| [shipping-notice/technical.md](../features/shipping-notice/technical.md) | 货代流程与 Tool API |
|
||||
| [file-check/technical.md](../features/file-check/technical.md) | 检核 Chatflow |
|
||||
| [error_handling.md](../convention/error_handling.md) | API 错误契约 |
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
> **唯一实现文档**:Agent 注册表、Catalog、迁移、Registry 分发、Admin/API/前端的 **落地步骤、代码路径、验收命令** 仅维护本文件(`docs/platform/agent_application_management_implementation.md`)。\
|
||||
> **设计方案**:[`agent_application_management.md`](./agent_application_management.md)(字段与架构权威定义,不含逐步操作)。\
|
||||
> **产品原型**:[`../prototype/agent_application_management_prototype.md`](../prototype/agent_application_management_prototype.md)(Admin 交互与验收案例)。\
|
||||
> **产品原型**:[`agent_application_management_prototype.md`](agent_application_management_prototype.md)(Admin 交互与验收案例)。\
|
||||
> **同步维护**:迭代完成或接口变更时,须同时更新本文件 §1 现状表、§0 全栈清单与设计方案。
|
||||
|
||||
---
|
||||
@@ -751,7 +751,7 @@ backend/tests/test_agent_registry_*.py
|
||||
| 文档 | 关系 |
|
||||
| --- | --- |
|
||||
| [agent_application_management.md](./agent_application_management.md) | 设计方案 |
|
||||
| [agent_application_management_prototype.md](../prototype/agent_application_management_prototype.md) | 产品验收 |
|
||||
| [agent_application_management_prototype.md](agent_application_management_prototype.md) | 产品验收 |
|
||||
| [agent_runtime_context_integration.md](../dify/agent_runtime_context_integration.md) | Dify Start + parse Tool |
|
||||
| [features/shipping-notice/technical.md](../features/shipping-notice/technical.md) | 货代领域手册 |
|
||||
| [features/file-check/technical.md](../features/file-check/technical.md) | 检核领域手册 |
|
||||
|
||||
@@ -388,7 +388,7 @@ flowchart TD
|
||||
| 维度 | 本原型(应用管理) | 关联原型 |
|
||||
|------|-------------------|----------|
|
||||
| 职责 | 平台级应用配置与运行时分发 | 不定义具体业务七步流程 |
|
||||
| conversation_mode=task_chat | Admin 配置对话形态 | 货代等业务见 [shipping_notice_agent_prototype.md](shipping_notice_agent_prototype.md) |
|
||||
| conversation_mode=task_chat | Admin 配置对话形态 | 货代等业务见 [shipping_notice_agent_prototype.md](../features/shipping-notice/shipping_notice_agent_prototype.md) |
|
||||
| 上下文注入 | Context Adapter 契约 | [agent_runtime_context_prototype.md](agent_runtime_context_prototype.md) |
|
||||
| 进度展示 | capabilities.task_progress | [agent_progress_prototype.md](agent_progress_prototype.md) |
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
| 文档版本 | v1.0 |
|
||||
| 读者 | 产品负责人、前端/后端研发、测试验收 |
|
||||
| 适用范围 | 对话页内所有 Agent 的进度观测、绑定与展示 |
|
||||
| 关联 Agent 原型 | [RoHS 文件检核](../features/file-check/technical.md#第一部分产品原型设计rohs-实例) · [货代发货通知](shipping_notice_agent_prototype.md) |
|
||||
| 关联 Agent 原型 | [RoHS 文件检核](../features/file-check/technical.md#第一部分产品原型设计rohs-实例) · [货代发货通知](../features/shipping-notice/shipping_notice_agent_prototype.md) |
|
||||
|
||||
---
|
||||
|
||||
@@ -328,7 +328,7 @@ ProgressMount ← 读 chat_log.progress_binding,决定是否展示
|
||||
|
||||
### 9.2 货代发货通知 → `workflow_steps`
|
||||
|
||||
详见 [shipping_notice_agent_prototype.md §3.3](shipping_notice_agent_prototype.md#33-交互规格)。
|
||||
详见 [shipping_notice_agent_prototype.md §3.3](../features/shipping-notice/shipping_notice_agent_prototype.md#33-交互规格)。
|
||||
|
||||
| 维度 | 说明 |
|
||||
|------|------|
|
||||
@@ -3,7 +3,7 @@
|
||||
"codes": {
|
||||
"AUTH_UNAUTHORIZED": "Please log in first.",
|
||||
"AUTH_INCORRECT_PASSWORD": "Incorrect password",
|
||||
"AUTH_INCORRECT_CURRENT_PASSWORD": "Original: current password is incorrect. New: the password you entered is incorrect; please try again.",
|
||||
"AUTH_INCORRECT_CURRENT_PASSWORD": "The current password you entered is incorrect. Please try again.",
|
||||
"AUTH_USER_NOT_FOUND": "User not found",
|
||||
"AUTH_ACCOUNT_DISABLED": "Account is disabled",
|
||||
"AUTH_CASDOOR_IDENTITY_INVALID": "Casdoor did not return a stable user identity. Check the OIDC configuration.",
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
"codes": {
|
||||
"AUTH_UNAUTHORIZED": "กรุณาเข้าสู่ระบบก่อน",
|
||||
"AUTH_INCORRECT_PASSWORD": "รหัสผ่านไม่ถูกต้อง",
|
||||
"AUTH_INCORRECT_CURRENT_PASSWORD": "เดิม: รหัสผ่านปัจจุบันไม่ถูกต้อง ใหม่: รหัสผ่านที่คุณป้อนไม่ถูกต้อง โปรดลองอีกครั้ง",
|
||||
"AUTH_INCORRECT_CURRENT_PASSWORD": "รหัสผ่านเดิมที่คุณป้อนไม่ถูกต้อง โปรดลองอีกครั้ง",
|
||||
"AUTH_USER_NOT_FOUND": "ไม่พบผู้ใช้",
|
||||
"AUTH_ACCOUNT_DISABLED": "บัญชีถูกปิดใช้งาน",
|
||||
"AUTH_CASDOOR_IDENTITY_INVALID": "Casdoor ไม่ได้ส่งคืนข้อมูลระบุตัวผู้ใช้ที่คงที่ โปรดตรวจสอบการตั้งค่า OIDC",
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
"codes": {
|
||||
"AUTH_UNAUTHORIZED": "请先登录。",
|
||||
"AUTH_INCORRECT_PASSWORD": "密码错误",
|
||||
"AUTH_INCORRECT_CURRENT_PASSWORD": "原:当前密码不正确,新:您输入的原密码有误,请重新输入",
|
||||
"AUTH_INCORRECT_CURRENT_PASSWORD": "您输入的原密码有误,请重新输入",
|
||||
"AUTH_USER_NOT_FOUND": "用户不存在",
|
||||
"AUTH_ACCOUNT_DISABLED": "账号已禁用",
|
||||
"AUTH_CASDOOR_IDENTITY_INVALID": "Casdoor 未返回稳定用户身份,请联系管理员检查 OIDC 配置。",
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
"codes": {
|
||||
"AUTH_UNAUTHORIZED": "請先登入。",
|
||||
"AUTH_INCORRECT_PASSWORD": "密碼錯誤",
|
||||
"AUTH_INCORRECT_CURRENT_PASSWORD": "原:當前密碼不正確,新:您輸入的原密碼有誤,請重新輸入",
|
||||
"AUTH_INCORRECT_CURRENT_PASSWORD": "您輸入的原密碼有誤,請重新輸入",
|
||||
"AUTH_USER_NOT_FOUND": "用戶不存在",
|
||||
"AUTH_ACCOUNT_DISABLED": "帳號已禁用",
|
||||
"AUTH_CASDOOR_IDENTITY_INVALID": "Casdoor 未返回穩定用戶身份,請聯絡管理員檢查 OIDC 設定。",
|
||||
|
||||