fix: 设备验收预警优化

This commit is contained in:
sophie committed 2026-10-13 15:52:09 +08:00
1 parent 7e7bcbd388
commit b8cc0cbe77
25 files changed
+1398 -193

No files matched your search

@@ -76,6 +76,9 @@
}
.when { display: flex; flex-direction: column; gap: 8px; }
.when b { font-size: 12px; color: var(--muted); font-weight: 700; }
.switch { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; }
.when small { color: var(--muted); font-size: 12px; }
.round.off .people { opacity: 0.45; }
.day {
display: flex;
align-items: center;
@@ -267,10 +270,12 @@
</div>
</article>
<article class="round">
<article class="round off" id="round4">
<div class="when">
<b>第 4 轮</b>
<label class="day">超过 <input value="51" /> 天</label>
<label class="switch"><input id="round4Switch" type="checkbox" /> 启用第 4 轮</label>
<small>默认关闭,不通知总经理</small>
</div>
<div class="people">
<div class="line">
@@ -305,7 +310,12 @@
<button class="save" type="button">保存配置</button>
</div>
</section>
<p class="mark">效果图,尚未接到现有页面。</p>
<p class="mark">效果图。第 4 轮开关已接到现有配置页,默认关闭。</p>
<script>
document.getElementById("round4Switch").addEventListener("change", (event) => {
document.getElementById("round4").classList.toggle("off", !event.target.checked);
});
</script>
</main>
</body>
</html>
@@ -60,6 +60,8 @@
| 超过 44 天 | COO | 采购经副理 |
| 超过 51 天 | 总经理 | COO、采购经副理 |
第 4 轮在配置里单独开关,默认关闭。关闭时不生成、也不发送总经理这一轮。打开后,下一次扫描才按超过第 4 档的天数产生待发送。前 3 轮不受这个开关影响。
人员解析:
- 担当、直接主管、经副理取**当前节点处理人**及其上级,不固定成「使用部门担当」本人。
@@ -70,7 +72,7 @@
## 6. 推送
已确认:扫描与发送分离。发送时刻做成可配置,**初始对齐合同付款预警,为每周五 18:00**(见 [合同付款预警需求](../contract-payment-plan/demand.md))。到点后按收件人合并为一条企业微信汇总。渠道只有企业微信。
已确认:扫描与发送分离。发送时刻做成可配置,**初始对齐合同付款预警,为每周五 18:00**(见 [合同付款预警需求](../contract-payment-plan/demand.md))。到点后按收件人合并为一条企业微信汇总卡片,并紧跟一份只含该收件人明细的 Excel。这份 Excel 按收件人归档,挂在发送记录表的 Excel 附件列上,点文件名再下载。卡片不逐条列出验收单,也不区分主送和抄送。渠道只有企业微信。
## 7. 数据来源
@@ -0,0 +1,279 @@
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8" />
<title>设备验收预警 · 发送效果图</title>
<style>
:root {
--ink: #142033;
--muted: #64748b;
--line: #dce4ef;
--paper: #ffffff;
--page: #f3f6fa;
--brand: #1d4e89;
--chat: #ededed;
--ok: #217346;
}
* { box-sizing: border-box; }
body {
margin: 0;
min-height: 100vh;
background: var(--page);
color: var(--ink);
font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}
.page { max-width: 1180px; margin: 0 auto; padding: 18px 20px 48px; }
h1 { margin: 0; font-size: 20px; }
.note { margin: 8px 0 0; color: var(--muted); font-size: 13px; }
.grid {
display: grid;
grid-template-columns: 380px minmax(0, 1fr);
gap: 16px;
margin-top: 16px;
align-items: start;
}
.panel {
background: var(--paper);
border: 1px solid var(--line);
border-radius: 16px;
box-shadow: 0 1px 2px rgba(20, 32, 51, 0.04);
}
.panel h2 { margin: 0; font-size: 15px; }
.panel .sub { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.head { padding: 16px 18px 0; }
.phone {
margin: 14px 18px 18px;
border-radius: 28px;
background: #111;
padding: 10px;
}
.screen {
overflow: hidden;
border-radius: 20px;
background: var(--chat);
min-height: 560px;
}
.bar {
display: flex;
align-items: center;
justify-content: center;
height: 48px;
background: #f7f7f7;
border-bottom: 1px solid #e5e5e5;
font-size: 15px;
font-weight: 700;
}
.thread { padding: 16px 14px 22px; }
.time { margin: 0 0 12px; text-align: center; color: #8a8a8a; font-size: 12px; }
.card {
background: #fff;
border-radius: 6px;
padding: 14px 14px 0;
box-shadow: 0 1px 1px rgba(0, 0, 0, 0.04);
}
.card h3 { margin: 0 0 10px; font-size: 16px; font-weight: 700; }
.card p { margin: 0; color: #3d3d3d; font-size: 14px; line-height: 1.65; white-space: pre-line; }
.more {
display: flex;
align-items: center;
justify-content: space-between;
margin-top: 12px;
padding: 10px 0 12px;
border-top: 1px solid #ececec;
color: #1f1f1f;
font-size: 14px;
}
.file {
display: flex;
align-items: center;
gap: 10px;
width: 250px;
margin-top: 10px;
padding: 10px 12px;
background: #fff;
border-radius: 6px;
}
.xls {
display: grid;
place-items: center;
width: 36px;
height: 40px;
border-radius: 4px;
background: var(--ok);
color: #fff;
font-size: 11px;
font-weight: 800;
}
.file b { display: block; font-size: 13px; font-weight: 650; }
.file span { color: #8a8a8a; font-size: 12px; }
.sheet { padding: 8px 12px 16px; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 12px; }
th, td { padding: 8px 10px; text-align: left; white-space: nowrap; }
.sheet th { background: #e8f3ec; color: #145c32; font-weight: 700; border-bottom: 1px solid #cfe3d6; }
.sheet td { border-bottom: 1px solid #edf2f7; }
.sheet tr:nth-child(even) td { background: #fbfcfd; }
.foot { padding: 0 18px 16px; color: var(--muted); font-size: 12px; }
.admin { margin-top: 16px; }
.tabs { display: flex; gap: 4px; margin-top: 14px; border-bottom: 1px solid var(--line); }
.tabs span {
margin-bottom: -1px;
padding: 8px 12px 10px;
border-bottom: 2px solid transparent;
color: var(--muted);
font-size: 14px;
font-weight: 700;
}
.tabs .on { border-color: var(--brand); color: var(--brand); }
.toolbar {
display: flex;
align-items: center;
justify-content: space-between;
gap: 12px;
padding: 12px 18px 0;
}
.toolbar p { margin: 0; color: var(--muted); font-size: 12px; }
button {
border: 1px solid var(--brand);
background: var(--brand);
color: #fff;
border-radius: 8px;
padding: 7px 12px;
font-size: 12px;
font-weight: 700;
}
.list { padding: 12px 12px 8px; overflow-x: auto; }
.list th { background: #f8fbff; color: var(--muted); font-weight: 700; }
.list td { border-bottom: 1px solid var(--line); }
.sent { color: #142033; }
.wait { color: #9a6700; font-weight: 700; }
.bad { color: #b42318; font-weight: 700; }
@media (max-width: 900px) {
.grid { grid-template-columns: 1fr; }
}
</style>
</head>
<body>
<main class="page">
<h1>设备验收预警 · 发送效果图</h1>
<p class="note">效果图,尚未接到现有页面。同一个人只收一条汇总卡片,明细在下一条 Excel。不再区分主送和抄送。</p>
<div class="grid">
<section class="panel">
<div class="head">
<h2>sophie 收到的企业微信</h2>
<p class="sub">她这一轮有 18 张单,卡片里不逐条列出。</p>
</div>
<div class="phone">
<div class="screen">
<div class="bar">设备验收预警</div>
<div class="thread">
<p class="time">19:52</p>
<article class="card">
<h3>设备验收停留提醒</h3>
<p>共 18 张验收单。
超过 30 天 12 张,超过 37 天 4 张,超过 44 天 2 张。
明细见下一条文件。</p>
<div class="more"><span>查看详情</span><span>›</span></div>
</article>
<article class="file">
<div class="xls">XLS</div>
<div>
<b>设备验收停留提醒.xlsx</b>
<span>28.4 KB</span>
</div>
</article>
</div>
</div>
</div>
</section>
<section class="panel">
<div class="head">
<h2>附件里的前 8 行</h2>
<p class="sub">只含 sophie 本人要看的单。通知身份说明她为什么会收到,不再写主送、抄送。</p>
</div>
<div class="sheet">
<table>
<thead>
<tr>
<th>验收单号</th>
<th>采购单号</th>
<th>申请人</th>
<th>轮次</th>
<th>停留天数</th>
<th>当前节点</th>
<th>当前处理人</th>
<th>通知身份</th>
</tr>
</thead>
<tbody>
<tr><td>20260210000001</td><td>1111</td><td>孙浩</td><td>超过 30 天</td><td>31</td><td>使用部门担当</td><td>吴敏</td><td>直接主管</td></tr>
<tr><td>20260211000008</td><td>CG-0881</td><td>李文</td><td>超过 30 天</td><td>33</td><td>品质担当</td><td>林可</td><td>直接主管</td></tr>
<tr><td>20260212000015</td><td>CG-0902</td><td>周洋</td><td>超过 30 天</td><td>36</td><td>公用主管</td><td>sophie</td><td>当前处理人</td></tr>
<tr><td>20260213000022</td><td>CG-0910</td><td>孙浩</td><td>超过 37 天</td><td>40</td><td>设备管理部</td><td>周宁</td><td>采购经副理</td></tr>
<tr><td>20260214000031</td><td>CG-0933</td><td>陈敏</td><td>超过 37 天</td><td>41</td><td>品质经理</td><td>何倩</td><td>采购经副理</td></tr>
<tr><td>20260215000040</td><td>CG-0948</td><td>刘洋</td><td>超过 44 天</td><td>46</td><td>COO</td><td>陈立</td><td>采购经副理</td></tr>
<tr><td>20260216000052</td><td>CG-0961</td><td>王磊</td><td>超过 30 天</td><td>32</td><td>使用部门经理</td><td>赵凯</td><td>直接主管</td></tr>
<tr><td>20260217000060</td><td>CG-0977</td><td>孙浩</td><td>超过 30 天</td><td>35</td><td>固定资产管理人</td><td>孙浩</td><td>采购担当</td></tr>
</tbody>
</table>
</div>
<p class="foot">文件内共 18 行。同一张单若第 1 轮和第 2 轮都还没发过,会各占一行。停留天数是发送当时的天数。</p>
</section>
</div>
<section class="panel admin">
<div class="tabs">
<span>停留情况</span>
<span class="on">发送记录</span>
<span>预警配置</span>
</div>
<div class="toolbar">
<p>每日扫描生成待发送。每周五 18:00 按人汇总,每人一条卡片加一份 Excel。这里仍是一条记录对应一张单的一轮。</p>
<button type="button">导出 Excel</button>
</div>
<div class="list">
<table>
<thead>
<tr>
<th>验收单号</th>
<th>采购单号</th>
<th>轮次</th>
<th>收件人</th>
<th>结果</th>
<th>发送时间</th>
</tr>
</thead>
<tbody>
<tr>
<td>20260210000001</td>
<td>1111</td>
<td>超过 30 天</td>
<td>吴敏、sophie、孙浩</td>
<td class="sent">已发送</td>
<td>2026-10-12 18:55:18</td>
</tr>
<tr>
<td>20260212000015</td>
<td>CG-0902</td>
<td>超过 37 天</td>
<td>孙经理、COO、赵琴</td>
<td class="wait">待发送</td>
<td>—</td>
</tr>
<tr>
<td>20260215000040</td>
<td>CG-0948</td>
<td>超过 44 天</td>
<td>COO、赵琴</td>
<td class="bad">发送失败</td>
<td>—</td>
</tr>
</tbody>
</table>
</div>
<p class="foot">页面上的「导出 Excel」是当前列表里的全部记录。个人在企业微信里收到的文件只含他自己的行。</p>
</section>
</main>
</body>
</html>
@@ -412,7 +412,7 @@ LEFT JOIN eteams.dbo.employee AS handler ON handler.ID = op.userid;
页面入口与合同付款预警相同:迁移写入内置 Chat Agent,`agent_code=equipment_acceptance`,`conversation_mode=task_chat`。对话页按该编码替换消息列表和输入框,页签是停留情况、发送记录和预警配置。普通用户要在用户管理里授予该 Agent 后才看得到。
`equipment_acceptance_settings` 只保留一行。`day_1` 到 `day_4` 默认 30、37、44、51,保存时必须逐档增大。`buyer_manager_user_id`、`coo_user_id`、`executive_user_id` 指向 `users.id`,姓名只在页面上显示。发送时刻不在这张表。`GET/PUT /api/equipment-acceptance/config`:有权限的用户可看,保存只给平台管理员。
`equipment_acceptance_settings` 只保留一行。`day_1` 到 `day_4` 默认 30、37、44、51,保存时必须逐档增大。`round_4_enabled` 默认关闭,关闭时扫描不生成第 4 轮,发送也会跳过已经待发送的第 4 轮。`buyer_manager_user_id`、`coo_user_id`、`executive_user_id` 指向 `users.id`,姓名只在页面上显示。发送时刻不在这张表。`GET/PUT /api/equipment-acceptance/config`:有权限的用户可看,保存只给平台管理员。
## 9. 扫描与发送
@@ -423,11 +423,11 @@ LEFT JOIN eteams.dbo.employee AS handler ON handler.ID = op.userid;
- 超过第 1 档:主送当前处理人,抄送其 `employee.SUPERIOR` 和申请人。
- 超过第 2 档:主送各处理人部门的经副理,抄送配置里的 COO 和采购经副理。
- 超过第 3 档:主送 COO,抄送采购经副理。
- 超过第 4 档:主送总经理,抄送 COO 和采购经副理。
- 超过第 4 档:主送总经理,抄送 COO 和采购经副理。配置里的第 4 轮开关默认关闭,关闭时这一档不产生、也不发送。
人员 ID 先对 `eteams.dbo.employee`,再用 `JOB_NUM` 对 `users.employee_id`,发送用 `users.wecom_userid`。矩阵 `relate_id` 和 E10 人员 ID 都不是企微 userid。没有工号、对不上用户、没绑企微、没有主管或经副理、三个岗位没选,都记在该席位上,不改发给别人。至少有一名可发的人时状态是待发送;一个都没有则整档失败。
每周五 18:00 排程 `equipment-acceptance-alert-weekly` 只发送状态为待发送的记录,不再同步。同一企微账号合并成一条文本卡片,标题「设备验收停留提醒」,事件 `equipment_acceptance_warning`。卡片过长时先留 12 行,其余写成「另有 N 条」。发送成功改为已发送。有人失败则整档改为失败,并附上「企业微信发送失败」;下次扫描会按当前处理人重算并回到待发送。已发出的企业微信不撤回。
每周五 18:00 排程 `equipment-acceptance-alert-weekly` 只发送状态为待发送的记录,不再同步。同一企微账号先收一条文本卡片,标题「设备验收停留提醒」,正文先写共多少张验收单已逾期,再写各轮次数量,事件 `equipment_acceptance_warning`。紧跟着一条文件消息《设备验收停留提醒.xlsx》,列是验收单号、采购单号、申请人、轮次、停留天数、当前节点、当前处理人、通知身份。卡片不写主送、抄送,也不逐条列出验收单。卡片和文件都成功才改为已发送。任一失败则整档改为失败,并写上卡片或附件的原因;下次扫描会按当前处理人重算并回到待发送。每位收件人的 Excel 写入 `equipment_acceptance_send_files`,并记下对应的发送记录。发送失败也保留。发送记录表用 Excel 附件列下载,同一行可有多份。已发出的企业微信不撤回。
停表(归档、退回、撤回、作废、无法验收,以及强制结束)时,待发送和解析失败且还没 `sent_at` 的行改为已取消。