feat(equipment-acceptance): 补抓E8数据并更新需求文档
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
f0334e5d22
commit
02aa00e913
47 files changed
+4423
-1261
No files matched your search
Binary file not shown.
|
After Width: | Height: | Size: 1.3 MiB |
Binary file not shown.
|
After Width: | Height: | Size: 1.2 MiB |
@@ -0,0 +1,90 @@
|
||||
[
|
||||
{
|
||||
"file": ".taste-skill/prototype/assets/gold-belt-mount-with-rivet.jpg",
|
||||
"media": "image",
|
||||
"ref": "met:464103",
|
||||
"title": "Gold Belt Mount with Rivet",
|
||||
"creator": "Avar maker",
|
||||
"creatorUrl": null,
|
||||
"date": "700s",
|
||||
"license": "public domain (CC0)",
|
||||
"licenseCode": "cc0",
|
||||
"licenseUrl": "https://creativecommons.org/publicdomain/zero/1.0/",
|
||||
"creditRequired": false,
|
||||
"page": "https://www.metmuseum.org/art/collection/search/464103",
|
||||
"via": "The Metropolitan Museum of Art",
|
||||
"image": "https://images.metmuseum.org/CRDImages/md/original/17_190_1694ab_MED_s02.jpg",
|
||||
"width": 3140,
|
||||
"height": 4000,
|
||||
"bytes": 1937315,
|
||||
"credit": "\"Gold Belt Mount with Rivet\" by Avar maker, 700s, public domain (CC0), via The Metropolitan Museum of Art",
|
||||
"notes": [],
|
||||
"saved": "2026-10-27T02:25:25.754Z"
|
||||
},
|
||||
{
|
||||
"file": ".taste-skill/prototype/assets/hammer.jpg",
|
||||
"media": "image",
|
||||
"ref": "met:204741",
|
||||
"title": "Hammer",
|
||||
"creator": null,
|
||||
"creatorUrl": null,
|
||||
"date": "probably 18th century",
|
||||
"license": "public domain (CC0)",
|
||||
"licenseCode": "cc0",
|
||||
"licenseUrl": "https://creativecommons.org/publicdomain/zero/1.0/",
|
||||
"creditRequired": false,
|
||||
"page": "https://www.metmuseum.org/art/collection/search/204741",
|
||||
"via": "The Metropolitan Museum of Art",
|
||||
"image": "https://images.metmuseum.org/CRDImages/es/original/187608.jpg",
|
||||
"width": 1984,
|
||||
"height": 860,
|
||||
"bytes": 281382,
|
||||
"credit": "\"Hammer\", probably 18th century, public domain (CC0), via The Metropolitan Museum of Art",
|
||||
"notes": [],
|
||||
"saved": "2026-10-27T02:25:30.738Z"
|
||||
},
|
||||
{
|
||||
"file": ".taste-skill/prototype/assets/armorer-s-anvil.jpg",
|
||||
"media": "image",
|
||||
"ref": "met:471599",
|
||||
"title": "Armorer's Anvil",
|
||||
"creator": "European maker",
|
||||
"creatorUrl": null,
|
||||
"date": "16th century",
|
||||
"license": "public domain (CC0)",
|
||||
"licenseCode": "cc0",
|
||||
"licenseUrl": "https://creativecommons.org/publicdomain/zero/1.0/",
|
||||
"creditRequired": false,
|
||||
"page": "https://www.metmuseum.org/art/collection/search/471599",
|
||||
"via": "The Metropolitan Museum of Art",
|
||||
"image": "https://images.metmuseum.org/CRDImages/cl/original/cdi55-61-26.jpg",
|
||||
"width": 2100,
|
||||
"height": 1918,
|
||||
"bytes": 1210493,
|
||||
"credit": "\"Armorer's Anvil\" by European maker, 16th century, public domain (CC0), via The Metropolitan Museum of Art",
|
||||
"notes": [],
|
||||
"saved": "2026-10-27T02:25:45.912Z"
|
||||
},
|
||||
{
|
||||
"file": ".taste-skill/prototype/assets/armor.jpg",
|
||||
"media": "image",
|
||||
"ref": "met:35937",
|
||||
"title": "Armor",
|
||||
"creator": "German, possibly Lower Saxony maker",
|
||||
"creatorUrl": null,
|
||||
"date": "ca. 1540–50 and later",
|
||||
"license": "public domain (CC0)",
|
||||
"licenseCode": "cc0",
|
||||
"licenseUrl": "https://creativecommons.org/publicdomain/zero/1.0/",
|
||||
"creditRequired": false,
|
||||
"page": "https://www.metmuseum.org/art/collection/search/35937",
|
||||
"via": "The Metropolitan Museum of Art",
|
||||
"image": "https://images.metmuseum.org/CRDImages/aa/original/DP-36206-003.jpg",
|
||||
"width": 3001,
|
||||
"height": 4000,
|
||||
"bytes": 1373710,
|
||||
"credit": "\"Armor\" by German, possibly Lower Saxony maker, ca. 1540–50 and later, public domain (CC0), via The Metropolitan Museum of Art",
|
||||
"notes": [],
|
||||
"saved": "2026-10-27T02:26:00.813Z"
|
||||
}
|
||||
]
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 1.8 MiB |
Binary file not shown.
|
After Width: | Height: | Size: 275 KiB |
@@ -0,0 +1,533 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>尚未计时 · 托威斯拉钉机验收单</title>
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||
<link href="https://fonts.googleapis.com/css2?family=Noto+Sans+SC:wght@300;400;500&family=Stack+Sans+Headline:wght@300&family=Stack+Sans+Text:wght@400;500&display=swap" rel="stylesheet">
|
||||
<script>document.documentElement.classList.add('js')</script>
|
||||
<style>
|
||||
:root {
|
||||
--bg: #133621;
|
||||
--surface: #1a4429;
|
||||
--ink: #f4d96c;
|
||||
--muted: #d4c27a;
|
||||
--accent: #f4d96c;
|
||||
--accent-ink: #133621;
|
||||
--fold-1: #07160e;
|
||||
--fold-2: #0c2418;
|
||||
--fold-3: #12301f;
|
||||
--fold-4: #184028;
|
||||
--font-display: "Stack Sans Headline", "Noto Sans SC", sans-serif;
|
||||
--font-text: "Stack Sans Text", "Noto Sans SC", sans-serif;
|
||||
--step-small: clamp(0.8125rem, 0.79rem + 0.1vw, 0.875rem);
|
||||
--step-body: clamp(1.0625rem, 1rem + 0.25vw, 1.1875rem);
|
||||
--step-lead: clamp(1.25rem, 1.1rem + 0.7vw, 1.625rem);
|
||||
--step-head: clamp(2rem, 1.3rem + 3.2vw, 4rem);
|
||||
--step-display: clamp(4.25rem, 8vw, 9rem);
|
||||
--margin: clamp(1rem, 2.2vw, 2rem);
|
||||
--gutter: clamp(1rem, 2vw, 2rem);
|
||||
--section: clamp(7.5rem, 12vw, 13.75rem);
|
||||
--radius: 999px;
|
||||
--ease-out: cubic-bezier(0.22, 1, 0.36, 1);
|
||||
--t-press: 140ms;
|
||||
--t-hover: 180ms;
|
||||
--t-ui: 240ms;
|
||||
--t-reveal: 800ms;
|
||||
}
|
||||
*, *::before, *::after { box-sizing: border-box; }
|
||||
html { text-size-adjust: 100%; }
|
||||
body {
|
||||
margin: 0;
|
||||
background: var(--bg);
|
||||
color: var(--ink);
|
||||
font-family: var(--font-text);
|
||||
font-size: var(--step-body);
|
||||
font-weight: 400;
|
||||
line-height: 1.5;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
}
|
||||
h1, h2, p, figure { margin: 0; }
|
||||
img { display: block; max-width: 100%; }
|
||||
button, input { font: inherit; color: inherit; }
|
||||
button { background: none; border: 0; padding: 0; cursor: pointer; }
|
||||
a { color: inherit; }
|
||||
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
|
||||
::selection { background: var(--accent); color: var(--accent-ink); }
|
||||
.nums { font-variant-numeric: tabular-nums; }
|
||||
|
||||
.rivet {
|
||||
display: inline-grid;
|
||||
place-items: center;
|
||||
width: 1.15em;
|
||||
height: 1.15em;
|
||||
border-radius: 50%;
|
||||
background: var(--accent);
|
||||
flex: none;
|
||||
}
|
||||
.rivet i {
|
||||
width: 34%;
|
||||
height: 34%;
|
||||
border-radius: 50%;
|
||||
background: var(--hole, var(--bg));
|
||||
}
|
||||
|
||||
.top {
|
||||
position: absolute;
|
||||
z-index: 2;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
display: grid;
|
||||
grid-template-columns: 1fr auto 1fr;
|
||||
align-items: center;
|
||||
min-height: 4.5rem;
|
||||
padding-inline: var(--margin);
|
||||
}
|
||||
.top .brand { grid-column: 2; font-family: var(--font-display); font-weight: 300; font-size: var(--step-body); text-decoration: none; }
|
||||
.top .back { grid-column: 3; justify-self: end; font-size: var(--step-body); text-underline-offset: 0.2em; }
|
||||
|
||||
.hero { position: relative; overflow-x: clip; padding: 6.5rem var(--margin) 0; }
|
||||
.hero h1 {
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
font-family: var(--font-display);
|
||||
font-weight: 300;
|
||||
font-size: var(--step-display);
|
||||
line-height: 1.05;
|
||||
letter-spacing: -0.03em;
|
||||
text-wrap: balance;
|
||||
}
|
||||
.support {
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
max-width: 18em;
|
||||
margin-top: 1.25rem;
|
||||
font-size: var(--step-body);
|
||||
line-height: 1.5;
|
||||
}
|
||||
.giant {
|
||||
position: absolute;
|
||||
z-index: 0;
|
||||
top: 4.5rem;
|
||||
right: -26vh;
|
||||
width: 108vh;
|
||||
height: 108vh;
|
||||
border-radius: 50%;
|
||||
overflow: hidden;
|
||||
background: var(--accent);
|
||||
}
|
||||
.giant img { width: 100%; height: 100%; object-fit: cover; object-position: center 62%; }
|
||||
|
||||
.stack { position: relative; z-index: 1; width: min(86%, 1120px); margin: 7vh auto 0; padding-top: 16rem; }
|
||||
.leaf {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
right: 0;
|
||||
height: 4rem;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.75rem;
|
||||
padding-inline: 1.25rem;
|
||||
color: var(--ink);
|
||||
text-decoration: none;
|
||||
font-size: var(--step-body);
|
||||
font-weight: 500;
|
||||
}
|
||||
.leaf:nth-of-type(1) { top: 0; background: var(--fold-1); }
|
||||
.leaf:nth-of-type(2) { top: 4rem; background: var(--fold-2); }
|
||||
.leaf:nth-of-type(3) { top: 8rem; background: var(--fold-3); }
|
||||
.leaf:nth-of-type(4) { top: 12rem; background: var(--fold-4); }
|
||||
.leaf .rivet { --hole: var(--leaf, var(--bg)); width: 2.4rem; height: 2.4rem; }
|
||||
.front {
|
||||
position: relative;
|
||||
min-height: 46vh;
|
||||
padding: 2rem;
|
||||
background: var(--surface);
|
||||
}
|
||||
.front .tabline { display: flex; align-items: center; gap: 0.75rem; font-weight: 500; margin-bottom: 1.5rem; }
|
||||
.front .rivet { --hole: var(--surface); width: 2.4rem; height: 2.4rem; }
|
||||
.button {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
min-height: 3.25rem;
|
||||
padding: 0 1.5rem;
|
||||
background: var(--accent);
|
||||
color: var(--accent-ink);
|
||||
border-radius: var(--radius);
|
||||
text-decoration: none;
|
||||
font-weight: 500;
|
||||
}
|
||||
.button:active { transform: scale(0.97); }
|
||||
.front p { max-width: 36ch; margin-top: 1.5rem; }
|
||||
|
||||
.band { padding: var(--section) var(--margin); }
|
||||
.ladder { background: var(--fold-1); }
|
||||
.ladder h2, .facts h2 {
|
||||
font-family: var(--font-display);
|
||||
font-weight: 300;
|
||||
font-size: var(--step-head);
|
||||
line-height: 1.05;
|
||||
letter-spacing: -0.02em;
|
||||
max-width: 8em;
|
||||
text-wrap: balance;
|
||||
}
|
||||
.ladder h2 { margin-bottom: 4rem; }
|
||||
.stages { display: flex; align-items: stretch; gap: 6px; }
|
||||
.stage { display: flex; flex-direction: column; gap: 0.9rem; min-width: 0; }
|
||||
.seg {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
min-height: 22vh;
|
||||
padding: 1.25rem;
|
||||
background: var(--seg, var(--surface));
|
||||
color: var(--seg-ink, var(--ink));
|
||||
font-family: var(--font-display);
|
||||
font-weight: 300;
|
||||
font-size: var(--step-lead);
|
||||
line-height: 1.1;
|
||||
}
|
||||
.stage p { font-size: var(--step-body); }
|
||||
.s1 { flex: 30 1 12%; --seg: #0c2418; }
|
||||
.s2 { flex: 7 1 12%; --seg: #184028; }
|
||||
.s3 { flex: 7 1 12%; --seg: #1f5536; }
|
||||
.s4 { flex: 7 1 12%; --seg: var(--accent); --seg-ink: var(--accent-ink); }
|
||||
.meter { position: relative; margin-top: 3rem; max-width: 72ch; }
|
||||
.meter label { display: block; margin-bottom: 0.75rem; }
|
||||
.meter input[type="range"] { width: 100%; height: 3rem; accent-color: #f4d96c; }
|
||||
.meter .reading { margin-top: 0.75rem; max-width: 42ch; }
|
||||
.track {
|
||||
position: relative;
|
||||
height: 2.75rem;
|
||||
margin-bottom: 0.5rem;
|
||||
}
|
||||
.track .bar {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
right: 0;
|
||||
top: 50%;
|
||||
height: 0.55rem;
|
||||
margin-top: -0.275rem;
|
||||
background: #245c38;
|
||||
}
|
||||
.pin {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 0;
|
||||
width: 1.75rem;
|
||||
height: 1.75rem;
|
||||
margin: -0.875rem 0 0 -0.875rem;
|
||||
display: grid;
|
||||
place-items: center;
|
||||
border-radius: 50%;
|
||||
background: var(--accent);
|
||||
}
|
||||
.pin i { width: 0.55rem; height: 0.55rem; border-radius: 50%; background: var(--fold-1); }
|
||||
|
||||
.facts { background: var(--fold-3); }
|
||||
.split { display: grid; grid-template-columns: 5fr 7fr; column-gap: var(--gutter); align-items: start; }
|
||||
.split h2 { grid-column: 2; grid-row: 1; margin-bottom: 2rem; }
|
||||
.frame { position: sticky; top: 12vh; grid-column: 1; grid-row: 1 / span 2; width: min(34vw, 460px); }
|
||||
.index { grid-column: 2; grid-row: 2; }
|
||||
.shot {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
aspect-ratio: 1;
|
||||
border-radius: 50%;
|
||||
overflow: hidden;
|
||||
background: var(--surface);
|
||||
}
|
||||
.shot img {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: cover;
|
||||
opacity: 0;
|
||||
}
|
||||
.shot img.is-on { opacity: 1; }
|
||||
.cap { max-width: 28ch; margin-top: 1rem; color: var(--muted); font-size: var(--step-small); }
|
||||
.index h2 { margin-bottom: 0; }
|
||||
.row {
|
||||
display: block;
|
||||
width: 100%;
|
||||
text-align: left;
|
||||
color: var(--muted);
|
||||
border-radius: 0;
|
||||
}
|
||||
.row.is-on { color: var(--ink); }
|
||||
.line { display: flex; justify-content: space-between; align-items: center; gap: 1rem; min-height: 3.6rem; }
|
||||
.name { display: inline-flex; align-items: center; gap: 0.7rem; font-size: var(--step-lead); font-weight: 500; }
|
||||
.row .rivet { --hole: var(--fold-3); }
|
||||
.row.is-on .rivet { --hole: var(--fold-3); }
|
||||
.val { font-size: var(--step-body); font-weight: 500; }
|
||||
.desc { display: grid; grid-template-rows: 0fr; transition: grid-template-rows 320ms var(--ease-out); }
|
||||
.desc span { overflow: hidden; }
|
||||
.desc p { max-width: 36ch; padding-bottom: 0.8rem; font-size: var(--step-body); font-weight: 400; }
|
||||
.row.is-on .desc { grid-template-rows: 1fr; }
|
||||
.inline { display: none; }
|
||||
|
||||
.close { background: #07160e; padding-bottom: 3rem; }
|
||||
.mark {
|
||||
display: flex;
|
||||
align-items: flex-end;
|
||||
gap: 4px;
|
||||
max-width: 100%;
|
||||
overflow: visible;
|
||||
}
|
||||
.blob {
|
||||
display: grid;
|
||||
place-items: center;
|
||||
flex: var(--g) 1 0;
|
||||
min-width: 0;
|
||||
aspect-ratio: 1;
|
||||
border-radius: 50%;
|
||||
background: var(--accent);
|
||||
}
|
||||
.blob i { width: 32%; height: 32%; border-radius: 50%; background: #07160e; }
|
||||
.close-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(12, minmax(0, 1fr));
|
||||
column-gap: var(--gutter);
|
||||
margin-top: 3.5rem;
|
||||
}
|
||||
.links { grid-column: 1 / 9; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.8rem 1rem; }
|
||||
.links a { font-size: var(--step-body); text-decoration: none; }
|
||||
.where { grid-column: 9 / 13; font-size: var(--step-body); }
|
||||
.legal {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
gap: 1rem;
|
||||
margin-top: 3rem;
|
||||
}
|
||||
.legal p, .credits { max-width: 78ch; color: var(--muted); font-size: var(--step-small); }
|
||||
.credits { margin-top: 1.5rem; }
|
||||
.credits a { color: inherit; }
|
||||
|
||||
@media (hover: hover) and (pointer: fine) {
|
||||
.button:hover { background: #ffe58a; }
|
||||
.leaf:hover .name, .links a:hover { text-decoration: underline; text-underline-offset: 0.18em; }
|
||||
}
|
||||
@media (max-width: 800px) {
|
||||
.hero { padding-top: 48svh; }
|
||||
.hero h1, .support {
|
||||
position: absolute;
|
||||
left: var(--margin);
|
||||
right: var(--margin);
|
||||
max-width: none;
|
||||
text-align: center;
|
||||
}
|
||||
.hero h1 { top: 5.5rem; font-size: 17vw; }
|
||||
.support { top: calc(5.5rem + 17vw + 0.8rem); font-size: 1rem; }
|
||||
.giant { width: 62vw; height: 62vw; right: -14vw; top: calc(8.5rem + 17vw); bottom: auto; }
|
||||
.stack { width: 100%; margin-top: 0; padding-top: 13rem; }
|
||||
.leaf { height: 3.25rem; }
|
||||
.leaf:nth-of-type(2) { top: 3.25rem; }
|
||||
.leaf:nth-of-type(3) { top: 6.5rem; }
|
||||
.leaf:nth-of-type(4) { top: 9.75rem; }
|
||||
.front .button { width: 100%; }
|
||||
.stages { flex-direction: column; }
|
||||
.stage { flex: none; }
|
||||
.seg { min-height: 5.5rem; }
|
||||
.split { grid-template-columns: 1fr; }
|
||||
.split h2, .frame, .index { grid-column: 1; width: auto; }
|
||||
.split h2 { grid-row: 1; }
|
||||
.frame { position: static; grid-row: 2; width: min(72vw, 360px); }
|
||||
.index { grid-row: 3; }
|
||||
.shot { width: min(70vw, 320px); margin-inline: auto; }
|
||||
.close-grid { grid-template-columns: 1fr; }
|
||||
.links, .where { grid-column: auto; }
|
||||
.links { grid-template-columns: 1fr 1fr; }
|
||||
.legal { flex-direction: column; align-items: flex-start; }
|
||||
.mark { max-width: 100%; }
|
||||
}
|
||||
@media (prefers-reduced-motion: no-preference) {
|
||||
.js [data-rise] { opacity: 0; transform: translateY(22px); animation: rise var(--t-reveal) var(--ease-out) forwards; animation-delay: calc(var(--i, 0) * 80ms + 80ms); }
|
||||
.js [data-reveal] { opacity: 0; transform: translateY(22px); transition: opacity 700ms var(--ease-out), transform 800ms var(--ease-out); }
|
||||
.js [data-reveal].is-in { opacity: 1; transform: none; }
|
||||
.js .shot img { transition: opacity var(--t-ui) linear; }
|
||||
.js .shot img.is-on { animation: drift 16s ease-in-out infinite alternate; }
|
||||
.button, .leaf, .row, .links a { transition: background-color var(--t-hover) ease, color var(--t-hover) ease, transform var(--t-press) var(--ease-out); }
|
||||
}
|
||||
@keyframes rise { to { opacity: 1; transform: none; } }
|
||||
@keyframes drift { to { transform: scale(1.06); } }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<header class="hero" id="top">
|
||||
<div class="top">
|
||||
<a class="brand" href="#top">设备验收预警</a>
|
||||
<a class="back" href="#close">返回停留情况</a>
|
||||
</div>
|
||||
<div class="giant" data-rise style="--i:2">
|
||||
<img src="assets/gold-belt-mount-with-rivet.jpg" width="3140" height="4000" alt="八世纪金带扣,面上有一颗铆钉和一个孔。这不是托威斯拉钉机。">
|
||||
</div>
|
||||
<h1 data-rise style="--i:0">尚未计时</h1>
|
||||
<p class="support" data-rise style="--i:1">托威斯这台拉钉机还停在品质担当,<br>签核天数是零。</p>
|
||||
<div class="stack">
|
||||
<a class="leaf" href="#ladder" data-rise style="--i:3; --leaf:#07160e"><span class="rivet" aria-hidden="true"><i></i></span>四档</a>
|
||||
<a class="leaf" href="#facts" data-rise style="--i:4; --leaf:#0c2418"><span class="rivet" aria-hidden="true"><i></i></span>单据</a>
|
||||
<a class="leaf" href="#handler" data-rise style="--i:5; --leaf:#12301f"><span class="rivet" aria-hidden="true"><i></i></span>经手</a>
|
||||
<a class="leaf" href="#close" data-rise style="--i:6; --leaf:#184028"><span class="rivet" aria-hidden="true"><i></i></span>落款</a>
|
||||
<div class="front" data-rise style="--i:7">
|
||||
<div class="tabline"><span class="rivet" aria-hidden="true"><i></i></span>这张单</div>
|
||||
<a class="button" href="#facts">看单据上的字</a>
|
||||
<p>验收单 20260718000003,流程 20260718-1520。温德佳经手。审批还没结束,这张单可以验收,也没有退回。</p>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<section class="band ladder" id="ladder">
|
||||
<h2 data-reveal>三十天才第一封</h2>
|
||||
<div class="stages" data-ui>
|
||||
<article class="stage s1" data-reveal style="--i:1">
|
||||
<div class="seg">三十天</div>
|
||||
<p>使用部门担当收到,并抄送主管。</p>
|
||||
</article>
|
||||
<article class="stage s2" data-reveal style="--i:2">
|
||||
<div class="seg">七天</div>
|
||||
<p>经副理收到,抄送 COO。</p>
|
||||
</article>
|
||||
<article class="stage s3" data-reveal style="--i:3">
|
||||
<div class="seg">七天</div>
|
||||
<p>COO 收到,抄送采购经副理。</p>
|
||||
</article>
|
||||
<article class="stage s4" data-reveal style="--i:4">
|
||||
<div class="seg">七天</div>
|
||||
<p>总经理默认不发。</p>
|
||||
</article>
|
||||
</div>
|
||||
<div class="meter" data-reveal style="--i:5">
|
||||
<div class="track" aria-hidden="true">
|
||||
<div class="bar"></div>
|
||||
<span class="pin" id="pin"><i></i></span>
|
||||
</div>
|
||||
<label for="dwell">假设已经签核 <output class="nums" id="days">0</output> 天</label>
|
||||
<input id="dwell" type="range" min="0" max="60" value="0" step="1">
|
||||
<p class="reading" id="reading">还在起点。进入使用部门担当之后,才从到达那天算。</p>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="band facts" id="facts">
|
||||
<div class="split">
|
||||
<h2 data-reveal>单据上的字</h2>
|
||||
<figure class="frame">
|
||||
<div class="shot">
|
||||
<img class="is-on" data-shot="0" src="assets/gold-belt-mount-with-rivet.jpg" width="3140" height="4000" alt="金带扣上的铆钉,阿瓦尔人,八世纪">
|
||||
<img data-shot="1" src="assets/hammer.jpg" width="1984" height="860" alt="一把十八世纪的小锤" loading="lazy">
|
||||
<img data-shot="2" src="assets/armorer-s-anvil.jpg" width="2100" height="1918" alt="十六世纪盔甲匠用的铁砧" loading="lazy">
|
||||
<img data-shot="3" src="assets/armor.jpg" width="3001" height="4000" alt="十六世纪板甲,甲片用铆钉固定" loading="lazy">
|
||||
</div>
|
||||
<figcaption class="cap" id="cap">金带扣上的铆钉。阿瓦尔人,八世纪。大都会艺术博物馆藏,不是这台机器。</figcaption>
|
||||
</figure>
|
||||
<div class="index">
|
||||
<button class="row is-on" type="button" data-shot="0" data-cap="金带扣上的铆钉。阿瓦尔人,八世纪。大都会艺术博物馆藏,不是这台机器。">
|
||||
<span class="line"><span class="name"><span class="rivet" aria-hidden="true"><i></i></span>验收单</span><span class="val nums">20260718000003</span></span>
|
||||
<span class="desc"><span><p>流程编号 20260718-1520。标题是托威斯平台式自动拉钉机,一套,提交 OA。创建于 2026-07-18 16:51:47。</p></span></span>
|
||||
</button>
|
||||
<button class="row" type="button" data-shot="1" data-cap="小锤。大概十八世纪。大都会艺术博物馆藏,不是采购单上的设备。">
|
||||
<span class="line"><span class="name"><span class="rivet" aria-hidden="true"><i></i></span>采购单</span><span class="val nums">5202-2606030008</span></span>
|
||||
<span class="desc"><span><p>申请人柴晓红。这张快照里没有合同号,采购单号就这一条。</p></span></span>
|
||||
</button>
|
||||
<button class="row" id="handler" type="button" data-shot="2" data-cap="盔甲匠的铁砧。十六世纪。人还没到计时的那一站,就像工件还搁在砧上。">
|
||||
<span class="line"><span class="name"><span class="rivet" aria-hidden="true"><i></i></span>当前处理人</span><span class="val">温德佳</span></span>
|
||||
<span class="desc"><span><p>节点是品质担当。计时要等使用部门担当,所以起点和天数都还是空的。工号这页没写。</p></span></span>
|
||||
</button>
|
||||
<button class="row" type="button" data-shot="3" data-cap="板甲。十六世纪,下萨克森一带。甲片靠铆钉固定,不是验收结论的照片。">
|
||||
<span class="line"><span class="name"><span class="rivet" aria-hidden="true"><i></i></span>验收结论</span><span class="val">可以验收</span></span>
|
||||
<span class="desc"><span><p>没有无法验收说明,也没有退回。流程仍是审批中,结束时间还没有。</p></span></span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<footer class="band close" id="close">
|
||||
<div class="mark" aria-hidden="true">
|
||||
<span class="blob" data-reveal style="--g:0.62"><i></i></span>
|
||||
<span class="blob" data-reveal style="--g:0.84; --i:1"><i></i></span>
|
||||
<span class="blob" data-reveal style="--g:1; --i:2"><i></i></span>
|
||||
<span class="blob" data-reveal style="--g:0.7; --i:3"><i></i></span>
|
||||
<span class="blob" data-reveal style="--g:0.92; --i:4"><i></i></span>
|
||||
<span class="blob" data-reveal style="--g:0.58; --i:5"><i></i></span>
|
||||
<span class="blob" data-reveal style="--g:1; --i:6"><i></i></span>
|
||||
</div>
|
||||
<div class="close-grid">
|
||||
<nav class="links" aria-label="页面">
|
||||
<a href="#top">停留情况</a>
|
||||
<a href="#ladder">四档天数</a>
|
||||
<a href="#facts">这张单据</a>
|
||||
<a href="#handler">当前处理人</a>
|
||||
</nav>
|
||||
<p class="where">验收单 20260718000003<br>流程 20260718-1520</p>
|
||||
</div>
|
||||
<div class="legal">
|
||||
<p>正式页面里,返回会回到停留列表。这里只停在这一张单上。</p>
|
||||
<a class="button" href="#top">返回停留情况</a>
|
||||
</div>
|
||||
<p class="credits">器物照片都来自大都会艺术博物馆,公有领域,不是托威斯的设备,也不是温德佳或柴晓红。<a href="https://www.metmuseum.org/art/collection/search/464103">金带扣与铆钉</a>,阿瓦尔人,八世纪。<a href="https://www.metmuseum.org/art/collection/search/204741">小锤</a>,约十八世纪。<a href="https://www.metmuseum.org/art/collection/search/471599">盔甲匠铁砧</a>,十六世纪。<a href="https://www.metmuseum.org/art/collection/search/35937">板甲</a>,约 1540–1550 年,可能来自下萨克森。</p>
|
||||
</footer>
|
||||
<script>
|
||||
const rows = [...document.querySelectorAll('.row')];
|
||||
const shots = [...document.querySelectorAll('.shot img')];
|
||||
const cap = document.getElementById('cap');
|
||||
function show(row) {
|
||||
rows.forEach((item) => item.classList.toggle('is-on', item === row));
|
||||
shots.forEach((img) => img.classList.toggle('is-on', img.dataset.shot === row.dataset.shot));
|
||||
cap.textContent = row.dataset.cap;
|
||||
}
|
||||
rows.forEach((row) => {
|
||||
row.addEventListener('mouseenter', () => show(row));
|
||||
row.addEventListener('focus', () => show(row));
|
||||
row.addEventListener('click', () => show(row));
|
||||
});
|
||||
|
||||
const dwell = document.getElementById('dwell');
|
||||
const days = document.getElementById('days');
|
||||
const reading = document.getElementById('reading');
|
||||
const pin = document.getElementById('pin');
|
||||
const narrow = window.matchMedia('(max-width: 800px)');
|
||||
function sentence(n) {
|
||||
if (n <= 0) return '还在起点。进入使用部门担当之后,才从到达那天算。';
|
||||
if (n < 30) return '已过 ' + n + ' 天,还没到三十天,一封都不发。';
|
||||
if (n < 37) return '已过三十天。通知使用部门担当,抄送直接主管和采购担当。';
|
||||
if (n < 44) return '已过三十七天。通知经副理,抄送 COO 和采购经副理。';
|
||||
if (n < 51) return '已过四十四天。通知 COO,抄送采购经副理。';
|
||||
return '已过五十一天。总经理这一档默认关着,打开后才发。';
|
||||
}
|
||||
function paint() {
|
||||
const n = Number(dwell.value);
|
||||
const pct = Math.min(100, (n / 51) * 100);
|
||||
days.textContent = String(n);
|
||||
reading.textContent = sentence(n);
|
||||
if (narrow.matches) {
|
||||
pin.style.top = '50%';
|
||||
pin.style.left = pct + '%';
|
||||
} else {
|
||||
pin.style.top = '50%';
|
||||
pin.style.left = pct + '%';
|
||||
}
|
||||
}
|
||||
dwell.addEventListener('input', paint);
|
||||
narrow.addEventListener('change', paint);
|
||||
paint();
|
||||
|
||||
const targets = document.querySelectorAll('[data-reveal]');
|
||||
if ('IntersectionObserver' in window) {
|
||||
const io = new IntersectionObserver((entries) => {
|
||||
entries.forEach((entry) => {
|
||||
if (!entry.isIntersecting) return;
|
||||
entry.target.classList.add('is-in');
|
||||
io.unobserve(entry.target);
|
||||
});
|
||||
}, { rootMargin: '0px 0px -8% 0px', threshold: 0.12 });
|
||||
targets.forEach((el) => io.observe(el));
|
||||
} else {
|
||||
targets.forEach((el) => el.classList.add('is-in'));
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -110,7 +110,7 @@ def sync_equipment_acceptance():
|
||||
|
||||
@equipment_acceptance_bp.route("/orders", methods=["GET"])
|
||||
def list_equipment_acceptance_orders():
|
||||
"""分页查看已同步的验收单。focus 按原型分组过滤,summary 始终统计全部单据。"""
|
||||
"""分页查看已同步的验收单。focus 按状态分组,keyword 查三种单号,applicant 查申请人。"""
|
||||
_require_equipment_acceptance_access()
|
||||
page = _int_arg("page", 1)
|
||||
page_size = _int_arg("page_size", 20)
|
||||
@@ -119,6 +119,8 @@ def list_equipment_acceptance_orders():
|
||||
focus=request.args.get("focus"),
|
||||
page=page,
|
||||
page_size=page_size,
|
||||
keyword=request.args.get("keyword"),
|
||||
applicant=request.args.get("applicant"),
|
||||
)
|
||||
return ok(payload, request_id=getattr(g, "request_id", None))
|
||||
|
||||
|
||||
@@ -3,11 +3,11 @@ backend/app/models/equipment_acceptance.py
|
||||
|
||||
用途:设备验收预警的本地同步快照和可改配置。
|
||||
依赖:models.base.Base、users。
|
||||
逻辑:同步服务按流程实例 request_id upsert 主表,并整批替换当前节点和操作人子表。
|
||||
逻辑:同步服务按来源 oa_system 加流程实例 request_id upsert 主表,并整批替换当前节点和操作人子表。
|
||||
配置表存四档天数、第 4 轮是否启用,以及三个固定岗位的系统用户。发送时刻不在这张表。
|
||||
发送记录按验收单和档位留一行。已发送和已取消的姓名不回写;待发送每次扫描重算。
|
||||
发给每位收件人的 Excel 另存一行,并用 send_record_ids 挂回发送记录,供表格列下载。
|
||||
不保存流程编号、第二合同编号、验收日期和 isremark。
|
||||
保存流程编号和标题。不保存第二合同编号、验收日期和 isremark。
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
@@ -22,18 +22,34 @@ from app.models.base import Base
|
||||
|
||||
|
||||
class EquipmentAcceptanceOrder(Base):
|
||||
"""一张验收单的最近一次同步结果。流程实例 request_id 唯一。"""
|
||||
"""一张验收单的最近一次同步结果。同一来源里 request_id 唯一。"""
|
||||
|
||||
__tablename__ = "equipment_acceptance_orders"
|
||||
__table_args__ = (
|
||||
UniqueConstraint("request_id", name="uq_equipment_acceptance_orders_request_id"),
|
||||
UniqueConstraint("oa_system", "request_id", name="uq_equipment_acceptance_orders_oa_request"),
|
||||
Index("ix_equipment_acceptance_orders_status", "monitor_status"),
|
||||
)
|
||||
|
||||
id: Mapped[int] = mapped_column(primary_key=True)
|
||||
oa_system: Mapped[str] = mapped_column(String(8), nullable=False, default="e10")
|
||||
acceptance_no: Mapped[Optional[str]] = mapped_column(String(128), nullable=True)
|
||||
purchase_order_no: Mapped[Optional[str]] = mapped_column(String(128), nullable=True)
|
||||
contract_no: Mapped[Optional[str]] = mapped_column(String(128), nullable=True)
|
||||
flow_no: Mapped[Optional[str]] = mapped_column(
|
||||
String(1000),
|
||||
nullable=True,
|
||||
comment="流程编号。E10 取 wfc_requestbase.requestmark,E8 取 formtable_main_324.lcbh。",
|
||||
)
|
||||
request_title: Mapped[Optional[str]] = mapped_column(
|
||||
String(1000),
|
||||
nullable=True,
|
||||
comment="流程标题。两边都取流程表 requestname。E10 这一列是流程默认标题。",
|
||||
)
|
||||
request_created_at: Mapped[Optional[datetime]] = mapped_column(
|
||||
DateTime,
|
||||
nullable=True,
|
||||
comment="流程创建时间。E10 取 wfc_requestbase.createdatetime。E8 取 createdate 加 createtime。不用 E10 的 create_time。",
|
||||
)
|
||||
timer_started_at: Mapped[Optional[datetime]] = mapped_column(DateTime, nullable=True)
|
||||
dwell_days: Mapped[Optional[int]] = mapped_column(nullable=True)
|
||||
can_accept: Mapped[Optional[int]] = mapped_column(
|
||||
|
||||
@@ -136,6 +136,47 @@ def resolve_account(
|
||||
)
|
||||
|
||||
|
||||
def resolve_direct_wecom(
|
||||
*,
|
||||
slot: str,
|
||||
label: str,
|
||||
name: str | None,
|
||||
wecom_userid: str | None,
|
||||
user: Any = None,
|
||||
oa_employee_id: int | None = None,
|
||||
missing_error: str,
|
||||
) -> dict[str, Any]:
|
||||
"""
|
||||
把已经是企业微信 userid 的人员收成收件人。
|
||||
|
||||
核心逻辑:E8 矩阵的 zz、jfl 本身就是企微 userid,不再用工号对用户。
|
||||
系统里能对上这个 userid 时带上用户主键。对不上仍按该 userid 发送。
|
||||
Args:
|
||||
slot: to 或 cc。
|
||||
label: 直接主管或经副理。
|
||||
name: 展示姓名。
|
||||
wecom_userid: 企业微信 userid。
|
||||
user: 已按 wecom_userid 找到的系统用户。可空。
|
||||
oa_employee_id: HrmResource.id。
|
||||
missing_error: 没有 userid 时的失败原因。
|
||||
Returns:
|
||||
一名收件人。
|
||||
"""
|
||||
wecom = str(wecom_userid or "").strip()
|
||||
if not wecom:
|
||||
return make_person(slot=slot, label=label, name=name, oa_employee_id=oa_employee_id, error=missing_error)
|
||||
display = _user_name(user) or name
|
||||
bound = str(getattr(user, "wecom_userid", None) or "").strip() if user is not None else ""
|
||||
return make_person(
|
||||
slot=slot,
|
||||
label=label,
|
||||
name=display,
|
||||
user_id=getattr(user, "id", None) if user is not None else None,
|
||||
wecom_userid=bound or wecom,
|
||||
oa_employee_id=oa_employee_id,
|
||||
)
|
||||
|
||||
|
||||
def resolve_configured_user(*, slot: str, label: str, user: Any, missing_error: str) -> dict[str, Any]:
|
||||
"""
|
||||
把预警配置里的固定岗位收成收件人。
|
||||
|
||||
@@ -2,8 +2,9 @@
|
||||
backend/app/services/equipment_acceptance/alert_service.py
|
||||
|
||||
用途:每日扫描生成设备验收待发送记录,并在周五按收件人发送企业微信。
|
||||
依赖:同步服务、OA 人员目录、alert_plan、alert_notice、发送记录模型、企微通知。
|
||||
逻辑:扫描先同步 E10,再按停留天数跨档。第 4 轮关闭时不生成、也不发送总经理那一轮。
|
||||
依赖:同步服务、E10 人员目录、E8 人员矩阵、alert_plan、alert_notice、发送记录模型、企微通知。
|
||||
逻辑:扫描先同步 E10 和 E8,再按停留天数跨档。第 1 档主送使用部门担当,不按当前未办人。
|
||||
第 4 轮关闭时不生成、也不发送总经理那一轮。
|
||||
周五按收件人发一条汇总卡片,紧跟着一份 Excel。卡片和文件都成功才算已发送。停表取消未发送记录。已发送的不重发、不改收件人。
|
||||
"""
|
||||
|
||||
@@ -35,6 +36,7 @@ from app.services.equipment_acceptance.alert_plan import (
|
||||
make_person,
|
||||
resolve_account,
|
||||
resolve_configured_user,
|
||||
resolve_direct_wecom,
|
||||
)
|
||||
from app.services.equipment_acceptance.config_service import is_round_4_enabled, reminder_days
|
||||
from app.services.equipment_acceptance.snapshot_rules import WATCHING
|
||||
@@ -47,9 +49,9 @@ _UNSENT = ("pending", "failed")
|
||||
|
||||
def generate_alerts() -> dict[str, Any]:
|
||||
"""
|
||||
同步 E10 后生成或更新待发送记录。
|
||||
同步两个来源后生成或更新待发送记录。
|
||||
|
||||
核心逻辑:先拉最新节点和停表状态,再按当前处理人解析收件人。本函数不发企业微信。
|
||||
核心逻辑:先拉最新快照,再按使用部门担当解析收件人。本函数不发企业微信。
|
||||
Returns:
|
||||
sync 摘要,以及 created、updated、cancelled 条数。
|
||||
"""
|
||||
@@ -78,9 +80,9 @@ def refresh_pending_alerts(
|
||||
created、updated、cancelled。
|
||||
"""
|
||||
orders = db.session.query(EquipmentAcceptanceOrder).all()
|
||||
operators = _operators_by_order([order.id for order in orders])
|
||||
people, deputies = directory if directory is not None else _load_directory(orders, operators)
|
||||
users_by_job = _users_by_job(_job_numbers(orders, operators, people, deputies))
|
||||
e10_people, e10_deputies, e8_people, e8_matrix, e8_ok = _directories(orders, directory)
|
||||
users_by_job = _users_by_job(_job_numbers(orders, e10_people, e10_deputies, e8_people))
|
||||
users_by_wecom = _users_by_wecom(_wecom_ids(e8_matrix))
|
||||
roles = _configured_users()
|
||||
thresholds = reminder_days()
|
||||
max_tier = 4 if is_round_4_enabled() else 3
|
||||
@@ -96,12 +98,16 @@ def refresh_pending_alerts(
|
||||
if order.monitor_status != WATCHING:
|
||||
cancelled += cancel_unsent(order.id)
|
||||
continue
|
||||
if (order.oa_system or "e10") == "e8" and not e8_ok:
|
||||
continue
|
||||
for draft in _drafts(
|
||||
order,
|
||||
operators.get(order.id, []),
|
||||
people,
|
||||
deputies,
|
||||
e10_people,
|
||||
e10_deputies,
|
||||
e8_people,
|
||||
e8_matrix,
|
||||
users_by_job,
|
||||
users_by_wecom,
|
||||
roles,
|
||||
thresholds,
|
||||
max_tier=max_tier,
|
||||
@@ -282,82 +288,31 @@ def send_pending_alerts() -> dict[str, Any]:
|
||||
|
||||
def _drafts(
|
||||
order: EquipmentAcceptanceOrder,
|
||||
operators: list[EquipmentAcceptanceOperator],
|
||||
people: dict[int, dict[str, Any]],
|
||||
deputies: dict[str, list[dict[str, Any]]],
|
||||
e10_people: dict[int, dict[str, Any]],
|
||||
e10_deputies: dict[str, list[dict[str, Any]]],
|
||||
e8_people: dict[int, dict[str, Any]],
|
||||
e8_matrix: dict[str, dict[str, Any]],
|
||||
users_by_job: dict[str, User],
|
||||
users_by_wecom: dict[str, User],
|
||||
roles: dict[str, User | None],
|
||||
thresholds: tuple[int, int, int, int],
|
||||
*,
|
||||
max_tier: int = 4,
|
||||
) -> list[dict[str, Any]]:
|
||||
"""按当前处理人展开已经跨过、且配置允许的档。第 4 轮关闭时最高到第 3 档。"""
|
||||
"""按使用部门担当展开已经跨过、且配置允许的档。第 4 轮关闭时最高到第 3 档。"""
|
||||
due = due_tiers(order.dwell_days, thresholds, max_tier=max_tier)
|
||||
if not due:
|
||||
return []
|
||||
handlers: list[dict[str, Any]] = []
|
||||
supervisors: list[dict[str, Any]] = []
|
||||
deputy_people: list[dict[str, Any]] = []
|
||||
if not operators:
|
||||
handlers.append(make_person(slot="to", label="当前处理人", error="没有当前处理人"))
|
||||
deputy_people.append(make_person(slot="to", label="经副理", error="没有当前处理人,查不到经副理"))
|
||||
for operator in operators:
|
||||
fact = people.get(operator.user_id) or {}
|
||||
name = fact.get("name") or operator.handler_name
|
||||
job_num = fact.get("job_num") or operator.handler_job_num
|
||||
shown = name or "处理人"
|
||||
handlers.append(resolve_account(
|
||||
slot="to",
|
||||
label="当前处理人",
|
||||
name=name,
|
||||
job_num=job_num,
|
||||
user=users_by_job.get(str(job_num or "")),
|
||||
missing_job_error=f"{shown}没有工号",
|
||||
oa_employee_id=operator.user_id,
|
||||
))
|
||||
superior_id = fact.get("superior_id")
|
||||
if superior_id is None:
|
||||
supervisors.append(make_person(slot="cc", label="直接主管", name=name, error=f"{shown}没有直接主管"))
|
||||
else:
|
||||
supervisors.append(resolve_account(
|
||||
slot="cc",
|
||||
label="直接主管",
|
||||
name=fact.get("superior_name"),
|
||||
job_num=fact.get("superior_job_num"),
|
||||
user=users_by_job.get(str(fact.get("superior_job_num") or "")),
|
||||
missing_job_error=f"{shown}的直接主管没有工号",
|
||||
oa_employee_id=superior_id,
|
||||
))
|
||||
found = deputies.get(str(fact.get("department_id") or ""), [])
|
||||
if not found:
|
||||
deputy_people.append(make_person(slot="to", label="经副理", name=name, error=f"{shown}没有经副理"))
|
||||
else:
|
||||
for item in found:
|
||||
deputy_people.append(resolve_account(
|
||||
slot="to",
|
||||
label="经副理",
|
||||
name=item.get("name"),
|
||||
job_num=item.get("job_num"),
|
||||
user=users_by_job.get(str(item.get("job_num") or "")),
|
||||
missing_job_error=f"{shown}的经副理没有工号",
|
||||
oa_employee_id=item.get("oa_id"),
|
||||
))
|
||||
applicant_fact = people.get(order.applicant_oa_id) if order.applicant_oa_id else None
|
||||
applicant = resolve_account(
|
||||
slot="cc",
|
||||
label="采购担当",
|
||||
name=(applicant_fact or {}).get("name") or order.applicant_name,
|
||||
job_num=(applicant_fact or {}).get("job_num") or order.applicant_job_num,
|
||||
user=users_by_job.get(str(((applicant_fact or {}).get("job_num") or order.applicant_job_num) or "")),
|
||||
missing_job_error="没有申请人工号",
|
||||
oa_employee_id=order.applicant_oa_id,
|
||||
owner, supervisors, deputy_people = _owner_seats(
|
||||
order, e10_people, e10_deputies, e8_people, e8_matrix, users_by_job, users_by_wecom
|
||||
)
|
||||
applicant = _applicant(order, e10_people if (order.oa_system or "e10") != "e8" else e8_people, users_by_job)
|
||||
drafts: list[dict[str, Any]] = []
|
||||
if 1 in due:
|
||||
drafts.append(assemble_tier(
|
||||
tier=1,
|
||||
threshold_days=thresholds[0],
|
||||
to_people=handlers,
|
||||
to_people=[owner],
|
||||
cc_people=[*supervisors, applicant],
|
||||
))
|
||||
if 2 in due:
|
||||
@@ -390,6 +345,159 @@ def _drafts(
|
||||
return drafts
|
||||
|
||||
|
||||
def _owner_seats(
|
||||
order: EquipmentAcceptanceOrder,
|
||||
e10_people: dict[int, dict[str, Any]],
|
||||
e10_deputies: dict[str, list[dict[str, Any]]],
|
||||
e8_people: dict[int, dict[str, Any]],
|
||||
e8_matrix: dict[str, dict[str, Any]],
|
||||
users_by_job: dict[str, User],
|
||||
users_by_wecom: dict[str, User],
|
||||
) -> tuple[dict[str, Any], list[dict[str, Any]], list[dict[str, Any]]]:
|
||||
"""第 1 档主送和其上级。E8 的上级来自部门矩阵,E10 来自 employee 和审批矩阵。"""
|
||||
if (order.oa_system or "e10") == "e8":
|
||||
return _e8_owner_seats(order, e8_people, e8_matrix, users_by_job, users_by_wecom)
|
||||
return _e10_owner_seats(order, e10_people, e10_deputies, users_by_job)
|
||||
|
||||
|
||||
def _e10_owner_seats(
|
||||
order: EquipmentAcceptanceOrder,
|
||||
people: dict[int, dict[str, Any]],
|
||||
deputies: dict[str, list[dict[str, Any]]],
|
||||
users_by_job: dict[str, User],
|
||||
) -> tuple[dict[str, Any], list[dict[str, Any]], list[dict[str, Any]]]:
|
||||
"""E10 只取 sybmdd 这一名使用部门担当,不展开当前节点上的其他人。"""
|
||||
if not order.owner_oa_id:
|
||||
return (
|
||||
make_person(slot="to", label="使用部门担当", error="没有使用部门担当"),
|
||||
[make_person(slot="cc", label="直接主管", error="没有使用部门担当,查不到直接主管")],
|
||||
[make_person(slot="to", label="经副理", error="没有使用部门担当,查不到经副理")],
|
||||
)
|
||||
fact = people.get(order.owner_oa_id) or {}
|
||||
name = fact.get("name") or order.owner_name
|
||||
job_num = fact.get("job_num") or order.owner_job_num
|
||||
shown = name or "使用部门担当"
|
||||
owner = resolve_account(
|
||||
slot="to",
|
||||
label="使用部门担当",
|
||||
name=name,
|
||||
job_num=job_num,
|
||||
user=users_by_job.get(str(job_num or "")),
|
||||
missing_job_error=f"{shown}没有工号",
|
||||
oa_employee_id=order.owner_oa_id,
|
||||
)
|
||||
superior_id = fact.get("superior_id")
|
||||
if superior_id is None:
|
||||
supervisors = [make_person(slot="cc", label="直接主管", name=name, error=f"{shown}没有直接主管")]
|
||||
else:
|
||||
supervisors = [resolve_account(
|
||||
slot="cc",
|
||||
label="直接主管",
|
||||
name=fact.get("superior_name"),
|
||||
job_num=fact.get("superior_job_num"),
|
||||
user=users_by_job.get(str(fact.get("superior_job_num") or "")),
|
||||
missing_job_error=f"{shown}的直接主管没有工号",
|
||||
oa_employee_id=superior_id,
|
||||
)]
|
||||
found = deputies.get(str(fact.get("department_id") or ""), [])
|
||||
if not found:
|
||||
deputy_people = [make_person(slot="to", label="经副理", name=name, error=f"{shown}没有经副理")]
|
||||
else:
|
||||
deputy_people = [
|
||||
resolve_account(
|
||||
slot="to",
|
||||
label="经副理",
|
||||
name=item.get("name"),
|
||||
job_num=item.get("job_num"),
|
||||
user=users_by_job.get(str(item.get("job_num") or "")),
|
||||
missing_job_error=f"{shown}的经副理没有工号",
|
||||
oa_employee_id=item.get("oa_id"),
|
||||
)
|
||||
for item in found
|
||||
]
|
||||
return owner, supervisors, deputy_people
|
||||
|
||||
|
||||
def _e8_owner_seats(
|
||||
order: EquipmentAcceptanceOrder,
|
||||
people: dict[int, dict[str, Any]],
|
||||
matrix: dict[str, dict[str, Any]],
|
||||
users_by_job: dict[str, User],
|
||||
users_by_wecom: dict[str, User],
|
||||
) -> tuple[dict[str, Any], list[dict[str, Any]], list[dict[str, Any]]]:
|
||||
"""E8 的直接主管是矩阵 zz,经副理是 jfl。不是一行就不发这两个席位。"""
|
||||
if not order.owner_oa_id:
|
||||
return (
|
||||
make_person(slot="to", label="使用部门担当", error="没有使用部门担当"),
|
||||
[make_person(slot="cc", label="直接主管", error="没有使用部门担当,查不到直接主管")],
|
||||
[make_person(slot="to", label="经副理", error="没有使用部门担当,查不到经副理")],
|
||||
)
|
||||
fact = people.get(order.owner_oa_id) or {}
|
||||
name = fact.get("name") or order.owner_name
|
||||
job_num = fact.get("job_num") or order.owner_job_num
|
||||
shown = name or "使用部门担当"
|
||||
owner = resolve_account(
|
||||
slot="to",
|
||||
label="使用部门担当",
|
||||
name=name,
|
||||
job_num=job_num,
|
||||
user=users_by_job.get(str(job_num or "")),
|
||||
missing_job_error=f"{shown}没有工号",
|
||||
oa_employee_id=order.owner_oa_id,
|
||||
)
|
||||
seat = matrix.get(str(fact.get("department_id") or ""))
|
||||
if not seat or not seat.get("ok"):
|
||||
return (
|
||||
owner,
|
||||
[make_person(slot="cc", label="直接主管", name=name, error=f"{shown}的部门矩阵不是一行")],
|
||||
[make_person(slot="to", label="经副理", name=name, error=f"{shown}的部门矩阵不是一行")],
|
||||
)
|
||||
return owner, [_matrix_seat(seat.get("zz"), "cc", "直接主管", shown, users_by_wecom)], [
|
||||
_matrix_seat(seat.get("jfl"), "to", "经副理", shown, users_by_wecom)
|
||||
]
|
||||
|
||||
|
||||
def _matrix_seat(
|
||||
seat: dict[str, Any] | None,
|
||||
slot: str,
|
||||
label: str,
|
||||
owner_name: str,
|
||||
users_by_wecom: dict[str, User],
|
||||
) -> dict[str, Any]:
|
||||
"""矩阵人员按企微 userid 发送。空席位记失败。"""
|
||||
if not seat:
|
||||
return make_person(slot=slot, label=label, name=owner_name, error=f"{owner_name}没有{label}")
|
||||
wecom = str(seat.get("wecom_userid") or "")
|
||||
return resolve_direct_wecom(
|
||||
slot=slot,
|
||||
label=label,
|
||||
name=seat.get("name"),
|
||||
wecom_userid=wecom,
|
||||
user=users_by_wecom.get(wecom),
|
||||
oa_employee_id=seat.get("oa_id"),
|
||||
missing_error=f"{owner_name}没有{label}",
|
||||
)
|
||||
|
||||
|
||||
def _applicant(
|
||||
order: EquipmentAcceptanceOrder,
|
||||
people: dict[int, dict[str, Any]],
|
||||
users_by_job: dict[str, User],
|
||||
) -> dict[str, Any]:
|
||||
"""采购担当是申请人。E8 用工号 workcode,E10 用工号 JOB_NUM,都对系统用户。"""
|
||||
fact = people.get(order.applicant_oa_id) if order.applicant_oa_id else None
|
||||
job_num = (fact or {}).get("job_num") or order.applicant_job_num
|
||||
return resolve_account(
|
||||
slot="cc",
|
||||
label="采购担当",
|
||||
name=(fact or {}).get("name") or order.applicant_name,
|
||||
job_num=job_num,
|
||||
user=users_by_job.get(str(job_num or "")),
|
||||
missing_job_error="没有申请人工号",
|
||||
oa_employee_id=order.applicant_oa_id,
|
||||
)
|
||||
|
||||
|
||||
def _apply_draft(row: EquipmentAcceptanceSendRecord, order: EquipmentAcceptanceOrder, draft: dict[str, Any]) -> None:
|
||||
"""把草稿写进未发送的记录。不改创建时间,也不填发送时间。"""
|
||||
row.acceptance_no = order.acceptance_no
|
||||
@@ -402,51 +510,103 @@ def _apply_draft(row: EquipmentAcceptanceSendRecord, order: EquipmentAcceptanceO
|
||||
row.error_message = draft["error_message"]
|
||||
|
||||
|
||||
def _load_directory(
|
||||
def _directories(
|
||||
orders: list[EquipmentAcceptanceOrder],
|
||||
directory: tuple[dict[int, dict[str, Any]], dict[str, list[dict[str, Any]]]] | None,
|
||||
) -> tuple[dict[int, dict[str, Any]], dict[str, list[dict[str, Any]]], dict[int, dict[str, Any]], dict[str, dict[str, Any]], bool]:
|
||||
"""分开取 E10 和 E8 的人员。E8 查询失败时本轮不改写 E8 待发送。"""
|
||||
if directory is not None:
|
||||
return directory[0], directory[1], {}, {}, True
|
||||
e10_people, e10_deputies = _load_e10_directory(orders)
|
||||
try:
|
||||
e8_people, e8_matrix = _load_e8_directory(orders)
|
||||
return e10_people, e10_deputies, e8_people, e8_matrix, True
|
||||
except Exception as exc:
|
||||
_LOGGER.warning("equipment acceptance e8 directory skipped error=%s", type(exc).__name__)
|
||||
return e10_people, e10_deputies, {}, {}, False
|
||||
|
||||
|
||||
def _load_e10_directory(
|
||||
orders: list[EquipmentAcceptanceOrder],
|
||||
operators: dict[int, list[EquipmentAcceptanceOperator]],
|
||||
) -> tuple[dict[int, dict[str, Any]], dict[str, list[dict[str, Any]]]]:
|
||||
"""向 E10 要当前处理人和申请人的主管、部门、经副理。"""
|
||||
"""向 E10 要使用部门担当和申请人的主管、部门、经副理。不传入 E8 人员 ID。"""
|
||||
from app.services.equipment_acceptance.oa_repository import fetch_alert_directory
|
||||
|
||||
ids: set[int] = set()
|
||||
for group in operators.values():
|
||||
for operator in group:
|
||||
if operator.user_id:
|
||||
ids.add(operator.user_id)
|
||||
for order in orders:
|
||||
if order.monitor_status == WATCHING and order.applicant_oa_id:
|
||||
if (order.oa_system or "e10") == "e8" or order.monitor_status != WATCHING:
|
||||
continue
|
||||
if order.owner_oa_id:
|
||||
ids.add(order.owner_oa_id)
|
||||
if order.applicant_oa_id:
|
||||
ids.add(order.applicant_oa_id)
|
||||
return fetch_alert_directory(sorted(ids))
|
||||
|
||||
|
||||
def _load_e8_directory(
|
||||
orders: list[EquipmentAcceptanceOrder],
|
||||
) -> tuple[dict[int, dict[str, Any]], dict[str, dict[str, Any]]]:
|
||||
"""向 E8 要使用部门担当和申请人。人员 ID 只进 HrmResource。"""
|
||||
from app.services.equipment_acceptance.e8_repository import fetch_e8_alert_directory
|
||||
|
||||
ids: set[int] = set()
|
||||
for order in orders:
|
||||
if (order.oa_system or "e10") != "e8" or order.monitor_status != WATCHING:
|
||||
continue
|
||||
if order.owner_oa_id:
|
||||
ids.add(order.owner_oa_id)
|
||||
if order.applicant_oa_id:
|
||||
ids.add(order.applicant_oa_id)
|
||||
return fetch_e8_alert_directory(sorted(ids))
|
||||
|
||||
|
||||
def _job_numbers(
|
||||
orders: list[EquipmentAcceptanceOrder],
|
||||
operators: dict[int, list[EquipmentAcceptanceOperator]],
|
||||
people: dict[int, dict[str, Any]],
|
||||
deputies: dict[str, list[dict[str, Any]]],
|
||||
e10_people: dict[int, dict[str, Any]],
|
||||
e10_deputies: dict[str, list[dict[str, Any]]],
|
||||
e8_people: dict[int, dict[str, Any]],
|
||||
) -> set[str]:
|
||||
"""收集要对系统用户的工号。"""
|
||||
"""收集要对系统用户的工号。E8 矩阵人员不走工号。"""
|
||||
found: set[str] = set()
|
||||
for order in orders:
|
||||
if order.owner_job_num:
|
||||
found.add(order.owner_job_num)
|
||||
if order.applicant_job_num:
|
||||
found.add(order.applicant_job_num)
|
||||
for group in operators.values():
|
||||
for operator in group:
|
||||
if operator.handler_job_num:
|
||||
found.add(operator.handler_job_num)
|
||||
for fact in people.values():
|
||||
for fact in (*e10_people.values(), *e8_people.values()):
|
||||
if fact.get("job_num"):
|
||||
found.add(str(fact["job_num"]))
|
||||
if fact.get("superior_job_num"):
|
||||
found.add(str(fact["superior_job_num"]))
|
||||
for group in deputies.values():
|
||||
for group in e10_deputies.values():
|
||||
for item in group:
|
||||
if item.get("job_num"):
|
||||
found.add(str(item["job_num"]))
|
||||
return found
|
||||
|
||||
|
||||
def _wecom_ids(matrix: dict[str, dict[str, Any]]) -> set[str]:
|
||||
"""收集 E8 矩阵上的企业微信 userid,用来补系统用户主键。"""
|
||||
found: set[str] = set()
|
||||
for item in matrix.values():
|
||||
if not item.get("ok"):
|
||||
continue
|
||||
for key in ("zz", "jfl"):
|
||||
seat = item.get(key) or {}
|
||||
wecom = str(seat.get("wecom_userid") or "").strip()
|
||||
if wecom:
|
||||
found.add(wecom)
|
||||
return found
|
||||
|
||||
|
||||
def _users_by_wecom(wecom_ids: set[str]) -> dict[str, User]:
|
||||
"""按企业微信 userid 索引系统用户。"""
|
||||
if not wecom_ids:
|
||||
return {}
|
||||
rows = db.session.query(User).filter(User.wecom_userid.in_(wecom_ids)).all()
|
||||
return {str(row.wecom_userid): row for row in rows if row.wecom_userid}
|
||||
|
||||
|
||||
def _users_by_job(job_nums: set[str]) -> dict[str, User]:
|
||||
"""用工号索引系统用户。"""
|
||||
if not job_nums:
|
||||
|
||||
@@ -0,0 +1,152 @@
|
||||
"""
|
||||
backend/app/services/equipment_acceptance/e8_group.py
|
||||
|
||||
用途:把 E8 验收单联表行收成与 E10 相同的快照草稿。
|
||||
依赖:e8_status、snapshot_rules、source_group。
|
||||
逻辑:同步服务在写库前调用。流程状态先翻译。人员 ID 仍是 E8 的 HrmResource.id。
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from datetime import datetime
|
||||
from typing import Any
|
||||
|
||||
from app.services.equipment_acceptance.e8_status import e8_flow_status
|
||||
from app.services.equipment_acceptance.snapshot_rules import (
|
||||
as_datetime,
|
||||
as_int,
|
||||
can_accept_from_oa,
|
||||
is_returned_from_oa,
|
||||
)
|
||||
from app.services.equipment_acceptance.source_group import (
|
||||
AcceptanceDraft,
|
||||
NodeDraft,
|
||||
OperatorDraft,
|
||||
)
|
||||
|
||||
_TERMINAL_FLOW = {3, 7}
|
||||
|
||||
|
||||
def group_e8_rows(rows: list[dict[str, Any]]) -> tuple[list[AcceptanceDraft], int]:
|
||||
"""
|
||||
按 requestid 合并 E8 联表行。
|
||||
|
||||
核心逻辑:没有 requestid 的行跳过。同一请求的未办人收成一张单。
|
||||
计时起点读 syddjssj。可以验收读 sfkys。来源标记为 e8。
|
||||
Args:
|
||||
rows: 查询别名组成的字典行。
|
||||
Returns:
|
||||
(草稿列表, 因缺少 requestid 而跳过的行数)。
|
||||
"""
|
||||
skipped = 0
|
||||
buckets: dict[int, list[dict[str, Any]]] = {}
|
||||
for row in rows:
|
||||
request_id = as_int(row.get("requestid"))
|
||||
if request_id is None:
|
||||
skipped += 1
|
||||
continue
|
||||
buckets.setdefault(request_id, []).append(row)
|
||||
return [_draft_from_rows(request_id, items) for request_id, items in buckets.items()], skipped
|
||||
|
||||
|
||||
def _draft_from_rows(request_id: int, items: list[dict[str, Any]]) -> AcceptanceDraft:
|
||||
"""同一流程的多行收成一条 E8 草稿。"""
|
||||
header = items[0]
|
||||
flow_status = e8_flow_status(header.get("currentnodetype"), header.get("currentstatus"))
|
||||
return AcceptanceDraft(
|
||||
oa_system="e8",
|
||||
request_id=request_id,
|
||||
acceptance_no=_text(header.get("ysddh")),
|
||||
purchase_order_no=_text(header.get("cgdh")),
|
||||
contract_no=_text(header.get("htbh")),
|
||||
flow_no=_text(header.get("flow_no")),
|
||||
request_title=_text(header.get("request_title")),
|
||||
request_created_at=_e8_created_at(header),
|
||||
timer_started_at=as_datetime(header.get("syddjssj")),
|
||||
can_accept=can_accept_from_oa(as_int(header.get("sfkys"))),
|
||||
cannot_accept_note=_text(header.get("ycsm")),
|
||||
is_returned=is_returned_from_oa(as_int(header.get("sfzfth"))),
|
||||
flow_status_raw=flow_status,
|
||||
finished_at=_finished_at(header, flow_status),
|
||||
request_match_count=1,
|
||||
nodes=_nodes(items),
|
||||
operators=_operators(items),
|
||||
owner_oa_id=as_int(header.get("sybmdd")),
|
||||
owner_name=_text(header.get("owner_name")),
|
||||
owner_job_num=_text(header.get("owner_job_num")),
|
||||
equip_oa_id=None,
|
||||
equip_name=None,
|
||||
equip_job_num=None,
|
||||
applicant_oa_id=as_int(header.get("creater")),
|
||||
applicant_name=_text(header.get("applicant_name")),
|
||||
applicant_job_num=_text(header.get("applicant_job_num")),
|
||||
)
|
||||
|
||||
|
||||
def _e8_created_at(header: dict[str, Any]) -> datetime | None:
|
||||
"""
|
||||
拼出 E8 流程创建时间。
|
||||
|
||||
核心逻辑:createdate 是日期,createtime 是时分秒,两边分开存。
|
||||
只有日期时按当天 0 点。都空则没有创建时间。
|
||||
"""
|
||||
day = _text(header.get("createdate"))
|
||||
clock = _text(header.get("createtime"))
|
||||
if day is None:
|
||||
return None
|
||||
if clock is None:
|
||||
return as_datetime(day)
|
||||
return as_datetime(f"{day} {clock}")
|
||||
|
||||
|
||||
def _finished_at(header: dict[str, Any], flow_status: int | None) -> datetime | None:
|
||||
"""归档或撤销时,用最后操作时间作为结束时间。进行中不写。"""
|
||||
if flow_status not in _TERMINAL_FLOW:
|
||||
return None
|
||||
parsed = as_datetime(header.get("lastoperatedate"))
|
||||
if parsed is not None:
|
||||
return parsed
|
||||
return None
|
||||
|
||||
|
||||
def _nodes(rows: list[dict[str, Any]]) -> list[NodeDraft]:
|
||||
"""当前节点只取 currentnodeid。没有节点 ID 时不造一行。"""
|
||||
found: dict[int, NodeDraft] = {}
|
||||
for row in rows:
|
||||
node_id = as_int(row.get("currentnodeid"))
|
||||
if node_id is None or node_id in found:
|
||||
continue
|
||||
found[node_id] = NodeDraft(
|
||||
node_id=node_id,
|
||||
node_name=_text(row.get("nodename")),
|
||||
node_type=None,
|
||||
)
|
||||
return list(found.values())
|
||||
|
||||
|
||||
def _operators(rows: list[dict[str, Any]]) -> list[OperatorDraft]:
|
||||
"""当前未办人。查询已限定 isremark=0,这里只按人和节点去重。"""
|
||||
found: dict[tuple[int, int], OperatorDraft] = {}
|
||||
for row in rows:
|
||||
node_id = as_int(row.get("currentnodeid"))
|
||||
user_id = as_int(row.get("userid"))
|
||||
if node_id is None or user_id is None:
|
||||
continue
|
||||
key = (node_id, user_id)
|
||||
if key in found:
|
||||
continue
|
||||
found[key] = OperatorDraft(
|
||||
node_id=node_id,
|
||||
user_id=user_id,
|
||||
handler_name=_text(row.get("handler_name")),
|
||||
handler_job_num=_text(row.get("handler_job_num")),
|
||||
)
|
||||
return list(found.values())
|
||||
|
||||
|
||||
def _text(value: Any) -> str | None:
|
||||
"""去空白;空串视为没有值。"""
|
||||
if value is None:
|
||||
return None
|
||||
text = str(value).strip()
|
||||
return text or None
|
||||
@@ -0,0 +1,71 @@
|
||||
"""
|
||||
backend/app/services/equipment_acceptance/e8_query.py
|
||||
|
||||
用途:组装 E8 验收单只读 SQL。
|
||||
依赖:无。不连接数据库。
|
||||
逻辑:e8_repository 执行本文件的语句。表名固定,不拼接外部字符串。
|
||||
不复用合同付款只取归档日的查询。不取 currentnodetype=3 的归档单,空节点类型仍取。
|
||||
流程编号取 lcbh,标题取 requestname。创建时间取 createdate 加 createtime。
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
|
||||
def build_e8_acceptance_sql() -> str:
|
||||
"""
|
||||
组装未归档的 E8 验收单查询。
|
||||
|
||||
核心逻辑:formtable_main_324.requestId 对 workflow_requestbase.requestid。
|
||||
当前节点用 currentnodeid,不用 lastnodeid。当前未办人是 isremark=0。
|
||||
currentnodetype=3 的归档单不取,空值仍取。申请人读 creater,不是 creator。
|
||||
流程编号读 lcbh,标题读 requestname。创建时间由 createdate 与 createtime 拼成。
|
||||
Returns:
|
||||
一条 SELECT。
|
||||
"""
|
||||
return """
|
||||
SELECT
|
||||
f.ysddh AS ysddh,
|
||||
f.cgdh AS cgdh,
|
||||
f.htbh AS htbh,
|
||||
f.lcbh AS flow_no,
|
||||
f.syddjssj AS syddjssj,
|
||||
f.sfzfth AS sfzfth,
|
||||
f.sfkys AS sfkys,
|
||||
f.ycsm AS ycsm,
|
||||
f.sybmdd AS sybmdd,
|
||||
w.requestid AS requestid,
|
||||
w.requestname AS request_title,
|
||||
w.createdate AS createdate,
|
||||
w.createtime AS createtime,
|
||||
LTRIM(RTRIM(CAST(w.currentnodetype AS nvarchar(10)))) AS currentnodetype,
|
||||
w.currentstatus AS currentstatus,
|
||||
w.currentnodeid AS currentnodeid,
|
||||
w.creater AS creater,
|
||||
w.lastoperatedate AS lastoperatedate,
|
||||
w.lastoperatetime AS lastoperatetime,
|
||||
n.nodename AS nodename,
|
||||
op.userid AS userid,
|
||||
owner.lastname AS owner_name,
|
||||
owner.workcode AS owner_job_num,
|
||||
applicant.lastname AS applicant_name,
|
||||
applicant.workcode AS applicant_job_num,
|
||||
handler.lastname AS handler_name,
|
||||
handler.workcode AS handler_job_num
|
||||
FROM formtable_main_324 AS f
|
||||
INNER JOIN workflow_requestbase AS w
|
||||
ON w.requestid = f.requestId
|
||||
LEFT JOIN workflow_nodebase AS n
|
||||
ON n.id = w.currentnodeid
|
||||
LEFT JOIN workflow_currentoperator AS op
|
||||
ON op.requestid = w.requestid
|
||||
AND op.nodeid = w.currentnodeid
|
||||
AND LTRIM(RTRIM(CAST(op.isremark AS nvarchar(10)))) = N'0'
|
||||
LEFT JOIN HrmResource AS owner
|
||||
ON owner.id = f.sybmdd
|
||||
LEFT JOIN HrmResource AS applicant
|
||||
ON applicant.id = w.creater
|
||||
LEFT JOIN HrmResource AS handler
|
||||
ON handler.id = op.userid
|
||||
WHERE w.currentnodetype IS NULL
|
||||
OR LTRIM(RTRIM(CAST(w.currentnodetype AS nvarchar(10)))) <> N'3'
|
||||
""".strip()
|
||||
@@ -0,0 +1,213 @@
|
||||
"""
|
||||
backend/app/services/equipment_acceptance/e8_repository.py
|
||||
|
||||
用途:只读拉取 E8 验收单,以及使用部门担当的直接主管和经副理。
|
||||
依赖:OASQLServerService、e8_query。不连接 E10,不把人员 ID 送进 eteams。
|
||||
逻辑:验收单一次联表。收件人再按 HrmResource.id 查部门和 Matrixtable_3。
|
||||
zz、jfl 就是企业微信 userid。矩阵不是一行时该部门失败。
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import logging
|
||||
from typing import Any
|
||||
|
||||
from app.core.errors import ServiceUnavailableError
|
||||
from app.services.equipment_acceptance.e8_query import build_e8_acceptance_sql
|
||||
from app.services.equipment_acceptance.snapshot_rules import as_int
|
||||
from app.services.integrations.oa.sqlserver import OASQLServerService
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def fetch_e8_acceptance_rows() -> list[dict[str, Any]]:
|
||||
"""
|
||||
从 E8 拉验收单联表结果。
|
||||
|
||||
核心逻辑:复用 OA_SQLSERVER_* 只读连接。失败不改走 E10。
|
||||
Returns:
|
||||
字段名为小写别名的字典行。
|
||||
|
||||
Raises:
|
||||
ServiceUnavailableError: 连接或查询失败。
|
||||
"""
|
||||
connection = _open()
|
||||
try:
|
||||
cursor = connection.cursor()
|
||||
cursor.execute(build_e8_acceptance_sql())
|
||||
columns = [str(col[0]).lower() for col in cursor.description]
|
||||
return [
|
||||
{columns[index]: raw[index] for index in range(len(columns))}
|
||||
for raw in cursor.fetchall()
|
||||
]
|
||||
except ServiceUnavailableError:
|
||||
raise
|
||||
except Exception as exc:
|
||||
_LOGGER.warning("equipment acceptance e8 sql failed error=%s", type(exc).__name__)
|
||||
raise ServiceUnavailableError(
|
||||
"查询 E8 设备验收数据失败",
|
||||
code="EQUIPMENT_ACCEPTANCE.OA_SQL_FAILED",
|
||||
) from exc
|
||||
finally:
|
||||
connection.close()
|
||||
|
||||
|
||||
def fetch_e8_alert_directory(
|
||||
person_ids: list[int],
|
||||
) -> tuple[dict[int, dict[str, Any]], dict[str, dict[str, Any]]]:
|
||||
"""
|
||||
按使用部门担当和申请人的 HrmResource.id 取工号,并按部门取直接主管、经副理。
|
||||
|
||||
核心逻辑:工号是 workcode。Matrixtable_3.bm 必须只命中一行,zz 是直接主管,jfl 是经副理。
|
||||
这两个 ID 同时是企业微信 userid。没有人员时不连库。
|
||||
Args:
|
||||
person_ids: HrmResource.id。禁止传入 E10 的 employee.ID。
|
||||
Returns:
|
||||
(人员字典, 部门 ID 到矩阵结果)。矩阵结果含 ok、zz、jfl。
|
||||
|
||||
Raises:
|
||||
ServiceUnavailableError: 连接或查询失败。
|
||||
"""
|
||||
ids = sorted({int(item) for item in person_ids if item is not None})
|
||||
if not ids:
|
||||
return {}, {}
|
||||
connection = _open()
|
||||
try:
|
||||
cursor = connection.cursor()
|
||||
people = _load_people(cursor, ids)
|
||||
departments = sorted({item["department_id"] for item in people.values() if item.get("department_id")})
|
||||
matrix = _load_matrix(cursor, departments)
|
||||
_fill_matrix_names(cursor, matrix)
|
||||
return people, matrix
|
||||
except ServiceUnavailableError:
|
||||
raise
|
||||
except Exception as exc:
|
||||
_LOGGER.warning("equipment acceptance e8 directory failed error=%s", type(exc).__name__)
|
||||
raise ServiceUnavailableError(
|
||||
"查询 E8 直接主管和经副理失败",
|
||||
code="EQUIPMENT_ACCEPTANCE.OA_SQL_FAILED",
|
||||
) from exc
|
||||
finally:
|
||||
connection.close()
|
||||
|
||||
|
||||
def _open():
|
||||
"""打开 E8 ecology 连接。异常收成业务错误,不把连接串写进日志。"""
|
||||
try:
|
||||
return OASQLServerService._connect()
|
||||
except Exception as exc:
|
||||
_LOGGER.warning("equipment acceptance e8 connect failed error=%s", type(exc).__name__)
|
||||
raise ServiceUnavailableError(
|
||||
"连接 E8 SQL Server 失败",
|
||||
code="EQUIPMENT_ACCEPTANCE.OA_SQL_FAILED",
|
||||
) from exc
|
||||
|
||||
|
||||
def _load_people(cursor: Any, person_ids: list[int]) -> dict[int, dict[str, Any]]:
|
||||
"""取出姓名、工号和部门。"""
|
||||
found: dict[int, dict[str, Any]] = {}
|
||||
for chunk in _chunks(person_ids):
|
||||
marks = ",".join("?" for _ in chunk)
|
||||
cursor.execute(
|
||||
f"""
|
||||
SELECT id, lastname, workcode, departmentid
|
||||
FROM HrmResource
|
||||
WHERE id IN ({marks})
|
||||
""",
|
||||
chunk,
|
||||
)
|
||||
for raw in cursor.fetchall():
|
||||
person_id = as_int(raw[0])
|
||||
if person_id is None:
|
||||
continue
|
||||
found[person_id] = {
|
||||
"oa_id": person_id,
|
||||
"name": _clean(raw[1]),
|
||||
"job_num": _clean(raw[2]),
|
||||
"department_id": _clean(raw[3]),
|
||||
}
|
||||
return found
|
||||
|
||||
|
||||
def _load_matrix(cursor: Any, department_ids: list[str]) -> dict[str, dict[str, Any]]:
|
||||
"""按部门取矩阵。不是正好一行就记失败,不挑其中一行。"""
|
||||
grouped: dict[str, list[tuple[Any, Any]]] = {}
|
||||
if not department_ids:
|
||||
return {}
|
||||
for chunk in _chunks(department_ids):
|
||||
marks = ",".join("?" for _ in chunk)
|
||||
params = [int(item) if str(item).isdigit() else item for item in chunk]
|
||||
cursor.execute(
|
||||
f"""
|
||||
SELECT bm, zz, jfl
|
||||
FROM Matrixtable_3
|
||||
WHERE bm IN ({marks})
|
||||
""",
|
||||
params,
|
||||
)
|
||||
for raw in cursor.fetchall():
|
||||
department_id = _clean(raw[0])
|
||||
if not department_id:
|
||||
continue
|
||||
grouped.setdefault(department_id, []).append((raw[1], raw[2]))
|
||||
found: dict[str, dict[str, Any]] = {}
|
||||
for department_id, rows in grouped.items():
|
||||
if len(rows) != 1:
|
||||
found[department_id] = {"ok": False, "zz": None, "jfl": None}
|
||||
continue
|
||||
zz_id = as_int(rows[0][0])
|
||||
jfl_id = as_int(rows[0][1])
|
||||
found[department_id] = {
|
||||
"ok": True,
|
||||
"zz": _seat(zz_id),
|
||||
"jfl": _seat(jfl_id),
|
||||
}
|
||||
return found
|
||||
|
||||
|
||||
def _fill_matrix_names(cursor: Any, matrix: dict[str, dict[str, Any]]) -> None:
|
||||
"""给直接主管和经副理补姓名。查不到姓名仍保留企微 userid。"""
|
||||
ids = sorted({
|
||||
seat["oa_id"]
|
||||
for item in matrix.values()
|
||||
if item.get("ok")
|
||||
for seat in (item.get("zz"), item.get("jfl"))
|
||||
if seat and seat.get("oa_id") is not None
|
||||
})
|
||||
if not ids:
|
||||
return
|
||||
names = _load_people(cursor, ids)
|
||||
for item in matrix.values():
|
||||
if not item.get("ok"):
|
||||
continue
|
||||
for key in ("zz", "jfl"):
|
||||
seat = item.get(key)
|
||||
if not seat:
|
||||
continue
|
||||
fact = names.get(seat["oa_id"]) or {}
|
||||
if fact.get("name"):
|
||||
seat["name"] = fact["name"]
|
||||
|
||||
|
||||
def _seat(person_id: int | None) -> dict[str, Any] | None:
|
||||
"""矩阵里的人员 ID 直接作为企业微信 userid。"""
|
||||
if person_id is None:
|
||||
return None
|
||||
return {
|
||||
"oa_id": person_id,
|
||||
"name": None,
|
||||
"wecom_userid": str(person_id),
|
||||
}
|
||||
|
||||
|
||||
def _chunks(values: list[Any], size: int = 400) -> list[list[Any]]:
|
||||
"""把 IN 列表拆开。"""
|
||||
return [values[index:index + size] for index in range(0, len(values), size)]
|
||||
|
||||
|
||||
def _clean(value: Any) -> str | None:
|
||||
"""去掉空白。"""
|
||||
if value is None:
|
||||
return None
|
||||
text = str(value).strip()
|
||||
return text or None
|
||||
@@ -0,0 +1,63 @@
|
||||
"""
|
||||
backend/app/services/equipment_acceptance/e8_status.py
|
||||
|
||||
用途:把 E8 流程状态收成与 E10 相同的 flow_status_raw。
|
||||
依赖:无。不读数据库。
|
||||
逻辑:同步分组在落库前调用。currentstatus 优先于 currentnodetype。
|
||||
E8 没有作废和强制结束,不写成 5 或 4。
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Any
|
||||
|
||||
# 与 E10 的审批中、归档、撤销对齐。暂停按 E10 的 flowstatus=7,同样停表。
|
||||
_APPROVING = 1
|
||||
_ARCHIVED = 3
|
||||
_REVOKED = 7
|
||||
_APPROVING_NODE_TYPES = {"0", "1", "2"}
|
||||
_PAUSE_OR_REVOKE = {0, 1}
|
||||
|
||||
|
||||
def e8_flow_status(currentnodetype: Any, currentstatus: Any) -> int | None:
|
||||
"""
|
||||
把 E8 的节点类型和暂停/撤销收成本地流程状态。
|
||||
|
||||
核心逻辑:currentstatus 为空才看 currentnodetype。0 暂停、1 撤销都写成 7。
|
||||
空、0、1 以外不写成审批中,返回空,调用方不把这张单放进进行中。
|
||||
Args:
|
||||
currentnodetype: workflow_requestbase.currentnodetype。0/1/2 审批中,3 归档。
|
||||
currentstatus: workflow_requestbase.currentstatus。空是正常,0 暂停,1 撤销。
|
||||
Returns:
|
||||
1、3 或 7。无法识别时为 None。
|
||||
"""
|
||||
status = _blank_to_none(currentstatus)
|
||||
if status is not None:
|
||||
code = _as_int(status)
|
||||
if code in _PAUSE_OR_REVOKE:
|
||||
return _REVOKED
|
||||
return None
|
||||
node_type = _blank_to_none(currentnodetype)
|
||||
if node_type in _APPROVING_NODE_TYPES:
|
||||
return _APPROVING
|
||||
if node_type == "3":
|
||||
return _ARCHIVED
|
||||
return None
|
||||
|
||||
|
||||
def _blank_to_none(value: Any) -> str | None:
|
||||
"""空白当成没有值。数字也收成去掉空白的文本。"""
|
||||
if value is None:
|
||||
return None
|
||||
text = str(value).strip()
|
||||
return text or None
|
||||
|
||||
|
||||
def _as_int(value: str) -> int | None:
|
||||
"""整数字符串收成 int。带小数或字母的不猜。"""
|
||||
try:
|
||||
if "." in value:
|
||||
return None
|
||||
return int(value)
|
||||
except ValueError:
|
||||
return None
|
||||
@@ -126,12 +126,12 @@ def _open_connection(settings: EquipmentAcceptanceSqlSettings):
|
||||
|
||||
def fetch_alert_directory(employee_ids: list[int]) -> tuple[dict[int, dict[str, Any]], dict[str, list[dict[str, Any]]]]:
|
||||
"""
|
||||
读取处理人的直接主管,并按部门查出经副理。
|
||||
读取使用部门担当的直接主管,并按部门查出经副理。
|
||||
|
||||
核心逻辑:主管在 employee.SUPERIOR。经副理不在这一列,按部门 ID 走 eteams 矩阵条件表。
|
||||
人员 ID 必须是整数。没有人员时不连库。
|
||||
人员 ID 必须是 E10 的 employee.ID。没有人员时不连库。
|
||||
Args:
|
||||
employee_ids: 当前处理人和申请人的 employee.ID。
|
||||
employee_ids: 使用部门担当和申请人的 employee.ID。禁止传入 E8 的 HrmResource.id。
|
||||
Returns:
|
||||
(人员字典, 部门 ID 到经副理列表)。人员字典的键是 employee.ID。
|
||||
|
||||
|
||||
@@ -4,7 +4,8 @@ backend/app/services/equipment_acceptance/query_sql.py
|
||||
用途:决定 E10 各表所在库,并组装只读联表 SQL。
|
||||
依赖:无 Flask。库名只允许字母、数字和下划线。
|
||||
逻辑:同步仓库调用。验收单用 FORM_DATA_ID 经 wfc_form_data 挂到流程实例。
|
||||
不读流程编号、第二合同编号、验收日期、optgroupid、batch_number、operate_log_id、isremark。无法验收说明读取 ycsm。字典库看不到时,流程表回退到 ecology10。
|
||||
不取 flowstatus=3 的归档单。flowstatus 为空仍取。
|
||||
流程编号读 requestmark,标题读 requestname,创建时间读 createdatetime。不读第二合同编号、验收日期、optgroupid、batch_number、operate_log_id、isremark。无法验收说明读取 ycsm。字典库看不到时,流程表回退到 ecology10。
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
@@ -68,8 +69,8 @@ def build_acceptance_sql(catalogs: AcceptanceCatalogs) -> str:
|
||||
组装验收单、人员、流程实例、当前节点、节点定义、操作人的只读 SQL。
|
||||
|
||||
核心逻辑:用 FORM_DATA_ID 对齐 wfc_form_data.dataid,再按 requestid 挂到流程实例。
|
||||
不查询流程编号、第二合同编号、验收日期和 isremark。当前节点和操作人按 requestid + nodeid 对齐,
|
||||
delete_type 只取 0。当前处理人就是这些 userid。
|
||||
流程编号取 requestmark,标题取 requestname,创建时间取 createdatetime。不查询第二合同编号、验收日期和 isremark。当前节点和操作人按 requestid + nodeid 对齐,
|
||||
delete_type 只取 0。当前处理人就是这些 userid。归档(flowstatus=3)不取,空状态仍取。
|
||||
Args:
|
||||
catalogs: 已解析的库名。
|
||||
Returns:
|
||||
@@ -104,6 +105,9 @@ SELECT
|
||||
applicant.USERNAME AS applicant_name,
|
||||
applicant.JOB_NUM AS applicant_job_num,
|
||||
r.requestid,
|
||||
r.requestmark AS flow_no,
|
||||
r.requestname AS request_title,
|
||||
r.createdatetime,
|
||||
r.flowstatus,
|
||||
r.finishdatetime,
|
||||
c.nodeid,
|
||||
@@ -135,6 +139,7 @@ LEFT JOIN {operate} AS op
|
||||
LEFT JOIN {employee} AS handler ON handler.ID = op.userid
|
||||
WHERE ISNULL(f.delete_type, 0) = 0
|
||||
AND r.requestid IS NOT NULL
|
||||
AND (r.flowstatus IS NULL OR r.flowstatus <> 3)
|
||||
""".strip()
|
||||
|
||||
|
||||
|
||||
@@ -179,7 +179,7 @@ def classify_monitor_status(
|
||||
按已确认规则给出监控状态。入参已是标准 0=否、1=是。
|
||||
|
||||
核心逻辑:退回、无法验收、作废、归档、强制结束、撤销优先于未开始。
|
||||
审批中、可以验收、未退回、已有计时起点才是计时中。
|
||||
审批中、未退回、已有计时起点,且可以验收不是明确为否时计时。空和是都监控。
|
||||
flowstatus 为 7、8、99、-99 时记为已撤销,有没有计时起点都不再提醒。
|
||||
Args:
|
||||
can_accept: 本地是否可以正常验收。0 否,1 是,空为未标明。
|
||||
@@ -204,8 +204,8 @@ def classify_monitor_status(
|
||||
return STOPPED_REVOKED
|
||||
if not timer_started:
|
||||
return NOT_STARTED
|
||||
# [STEP 2] 只有审批中、可以验收、未退回时继续计时
|
||||
if can_accept == 1 and flow_status == _FLOW_APPROVING and is_returned == 0:
|
||||
# [STEP 2] 可以验收只有明确为否才停表,空和是都继续计时。0、1、空以外不猜。
|
||||
if can_accept in (1, None) and flow_status == _FLOW_APPROVING and is_returned == 0:
|
||||
return WATCHING
|
||||
return EXCLUDED
|
||||
|
||||
|
||||
@@ -42,12 +42,16 @@ class NodeDraft:
|
||||
|
||||
@dataclass
|
||||
class AcceptanceDraft:
|
||||
"""一张验收单在一次同步中的快照草稿。不包含流程编号、第二合同编号和验收日期。"""
|
||||
"""一张验收单在一次同步中的快照草稿。含流程编号、标题和创建时间。不含第二合同编号和验收日期。"""
|
||||
|
||||
oa_system: str
|
||||
request_id: int
|
||||
acceptance_no: str | None
|
||||
purchase_order_no: str | None
|
||||
contract_no: str | None
|
||||
flow_no: str | None
|
||||
request_title: str | None
|
||||
request_created_at: datetime | None
|
||||
timer_started_at: datetime | None
|
||||
can_accept: int | None
|
||||
cannot_accept_note: str | None
|
||||
@@ -73,7 +77,7 @@ def group_acceptance_rows(rows: list[dict[str, Any]]) -> tuple[list[AcceptanceDr
|
||||
按流程实例 requestid 合并联表结果。
|
||||
|
||||
核心逻辑:没有 requestid 的行跳过。同一请求上的节点和操作人收成一张单。
|
||||
不读取流程编号、第二合同编号和验收日期。
|
||||
流程编号和标题随行写入。不读取第二合同编号和验收日期。
|
||||
Args:
|
||||
rows: 查询别名组成的字典行。
|
||||
Returns:
|
||||
@@ -94,10 +98,14 @@ def _draft_from_rows(request_id: int, items: list[dict[str, Any]]) -> Acceptance
|
||||
"""同一流程实例的多行收成一条草稿。"""
|
||||
header = items[0]
|
||||
return AcceptanceDraft(
|
||||
oa_system="e10",
|
||||
request_id=request_id,
|
||||
acceptance_no=_text(header.get("ysddh")),
|
||||
purchase_order_no=_text(header.get("cgdh")),
|
||||
contract_no=_text(header.get("htbh")),
|
||||
flow_no=_text(header.get("flow_no")),
|
||||
request_title=_text(header.get("request_title")),
|
||||
request_created_at=as_datetime(header.get("createdatetime")),
|
||||
timer_started_at=as_datetime(header.get("sbsyrjssj")),
|
||||
can_accept=can_accept_from_oa(as_int(header.get("sfkyzcys"))),
|
||||
cannot_accept_note=_text(header.get("ycsm")),
|
||||
|
||||
@@ -1,19 +1,24 @@
|
||||
"""
|
||||
backend/app/services/equipment_acceptance/sync_service.py
|
||||
|
||||
用途:把 E10 验收单快照写入本地表,并提供管理员查询。
|
||||
依赖:extensions.db、equipment_acceptance 模型、snapshot_rules、source_group、oa_repository。
|
||||
逻辑:手动同步 upsert 主表并替换子表。列表按原型分组过滤,并附带全部单据的汇总。
|
||||
停表时取消该单未发送的预警。操作人不保存 isremark。
|
||||
用途:把 E10 和 E8 验收单快照写入本地表,并提供管理员查询。
|
||||
依赖:extensions.db、sqlalchemy.or_、equipment_acceptance 模型、snapshot_rules、source_group、e8_group、oa_repository、e8_repository。
|
||||
逻辑:两个来源分开拉取。一边失败不改另一边的快照,也不把失败来源标成消失。
|
||||
只保留未归档单据。归档单不写入;该来源本次结果里没有的本地单删除,并取消未发送预警。
|
||||
主表按 oa_system + request_id 更新,并写入流程编号和标题。子表整批替换。停表时取消未发送预警。
|
||||
列表查询由 api/equipment_acceptance 调用。单号关键字同时匹配流程编号、验收单号和采购单号,再与申请人取交集。
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import logging
|
||||
from collections import Counter
|
||||
from datetime import datetime
|
||||
from typing import Any
|
||||
from zoneinfo import ZoneInfo
|
||||
|
||||
from sqlalchemy import or_
|
||||
|
||||
from app.core.errors import NotFoundError, ValidationError
|
||||
from app.core.response import utc_iso
|
||||
from app.extensions import db
|
||||
@@ -25,12 +30,15 @@ from app.models.equipment_acceptance import (
|
||||
from app.services.equipment_acceptance.config_service import first_reminder_day
|
||||
from app.services.equipment_acceptance.snapshot_rules import (
|
||||
MONITOR_STATUSES,
|
||||
STOPPED_ARCHIVED,
|
||||
classify_monitor_status,
|
||||
dwell_days,
|
||||
)
|
||||
from app.services.equipment_acceptance.source_group import AcceptanceDraft, group_acceptance_rows
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
_SHANGHAI = ZoneInfo("Asia/Shanghai")
|
||||
_ARCHIVED_FLOW = 3
|
||||
_LEDGER_FOCUSES = ("watching", "overdue", "stopped", "not_started")
|
||||
_STOPPED_STATUSES = (
|
||||
"stopped_returned",
|
||||
@@ -42,34 +50,107 @@ _STOPPED_STATUSES = (
|
||||
)
|
||||
|
||||
|
||||
def sync_acceptance_snapshots(rows: list[dict[str, Any]] | None = None) -> dict[str, Any]:
|
||||
def sync_acceptance_snapshots(
|
||||
rows: list[dict[str, Any]] | None = None,
|
||||
*,
|
||||
e8_rows: list[dict[str, Any]] | None = None,
|
||||
) -> dict[str, Any]:
|
||||
"""
|
||||
同步验收单快照。
|
||||
同步 E10 和 E8 验收单快照。
|
||||
|
||||
核心逻辑:未传入行时自己读 E10。按流程实例 request_id 更新主表,子表整批替换。
|
||||
本次查询里消失的单据保留上次内容,只把 present_in_source 标成否。
|
||||
核心逻辑:未传入行时分别读两个来源。一边查询失败只跳过这一边,不把已有快照标成消失。
|
||||
只保留未归档单据。该来源本次没返回的本地单删掉。只传入 rows 时只同步 E10,方便既有测试注入联表行。
|
||||
Args:
|
||||
rows: 测试或调用方已经取好的联表行。None 时访问 E10。
|
||||
rows: 已取好的 E10 联表行。None 时访问 E10。
|
||||
e8_rows: 已取好的 E8 联表行。与 rows 同时为 None 时才访问 E8。
|
||||
Returns:
|
||||
本次写入条数、跳过条数、停表取消的未发送条数,以及各监控状态计数。
|
||||
两边合计的写入、跳过、消失和取消条数,以及 e10、e8 各自的结果。
|
||||
"""
|
||||
if rows is None:
|
||||
from app.services.equipment_acceptance.oa_repository import fetch_acceptance_rows
|
||||
|
||||
rows = fetch_acceptance_rows()
|
||||
drafts, skipped = group_acceptance_rows(rows)
|
||||
fetch_live = rows is None and e8_rows is None
|
||||
e10_rows, e10_ok, e10_error = _source_rows("e10", rows, fetch_live)
|
||||
e8_input, e8_ok, e8_error = _source_rows("e8", e8_rows, fetch_live)
|
||||
as_of = datetime.now(_SHANGHAI).date()
|
||||
e10_result = _apply_source("e10", e10_rows, e10_ok, e10_error, as_of, group_acceptance_rows)
|
||||
from app.services.equipment_acceptance.e8_group import group_e8_rows
|
||||
|
||||
e8_result = _apply_source("e8", e8_input, e8_ok, e8_error, as_of, group_e8_rows)
|
||||
db.session.commit()
|
||||
cancelled = e10_result["cancelled"] + e8_result["cancelled"]
|
||||
counts: Counter[str] = Counter(e10_result["by_status"])
|
||||
counts.update(e8_result["by_status"])
|
||||
return {
|
||||
"upserted": e10_result["upserted"] + e8_result["upserted"],
|
||||
"skipped_without_request_id": (
|
||||
e10_result["skipped_without_request_id"] + e8_result["skipped_without_request_id"]
|
||||
),
|
||||
"absent": e10_result["absent"] + e8_result["absent"],
|
||||
"cancelled": cancelled,
|
||||
"by_status": dict(counts),
|
||||
"e10": e10_result,
|
||||
"e8": e8_result,
|
||||
}
|
||||
|
||||
|
||||
def _source_rows(
|
||||
source: str,
|
||||
injected: list[dict[str, Any]] | None,
|
||||
fetch_live: bool,
|
||||
) -> tuple[list[dict[str, Any]] | None, bool, str | None]:
|
||||
"""取一个来源的行。注入的行视为成功。实时查询失败时不标消失。"""
|
||||
if injected is not None:
|
||||
return injected, True, None
|
||||
if not fetch_live:
|
||||
return None, False, None
|
||||
try:
|
||||
if source == "e10":
|
||||
from app.services.equipment_acceptance.oa_repository import fetch_acceptance_rows
|
||||
|
||||
return fetch_acceptance_rows(), True, None
|
||||
from app.services.equipment_acceptance.e8_repository import fetch_e8_acceptance_rows
|
||||
|
||||
return fetch_e8_acceptance_rows(), True, None
|
||||
except Exception as exc:
|
||||
_LOGGER.warning("equipment acceptance %s sync skipped error=%s", source, type(exc).__name__)
|
||||
return None, False, type(exc).__name__
|
||||
|
||||
|
||||
def _apply_source(
|
||||
source: str,
|
||||
rows: list[dict[str, Any]] | None,
|
||||
ok: bool,
|
||||
error: str | None,
|
||||
as_of,
|
||||
grouper,
|
||||
) -> dict[str, Any]:
|
||||
"""把一个来源的未归档草稿写入。该来源这次没返回的本地单删除。"""
|
||||
if not ok or rows is None:
|
||||
return {
|
||||
"ok": False,
|
||||
"error": error,
|
||||
"upserted": 0,
|
||||
"skipped_without_request_id": 0,
|
||||
"absent": 0,
|
||||
"cancelled": 0,
|
||||
"by_status": {},
|
||||
}
|
||||
drafts, skipped = grouper(rows)
|
||||
counts: Counter[str] = Counter()
|
||||
request_ids: list[int] = []
|
||||
cancelled = 0
|
||||
for draft in drafts:
|
||||
# [STEP] 归档单不落本地。查询已排除;这里再挡一层,避免注入行把归档单写回来。
|
||||
if draft.flow_status_raw == _ARCHIVED_FLOW:
|
||||
continue
|
||||
draft.oa_system = source
|
||||
order, cancelled_now = _upsert_order(draft, as_of=as_of)
|
||||
request_ids.append(order.request_id)
|
||||
counts[order.monitor_status] += 1
|
||||
cancelled += cancelled_now
|
||||
absent = _mark_absent(request_ids)
|
||||
db.session.commit()
|
||||
absent, cancelled_missing = _drop_missing(request_ids, source)
|
||||
cancelled += cancelled_missing
|
||||
return {
|
||||
"ok": True,
|
||||
"error": None,
|
||||
"upserted": len(drafts),
|
||||
"skipped_without_request_id": skipped,
|
||||
"absent": absent,
|
||||
@@ -84,17 +165,23 @@ def list_acceptance_orders(
|
||||
focus: str | None,
|
||||
page: int,
|
||||
page_size: int,
|
||||
keyword: str | None = None,
|
||||
applicant: str | None = None,
|
||||
) -> dict[str, Any]:
|
||||
"""
|
||||
分页列出本地快照。
|
||||
|
||||
核心逻辑:focus 按原型的全部、进行中、已逾期、不再提醒、未开始过滤。
|
||||
已逾期是计时中且签核天数超过第 1 档。汇总数字始终看全部单据。
|
||||
核心逻辑:focus 按全部、进行中、已逾期、不再提醒、未开始过滤。
|
||||
keyword 在流程编号、验收单号、采购单号里任一包含即命中,再与申请人姓名取交集。
|
||||
已归档不列出。已逾期是计时中且签核天数超过第 1 档。
|
||||
汇总不看当前状态分组,但跟着单号关键字和申请人走,也不计归档。
|
||||
Args:
|
||||
monitor_status: 可选的单个监控状态代码。与 focus 同时传时以 focus 为准。
|
||||
focus: watching、overdue、stopped、not_started 或空。
|
||||
page: 从 1 开始。
|
||||
page_size: 每页条数,上限 100。
|
||||
keyword: 流程编号、验收单号或采购单号的包含匹配。空白表示不筛。
|
||||
applicant: 申请人姓名的包含匹配。空白表示不筛。
|
||||
Returns:
|
||||
items、total、page、page_size、summary。
|
||||
|
||||
@@ -106,7 +193,11 @@ def list_acceptance_orders(
|
||||
reminder_day = first_reminder_day()
|
||||
page = max(1, page)
|
||||
page_size = min(100, max(1, page_size))
|
||||
query = db.session.query(EquipmentAcceptanceOrder)
|
||||
query = _apply_search(
|
||||
_without_archived(db.session.query(EquipmentAcceptanceOrder)),
|
||||
keyword=keyword,
|
||||
applicant=applicant,
|
||||
)
|
||||
if ledger_focus:
|
||||
query = _apply_focus(query, ledger_focus, reminder_day)
|
||||
elif status:
|
||||
@@ -131,7 +222,7 @@ def list_acceptance_orders(
|
||||
"page": page,
|
||||
"page_size": page_size,
|
||||
"pages": pages,
|
||||
"summary": _ledger_summary(reminder_day),
|
||||
"summary": _ledger_summary(reminder_day, keyword=keyword, applicant=applicant),
|
||||
}
|
||||
|
||||
|
||||
@@ -160,20 +251,25 @@ def get_acceptance_order(order_id: int) -> dict[str, Any]:
|
||||
|
||||
def _upsert_order(draft: AcceptanceDraft, *, as_of) -> tuple[EquipmentAcceptanceOrder, int]:
|
||||
"""
|
||||
按流程实例 request_id 更新主表,并替换该单的节点和操作人。
|
||||
按来源和流程实例更新主表,并替换该单的节点和操作人。
|
||||
|
||||
核心逻辑:不再计时的单据顺手取消未发送预警。已发送的记录不动。
|
||||
E10 与 E8 的 request_id 可以相同,必须连 oa_system 一起查。
|
||||
Returns:
|
||||
更新后的验收单,以及本次改成已取消的发送记录条数。
|
||||
"""
|
||||
order = (
|
||||
db.session.query(EquipmentAcceptanceOrder)
|
||||
.filter(EquipmentAcceptanceOrder.request_id == draft.request_id)
|
||||
.filter(
|
||||
EquipmentAcceptanceOrder.oa_system == draft.oa_system,
|
||||
EquipmentAcceptanceOrder.request_id == draft.request_id,
|
||||
)
|
||||
.one_or_none()
|
||||
)
|
||||
now = datetime.utcnow()
|
||||
if order is None:
|
||||
order = EquipmentAcceptanceOrder(
|
||||
oa_system=draft.oa_system,
|
||||
request_id=draft.request_id,
|
||||
monitor_status="excluded",
|
||||
synced_at=now,
|
||||
@@ -185,6 +281,9 @@ def _upsert_order(draft: AcceptanceDraft, *, as_of) -> tuple[EquipmentAcceptance
|
||||
order.acceptance_no = draft.acceptance_no
|
||||
order.purchase_order_no = draft.purchase_order_no
|
||||
order.contract_no = draft.contract_no
|
||||
order.flow_no = draft.flow_no
|
||||
order.request_title = draft.request_title
|
||||
order.request_created_at = draft.request_created_at
|
||||
order.timer_started_at = draft.timer_started_at
|
||||
order.can_accept = draft.can_accept
|
||||
order.cannot_accept_note = draft.cannot_accept_note
|
||||
@@ -254,12 +353,45 @@ def _upsert_order(draft: AcceptanceDraft, *, as_of) -> tuple[EquipmentAcceptance
|
||||
return order, cancelled
|
||||
|
||||
|
||||
def _mark_absent(request_ids: list[int]) -> int:
|
||||
"""把这次没拉到的单据标成源里不存在。"""
|
||||
query = db.session.query(EquipmentAcceptanceOrder).filter(EquipmentAcceptanceOrder.present_in_source.is_(True))
|
||||
def _drop_missing(request_ids: list[int], oa_system: str) -> tuple[int, int]:
|
||||
"""
|
||||
删除这个来源里本次未归档结果没有的本地单。
|
||||
|
||||
核心逻辑:查询已不含归档。本地还在、结果里没有的单,视为已归档或已从 OA 消失。
|
||||
先取消未发送预警,再删主表。节点和操作人随外键级联删除。已发送记录保留,只解开验收单外键。
|
||||
不改另一个来源。查询失败的来源不会进到这里。
|
||||
Returns:
|
||||
删除张数,以及取消的未发送条数。
|
||||
"""
|
||||
query = db.session.query(EquipmentAcceptanceOrder).filter(EquipmentAcceptanceOrder.oa_system == oa_system)
|
||||
if request_ids:
|
||||
query = query.filter(EquipmentAcceptanceOrder.request_id.notin_(request_ids))
|
||||
return query.update({EquipmentAcceptanceOrder.present_in_source: False}, synchronize_session=False)
|
||||
gone = query.all()
|
||||
if not gone:
|
||||
return 0, 0
|
||||
from app.services.equipment_acceptance.alert_service import cancel_unsent
|
||||
|
||||
cancelled = 0
|
||||
for order in gone:
|
||||
cancelled += cancel_unsent(order.id)
|
||||
db.session.delete(order)
|
||||
return len(gone), cancelled
|
||||
|
||||
|
||||
def _without_archived(query):
|
||||
"""
|
||||
列表和汇总都不展示已归档。
|
||||
|
||||
核心逻辑:状态已是归档的不显示。流程原值已是 3 的也不显示,
|
||||
避免退回或无法验收优先落成别的状态后,归档单仍留在列表里。
|
||||
"""
|
||||
return query.filter(
|
||||
EquipmentAcceptanceOrder.monitor_status != STOPPED_ARCHIVED,
|
||||
or_(
|
||||
EquipmentAcceptanceOrder.flow_status_raw.is_(None),
|
||||
EquipmentAcceptanceOrder.flow_status_raw != _ARCHIVED_FLOW,
|
||||
),
|
||||
)
|
||||
|
||||
|
||||
def _clean_focus(focus: str | None) -> str | None:
|
||||
@@ -290,9 +422,65 @@ def _apply_focus(query, focus: str, reminder_day: int):
|
||||
)
|
||||
|
||||
|
||||
def _ledger_summary(reminder_day: int) -> dict[str, int]:
|
||||
"""统计全部单据的进行中、已逾期、不再提醒、未开始,不受当前筛选影响。"""
|
||||
base = db.session.query(EquipmentAcceptanceOrder)
|
||||
def _clean_search(value: str | None) -> str | None:
|
||||
"""去掉首尾空白。空白视为不筛选。过长时只保留前 100 字,避免把整段说明送进 LIKE。"""
|
||||
text = str(value or "").strip()
|
||||
if not text:
|
||||
return None
|
||||
return text[:100]
|
||||
|
||||
|
||||
def _contains_pattern(text: str) -> str:
|
||||
"""
|
||||
把用户输入收成包含匹配,并把 LIKE 通配符当成普通字符。
|
||||
|
||||
核心逻辑:% 和 _ 要能搜出单号里的原字符,不能变成任意匹配。
|
||||
|
||||
Args:
|
||||
text: 已经去掉空白的搜索词。
|
||||
|
||||
Returns:
|
||||
带前后百分号、且转义过的模式。
|
||||
"""
|
||||
escaped = text.replace("\\", "\\\\").replace("%", "\\%").replace("_", "\\_")
|
||||
return f"%{escaped}%"
|
||||
|
||||
|
||||
def _apply_search(query, *, keyword: str | None, applicant: str | None):
|
||||
"""
|
||||
按单号关键字和申请人收窄查询。
|
||||
|
||||
核心逻辑:关键字在流程编号、验收单号、采购单号三者取并集;申请人再与这个结果取交集。
|
||||
比较不区分大小写。空值不加入条件。
|
||||
"""
|
||||
number = _clean_search(keyword)
|
||||
if number:
|
||||
pattern = _contains_pattern(number)
|
||||
query = query.filter(or_(
|
||||
EquipmentAcceptanceOrder.flow_no.ilike(pattern, escape="\\"),
|
||||
EquipmentAcceptanceOrder.acceptance_no.ilike(pattern, escape="\\"),
|
||||
EquipmentAcceptanceOrder.purchase_order_no.ilike(pattern, escape="\\"),
|
||||
))
|
||||
person = _clean_search(applicant)
|
||||
if person:
|
||||
query = query.filter(
|
||||
EquipmentAcceptanceOrder.applicant_name.ilike(_contains_pattern(person), escape="\\"),
|
||||
)
|
||||
return query
|
||||
|
||||
|
||||
def _ledger_summary(
|
||||
reminder_day: int,
|
||||
*,
|
||||
keyword: str | None = None,
|
||||
applicant: str | None = None,
|
||||
) -> dict[str, int]:
|
||||
"""统计未归档单据的进行中、已逾期、不再提醒、未开始。不看状态分组,但跟着单号和申请人走。"""
|
||||
base = _apply_search(
|
||||
_without_archived(db.session.query(EquipmentAcceptanceOrder)),
|
||||
keyword=keyword,
|
||||
applicant=applicant,
|
||||
)
|
||||
return {
|
||||
"watching": base.filter(EquipmentAcceptanceOrder.monitor_status == "watching").count(),
|
||||
"overdue": base.filter(
|
||||
@@ -359,9 +547,13 @@ def _order_payload(
|
||||
"""把快照收成 API 数据。人员主键用字符串,避免长整型在前端丢精度。overdue 只标记计时中且超过第 1 档的单据。"""
|
||||
payload: dict[str, Any] = {
|
||||
"id": order.id,
|
||||
"oa_system": order.oa_system,
|
||||
"acceptance_no": order.acceptance_no,
|
||||
"purchase_order_no": order.purchase_order_no,
|
||||
"contract_no": order.contract_no,
|
||||
"flow_no": order.flow_no,
|
||||
"request_title": order.request_title,
|
||||
"request_created_at": utc_iso(order.request_created_at),
|
||||
"timer_started_at": utc_iso(order.timer_started_at),
|
||||
"dwell_days": order.dwell_days,
|
||||
"can_accept": order.can_accept,
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
"""设备验收快照增加流程编号、标题和创建时间。
|
||||
|
||||
Revision ID: ea1b2c3d4e5f
|
||||
Revises: ea9d1e2f3a4b
|
||||
Create Date: 2026-10-26 19:20:00.000000
|
||||
|
||||
用途:equipment_acceptance_orders 增加 flow_no、request_title、request_created_at。
|
||||
依赖:ea9d1e2f3a4b 已加上 oa_system。不改合同付款表。
|
||||
逻辑:三列可空。已有行留空,下次同步按来源回填。创建时间不是本地行的 created_at。
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
revision = "ea1b2c3d4e5f"
|
||||
down_revision = "ea9d1e2f3a4b"
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
"""加上流程编号、标题和创建时间。已有单据留空,等下一次同步写入。"""
|
||||
op.add_column(
|
||||
"equipment_acceptance_orders",
|
||||
sa.Column("flow_no", sa.String(length=1000), nullable=True),
|
||||
)
|
||||
op.add_column(
|
||||
"equipment_acceptance_orders",
|
||||
sa.Column("request_title", sa.String(length=1000), nullable=True),
|
||||
)
|
||||
op.add_column(
|
||||
"equipment_acceptance_orders",
|
||||
sa.Column("request_created_at", sa.DateTime(), nullable=True),
|
||||
)
|
||||
|
||||
|
||||
def downgrade():
|
||||
"""去掉流程编号、标题和创建时间。"""
|
||||
op.drop_column("equipment_acceptance_orders", "request_created_at")
|
||||
op.drop_column("equipment_acceptance_orders", "request_title")
|
||||
op.drop_column("equipment_acceptance_orders", "flow_no")
|
||||
@@ -0,0 +1,51 @@
|
||||
"""设备验收快照增加来源,E10 与 E8 的流程号分开。
|
||||
|
||||
Revision ID: ea9d1e2f3a4b
|
||||
Revises: b51c9e4a7d30, tt21c8d9e0f1a2
|
||||
Create Date: 2026-10-26 16:20:00.000000
|
||||
|
||||
用途:equipment_acceptance_orders 增加 oa_system,唯一约束改为 (oa_system, request_id)。
|
||||
依赖:equipment_acceptance_orders 已存在。不改合同付款表。
|
||||
逻辑:已有行回填 e10。E8 的 request_id 可以与 E10 相同,不能再共用单列唯一。
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
revision = "ea9d1e2f3a4b"
|
||||
down_revision = ("b51c9e4a7d30", "tt21c8d9e0f1a2")
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
"""加上来源列,并把唯一约束从 request_id 改成来源加流程号。"""
|
||||
op.add_column(
|
||||
"equipment_acceptance_orders",
|
||||
sa.Column("oa_system", sa.String(length=8), nullable=False, server_default="e10"),
|
||||
)
|
||||
op.drop_constraint(
|
||||
"uq_equipment_acceptance_orders_request_id",
|
||||
"equipment_acceptance_orders",
|
||||
type_="unique",
|
||||
)
|
||||
op.create_unique_constraint(
|
||||
"uq_equipment_acceptance_orders_oa_request",
|
||||
"equipment_acceptance_orders",
|
||||
["oa_system", "request_id"],
|
||||
)
|
||||
|
||||
|
||||
def downgrade():
|
||||
"""去掉来源列,恢复只按 request_id 唯一。E8 行若与 E10 撞号,降级会失败。"""
|
||||
op.drop_constraint(
|
||||
"uq_equipment_acceptance_orders_oa_request",
|
||||
"equipment_acceptance_orders",
|
||||
type_="unique",
|
||||
)
|
||||
op.create_unique_constraint(
|
||||
"uq_equipment_acceptance_orders_request_id",
|
||||
"equipment_acceptance_orders",
|
||||
["request_id"],
|
||||
)
|
||||
op.drop_column("equipment_acceptance_orders", "oa_system")
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
"""合并设备验收流程字段与复核行决策码两条 Alembic 头。
|
||||
|
||||
Revision ID: mh24f5a6b7c8
|
||||
Revises: ea1b2c3d4e5f, s20a1b2c3d4e
|
||||
Create Date: 2026-10-28 10:55:00.000000
|
||||
|
||||
用途:将 ``ea1b2c3d4e5f``(设备验收流程编号、标题与来源)与
|
||||
``s20a1b2c3d4e``(复核行决策码改名)收成单一升级路径。
|
||||
依赖:``ea1b2c3d4e5f``、``s20a1b2c3d4e``。
|
||||
逻辑:不修改业务表,只声明两条已完成迁移线在此收敛。
|
||||
"""
|
||||
|
||||
from alembic import op # noqa: F401 - Alembic migration module contract
|
||||
|
||||
|
||||
revision = "mh24f5a6b7c8"
|
||||
down_revision = ("ea1b2c3d4e5f", "s20a1b2c3d4e")
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
"""合并设备验收 head 与复核行决策码 head,不执行数据库结构变更。"""
|
||||
pass
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
"""撤销合并节点;不会回滚两个父分支的业务变更。"""
|
||||
pass
|
||||
@@ -0,0 +1,155 @@
|
||||
"""
|
||||
backend/tests/test_equipment_acceptance_e8.py
|
||||
|
||||
用途:E8 状态翻译、分组、查询语句,以及按使用部门担当组装收件人。
|
||||
依赖:e8_status、e8_group、e8_query、alert_service._drafts。不连接 OA,不启动 Flask。
|
||||
逻辑:暂停和撤销都停表。可以验收按 0=是翻转。第 1 档主送使用部门担当。
|
||||
"""
|
||||
|
||||
from datetime import datetime
|
||||
from types import SimpleNamespace
|
||||
|
||||
import pytest
|
||||
|
||||
pytestmark = pytest.mark.pure_unit
|
||||
|
||||
from app.services.equipment_acceptance.alert_service import _drafts
|
||||
from app.services.equipment_acceptance.e8_group import group_e8_rows
|
||||
from app.services.equipment_acceptance.e8_query import build_e8_acceptance_sql
|
||||
from app.services.equipment_acceptance.e8_status import e8_flow_status
|
||||
from app.services.equipment_acceptance.snapshot_rules import EXCLUDED, classify_monitor_status
|
||||
|
||||
|
||||
def test_e8_null_status_follows_node_type_and_pause_stops():
|
||||
"""空的 currentstatus 看节点类型。暂停和撤销都收成 7。别的值不收成审批中。"""
|
||||
assert e8_flow_status("1", None) == 1
|
||||
assert e8_flow_status(" 3 ", "") == 3
|
||||
assert e8_flow_status("1", 0) == 7
|
||||
assert e8_flow_status("1", 1) == 7
|
||||
assert e8_flow_status("1", 9) is None
|
||||
|
||||
|
||||
def test_unknown_e8_status_is_not_watching():
|
||||
"""认不出的流程状态留空后,有计时起点也不进进行中。"""
|
||||
assert classify_monitor_status(
|
||||
can_accept=1, is_returned=0, flow_status=None, timer_started=True
|
||||
) == EXCLUDED
|
||||
|
||||
|
||||
def test_e8_rows_group_owner_and_pending_handler():
|
||||
"""计时读 syddjssj,可以验收读 sfkys。当前未办人只留查询给出的 userid。"""
|
||||
drafts, skipped = group_e8_rows([
|
||||
{
|
||||
"requestid": 88,
|
||||
"ysddh": "YS-E8",
|
||||
"cgdh": "CG-1",
|
||||
"htbh": "HT-1",
|
||||
"flow_no": "LC-1",
|
||||
"request_title": "设备验收",
|
||||
"createdate": "2026-10-26",
|
||||
"createtime": "15:46:04",
|
||||
"syddjssj": "2026-08-01",
|
||||
"sfkys": 0,
|
||||
"sfzfth": None,
|
||||
"ycsm": "",
|
||||
"sybmdd": 15,
|
||||
"owner_name": "吴敏",
|
||||
"owner_job_num": "10086",
|
||||
"creater": 22,
|
||||
"applicant_name": "赵琴",
|
||||
"applicant_job_num": "20001",
|
||||
"currentnodetype": "1",
|
||||
"currentstatus": None,
|
||||
"currentnodeid": 6,
|
||||
"nodename": "使用部门担当",
|
||||
"userid": 15,
|
||||
"handler_name": "吴敏",
|
||||
"handler_job_num": "10086",
|
||||
},
|
||||
{"ysddh": "NO-ID"},
|
||||
])
|
||||
assert skipped == 1
|
||||
draft = drafts[0]
|
||||
assert draft.oa_system == "e8"
|
||||
assert draft.timer_started_at is not None
|
||||
assert draft.can_accept == 1
|
||||
assert draft.is_returned == 0
|
||||
assert draft.flow_status_raw == 1
|
||||
assert draft.owner_oa_id == 15
|
||||
assert draft.applicant_oa_id == 22
|
||||
assert draft.flow_no == "LC-1"
|
||||
assert draft.request_title == "设备验收"
|
||||
assert draft.request_created_at == datetime(2026, 10, 26, 15, 46, 4)
|
||||
assert [node.node_name for node in draft.nodes] == ["使用部门担当"]
|
||||
assert [item.user_id for item in draft.operators] == [15]
|
||||
|
||||
|
||||
def test_e8_sql_joins_current_node_and_unfinished_operator():
|
||||
"""当前节点用 currentnodeid。未办人用 isremark=0。不取流程编号。"""
|
||||
sql = build_e8_acceptance_sql().lower()
|
||||
assert "formtable_main_324" in sql
|
||||
assert "w.requestid = f.requestid" in sql
|
||||
assert "n.id = w.currentnodeid" in sql
|
||||
assert "op.nodeid = w.currentnodeid" in sql
|
||||
assert "isremark" in sql
|
||||
assert "w.currentnodetype is null" in sql
|
||||
assert "<> n'3'" in sql
|
||||
assert "w.creater" in sql
|
||||
assert "w.creator" not in sql
|
||||
assert "f.lcbh as flow_no" in sql
|
||||
assert "w.requestname as request_title" in sql
|
||||
assert "w.createdate" in sql
|
||||
assert "w.createtime" in sql
|
||||
assert "lastnodeid" not in sql
|
||||
|
||||
|
||||
def test_tier_one_sends_to_usage_owner_not_current_handler():
|
||||
"""第 1 档主送使用部门担当。当前节点上的另一名处理人不进收件人。"""
|
||||
order = SimpleNamespace(
|
||||
oa_system="e10",
|
||||
dwell_days=31,
|
||||
owner_oa_id=15,
|
||||
owner_name="吴敏",
|
||||
owner_job_num="10086",
|
||||
applicant_oa_id=22,
|
||||
applicant_name="赵琴",
|
||||
applicant_job_num="20001",
|
||||
)
|
||||
people = {
|
||||
15: {
|
||||
"name": "吴敏",
|
||||
"job_num": "10086",
|
||||
"superior_id": 30,
|
||||
"superior_name": "钱伟",
|
||||
"superior_job_num": "30001",
|
||||
"department_id": "9",
|
||||
},
|
||||
22: {"name": "赵琴", "job_num": "20001"},
|
||||
}
|
||||
deputies = {"9": [{"oa_id": 40, "name": "孙经理", "job_num": "40001"}]}
|
||||
users = {
|
||||
"10086": SimpleNamespace(id=7, wecom_userid="wx-owner", real_name="吴敏"),
|
||||
"30001": SimpleNamespace(id=8, wecom_userid="wx-boss", real_name="钱伟"),
|
||||
"20001": SimpleNamespace(id=9, wecom_userid="wx-buyer", real_name="赵琴"),
|
||||
"40001": SimpleNamespace(id=10, wecom_userid="wx-deputy", real_name="孙经理"),
|
||||
}
|
||||
drafts = _drafts(
|
||||
order,
|
||||
people,
|
||||
deputies,
|
||||
{},
|
||||
{},
|
||||
users,
|
||||
{},
|
||||
{"coo": None, "buyer": None, "executive": None},
|
||||
(30, 37, 44, 51),
|
||||
max_tier=3,
|
||||
)
|
||||
tier1 = drafts[0]
|
||||
assert tier1["tier"] == 1
|
||||
assert tier1["to_text"] == "吴敏"
|
||||
assert "钱伟" in (tier1["cc_text"] or "")
|
||||
assert "赵琴" in (tier1["cc_text"] or "")
|
||||
labels = [item["label"] for item in tier1["recipients"]]
|
||||
assert "当前处理人" not in labels
|
||||
assert "使用部门担当" in labels
|
||||
@@ -2,7 +2,7 @@
|
||||
backend/tests/test_equipment_acceptance_snapshot.py
|
||||
|
||||
用途:设备验收同步的状态、分组和 SQL 组装单测。
|
||||
依赖:snapshot_rules、source_group、query_sql。不连接 OA,也不启动 Flask。
|
||||
依赖:snapshot_rules、source_group、query_sql、sync_service 的搜索词整理。不连接 OA,也不启动 Flask。
|
||||
逻辑:停表规则、按 requestid 分组、SQL 不查 isremark,发送记录快照字段原样返回。
|
||||
"""
|
||||
|
||||
@@ -13,6 +13,7 @@ import pytest
|
||||
pytestmark = pytest.mark.pure_unit
|
||||
|
||||
from app.services.equipment_acceptance.query_sql import build_acceptance_sql, resolve_catalogs
|
||||
from app.services.equipment_acceptance.sync_service import _clean_search, _contains_pattern
|
||||
from app.services.equipment_acceptance.snapshot_rules import (
|
||||
EXCLUDED,
|
||||
NOT_STARTED,
|
||||
@@ -51,16 +52,16 @@ def test_returned_yes_stops_even_while_approving():
|
||||
assert status == STOPPED_RETURNED
|
||||
|
||||
|
||||
def test_cannot_accept_stops_and_null_can_accept_is_not_watching():
|
||||
"""can_accept=0 是不可以,停表;空值不是可以验收。"""
|
||||
def test_cannot_accept_stops_and_null_can_accept_still_watches():
|
||||
"""可以验收明确为否才停表。空值未标明,审批中且已计时仍监控。"""
|
||||
stopped = classify_monitor_status(
|
||||
can_accept=0, is_returned=0, flow_status=1, timer_started=True
|
||||
)
|
||||
excluded = classify_monitor_status(
|
||||
watching = classify_monitor_status(
|
||||
can_accept=None, is_returned=0, flow_status=1, timer_started=True
|
||||
)
|
||||
assert stopped == STOPPED_CANNOT_ACCEPT
|
||||
assert excluded == EXCLUDED
|
||||
assert watching == WATCHING
|
||||
|
||||
|
||||
def test_not_returned_and_can_accept_watches():
|
||||
@@ -204,10 +205,14 @@ def test_sql_uses_dictionary_catalogs_and_does_not_select_isremark():
|
||||
assert "workflow_requestbase" not in sql
|
||||
assert "[weaver_wfc].[dbo].[wfc_form_data]" in sql
|
||||
assert "d.dataid = f.FORM_DATA_ID" in sql
|
||||
assert "r.flowstatus is null or r.flowstatus <> 3" in sql.lower()
|
||||
assert "r.requestmark as flow_no" in sql.lower()
|
||||
assert "r.requestname as request_title" in sql.lower()
|
||||
assert "r.createdatetime" in sql.lower()
|
||||
assert "lcbh" not in sql
|
||||
assert "htbh1" not in sql
|
||||
assert "ysrq" not in sql
|
||||
assert "requestmark" not in sql
|
||||
assert "requestmark" in sql.lower()
|
||||
assert "operateround" not in sql.lower()
|
||||
assert "optgroupid" not in sql.lower()
|
||||
assert "batch_number" not in sql.lower()
|
||||
@@ -255,3 +260,11 @@ def test_send_record_payload_keeps_written_names():
|
||||
assert payload["threshold_days"] == 37
|
||||
assert payload["status"] == "sent"
|
||||
assert payload["sent_at"]
|
||||
|
||||
|
||||
def test_number_keyword_treats_like_wildcards_as_literal_text():
|
||||
"""单号搜索按包含匹配,% 和 _ 保持原字符,空白不参与过滤。"""
|
||||
assert _clean_search(" ") is None
|
||||
assert _clean_search(" 20260718 ") == "20260718"
|
||||
assert _contains_pattern("a%b_c") == "%a\\%b\\_c%"
|
||||
assert len(_clean_search("x" * 120) or "") == 100
|
||||
+9
-1
@@ -1,5 +1,12 @@
|
||||
# 智能HR请假管理需求
|
||||
|
||||
## 制程品质异常预警(2026-10)
|
||||
|
||||
- 只读统计 OA 制程品质异常通知单。统计键是料号 + 不良类别,料号按原值,计次日期是申请日期。归档和在途计入,废弃和撤销不计入。
|
||||
- 近一年是扫描日减 1 年(含)到扫描日前 1 天(含),同一键 ≥ 3 才预警。当月按申请日期所在自然月计,含扫描日当天。当月笔数只决定升级给谁。
|
||||
- 品质担当每周收一封仍 ≥ 3 的全量清单。升级只在当月进入更高档的那一周发一次:第 1 笔主送品质和生产经副理,第 2 笔主送 COO,第 3 笔及以上主送老板并抄送 COO、品质、生产经副理。跳过的档不补发。渠道是 OA 邮件。
|
||||
- 规则已整理,尚未实现。OA 字段和发信方式见后续设计文档。一单多行计次、空不良类别、五个岗位的具体人员仍待确认。需求见 [制程品质异常预警需求](features/process-quality-alert/demand.md)。
|
||||
|
||||
## 年度教育训练计划(2026-10)
|
||||
|
||||
独立于入职、安全、精益、出国规章培训。年底按主办单位收集下一年度计划,讲师按月排课;课程库保存可重复使用的课件和试题,签到、录制、考试发布和完成状态记在月度场次上。未完成提醒每周一 09:00 发给当月仍有未完成场次的讲师,文案对齐人事课内部邮件。细则见 [features/training/annual-training-plan-demand.md](features/training/annual-training-plan-demand.md),设计方案见 [features/training/annual-training-plan-design.md](features/training/annual-training-plan-design.md),原型见 [features/training/annual-training-plan-prototype.html](features/training/annual-training-plan-prototype.html)。
|
||||
@@ -26,8 +33,9 @@
|
||||
## 设备验收预警(2026-09)
|
||||
|
||||
- 从 OA 资产验收单第一次进入「使用部门担当」起按自然日累计停留;只监控未归档、有效、可以验收的流程。归档、退回、撤回、作废或无法验收立即停表。再进入时计时起点不改,仍按第一次写入的 `sbsyrjssj` 计算,不从 0 重计。`sfzfth` 不考虑从退回改回正常。
|
||||
- 超过 30/37/44/51 天各发一次企业微信。第 4 轮默认关闭,配置打开后才通知总经理。担当、直接主管、经副理取当前节点处理人及其上级;采购担当取流程申请人。采购经副理、COO、总经理可在界面配置。每日扫描只生成待发送,初始每周五 18:00 按收件人发送汇总卡片和 Excel 明细。
|
||||
- 超过 30/37/44/51 天各发一次企业微信。第 4 轮默认关闭,配置打开后才通知总经理。第 1 档主送使用部门担当,第 2 档主送其经副理,直接主管也取这个人;E8 与 E10 相同,不取当前节点未办人。采购担当取流程申请人。采购经副理、COO、总经理可在界面配置。每日扫描只生成待发送,初始每周五 18:00 按收件人发送汇总卡片和 Excel 明细。
|
||||
- 规则已冻结。验收单读 E10 `ecology10.dbo.ft_gdzcysdv2`,人员 ID 经 `eteams.dbo.employee` 用工号对上系统用户。流程状态读 `wfc_requestbase.flowstatus`,`7`、`8`、`99`、`-99` 都按撤销停表。当前节点读 `wfc_currentnode` 再关联 `wfp_node`,当前处理人读 `wfc_operate.userid`。直接主管取 `employee.SUPERIOR`,经副理按 `employee.DEPARTMENT` 查 E10 部门矩阵。申请人 `sqr` 是人员 ID。退回为 `sfzfth = 0`。无法验收说明正文是 `ycsm`,只留痕。只读同步、停留列表、发送记录、每日扫描和周五企业微信已实现,入口与合同付款预警相同(内置 Chat Agent `equipment_acceptance`)。不查询、不保存 `isremark`。默认每天 06:00 扫描、每周五 18:00 按收件人发送。停表取消未发送,已发送不撤回。需求见 [设备验收预警需求](features/equipment-acceptance-warning/demand.md),数据设计见 [technical.md](features/equipment-acceptance-warning/technical.md)。
|
||||
- E8 补抓已接上(2026-10-26)。与 E10 分来源保存。暂停按撤销停表。没有作废、强制结束。见 [设备验收预警需求](features/equipment-acceptance-warning/demand.md)、[technical.md](features/equipment-acceptance-warning/technical.md)。
|
||||
|
||||
## 合同付款预警 Agent(2026-08)
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
| [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) · [人工复核原型](contract-payment-plan/contract-payment-review-prototype.html) · [Chat Agent 原型](contract-payment-plan/contract-payment-chat-agent-prototype.html) |
|
||||
| [equipment-maintenance](equipment-maintenance/README.md) | 设备维保助手 | [聊天原型](equipment-maintenance/equipment-maintenance-agent-chat-lofi.html) |
|
||||
| [equipment-acceptance-warning](equipment-acceptance-warning/README.md) | 设备验收停留预警 | [需求说明](equipment-acceptance-warning/demand.md) · [数据设计](equipment-acceptance-warning/technical.md) |
|
||||
| [process-quality-alert](process-quality-alert/demand.md) | 制程品质异常预警 | [需求说明](process-quality-alert/demand.md) · [原型](process-quality-alert/process-quality-alert-prototype.html) |
|
||||
| [training](training/) | 教育训练:新人培训与年度计划 | [年度教育训练计划需求](training/annual-training-plan-demand.md) · [设计方案](training/annual-training-plan-design.md) · [可点击原型](training/annual-training-plan-prototype.html) · [精益周任务规则](training/精益管理周任务规则手册.md) |
|
||||
| [faq](faq/) | 常用问题 / FAQ 缓存直答 | [运维手册](faq/faq_cache_ops_manual.md) · [模糊查询与 AI 自动维护设计](faq/faq_fuzzy_and_ai_maintenance_design.md) |
|
||||
|
||||
|
||||
@@ -5,4 +5,4 @@
|
||||
| **需求说明** | 产品、业务、研发 | [demand.md](demand.md) |
|
||||
| **数据设计** | 研发 | [technical.md](technical.md) |
|
||||
|
||||
**状态**:规则已冻结(2026-09-29)。只读同步、Chat 作业面、每日扫描和周五企业微信已实现(2026-10-12)。入口与合同付款预警相同,内置 Agent `equipment_acceptance`。页签有停留情况、发送记录和预警配置。当前处理人取当前节点上的 `userid`,不查询、不保存 `isremark`。默认每天 06:00 扫描、每周五 18:00 按收件人发送。见 [funclist.md](../../funclist.md)「设备验收预警」。
|
||||
**状态**:E10 与 E8 都按使用部门担当发第 1 档。E8 暂停按停表。见 [funclist.md](../../funclist.md)「设备验收预警」。
|
||||
@@ -210,9 +210,9 @@
|
||||
<label class="day">超过 <input value="30" /> 天</label>
|
||||
</div>
|
||||
<div class="people">
|
||||
<div class="line"><span class="tag">主送</span><span class="plain">当前节点处理人</span></div>
|
||||
<div class="line"><span class="tag">主送</span><span class="plain">使用部门担当</span></div>
|
||||
<div class="line"><span class="tag">抄送</span><span class="plain">其直接主管、采购担当</span></div>
|
||||
<span class="note">随当前单据变化,这里不选人</span>
|
||||
<span class="note">随单据上的使用部门担当变化,这里不选人</span>
|
||||
</div>
|
||||
</article>
|
||||
|
||||
@@ -222,7 +222,7 @@
|
||||
<label class="day">超过 <input value="37" /> 天</label>
|
||||
</div>
|
||||
<div class="people">
|
||||
<div class="line"><span class="tag">主送</span><span class="plain">当前节点处理人的经副理</span></div>
|
||||
<div class="line"><span class="tag">主送</span><span class="plain">使用部门担当的经副理</span></div>
|
||||
<div class="line">
|
||||
<span class="tag">抄送</span>
|
||||
<div class="chips">
|
||||
|
||||
@@ -1,101 +1,42 @@
|
||||
# 设备验收预警需求说明
|
||||
|
||||
> **版本**:V1.0
|
||||
> **更新日期**:2026-10-08
|
||||
> **状态**:规则已冻结。只读同步、停留列表、发送记录、预警配置、每日扫描和周五企业微信已实现。入口与合同付款预警相同。当前处理人取当前节点上的 `userid`,不查询、不保存 `isremark`。发送时刻不在配置页,默认排程每天 06:00 扫描、每周五 18:00 发送。数据设计见 [technical.md](technical.md)。
|
||||
> **适用范围**:OA 资产验收单停留预警、企业微信通知、固定岗位配置
|
||||
> **版本**:V2.0
|
||||
> **更新日期**:2026-10-26
|
||||
> **状态**:E10 已上线。E8 查询已接上。字段和关联见 [technical.md](technical.md)。
|
||||
|
||||
## 1. 背景与目标
|
||||
验收单从第一次进入「使用部门担当」起按自然日累计。未归档、已经开始计时,且可以验收不是明确为否的单据,超过 30 / 37 / 44 / 51 天升级提醒。合同付款预警只在归档后取日期,本需求不改那条规则。
|
||||
|
||||
资产验收流程可能在某个节点停留很久。从流程进入「使用部门担当」起按自然日累计停留时间,对仍可验收的未归档单据按 30/37/44/51 天升级提醒,避免验收长期挂起。
|
||||
## 1. 哪些单要提醒
|
||||
|
||||
现有合同付款预警只在验收单归档后读取 OA(`formtable_main_324`,`currentnodetype=3`),不监控进行中的节点停留。本需求是独立能力,不改付款预警的归档口径。
|
||||
| 条件 | 结果 |
|
||||
| --- | --- |
|
||||
| 未归档,可以验收为是或未标明,计时起点已有值 | 提醒 |
|
||||
| 还没进入使用部门担当 | 不计时 |
|
||||
| 可以验收明确为否 | 不监控 |
|
||||
| 退回、撤销 | 停表,取消还没发出的提醒,仍留在列表 |
|
||||
| 归档 | 不抓、不进列表。下次同步从本地删掉,未发出的提醒取消 |
|
||||
| E10 的作废、强制结束、暂停 | 停表 |
|
||||
| E8 | 没有作废、强制结束。暂停与 E10 一样停表 |
|
||||
|
||||
## 2. 范围
|
||||
计时起点写入后不改。换后续节点,或退回、无法验收后再进入,仍从第一次的起点累计,不从 0 重计,已发过的档不重发。
|
||||
|
||||
### 2.1 本期已冻结
|
||||
## 2. 谁收
|
||||
|
||||
- 监控对象、计时起点、自然日累计、停表与再进入规则。
|
||||
- 四档升级的主送、抄送,以及当前节点处理人、上级、申请人的取人规则。
|
||||
- 采购经副理、COO、总经理三个固定岗位可在管理界面配置,禁止在代码中写死姓名或账号。
|
||||
- 企业微信为唯一通知渠道。每日扫描只生成待发送记录;发送时刻可配置,初始为每周五 18:00,按收件人汇总一条。
|
||||
- 数据来源见第 7 节。缺字段的单据跳过并留下原因。
|
||||
每一档在同一段累计里只发一次。超过才发,刚好等于不发。第 4 档默认关闭。
|
||||
|
||||
停留列表已接到对话页:内置 Chat Agent `equipment_acceptance`,与合同付款预警一样替换消息列表和输入框。
|
||||
|
||||
### 2.2 本期不做
|
||||
|
||||
- 不接 Dify 对话。
|
||||
- 不撤回已发送的企业微信。停表只取消尚未发出的预警。
|
||||
- 「使用部门担当」之前的节点(ERP 触发、申请人确认、直属上级)不参与计时。
|
||||
|
||||
## 3. 监控对象
|
||||
|
||||
数据源是 E10 验收单主表,字段对照见 [technical.md](technical.md)。只纳入同时满足以下条件的流程:
|
||||
|
||||
- 未归档
|
||||
- 有效(未撤回、未作废)
|
||||
- 可以验收
|
||||
|
||||
计时起点是该流程**第一次进入「使用部门担当」**。进入之后按自然日持续累计,中途更换后续节点不重置。流程图上该节点之后的使用部门经理、品质担当、品质经理、公用主管、设备管理部、设备管理部经理、固定资产管理人、COO、总经理、总务知会,都算在同一段累计时间里。节点正式名称以 OA 为准。
|
||||
|
||||
## 4. 停表与再进入
|
||||
|
||||
出现任一情况立即停止计时,并取消尚未发出的预警:
|
||||
|
||||
- 归档
|
||||
- 退回、撤回、作废
|
||||
- 验收单上为无法验收(说明正文是 `ycsm`,只作留痕,不单独触发通知)
|
||||
|
||||
已确认:退回或无法验收后再进入,「使用部门担当」的计时起点 `sbsyrjssj` 不会改写,签核天数仍按第一次写入的时间计算,不从 0 重计,也不另找起点。四档按这一段累计天数各发一次,不因再进入而重发。`sfzfth` 不考虑从退回(`0`)改回正常(`1` 或空);不靠这个变化恢复计时。撤回、作废、归档后的同一请求不再恢复。
|
||||
|
||||
## 5. 升级与收件人
|
||||
|
||||
每一档在同一计时周期只产生一次待发送。每日扫描判断是否跨档,跨档后等到固定推送时刻再发。一次汇总前若跨了多档,各档都保留,合并进该收件人的同一条汇总,不逐单刷屏。
|
||||
|
||||
| 停留 | 主送 | 抄送 |
|
||||
| 超过 | 主送 | 抄送 |
|
||||
| --- | --- | --- |
|
||||
| 超过 30 天 | 当前节点处理人(担当) | 其直接主管、采购担当 |
|
||||
| 超过 37 天 | 当前节点处理人的经副理 | COO、采购经副理 |
|
||||
| 超过 44 天 | COO | 采购经副理 |
|
||||
| 超过 51 天 | 总经理 | COO、采购经副理 |
|
||||
| 30 天 | 使用部门担当 | 其直接主管、采购担当 |
|
||||
| 37 天 | 该担当的经副理 | COO、采购经副理 |
|
||||
| 44 天 | COO | 采购经副理 |
|
||||
| 51 天 | 总经理 | COO、采购经副理 |
|
||||
|
||||
第 4 轮在配置里单独开关,默认关闭。关闭时不生成、也不发送总经理这一轮。打开后,下一次扫描才按超过第 4 档的天数产生待发送。前 3 轮不受这个开关影响。
|
||||
- 使用部门担当、直接主管、经副理都按表单上的使用部门担当取,不按当前节点未办人。E8 与 E10 相同。
|
||||
- 采购担当是申请人。
|
||||
- COO、采购经副理、总经理在配置页选择。
|
||||
- 对不上人就记失败,不改发给别人。
|
||||
|
||||
人员解析:
|
||||
## 3. 怎么发
|
||||
|
||||
- 担当、直接主管、经副理取**当前节点处理人**及其上级,不固定成「使用部门担当」本人。
|
||||
- 采购担当取该流程的**申请人**。
|
||||
- 采购经副理、COO、总经理是固定岗位。配置初始值分别为赵琴、COO、廖总,必须能在管理界面修改。代码与环境文件不得写死这三个人的姓名或账号。
|
||||
- 当前节点有多名处理人时,主送这些处理人;直接主管、经副理按各处理人展开后去重。
|
||||
- 收件人解析失败(无上级、未绑定企业微信)时,该条保持失败可追查,不改发给别人。
|
||||
|
||||
## 6. 推送
|
||||
|
||||
已确认:扫描与发送分离。发送时刻做成可配置,**初始对齐合同付款预警,为每周五 18:00**(见 [合同付款预警需求](../contract-payment-plan/demand.md))。到点后按收件人合并为一条企业微信汇总卡片,并紧跟一份只含该收件人明细的 Excel。这份 Excel 按收件人归档,挂在发送记录表的 Excel 附件列上,点文件名再下载。卡片不逐条列出验收单,也不区分主送和抄送。渠道只有企业微信。
|
||||
|
||||
## 7. 数据来源
|
||||
|
||||
权威设计见 [technical.md](technical.md)。摘要如下:
|
||||
|
||||
- 连接只用 `.env.shared` 的 `OA_E10_SQLSERVER_HOST`、`OA_E10_SQLSERVER_USERNAME`、`OA_E10_SQLSERVER_PASSWORD`。验收单在 `ecology10`,流程实例字典库为 `weaver_wfc`,节点定义字典库为 `weaver_wfp`。
|
||||
- 验收单主表是 `ecology10.dbo.ft_gdzcysdv2`。验收单单号 `ysddh`,采购单号 `cgdh`。计时起点 `sbsyrjssj` 只在第一次进入「使用部门担当」时写入,之后不改。
|
||||
- `sybmdd`(使用部门担当)、`sbglry`(设备管理人员)存人员 ID,关联 `eteams.dbo.employee.ID`,用工号 `JOB_NUM` 匹配 HXOPS 用户。
|
||||
- `sfkyzcys` 是是否可以正常验收:**0 是可以,1 是不可以**,与常见 0/1 相反。空值不纳入监控。无法验收说明正文是 `ycsm`,只留痕,不单独触发停表。
|
||||
- `sfzfth`:**0 是退回,1 和空都是流程正常。** 空值不当成退回。作废不看这一列。
|
||||
- 未归档、归档、作废、撤销看 `wfc_requestbase.flowstatus`(`1` 审批中,`3` 正常归档,`5` 已作废)。`7`、`8`、`99`、`-99` 都按撤销处理,停表且不再提醒。当前节点看 `weaver_wfc.dbo.wfc_currentnode.nodeid`,名称关联 `weaver_wfp.dbo.wfp_node`。`lastnodeid` 是最后操作节点,不当作当前节点。申请人 `sqr` 已确认是人员 ID。
|
||||
- 当前处理人在 `weaver_wfc.dbo.wfc_operate`。`userid` 是操作人,与当前节点按 `requestid`、`nodeid` 对齐,再关联 `employee`。不查询、不保存 `isremark`。同一人只留一行。每日扫描按这些人展开四档收件人。
|
||||
|
||||
直接主管取当前处理人的 `employee.SUPERIOR`。经副理用该人的 `employee.DEPARTMENT` 查 `eteams.dbo.hrm_matrix_condition_data`,人在 `eteams.dbo.hrm_matrix_value_data.relate_id`。不查 E8 矩阵。采购经副理、COO、总经理不从矩阵取,只读界面配置。
|
||||
|
||||
## 8. 验收标准(视图到位后的实现对照)
|
||||
|
||||
| 编号 | 条件 | 期望 |
|
||||
| --- | --- | --- |
|
||||
| AC-01 | 尚未进入「使用部门担当」 | 不计时、不产生预警 |
|
||||
| AC-02 | 签核天数超过 30/37/44/51 | 各档只产生一次待发送,刚好等于还不发。收件人符合第 5 节 |
|
||||
| AC-03 | 进入后更换后续节点 | 累计天数不重置 |
|
||||
| AC-04 | 归档、退回、撤回、作废或无法验收 | 立即停表,取消未发送预警,已发送消息保留 |
|
||||
| AC-05 | 退回或无法验收后再次进入 | 签核天数仍从原 `sbsyrjssj` 计算。不把 `sfzfth` 从 `0` 改回正常当作恢复 |
|
||||
| AC-06 | 发送时刻 | 默认每周五 18:00 按收件人汇总;时刻可配置 |
|
||||
| AC-07 | 修改采购经副理、COO、总经理配置 | 此后新产生的预警使用新人员,不改历史已发送记录 |
|
||||
- 每天扫描,生成待发送。默认每周五 18:00 按收件人发一条企业微信汇总,并附一份只含该人的 Excel。时刻可改。
|
||||
- 已发送的不撤回、不重发。
|
||||
+17
-16
@@ -175,7 +175,7 @@
|
||||
<section class="view" id="v-config">
|
||||
<div class="hero"><div><h1>预警配置</h1><p>天数默认 30、37、44、51,须逐档增大。保存后只影响尚未发送的预警。</p></div></div>
|
||||
<div class="ladder">
|
||||
<label class="rung"><span class="k">第 1 档</span><span class="num"><input id="cfgDay0" type="number" min="1" value="30" /><em>天</em></span><small id="rungWho0">当前处理人</small></label>
|
||||
<label class="rung"><span class="k">第 1 档</span><span class="num"><input id="cfgDay0" type="number" min="1" value="30" /><em>天</em></span><small id="rungWho0">使用部门担当</small></label>
|
||||
<label class="rung"><span class="k">第 2 档</span><span class="num"><input id="cfgDay1" type="number" min="1" value="37" /><em>天</em></span><small id="rungWho1">经副理</small></label>
|
||||
<label class="rung"><span class="k">第 3 档</span><span class="num"><input id="cfgDay2" type="number" min="1" value="44" /><em>天</em></span><small id="rungWho2">COO</small></label>
|
||||
<label class="rung"><span class="k">第 4 档</span><span class="num"><input id="cfgDay3" type="number" min="1" value="51" /><em>天</em></span><small id="rungWho3">总经理</small></label>
|
||||
@@ -217,28 +217,29 @@
|
||||
let digest = null;
|
||||
const cfg = { buyer: '赵琴', coo: 'COO', boss: '廖总', when: '每周五 18:00', days: [30, 37, 44, 51] };
|
||||
const orders = [
|
||||
{ id:'YS-2026-0138', po:'CG-2026-0812', applicant:'王磊', node:'设备管理部', handlers:['陈工'], supervisor:'何主管', deputy:'周经副理', entered:'2026-08-08', days:53, cycle:1, state:'watching', sent:[0,1,2], fail:'', stop:'', note:'同一周期已发过前三档,本周只待第 4 档。' },
|
||||
{ id:'YS-2026-0142', po:'CG-2026-0744', applicant:'张敏', node:'品质经理', handlers:['李倩'], supervisor:'钱伟', deputy:'孙经理', entered:'2026-08-15', days:46, cycle:1, state:'watching', sent:[0,1], fail:'', stop:'', note:'换到品质经理后累计不重置。' },
|
||||
{ id:'YS-2026-0155', po:'CG-2026-0901', applicant:'赵丽', node:'使用部门经理', handlers:['周涛'], supervisor:'马主管', deputy:'孙经理', entered:'2026-08-23', days:38, cycle:1, state:'watching', sent:[0], fail:'', stop:'', note:'' },
|
||||
{ id:'YS-2026-0160', po:'CG-2026-0886', applicant:'孙浩', node:'公用主管', handlers:['吴敏','林可'], supervisor:'钱伟', deputy:'孙经理', entered:'2026-08-30', days:31, cycle:1, state:'watching', sent:[], fail:'', stop:'', note:'当前节点两名处理人,直接主管相同,抄送去重为钱伟。' },
|
||||
{ id:'YS-2026-0188', po:'CG-2026-0910', applicant:'刘洋', node:'品质担当', handlers:['郑凯'], supervisor:'', deputy:'孙经理', entered:'2026-08-28', days:33, cycle:1, state:'watching', sent:[], fail:'直接主管缺失', stop:'', note:'第 1 档无法解析直接主管,保持失败,不改发。' },
|
||||
{ id:'YS-2026-0172', po:'CG-2026-0933', applicant:'陈静', node:'品质担当', handlers:['郑凯'], supervisor:'钱伟', deputy:'孙经理', entered:'2026-09-10', days:20, cycle:1, state:'watching', sent:[], fail:'', stop:'', note:'未超过第 1 档,只监控不发。' },
|
||||
{ id:'YS-2026-0098', po:'CG-2026-0618', applicant:'周宁', node:'使用部门担当', handlers:['马超'], supervisor:'钱伟', deputy:'孙经理', entered:'2026-08-10', days:60, cycle:1, state:'watching', sent:[0,1,2,3], fail:'', stop:'', note:'无法验收后再进入,签核天数仍从第一次写入的计时起点计算,不从 0 重计。' },
|
||||
{ id:'YS-2026-0071', po:'CG-2026-0550', applicant:'吴芳', node:'品质经理', handlers:['李倩'], supervisor:'钱伟', deputy:'孙经理', entered:'2026-08-01', days:40, cycle:1, state:'stopped', sent:[0], fail:'', stop:'无法验收', note:'无法验收说明:到货规格与请购不符。未发送的后续档已取消。' },
|
||||
{ id:'YS-2026-0066', po:'CG-2026-0702', applicant:'郑明', node:'使用部门经理', handlers:['周涛'], supervisor:'马主管', deputy:'孙经理', entered:'2026-08-20', days:18, cycle:1, state:'stopped', sent:[], fail:'', stop:'退回', note:'退回后立即停表。再进入仍用第一次的计时起点,不按 sfzfth 改回正常来恢复。' },
|
||||
{ id:'YS-2026-0201', po:'CG-2026-1008', applicant:'韩冰', node:'直属上级', handlers:['—'], supervisor:'', deputy:'', entered:'', days:0, cycle:0, state:'out', sent:[], fail:'', stop:'', note:'尚未进入使用部门担当,不计时。' }
|
||||
{ id:'YS-2026-0138', po:'CG-2026-0812', applicant:'王磊', node:'设备管理部', owner:'陈工', handlers:['陈工'], supervisor:'何主管', deputy:'周经副理', entered:'2026-08-08', days:53, cycle:1, state:'watching', sent:[0,1,2], fail:'', stop:'', note:'同一周期已发过前三档,本周只待第 4 档。' },
|
||||
{ id:'YS-2026-0142', po:'CG-2026-0744', applicant:'张敏', node:'品质经理', owner:'李倩', handlers:['李倩'], supervisor:'钱伟', deputy:'孙经理', entered:'2026-08-15', days:46, cycle:1, state:'watching', sent:[0,1], fail:'', stop:'', note:'换到品质经理后累计不重置。' },
|
||||
{ id:'YS-2026-0155', po:'CG-2026-0901', applicant:'赵丽', node:'使用部门经理', owner:'周涛', handlers:['周涛'], supervisor:'马主管', deputy:'孙经理', entered:'2026-08-23', days:38, cycle:1, state:'watching', sent:[0], fail:'', stop:'', note:'' },
|
||||
{ id:'YS-2026-0160', po:'CG-2026-0886', applicant:'孙浩', node:'公用主管', owner:'吴敏', handlers:['吴敏','林可'], supervisor:'钱伟', deputy:'孙经理', entered:'2026-08-30', days:31, cycle:1, state:'watching', sent:[], fail:'', stop:'', note:'当前节点有两名处理人,第 1 档只发给使用部门担当吴敏,抄送其直接主管钱伟。' },
|
||||
{ id:'YS-2026-0188', po:'CG-2026-0910', applicant:'刘洋', node:'品质担当', owner:'郑凯', handlers:['郑凯'], supervisor:'', deputy:'孙经理', entered:'2026-08-28', days:33, cycle:1, state:'watching', sent:[], fail:'直接主管缺失', stop:'', note:'第 1 档无法解析使用部门担当的直接主管,保持失败,不改发。' },
|
||||
{ id:'YS-2026-0172', po:'CG-2026-0933', applicant:'陈静', node:'品质担当', owner:'郑凯', handlers:['郑凯'], supervisor:'钱伟', deputy:'孙经理', entered:'2026-09-10', days:20, cycle:1, state:'watching', sent:[], fail:'', stop:'', note:'未超过第 1 档,只监控不发。' },
|
||||
{ id:'YS-2026-0098', po:'CG-2026-0618', applicant:'周宁', node:'使用部门担当', owner:'马超', handlers:['马超'], supervisor:'钱伟', deputy:'孙经理', entered:'2026-08-10', days:60, cycle:1, state:'watching', sent:[0,1,2,3], fail:'', stop:'', note:'无法验收后再进入,签核天数仍从第一次写入的计时起点计算,不从 0 重计。' },
|
||||
{ id:'YS-2026-0071', po:'CG-2026-0550', applicant:'吴芳', node:'品质经理', owner:'李倩', handlers:['李倩'], supervisor:'钱伟', deputy:'孙经理', entered:'2026-08-01', days:40, cycle:1, state:'stopped', sent:[0], fail:'', stop:'无法验收', note:'无法验收说明:到货规格与请购不符。未发送的后续档已取消。' },
|
||||
{ id:'YS-2026-0066', po:'CG-2026-0702', applicant:'郑明', node:'使用部门经理', owner:'周涛', handlers:['周涛'], supervisor:'马主管', deputy:'孙经理', entered:'2026-08-20', days:18, cycle:1, state:'stopped', sent:[], fail:'', stop:'退回', note:'退回后立即停表。再进入仍用第一次的计时起点,不按 sfzfth 改回正常来恢复。' },
|
||||
{ id:'YS-2026-0201', po:'CG-2026-1008', applicant:'韩冰', node:'直属上级', owner:'', handlers:['—'], supervisor:'', deputy:'', entered:'', days:0, cycle:0, state:'out', sent:[], fail:'', stop:'', note:'尚未进入使用部门担当,不计时。' }
|
||||
];
|
||||
|
||||
/**
|
||||
* 按档位序号取主送与抄送。天数读配置,人员规则不随天数变化。
|
||||
* 第 1 档取当前处理人及其主管、申请人;其后三档读固定岗位。
|
||||
* 第 1 档主送使用部门担当,抄送其直接主管和申请人。第 2 档主送该担当的经副理。其后两档读固定岗位。
|
||||
*/
|
||||
function audience(order, level) {
|
||||
if (level === 0) {
|
||||
const cc = [];
|
||||
if (order.supervisor) cc.push(order.supervisor);
|
||||
cc.push(order.applicant + '(采购担当)');
|
||||
return { to: order.handlers.slice(), cc, blocked: order.supervisor ? '' : '直接主管缺失' };
|
||||
const blocked = order.owner ? (order.supervisor ? '' : '直接主管缺失') : '使用部门担当缺失';
|
||||
return { to: order.owner ? [order.owner] : [], cc, blocked };
|
||||
}
|
||||
if (level === 1) return { to:[order.deputy], cc:[cfg.coo, cfg.buyer], blocked: order.deputy ? '' : '经副理缺失' };
|
||||
if (level === 2) return { to:[cfg.coo], cc:[cfg.buyer], blocked:'' };
|
||||
@@ -436,14 +437,14 @@
|
||||
*/
|
||||
function renderRules() {
|
||||
const rows = [
|
||||
[cfg.days[0], '当前节点处理人', '直接主管、采购担当'],
|
||||
[cfg.days[1], '当前处理人的经副理', cfg.coo + '、' + cfg.buyer],
|
||||
[cfg.days[0], '使用部门担当', '其直接主管、采购担当'],
|
||||
[cfg.days[1], '使用部门担当的经副理', cfg.coo + '、' + cfg.buyer],
|
||||
[cfg.days[2], cfg.coo, cfg.buyer],
|
||||
[cfg.days[3], cfg.boss, cfg.coo + '、' + cfg.buyer]
|
||||
];
|
||||
$('ruleBox').innerHTML = rows.map(([day, to, cc]) => '<tr><td><b>超过 ' + day + ' 天</b></td><td>' + to + '</td><td>' + cc + '</td></tr>').join('')
|
||||
+ '<tr><td><b>解析失败</b></td><td colspan="2">保持失败可追查,不改发给别人</td></tr>';
|
||||
['当前处理人', '经副理', cfg.coo, cfg.boss].forEach((text, index) => { $('rungWho' + index).textContent = text; });
|
||||
['使用部门担当', '使用部门担当的经副理', cfg.coo, cfg.boss].forEach((text, index) => { $('rungWho' + index).textContent = text; });
|
||||
$('banner').textContent = '从第一次进入「使用部门担当」起按自然日累计,换节点不重新计算。超过 ' + cfg.days.join('/') + ' 天各提醒一次,' + cfg.when + ' 合并成一条企业微信。无法验收、退回、撤回、作废或归档后不再提醒。';
|
||||
}
|
||||
|
||||
|
||||
@@ -1,438 +1,154 @@
|
||||
# 设备验收预警设计
|
||||
# 设备验收预警数据来源
|
||||
|
||||
> **版本**:V1.19
|
||||
> **更新日期**:2026-10-12
|
||||
> **状态**:只读同步、停留列表、发送记录、预警配置、每日扫描和周五企业微信已实现。入口与合同付款预警相同:内置 Agent `equipment_acceptance`。当前处理人取当前节点上的 `wfc_operate.userid`,不查询、不保存 `isremark`。发送时刻不在配置表,默认排程是每天 06:00 扫描、每周五 18:00 发送,可在排程页改 Cron。
|
||||
> **业务规则**:[demand.md](demand.md)。本文只说明数据从哪读、人员怎么对上、哪些事实还缺。
|
||||
> **版本**:V2.0
|
||||
> **更新日期**:2026-10-26
|
||||
> **状态**:E10 已在抓。E8 查询已接上,暂停按撤销停表。业务规则见 [demand.md](demand.md)。
|
||||
|
||||
## 1. 结论
|
||||
E10 用 `OA_E10_SQLSERVER_*`,E8 用 `OA_SQLSERVER_*`。一边失败不改走另一边。人员 ID 不混用。流程实例 ID 两边都会撞号,本地用来源分开。合同付款只取 E8 归档日,那条 SQL 不复用。
|
||||
|
||||
验收单主数据读 OA E10 的 `ecology10.dbo.ft_gdzcysdv2`。人员 ID 到 `eteams.dbo.employee` 取出工号,再用工号对上 HXOPS 用户。流程是否归档、作废、撤销,读 `wfc_requestbase.flowstatus`。当前节点读 `wfc_currentnode.nodeid`,再关联 `wfp_node.nodename`。`lastnodeid` 是最后操作节点,不拿来当当前节点。当前处理人读 `wfc_operate.userid`,与当前节点按 `requestid`、`nodeid` 对齐,再关联 `employee`。不查询、不保存 `isremark`。同一节点同一人只留一行。每日扫描按这些处理人展开四档收件人。
|
||||
两边都只抓未归档。E10 不取 `flowstatus = 3`,E8 不取 `currentnodetype = 3`。这两列为空仍抓。退回、作废、强制结束、撤销仍抓。
|
||||
|
||||
## 2. 连接
|
||||
两边表单上的是否字段都是 **0 = 是,1 = 否**。落库翻成 0 = 否、1 = 是。
|
||||
|
||||
查询走 E10 SQL Server,不走 E8 `ecology`。账号只从 `.env.shared` 读取下面三个变量,不把主机、账号、密码写进代码或文档:
|
||||
## 1. 同一件事两边各看哪一列
|
||||
|
||||
| 变量 | 用途 |
|
||||
| ----------------------------- | ------------------- |
|
||||
| `OA_E10_SQLSERVER_HOST` | E10 SQL Server 主机 |
|
||||
| `OA_E10_SQLSERVER_USERNAME` | 只读账号 |
|
||||
| `OA_E10_SQLSERVER_PASSWORD` | 只读密码 |
|
||||
|
||||
验收单在 `ecology10`,人员表在同一实例的 `eteams`。流程字典写明:`wfc_requestbase`、`wfc_currentnode`、`wfc_operate` 所属库 `weaver_wfc`,`wfp_node` 所属库 `weaver_wfp`。现场曾在 `ecology10` 的 `INFORMATION_SCHEMA` 查出 `wfc_requestbase` 的列,查询时先按字典库名,账号看不到 `weaver_wfc` / `weaver_wfp` 时再改用 `ecology10` 里的同名表。本功能要求上述三个变量已配置,不回退到 E8 的 `OA_SQLSERVER_*`。
|
||||
|
||||
## 3. 验收单主表
|
||||
|
||||
表:`ecology10.dbo.ft_gdzcysdv2`。
|
||||
|
||||
| 字段 | 含义 | 在预警里的用法 |
|
||||
| ------------- | -------------------- | -------------------------------------------------------------------------------------------- |
|
||||
| `ysddh` | 验收单单号 | 台账、详情、企业微信上的验收单单号。 |
|
||||
| `cgdh` | 采购单号 | 台账上的采购单号。 |
|
||||
| `htbh` | 合同编号 | 只保存这一列。表上没有第二合同编号。 |
|
||||
| `sbsyrjssj` | 设备使用人员计时时间 | 计时起点。第一次进入「使用部门担当」时写入,之后不改。为空表示还没开始计时。 |
|
||||
| `sybmdd` | 使用部门担当 | 人员 ID,关联 `eteams.dbo.employee.ID`。 |
|
||||
| `sbglry` | 设备管理人员 | 人员 ID,关联方式同 `sybmdd`。 |
|
||||
| `sqr` | 申请人 | 预警规则里的采购担当。已确认是人员 ID,关联 `eteams.dbo.employee.ID`。 |
|
||||
| `syry` | 使用人员 | 样例中同样是长整型 ID,按 `employee.ID` 关联。 |
|
||||
| `gzglry` | 固资管理人员 | 人员字段。样例多为空;非空时按同一 ID 关联。 |
|
||||
| `dx` | 使用人员1 | 同上。 |
|
||||
| `agent` | 资管经办人 | 同上。 |
|
||||
| `sfzfth` | 是否作废退回 | OA 上 **0 是退回,1 和空都是流程正常。** 落库 `is_returned` 翻转成 0 否、1 是,空收成 0。作废不看这一列,作废看 `flowstatus = 5`。 |
|
||||
| `sfkyzcys` | 是否可以正常验收 | OA 上 **0 表示可以,1 表示不可以。** 落库 `can_accept` 翻转成 0 否、1 是。空值保持空,不当成可以验收。 |
|
||||
| `ycsm` | 无法验收说明 | 说明正文。落库 `cannot_accept_note`。只留痕,不单独触发停表。停表仍看 `sfkyzcys = 1`。 |
|
||||
|
||||
`sfkyzcys` 只表达能不能正常验收。说明正文是 `ycsm`。
|
||||
|
||||
已确认按 ID 关联人员的是 `sybmdd`、`sbglry`、`sqr`。`syry`、`gzglry`、`dx`、`agent` 在样例结果里是同类长整型,设计上人员列统一走 `employee.ID`。若核对后某列不是人员 ID,只改该列,不改工号匹配方式。
|
||||
|
||||
## 4. 人员怎么对上系统用户
|
||||
|
||||
`eteams.dbo.employee` 使用这些列:
|
||||
|
||||
| 字段 | 含义 |
|
||||
| ------------ | ----------------------------------------------------- |
|
||||
| `ID` | 与验收单人员字段、操作人 `userid` 关联 |
|
||||
| `USERNAME` | 显示姓名。只用于展示,不作为匹配键。 |
|
||||
| `JOB_NUM` | 工号。对应 HXOPS 用户表的工号,工号在系统用户中唯一。 |
|
||||
| `DEPARTMENT` | 部门 ID。只用来查经副理 |
|
||||
| `SUPERIOR` | 直接主管的人员 ID。再关联本表 `ID` |
|
||||
|
||||
关联顺序:
|
||||
|
||||
1. 验收单上的人员 ID = `eteams.dbo.employee.ID`。
|
||||
2. 取该行 `JOB_NUM`。
|
||||
3. 用 `JOB_NUM` 匹配 HXOPS 用户工号(`users.employee_id`)。
|
||||
4. 企业微信接收人用该用户已绑定的 `wecom_userid`。
|
||||
|
||||
对不上时该条保持失败,可追查,不改发给别人。失败包括:人员 ID 为空、`employee` 无此 ID、`JOB_NUM` 为空、工号在 HXOPS 无用户、用户未绑定企业微信。
|
||||
|
||||
直接主管取当前处理人在 `employee.SUPERIOR` 上的人员 ID,不查矩阵。经副理才查 E10 矩阵,见第 4.1 节。不从 `ft_gdzcysdv2` 臆造,也不查 E8 的 `Matrixtable_3`。
|
||||
|
||||
采购经副理、COO、总经理只读界面配置,不从矩阵表取。
|
||||
|
||||
## 4.1 直接主管与经副理
|
||||
|
||||
按当前处理人查,不按申请人查,也不查 E8。
|
||||
|
||||
1. 当前处理人是 `wfc_operate.userid`,等于 `eteams.dbo.employee.ID`。
|
||||
2. 直接主管是该员工的 `SUPERIOR`。这是人员 ID,再关联 `employee.ID` 取姓名和工号。空或关联不上就记失败,不改发给别人。
|
||||
3. 经副理用该员工的 `DEPARTMENT`(部门 ID)查 E10 部门矩阵。人员在 `hrm_matrix_value_data.relate_id`,再同样关联 `employee`。不要把这个 ID 当成企微 userid,也不要对 `HrmResource.id`。
|
||||
|
||||
多名当前处理人时,各自取 `SUPERIOR` 和经副理,然后去重。
|
||||
|
||||
三个固定值已确认。`tenant_key` 为 `temkc46eme`。矩阵 `id` `1115770797884751874` 是苏州和信的「HXJM-审批矩阵」,取自 `eteams.dbo.hrm_matrix.id`。经副理取值配置 `id` `1115771897387991041` 取自 `eteams.dbo.hrm_matrix_value_config`:`config_name` 为「经副理」,且 `matrix_id` 为上面这个矩阵。该配置 `config_type` 是 `resource`,`single_type = 1`(单选)。查人仍用 `hrm_matrix_value_data.relate_id`,不要把配置表的 `id` 当成人员 ID。`delete_type = 0` 为正常。同一矩阵下还有总经理等其他取值配置,不拿来当经副理。
|
||||
|
||||
矩阵 id 和经副理配置 id 按下面两条查出,不在代码里另找别的矩阵:
|
||||
|
||||
```sql
|
||||
-- 苏州和信「HXJM-审批矩阵」的 id。
|
||||
SELECT id
|
||||
FROM eteams.dbo.hrm_matrix
|
||||
WHERE tenant_key = 'temkc46eme'
|
||||
AND matrix_name = N'HXJM-审批矩阵'
|
||||
AND delete_type = 0
|
||||
AND enable_status = 1;
|
||||
-- 结果:1115770797884751874
|
||||
|
||||
-- 该矩阵下 config_name 为「经副理」的取值配置 id。
|
||||
SELECT id
|
||||
FROM eteams.dbo.hrm_matrix_value_config
|
||||
WHERE tenant_key = 'temkc46eme'
|
||||
AND matrix_id = 1115770797884751874
|
||||
AND config_name = N'经副理'
|
||||
AND delete_type = 0;
|
||||
-- 结果:1115771897387991041
|
||||
```
|
||||
|
||||
已用 `employee.DEPARTMENT = 1115763045510725632` 核对:`hrm_matrix_value_data.matrix_data_id` 没有这个值。因此这张矩阵不能把 `matrix_data_id` 直接当成部门 ID。部门 ID 改到条件表 `hrm_matrix_condition_data.relate_id` 里按字符串匹配,先取出矩阵数据行,再取值:
|
||||
|
||||
```sql
|
||||
-- 经副理。表都在 eteams.dbo,不能省库名。
|
||||
-- 返回的 relate_id 是人员 ID,再关联 eteams.dbo.employee.ID,不要当成企微 userid。
|
||||
-- :department_id 取当前处理人的 employee.DEPARTMENT,必须按字符串比较。
|
||||
-- 已用部门 1115763045510725632 跑通,返回一名经副理。
|
||||
SELECT v.relate_id
|
||||
FROM eteams.dbo.hrm_matrix_value_data AS v
|
||||
WHERE v.tenant_key = 'temkc46eme' -- 租户
|
||||
AND v.matrix_id = 1115770797884751874 -- hrm_matrix:苏州和信「HXJM-审批矩阵」的 id
|
||||
AND v.matrix_value_config_id = 1115771897387991041 -- hrm_matrix_value_config:该矩阵下 config_name 为「经副理」的 id,不是人员 ID
|
||||
AND v.delete_type = 0 -- 0 正常,1/2/3 都是删除
|
||||
AND v.matrix_data_id IN (
|
||||
-- 部门 ID 不在 matrix_data_id 上。先从条件表找出矩阵数据行。
|
||||
SELECT c.matrix_data_id
|
||||
FROM eteams.dbo.hrm_matrix_condition_data AS c
|
||||
WHERE c.tenant_key = 'temkc46eme'
|
||||
AND c.matrix_id = 1115770797884751874
|
||||
AND c.delete_type = 0
|
||||
AND c.relate_id = :department_id -- 字符串,例如 '1115763045510725632'
|
||||
)
|
||||
```
|
||||
|
||||
条件配置 id 还没限定。若同一部门对出多行,再按 `matrix_condition_config_id` 收窄。
|
||||
|
||||
## 5. 计时与停表在现有字段上怎么落
|
||||
|
||||
计时起点用 `sbsyrjssj`。已确认它只在第一次进入「使用部门担当」时写入一次,之后不改写。从该时间起到当前按自然日累计,换节点不重置。字段为空的单据视为尚未开始计时,不产生预警。
|
||||
|
||||
退回只看 `sfzfth`。OA 取值是 0=是、1=否。落库列 `is_returned` 先翻转成标准布尔:0 否,1 是。已确认取值:
|
||||
|
||||
| OA `sfzfth` | 本地 `is_returned` | 含义 | 预警 |
|
||||
| --- | --- | --- | --- |
|
||||
| `0` | `1` | 是,退回 | 立即停表,取消尚未发出的预警。不考虑从 `0` 改回 `1` 或空。 |
|
||||
| `1` | `0` | 否,流程正常 | 不因本字段停表 |
|
||||
| 空 | `0` | 否,流程正常 | 与 OA `1` 相同,不当成退回 |
|
||||
|
||||
字段中文名是「是否作废退回」,已确认的取值只区分退回和正常。作废、撤销仍看下一节的 `flowstatus`,不用 `sfzfth` 代替。出现 `0`、`1`、空以外的值时,不判退回,也不当正常,先记下来待确认。
|
||||
|
||||
不考虑 `sfzfth` 从 `0` 改回 `1` 或空。不把这种改写当作恢复计时或新周期。
|
||||
|
||||
是否可以正常验收看 `sfkyzcys`。OA 取值与常见布尔相反:0=是、1=否。落库列 `can_accept` 翻转成 0 否、1 是。空值不翻转成否。
|
||||
|
||||
| OA `sfkyzcys` | 本地 `can_accept` | 含义 | 预警 |
|
||||
| --- | --- | --- | --- |
|
||||
| `0` | `1` | 是,可以正常验收 | 其他条件也满足时继续计时 |
|
||||
| `1` | `0` | 否,不可以正常验收 | 立即停表,取消尚未发出的预警 |
|
||||
| 空 | 空 | 未标明 | 不纳入监控,不按「可以验收」处理 |
|
||||
|
||||
退回或无法验收后再进入,`sbsyrjssj` 仍是第一次写入的时间,签核天数就按它计算,不从 0 重计。不读取、不保存 `wfc_operate.operateround`。
|
||||
|
||||
## 5.1 流程实例与节点定义
|
||||
|
||||
OA 数据字典:
|
||||
|
||||
| 表 | 中文名 | 字典所属库 | 用途 |
|
||||
| --- | --- | --- | --- |
|
||||
| `wfc_requestbase` | 流程实例基本信息表 | `weaver_wfc` | 一条流程一行。状态、编号、最后操作节点。 |
|
||||
| `wfc_currentnode` | 流程当前节点表 | `weaver_wfc` | 流程当前停在哪个节点。没有处理人。 |
|
||||
| `wfp_node` | 工作流节点基础信息表 | `weaver_wfp` | 节点定义。用 `id` 取出节点名称和节点类型。 |
|
||||
|
||||
`wfc_currentnode` 字段:
|
||||
|
||||
| 字段 | 字典含义 | 用法 |
|
||||
| 事实 | E10 | E8 |
|
||||
| --- | --- | --- |
|
||||
| `requestid` | 流程实例 id。来源说明写着 `wfc_operate` | 等于 `wfc_requestbase.requestid` |
|
||||
| `nodeid` | 数据所在节点 ID。来源说明写着 `wfc_operate` | 等于 `wfp_node.id`,这是当前节点 |
|
||||
| `nodetype` | 节点类型 | 本表字典没有 0–9。类型以 `wfp_node.nodetype` 为准 |
|
||||
| `delete_type` | 是否删除 | 只取 `0` |
|
||||
| `operate_log_id` | 批次号 | 不查询、不保存 |
|
||||
| `creator` | 数据插入人 | 不是当前处理人 |
|
||||
| 验收单单号 | `ft_gdzcysdv2.ysddh` | `formtable_main_324.ysddh` |
|
||||
| 采购单号 | `cgdh` | `cgdh` |
|
||||
| 合同编号 | `htbh` | `htbh` |
|
||||
| 流程编号 | `wfc_requestbase.requestmark` | `formtable_main_324.lcbh` |
|
||||
| 标题 | `wfc_requestbase.requestname`。流程默认标题 | `workflow_requestbase.requestname` |
|
||||
| 创建时间 | `wfc_requestbase.createdatetime`。流程创建时间,不是 `create_time` | `workflow_requestbase.createdate` 加 `createtime` |
|
||||
| 计时起点 | `sbsyrjssj`。空 = 未开始 | `syddjssj`。空 = 未开始 |
|
||||
| 使用部门担当 | `sybmdd` = `eteams.employee.ID` | `sybmdd` = `HrmResource.id` |
|
||||
| 申请人(采购担当) | `sqr` = `employee.ID` | `workflow_requestbase.creater` = `HrmResource.id` |
|
||||
| 直接主管 | 该担当的 `employee.SUPERIOR` | 该担当部门的 `Matrixtable_3.zz` |
|
||||
| 经副理 | 该担当部门的 E10 矩阵 | 该担当部门的 `Matrixtable_3.jfl`。值就是企微 userid |
|
||||
| 退回 | `sfzfth`:0 退回,1 和空未退回 | `sfzfth`:同上 |
|
||||
| 可以验收 | `sfkyzcys`:0 可以,1 不可以,空未标明 | `sfkys`:同上 |
|
||||
| 无法验收说明 | `ycsm`,只留痕 | `ycsm`,只留痕 |
|
||||
| 当前节点 | `wfc_currentnode.nodeid` → `wfp_node.nodename` | `currentnodeid` → `workflow_nodebase.nodename` |
|
||||
| 当前处理人 | `wfc_operate.userid`。不读 `isremark`。只展示 | `workflow_currentoperator.userid`,且 `isremark = 0`。只展示 |
|
||||
| 审批中 / 归档 | `flowstatus` 1 / 3 | `currentnodetype` 0、1、2 / 3 |
|
||||
| 撤销 | `flowstatus` 为 7、8、99、-99 | `currentstatus = 1` |
|
||||
| 暂停 | `flowstatus = 7`,按撤销停表 | `currentstatus = 0`,同样写成 `7`,停表 |
|
||||
| 作废 / 强制结束 | `flowstatus` 5 / 4 | 没有,不查 |
|
||||
|
||||
可以验收为空仍监控。只有明确为否才停表,显示为无法验收。计时起点为空仍是未开始。
|
||||
|
||||
当前处理人不是收件人。第 1 档主送是使用部门担当,第 2 档主送是这个人的经副理。
|
||||
|
||||
## 2. E10
|
||||
|
||||
库:验收单 `ecology10`,人员 `eteams`,流程 `weaver_wfc`,节点 `weaver_wfp`。看不到 `weaver_wfc` / `weaver_wfp` 时,流程表和节点表改用 `ecology10` 里的同名表。
|
||||
|
||||
关联,只取 `delete_type = 0`:
|
||||
|
||||
1. `ft_gdzcysdv2.FORM_DATA_ID` = `wfc_form_data.dataid`
|
||||
2. `wfc_form_data.requestid` = `wfc_requestbase.requestid`
|
||||
3. `wfc_requestbase.requestid` = `wfc_currentnode.requestid`
|
||||
4. `wfc_currentnode.nodeid` = `wfp_node.id`,名称 `nodename`
|
||||
5. `wfc_operate.requestid`、`nodeid` 对上当前节点,人是 `userid`
|
||||
|
||||
`lastnodeid` 是刚办过的节点,不是当前节点。分流时当前节点可以多行,都保留。计时按整单,不按节点重置。
|
||||
|
||||
### 2.1 验收单 `ft_gdzcysdv2`
|
||||
|
||||
| 字段 | 含义 |
|
||||
| --- | --- |
|
||||
| `ysddh` | 验收单单号 |
|
||||
| `cgdh` | 采购单号 |
|
||||
| `htbh` | 合同编号。没有第二合同编号 |
|
||||
| `sbsyrjssj` | 计时起点。第一次进入使用部门担当时写入,之后不改 |
|
||||
| `sybmdd` | 使用部门担当,人员 ID |
|
||||
| `sbglry` | 设备管理人员,人员 ID |
|
||||
| `sqr` | 申请人,人员 ID |
|
||||
| `sfzfth` | 是否退回。0 是,1 和空否。作废不看这列 |
|
||||
| `sfkyzcys` | 是否可以正常验收。0 是,1 否,空未标明 |
|
||||
| `ycsm` | 无法验收说明 |
|
||||
|
||||
`syry`、`gzglry`、`dx`、`agent` 也是人员 ID,预警不用。流程编号和标题在流程表,不在这张验收单上。不读验收日期。
|
||||
|
||||
### 2.2 流程 `wfc_requestbase.flowstatus`
|
||||
|
||||
`status` 是文本,不拿来停表。结束时间用 `finishdatetime`,不读 `finshdatetime`。流程编号是 `requestmark`。标题是 `requestname`(流程默认标题),不用 `requestnamehtml` 和 `requestnametitle`。创建时间是 `createdatetime`,不用 `create_time`。
|
||||
|
||||
| 值 | 含义 | 预警 |
|
||||
| --- | --- | --- |
|
||||
| 0 | 草稿 | 不监控 |
|
||||
| 1 | 审批中 | 其他条件满足才计时 |
|
||||
| 3 | 正常归档 | 不抓取 |
|
||||
| 4 | 强制结束 | 停表 |
|
||||
| 5 | 已作废 | 停表 |
|
||||
| 6 | 待提交 | 不监控 |
|
||||
| 7 | 暂停 | 按撤销停表 |
|
||||
| 8 | 撤销 | 停表 |
|
||||
| 99、-99 | 撤销 | 停表 |
|
||||
|
||||
退回后 `flowstatus` 仍可能是 1。退回只看 `sfzfth = 0`。
|
||||
|
||||
### 2.3 人员
|
||||
|
||||
`eteams.employee`:`ID` 对人员字段和 `userid`,`USERNAME` 只展示,`JOB_NUM` 对 `users.employee_id`,发送用 `users.wecom_userid`。`DEPARTMENT` 查经副理,`SUPERIOR` 是直接主管的人员 ID。
|
||||
|
||||
经副理:用使用部门担当的 `DEPARTMENT` 对 `hrm_matrix_condition_data.relate_id`(字符串),取出 `matrix_data_id`,再在 `hrm_matrix_value_data` 取 `relate_id`。该值是人员 ID,再对 `employee.ID`,不是企微 userid。`matrix_data_id` 不是部门 ID。
|
||||
|
||||
固定条件:`tenant_key = temkc46eme`,矩阵 `1115770797884751874`(HXJM-审批矩阵),经副理配置 `1115771897387991041`,`delete_type = 0`。同一部门多行时再按 `matrix_condition_config_id` 收窄。
|
||||
|
||||
对不上人、没有主管或经副理:该席位失败,不改发给别人。
|
||||
|
||||
## 3. E8
|
||||
|
||||
库:`ecology`。人员主键是 `HrmResource.id`,不能对 `eteams.employee.ID`。
|
||||
|
||||
关联:
|
||||
|
||||
1. `ft_gdzcysdv2.FORM_DATA_ID` = `wfc_form_data.dataid`,且 `wfc_form_data.delete_type = 0`。验收单上没有流程编号列,不读 `requestmark`。
|
||||
2. `wfc_form_data.requestid` = `wfc_requestbase.requestid`。本地快照按这个 `requestid` 唯一。归档看 `flowstatus = 3`,不看验收日期。
|
||||
3. `wfc_requestbase.requestid` = `wfc_currentnode.requestid`,且 `wfc_currentnode.delete_type = 0`。
|
||||
4. `wfc_currentnode.nodeid` = `wfp_node.id`。展示名称用 `wfp_node.nodename`。
|
||||
5. 分流时一条流程可以有多行当前节点。这些行都保留,节点名称分别列出。计时仍按整单累计,不按节点重置。
|
||||
1. `formtable_main_324.requestId` = `workflow_requestbase.requestid`
|
||||
2. `workflow_requestbase.currentnodeid` = `workflow_nodebase.id`,名称 `nodename`
|
||||
3. `workflow_currentoperator.requestid` = `workflow_requestbase.requestid`,且 `nodeid` = `currentnodeid`,且 `isremark = 0`
|
||||
|
||||
`wfc_requestbase.lastnodeid` 仍是「最后操作节点 ID」,只表示刚办过的节点。当前节点以 `wfc_currentnode.nodeid` 为准。
|
||||
`lastnodeid` 不是当前节点。`isremark`:0 未操作,2 已操作,4 归档,8 / 9 抄送。只留 0。关联不上不跳过整单。不另存 `isremark`。计时不按节点名过滤。
|
||||
|
||||
`wfp_node.nodetype`:0 发起,1 审批,2 确认,3 结束,4 子流程节点,5 投票,6 循环审批,7 自动处理,8 等待,9 查阅。`nodeattr`:0 一般节点,1 分流点,2 分流中间点,3 合流点。`wfc_requestbase.lastnodetype` 只标了「最后操作流程节点类型」,字典没有给出 0–9。不把 `nodetype` 的枚举直接套到 `lastnodetype`。
|
||||
### 3.1 验收单 `formtable_main_324`
|
||||
|
||||
流程状态以 `flowstatus` 为准。同表的 `status` 是最长 1000 的文本,没有枚举,不拿来判断停表。
|
||||
| 字段 | 含义 |
|
||||
| --- | --- |
|
||||
| `cgdh` | 采购单号 |
|
||||
| `requestId` | 流程实例 ID |
|
||||
| `ysddh` | 验收单单号 |
|
||||
| `htbh` | 合同编号 |
|
||||
| `lcbh` | 流程编号 |
|
||||
| `syddjssj` | 使用担当接收时间。计时起点,之后不改 |
|
||||
| `sybmdd` | 使用部门担当,人员 ID |
|
||||
| `sfzfth` | 是否退回。0 是,1 和空否 |
|
||||
| `sfkys` | 是否可以正常验收。0 是,1 否,空未标明 |
|
||||
| `ycsm` | 无法验收说明。只留痕 |
|
||||
|
||||
| `flowstatus` | 字典含义 | 预警 |
|
||||
### 3.2 流程 `workflow_requestbase`
|
||||
|
||||
| 字段 | 值 | 含义 |
|
||||
| --- | --- | --- |
|
||||
| `0` | 草稿 | 不监控 |
|
||||
| `1` | 审批中 | 其他条件也满足时可以计时 |
|
||||
| `3` | 正常归档 | 停表,不恢复旧周期 |
|
||||
| `4` | 强制结束 | 流程已结束。业务未单列这一项,先按停表、不恢复处理 |
|
||||
| `5` | 已作废 | 停表,不恢复旧周期 |
|
||||
| `6` | 待提交 | 不按审批中处理 |
|
||||
| `7` | 暂停 | 已确认与撤销相同:停表,不再提醒,不恢复旧周期 |
|
||||
| `8` | 撤销 | 停表,不再提醒,不恢复旧周期 |
|
||||
| `99`、`-99` | `99` 为业务确认值;`-99` 是字典截断处 | 与撤销相同:停表,不再提醒 |
|
||||
| `currentnodetype` | 0、1、2 | 审批中。创建 / 批准 / 提交都算进行中 |
|
||||
| `currentnodetype` | 3 | 正常归档。不抓取 |
|
||||
| `currentstatus` | 空 | 流程正常。再看 `currentnodetype` |
|
||||
| `currentstatus` | 1 | 撤销,停表 |
|
||||
| `currentstatus` | 0 | 暂停。与 E10 一样停表,写成 `7` |
|
||||
| `currentnodeid` | | 当前节点 ID |
|
||||
| `lastnodeid` | | 最后操作节点,不是当前节点 |
|
||||
| `creater` | | 申请人,人员 ID。没有 `creator` 这一列 |
|
||||
| `requestname` | | 标题 |
|
||||
| `createdate` | | 创建日期。与 `createtime` 拼成创建时间 |
|
||||
| `createtime` | | 创建时分秒 |
|
||||
|
||||
字典没有值为「退回」的流程状态。退回后 `flowstatus` 仍可能是 `1`(审批中)。退回以验收单 `sfzfth = 0` 为准,不从 `flowstatus` 推断。
|
||||
没有作废、强制结束。不把任何值写成这两类。`currentstatus` 出现空、0、1 以外的值时,不当成正常。`status` 是文本,不拿来停表。`deleted` 是是否删除,不当作废。
|
||||
|
||||
`finishdatetime` 是流程归档时间。字典另有拼写 `finshdatetime`(少一个 i),含义写成「流程归档时间、作废时间」。现场列清单里是 `finishdatetime`。查询只用 `finishdatetime`,不查 `finshdatetime`。
|
||||
### 3.3 人员
|
||||
|
||||
`lastoperator` 是最后操作人,`wfc_currentnode.creator` 是插行的人,都不是当前待办人。`delete_type` 是记录是否删除,不是作废。作废看 `flowstatus = 5`。
|
||||
使用部门担当、申请人:`HrmResource.id` 取姓名,`workcode` 对 `users.employee_id`,发送用 `users.wecom_userid`。
|
||||
|
||||
## 5.2 流程操作人
|
||||
直接主管和经副理:用该担当的 `departmentid` 对 `Matrixtable_3.bm`,必须只命中一行。`zz` 是直接主管,`jfl` 是经副理。这两个值就是 `HrmResource.id`,也是企微 userid,发送时直接用。无部门、不是一行或对不上,该席位失败,不改发给别人。
|
||||
|
||||
表:`weaver_wfc.dbo.wfc_operate`,中文名「流程操作人表」。当前处理人在这张表。
|
||||
## 4. 状态对照里已经落地的决定
|
||||
|
||||
| 字段 | 字典含义 | 用法 |
|
||||
| --- | --- | --- |
|
||||
| `requestid` | 流程实例 id | 等于 `wfc_currentnode.requestid` |
|
||||
| `nodeid` | 数据所在节点 ID | 等于 `wfc_currentnode.nodeid`。只取当前节点上的操作人 |
|
||||
| `userid` | 操作人 id | 当前处理人。关联 `eteams.dbo.employee.ID` |
|
||||
| `processuser` | 实际操作人 ID | 已经代办或实际点过的人。待办人取 `userid`,不取这一列 |
|
||||
| `usertype` | 人员类型 | 字典没有取值。先按 `userid` 关联员工,关联不上记失败 |
|
||||
| `isremark` | 操作状态 | 不查询、不保存。当前处理人就是当前节点上的 `userid` |
|
||||
| `preisremark` | 插入时的操作状态,插入后不变更 | 不查询、不保存 |
|
||||
| `operatedatetime` | 操作日期时间 | 已办才会有操作时间。不能单靠它为空就把抄送、转发都算成待办 |
|
||||
| `showorder` | 未操作者的显示顺序 | 说明表里包含未操作的人 |
|
||||
| `operateround` | 节点第几次到达 | 不查询、不保存 |
|
||||
| `isbereject` | 是否退回操作 | 字典没有 0/1。退回仍以 `sfzfth = 0` 为准 |
|
||||
| `isprocessing` | 执行中时,流程不出现在待办、已办 | 字典没有哪个值表示执行中。该状态的行不发预警 |
|
||||
| `delete_type` | 是否删除 | 只取 `0` |
|
||||
| `optgroupid` | 操作者批次 | 不查询、不保存 |
|
||||
| `batch_number` | 批次号 | 不查询、不保存。与 `wfc_currentnode.operate_log_id` 一样不参与预警 |
|
||||
|
||||
当前节点上的 `userid` 都是当前处理人。同一人只留一行。直接主管、经副理按各人展开后去重。会签关系 `signorder` 的取值未给,不改变「这些人都要通知」。
|
||||
|
||||
## 6. 查询形态
|
||||
|
||||
同一实例上跨库只读,不把人员 ID 当姓名用。
|
||||
|
||||
```sql
|
||||
SELECT
|
||||
f.ysddh,
|
||||
f.cgdh,
|
||||
f.htbh,
|
||||
f.sbsyrjssj,
|
||||
f.sfzfth,
|
||||
f.sfkyzcys,
|
||||
f.ycsm,
|
||||
f.sybmdd,
|
||||
owner.USERNAME AS owner_name,
|
||||
owner.JOB_NUM AS owner_job_num,
|
||||
f.sbglry,
|
||||
equip.USERNAME AS equip_name,
|
||||
equip.JOB_NUM AS equip_job_num,
|
||||
f.sqr,
|
||||
applicant.USERNAME AS applicant_name,
|
||||
applicant.JOB_NUM AS applicant_job_num,
|
||||
r.requestid,
|
||||
r.flowstatus,
|
||||
r.finishdatetime,
|
||||
c.nodeid,
|
||||
n.nodename,
|
||||
n.nodetype,
|
||||
op.userid,
|
||||
handler.USERNAME AS handler_name,
|
||||
handler.JOB_NUM AS handler_job_num
|
||||
FROM ecology10.dbo.ft_gdzcysdv2 AS f
|
||||
LEFT JOIN eteams.dbo.employee AS owner ON owner.ID = f.sybmdd
|
||||
LEFT JOIN eteams.dbo.employee AS equip ON equip.ID = f.sbglry
|
||||
LEFT JOIN eteams.dbo.employee AS applicant ON applicant.ID = f.sqr
|
||||
LEFT JOIN weaver_wfc.dbo.wfc_form_data AS d
|
||||
ON d.dataid = f.FORM_DATA_ID
|
||||
AND d.delete_type = 0
|
||||
LEFT JOIN weaver_wfc.dbo.wfc_requestbase AS r
|
||||
ON r.requestid = d.requestid
|
||||
AND r.delete_type = 0
|
||||
LEFT JOIN weaver_wfc.dbo.wfc_currentnode AS c
|
||||
ON c.requestid = r.requestid
|
||||
AND c.delete_type = 0
|
||||
LEFT JOIN weaver_wfp.dbo.wfp_node AS n
|
||||
ON n.id = c.nodeid
|
||||
AND n.delete_type = 0
|
||||
LEFT JOIN weaver_wfc.dbo.wfc_operate AS op
|
||||
ON op.requestid = c.requestid
|
||||
AND op.nodeid = c.nodeid
|
||||
AND op.delete_type = 0
|
||||
LEFT JOIN eteams.dbo.employee AS handler ON handler.ID = op.userid;
|
||||
```
|
||||
|
||||
验收单上没有流程编号、第二合同编号和验收日期,这三列不查询、也不写入本地表。归档只看 `flowstatus = 3`。不查询 `isremark`。当前节点上的 `userid` 就是当前处理人,同一人只留一行。一条流程有多个当前节点、每个节点有多名操作人时,这个查询会返回多行。库名按第 2 节:看不到 `weaver_wfc` / `weaver_wfp` 时改为 `ecology10`。`syry`、`gzglry`、`dx`、`agent` 需要展示或发通知时,按同样方式再关联 `employee`。不在应用里先全量拉人再在内存里对 ID。
|
||||
|
||||
## 7. 和需求规则的对照
|
||||
|
||||
| 需求事实 | 现在的来源 | 缺口 |
|
||||
| ---------------------- | -------------------------- | --------------------------- |
|
||||
| 验收单单号 | `ysddh` | 无 |
|
||||
| 采购单号 | `cgdh` | 无 |
|
||||
| 一张流程的身份 | `wfc_requestbase.requestid` | 不保存流程编号。验收日期不参与归档。 |
|
||||
| 计时起点 | `sbsyrjssj`,只写一次、不覆盖 | 再进入也用这个时间,不从 0 重计。 |
|
||||
| 使用部门担当 | `sybmdd` → `employee` | 无 |
|
||||
| 申请人(采购担当) | `sqr` → `employee` | 已确认是人员 ID |
|
||||
| 作废 | `flowstatus = 5` | 不看 `sfzfth` |
|
||||
| 撤销 | `flowstatus` 为 `7`、`8`、`99`、`-99` | 都停表且不再提醒。本地状态 `stopped_revoked` |
|
||||
| 退回 | OA `sfzfth = 0`,本地 `is_returned = 1` | `1` 和空都是未退回,本地写成 `0`。 |
|
||||
| 归档、未归档 | `flowstatus`:`3` 正常归档,`1` 审批中 | `4` 强制结束先按结束。 |
|
||||
| 当前节点名称 | `wfc_currentnode.nodeid` → `wfp_node.nodename` | 分流时可能多行,都保留。`lastnodeid` 不是当前节点 |
|
||||
| 当前处理人 | `wfc_operate.userid`,对齐当前 `requestid` + `nodeid` | 不使用 `isremark`。同一人只留一行 |
|
||||
| 可以正常验收 | OA `sfkyzcys`:`0` 可以,`1` 不可以。本地 `can_accept` 为 `1` 可以、`0` 不可以 | 空值不监控,也不写成 0。说明正文是 `ycsm`。 |
|
||||
| 直接主管 | 当前处理人的 `employee.SUPERIOR` | 人员 ID,再关联 `employee` |
|
||||
| 经副理 | `eteams.dbo.hrm_matrix_value_data.relate_id`。部门 ID 在 `eteams.dbo.hrm_matrix_condition_data.relate_id` | 查询已用部门 `1115763045510725632` 跑通。`matrix_data_id` 不是部门 ID |
|
||||
| 再次进入 | 仍用第一次的 `sbsyrjssj` | 不从 0 重计。不看 `sfzfth` 是否从 `0` 改回正常。不用 `operateround`。 |
|
||||
| 固定岗位三人 | 界面配置 | 不读 OA |
|
||||
|
||||
## 8. 已实现的同步
|
||||
|
||||
平台管理员调用 `POST /api/equipment-acceptance/sync`。连接只用 `OA_E10_SQLSERVER_HOST`、`OA_E10_SQLSERVER_USERNAME`、`OA_E10_SQLSERVER_PASSWORD`,不回退 E8 的 `OA_SQLSERVER_*`。库名先按字典;实例里没有 `weaver_wfc` 或 `weaver_wfp` 时,流程表和节点表改用 `ecology10`。人员库只认 `eteams`。
|
||||
|
||||
本地表保存 OA 同步快照,另有一张发送记录表。一张验收单在 `equipment_acceptance_orders` 里一行,当前节点和操作人在另外两张表。每次同步按 `request_id` 更新主表,并整批替换该单的节点和操作人。主表删除时,节点和操作人随外键级联删除,发送记录只把 `order_id` 置空并保留单号快照。不保存流程编号、第二合同编号和验收日期。归档看 `flow_status_raw = 3`,不看验收日期。每日扫描写入发送记录;停表时取消还没发出的行。
|
||||
|
||||
### 8.1 `equipment_acceptance_orders`
|
||||
|
||||
一张验收单的最近一次同步结果。`request_id` 唯一。
|
||||
|
||||
| 字段 | 含义 |
|
||||
| --- | --- |
|
||||
| `id` | 本地主键 |
|
||||
| `request_id` | OA 流程实例 ID,来自 `wfc_requestbase.requestid`。一张流程一行 |
|
||||
| `acceptance_no` | 验收单单号,来自 `ysddh` |
|
||||
| `purchase_order_no` | 采购单号,来自 `cgdh` |
|
||||
| `contract_no` | 合同编号,来自 `htbh` |
|
||||
| `timer_started_at` | 计时起点,来自 `sbsyrjssj`。空表示还没开始计时 |
|
||||
| `dwell_days` | 签核天数。归档、强制结束、作废且有 `finished_at` 时停在结束日,否则算到同步日 |
|
||||
| `can_accept` | 是否可以正常验收。**0 否,1 是,空表示未标明。** 由 OA `sfkyzcys` 翻转而来,OA 是 0 是、1 否。空不写成 0 |
|
||||
| `cannot_accept_note` | 无法验收说明正文,来自 `ycsm`。空表示没有说明。不参与停表判断 |
|
||||
| `is_returned` | 是否退回。**0 否,1 是。** 由 OA `sfzfth` 翻转而来,OA 是 0 是、1 否。OA 的 1 和空都收成 0 |
|
||||
| `flow_status_raw` | `wfc_requestbase.flowstatus` 原值。1 审批中,3 正常归档,4 强制结束,5 已作废 |
|
||||
| `finished_at` | 流程结束时间,来自 `finishdatetime`。不拿它判断是否归档 |
|
||||
| `request_match_count` | 这一行对应的流程实例数,现在固定为 1 |
|
||||
| `owner_oa_id` / `owner_name` / `owner_job_num` | 使用部门担当。人员 ID 来自 `sybmdd`,姓名和工号来自 `employee` |
|
||||
| `equip_oa_id` / `equip_name` / `equip_job_num` | 设备管理人员,来自 `sbglry` |
|
||||
| `applicant_oa_id` / `applicant_name` / `applicant_job_num` | 申请人(采购担当),来自 `sqr` |
|
||||
| `monitor_status` | 监控状态,取值见下表 |
|
||||
| `present_in_source` | 这次同步是否还能在 OA 里看到这张单。看不到时保留上次内容,只把本列改成否 |
|
||||
| `synced_at` | 最近一次同步时间 |
|
||||
| `created_at` / `updated_at` | 本地创建、更新时间 |
|
||||
|
||||
`monitor_status`:
|
||||
|
||||
| 值 | 含义 |
|
||||
| --- | --- |
|
||||
| `watching` | 进行中。审批中、可以验收、未退回、已有计时起点 |
|
||||
| `not_started` | 未开始。没有计时起点,且没有更优先的停表原因 |
|
||||
| `stopped_returned` | 已退回。`is_returned = 1` |
|
||||
| `stopped_cannot_accept` | 无法验收。`can_accept = 0` |
|
||||
| `stopped_archived` | 已归档。`flow_status_raw = 3`,之后不再追踪预警 |
|
||||
| `stopped_force_finished` | 已强制结束。`flow_status_raw = 4` |
|
||||
| `stopped_voided` | 已作废。`flow_status_raw = 5` |
|
||||
| `stopped_revoked` | 已撤销,不再提醒。`flow_status_raw` 为 `7`、`8`、`99` 或 `-99` |
|
||||
| `excluded` | 不在监控范围。不含上面的撤销取值 |
|
||||
|
||||
退回、无法验收先于作废、归档、强制结束和撤销。撤销即使没有计时起点也记为 `stopped_revoked`,不记成未开始。归档、强制结束、作废、撤销且有 `finished_at` 时,签核天数截止到该日。`optgroupid`、`batch_number`、`operate_log_id` 不查询、不保存。
|
||||
|
||||
### 8.2 `equipment_acceptance_nodes`
|
||||
|
||||
这张单当前停在哪些节点。同一张单可以有多行,分流时每个当前节点一行。同一张单里 `order_id` + `node_id` 不重复。
|
||||
|
||||
| 字段 | 含义 |
|
||||
| --- | --- |
|
||||
| `id` | 本地主键 |
|
||||
| `order_id` | 对应 `equipment_acceptance_orders.id` |
|
||||
| `node_id` | OA 当前节点 ID,来自 `wfc_currentnode.nodeid` |
|
||||
| `node_name` | 节点名称,来自 `wfp_node.nodename` |
|
||||
| `node_type` | 节点类型原值,来自 `wfp_node.nodetype`。0 发起,1 审批,2 确认,3 结束,4 子流程,5 投票,6 循环审批,7 自动处理,8 等待,9 查阅 |
|
||||
|
||||
`lastnodeid` 不写入本表。
|
||||
|
||||
### 8.3 `equipment_acceptance_operators`
|
||||
|
||||
当前节点上的操作人。同一节点同一人只留一行。不保存 `isremark`。
|
||||
|
||||
| 字段 | 含义 |
|
||||
| --- | --- |
|
||||
| `id` | 本地主键 |
|
||||
| `order_id` | 对应 `equipment_acceptance_orders.id` |
|
||||
| `node_id` | 这个人所属的当前节点 |
|
||||
| `user_id` | OA 操作人 ID,来自 `wfc_operate.userid` |
|
||||
| `handler_name` | 操作人姓名 |
|
||||
| `handler_job_num` | 操作人工号 |
|
||||
|
||||
扫描按这张表的当前处理人展开直接主管和经副理。直接主管、经副理不在本表,查询时再读 E10。
|
||||
|
||||
`GET /api/equipment-acceptance/orders` 分页列表。`focus` 取 `watching`、`overdue`、`stopped`、`not_started`;`overdue` 是计时中且签核天数超过配置里的第 1 档,默认 30。响应里的 `summary` 始终统计全部单据。`GET /api/equipment-acceptance/orders/<id>` 含当前节点操作人。人员主键以字符串返回。平台管理员,或被授予启用中 Agent 的用户,可以打开列表和详情。同步仍只给平台管理员。停留列表四张汇总卡是进行中、已逾期、不再提醒、未开始。计时中且超过 30 天显示已逾期,未超过显示未超时。停留列表不显示第几档。
|
||||
|
||||
### 8.4 `equipment_acceptance_send_records`
|
||||
|
||||
一张验收单某一档的发送记录。同一张单同一档只有一行。待发送和解析失败的行每次扫描按当前处理人和当前岗位重算;已发送、已取消的姓名不再改写。Chat 页签「发送记录」读 `GET /api/equipment-acceptance/sends`。
|
||||
|
||||
| 字段 | 含义 |
|
||||
| --- | --- |
|
||||
| `id` | 本地主键 |
|
||||
| `order_id` | 对应 `equipment_acceptance_orders.id`。验收单被删时置空 |
|
||||
| `acceptance_no` / `purchase_order_no` | 写入时的验收单单号、采购单号 |
|
||||
| `tier` | 第几档,1 到 4 |
|
||||
| `threshold_days` | 这一档当时的天数,例如 30 |
|
||||
| `to_text` / `cc_text` | 解析成功的主送、抄送姓名,用顿号拼接 |
|
||||
| `recipients_json` | 每个席位的角色、姓名、系统用户、企微 userid、OA 人员 ID 和失败原因 |
|
||||
| `status` | `pending` 待发送,`sent` 已发送,`failed` 解析或发送失败,`cancelled` 已取消 |
|
||||
| `sent_at` | 发出时间。只有 `sent` 才有 |
|
||||
| `error_message` | 解析失败或企业微信发送失败的原因。能发出的人仍会发送 |
|
||||
| `created_at` | 记录生成时间 |
|
||||
|
||||
页面入口与合同付款预警相同:迁移写入内置 Chat Agent,`agent_code=equipment_acceptance`,`conversation_mode=task_chat`。对话页按该编码替换消息列表和输入框,页签是停留情况、发送记录和预警配置。普通用户要在用户管理里授予该 Agent 后才看得到。
|
||||
|
||||
`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. 扫描与发送
|
||||
|
||||
每天 06:00(Asia/Shanghai)排程 `equipment-acceptance-alert-scan` 先同步 E10,再按签核天数生成待发送。超过配置天数才进档,刚好等于还不发。默认 30/37/44/51。同一张单每一档只生成一次;已发送和已取消不重算、不重发。
|
||||
|
||||
收件人:
|
||||
|
||||
- 超过第 1 档:主送当前处理人,抄送其 `employee.SUPERIOR` 和申请人。
|
||||
- 超过第 2 档:主送各处理人部门的经副理,抄送配置里的 COO 和采购经副理。
|
||||
- 超过第 3 档:主送 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`。紧跟着一条文件消息《设备验收停留提醒.xlsx》,列是验收单号、采购单号、申请人、轮次、停留天数、当前节点、当前处理人、通知身份。卡片不写主送、抄送,也不逐条列出验收单。卡片和文件都成功才改为已发送。任一失败则整档改为失败,并写上卡片或附件的原因;下次扫描会按当前处理人重算并回到待发送。每位收件人的 Excel 写入 `equipment_acceptance_send_files`,并记下对应的发送记录。发送失败也保留。发送记录表用 Excel 附件列下载,同一行可有多份。已发出的企业微信不撤回。
|
||||
|
||||
停表(归档、退回、撤回、作废、无法验收,以及强制结束)时,待发送和解析失败且还没 `sent_at` 的行改为已取消。
|
||||
|
||||
管理员在发送记录页可以立即「扫描预警」和「发送预警」,对应 `POST /api/equipment-acceptance/alerts/scan` 和 `POST /api/equipment-acceptance/alerts/send`。两个排程启动时写入,已有同编号时不覆盖。Cron 在排程页改,不在预警配置页。
|
||||
|
||||
不查询、不保存 `isremark`。不接 Dify。不给「使用部门担当」之前的节点单独计时。读 OA `sfkyzcys`、`sfzfth` 时仍是 0 表示是、1 表示否,禁止把 OA 原值直接写进 `can_accept`、`is_returned`。`ycsm` 只保存说明,不拿它判断能不能验收。
|
||||
|
||||
数据库升到迁移 `ea8c0a1b2c3d` 后,快照、配置和带收件人明细的发送记录一次建好,扫描才能落库。
|
||||
E8 `currentstatus = 0` 按 E10 的暂停处理:停表,本地流程状态写成 `7`。空、`0`、`1` 以外不写成审批中。
|
||||
@@ -0,0 +1,130 @@
|
||||
# 制程品质异常预警需求说明
|
||||
|
||||
> **版本**:V1.0
|
||||
> **更新日期**:2026-10-23
|
||||
> **状态**:规则已整理,尚未实现。OA 表、字段和 OA 邮件发送方式见后续设计文档。第 9 节三项仍待确认。
|
||||
> **适用范围**:OA 制程品质异常通知单的滚动统计,以及按料号 + 不良类别向品质担当和升级对象发送 OA 邮件
|
||||
|
||||
## 1. 背景与目标
|
||||
|
||||
制程品质异常通知单已经在 OA 中流转。同一料号、同一不良类别在近一年内反复出现时,需要按固定节奏提醒品质担当,并在当月再次发生时按次数升级到品质、生产经副理、COO 和老板。
|
||||
|
||||
本需求只定义统计、升级和推送规则。不改 OA 流程本身,也不回写异常单。
|
||||
|
||||
## 2. 范围
|
||||
|
||||
### 2.1 本期已确认
|
||||
|
||||
- 统计键、计次日期、纳入状态、近一年窗口、当月窗口。
|
||||
- 品质担当周报与三档升级的收件人、抄送、不补发和同月不重复。
|
||||
- 通知渠道是 OA 邮件。按收件人汇总,不逐单发信。
|
||||
- 品质担当、品质、生产经副理、COO、老板五个岗位在界面配置。代码和配置文件不写死姓名或账号。品质担当与升级档里的「品质」是两个配置项。
|
||||
|
||||
### 2.2 本期不做
|
||||
|
||||
- 不接 Dify 对话。
|
||||
- 不回写 OA 异常单,不改流程状态。
|
||||
- 不撤回已发出的邮件。
|
||||
- 不为已过去的自然月补发升级信。
|
||||
|
||||
OA 流程表、workflow、料号、不良类别、申请日期的字段名,以及 OA 邮件怎么发,写在后续设计文档,不在本需求里展开。
|
||||
|
||||
## 3. 统计对象
|
||||
|
||||
数据源是 OA「制程品质异常通知单」。一笔计入统计的单据同时满足:
|
||||
|
||||
- 流程处于归档或在途。
|
||||
- 流程不是废弃,也不是撤销。
|
||||
|
||||
不按会签判定结果再过滤。料号按单据原值统计,不去斜杠、不截断、不与其他料号合并。不良项目、机种不参与合并。
|
||||
|
||||
统计键是 **料号 + 不良类别**。近一年和当月都用 **申请日期** 判断落在哪个区间。
|
||||
|
||||
## 4. 两个计数
|
||||
|
||||
两个计数分开。近一年决定要不要预警,当月笔数决定升级给谁。
|
||||
|
||||
### 4.1 近一年
|
||||
|
||||
申请日期落在 **扫描日减 1 年(含)到扫描日前 1 天(含)**。申请日期等于扫描日的单据不计入近一年。
|
||||
|
||||
扫描日 2026-10-23 时,区间是 2025-10-23 至 2026-10-22,两端都含。扫描日为闰年 2 月 29 日时,起始日取前一年 2 月 28 日。
|
||||
|
||||
同一键在这个区间内的合格单据笔数 ≥ 3,才进入预警。
|
||||
|
||||
### 4.2 当月
|
||||
|
||||
按申请日期所在自然月计。该月 1 日到月末都算,含扫描日当天。10 月就是 10 月 1 日到 10 月 31 日。
|
||||
|
||||
申请日期为扫描日当天的单据计入当月,次日才进入近一年。当月笔数只决定升级档,不能单独把近一年不足 3 次的键送进预警。
|
||||
|
||||
例:8 月已有 3 笔,10 月 1 日 1 笔,10 月 23 日又 1 笔。10 月 23 日扫描时,近一年已 ≥ 3(不含当天这一笔),当月是第 2 次,走 COO。
|
||||
|
||||
## 5. 升级与收件人
|
||||
|
||||
升级不补发跳过的档。
|
||||
|
||||
- 近一年这次刚到 3,但这笔已是当月第 2 笔时,只走 COO,不补「当月首次」。
|
||||
- 两次扫描之间当月笔数从 1 直接到 3 及以上时,只走老板档,不补首次和第二次。
|
||||
- 已过去的自然月不补发。
|
||||
|
||||
同一键、同一自然月,只在当月笔数进入更高档的那一周发一次升级信。之后几周停在同一档不再发。下个自然月从 0 重新计。近一年仍 ≥ 3 时,新月份的第一笔再走首次档。
|
||||
|
||||
| 条件 | 主送 | 抄送 |
|
||||
| --- | --- | --- |
|
||||
| 近一年 ≥ 3,且当月 1 笔,本月未发过该档 | 品质、生产经副理 | 无 |
|
||||
| 近一年 ≥ 3,且当月 2 笔,本月未发过该档 | COO | 无 |
|
||||
| 近一年 ≥ 3,且当月 ≥ 3 笔,本月未发过该档 | 老板 | COO、品质、生产经副理 |
|
||||
|
||||
当月 0 笔时不发升级信。品质担当周报不看当月笔数,见第 6 节。
|
||||
|
||||
五个岗位的具体人员尚未指定,见第 9 节。上线前必须能在界面配置,不能写死在代码或环境文件里。
|
||||
|
||||
## 6. 推送
|
||||
|
||||
渠道是 OA 邮件。每周扫描一次,按收件人汇总成一封,不逐单刷屏。同一周可以同时有周报和升级信:周报里有这个料号,升级信再发给该档收件人。
|
||||
|
||||
### 6.1 品质担当周报
|
||||
|
||||
每周一封。列出当前近一年仍 ≥ 3 的全部料号 + 不良类别。条件一直成立就每周都发,不因上周已发过而跳过。
|
||||
|
||||
### 6.2 升级信
|
||||
|
||||
只发给第 5 节当前档的主送和抄送。同一键、同一自然月、同一档只发一次。
|
||||
|
||||
## 7. 建议默认
|
||||
|
||||
以下四项先按这个写,确认前可以改:
|
||||
|
||||
- 入口做成内置 Chat Agent,不接 Dify。默认页是 Dashboard,其余页签为异常清单、发送记录、收件人配置。管理员可手动扫描。形态对齐设备验收预警。可点击原型见 [process-quality-alert-prototype.html](process-quality-alert-prototype.html)。本期只冻结规则,不在本文件展开页面。
|
||||
- 发送时刻可配置,初始为每周五 18:00,与合同付款预警、设备验收预警一致。
|
||||
- 上线第一周只发品质担当全量周报,不为已经处在当月第 2、第 3 档的历史组合补发升级。
|
||||
- 邮件明细至少包含:单号、申请日期、机种、料号、不良类别、不良项目、不良发生部、近一年次数、当月次数。
|
||||
|
||||
## 8. 留给设计文档
|
||||
|
||||
- OA 流程表、workflow、料号、不良类别、申请日期等字段名,以及怎么接入制程品质异常通知单。
|
||||
- OA 邮件的发送方式。本需求只定渠道是 OA 邮件。
|
||||
|
||||
## 9. 待确认
|
||||
|
||||
确认前,下面三项不算冻结:
|
||||
|
||||
- 一单多行、每行不良类别不同时,是否按行各计 1 次。
|
||||
- 不良类别为空的行是否排除。
|
||||
- 品质担当、品质、生产经副理、COO、老板五个岗位的具体人员。
|
||||
|
||||
## 10. 验收标准
|
||||
|
||||
| 编号 | 条件 | 期望 |
|
||||
| --- | --- | --- |
|
||||
| AC-01 | 扫描日 2026-10-23 | 近一年只计申请日期 2025-10-23 至 2026-10-22。申请日期为 2026-10-23 的单据只计入 10 月,不计入近一年 |
|
||||
| AC-02 | 同一料号 + 不良类别在近一年内不足 3 笔 | 不进周报,不发升级信 |
|
||||
| AC-03 | 近一年 ≥ 3,当月 0 笔 | 只出现在品质担当周报 |
|
||||
| AC-04 | 近一年 ≥ 3,当月第 1 / 2 / ≥3 笔,且本月该档未发过 | 分别主送品质+生产经副理、COO、老板。老板档抄送 COO、品质、生产经副理 |
|
||||
| AC-05 | 8 月已有 3 笔,10 月 1 日 1 笔,10 月 23 日再 1 笔,扫描日为 10 月 23 日 | 近一年 ≥ 3,当月第 2 次,主送 COO,不补首次档 |
|
||||
| AC-06 | 同一次扫描中当月笔数从 1 跨到 ≥ 3 | 只发老板档,不补首次和第二次 |
|
||||
| AC-07 | 同一档已在本月发过,后续周当月笔数没有进入更高档 | 品质担当仍收周报;升级对象不再收同一档 |
|
||||
| AC-08 | 单据为废弃或撤销 | 不计入近一年,也不计入当月 |
|
||||
| AC-09 | 单据为归档或在途 | 按申请日期计入对应区间 |
|
||||
| AC-10 | 料号原文带空格或符号 | 按原值与不良类别组成统计键,不另做清洗 |
|
||||
@@ -0,0 +1,743 @@
|
||||
<!doctype html>
|
||||
<!--
|
||||
docs/features/process-quality-alert/process-quality-alert-prototype.html
|
||||
用途:制程品质异常预警的可点击评审原型,用样例数据演示近一年窗口、当月升级和 OA 邮件汇总。
|
||||
依赖:浏览器原生 HTML/CSS/JavaScript,无需构建。
|
||||
逻辑:与 demand.md 对齐;不接 OA、不发邮件。默认打开 Dashboard。
|
||||
假设:一单一行计 1 次;样例不含空不良类别。五个岗位人员仍待确认,收件人页改称呼只改写信封。
|
||||
-->
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1" />
|
||||
<title>制程品质异常预警 · 原型</title>
|
||||
<style>
|
||||
:root { --ink:#142033; --muted:#64748b; --line:#dce4ef; --bg:#f4f7fb; --nav:#111c31; --brand:#2563eb; --soft:#eaf2ff; --green:#067647; --amber:#b54708; --red:#b42318; }
|
||||
* { box-sizing:border-box; }
|
||||
body { margin:0; background:var(--bg); color:var(--ink); font:14px/1.5 "Segoe UI","Microsoft YaHei",sans-serif; }
|
||||
button,select,input { font:inherit; }
|
||||
button { cursor:pointer; }
|
||||
.top { display:flex; justify-content:space-between; gap:16px; align-items:center; padding:12px 24px; background:var(--nav); color:#fff; }
|
||||
.top small { color:#aac0db; margin-left:8px; }
|
||||
.tabs { display:flex; gap:5px; flex-wrap:wrap; }
|
||||
.tabs button { border:0; border-radius:7px; padding:7px 11px; color:#c5d3e6; background:transparent; font-weight:700; font-size:12px; }
|
||||
.tabs button.active { color:#fff; background:var(--brand); }
|
||||
main { width:min(1180px,calc(100% - 32px)); margin:auto; padding:22px 0 48px; }
|
||||
.view { display:none; }
|
||||
.view.active { display:block; }
|
||||
.note { margin:0 0 14px; padding:10px 12px; border:1px solid #c9dcfb; border-radius:10px; background:#f3f8ff; color:#334155; font-size:12px; }
|
||||
.hero { display:flex; justify-content:space-between; gap:16px; align-items:flex-start; margin-bottom:14px; }
|
||||
.hero h1 { margin:0; font-size:22px; }
|
||||
.hero p { margin:4px 0 0; color:var(--muted); }
|
||||
.windows { display:flex; flex-wrap:wrap; gap:8px; margin-top:10px; }
|
||||
.windows span { padding:4px 8px; border-radius:99px; background:#fff; border:1px solid var(--line); font-size:12px; font-weight:700; }
|
||||
.btn { border:1px solid var(--line); border-radius:8px; padding:8px 11px; background:#fff; font-size:12px; font-weight:700; }
|
||||
.btn.primary { border-color:var(--brand); color:#fff; background:var(--brand); }
|
||||
.kpis { display:grid; grid-template-columns:repeat(5,minmax(0,1fr)); gap:12px; margin-bottom:14px; }
|
||||
.kpis button { text-align:left; border:1px solid var(--line); border-radius:12px; background:#fff; padding:14px 16px; }
|
||||
.kpis button:hover,.kpis button.active { border-color:#93c5fd; background:#f8fbff; }
|
||||
.kpis b { display:block; font-size:26px; }
|
||||
.kpis span { color:var(--muted); font-size:12px; }
|
||||
.card { border:1px solid var(--line); border-radius:12px; background:#fff; overflow:hidden; }
|
||||
.split { display:grid; grid-template-columns:1.15fr .85fr; gap:14px; margin-bottom:14px; }
|
||||
.hd { display:flex; justify-content:space-between; gap:12px; align-items:flex-start; padding:14px 16px 0; }
|
||||
.hd h2 { margin:0; font-size:15px; }
|
||||
.bd { padding:14px 16px 16px; }
|
||||
.bar { display:grid; grid-template-columns:132px 1fr 28px; gap:8px; align-items:center; margin:8px 0; font-size:12px; }
|
||||
.bar i { display:block; height:10px; border-radius:99px; background:#dbeafe; }
|
||||
.bar i span { display:block; height:100%; border-radius:99px; background:#2563eb; }
|
||||
.bar .amber span { background:#d97706; }
|
||||
.bar .red span { background:#dc2626; }
|
||||
.bar .green span { background:#059669; }
|
||||
.mails { display:grid; gap:8px; }
|
||||
.mail-row { display:flex; justify-content:space-between; gap:8px; padding:8px 10px; border:1px solid var(--line); border-radius:10px; font-size:12px; }
|
||||
.mail-row b { font-size:16px; }
|
||||
.filters { display:flex; flex-wrap:wrap; gap:8px; padding:12px; }
|
||||
.filters button { border:1px solid var(--line); border-radius:99px; padding:5px 10px; background:#fff; font-size:12px; font-weight:700; color:#475569; }
|
||||
.filters button.active { border-color:#bfdbfe; color:#1d4ed8; background:var(--soft); }
|
||||
table { width:100%; border-collapse:collapse; font-size:12px; }
|
||||
th,td { padding:10px 8px; border-bottom:1px solid var(--line); text-align:left; vertical-align:top; }
|
||||
th { color:var(--muted); background:#f8fbff; font-weight:700; }
|
||||
tr.clickable { cursor:pointer; }
|
||||
tr.clickable:hover,tr.selected { background:#f3f7ff; }
|
||||
.badge { display:inline-flex; padding:2px 8px; border-radius:99px; font-size:11px; font-weight:800; }
|
||||
.blue { color:#175cd3; background:var(--soft); }
|
||||
.green { color:var(--green); background:#eafaf1; }
|
||||
.amber { color:var(--amber); background:#fff7e6; }
|
||||
.red { color:var(--red); background:#fff0ef; }
|
||||
.gray { color:#475569; background:#edf1f6; }
|
||||
.muted { color:var(--muted); }
|
||||
.two { display:grid; grid-template-columns:280px 1fr; gap:14px; }
|
||||
.person { display:flex; flex-direction:column; gap:8px; }
|
||||
.person button { border:1px solid var(--line); border-radius:8px; padding:8px 10px; background:#fff; font-size:12px; text-align:left; font-weight:700; }
|
||||
.person button.active { border-color:#93c5fd; background:var(--soft); }
|
||||
.letter { margin-bottom:12px; padding:14px; border:1px solid var(--line); border-radius:12px; background:#fff; }
|
||||
.letter h3 { margin:0 0 8px; font-size:15px; }
|
||||
.kv { display:grid; grid-template-columns:72px 1fr; gap:6px; margin-bottom:8px; font-size:12px; }
|
||||
.kv b { color:var(--muted); font-weight:700; }
|
||||
.toast { position:fixed; right:16px; bottom:16px; padding:10px 12px; border-radius:8px; color:#fff; background:#142036; opacity:0; transition:.2s; }
|
||||
.toast.show { opacity:1; }
|
||||
.people-grid { display:grid; grid-template-columns:minmax(0,1fr) minmax(0,1fr); gap:14px; align-items:start; }
|
||||
#v-people .prow { display:grid; grid-template-columns:minmax(0,1fr) 168px; gap:12px; align-items:center; padding:12px 16px; border-top:1px solid var(--line); }
|
||||
#v-people .prow b { display:block; font-size:13px; }
|
||||
#v-people .prow span { color:var(--muted); font-size:12px; }
|
||||
#v-people select { width:100%; height:36px; padding:0 8px; border:1px solid #d7dee8; border-radius:8px; background:#fff; color:var(--ink); font-weight:650; }
|
||||
#v-people select:focus { outline:2px solid #bfdbfe; border-color:#2563eb; }
|
||||
#v-people .parts { margin:8px 0 0; padding:0; list-style:none; }
|
||||
#v-people .parts li { padding:8px 0; border-top:1px solid var(--line); font-size:12px; }
|
||||
@media (max-width:980px) {
|
||||
.kpis { grid-template-columns:1fr 1fr; }
|
||||
.split,.two,.hero,.top,.people-grid { display:block; }
|
||||
.people-grid > article + article { margin-top:14px; }
|
||||
.tabs { margin-top:8px; }
|
||||
.split > article + article,.two > article + article { margin-top:14px; }
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<header class="top">
|
||||
<div><b>制程品质异常预警</b><small>原型 · 样例数据 · 不接 OA</small></div>
|
||||
<nav class="tabs" id="tabs">
|
||||
<button class="active" data-v="dash">Dashboard</button>
|
||||
<button data-v="list">异常清单</button>
|
||||
<button data-v="mail">发送预览</button>
|
||||
<button data-v="people">收件人</button>
|
||||
</nav>
|
||||
</header>
|
||||
<main>
|
||||
<p class="note">原型假设:一单一行计 1 次;样例不含空不良类别。五个岗位的具体人员仍待确认,这里的姓名只影响预览称呼。扫描日固定为 2026-10-23。近一年计申请日期 2025-10-23 至 2026-10-22。当月计 2026-10-01 至 2026-10-31,含当天。</p>
|
||||
|
||||
<section class="view active" id="v-dash">
|
||||
<div class="hero">
|
||||
<div>
|
||||
<h1>Dashboard</h1>
|
||||
<p>本周五 18:00 将发出的周报和升级信。近一年不足 3 次的键不出现在这里。</p>
|
||||
<div class="windows">
|
||||
<span>扫描日 2026-10-23</span>
|
||||
<span>近一年 2025-10-23 ~ 2026-10-22</span>
|
||||
<span>当月 2026-10-01 ~ 2026-10-31</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="kpis" id="kpis"></div>
|
||||
<div class="split">
|
||||
<article class="card">
|
||||
<div class="hd"><h2>档位分布</h2></div>
|
||||
<div class="bd" id="bars"></div>
|
||||
</article>
|
||||
<article class="card">
|
||||
<div class="hd"><h2>本周收件人</h2><p class="muted">含抄送。同一人收到多封时分开计数。</p></div>
|
||||
<div class="bd mails" id="mailCounts"></div>
|
||||
</article>
|
||||
</div>
|
||||
<article class="card">
|
||||
<div class="hd"><h2>近一年仍 ≥ 3</h2><p class="muted">按近一年次数从高到低。点一行看单据。</p></div>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>料号</th><th>不良类别</th><th>机种</th><th>近一年</th><th>当月</th><th>本周动作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="watchRows"></tbody>
|
||||
</table>
|
||||
</article>
|
||||
</section>
|
||||
|
||||
<section class="view" id="v-list">
|
||||
<div class="hero">
|
||||
<div>
|
||||
<h1>异常清单</h1>
|
||||
<p>废弃、撤销和近一年不足 3 次的样例留在这里,标成不预警。计入标记按申请日期和流程状态计算。</p>
|
||||
</div>
|
||||
</div>
|
||||
<article class="card">
|
||||
<div class="filters" id="filters"></div>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>料号</th><th>不良类别</th><th>近一年</th><th>当月</th><th>状态</th><th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="keyRows"></tbody>
|
||||
</table>
|
||||
</article>
|
||||
<article class="card" style="margin-top:14px">
|
||||
<div class="hd"><h2 id="detailTitle">单据明细</h2></div>
|
||||
<div class="bd" id="detailNote"></div>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>单号</th><th>申请日期</th><th>机种</th><th>料号</th><th>不良类别</th><th>不良项目</th><th>不良发生部</th><th>流程</th><th>计入</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="formRows"></tbody>
|
||||
</table>
|
||||
</article>
|
||||
</section>
|
||||
|
||||
<section class="view" id="v-mail">
|
||||
<div class="hero">
|
||||
<div>
|
||||
<h1>发送预览</h1>
|
||||
<p>本周五 18:00 的 OA 邮件。品质担当收全量周报。升级信只含本周新跨入的档,不补发跳过的档。</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="two">
|
||||
<article class="card"><div class="bd"><div class="person" id="recipients"></div></div></article>
|
||||
<div id="letters"></div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="view" id="v-people">
|
||||
<div class="hero">
|
||||
<div>
|
||||
<h1>收件人</h1>
|
||||
<p>五个岗位分开配置。改称呼会立刻出现在右侧预览里,不进入正式名单。</p>
|
||||
</div>
|
||||
<button class="btn primary" id="savePeople" type="button">保存称呼</button>
|
||||
</div>
|
||||
<div class="people-grid">
|
||||
<article class="card">
|
||||
<div class="hd"><div><h2>岗位</h2><p class="muted">品质担当和升级档里的品质是两个人。</p></div></div>
|
||||
<div id="slipBands"></div>
|
||||
</article>
|
||||
<article class="card">
|
||||
<div class="hd"><div><h2>本周预览</h2><p class="muted" id="slipMeta"></p></div></div>
|
||||
<div class="filters" id="slipPicks"></div>
|
||||
<div class="bd" id="slipLetter"></div>
|
||||
</article>
|
||||
</div>
|
||||
</section>
|
||||
</main>
|
||||
<div class="toast" id="toast"></div>
|
||||
<script>
|
||||
/**
|
||||
* 用样例异常单演示近一年窗口、当月升级和按收件人汇总的 OA 邮件。
|
||||
* 核心逻辑:近一年不含扫描日;当月含扫描日;废弃和撤销不计入;跳过的档不补发。
|
||||
*/
|
||||
(() => {
|
||||
const SCAN = '2026-10-23';
|
||||
const YEAR_FROM = '2025-10-23';
|
||||
const YEAR_TO = '2026-10-22';
|
||||
const MONTH_FROM = '2026-10-01';
|
||||
const MONTH_TO = '2026-10-31';
|
||||
const $ = (id) => document.getElementById(id);
|
||||
const ROLE_FIELDS = [
|
||||
['owner', '品质担当'],
|
||||
['quality', '品质'],
|
||||
['prod', '生产经副理'],
|
||||
['coo', 'COO'],
|
||||
['boss', '老板']
|
||||
];
|
||||
const NAME_OPTIONS = ['待确认', '样例·甲', '样例·乙'];
|
||||
|
||||
let view = 'dash';
|
||||
let filter = 'watch';
|
||||
let selected = 'A';
|
||||
let mailPerson = 'owner';
|
||||
let slipId = 'weekly';
|
||||
const people = { owner:'待确认', quality:'待确认', prod:'待确认', coo:'待确认', boss:'待确认' };
|
||||
|
||||
const keys = [
|
||||
{
|
||||
id:'A', model:'AR1.2', part:'D4-A12HOX0000040', defect:'外观不良', sent:[],
|
||||
note:'当月 0 笔。近一年仍 ≥ 3,只进品质担当周报。',
|
||||
forms:[
|
||||
{ no:'QA-2025-0901', date:'2025-09-01', model:'AR1.2', item:'外观划伤', dept:'生二包装', status:'归档' },
|
||||
{ no:'QA-2026-0804', date:'2026-08-04', model:'AR1.2', item:'包装破损', dept:'生二包装', status:'归档' },
|
||||
{ no:'QA-2026-0818', date:'2026-08-18', model:'AR1.2', item:'外观划伤', dept:'生二包装', status:'在途' },
|
||||
{ no:'QA-2026-0906', date:'2026-09-06', model:'AR1.2', item:'包装方式', dept:'生二包装', status:'归档' },
|
||||
{ no:'QA-2026-0920', date:'2026-09-20', model:'AR1.2', item:'外观不良', dept:'生二包装', status:'归档' }
|
||||
]
|
||||
},
|
||||
{
|
||||
id:'B', model:'CE001', part:'I6-CE0010321', defect:'尺寸不良', sent:[],
|
||||
note:'当月第 1 笔,本月尚未发过该档。本周主送品质和生产经副理。',
|
||||
forms:[
|
||||
{ no:'QA-2025-1023', date:'2025-10-23', model:'CE001', item:'尺寸超差', dept:'生二下料', status:'归档' },
|
||||
{ no:'QA-2026-0114', date:'2026-01-14', model:'CE001', item:'尺寸超差', dept:'生二下料', status:'归档' },
|
||||
{ no:'QA-2026-0402', date:'2026-04-02', model:'CE001', item:'孔径超差', dept:'生二下料', status:'在途' },
|
||||
{ no:'QA-2026-0719', date:'2026-07-19', model:'CE001', item:'尺寸超差', dept:'生二下料', status:'归档' },
|
||||
{ no:'QA-2026-1008', date:'2026-10-08', model:'CE001', item:'尺寸超差', dept:'生二下料', status:'归档' }
|
||||
]
|
||||
},
|
||||
{
|
||||
id:'C', model:'RT05', part:'I9-RT05001106/107', defect:'错漏混', sent:[],
|
||||
note:'8 月 3 笔,10 月 1 日 1 笔,10 月 23 日又 1 笔。近一年不含当天仍 ≥ 3,当月是第 2 次,本周只主送 COO,不补首次档。料号按原值,不去斜杠。',
|
||||
forms:[
|
||||
{ no:'QA-2026-0805', date:'2026-08-05', model:'RT05', item:'漏装', dept:'生二焊接', status:'归档' },
|
||||
{ no:'QA-2026-0812', date:'2026-08-12', model:'RT05', item:'错料', dept:'生二焊接', status:'在途' },
|
||||
{ no:'QA-2026-0820', date:'2026-08-20', model:'RT05', item:'漏焊', dept:'生二焊接', status:'归档' },
|
||||
{ no:'QA-2026-1001', date:'2026-10-01', model:'RT05', item:'错料', dept:'生二焊接', status:'归档' },
|
||||
{ no:'QA-2026-1023', date:'2026-10-23', model:'RT05', item:'漏装', dept:'生二焊接', status:'在途' }
|
||||
]
|
||||
},
|
||||
{
|
||||
id:'D', model:'AR1.1', part:'B3-AR100253', defect:'实物与图不符', sent:[],
|
||||
note:'上次扫描时当月还是 0 笔。本周一次看到 10 月 20、21、22 日三笔,只走老板档,不补首次和第二次。',
|
||||
forms:[
|
||||
{ no:'QA-2026-0302', date:'2026-03-02', model:'AR1.1', item:'实物不符', dept:'生一冲压', status:'归档' },
|
||||
{ no:'QA-2026-0411', date:'2026-04-11', model:'AR1.1', item:'图物不符', dept:'生一冲压', status:'归档' },
|
||||
{ no:'QA-2026-0619', date:'2026-06-19', model:'AR1.1', item:'实物不符', dept:'生一冲压', status:'在途' },
|
||||
{ no:'QA-2026-1020', date:'2026-10-20', model:'AR1.1', item:'实物不符', dept:'生一冲压', status:'归档' },
|
||||
{ no:'QA-2026-1021', date:'2026-10-21', model:'AR1.1', item:'图物不符', dept:'生一冲压', status:'归档' },
|
||||
{ no:'QA-2026-1022', date:'2026-10-22', model:'AR1.1', item:'实物不符', dept:'生一冲压', status:'在途' }
|
||||
]
|
||||
},
|
||||
{
|
||||
id:'E', model:'AR1.2', part:'D4-AR1200100', defect:'尺寸不良', sent:['first'],
|
||||
note:'10 月 10 日已发过当月首次。本周当月仍是 1 笔,周报继续收,升级信不再发。',
|
||||
forms:[
|
||||
{ no:'QA-2026-0702', date:'2026-07-02', model:'AR1.2', item:'尺寸超差', dept:'生二折弯', status:'归档' },
|
||||
{ no:'QA-2026-0814', date:'2026-08-14', model:'AR1.2', item:'尺寸超差', dept:'生二折弯', status:'在途' },
|
||||
{ no:'QA-2026-1006', date:'2026-10-06', model:'AR1.2', item:'孔径超差', dept:'生二折弯', status:'归档' }
|
||||
]
|
||||
},
|
||||
{
|
||||
id:'F', model:'CE001', part:'I6-CE0010362', defect:'尺寸不良', sent:[],
|
||||
note:'归档和在途都计入,但近一年只有 2 笔,不预警。',
|
||||
forms:[
|
||||
{ no:'QA-2026-0912', date:'2026-09-12', model:'CE001', item:'尺寸超差', dept:'生二折弯', status:'归档' },
|
||||
{ no:'QA-2026-1015', date:'2026-10-15', model:'CE001', item:'尺寸超差', dept:'生二折弯', status:'在途' }
|
||||
]
|
||||
},
|
||||
{
|
||||
id:'G', model:'AR1.2', part:'D4-AR1200098', defect:'错漏混', sent:[],
|
||||
note:'废弃和撤销不计入。剩下 2 笔有效单,近一年不足 3 次,不预警。',
|
||||
forms:[
|
||||
{ no:'QA-2026-0601', date:'2026-06-01', model:'AR1.2', item:'漏孔', dept:'生二包装', status:'归档' },
|
||||
{ no:'QA-2026-0708', date:'2026-07-08', model:'AR1.2', item:'混料', dept:'生二包装', status:'在途' },
|
||||
{ no:'QA-2026-0819', date:'2026-08-19', model:'AR1.2', item:'漏孔', dept:'生二包装', status:'废弃' },
|
||||
{ no:'QA-2026-0903', date:'2026-09-03', model:'AR1.2', item:'错料', dept:'生二包装', status:'撤销' }
|
||||
]
|
||||
}
|
||||
];
|
||||
|
||||
/**
|
||||
* 判断申请日期是否落在近一年窗口。
|
||||
* 扫描日当天不算。两端日期都含。
|
||||
* @param {string} date - 申请日期,YYYY-MM-DD
|
||||
* @returns {boolean}
|
||||
*/
|
||||
function inYear(date) {
|
||||
return date >= YEAR_FROM && date <= YEAR_TO;
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断申请日期是否落在扫描日所在自然月。
|
||||
* 该月 1 日到月末都算,含扫描日当天。
|
||||
* @param {string} date - 申请日期,YYYY-MM-DD
|
||||
* @returns {boolean}
|
||||
*/
|
||||
function inMonth(date) {
|
||||
return date >= MONTH_FROM && date <= MONTH_TO;
|
||||
}
|
||||
|
||||
/**
|
||||
* 归档和在途计入。废弃、撤销不计入。
|
||||
* @param {{status:string}} form - 样例单据
|
||||
* @returns {boolean}
|
||||
*/
|
||||
function countable(form) {
|
||||
return form.status === '归档' || form.status === '在途';
|
||||
}
|
||||
|
||||
/**
|
||||
* 近一年有效笔数,不含扫描日当天。
|
||||
* @param {{forms:Array}} key - 料号 + 不良类别
|
||||
* @returns {number}
|
||||
*/
|
||||
function yearCount(key) {
|
||||
return key.forms.filter((form) => countable(form) && inYear(form.date)).length;
|
||||
}
|
||||
|
||||
/**
|
||||
* 当月有效笔数,含扫描日当天。
|
||||
* @param {{forms:Array}} key - 料号 + 不良类别
|
||||
* @returns {number}
|
||||
*/
|
||||
function monthCount(key) {
|
||||
return key.forms.filter((form) => countable(form) && inMonth(form.date)).length;
|
||||
}
|
||||
|
||||
/**
|
||||
* 当前所处档位。近一年不足 3 次为 none,当月 0 笔为 weekly。
|
||||
* @param {{forms:Array}} key - 料号 + 不良类别
|
||||
* @returns {'none'|'weekly'|'first'|'second'|'third'}
|
||||
*/
|
||||
function standingTier(key) {
|
||||
if (yearCount(key) < 3) return 'none';
|
||||
const month = monthCount(key);
|
||||
if (month <= 0) return 'weekly';
|
||||
if (month === 1) return 'first';
|
||||
if (month === 2) return 'second';
|
||||
return 'third';
|
||||
}
|
||||
|
||||
/**
|
||||
* 本周要新发的升级档。已发过的同一档不再发,也不补发更低档。
|
||||
* @param {{forms:Array, sent:string[]}} key - 料号 + 不良类别
|
||||
* @returns {'first'|'second'|'third'|null}
|
||||
*/
|
||||
function upgradeTier(key) {
|
||||
const tier = standingTier(key);
|
||||
if (tier === 'none' || tier === 'weekly') return null;
|
||||
if (key.sent.includes(tier)) return null;
|
||||
return tier;
|
||||
}
|
||||
|
||||
/**
|
||||
* 清单和 Dashboard 上的本周动作文案。
|
||||
* @param {{forms:Array, sent:string[]}} key - 料号 + 不良类别
|
||||
* @returns {string}
|
||||
*/
|
||||
function actionLabel(key) {
|
||||
const upgrade = upgradeTier(key);
|
||||
if (standingTier(key) === 'none') return '不预警';
|
||||
if (upgrade === 'first') return '周报 + 首次升级';
|
||||
if (upgrade === 'second') return '周报 + 主送 COO';
|
||||
if (upgrade === 'third') return '周报 + 主送老板';
|
||||
if (standingTier(key) === 'weekly') return '只发周报';
|
||||
return '周报照发。当月这一档已经发过,这周不再发升级信';
|
||||
}
|
||||
|
||||
/**
|
||||
* 把本周动作写成徽章。
|
||||
* @param {{forms:Array, sent:string[]}} key - 料号 + 不良类别
|
||||
* @returns {string}
|
||||
*/
|
||||
function actionBadge(key) {
|
||||
const upgrade = upgradeTier(key);
|
||||
if (standingTier(key) === 'none') return '<span class="badge gray">不预警</span>';
|
||||
if (upgrade === 'first') return '<span class="badge blue">首次升级</span>';
|
||||
if (upgrade === 'second') return '<span class="badge amber">第二次 · COO</span>';
|
||||
if (upgrade === 'third') return '<span class="badge red">第三次及以上 · 老板</span>';
|
||||
if (standingTier(key) === 'weekly') return '<span class="badge green">只发周报</span>';
|
||||
return '<span class="badge gray">升级已发过</span>';
|
||||
}
|
||||
|
||||
/**
|
||||
* 单笔单据的计入说明。废弃和撤销优先于日期窗口。
|
||||
* @param {{date:string, status:string}} form - 样例单据
|
||||
* @returns {string}
|
||||
*/
|
||||
function countBadge(form) {
|
||||
if (!countable(form)) return '<span class="badge red">不计入(' + form.status + ')</span>';
|
||||
const year = inYear(form.date);
|
||||
const month = inMonth(form.date);
|
||||
if (year && month) return '<span class="badge blue">近一年 + 当月</span>';
|
||||
if (year) return '<span class="badge green">近一年</span>';
|
||||
if (month) return '<span class="badge amber">只算当月</span>';
|
||||
return '<span class="badge gray">两者都不算</span>';
|
||||
}
|
||||
|
||||
/**
|
||||
* 按当前筛选留下的统计键。
|
||||
* @returns {Array}
|
||||
*/
|
||||
function visibleKeys() {
|
||||
return keys.filter((key) => {
|
||||
const tier = standingTier(key);
|
||||
const upgrade = upgradeTier(key);
|
||||
if (filter === 'watch') return yearCount(key) >= 3;
|
||||
if (filter === 'weekly') return tier === 'weekly';
|
||||
if (filter === 'first') return upgrade === 'first';
|
||||
if (filter === 'second') return upgrade === 'second';
|
||||
if (filter === 'third') return upgrade === 'third';
|
||||
if (filter === 'skip') return tier === 'none';
|
||||
return true;
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 岗位显示名。待确认时带上岗位,避免预览里五个人都叫同一句话。
|
||||
* @param {'owner'|'quality'|'prod'|'coo'|'boss'} role - 岗位键
|
||||
* @returns {string}
|
||||
*/
|
||||
function personName(role) {
|
||||
const label = ROLE_FIELDS.find((item) => item[0] === role)[1];
|
||||
if (people[role] === '待确认') return label + '(待确认)';
|
||||
return people[role] + ' · ' + label;
|
||||
}
|
||||
|
||||
/**
|
||||
* 本周要发出的邮件。周报一封;每个新升级档一封,不把跳过的档补进去。
|
||||
* @returns {Array<{id:string, kind:string, to:string[], cc:string[], keys:Array}>}
|
||||
*/
|
||||
function letters() {
|
||||
const watch = keys.filter((key) => yearCount(key) >= 3)
|
||||
.sort((a, b) => yearCount(b) - yearCount(a) || a.part.localeCompare(b.part));
|
||||
const ofTier = (tier) => watch.filter((key) => upgradeTier(key) === tier);
|
||||
const batch = [];
|
||||
if (watch.length) {
|
||||
batch.push({ id:'weekly', kind:'周报', to:[personName('owner')], cc:[], keys:watch });
|
||||
}
|
||||
const first = ofTier('first');
|
||||
if (first.length) {
|
||||
batch.push({ id:'first', kind:'当月首次', to:[personName('quality'), personName('prod')], cc:[], keys:first });
|
||||
}
|
||||
const second = ofTier('second');
|
||||
if (second.length) {
|
||||
batch.push({ id:'second', kind:'当月第二次', to:[personName('coo')], cc:[], keys:second });
|
||||
}
|
||||
const third = ofTier('third');
|
||||
if (third.length) {
|
||||
batch.push({
|
||||
id:'third',
|
||||
kind:'当月第三次及以上',
|
||||
to:[personName('boss')],
|
||||
cc:[personName('coo'), personName('quality'), personName('prod')],
|
||||
keys:third
|
||||
});
|
||||
}
|
||||
return batch;
|
||||
}
|
||||
|
||||
/**
|
||||
* 某人作为主送或抄送会收到的邮件。
|
||||
* @param {string} name - personName 的结果
|
||||
* @returns {Array}
|
||||
*/
|
||||
function lettersFor(name) {
|
||||
return letters().filter((letter) => letter.to.includes(name) || letter.cc.includes(name));
|
||||
}
|
||||
|
||||
/**
|
||||
* 切换页签。从 Dashboard 点进清单时保留已选统计键。
|
||||
* @param {string} next - dash、list、mail、people
|
||||
*/
|
||||
function show(next) {
|
||||
view = next;
|
||||
document.querySelectorAll('.tabs button').forEach((button) => {
|
||||
button.classList.toggle('active', button.dataset.v === next);
|
||||
});
|
||||
document.querySelectorAll('.view').forEach((section) => {
|
||||
section.classList.toggle('active', section.id === 'v-' + next);
|
||||
});
|
||||
if (next === 'list') renderList();
|
||||
if (next === 'mail') renderMail();
|
||||
if (next === 'people') renderPeople();
|
||||
}
|
||||
|
||||
/**
|
||||
* 打开某个统计键的单据明细。
|
||||
* @param {string} id - 样例键 id
|
||||
* @param {string} [nextFilter] - 清单筛选
|
||||
*/
|
||||
function openKey(id, nextFilter) {
|
||||
selected = id;
|
||||
if (nextFilter) filter = nextFilter;
|
||||
show('list');
|
||||
}
|
||||
|
||||
/**
|
||||
* 画 Dashboard 的指标、档位条、收件人封数和预警清单。
|
||||
*/
|
||||
function renderDash() {
|
||||
const watch = keys.filter((key) => yearCount(key) >= 3);
|
||||
const cards = [
|
||||
['watch', watch.length, '近一年仍 ≥ 3'],
|
||||
['weekly', watch.filter((key) => standingTier(key) === 'weekly').length, '本周只发周报(当月 0 笔)'],
|
||||
['first', watch.filter((key) => upgradeTier(key) === 'first').length, '本周首次升级'],
|
||||
['second', watch.filter((key) => upgradeTier(key) === 'second').length, '本周第二次(COO)'],
|
||||
['third', watch.filter((key) => upgradeTier(key) === 'third').length, '本周第三次及以上(老板)']
|
||||
];
|
||||
$('kpis').innerHTML = cards.map(([id, num, label]) => (
|
||||
'<button type="button" data-jump="' + id + '"><b>' + num + '</b><span>' + label + '</span></button>'
|
||||
)).join('');
|
||||
$('kpis').querySelectorAll('button').forEach((button) => {
|
||||
button.onclick = () => openKey(selected, button.dataset.jump === 'watch' ? 'watch' : button.dataset.jump);
|
||||
});
|
||||
|
||||
const buckets = [
|
||||
['只发周报', cards[1][1], 'green'],
|
||||
['本周首次', cards[2][1], ''],
|
||||
['本周第二次', cards[3][1], 'amber'],
|
||||
['本周第三次及以上', cards[4][1], 'red'],
|
||||
['升级已发过', watch.filter((key) => standingTier(key) !== 'weekly' && !upgradeTier(key)).length, 'green']
|
||||
];
|
||||
const max = Math.max(1, ...buckets.map((item) => item[1]));
|
||||
$('bars').innerHTML = buckets.map(([label, num, tone]) => (
|
||||
'<div class="bar"><span>' + label + '</span><i class="' + tone + '"><span style="width:' + (num / max * 100) + '%"></span></i><b>' + num + '</b></div>'
|
||||
)).join('');
|
||||
|
||||
const names = ['owner', 'quality', 'prod', 'coo', 'boss'].map(personName);
|
||||
$('mailCounts').innerHTML = names.map((name) => {
|
||||
const mine = lettersFor(name);
|
||||
return '<div class="mail-row"><span>' + name + '</span><b>' + mine.length + ' 封</b></div>';
|
||||
}).join('');
|
||||
|
||||
const rows = watch.slice().sort((a, b) => yearCount(b) - yearCount(a) || a.part.localeCompare(b.part));
|
||||
$('watchRows').innerHTML = rows.map((key) => (
|
||||
'<tr class="clickable" data-id="' + key.id + '"><td>' + key.part + '</td><td>' + key.defect + '</td><td>' + key.model + '</td><td>' + yearCount(key) + '</td><td>' + monthCount(key) + '</td><td>' + actionBadge(key) + '</td></tr>'
|
||||
)).join('');
|
||||
$('watchRows').querySelectorAll('tr').forEach((row) => {
|
||||
row.onclick = () => openKey(row.dataset.id, 'all');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 画异常清单和当前统计键的单据明细。
|
||||
*/
|
||||
function renderList() {
|
||||
const filters = [
|
||||
['all', '全部'],
|
||||
['watch', '近一年 ≥ 3'],
|
||||
['weekly', '只发周报'],
|
||||
['first', '本周首次'],
|
||||
['second', '本周第二次'],
|
||||
['third', '本周第三次及以上'],
|
||||
['skip', '不预警']
|
||||
];
|
||||
$('filters').innerHTML = filters.map(([id, label]) => (
|
||||
'<button type="button" data-f="' + id + '"' + (filter === id ? ' class="active"' : '') + '>' + label + '</button>'
|
||||
)).join('');
|
||||
$('filters').querySelectorAll('button').forEach((button) => {
|
||||
button.onclick = () => { filter = button.dataset.f; renderList(); };
|
||||
});
|
||||
|
||||
const rows = visibleKeys().sort((a, b) => yearCount(b) - yearCount(a) || a.part.localeCompare(b.part));
|
||||
if (!rows.some((key) => key.id === selected) && rows[0]) selected = rows[0].id;
|
||||
$('keyRows').innerHTML = rows.map((key) => (
|
||||
'<tr class="clickable' + (key.id === selected ? ' selected' : '') + '" data-id="' + key.id + '"><td>' + key.part + '</td><td>' + key.defect + '</td><td>' + yearCount(key) + '</td><td>' + monthCount(key) + '</td><td>' + actionBadge(key) + '</td><td>' + actionLabel(key) + '</td></tr>'
|
||||
)).join('') || '<tr><td colspan="6" class="muted">这个筛选下没有样例。</td></tr>';
|
||||
$('keyRows').querySelectorAll('tr[data-id]').forEach((row) => {
|
||||
row.onclick = () => { selected = row.dataset.id; renderList(); };
|
||||
});
|
||||
|
||||
const key = keys.find((item) => item.id === selected) || rows[0];
|
||||
if (!key) {
|
||||
$('detailTitle').textContent = '单据明细';
|
||||
$('detailNote').textContent = '';
|
||||
$('formRows').innerHTML = '';
|
||||
return;
|
||||
}
|
||||
$('detailTitle').textContent = key.part + ' · ' + key.defect;
|
||||
$('detailNote').innerHTML = '<p class="muted" style="margin:0">' + key.note + ' 近一年 ' + yearCount(key) + ' 笔,当月 ' + monthCount(key) + ' 笔。</p>';
|
||||
$('formRows').innerHTML = key.forms.map((form) => (
|
||||
'<tr><td>' + form.no + '</td><td>' + form.date + '</td><td>' + form.model + '</td><td>' + key.part + '</td><td>' + key.defect + '</td><td>' + form.item + '</td><td>' + form.dept + '</td><td>' + form.status + '</td><td>' + countBadge(form) + '</td></tr>'
|
||||
)).join('');
|
||||
}
|
||||
|
||||
/**
|
||||
* 画某个收件人本周会收到的 OA 邮件。
|
||||
*/
|
||||
function renderMail() {
|
||||
const batch = letters();
|
||||
const peopleInBatch = [];
|
||||
batch.forEach((letter) => {
|
||||
letter.to.concat(letter.cc).forEach((name) => {
|
||||
if (!peopleInBatch.includes(name)) peopleInBatch.push(name);
|
||||
});
|
||||
});
|
||||
if (!peopleInBatch.includes(mailPerson) && !peopleInBatch.some((name) => name.startsWith(personName(mailPerson)))) {
|
||||
mailPerson = 'owner';
|
||||
}
|
||||
const activeName = personName(mailPerson);
|
||||
$('recipients').innerHTML = ROLE_FIELDS.map(([role]) => {
|
||||
const name = personName(role);
|
||||
const count = lettersFor(name).length;
|
||||
return '<button type="button" data-role="' + role + '"' + (mailPerson === role ? ' class="active"' : '') + '>' + name + '<br><span class="muted">' + count + ' 封</span></button>';
|
||||
}).join('');
|
||||
$('recipients').querySelectorAll('button').forEach((button) => {
|
||||
button.onclick = () => { mailPerson = button.dataset.role; renderMail(); };
|
||||
});
|
||||
|
||||
const mine = lettersFor(activeName);
|
||||
$('letters').innerHTML = mine.map((letter) => {
|
||||
const roleLine = letter.to.includes(activeName) ? '主送' : '抄送';
|
||||
const body = letter.keys.map((key) => (
|
||||
key.forms.filter((form) => countable(form) && (inYear(form.date) || inMonth(form.date))).map((form) => (
|
||||
'<tr><td>' + form.no + '</td><td>' + form.date + '</td><td>' + form.model + '</td><td>' + key.part + '</td><td>' + key.defect + '</td><td>' + form.item + '</td><td>' + form.dept + '</td><td>' + yearCount(key) + '</td><td>' + monthCount(key) + '</td></tr>'
|
||||
)).join('')
|
||||
)).join('');
|
||||
return '<article class="letter"><h3>' + letter.kind + '</h3><div class="kv"><b>发送</b><span>2026-10-23 18:00 · OA 邮件</span><b>你的身份</b><span>' + roleLine + '</span><b>主送</b><span>' + letter.to.join('、') + '</span><b>抄送</b><span>' + (letter.cc.length ? letter.cc.join('、') : '无') + '</span></div><table><thead><tr><th>单号</th><th>申请日期</th><th>机种</th><th>料号</th><th>不良类别</th><th>不良项目</th><th>不良发生部</th><th>近一年</th><th>当月</th></tr></thead><tbody>' + body + '</tbody></table></article>';
|
||||
}).join('') || '<article class="letter"><p class="muted">这位本周没有邮件。</p></article>';
|
||||
}
|
||||
|
||||
const SLIPS = [
|
||||
{ id:'weekly', title:'周报', to:['owner'], cc:[] },
|
||||
{ id:'first', title:'当月首次', to:['quality','prod'], cc:[] },
|
||||
{ id:'second', title:'当月第二次', to:['coo'], cc:[] },
|
||||
{ id:'third', title:'第三次及以上', to:['boss'], cc:['coo','quality','prod'] }
|
||||
];
|
||||
const ROLE_DUTY = {
|
||||
owner:'周报主送',
|
||||
quality:'首次主送,第三次抄送',
|
||||
prod:'首次主送,第三次抄送',
|
||||
coo:'第二次主送,第三次抄送',
|
||||
boss:'第三次主送'
|
||||
};
|
||||
|
||||
/**
|
||||
* 当前这封信要列出的料号。周报是近一年仍不少于 3 次的全部键,升级信只含本周新跨入的那一档。
|
||||
* @param {string} id - weekly、first、second、third
|
||||
* @returns {Array}
|
||||
*/
|
||||
function slipKeys(id) {
|
||||
const watch = keys.filter((key) => yearCount(key) >= 3);
|
||||
if (id === 'weekly') return watch.sort((a, b) => yearCount(b) - yearCount(a));
|
||||
return watch.filter((key) => upgradeTier(key) === id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 画出五个岗位和右侧这封信。每个岗位只出现一次,改称呼只改预览。
|
||||
*/
|
||||
function renderPeople() {
|
||||
$('slipBands').innerHTML = ROLE_FIELDS.map(([role, label]) => {
|
||||
const options = NAME_OPTIONS.map((name) => (
|
||||
'<option' + (people[role] === name ? ' selected' : '') + '>' + name + '</option>'
|
||||
)).join('');
|
||||
return '<div class="prow"><div><b>' + label + '</b><span>' + ROLE_DUTY[role] + '</span></div><select data-role="' + role + '" aria-label="' + label + '">' + options + '</select></div>';
|
||||
}).join('');
|
||||
$('slipBands').querySelectorAll('select').forEach((select) => {
|
||||
select.onchange = () => {
|
||||
people[select.dataset.role] = select.value;
|
||||
renderPeople();
|
||||
renderDash();
|
||||
renderMail();
|
||||
};
|
||||
});
|
||||
$('slipPicks').innerHTML = SLIPS.map((slip) => (
|
||||
'<button type="button" data-slip="' + slip.id + '"' + (slip.id === slipId ? ' class="active"' : '') + '>' + slip.title + '</button>'
|
||||
)).join('');
|
||||
$('slipPicks').querySelectorAll('button').forEach((button) => {
|
||||
button.onclick = () => { slipId = button.dataset.slip; renderPeople(); };
|
||||
});
|
||||
const slip = SLIPS.find((item) => item.id === slipId);
|
||||
const rows = slipKeys(slip.id);
|
||||
const to = slip.to.map(personName).join('、');
|
||||
const cc = slip.cc.length ? slip.cc.map(personName).join('、') : '无';
|
||||
const list = rows.map((key) => (
|
||||
'<li>' + key.part + ' · ' + key.defect + ' · 近一年 ' + yearCount(key) + ' · 当月 ' + monthCount(key) + '</li>'
|
||||
)).join('') || '<li>本周这封没有料号。</li>';
|
||||
$('slipMeta').textContent = '2026-10-23 18:00 · OA 邮件 · ' + rows.length + ' 个料号';
|
||||
$('slipLetter').innerHTML = '<div class="kv"><b>主送</b><span>' + to + '</span><b>抄送</b><span>' + cc + '</span></div><ul class="parts">' + list + '</ul>';
|
||||
}
|
||||
|
||||
/**
|
||||
* 短暂提示称呼已用于预览。
|
||||
* @param {string} text - 提示文案
|
||||
*/
|
||||
function toast(text) {
|
||||
const node = $('toast');
|
||||
node.textContent = text;
|
||||
node.classList.add('show');
|
||||
setTimeout(() => node.classList.remove('show'), 1600);
|
||||
}
|
||||
|
||||
document.querySelectorAll('.tabs button').forEach((button) => {
|
||||
button.onclick = () => show(button.dataset.v);
|
||||
});
|
||||
$('savePeople').onclick = () => toast('预览称呼已更新,未写入正式配置');
|
||||
|
||||
renderDash();
|
||||
renderList();
|
||||
renderMail();
|
||||
renderPeople();
|
||||
const openView = new URLSearchParams(location.search).get('view') || (location.hash || '').replace('#', '');
|
||||
if (['dash', 'list', 'mail', 'people'].includes(openView)) show(openView);
|
||||
})();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
+13
-4
@@ -41,16 +41,25 @@
|
||||
| 合同付款 Agent 授权 | 已实现 | 入口为 Chat builtin Agent `contract_payment`:平台管理员默认可访问;权限组启用后把该 Agent 勾到角色包即可,不再按人授权。旧功能权限 `contract_payment.access` 由迁移写入 Agent 授权后删除。无授权直链提示并回应用管理,API 返回 403。同步 OA、强制覆盖、批量重解析、扫描预警和发送预警仅平台管理员可见并可调用。 |
|
||||
| OA 盖章合同优先 | 已实现 | 合同申请单存在“盖章完成合同上传”时固定优先下载和解析该附件;“合同附件”仅作为失败降级来源。 |
|
||||
|
||||
## 制程品质异常预警
|
||||
|
||||
| 功能项 | 状态 | 说明 |
|
||||
| --- | --- | --- |
|
||||
| 滚动统计与升级规则 | 规划中 | 料号 + 不良类别,申请日期计次。近一年为扫描日减 1 年至前 1 天,≥ 3 才预警;当月按自然月计含当天。周报给品质担当,当月第 1/2/≥3 笔分别升级到品质+生产经副理、COO、老板(抄送 COO、品质、生产经副理)。废弃和撤销不计入。权威:[features/process-quality-alert/demand.md](features/process-quality-alert/demand.md)。 |
|
||||
| OA 接入与 OA 邮件 | 未开始 | 流程表、字段和发信方式留设计文档。需求只定渠道是 OA 邮件。 |
|
||||
| 收件人与待确认口径 | 待确认 | 五个岗位界面配置、不写死姓名。一单多行是否按行计次、空不良类别是否排除、具体人员尚未确认。 |
|
||||
|
||||
## 设备验收预警
|
||||
|
||||
| 功能项 | 状态 | 说明 |
|
||||
| --- | --- | --- |
|
||||
| 停留预警规则 | 需求已冻结 | 从第一次进入「使用部门担当」起按自然日累计,直到停表。只监控未归档、有效、可以验收的 OA 资产验收单。再进入仍用第一次写入的 `sbsyrjssj`,不从 0 重计。权威:[features/equipment-acceptance-warning/demand.md](features/equipment-acceptance-warning/demand.md)。 |
|
||||
| 只读同步 | 已实现 | 平台管理员 `POST /api/equipment-acceptance/sync` 拉取 E10 验收单、流程状态、当前节点和操作人。按 `sfkyzcys`、`sfzfth`、`flowstatus` 3/4/5 标停表;`flowstatus` 为 7、8、99、-99 时记为已撤销并不再提醒。不查询、不保存 `isremark`。不保存 `optgroupid`、`batch_number`、`operate_log_id`。 |
|
||||
| 停留列表 | 已实现 | 入口与合同付款预警相同:内置 Chat Agent `equipment_acceptance` 替换对话区。有权限的用户看列表和详情,同步按钮只给平台管理员。 |
|
||||
| 停留预警规则 | 需求已冻结 | 从第一次进入「使用部门担当」起按自然日累计,直到停表。未归档且已开始计时的单据,可以验收为是或未标明都监控,明确为否才不监控。再进入仍用第一次写入的 `sbsyrjssj`,不从 0 重计。权威:[features/equipment-acceptance-warning/demand.md](features/equipment-acceptance-warning/demand.md)。 |
|
||||
| 只读同步 | 已实现 | 平台管理员 `POST /api/equipment-acceptance/sync` 拉取 E10 与 E8 未归档验收单、流程状态、当前节点和操作人。不抓归档(E10 `flowstatus = 3`,E8 `currentnodetype = 3`)。按 `sfkyzcys`、`sfzfth`、`flowstatus` 4/5 标停表;`flowstatus` 为 7、8、99、-99 时记为已撤销并不再提醒。本次结果里没有的本地单删除,并取消未发送预警。不查询、不保存 `isremark`。不保存 `optgroupid`、`batch_number`、`operate_log_id`。 |
|
||||
| 停留列表 | 已实现 | 入口与合同付款预警相同:内置 Chat Agent `equipment_acceptance` 替换对话区。只列出未归档单据,并展示流程编号、标题和创建时间。有权限的用户看列表和详情,同步按钮只给平台管理员。 |
|
||||
| 预警配置 | 已实现 | 停留情况旁的「预警配置」页。四档天数默认 30/37/44/51,第 4 轮默认关闭,打开后才通知总经理。采购经副理、COO、总经理选择系统用户。发送时刻不在此页,由排程 Cron 配置,默认每周五 18:00。 |
|
||||
| 发送记录 | 已实现 | Chat 页签「发送记录」。按验收单和档位列出主送、抄送、结果、Excel 附件和发送时间。发给每位收件人的 Excel 归档后挂在对应行上,点文件名下载。`GET /api/equipment-acceptance/sends`。管理员可立即扫描或发送。 |
|
||||
| 四档企业微信升级 | 已实现 | 超过 30/37/44/51 天各发一次。担当、直接主管、经副理取当前节点处理人及其上级;采购担当取流程申请人。采购经副理、COO、总经理为可配置固定岗位。每天 06:00 同步并生成待发送,每周五 18:00 按收件人发送一条汇总卡片和一份 Excel 明细。停表取消未发送。已发送不撤回、不重发。当前处理人就是当前节点上的 `userid`,不使用 `isremark`。设计:[features/equipment-acceptance-warning/technical.md](features/equipment-acceptance-warning/technical.md)。 |
|
||||
| 四档企业微信升级 | 已按使用部门担当 | 超过 30/37/44/51 天各发一次。第 1 档主送使用部门担当,第 2 档主送其经副理,直接主管也取这个人。E8 与 E10 相同。采购担当取流程申请人。采购经副理、COO、总经理为可配置固定岗位。每天 06:00 同步并生成待发送,每周五 18:00 按收件人发送一条汇总卡片和一份 Excel 明细。停表取消未发送。已发送不撤回、不重发。设计:[features/equipment-acceptance-warning/technical.md](features/equipment-acceptance-warning/technical.md)。 |
|
||||
| E8 补抓 | 已接上查询 | 读取 `ecology` 上的验收单,与 E10 分来源保存。计时起点 `syddjssj`。暂停 `currentstatus = 0` 按撤销停表。没有作废、强制结束。见 [technical.md](features/equipment-acceptance-warning/technical.md)。 |
|
||||
|
||||
## 知识库同步状态校验
|
||||
|
||||
|
||||
@@ -22,6 +22,11 @@
|
||||
- 验收单归档不走合同申请单 HTTP 列表,而查 OA SQL Server(凭据复用 `OA_SQLSERVER_*`):`formtable_main_324.cgdh` 为采购单号,`requestId` 关联 `workflow_requestbase`,`currentnodetype='3'` 为已归档(0 创建 / 1 批准 / 2 提交 / 3 归档)。归档日取 `lastoperatedate`/`lastoperatetime`。事件幂等键 `oa-acceptance:{requestId}:c{contractId}`,按采购单号匹配台账;独立断点 `oa-acceptance-archive`。查询失败 fail-safe 跳过且不推进该断点。节点后于事件生成时,`_persist_payment_plan` 回放已有验收事件计算验收款/质保款日期。表名/字段可由 `CONTRACT_PAYMENT_OA_ACCEPTANCE_*` 覆盖。
|
||||
- 第二、三轮收件人查同一 OA SQL:`HrmResource.lastname` 唯一匹配台账申请人,取其 `departmentid`;`Matrixtable_3.bm` 关联部门,`zz` 为第二轮、`jfl` 为第三轮。该 ID 即 `HrmResource.id` 与企业微信 userid。优先按 `users.wecom_userid` 映射系统用户,未绑定再用主管 `lastname` 唯一匹配 `real_name`;查不到不向第一轮兜底。表名/字段可由 `CONTRACT_PAYMENT_OA_HRM_*`、`CONTRACT_PAYMENT_OA_MATRIX_*` 覆盖。
|
||||
|
||||
## 设备验收预警(2026-10)
|
||||
|
||||
- 已实现的同步只读 E10:`OA_E10_SQLSERVER_*`,验收单 `ecology10.dbo.ft_gdzcysdv2`,流程 `wfc_requestbase` / `wfc_currentnode` / `wfc_operate`,人员 `eteams.dbo.employee`。不回退 E8。本地快照按 `request_id` 唯一。每天 06:00 先同步再生成待发送,每周五 18:00 只发送。
|
||||
- E8 补抓已接上。`OA_SQLSERVER_*` 读 `ecology`。与 E10 分来源保存。暂停 `currentstatus = 0` 按撤销停表。没有作废、强制结束。字段见 [features/equipment-acceptance-warning/technical.md](features/equipment-acceptance-warning/technical.md)。
|
||||
|
||||
## 货代发货通知 STP + 例外工作台(2026-07-29)
|
||||
|
||||
### 阶段与状态职责基线(2026-08)
|
||||
|
||||
@@ -2,7 +2,9 @@
|
||||
* features/equipment-acceptance/api/equipment-acceptance.api.ts
|
||||
* 用途:设备验收预警同步列表、详情和手动同步。
|
||||
* 依赖:统一 requestJson;后端 /api/equipment-acceptance。
|
||||
* 逻辑:Chat 作业面调用。同步只读 E10。配置只保存天数和系统用户,不保存发送时刻。
|
||||
* 逻辑:Chat 作业面调用。同步同时读 E10 和 E8,列表用来源字段区分。
|
||||
* 停留列表的 keyword 同时查流程编号、验收单号、采购单号,applicant 只查申请人。
|
||||
* 配置只保存天数和系统用户,不保存发送时刻。
|
||||
* 保存配置自行声明 Content-Type: application/json,供 Flask get_json 解析。
|
||||
* 发送记录只读已落库的行。每位收件人的 Excel 可再下载。
|
||||
*/
|
||||
@@ -23,7 +25,15 @@ export interface EquipmentAcceptanceOperator {
|
||||
|
||||
export interface EquipmentAcceptanceOrder {
|
||||
id: number;
|
||||
/** 来源。e10 或 e8。旧数据未返回时为空。 */
|
||||
oa_system?: string | null;
|
||||
acceptance_no?: string | null;
|
||||
/** 流程编号。E10 为 requestmark,E8 为 lcbh。 */
|
||||
flow_no?: string | null;
|
||||
/** 流程标题。两边都是流程表 requestname。 */
|
||||
request_title?: string | null;
|
||||
/** 流程创建时间。E10 为 createdatetime,E8 为 createdate 加 createtime。 */
|
||||
request_created_at?: string | null;
|
||||
purchase_order_no?: string | null;
|
||||
contract_no?: string | null;
|
||||
timer_started_at?: string | null;
|
||||
@@ -72,19 +82,27 @@ export interface EquipmentAcceptanceSyncResult {
|
||||
|
||||
/**
|
||||
* 分页查询已同步的验收单。
|
||||
* 核心逻辑:focus 对应原型分组。空或 all 不过滤。
|
||||
* 核心逻辑:focus 对应状态分组。keyword 同时匹配流程编号、验收单号、采购单号。applicant 只匹配申请人。空值不传。
|
||||
* @param params.focus - watching、overdue、stopped、not_started
|
||||
* @param params.keyword - 三种单号的包含匹配
|
||||
* @param params.applicant - 申请人姓名的包含匹配
|
||||
* @param params.page - 页码,从 1 开始
|
||||
* @param params.pageSize - 每页条数
|
||||
* @returns 分页快照和全部单据汇总
|
||||
* @returns 分页快照和汇总。汇总不看状态分组,但跟着单号和申请人走
|
||||
*/
|
||||
export function listEquipmentAcceptanceOrders(params?: {
|
||||
focus?: string;
|
||||
keyword?: string;
|
||||
applicant?: string;
|
||||
page?: number;
|
||||
pageSize?: number;
|
||||
}) {
|
||||
const query = new URLSearchParams();
|
||||
if (params?.focus && params.focus !== 'all') query.set('focus', params.focus);
|
||||
const keyword = params?.keyword?.trim();
|
||||
const applicant = params?.applicant?.trim();
|
||||
if (keyword) query.set('keyword', keyword);
|
||||
if (applicant) query.set('applicant', applicant);
|
||||
if (params?.page) query.set('page', String(params.page));
|
||||
if (params?.pageSize) query.set('page_size', String(params.pageSize));
|
||||
const suffix = query.toString() ? `?${query.toString()}` : '';
|
||||
|
||||
+141
-89
@@ -1,19 +1,30 @@
|
||||
<!--
|
||||
features/equipment-acceptance/components/EquipmentAcceptanceChatPanel.vue
|
||||
用途:设备验收预警 Chat 主区:停留列表、详情、发送记录、预警配置,以及管理员同步、扫描和发送。
|
||||
依赖:停留列表、详情、发送记录、配置页、auth.store、equipment-acceptance.api、DeleteConfirmDialog、vue-router query。
|
||||
依赖:停留列表、详情、发送记录、配置页、Element Plus、auth.store、equipment-acceptance.api、vue-router query。
|
||||
逻辑:由 ChatViewContent 在 agent_code=equipment_acceptance 时替换消息列表与输入框。
|
||||
本文件引入 Element 样式并包住 ElConfigProvider。标题和页签压到两行,下面整块留给当前页。
|
||||
view=config 打开预警配置;view=sends 打开发送记录;orderId 只在停留列表下钻。
|
||||
同步只在停留列表。扫描和发送只在发送记录,且仅平台管理员可见。
|
||||
-->
|
||||
<script setup lang="ts">
|
||||
import { computed, ref } from 'vue';
|
||||
import { useRoute, useRouter } from 'vue-router';
|
||||
import { RefreshCw } from 'lucide-vue-next';
|
||||
import { Refresh } from '@element-plus/icons-vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import {
|
||||
ElButton,
|
||||
ElConfigProvider,
|
||||
ElMessageBox,
|
||||
ElTabPane,
|
||||
ElTabs,
|
||||
} from 'element-plus';
|
||||
import 'element-plus/dist/index.css';
|
||||
import 'element-plus/theme-chalk/dark/css-vars.css';
|
||||
import '@/features/admin/styles/element-trial.css';
|
||||
import { BusinessError } from '@/shared/api/client';
|
||||
import DeleteConfirmDialog from '@/shared/components/DeleteConfirmDialog.vue';
|
||||
import { useAuthStore } from '@/features/auth/stores/auth.store';
|
||||
import { useElementProvider } from '@/features/admin/composables/useElementProvider';
|
||||
import { useMessage } from '@/shared/composables/useMessage';
|
||||
import {
|
||||
scanEquipmentAcceptanceAlerts,
|
||||
@@ -32,9 +43,9 @@ const route = useRoute();
|
||||
const router = useRouter();
|
||||
const auth = useAuthStore();
|
||||
const msg = useMessage();
|
||||
const { elementLocale } = useElementProvider();
|
||||
const syncing = ref(false);
|
||||
const alertRunning = ref(false);
|
||||
const pendingAlert = ref<'scan' | 'send' | null>(null);
|
||||
const runningAction = ref<'scan' | 'send' | null>(null);
|
||||
const listPage = ref<{ reload: () => Promise<void> } | null>(null);
|
||||
const sendsPage = ref<{ reload: () => Promise<void> } | null>(null);
|
||||
|
||||
@@ -44,17 +55,6 @@ const activeView = computed<WorkspaceView>(() => {
|
||||
if (route.query.view === 'sends') return 'sends';
|
||||
return 'ledger';
|
||||
});
|
||||
const showAlertConfirm = computed({
|
||||
get: () => pendingAlert.value !== null,
|
||||
set: (open: boolean) => {
|
||||
if (!open) pendingAlert.value = null;
|
||||
},
|
||||
});
|
||||
const alertConfirmCopy = computed(() => (
|
||||
pendingAlert.value === 'send'
|
||||
? { title: t('admin.equipmentAcceptance.sendAlerts'), message: t('admin.equipmentAcceptance.sendConfirm') }
|
||||
: { title: t('admin.equipmentAcceptance.scanAlerts'), message: t('admin.equipmentAcceptance.scanConfirm') }
|
||||
));
|
||||
const detailId = computed(() => {
|
||||
if (activeView.value !== 'ledger') return null;
|
||||
const raw = Number(route.query.orderId);
|
||||
@@ -97,23 +97,33 @@ function selectView(view: WorkspaceView): void {
|
||||
}
|
||||
|
||||
/**
|
||||
* 管理员在发送记录页立即扫描或发送。
|
||||
* 核心逻辑:公共确认框点确定后才调用。先取出动作再关掉弹窗,避免关闭时把待执行动作清掉。
|
||||
* 只接受本页三个页签,避免 Element 回传任意字符串。
|
||||
* @param name - 被点中的页签名
|
||||
*/
|
||||
function confirmAlertAction(): void {
|
||||
const action = pendingAlert.value;
|
||||
pendingAlert.value = null;
|
||||
if (action) void runAlertAction(action);
|
||||
function onTabChange(name: string | number): void {
|
||||
if (name === 'ledger' || name === 'sends' || name === 'config') selectView(name);
|
||||
}
|
||||
|
||||
/**
|
||||
* 执行已经确认的扫描或发送。
|
||||
* 核心逻辑:扫描会同步 E10;发送把待发送记录推到企业微信。
|
||||
* 管理员在发送记录页确认后立即扫描或发送。
|
||||
* 核心逻辑:确认框取消会拒绝,这里直接返回。扫描会同步 E10;发送把待发送记录推到企业微信。
|
||||
* @param action - scan 或 send
|
||||
*/
|
||||
async function runAlertAction(action: 'scan' | 'send'): Promise<void> {
|
||||
if (alertRunning.value) return;
|
||||
alertRunning.value = true;
|
||||
async function askAlert(action: 'scan' | 'send'): Promise<void> {
|
||||
if (runningAction.value) return;
|
||||
const copy = action === 'send'
|
||||
? { title: t('admin.equipmentAcceptance.sendAlerts'), message: t('admin.equipmentAcceptance.sendConfirm') }
|
||||
: { title: t('admin.equipmentAcceptance.scanAlerts'), message: t('admin.equipmentAcceptance.scanConfirm') };
|
||||
try {
|
||||
await ElMessageBox.confirm(copy.message, copy.title, {
|
||||
type: 'warning',
|
||||
confirmButtonText: t('common.deleteDialog.confirm'),
|
||||
cancelButtonText: t('common.cancel'),
|
||||
});
|
||||
} catch {
|
||||
return;
|
||||
}
|
||||
runningAction.value = action;
|
||||
try {
|
||||
if (action === 'scan') {
|
||||
const result = await scanEquipmentAcceptanceAlerts();
|
||||
@@ -133,12 +143,12 @@ async function runAlertAction(action: 'scan' | 'send'): Promise<void> {
|
||||
} catch (error) {
|
||||
msg.error(error instanceof BusinessError ? error.message : t('admin.equipmentAcceptance.syncFailed'));
|
||||
} finally {
|
||||
alertRunning.value = false;
|
||||
runningAction.value = null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 管理员从 E10 同步后刷新列表。
|
||||
* 管理员从 OA 同步后刷新列表。
|
||||
* 核心逻辑:成功提示写入、跳过和本次未见条数。失败展示业务错误。
|
||||
*/
|
||||
async function runSync(): Promise<void> {
|
||||
@@ -161,65 +171,107 @@ async function runSync(): Promise<void> {
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<section class="flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden bg-[var(--surface-muted,#f4f7fb)]">
|
||||
<div class="flex flex-wrap items-center justify-between gap-2 px-5 pt-3">
|
||||
<div class="min-w-0">
|
||||
<h1 class="text-lg font-bold text-primary md:text-xl">{{ t('admin.equipmentAcceptance.title') }}</h1>
|
||||
<ElConfigProvider :locale="elementLocale">
|
||||
<section class="ea-workspace">
|
||||
<header class="ea-workspace__bar">
|
||||
<h1 class="section-title">{{ t('admin.equipmentAcceptance.title') }}</h1>
|
||||
<div v-if="isAdmin && activeView === 'sends'" class="ea-workspace__actions">
|
||||
<ElButton :loading="runningAction === 'scan'" :disabled="runningAction !== null" @click="askAlert('scan')">
|
||||
{{ t('admin.equipmentAcceptance.scanAlerts') }}
|
||||
</ElButton>
|
||||
<ElButton :loading="runningAction === 'send'" :disabled="runningAction !== null" @click="askAlert('send')">
|
||||
{{ t('admin.equipmentAcceptance.sendAlerts') }}
|
||||
</ElButton>
|
||||
</div>
|
||||
<ElButton
|
||||
v-else-if="isAdmin && activeView === 'ledger' && !detailId"
|
||||
:icon="Refresh"
|
||||
:loading="syncing"
|
||||
@click="runSync"
|
||||
>
|
||||
{{ t('admin.equipmentAcceptance.sync') }}
|
||||
</ElButton>
|
||||
</header>
|
||||
<ElTabs :model-value="activeView" class="ea-tabs" @tab-change="onTabChange">
|
||||
<ElTabPane v-for="tab in tabs" :key="tab.key" :name="tab.key" :label="tab.label" />
|
||||
</ElTabs>
|
||||
<div class="ea-workspace__body">
|
||||
<EquipmentAcceptanceDetailPage
|
||||
v-if="detailId"
|
||||
:order-id="detailId"
|
||||
@back="syncQuery('ledger', null)"
|
||||
/>
|
||||
<EquipmentAcceptanceConfigPage
|
||||
v-else-if="activeView === 'config'"
|
||||
:editable="isAdmin"
|
||||
/>
|
||||
<EquipmentAcceptanceSendsPage v-else-if="activeView === 'sends'" ref="sendsPage" />
|
||||
<EquipmentAcceptancePage
|
||||
v-else
|
||||
ref="listPage"
|
||||
@open-detail="syncQuery('ledger', $event)"
|
||||
/>
|
||||
</div>
|
||||
<div v-if="isAdmin && activeView === 'sends'" class="flex flex-wrap items-center gap-2">
|
||||
<button class="btn-secondary-ds" type="button" :disabled="alertRunning" @click="pendingAlert = 'scan'">
|
||||
{{ t('admin.equipmentAcceptance.scanAlerts') }}
|
||||
</button>
|
||||
<button class="btn-secondary-ds" type="button" :disabled="alertRunning" @click="pendingAlert = 'send'">
|
||||
{{ t('admin.equipmentAcceptance.sendAlerts') }}
|
||||
</button>
|
||||
</div>
|
||||
<button
|
||||
v-if="isAdmin && activeView === 'ledger' && !detailId"
|
||||
class="btn-secondary-ds"
|
||||
type="button"
|
||||
:disabled="syncing"
|
||||
@click="runSync"
|
||||
>
|
||||
<RefreshCw class="h-4 w-4" aria-hidden="true" />{{ t('admin.equipmentAcceptance.sync') }}
|
||||
</button>
|
||||
</div>
|
||||
<div class="mt-2 flex gap-0 border-b border-default px-5">
|
||||
<button
|
||||
v-for="tab in tabs"
|
||||
:key="tab.key"
|
||||
type="button"
|
||||
class="mb-[-1px] border-b-2 px-3 py-2 text-sm font-bold"
|
||||
:class="activeView === tab.key
|
||||
? 'border-brand-500 text-brand-600'
|
||||
: 'border-transparent text-muted hover:text-secondary'"
|
||||
@click="selectView(tab.key)"
|
||||
>
|
||||
{{ tab.label }}
|
||||
</button>
|
||||
</div>
|
||||
<EquipmentAcceptanceDetailPage
|
||||
v-if="detailId"
|
||||
:order-id="detailId"
|
||||
@back="syncQuery('ledger', null)"
|
||||
/>
|
||||
<EquipmentAcceptanceConfigPage
|
||||
v-else-if="activeView === 'config'"
|
||||
:editable="isAdmin"
|
||||
/>
|
||||
<EquipmentAcceptanceSendsPage v-else-if="activeView === 'sends'" ref="sendsPage" />
|
||||
<EquipmentAcceptancePage
|
||||
v-else
|
||||
ref="listPage"
|
||||
@open-detail="syncQuery('ledger', $event)"
|
||||
/>
|
||||
<DeleteConfirmDialog
|
||||
v-if="isAdmin"
|
||||
v-model="showAlertConfirm"
|
||||
:title="alertConfirmCopy.title"
|
||||
:message="alertConfirmCopy.message"
|
||||
confirm-tone="primary"
|
||||
@confirm="confirmAlertAction"
|
||||
/>
|
||||
</section>
|
||||
</section>
|
||||
</ElConfigProvider>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.ea-workspace {
|
||||
display: flex;
|
||||
flex: 1 1 auto;
|
||||
flex-direction: column;
|
||||
min-height: 0;
|
||||
min-width: 0;
|
||||
overflow: hidden;
|
||||
background: var(--surface-muted, var(--el-fill-color-light));
|
||||
}
|
||||
|
||||
.ea-workspace__bar {
|
||||
display: flex;
|
||||
flex: none;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 12px;
|
||||
padding: 8px 16px 0;
|
||||
}
|
||||
|
||||
.ea-workspace__actions {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.ea-tabs {
|
||||
flex: none;
|
||||
padding: 0 8px;
|
||||
}
|
||||
|
||||
.ea-tabs :deep(.el-tabs__header) {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.ea-tabs :deep(.el-tabs__nav-wrap::after) {
|
||||
height: 1px;
|
||||
background: var(--el-border-color-lighter);
|
||||
}
|
||||
|
||||
.ea-tabs :deep(.el-tabs__content) {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.ea-tabs :deep(.el-tabs__item) {
|
||||
height: 36px;
|
||||
padding: 0 12px;
|
||||
font-size: var(--el-font-size-base);
|
||||
line-height: 36px;
|
||||
}
|
||||
|
||||
.ea-workspace__body {
|
||||
display: flex;
|
||||
flex: 1 1 auto;
|
||||
flex-direction: column;
|
||||
min-height: 0;
|
||||
padding: 8px 12px 12px;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,41 @@
|
||||
/**
|
||||
* features/equipment-acceptance/composables/useFillHeight.ts
|
||||
* 用途:把 Element 表格高度收成容器剩余像素,表头固定、表体在卡片内滚动。
|
||||
* 依赖:vue。
|
||||
* 逻辑:停留列表和发送记录把表格外包一层,本函数监听该层高度并回写给 ElTable 的 height。
|
||||
*/
|
||||
import { onBeforeUnmount, onMounted, ref, type Ref } from 'vue';
|
||||
|
||||
/**
|
||||
* 读取容器当前高度,供 ElTable 占满剩余区域。
|
||||
* 核心逻辑:容器由 flex 撑开,表格再用同样的像素高度内部滚动,避免整页把表头卷走。
|
||||
* @param host - 表格外层,高度应等于剩余视口
|
||||
* @returns height 为不小于 160 的像素高度
|
||||
*/
|
||||
export function useFillHeight(host: Ref<HTMLElement | null>): { height: Ref<number> } {
|
||||
const height = ref(240);
|
||||
let observer: ResizeObserver | null = null;
|
||||
|
||||
/**
|
||||
* 用容器客户区高度更新表格。容器尚未挂上时跳过。
|
||||
*/
|
||||
function measure(): void {
|
||||
const el = host.value;
|
||||
if (!el) return;
|
||||
height.value = Math.max(160, Math.floor(el.clientHeight));
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
measure();
|
||||
if (typeof ResizeObserver === 'undefined' || !host.value) return;
|
||||
observer = new ResizeObserver(() => measure());
|
||||
observer.observe(host.value);
|
||||
});
|
||||
|
||||
onBeforeUnmount(() => {
|
||||
observer?.disconnect();
|
||||
observer = null;
|
||||
});
|
||||
|
||||
return { height };
|
||||
}
|
||||
+236
-91
@@ -1,13 +1,20 @@
|
||||
<!--
|
||||
features/equipment-acceptance/views/EquipmentAcceptanceConfigPage.vue
|
||||
用途:设备验收预警配置页。按升级轮次编辑天数、第 4 轮开关和三个固定岗位。
|
||||
依赖:equipment-acceptance.api、UserPickerDialog、userPicker.utils、vue-i18n。
|
||||
逻辑:由 Chat 作业面的「预警配置」Tab 嵌入。同一岗位在多个轮次里共用一个人。
|
||||
发送时刻不在本页,由排程 Cron 配置。非管理员只能查看。
|
||||
依赖:equipment-acceptance.api、Element Plus、UserPickerDialog、userPicker.utils、vue-i18n。
|
||||
逻辑:由 Chat 作业面的「预警配置」Tab 嵌入。样式和 ElConfigProvider 由作业面提供。
|
||||
同一岗位在多个轮次里共用一个人。发送时刻不在本页,由排程 Cron 配置。非管理员只能查看。
|
||||
-->
|
||||
<script setup lang="ts">
|
||||
import { computed, onMounted, ref } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import {
|
||||
ElButton,
|
||||
ElCard,
|
||||
ElCheckbox,
|
||||
ElInputNumber,
|
||||
ElLoading,
|
||||
} from 'element-plus';
|
||||
import { BusinessError } from '@/shared/api/client';
|
||||
import UserPickerDialog from '@/shared/components/UserPickerDialog.vue';
|
||||
import { useMessage } from '@/shared/composables/useMessage';
|
||||
@@ -60,6 +67,7 @@ const ROUNDS: Array<{ index: number; lines: RoundLine[] }> = [
|
||||
|
||||
const { t } = useI18n();
|
||||
const msg = useMessage();
|
||||
const vLoading = ElLoading.directive;
|
||||
const loading = ref(false);
|
||||
const saving = ref(false);
|
||||
const days = ref<number[]>([30, 37, 44, 51]);
|
||||
@@ -224,100 +232,74 @@ onMounted(() => {
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<section class="min-h-0 flex-1 overflow-auto px-5 pb-6 pt-3">
|
||||
<p class="mb-3 text-sm text-[#64748b]">{{ t('admin.equipmentAcceptance.configLead') }}</p>
|
||||
<p v-if="loading" class="text-sm text-[#64748b]">{{ t('admin.equipmentAcceptance.loading') }}</p>
|
||||
<template v-else>
|
||||
<section class="overflow-hidden rounded-2xl border border-[#dce4ef] bg-white">
|
||||
<div class="px-5 pb-2 pt-4">
|
||||
<h2 class="text-sm font-bold text-[#142033]">{{ t('admin.equipmentAcceptance.configSheetTitle') }}</h2>
|
||||
<p class="mt-1 text-xs text-[#64748b]">{{ t('admin.equipmentAcceptance.configSheetLead') }}</p>
|
||||
<section v-loading="loading" class="ea-scroll">
|
||||
<p class="ea-lead">{{ t('admin.equipmentAcceptance.configLead') }}</p>
|
||||
<ElCard v-if="!loading" shadow="never" class="ea-config-card">
|
||||
<template #header>
|
||||
<h2 class="ea-card-title">{{ t('admin.equipmentAcceptance.configSheetTitle') }}</h2>
|
||||
<p class="ea-lead">{{ t('admin.equipmentAcceptance.configSheetLead') }}</p>
|
||||
</template>
|
||||
<article
|
||||
v-for="round in ROUNDS"
|
||||
:key="round.index"
|
||||
class="ea-round"
|
||||
:class="round.index === ROUNDS.length - 1 ? 'ea-round--last' : ''"
|
||||
>
|
||||
<div class="ea-round__when">
|
||||
<b>{{ t('admin.equipmentAcceptance.roundName', { n: round.index + 1 }) }}</b>
|
||||
<label class="ea-days">
|
||||
{{ t('admin.equipmentAcceptance.overPrefix') }}
|
||||
<ElInputNumber
|
||||
v-model="days[round.index]"
|
||||
:min="1"
|
||||
:step="1"
|
||||
:precision="0"
|
||||
:disabled="!editable"
|
||||
controls-position="right"
|
||||
/>
|
||||
{{ t('admin.equipmentAcceptance.dayUnit') }}
|
||||
</label>
|
||||
<template v-if="round.index === 3">
|
||||
<ElCheckbox v-model="round4Enabled" :disabled="!editable">
|
||||
{{ t('admin.equipmentAcceptance.round4Enabled') }}
|
||||
</ElCheckbox>
|
||||
<p class="ea-lead">{{ t('admin.equipmentAcceptance.round4ShortHint') }}</p>
|
||||
</template>
|
||||
</div>
|
||||
<div class="px-3 pb-2">
|
||||
<article
|
||||
v-for="round in ROUNDS"
|
||||
:key="round.index"
|
||||
class="relative ml-4 grid grid-cols-1 gap-3 border-l-2 border-[#c9d4e3] py-4 pl-7 sm:grid-cols-[168px_minmax(0,1fr)] sm:gap-x-5"
|
||||
:class="round.index === ROUNDS.length - 1 ? 'border-transparent' : ''"
|
||||
>
|
||||
<span class="absolute -left-[7px] top-6 h-3 w-3 rounded-full border-2 border-white bg-[#1d4e89] shadow-[0_0_0_1px_#c9d4e3]"></span>
|
||||
<div class="flex flex-col gap-2">
|
||||
<b class="text-xs text-[#64748b]">{{ t('admin.equipmentAcceptance.roundName', { n: round.index + 1 }) }}</b>
|
||||
<label class="flex items-center gap-2 text-[13px] text-[#64748b]">
|
||||
{{ t('admin.equipmentAcceptance.overPrefix') }}
|
||||
<input
|
||||
v-model.number="days[round.index]"
|
||||
class="h-10 w-[72px] rounded-lg border border-[#d5dee8] bg-[#f8fafc] text-center text-[22px] font-semibold text-[#142033] disabled:opacity-70"
|
||||
type="number"
|
||||
min="1"
|
||||
:disabled="!editable"
|
||||
/>
|
||||
{{ t('admin.equipmentAcceptance.dayUnit') }}
|
||||
</label>
|
||||
<template v-if="round.index === 3">
|
||||
<label class="flex items-center gap-1.5 text-[13px] font-bold text-[#142033]">
|
||||
<input v-model="round4Enabled" class="h-4 w-4 accent-[#1d4e89]" type="checkbox" :disabled="!editable" />
|
||||
{{ t('admin.equipmentAcceptance.round4Enabled') }}
|
||||
</label>
|
||||
<small class="text-xs text-[#64748b]">{{ t('admin.equipmentAcceptance.round4ShortHint') }}</small>
|
||||
<div class="ea-round__who" :class="round.index === 3 && !round4Enabled ? 'is-muted' : ''">
|
||||
<div v-for="(line, lineIndex) in round.lines" :key="`${round.index}-${lineIndex}`" class="ea-line">
|
||||
<span class="ea-line__tag">{{ t(`admin.equipmentAcceptance.${line.tag}`) }}</span>
|
||||
<div class="ea-line__body">
|
||||
<template v-if="line.kind === 'plain'">
|
||||
<p class="ea-line__text">{{ t(`admin.equipmentAcceptance.${line.text}`) }}</p>
|
||||
<p v-if="line.note" class="ea-lead">{{ t(`admin.equipmentAcceptance.${line.note}`) }}</p>
|
||||
</template>
|
||||
</div>
|
||||
<div class="flex flex-col gap-2" :class="round.index === 3 && !round4Enabled ? 'opacity-45' : ''">
|
||||
<div v-for="(line, lineIndex) in round.lines" :key="`${round.index}-${lineIndex}`" class="flex items-start gap-2.5">
|
||||
<span class="mt-1.5 w-9 shrink-0 text-xs font-bold text-[#64748b]">{{ t(`admin.equipmentAcceptance.${line.tag}`) }}</span>
|
||||
<div class="min-w-0">
|
||||
<template v-if="line.kind === 'plain'">
|
||||
<p class="mt-1 text-sm font-semibold text-[#142033]">{{ t(`admin.equipmentAcceptance.${line.text}`) }}</p>
|
||||
<p v-if="line.note" class="mt-1 text-xs text-[#94a3b8]">{{ t(`admin.equipmentAcceptance.${line.note}`) }}</p>
|
||||
</template>
|
||||
<div v-else class="flex flex-wrap gap-2">
|
||||
<div
|
||||
v-for="role in line.roles"
|
||||
:key="role"
|
||||
class="flex min-h-8 items-center gap-2 rounded-full bg-[#eef3f8] py-1 pl-1 pr-2"
|
||||
>
|
||||
<span class="grid h-6 w-6 place-items-center rounded-full bg-[#d7e4f2] text-xs font-bold text-[#1d4e89]">{{ roleInitial(role) }}</span>
|
||||
<span class="flex flex-col leading-tight">
|
||||
<strong class="text-[13px] text-[#142033]">{{ roleName(role) || t('admin.equipmentAcceptance.roleEmpty') }}</strong>
|
||||
<span class="text-[11px] text-[#64748b]">{{ roleMeta(role) }}</span>
|
||||
</span>
|
||||
<button
|
||||
v-if="editable"
|
||||
class="text-xs font-bold text-[#1d4e89]"
|
||||
type="button"
|
||||
@click="openPicker(role)"
|
||||
>
|
||||
{{ roleIds[role] ? t('admin.equipmentAcceptance.replaceUser') : t('admin.equipmentAcceptance.selectUser') }}
|
||||
</button>
|
||||
<button
|
||||
v-if="editable && roleIds[role]"
|
||||
class="text-xs text-[#64748b]"
|
||||
type="button"
|
||||
@click="clearRole(role)"
|
||||
>
|
||||
{{ t('admin.equipmentAcceptance.clearUser') }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div v-else class="ea-people">
|
||||
<div v-for="role in line.roles" :key="role" class="ea-person">
|
||||
<span class="ea-person__avatar">{{ roleInitial(role) }}</span>
|
||||
<span class="ea-person__text">
|
||||
<strong>{{ roleName(role) || t('admin.equipmentAcceptance.roleEmpty') }}</strong>
|
||||
<span>{{ roleMeta(role) }}</span>
|
||||
</span>
|
||||
<ElButton v-if="editable" link type="primary" @click="openPicker(role)">
|
||||
{{ roleIds[role] ? t('admin.equipmentAcceptance.replaceUser') : t('admin.equipmentAcceptance.selectUser') }}
|
||||
</ElButton>
|
||||
<ElButton v-if="editable && roleIds[role]" link @click="clearRole(role)">
|
||||
{{ t('admin.equipmentAcceptance.clearUser') }}
|
||||
</ElButton>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</article>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex items-center justify-between gap-4 border-t border-[#dce4ef] bg-[#fafbfd] px-5 py-3.5">
|
||||
<span class="text-xs text-[#64748b]">{{ editable ? t('admin.equipmentAcceptance.configSaveHint') : t('admin.equipmentAcceptance.configReadOnly') }}</span>
|
||||
<button
|
||||
v-if="editable"
|
||||
class="h-9 rounded-lg bg-[#1d4e89] px-4 text-[13px] font-bold text-white disabled:opacity-50"
|
||||
type="button"
|
||||
:disabled="saving"
|
||||
@click="save"
|
||||
>
|
||||
{{ t('admin.equipmentAcceptance.saveConfig') }}
|
||||
</button>
|
||||
</div>
|
||||
</section>
|
||||
</template>
|
||||
</article>
|
||||
<div class="ea-config-foot">
|
||||
<span>{{ editable ? t('admin.equipmentAcceptance.configSaveHint') : t('admin.equipmentAcceptance.configReadOnly') }}</span>
|
||||
<ElButton v-if="editable" type="primary" :loading="saving" @click="save">
|
||||
{{ t('admin.equipmentAcceptance.saveConfig') }}
|
||||
</ElButton>
|
||||
</div>
|
||||
</ElCard>
|
||||
|
||||
<UserPickerDialog
|
||||
v-model="pickerOpen"
|
||||
@@ -329,3 +311,166 @@ onMounted(() => {
|
||||
/>
|
||||
</section>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.ea-scroll {
|
||||
flex: 1 1 auto;
|
||||
min-height: 240px;
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
.ea-lead {
|
||||
margin: 0;
|
||||
font-size: var(--el-font-size-extra-small);
|
||||
line-height: 1.4;
|
||||
color: var(--el-text-color-secondary);
|
||||
}
|
||||
|
||||
.ea-scroll > .ea-lead {
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
|
||||
.ea-config-card :deep(.el-card__header) {
|
||||
padding: 12px 16px 8px;
|
||||
}
|
||||
|
||||
.ea-config-card :deep(.el-card__body) {
|
||||
padding: 0 16px 12px;
|
||||
}
|
||||
|
||||
.ea-card-title {
|
||||
margin: 0 0 4px;
|
||||
font-size: var(--el-font-size-base);
|
||||
font-weight: var(--el-font-weight-primary);
|
||||
color: var(--el-text-color-primary);
|
||||
}
|
||||
|
||||
.ea-round {
|
||||
position: relative;
|
||||
display: grid;
|
||||
grid-template-columns: 200px minmax(0, 1fr);
|
||||
gap: 12px 20px;
|
||||
margin-left: 12px;
|
||||
border-left: 2px solid var(--el-border-color);
|
||||
padding: 12px 0 12px 20px;
|
||||
}
|
||||
|
||||
.ea-round--last {
|
||||
border-left-color: transparent;
|
||||
}
|
||||
|
||||
.ea-round::before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
left: -7px;
|
||||
top: 18px;
|
||||
width: 12px;
|
||||
height: 12px;
|
||||
border: 2px solid var(--el-bg-color);
|
||||
border-radius: 999px;
|
||||
background: var(--el-color-primary);
|
||||
box-shadow: 0 0 0 1px var(--el-border-color);
|
||||
}
|
||||
|
||||
.ea-round__when {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 8px;
|
||||
color: var(--el-text-color-secondary);
|
||||
font-size: var(--el-font-size-small);
|
||||
}
|
||||
|
||||
.ea-days {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.ea-days :deep(.el-input-number) {
|
||||
width: 120px;
|
||||
}
|
||||
|
||||
.ea-round__who.is-muted {
|
||||
opacity: 0.45;
|
||||
}
|
||||
|
||||
.ea-line {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
gap: 8px;
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
|
||||
.ea-line__tag {
|
||||
flex: none;
|
||||
width: 36px;
|
||||
margin-top: 6px;
|
||||
font-size: var(--el-font-size-extra-small);
|
||||
font-weight: var(--el-font-weight-primary);
|
||||
color: var(--el-text-color-secondary);
|
||||
}
|
||||
|
||||
.ea-line__text {
|
||||
margin: 6px 0 0;
|
||||
color: var(--el-text-color-primary);
|
||||
font-weight: var(--el-font-weight-primary);
|
||||
}
|
||||
|
||||
.ea-people {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.ea-person {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
min-height: 32px;
|
||||
padding: 4px 8px 4px 4px;
|
||||
border-radius: 999px;
|
||||
background: var(--el-fill-color-light);
|
||||
}
|
||||
|
||||
.ea-person__avatar {
|
||||
display: grid;
|
||||
width: 24px;
|
||||
height: 24px;
|
||||
place-items: center;
|
||||
border-radius: 999px;
|
||||
background: var(--el-color-primary-light-8);
|
||||
color: var(--el-color-primary);
|
||||
font-size: var(--el-font-size-extra-small);
|
||||
font-weight: var(--el-font-weight-primary);
|
||||
}
|
||||
|
||||
.ea-person__text {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
line-height: 1.2;
|
||||
color: var(--el-text-color-primary);
|
||||
}
|
||||
|
||||
.ea-person__text span {
|
||||
color: var(--el-text-color-secondary);
|
||||
font-size: var(--el-font-size-extra-small);
|
||||
}
|
||||
|
||||
.ea-config-foot {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 12px;
|
||||
margin: 4px -16px 0;
|
||||
padding: 12px 16px;
|
||||
border-top: 1px solid var(--el-border-color-lighter);
|
||||
color: var(--el-text-color-secondary);
|
||||
font-size: var(--el-font-size-extra-small);
|
||||
}
|
||||
|
||||
@media (max-width: 720px) {
|
||||
.ea-round {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
+75
@@ -0,0 +1,75 @@
|
||||
/**
|
||||
* features/equipment-acceptance/views/EquipmentAcceptanceDetailPage.spec.ts
|
||||
* 用途:确认详情在接口返回后能画出标题和当前节点表格,加载遮罩会关掉。
|
||||
* 依赖:EquipmentAcceptanceDetailPage、vue-i18n、@vue/test-utils。
|
||||
* 逻辑:只挂本页,接口用桩数据。不覆盖对话壳。
|
||||
*/
|
||||
import { flushPromises, mount } from '@vue/test-utils';
|
||||
import { createI18n } from 'vue-i18n';
|
||||
import { describe, expect, it, vi } from 'vitest';
|
||||
import { getEquipmentAcceptanceOrder } from '../api/equipment-acceptance.api';
|
||||
import EquipmentAcceptanceDetailPage from './EquipmentAcceptanceDetailPage.vue';
|
||||
|
||||
vi.mock('../api/equipment-acceptance.api', () => ({
|
||||
getEquipmentAcceptanceOrder: vi.fn(),
|
||||
}));
|
||||
|
||||
const sample = {
|
||||
id: 1,
|
||||
request_title: '托威斯平台式自动拉钉机/1套资产验收单提交OA-20260718000003',
|
||||
acceptance_no: '20260718000003',
|
||||
flow_no: '20260718-1520',
|
||||
request_created_at: '2026-07-18T16:51:47',
|
||||
finished_at: null,
|
||||
applicant_name: '柴晓红',
|
||||
purchase_order_no: '5202-2606030008',
|
||||
flow_status_raw: 1,
|
||||
dwell_days: null,
|
||||
timer_started_at: null,
|
||||
can_accept: 1,
|
||||
is_returned: 0,
|
||||
cannot_accept_note: null,
|
||||
monitor_status: 'not_started',
|
||||
overdue: false,
|
||||
nodes: [{ node_id: '1', node_name: '品质担当', node_type: null }],
|
||||
operators: [{ node_id: '1', user_id: '9', handler_name: '温德佳', handler_job_num: '25060045' }],
|
||||
};
|
||||
|
||||
describe('设备验收详情', () => {
|
||||
it('接口返回后显示标题、当前节点、处理人和工号,并关掉加载遮罩', async () => {
|
||||
const errors: unknown[] = [];
|
||||
vi.mocked(getEquipmentAcceptanceOrder).mockResolvedValue(sample as never);
|
||||
const i18n = createI18n({
|
||||
legacy: false,
|
||||
locale: 'zh-CN',
|
||||
missing: (_locale, key) => key,
|
||||
messages: { 'zh-CN': {} },
|
||||
});
|
||||
const wrapper = mount(EquipmentAcceptanceDetailPage, {
|
||||
props: { orderId: 1 },
|
||||
global: {
|
||||
plugins: [i18n],
|
||||
config: {
|
||||
errorHandler(err) {
|
||||
errors.push(err);
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
await flushPromises();
|
||||
await new Promise((resolve) => setTimeout(resolve, 500));
|
||||
const text = wrapper.text();
|
||||
// 标题用流程标题,不再用验收单号占页眉。
|
||||
expect(text).toContain(sample.request_title);
|
||||
// 采购单号单独占字段表第一行。
|
||||
expect(wrapper.find('.el-descriptions__label').text()).toBe('admin.equipmentAcceptance.purchaseOrderNo');
|
||||
// 当前节点、处理人、工号只出现在下方表格。
|
||||
expect(text).toContain('品质担当');
|
||||
expect(text).toContain('温德佳');
|
||||
expect(text).toContain('25060045');
|
||||
// 加载结束不能留下可见遮罩,否则页面会一直转圈。
|
||||
const mask = wrapper.find('.el-loading-mask');
|
||||
expect(mask.exists() && mask.isVisible()).toBe(false);
|
||||
expect(errors).toEqual([]);
|
||||
});
|
||||
});
|
||||
+218
-149
@@ -1,13 +1,26 @@
|
||||
<!--
|
||||
features/equipment-acceptance/views/EquipmentAcceptanceDetailPage.vue
|
||||
用途:一张验收单的详情卡片,展示状态徽章、停留进度、当前节点和操作人。
|
||||
依赖:equipment-acceptance.api、vue-i18n、统一消息提示。
|
||||
逻辑:由 Chat 作业面在选中某行后展示。操作人只显示姓名和工号。
|
||||
用途:一张验收单的详情卡片,展示状态标签、停留进度、当前节点和操作人。
|
||||
依赖:equipment-acceptance.api、Element Plus、vue-i18n、统一消息提示。
|
||||
逻辑:由 Chat 作业面在选中某行后展示。样式和 ElConfigProvider 由作业面提供。
|
||||
页眉是流程标题。采购单号单独占第一行。流程编号与验收单单号、创建时间与结束时间各占一行。申请人单独占一行。
|
||||
监控状态贴在标题下方。当前节点、处理人和工号只在下方表格出现一次。
|
||||
进度条只按签核天数画到 30/37/44/51,不表示已经发送。
|
||||
-->
|
||||
<script setup lang="ts">
|
||||
import { computed, onMounted, ref, watch } from 'vue';
|
||||
import { ArrowLeft } from '@element-plus/icons-vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import {
|
||||
ElButton,
|
||||
ElDescriptions,
|
||||
ElDescriptionsItem,
|
||||
ElLoading,
|
||||
ElProgress,
|
||||
ElTable,
|
||||
ElTableColumn,
|
||||
ElTag,
|
||||
} from 'element-plus';
|
||||
import { BusinessError } from '@/shared/api/client';
|
||||
import { useMessage } from '@/shared/composables/useMessage';
|
||||
import {
|
||||
@@ -23,7 +36,7 @@ const emit = defineEmits<{
|
||||
back: [];
|
||||
}>();
|
||||
|
||||
type BadgeTone = 'red' | 'green' | 'gray';
|
||||
type TagType = 'danger' | 'success' | 'info';
|
||||
|
||||
const STOPPED_STATUSES = new Set([
|
||||
'stopped_returned',
|
||||
@@ -49,21 +62,68 @@ const FLOW_STATUS_KEYS: Record<number, string> = {
|
||||
|
||||
const REMINDER_DAYS = [30, 37, 44, 51];
|
||||
|
||||
interface OperatorRow {
|
||||
rowKey: string;
|
||||
nodeName: string;
|
||||
handlerName: string;
|
||||
jobNum: string;
|
||||
}
|
||||
|
||||
const { t } = useI18n();
|
||||
const msg = useMessage();
|
||||
const vLoading = ElLoading.directive;
|
||||
const loading = ref(false);
|
||||
const order = ref<EquipmentAcceptanceOrder | null>(null);
|
||||
const operatorRows = ref<OperatorRow[]>([]);
|
||||
|
||||
/**
|
||||
* 把接口里的节点和操作人收成表格行。
|
||||
* 核心逻辑:操作人的 node_id 对上节点名。没有操作人时仍列出节点,人和工号为空。
|
||||
* 表格会改传入的数组,所以这里每次返回新的普通对象,不把计算属性直接交给表格。
|
||||
* @param current - 当前验收单,空则没有行
|
||||
* @returns 当前节点、处理人、工号各一列
|
||||
*/
|
||||
function buildOperatorRows(current: EquipmentAcceptanceOrder | null): OperatorRow[] {
|
||||
if (!current) return [];
|
||||
const nodes = Array.isArray(current.nodes) ? current.nodes.filter((node) => node) : [];
|
||||
const people = Array.isArray(current.operators) ? current.operators.filter((item) => item) : [];
|
||||
const nodeNameById = new Map(
|
||||
nodes
|
||||
.filter((node) => node.node_id)
|
||||
.map((node) => [String(node.node_id), node.node_name || '—']),
|
||||
);
|
||||
const namedNodes = nodes.filter((node) => node.node_name);
|
||||
const onlyNamed = namedNodes.length === 1 ? namedNodes[0] : undefined;
|
||||
const fallbackNode = onlyNamed?.node_name || '—';
|
||||
if (!people.length) {
|
||||
return namedNodes.map((node, index) => ({
|
||||
rowKey: `node-${node.node_id || index}`,
|
||||
nodeName: node.node_name || '—',
|
||||
handlerName: '—',
|
||||
jobNum: '—',
|
||||
}));
|
||||
}
|
||||
return people.map((item, index) => ({
|
||||
rowKey: `${item.user_id || ''}-${item.node_id || ''}-${index}`,
|
||||
nodeName: (item.node_id && nodeNameById.get(String(item.node_id))) || fallbackNode,
|
||||
handlerName: item.handler_name || '—',
|
||||
jobNum: item.handler_job_num || '—',
|
||||
}));
|
||||
}
|
||||
|
||||
/**
|
||||
* 读取当前验收单详情。
|
||||
* 核心逻辑:orderId 变化时重新请求。失败清空详情,避免上一张单残留。
|
||||
* 核心逻辑:先算出表格行,再写入单据。失败时单据和表格一起清空,避免上一张单残留。
|
||||
*/
|
||||
async function load(): Promise<void> {
|
||||
loading.value = true;
|
||||
try {
|
||||
order.value = await getEquipmentAcceptanceOrder(props.orderId);
|
||||
const next = await getEquipmentAcceptanceOrder(props.orderId);
|
||||
operatorRows.value = buildOperatorRows(next);
|
||||
order.value = next;
|
||||
} catch (error) {
|
||||
order.value = null;
|
||||
operatorRows.value = [];
|
||||
msg.error(error instanceof BusinessError ? error.message : t('admin.equipmentAcceptance.detailLoadFailed'));
|
||||
} finally {
|
||||
loading.value = false;
|
||||
@@ -80,6 +140,16 @@ function dateText(value?: string | null): string {
|
||||
return value.slice(0, 10);
|
||||
}
|
||||
|
||||
/**
|
||||
* 展示流程创建时间,保留时分秒,不按浏览器时区再换算。
|
||||
* @param value - 接口返回的 ISO 时间
|
||||
* @returns 本地墙上时间或横线
|
||||
*/
|
||||
function dateTimeText(value?: string | null): string {
|
||||
if (!value) return '—';
|
||||
return value.replace('T', ' ').replace(/Z$/, '').slice(0, 19);
|
||||
}
|
||||
|
||||
/**
|
||||
* 把 0/1 写成否/是。可以验收为空时显示未标明,退回在同步时已把空收成否。
|
||||
* @param value - 标准 0 否、1 是
|
||||
@@ -114,55 +184,23 @@ function dwellText(item: EquipmentAcceptanceOrder): string {
|
||||
}
|
||||
|
||||
/**
|
||||
* 当前节点名称。没有节点时为空,模板改显示横线。
|
||||
* 与列表相同的标签颜色。红是已逾期,绿是不再提醒,灰是未开始和未超时。
|
||||
* @param item - 当前验收单
|
||||
* @returns 节点名称列表
|
||||
* @returns 文案和 Element 标签类型
|
||||
*/
|
||||
function nodeNames(item: EquipmentAcceptanceOrder): string[] {
|
||||
return (item.nodes || []).map((node) => node.node_name).filter((name): name is string => Boolean(name));
|
||||
}
|
||||
|
||||
/**
|
||||
* 当前处理人去重后拼成一行。
|
||||
* @param item - 当前验收单
|
||||
* @returns 处理人姓名
|
||||
*/
|
||||
function handlerNames(item: EquipmentAcceptanceOrder): string {
|
||||
const names = Array.from(new Set(
|
||||
(item.operators || []).map((person) => person.handler_name).filter((name): name is string => Boolean(name)),
|
||||
));
|
||||
return names.length ? names.join('、') : '—';
|
||||
}
|
||||
|
||||
/**
|
||||
* 与列表相同的徽章颜色。红是已逾期,绿是不再提醒,灰是未开始和未超时。
|
||||
* @param item - 当前验收单
|
||||
* @returns 文案和颜色
|
||||
*/
|
||||
function statusBadge(item: EquipmentAcceptanceOrder): { label: string; tone: BadgeTone } {
|
||||
function statusTag(item: EquipmentAcceptanceOrder): { label: string; type: TagType } {
|
||||
if (item.monitor_status === 'watching' && item.overdue) {
|
||||
return { label: t('admin.equipmentAcceptance.badgeOverdue'), tone: 'red' };
|
||||
return { label: t('admin.equipmentAcceptance.badgeOverdue'), type: 'danger' };
|
||||
}
|
||||
if (item.monitor_status === 'watching') {
|
||||
return { label: t('admin.equipmentAcceptance.badgeOnTime'), tone: 'gray' };
|
||||
return { label: t('admin.equipmentAcceptance.badgeOnTime'), type: 'info' };
|
||||
}
|
||||
return {
|
||||
label: t(`admin.equipmentAcceptance.statusLabel.${item.monitor_status}`),
|
||||
tone: STOPPED_STATUSES.has(item.monitor_status) ? 'green' : 'gray',
|
||||
type: STOPPED_STATUSES.has(item.monitor_status) ? 'success' : 'info',
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* 徽章底色。
|
||||
* @param tone - 徽章颜色
|
||||
* @returns Tailwind 类名
|
||||
*/
|
||||
function badgeClass(tone: BadgeTone): string {
|
||||
if (tone === 'red') return 'bg-[#fff0ef] text-[#b42318]';
|
||||
if (tone === 'green') return 'bg-[#eafaf1] text-[#067647]';
|
||||
return 'bg-[#edf1f6] text-[#475569]';
|
||||
}
|
||||
|
||||
/**
|
||||
* 按签核天数在 0 到第 4 档之间画进度。没有天数时不画。
|
||||
* 核心逻辑:刻度至少到 60 天,避免 51 天贴在条的尽头。
|
||||
@@ -172,8 +210,9 @@ const track = computed(() => {
|
||||
if (order.value?.monitor_status === 'not_started' || days == null) return null;
|
||||
const lastMark = REMINDER_DAYS[REMINDER_DAYS.length - 1] ?? 51;
|
||||
const scale = Math.max(60, lastMark + 9, days);
|
||||
const percent = Math.min(100, Math.round((days / scale) * 100));
|
||||
return {
|
||||
width: `${Math.min(100, Math.round((days / scale) * 100))}%`,
|
||||
percent,
|
||||
marks: [0, ...REMINDER_DAYS, scale].map((day) => ({
|
||||
day,
|
||||
left: `${(day / scale) * 100}%`,
|
||||
@@ -192,35 +231,22 @@ watch(() => props.orderId, () => {
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<section class="min-h-0 flex-1 overflow-auto px-5 pb-6 pt-3">
|
||||
<button
|
||||
class="mb-3 rounded-lg border border-[#dce4ef] bg-white px-3 py-1.5 text-xs font-bold text-[#142033]"
|
||||
type="button"
|
||||
@click="emit('back')"
|
||||
>
|
||||
<section v-loading="loading" class="ea-scroll">
|
||||
<ElButton class="ea-back" :icon="ArrowLeft" @click="emit('back')">
|
||||
{{ t('admin.equipmentAcceptance.back') }}
|
||||
</button>
|
||||
<p v-if="loading && !order" class="text-sm text-[#64748b]">{{ t('admin.equipmentAcceptance.loading') }}</p>
|
||||
<article v-else-if="order" class="overflow-hidden rounded-xl border border-[#dce4ef] bg-white">
|
||||
<div class="flex items-start justify-between gap-3 px-4 pt-4">
|
||||
<h2 class="text-lg font-bold text-[#142033]">{{ order.acceptance_no || '—' }}</h2>
|
||||
<span
|
||||
class="inline-flex shrink-0 rounded-full px-2 py-0.5 text-[11px] font-extrabold"
|
||||
:class="badgeClass(statusBadge(order).tone)"
|
||||
>
|
||||
{{ statusBadge(order).label }}
|
||||
</span>
|
||||
</div>
|
||||
</ElButton>
|
||||
<article v-if="order" class="ea-detail">
|
||||
<header class="ea-detail__head">
|
||||
<h2>{{ order.request_title || order.acceptance_no || '—' }}</h2>
|
||||
<ElTag :type="statusTag(order).type" effect="light">{{ statusTag(order).label }}</ElTag>
|
||||
</header>
|
||||
|
||||
<div v-if="track" class="px-7 pt-5">
|
||||
<div class="h-2 overflow-hidden rounded-full bg-[#e7edf5]">
|
||||
<i class="block h-full rounded-full bg-gradient-to-r from-[#93c5fd] to-[#2563eb]" :style="{ width: track.width }"></i>
|
||||
</div>
|
||||
<div class="relative mt-1 h-4 text-[11px] text-[#64748b]">
|
||||
<div v-if="track" class="ea-track">
|
||||
<ElProgress :percentage="track.percent" :show-text="false" :stroke-width="8" />
|
||||
<div class="ea-track__marks">
|
||||
<span
|
||||
v-for="mark in track.marks"
|
||||
:key="mark.day"
|
||||
class="absolute -translate-x-1/2 whitespace-nowrap"
|
||||
:style="{ left: mark.left }"
|
||||
>
|
||||
{{ mark.label }}
|
||||
@@ -228,87 +254,130 @@ watch(() => props.orderId, () => {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="flex flex-wrap gap-1.5 px-4 pb-1 pt-4">
|
||||
<span
|
||||
v-for="(name, index) in nodeNames(order)"
|
||||
:key="`${name}-${index}`"
|
||||
class="rounded-full bg-[#dbeafe] px-2 py-1 text-[11px] font-extrabold text-[#1d4ed8]"
|
||||
>
|
||||
{{ name }}
|
||||
</span>
|
||||
<span v-if="!nodeNames(order).length" class="text-sm text-[#64748b]">—</span>
|
||||
</div>
|
||||
<ElDescriptions :column="2" border>
|
||||
<ElDescriptionsItem :label="t('admin.equipmentAcceptance.purchaseOrderNo')" :span="2">
|
||||
{{ order.purchase_order_no || '—' }}
|
||||
</ElDescriptionsItem>
|
||||
<ElDescriptionsItem :label="t('admin.equipmentAcceptance.flowNo')">
|
||||
{{ order.flow_no || '—' }}
|
||||
</ElDescriptionsItem>
|
||||
<ElDescriptionsItem :label="t('admin.equipmentAcceptance.acceptanceNo')">
|
||||
{{ order.acceptance_no || '—' }}
|
||||
</ElDescriptionsItem>
|
||||
<ElDescriptionsItem :label="t('admin.equipmentAcceptance.createdAt')">
|
||||
{{ dateTimeText(order.request_created_at) }}
|
||||
</ElDescriptionsItem>
|
||||
<ElDescriptionsItem :label="t('admin.equipmentAcceptance.finishedAt')">
|
||||
{{ dateText(order.finished_at) }}
|
||||
</ElDescriptionsItem>
|
||||
<ElDescriptionsItem :label="t('admin.equipmentAcceptance.applicant')" :span="2">
|
||||
{{ order.applicant_name || '—' }}
|
||||
</ElDescriptionsItem>
|
||||
<ElDescriptionsItem :label="t('admin.equipmentAcceptance.flowStatus')" :span="2">
|
||||
{{ flowText(order.flow_status_raw) }}
|
||||
</ElDescriptionsItem>
|
||||
<ElDescriptionsItem :label="t('admin.equipmentAcceptance.dwellDays')">
|
||||
{{ dwellText(order) }}
|
||||
</ElDescriptionsItem>
|
||||
<ElDescriptionsItem :label="t('admin.equipmentAcceptance.timerStart')">
|
||||
{{ dateText(order.timer_started_at) }}
|
||||
</ElDescriptionsItem>
|
||||
<ElDescriptionsItem :label="t('admin.equipmentAcceptance.canAccept')">
|
||||
{{ yesNo(order.can_accept, t('admin.equipmentAcceptance.unspecified')) }}
|
||||
</ElDescriptionsItem>
|
||||
<ElDescriptionsItem :label="t('admin.equipmentAcceptance.returnFlag')">
|
||||
{{ yesNo(order.is_returned, t('common.no')) }}
|
||||
</ElDescriptionsItem>
|
||||
<ElDescriptionsItem :label="t('admin.equipmentAcceptance.cannotAcceptNote')" :span="2">
|
||||
<span class="ea-pre">{{ order.cannot_accept_note || '—' }}</span>
|
||||
</ElDescriptionsItem>
|
||||
</ElDescriptions>
|
||||
|
||||
<dl class="mt-3 grid border-t border-[#dce4ef] px-4 sm:grid-cols-2">
|
||||
<div class="grid grid-cols-[108px_minmax(0,1fr)] gap-2 border-b border-[#dce4ef] py-2.5 text-xs">
|
||||
<dt class="font-bold text-[#64748b]">{{ t('admin.equipmentAcceptance.purchaseOrderNo') }}</dt>
|
||||
<dd class="text-[#142033]">{{ order.purchase_order_no || '—' }}</dd>
|
||||
</div>
|
||||
<div class="grid grid-cols-[108px_minmax(0,1fr)] gap-2 border-b border-[#dce4ef] py-2.5 text-xs sm:pl-4">
|
||||
<dt class="font-bold text-[#64748b]">{{ t('admin.equipmentAcceptance.applicant') }}</dt>
|
||||
<dd class="text-[#142033]">{{ order.applicant_name || '—' }}</dd>
|
||||
</div>
|
||||
<div class="grid grid-cols-[108px_minmax(0,1fr)] gap-2 border-b border-[#dce4ef] py-2.5 text-xs">
|
||||
<dt class="font-bold text-[#64748b]">{{ t('admin.equipmentAcceptance.dwellDays') }}</dt>
|
||||
<dd class="text-[#142033]">{{ dwellText(order) }}</dd>
|
||||
</div>
|
||||
<div class="grid grid-cols-[108px_minmax(0,1fr)] gap-2 border-b border-[#dce4ef] py-2.5 text-xs sm:pl-4">
|
||||
<dt class="font-bold text-[#64748b]">{{ t('admin.equipmentAcceptance.timerStart') }}</dt>
|
||||
<dd class="text-[#142033]">{{ dateText(order.timer_started_at) }}</dd>
|
||||
</div>
|
||||
<div class="grid grid-cols-[108px_minmax(0,1fr)] gap-2 border-b border-[#dce4ef] py-2.5 text-xs sm:col-span-2">
|
||||
<dt class="font-bold text-[#64748b]">{{ t('admin.equipmentAcceptance.currentHandlers') }}</dt>
|
||||
<dd class="text-[#142033]">{{ handlerNames(order) }}</dd>
|
||||
</div>
|
||||
<div class="grid grid-cols-[108px_minmax(0,1fr)] gap-2 border-b border-[#dce4ef] py-2.5 text-xs">
|
||||
<dt class="font-bold text-[#64748b]">{{ t('admin.equipmentAcceptance.canAccept') }}</dt>
|
||||
<dd class="text-[#142033]">{{ yesNo(order.can_accept, t('admin.equipmentAcceptance.unspecified')) }}</dd>
|
||||
</div>
|
||||
<div class="grid grid-cols-[108px_minmax(0,1fr)] gap-2 border-b border-[#dce4ef] py-2.5 text-xs sm:col-span-2">
|
||||
<dt class="font-bold text-[#64748b]">{{ t('admin.equipmentAcceptance.cannotAcceptNote') }}</dt>
|
||||
<dd class="whitespace-pre-wrap text-[#142033]">{{ order.cannot_accept_note || '—' }}</dd>
|
||||
</div>
|
||||
<div class="grid grid-cols-[108px_minmax(0,1fr)] gap-2 border-b border-[#dce4ef] py-2.5 text-xs sm:pl-4">
|
||||
<dt class="font-bold text-[#64748b]">{{ t('admin.equipmentAcceptance.returnFlag') }}</dt>
|
||||
<dd class="text-[#142033]">{{ yesNo(order.is_returned, t('common.no')) }}</dd>
|
||||
</div>
|
||||
<div class="grid grid-cols-[108px_minmax(0,1fr)] gap-2 border-b border-[#dce4ef] py-2.5 text-xs">
|
||||
<dt class="font-bold text-[#64748b]">{{ t('admin.equipmentAcceptance.flowStatus') }}</dt>
|
||||
<dd class="text-[#142033]">{{ flowText(order.flow_status_raw) }}</dd>
|
||||
</div>
|
||||
<div class="grid grid-cols-[108px_minmax(0,1fr)] gap-2 border-b border-[#dce4ef] py-2.5 text-xs sm:pl-4">
|
||||
<dt class="font-bold text-[#64748b]">{{ t('admin.equipmentAcceptance.finishedAt') }}</dt>
|
||||
<dd class="text-[#142033]">{{ dateText(order.finished_at) }}</dd>
|
||||
</div>
|
||||
</dl>
|
||||
|
||||
<div class="px-4 pb-4 pt-4">
|
||||
<h3 class="text-sm font-bold text-[#142033]">{{ t('admin.equipmentAcceptance.operators') }}</h3>
|
||||
<p class="mt-1 text-xs text-[#64748b]">{{ t('admin.equipmentAcceptance.operatorsNote') }}</p>
|
||||
<div class="mt-3 overflow-auto rounded-xl border border-[#dce4ef]">
|
||||
<table class="w-full min-w-[640px] border-collapse text-left text-xs">
|
||||
<thead class="bg-[#f8fbff] text-[#64748b]">
|
||||
<tr>
|
||||
<th class="px-3 py-2.5 font-bold">{{ t('admin.equipmentAcceptance.operatorName') }}</th>
|
||||
<th class="px-3 py-2.5 font-bold">{{ t('admin.equipmentAcceptance.jobNum') }}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr
|
||||
v-for="(item, index) in order.operators"
|
||||
:key="`${item.user_id}-${item.node_id}-${index}`"
|
||||
class="border-t border-[#dce4ef]"
|
||||
>
|
||||
<td class="px-3 py-2.5 font-bold text-[#142033]">{{ item.handler_name || '—' }}</td>
|
||||
<td class="px-3 py-2.5">{{ item.handler_job_num || '—' }}</td>
|
||||
</tr>
|
||||
<tr v-if="!order.operators.length">
|
||||
<td colspan="2" class="px-3 py-6 text-center text-[#64748b]">—</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<h3 class="ea-operators-title">{{ t('admin.equipmentAcceptance.operators') }}</h3>
|
||||
<p class="ea-lead">{{ t('admin.equipmentAcceptance.operatorsNote') }}</p>
|
||||
<ElTable class="ea-operators" :data="operatorRows" row-key="rowKey" :empty-text="'—'">
|
||||
<ElTableColumn :label="t('admin.equipmentAcceptance.currentNodes')" min-width="160">
|
||||
<template #default="{ row }">{{ row.nodeName }}</template>
|
||||
</ElTableColumn>
|
||||
<ElTableColumn :label="t('admin.equipmentAcceptance.currentHandlers')" min-width="160">
|
||||
<template #default="{ row }">{{ row.handlerName }}</template>
|
||||
</ElTableColumn>
|
||||
<ElTableColumn :label="t('admin.equipmentAcceptance.jobNum')" min-width="140">
|
||||
<template #default="{ row }">{{ row.jobNum }}</template>
|
||||
</ElTableColumn>
|
||||
</ElTable>
|
||||
</article>
|
||||
</section>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.ea-scroll {
|
||||
flex: 1 1 auto;
|
||||
min-height: 0;
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
.ea-back {
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
|
||||
.ea-detail {
|
||||
padding: 16px;
|
||||
background: var(--el-bg-color);
|
||||
border: 1px solid var(--el-border-color);
|
||||
border-radius: var(--el-border-radius-base);
|
||||
}
|
||||
|
||||
.ea-detail__head {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: flex-start;
|
||||
gap: 12px;
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
|
||||
.ea-detail__head h2 {
|
||||
margin: 0;
|
||||
font-size: var(--el-font-size-large);
|
||||
font-weight: var(--el-font-weight-primary);
|
||||
line-height: 1.4;
|
||||
color: var(--el-text-color-primary);
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
|
||||
.ea-track {
|
||||
padding: 16px 12px 0;
|
||||
}
|
||||
|
||||
.ea-track__marks {
|
||||
position: relative;
|
||||
height: 18px;
|
||||
margin-top: 4px;
|
||||
color: var(--el-text-color-secondary);
|
||||
font-size: var(--el-font-size-extra-small);
|
||||
}
|
||||
|
||||
.ea-track__marks span {
|
||||
position: absolute;
|
||||
white-space: nowrap;
|
||||
transform: translateX(-50%);
|
||||
}
|
||||
|
||||
.ea-pre {
|
||||
white-space: pre-wrap;
|
||||
}
|
||||
|
||||
.ea-operators-title {
|
||||
margin: 16px 0 4px;
|
||||
font-size: var(--el-font-size-base);
|
||||
font-weight: var(--el-font-weight-primary);
|
||||
color: var(--el-text-color-primary);
|
||||
}
|
||||
|
||||
.ea-lead {
|
||||
margin: 0 0 8px;
|
||||
font-size: var(--el-font-size-extra-small);
|
||||
line-height: 1.4;
|
||||
color: var(--el-text-color-secondary);
|
||||
}
|
||||
</style>
|
||||
@@ -1,16 +1,30 @@
|
||||
<!--
|
||||
features/equipment-acceptance/views/EquipmentAcceptancePage.vue
|
||||
用途:设备验收预警停留列表,对齐原型的汇总卡、分组筛选和状态徽章。
|
||||
依赖:equipment-acceptance.api、PaginationBar、统一消息提示、vue-i18n。
|
||||
逻辑:由 Chat 作业面嵌入。点「查看详情」交给父级下钻。
|
||||
已逾期只看接口给出的 overdue。发送结果在「发送记录」页,这里不显示第几档。
|
||||
用途:设备验收预警停留列表。四张数字卡既是总览也是状态筛选。
|
||||
依赖:equipment-acceptance.api、Element Plus、useFillHeight、统一消息提示、vue-i18n。
|
||||
逻辑:由 Chat 作业面嵌入。样式和 ElConfigProvider 由 EquipmentAcceptanceChatPanel 提供。
|
||||
点一张卡片只看该状态,再点一次回到全部。单号和申请人是另外两个输入框。
|
||||
点「查看详情」交给父级下钻。已逾期只看接口给出的 overdue。
|
||||
列表前五列是来源、标题、采购单号、验收单单号、流程编号,其余列接在后面。
|
||||
发送结果在「发送记录」页,这里不显示第几档。
|
||||
-->
|
||||
<script setup lang="ts">
|
||||
import { onMounted, ref } from 'vue';
|
||||
import { computed, onBeforeUnmount, onMounted, ref } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import {
|
||||
ElButton,
|
||||
ElCard,
|
||||
ElInput,
|
||||
ElLoading,
|
||||
ElPagination,
|
||||
ElStatistic,
|
||||
ElTable,
|
||||
ElTableColumn,
|
||||
ElTag,
|
||||
} from 'element-plus';
|
||||
import { BusinessError } from '@/shared/api/client';
|
||||
import PaginationBar from '@/shared/components/PaginationBar.vue';
|
||||
import { useMessage } from '@/shared/composables/useMessage';
|
||||
import { useFillHeight } from '../composables/useFillHeight';
|
||||
import {
|
||||
listEquipmentAcceptanceOrders,
|
||||
type EquipmentAcceptanceOrder,
|
||||
@@ -22,7 +36,7 @@ const emit = defineEmits<{
|
||||
}>();
|
||||
|
||||
type FocusKey = 'all' | 'watching' | 'overdue' | 'stopped' | 'not_started';
|
||||
type BadgeTone = 'red' | 'green' | 'gray';
|
||||
type TagType = 'danger' | 'success' | 'info';
|
||||
|
||||
const STOPPED_STATUSES = new Set([
|
||||
'stopped_returned',
|
||||
@@ -33,23 +47,23 @@ const STOPPED_STATUSES = new Set([
|
||||
'stopped_revoked',
|
||||
]);
|
||||
|
||||
const filters: Array<{ key: FocusKey; label: string }> = [
|
||||
{ key: 'all', label: 'filterAll' },
|
||||
{ key: 'watching', label: 'filterWatching' },
|
||||
{ key: 'overdue', label: 'filterOverdue' },
|
||||
{ key: 'stopped', label: 'filterStopped' },
|
||||
{ key: 'not_started', label: 'filterNotStarted' },
|
||||
];
|
||||
const PAGE_SIZES = [10, 20, 50, 100];
|
||||
|
||||
const { t } = useI18n();
|
||||
const msg = useMessage();
|
||||
const vLoading = ElLoading.directive;
|
||||
const tableHost = ref<HTMLElement | null>(null);
|
||||
const { height: tableHeight } = useFillHeight(tableHost);
|
||||
const loading = ref(false);
|
||||
const orders = ref<EquipmentAcceptanceOrder[]>([]);
|
||||
const focus = ref<FocusKey>('all');
|
||||
const page = ref(1);
|
||||
const pageSize = ref(20);
|
||||
const total = ref(0);
|
||||
const pages = ref(1);
|
||||
const keyword = ref('');
|
||||
const applicant = ref('');
|
||||
let searchTimer: ReturnType<typeof setTimeout> | null = null;
|
||||
let skipNextInput = false;
|
||||
const summary = ref<EquipmentAcceptanceSummary>({
|
||||
watching: 0,
|
||||
overdue: 0,
|
||||
@@ -57,10 +71,17 @@ const summary = ref<EquipmentAcceptanceSummary>({
|
||||
not_started: 0,
|
||||
});
|
||||
|
||||
const kpis = computed(() => [
|
||||
{ key: 'watching' as const, label: 'kpiWatching', value: summary.value.watching },
|
||||
{ key: 'overdue' as const, label: 'kpiOverdue', value: summary.value.overdue },
|
||||
{ key: 'stopped' as const, label: 'kpiStopped', value: summary.value.stopped },
|
||||
{ key: 'not_started' as const, label: 'filterNotStarted', value: summary.value.not_started },
|
||||
]);
|
||||
|
||||
/**
|
||||
* 加载当前分组的验收单,并刷新全部单据的汇总数字。
|
||||
* 核心逻辑:汇总不受当前筛选影响,由接口的 summary 给出。
|
||||
* @param resetPage - 为 true 时回到第一页,用于更换筛选。
|
||||
* 核心逻辑:状态分组只影响表格。单号和申请人同时影响表格和分组数字。
|
||||
* @param resetPage - 为 true 时回到第一页,用于更换筛选或每页条数。
|
||||
*/
|
||||
async function load(resetPage = false): Promise<void> {
|
||||
if (resetPage) page.value = 1;
|
||||
@@ -68,12 +89,13 @@ async function load(resetPage = false): Promise<void> {
|
||||
try {
|
||||
const result = await listEquipmentAcceptanceOrders({
|
||||
focus: focus.value,
|
||||
keyword: keyword.value,
|
||||
applicant: applicant.value,
|
||||
page: page.value,
|
||||
pageSize: pageSize.value,
|
||||
});
|
||||
orders.value = result.items || [];
|
||||
total.value = result.total || 0;
|
||||
pages.value = result.pages || 1;
|
||||
if (result.summary) summary.value = result.summary;
|
||||
} catch (error) {
|
||||
msg.error(error instanceof BusinessError ? error.message : t('admin.equipmentAcceptance.loadFailed'));
|
||||
@@ -83,15 +105,93 @@ async function load(resetPage = false): Promise<void> {
|
||||
}
|
||||
|
||||
/**
|
||||
* 切换原型分组并回到第一页。
|
||||
* @param next - all、watching、overdue、stopped、not_started
|
||||
* 用数字卡切换停留分组,并回到第一页。
|
||||
* 核心逻辑:再点当前卡片回到全部,避免卡片下面再放一排同样的标签。
|
||||
* @param next - watching、overdue、stopped、not_started
|
||||
*/
|
||||
function selectFocus(next: FocusKey): void {
|
||||
if (focus.value === next) return;
|
||||
focus.value = next;
|
||||
focus.value = focus.value === next ? 'all' : next;
|
||||
void load(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 翻页后按当前分组重拉。
|
||||
* @param next - 从 1 开始的页码
|
||||
*/
|
||||
function onPageChange(next: number): void {
|
||||
if (page.value === next) return;
|
||||
page.value = next;
|
||||
void load();
|
||||
}
|
||||
|
||||
/**
|
||||
* 更换每页条数后回到第一页,避免停在已经不存在的页上。
|
||||
* @param next - 每页条数
|
||||
*/
|
||||
function onSizeChange(next: number): void {
|
||||
pageSize.value = next;
|
||||
void load(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 停掉尚未发出的搜索,避免连续按键打出一串过期请求。
|
||||
*/
|
||||
function clearSearchTimer(): void {
|
||||
if (searchTimer === null) return;
|
||||
clearTimeout(searchTimer);
|
||||
searchTimer = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 单号或申请人变化后稍等再查,并回到第一页。
|
||||
* 核心逻辑:输入停 300 毫秒才请求。清空按钮紧接着还会发一次 input,那一次丢掉。
|
||||
*/
|
||||
function scheduleSearch(): void {
|
||||
if (skipNextInput) {
|
||||
skipNextInput = false;
|
||||
return;
|
||||
}
|
||||
clearSearchTimer();
|
||||
searchTimer = setTimeout(() => {
|
||||
searchTimer = null;
|
||||
void load(true);
|
||||
}, 300);
|
||||
}
|
||||
|
||||
/**
|
||||
* 立刻按当前两个输入框查询。
|
||||
* 核心逻辑:回车或点清空时不等待防抖。清空后的 input 由 skipNextInput 吃掉。
|
||||
*/
|
||||
function searchNow(): void {
|
||||
clearSearchTimer();
|
||||
skipNextInput = true;
|
||||
queueMicrotask(() => {
|
||||
skipNextInput = false;
|
||||
});
|
||||
void load(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 把来源代码显示成 E10 或 E8。
|
||||
* @param order - 列表行
|
||||
* @returns 来源名称,空值显示横线
|
||||
*/
|
||||
function sourceText(order: EquipmentAcceptanceOrder): string {
|
||||
if (order.oa_system === 'e10') return t('admin.equipmentAcceptance.sourceE10');
|
||||
if (order.oa_system === 'e8') return t('admin.equipmentAcceptance.sourceE8');
|
||||
return '—';
|
||||
}
|
||||
|
||||
/**
|
||||
* 空单元格显示横线。
|
||||
* @param value - 接口原值
|
||||
* @returns 文本或横线
|
||||
*/
|
||||
function textOrDash(value?: string | null): string {
|
||||
const text = String(value || '').trim();
|
||||
return text || '—';
|
||||
}
|
||||
|
||||
/**
|
||||
* 把节点名称拼成一格。没有节点时显示横线。
|
||||
* @param order - 列表行
|
||||
@@ -124,6 +224,17 @@ function dateText(value?: string | null): string {
|
||||
return value.slice(0, 10);
|
||||
}
|
||||
|
||||
/**
|
||||
* 展示流程创建时间,保留时分秒,不按浏览器时区再换算。
|
||||
* @param value - 接口返回的 ISO 时间
|
||||
* @returns 本地墙上时间或横线
|
||||
*/
|
||||
function dateTimeText(value?: string | null): string {
|
||||
if (!value) return '—';
|
||||
const text = value.replace('T', ' ').replace(/Z$/, '');
|
||||
return text.slice(0, 19);
|
||||
}
|
||||
|
||||
/**
|
||||
* 未开始或没有天数时显示横线,其余显示「N 天」。
|
||||
* @param order - 列表行
|
||||
@@ -135,130 +246,270 @@ function dwellText(order: EquipmentAcceptanceOrder): string {
|
||||
}
|
||||
|
||||
/**
|
||||
* 按监控状态收成徽章。已逾期用红色,表示还要提醒。不再提醒用绿色,未开始和未超时用灰色。
|
||||
* 按监控状态收成标签。已逾期用危险色,不再提醒用成功色,未开始和未超时用信息色。
|
||||
* @param order - 列表行
|
||||
* @returns 文案和颜色
|
||||
* @returns 文案和 Element 标签类型
|
||||
*/
|
||||
function statusBadge(order: EquipmentAcceptanceOrder): { label: string; tone: BadgeTone } {
|
||||
function statusTag(order: EquipmentAcceptanceOrder): { label: string; type: TagType } {
|
||||
if (order.monitor_status === 'watching' && order.overdue) {
|
||||
return { label: t('admin.equipmentAcceptance.badgeOverdue'), tone: 'red' };
|
||||
return { label: t('admin.equipmentAcceptance.badgeOverdue'), type: 'danger' };
|
||||
}
|
||||
if (order.monitor_status === 'watching') {
|
||||
return { label: t('admin.equipmentAcceptance.badgeOnTime'), tone: 'gray' };
|
||||
return { label: t('admin.equipmentAcceptance.badgeOnTime'), type: 'info' };
|
||||
}
|
||||
return {
|
||||
label: t(`admin.equipmentAcceptance.statusLabel.${order.monitor_status}`),
|
||||
tone: STOPPED_STATUSES.has(order.monitor_status) ? 'green' : 'gray',
|
||||
type: STOPPED_STATUSES.has(order.monitor_status) ? 'success' : 'info',
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* 徽章底色。红是已逾期,绿是不再提醒,灰是未超时、未开始和不在监控范围。
|
||||
* @param tone - 徽章颜色
|
||||
* @returns Tailwind 类名
|
||||
*/
|
||||
function badgeClass(tone: BadgeTone): string {
|
||||
if (tone === 'red') return 'bg-[#fff0ef] text-[#b42318]';
|
||||
if (tone === 'green') return 'bg-[#eafaf1] text-[#067647]';
|
||||
return 'bg-[#edf1f6] text-[#475569]';
|
||||
}
|
||||
|
||||
defineExpose({ reload: () => load(false) });
|
||||
|
||||
onMounted(() => {
|
||||
void load();
|
||||
});
|
||||
|
||||
onBeforeUnmount(() => {
|
||||
clearSearchTimer();
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<section class="flex min-h-0 flex-1 flex-col gap-3 px-5 pb-4 pt-3">
|
||||
<div class="grid grid-cols-4 gap-3">
|
||||
<article class="rounded-xl border border-[#dce4ef] bg-white px-4 py-3.5">
|
||||
<b class="block text-[26px] font-bold leading-none text-[#142033]">{{ summary.watching }}</b>
|
||||
<span class="mt-1 block text-xs text-[#64748b]">{{ t('admin.equipmentAcceptance.kpiWatching') }}</span>
|
||||
</article>
|
||||
<article class="rounded-xl border border-[#dce4ef] bg-white px-4 py-3.5">
|
||||
<b class="block text-[26px] font-bold leading-none text-[#142033]">{{ summary.overdue }}</b>
|
||||
<span class="mt-1 block text-xs text-[#64748b]">{{ t('admin.equipmentAcceptance.kpiOverdue') }}</span>
|
||||
</article>
|
||||
<article class="rounded-xl border border-[#dce4ef] bg-white px-4 py-3.5">
|
||||
<b class="block text-[26px] font-bold leading-none text-[#142033]">{{ summary.stopped }}</b>
|
||||
<span class="mt-1 block text-xs text-[#64748b]">{{ t('admin.equipmentAcceptance.kpiStopped') }}</span>
|
||||
</article>
|
||||
<article class="rounded-xl border border-[#dce4ef] bg-white px-4 py-3.5">
|
||||
<b class="block text-[26px] font-bold leading-none text-[#142033]">{{ summary.not_started }}</b>
|
||||
<span class="mt-1 block text-xs text-[#64748b]">{{ t('admin.equipmentAcceptance.filterNotStarted') }}</span>
|
||||
</article>
|
||||
<div class="ea-board">
|
||||
<div class="ea-kpis">
|
||||
<ElCard
|
||||
v-for="item in kpis"
|
||||
:key="item.key"
|
||||
shadow="never"
|
||||
class="ea-kpi"
|
||||
:class="{ 'is-active': focus === item.key }"
|
||||
role="button"
|
||||
tabindex="0"
|
||||
@click="selectFocus(item.key)"
|
||||
@keyup.enter="selectFocus(item.key)"
|
||||
>
|
||||
<ElStatistic :title="t(`admin.equipmentAcceptance.${item.label}`)" :value="item.value" />
|
||||
</ElCard>
|
||||
</div>
|
||||
|
||||
<div class="flex min-h-0 flex-1 flex-col overflow-hidden rounded-xl border border-[#dce4ef] bg-white">
|
||||
<div class="flex flex-wrap gap-2 p-3">
|
||||
<button
|
||||
v-for="item in filters"
|
||||
:key="item.key"
|
||||
type="button"
|
||||
class="rounded-full border px-2.5 py-1 text-xs font-bold"
|
||||
:class="focus === item.key
|
||||
? 'border-[#bfdbfe] bg-[#eaf2ff] text-[#1d4ed8]'
|
||||
: 'border-[#dce4ef] bg-white text-[#475569]'"
|
||||
@click="selectFocus(item.key)"
|
||||
>
|
||||
{{ t(`admin.equipmentAcceptance.${item.label}`) }}
|
||||
</button>
|
||||
</div>
|
||||
<div class="min-h-0 flex-1 overflow-auto">
|
||||
<table class="min-w-[960px] w-full border-collapse text-left text-xs">
|
||||
<thead class="sticky top-0 bg-[#f8fbff] text-[#64748b]">
|
||||
<tr>
|
||||
<th class="px-3 py-2.5 font-bold">{{ t('admin.equipmentAcceptance.acceptanceNo') }}</th>
|
||||
<th class="px-3 py-2.5 font-bold">{{ t('admin.equipmentAcceptance.purchaseOrderNo') }}</th>
|
||||
<th class="px-3 py-2.5 font-bold">{{ t('admin.equipmentAcceptance.applicant') }}</th>
|
||||
<th class="px-3 py-2.5 font-bold">{{ t('admin.equipmentAcceptance.currentNodes') }}</th>
|
||||
<th class="px-3 py-2.5 font-bold">{{ t('admin.equipmentAcceptance.currentHandlers') }}</th>
|
||||
<th class="px-3 py-2.5 font-bold">{{ t('admin.equipmentAcceptance.timerStart') }}</th>
|
||||
<th class="px-3 py-2.5 font-bold">{{ t('admin.equipmentAcceptance.dwellDays') }}</th>
|
||||
<th class="px-3 py-2.5 font-bold">{{ t('admin.equipmentAcceptance.status') }}</th>
|
||||
<th class="px-3 py-2.5 font-bold">{{ t('admin.equipmentAcceptance.actions') }}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr v-for="item in orders" :key="item.id" class="border-b border-[#dce4ef] hover:bg-[#f3f7ff]">
|
||||
<td class="px-3 py-2.5 font-bold text-[#142033]">{{ item.acceptance_no || '—' }}</td>
|
||||
<td class="px-3 py-2.5">{{ item.purchase_order_no || '—' }}</td>
|
||||
<td class="px-3 py-2.5">{{ item.applicant_name || '—' }}</td>
|
||||
<td class="px-3 py-2.5">{{ nodeNames(item) }}</td>
|
||||
<td class="px-3 py-2.5">{{ handlerNames(item) }}</td>
|
||||
<td class="px-3 py-2.5">{{ dateText(item.timer_started_at) }}</td>
|
||||
<td class="px-3 py-2.5">{{ dwellText(item) }}</td>
|
||||
<td class="px-3 py-2.5">
|
||||
<span
|
||||
class="inline-flex rounded-full px-2 py-0.5 text-[11px] font-extrabold"
|
||||
:class="badgeClass(statusBadge(item).tone)"
|
||||
>
|
||||
{{ statusBadge(item).label }}
|
||||
</span>
|
||||
</td>
|
||||
<td class="px-3 py-2.5">
|
||||
<button class="font-extrabold text-[#175cd3]" type="button" @click="emit('open-detail', item.id)">
|
||||
{{ t('admin.equipmentAcceptance.detail') }}
|
||||
</button>
|
||||
</td>
|
||||
</tr>
|
||||
<tr v-if="!loading && !orders.length">
|
||||
<td colspan="9" class="px-3 py-9 text-center text-[#64748b]">{{ t('admin.equipmentAcceptance.empty') }}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<section class="ea-pane">
|
||||
<div class="ea-filters">
|
||||
<div class="ea-searches">
|
||||
<ElInput
|
||||
v-model="keyword"
|
||||
clearable
|
||||
class="ea-filter-keyword"
|
||||
:placeholder="t('admin.equipmentAcceptance.keywordPlaceholder')"
|
||||
@input="scheduleSearch"
|
||||
@clear="searchNow"
|
||||
@keyup.enter="searchNow"
|
||||
/>
|
||||
<ElInput
|
||||
v-model="applicant"
|
||||
clearable
|
||||
class="ea-filter-applicant"
|
||||
:placeholder="t('admin.equipmentAcceptance.applicant')"
|
||||
@input="scheduleSearch"
|
||||
@clear="searchNow"
|
||||
@keyup.enter="searchNow"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<PaginationBar
|
||||
class="shrink-0"
|
||||
v-model:page="page"
|
||||
v-model:page-size="pageSize"
|
||||
:total="total"
|
||||
:pages="pages"
|
||||
@update:page="() => load()"
|
||||
@update:page-size="() => load()"
|
||||
/>
|
||||
</section>
|
||||
<div ref="tableHost" class="ea-table-host">
|
||||
<ElTable
|
||||
v-loading="loading"
|
||||
class="ea-table"
|
||||
:data="orders"
|
||||
:height="tableHeight"
|
||||
row-key="id"
|
||||
:empty-text="t('admin.equipmentAcceptance.empty')"
|
||||
>
|
||||
<ElTableColumn :label="t('admin.equipmentAcceptance.source')" width="72" class-name="ea-ellipsis">
|
||||
<template #default="{ row }">
|
||||
<span class="ea-strong">{{ sourceText(row as EquipmentAcceptanceOrder) }}</span>
|
||||
</template>
|
||||
</ElTableColumn>
|
||||
<ElTableColumn :label="t('admin.equipmentAcceptance.requestTitle')" min-width="220" class-name="ea-ellipsis" show-overflow-tooltip>
|
||||
<template #default="{ row }">{{ textOrDash((row as EquipmentAcceptanceOrder).request_title) }}</template>
|
||||
</ElTableColumn>
|
||||
<ElTableColumn :label="t('admin.equipmentAcceptance.purchaseOrderNo')" min-width="132" class-name="ea-ellipsis" show-overflow-tooltip>
|
||||
<template #default="{ row }">{{ textOrDash((row as EquipmentAcceptanceOrder).purchase_order_no) }}</template>
|
||||
</ElTableColumn>
|
||||
<ElTableColumn :label="t('admin.equipmentAcceptance.acceptanceNo')" min-width="156" class-name="ea-ellipsis" show-overflow-tooltip>
|
||||
<template #default="{ row }">
|
||||
<span class="ea-strong">{{ textOrDash((row as EquipmentAcceptanceOrder).acceptance_no) }}</span>
|
||||
</template>
|
||||
</ElTableColumn>
|
||||
<ElTableColumn :label="t('admin.equipmentAcceptance.flowNo')" min-width="132" class-name="ea-ellipsis" show-overflow-tooltip>
|
||||
<template #default="{ row }">{{ textOrDash((row as EquipmentAcceptanceOrder).flow_no) }}</template>
|
||||
</ElTableColumn>
|
||||
<ElTableColumn :label="t('admin.equipmentAcceptance.createdAt')" min-width="168" class-name="ea-ellipsis" show-overflow-tooltip>
|
||||
<template #default="{ row }">{{ dateTimeText((row as EquipmentAcceptanceOrder).request_created_at) }}</template>
|
||||
</ElTableColumn>
|
||||
<ElTableColumn :label="t('admin.equipmentAcceptance.applicant')" min-width="88" class-name="ea-ellipsis" show-overflow-tooltip>
|
||||
<template #default="{ row }">{{ textOrDash((row as EquipmentAcceptanceOrder).applicant_name) }}</template>
|
||||
</ElTableColumn>
|
||||
<ElTableColumn :label="t('admin.equipmentAcceptance.currentNodes')" min-width="120" class-name="ea-ellipsis" show-overflow-tooltip>
|
||||
<template #default="{ row }">{{ nodeNames(row as EquipmentAcceptanceOrder) }}</template>
|
||||
</ElTableColumn>
|
||||
<ElTableColumn :label="t('admin.equipmentAcceptance.currentHandlers')" min-width="120" class-name="ea-ellipsis" show-overflow-tooltip>
|
||||
<template #default="{ row }">{{ handlerNames(row as EquipmentAcceptanceOrder) }}</template>
|
||||
</ElTableColumn>
|
||||
<ElTableColumn :label="t('admin.equipmentAcceptance.timerStart')" min-width="112" class-name="ea-ellipsis">
|
||||
<template #default="{ row }">{{ dateText((row as EquipmentAcceptanceOrder).timer_started_at) }}</template>
|
||||
</ElTableColumn>
|
||||
<ElTableColumn :label="t('admin.equipmentAcceptance.dwellDays')" min-width="96" class-name="ea-ellipsis">
|
||||
<template #default="{ row }">{{ dwellText(row as EquipmentAcceptanceOrder) }}</template>
|
||||
</ElTableColumn>
|
||||
<ElTableColumn :label="t('admin.equipmentAcceptance.status')" min-width="168">
|
||||
<template #default="{ row }">
|
||||
<ElTag :type="statusTag(row as EquipmentAcceptanceOrder).type" effect="light">
|
||||
{{ statusTag(row as EquipmentAcceptanceOrder).label }}
|
||||
</ElTag>
|
||||
</template>
|
||||
</ElTableColumn>
|
||||
<ElTableColumn :label="t('admin.equipmentAcceptance.actions')" width="96" fixed="right" align="right">
|
||||
<template #default="{ row }">
|
||||
<ElButton link type="primary" @click="emit('open-detail', (row as EquipmentAcceptanceOrder).id)">
|
||||
{{ t('admin.equipmentAcceptance.detail') }}
|
||||
</ElButton>
|
||||
</template>
|
||||
</ElTableColumn>
|
||||
</ElTable>
|
||||
</div>
|
||||
<div class="ea-pager">
|
||||
<ElPagination
|
||||
background
|
||||
layout="total, sizes, prev, pager, next"
|
||||
:total="total"
|
||||
:page-size="pageSize"
|
||||
:current-page="page"
|
||||
:page-sizes="PAGE_SIZES"
|
||||
@current-change="onPageChange"
|
||||
@size-change="onSizeChange"
|
||||
/>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.ea-board {
|
||||
display: flex;
|
||||
flex: 1 1 auto;
|
||||
flex-direction: column;
|
||||
gap: 8px;
|
||||
min-height: 0;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.ea-kpis {
|
||||
display: grid;
|
||||
flex: none;
|
||||
grid-template-columns: repeat(4, minmax(0, 1fr));
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
.ea-kpi {
|
||||
cursor: pointer;
|
||||
border-radius: 12px;
|
||||
}
|
||||
|
||||
.ea-kpi.is-active {
|
||||
border-color: var(--el-color-primary);
|
||||
}
|
||||
|
||||
.ea-kpi:focus-visible {
|
||||
outline: 2px solid var(--el-color-primary);
|
||||
outline-offset: 2px;
|
||||
}
|
||||
|
||||
.ea-kpi :deep(.el-card__body) {
|
||||
padding: 14px 16px;
|
||||
}
|
||||
|
||||
.ea-kpi :deep(.el-statistic) {
|
||||
display: flex;
|
||||
flex-direction: column-reverse;
|
||||
align-items: flex-start;
|
||||
--el-statistic-content-font-size: 26px;
|
||||
}
|
||||
|
||||
.ea-kpi :deep(.el-statistic__head) {
|
||||
margin-top: 6px;
|
||||
margin-bottom: 0;
|
||||
color: var(--el-text-color-secondary);
|
||||
font-size: var(--el-font-size-extra-small);
|
||||
line-height: 1.2;
|
||||
}
|
||||
|
||||
.ea-kpi :deep(.el-statistic__content) {
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
.ea-pane {
|
||||
display: flex;
|
||||
flex: 1 1 auto;
|
||||
flex-direction: column;
|
||||
min-height: 0;
|
||||
min-width: 0;
|
||||
overflow: hidden;
|
||||
background: var(--el-bg-color);
|
||||
border: 1px solid var(--el-border-color);
|
||||
border-radius: var(--el-border-radius-base);
|
||||
}
|
||||
|
||||
.ea-filters {
|
||||
display: flex;
|
||||
flex: none;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
padding: 10px 12px;
|
||||
border-bottom: 1px solid var(--el-border-color-lighter);
|
||||
}
|
||||
|
||||
.ea-searches {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.ea-filter-keyword {
|
||||
width: 18rem;
|
||||
flex: none;
|
||||
}
|
||||
|
||||
.ea-filter-applicant {
|
||||
width: 11rem;
|
||||
flex: none;
|
||||
}
|
||||
|
||||
.ea-table-host {
|
||||
flex: 1 1 auto;
|
||||
min-height: 0;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.ea-table :deep(.el-table__cell) {
|
||||
padding-top: 6px;
|
||||
padding-bottom: 6px;
|
||||
}
|
||||
|
||||
.ea-table :deep(.ea-ellipsis .cell) {
|
||||
white-space: nowrap;
|
||||
word-break: normal;
|
||||
}
|
||||
|
||||
.ea-strong {
|
||||
font-weight: var(--el-font-weight-primary);
|
||||
color: var(--el-text-color-primary);
|
||||
}
|
||||
|
||||
.ea-pager {
|
||||
display: flex;
|
||||
flex: none;
|
||||
justify-content: flex-end;
|
||||
padding: 8px 12px;
|
||||
border-top: 1px solid var(--el-border-color-lighter);
|
||||
}
|
||||
</style>
|
||||
+212
-118
@@ -1,55 +1,89 @@
|
||||
<!--
|
||||
features/equipment-acceptance/views/EquipmentAcceptanceSendsPage.vue
|
||||
用途:设备验收预警发送记录页,列出每张验收单某一档的主送、抄送、Excel 附件和结果。
|
||||
依赖:equipment-acceptance.api、PaginationBar、统一消息提示、vue-i18n、lucide 图标。
|
||||
逻辑:由 Chat 作业面的「发送记录」Tab 嵌入。Excel 附件列点击文件名下载。发送失败时悬停图标看原因。
|
||||
依赖:equipment-acceptance.api、Element Plus、useFillHeight、统一消息提示、vue-i18n。
|
||||
逻辑:由 Chat 作业面的「发送记录」Tab 嵌入。样式和 ElConfigProvider 由作业面提供。
|
||||
Excel 附件列点击文件名下载。发送失败时悬停图标看原因。
|
||||
-->
|
||||
<script setup lang="ts">
|
||||
import { onMounted, ref } from 'vue';
|
||||
import { CircleAlert, Download } from 'lucide-vue-next';
|
||||
import { Download, Warning } from '@element-plus/icons-vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import {
|
||||
ElButton,
|
||||
ElLoading,
|
||||
ElPagination,
|
||||
ElTable,
|
||||
ElTableColumn,
|
||||
ElTag,
|
||||
ElTooltip,
|
||||
} from 'element-plus';
|
||||
import { BusinessError } from '@/shared/api/client';
|
||||
import PaginationBar from '@/shared/components/PaginationBar.vue';
|
||||
import { useMessage } from '@/shared/composables/useMessage';
|
||||
import { formatLocalDateTime } from '@/shared/utils/dateTime';
|
||||
import { useFillHeight } from '../composables/useFillHeight';
|
||||
import {
|
||||
downloadEquipmentAcceptanceSendFile,
|
||||
listEquipmentAcceptanceSends,
|
||||
type EquipmentAcceptanceSendRecord,
|
||||
} from '../api/equipment-acceptance.api';
|
||||
|
||||
type TagType = 'success' | 'danger' | 'warning' | 'info';
|
||||
|
||||
const PAGE_SIZES = [10, 20, 50, 100];
|
||||
|
||||
const { t, te } = useI18n();
|
||||
const msg = useMessage();
|
||||
const vLoading = ElLoading.directive;
|
||||
const tableHost = ref<HTMLElement | null>(null);
|
||||
const { height: tableHeight } = useFillHeight(tableHost);
|
||||
const records = ref<EquipmentAcceptanceSendRecord[]>([]);
|
||||
const downloadingId = ref<number | null>(null);
|
||||
const loading = ref(false);
|
||||
const page = ref(1);
|
||||
const pageSize = ref(20);
|
||||
const total = ref(0);
|
||||
const pages = ref(1);
|
||||
const failureTip = ref<{ text: string; left: number; top: number } | null>(null);
|
||||
|
||||
/**
|
||||
* 拉取当前页发送记录。
|
||||
* 核心逻辑:失败时清空表格并提示。空列表留给模板显示「还没有发送记录」。
|
||||
* 核心逻辑:失败时清空表格并提示。空列表留给表格显示「还没有发送记录」。
|
||||
* @param resetPage - 为 true 时回到第一页,用于更换每页条数。
|
||||
*/
|
||||
async function load(): Promise<void> {
|
||||
async function load(resetPage = false): Promise<void> {
|
||||
if (resetPage) page.value = 1;
|
||||
loading.value = true;
|
||||
try {
|
||||
const result = await listEquipmentAcceptanceSends({ page: page.value, pageSize: pageSize.value });
|
||||
records.value = result.items || [];
|
||||
total.value = result.total || 0;
|
||||
pages.value = Math.max(1, Math.ceil(total.value / pageSize.value));
|
||||
} catch (error) {
|
||||
records.value = [];
|
||||
total.value = 0;
|
||||
pages.value = 1;
|
||||
msg.error(error instanceof BusinessError ? error.message : t('admin.equipmentAcceptance.sendsFailed'));
|
||||
} finally {
|
||||
loading.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 翻页后重拉发送记录。
|
||||
* @param next - 从 1 开始的页码
|
||||
*/
|
||||
function onPageChange(next: number): void {
|
||||
if (page.value === next) return;
|
||||
page.value = next;
|
||||
void load();
|
||||
}
|
||||
|
||||
/**
|
||||
* 更换每页条数后回到第一页。
|
||||
* @param next - 每页条数
|
||||
*/
|
||||
function onSizeChange(next: number): void {
|
||||
pageSize.value = next;
|
||||
void load(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 轮次列写成「超过 N 天」。
|
||||
* @param item - 一条发送记录
|
||||
@@ -69,6 +103,18 @@ function statusText(status: string): string {
|
||||
return te(key) ? t(key) : status;
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送结果对应的标签颜色。
|
||||
* @param status - pending、sent、failed、cancelled
|
||||
* @returns Element 标签类型
|
||||
*/
|
||||
function sendTagType(status: string): TagType {
|
||||
if (status === 'sent') return 'success';
|
||||
if (status === 'failed') return 'danger';
|
||||
if (status === 'pending') return 'warning';
|
||||
return 'info';
|
||||
}
|
||||
|
||||
/**
|
||||
* 已发送显示本地时间,待发送没有时间时显示横线。
|
||||
* @param value - 接口返回的发送时间
|
||||
@@ -81,27 +127,13 @@ function sentText(value?: string | null): string {
|
||||
}
|
||||
|
||||
/**
|
||||
* 在失败图标下方显示原因。用固定定位,避免被表格滚动容器裁掉。
|
||||
* @param event - 悬停或聚焦事件
|
||||
* @param message - 发送失败原因
|
||||
* 空单元格显示横线。
|
||||
* @param value - 接口原值
|
||||
* @returns 文本或横线
|
||||
*/
|
||||
function openFailureTip(event: Event, message: string): void {
|
||||
const target = event.currentTarget;
|
||||
if (!(target instanceof HTMLElement)) return;
|
||||
const rect = target.getBoundingClientRect();
|
||||
const width = 280;
|
||||
failureTip.value = {
|
||||
text: message || t('admin.equipmentAcceptance.failureReasonEmpty'),
|
||||
left: Math.max(8, Math.min(rect.left, window.innerWidth - width - 8)),
|
||||
top: rect.bottom + 6,
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* 鼠标离开或失焦时关掉失败原因提示。
|
||||
*/
|
||||
function closeFailureTip(): void {
|
||||
failureTip.value = null;
|
||||
function textOrDash(value?: string | null): string {
|
||||
const text = String(value || '').trim();
|
||||
return text || '—';
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -133,97 +165,159 @@ onMounted(() => {
|
||||
void load();
|
||||
});
|
||||
|
||||
defineExpose({ reload: load });
|
||||
defineExpose({ reload: () => load(false) });
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<section class="flex min-h-0 flex-1 flex-col gap-3 px-5 pb-4 pt-3">
|
||||
<p class="text-xs text-[#64748b]">{{ t('admin.equipmentAcceptance.sendsLead') }}</p>
|
||||
<div class="flex min-h-0 flex-1 flex-col overflow-hidden rounded-xl border border-[#dce4ef] bg-white">
|
||||
<div class="min-h-0 flex-1 overflow-auto">
|
||||
<table class="min-w-[960px] w-full border-collapse text-left text-xs">
|
||||
<thead class="sticky top-0 bg-[#f8fbff] text-[#64748b]">
|
||||
<tr>
|
||||
<th class="px-3 py-2.5 font-bold">{{ t('admin.equipmentAcceptance.acceptanceNo') }}</th>
|
||||
<th class="px-3 py-2.5 font-bold">{{ t('admin.equipmentAcceptance.purchaseOrderNo') }}</th>
|
||||
<th class="px-3 py-2.5 font-bold">{{ t('admin.equipmentAcceptance.ruleTier') }}</th>
|
||||
<th class="px-3 py-2.5 font-bold">{{ t('admin.equipmentAcceptance.ruleTo') }}</th>
|
||||
<th class="px-3 py-2.5 font-bold">{{ t('admin.equipmentAcceptance.ruleCc') }}</th>
|
||||
<th class="px-3 py-2.5 font-bold">{{ t('admin.equipmentAcceptance.sendResult') }}</th>
|
||||
<th class="px-3 py-2.5 font-bold">{{ t('admin.equipmentAcceptance.excelColumn') }}</th>
|
||||
<th class="px-3 py-2.5 font-bold">{{ t('admin.equipmentAcceptance.sentAt') }}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr v-for="item in records" :key="item.id" class="border-b border-[#dce4ef]">
|
||||
<td class="px-3 py-2.5 font-bold text-[#142033]">{{ item.acceptance_no || '—' }}</td>
|
||||
<td class="px-3 py-2.5">{{ item.purchase_order_no || '—' }}</td>
|
||||
<td class="px-3 py-2.5">{{ tierText(item) }}</td>
|
||||
<td class="px-3 py-2.5">{{ item.to_text || '—' }}</td>
|
||||
<td class="px-3 py-2.5">{{ item.cc_text || '—' }}</td>
|
||||
<td class="px-3 py-2.5">
|
||||
<span class="inline-flex items-center gap-1" :class="item.status === 'failed' ? 'font-bold text-[#b42318]' : ''">
|
||||
{{ statusText(item.status) }}
|
||||
<button
|
||||
v-if="item.status === 'failed'"
|
||||
class="inline-flex h-[22px] w-[22px] items-center justify-center rounded-full text-[#b42318] hover:bg-[#fff1f2]"
|
||||
type="button"
|
||||
:aria-label="t('admin.equipmentAcceptance.failureReasonAria')"
|
||||
@mouseenter="openFailureTip($event, item.error_message || '')"
|
||||
@mouseleave="closeFailureTip"
|
||||
@focus="openFailureTip($event, item.error_message || '')"
|
||||
@blur="closeFailureTip"
|
||||
>
|
||||
<CircleAlert class="h-4 w-4" />
|
||||
</button>
|
||||
</span>
|
||||
</td>
|
||||
<td class="px-3 py-2.5">
|
||||
<div v-if="item.files?.length" class="flex max-w-[280px] flex-col gap-1">
|
||||
<button
|
||||
v-for="file in item.files"
|
||||
:key="file.id"
|
||||
class="inline-flex min-w-0 items-center gap-1 font-semibold text-[#2563eb] disabled:opacity-50"
|
||||
type="button"
|
||||
:disabled="downloadingId === file.id"
|
||||
:title="t('admin.equipmentAcceptance.excelColumn')"
|
||||
@click="downloadFile(file)"
|
||||
>
|
||||
<Download class="h-3.5 w-3.5 shrink-0" />
|
||||
<span class="truncate">{{ file.excel_file_name }}</span>
|
||||
</button>
|
||||
</div>
|
||||
<span v-else>—</span>
|
||||
</td>
|
||||
<td class="px-3 py-2.5">{{ sentText(item.sent_at) }}</td>
|
||||
</tr>
|
||||
<tr v-if="!loading && !records.length">
|
||||
<td colspan="8" class="px-3 py-10 text-center text-[#64748b]">
|
||||
{{ t('admin.equipmentAcceptance.sendsEmpty') }}
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<PaginationBar
|
||||
class="shrink-0"
|
||||
v-model:page="page"
|
||||
v-model:page-size="pageSize"
|
||||
:total="total"
|
||||
:pages="pages"
|
||||
@update:page="() => load()"
|
||||
@update:page-size="() => load()"
|
||||
/>
|
||||
<Teleport to="body">
|
||||
<div
|
||||
v-if="failureTip"
|
||||
class="pointer-events-none fixed z-[80] max-w-[280px] whitespace-normal break-words rounded-lg bg-slate-900 px-2.5 py-1.5 text-xs leading-relaxed text-white shadow-lg"
|
||||
role="tooltip"
|
||||
:style="{ left: `${failureTip.left}px`, top: `${failureTip.top}px` }"
|
||||
<section class="ea-pane">
|
||||
<p class="ea-lead">{{ t('admin.equipmentAcceptance.sendsLead') }}</p>
|
||||
<div ref="tableHost" class="ea-table-host">
|
||||
<ElTable
|
||||
v-loading="loading"
|
||||
class="ea-table"
|
||||
:data="records"
|
||||
:height="tableHeight"
|
||||
row-key="id"
|
||||
:empty-text="t('admin.equipmentAcceptance.sendsEmpty')"
|
||||
>
|
||||
{{ failureTip.text }}
|
||||
</div>
|
||||
</Teleport>
|
||||
<ElTableColumn :label="t('admin.equipmentAcceptance.acceptanceNo')" min-width="156" class-name="ea-ellipsis" show-overflow-tooltip>
|
||||
<template #default="{ row }">
|
||||
<span class="ea-strong">{{ textOrDash((row as EquipmentAcceptanceSendRecord).acceptance_no) }}</span>
|
||||
</template>
|
||||
</ElTableColumn>
|
||||
<ElTableColumn :label="t('admin.equipmentAcceptance.purchaseOrderNo')" min-width="132" class-name="ea-ellipsis" show-overflow-tooltip>
|
||||
<template #default="{ row }">{{ textOrDash((row as EquipmentAcceptanceSendRecord).purchase_order_no) }}</template>
|
||||
</ElTableColumn>
|
||||
<ElTableColumn :label="t('admin.equipmentAcceptance.ruleTier')" min-width="120" class-name="ea-ellipsis" show-overflow-tooltip>
|
||||
<template #default="{ row }">{{ tierText(row as EquipmentAcceptanceSendRecord) }}</template>
|
||||
</ElTableColumn>
|
||||
<ElTableColumn :label="t('admin.equipmentAcceptance.ruleTo')" min-width="160" class-name="ea-ellipsis" show-overflow-tooltip>
|
||||
<template #default="{ row }">{{ textOrDash((row as EquipmentAcceptanceSendRecord).to_text) }}</template>
|
||||
</ElTableColumn>
|
||||
<ElTableColumn :label="t('admin.equipmentAcceptance.ruleCc')" min-width="160" class-name="ea-ellipsis" show-overflow-tooltip>
|
||||
<template #default="{ row }">{{ textOrDash((row as EquipmentAcceptanceSendRecord).cc_text) }}</template>
|
||||
</ElTableColumn>
|
||||
<ElTableColumn :label="t('admin.equipmentAcceptance.sendResult')" min-width="140">
|
||||
<template #default="{ row }">
|
||||
<span class="ea-result">
|
||||
<ElTag :type="sendTagType((row as EquipmentAcceptanceSendRecord).status)" effect="light">
|
||||
{{ statusText((row as EquipmentAcceptanceSendRecord).status) }}
|
||||
</ElTag>
|
||||
<ElTooltip
|
||||
v-if="(row as EquipmentAcceptanceSendRecord).status === 'failed'"
|
||||
:content="(row as EquipmentAcceptanceSendRecord).error_message || t('admin.equipmentAcceptance.failureReasonEmpty')"
|
||||
placement="top"
|
||||
>
|
||||
<ElButton
|
||||
link
|
||||
type="danger"
|
||||
:icon="Warning"
|
||||
:title="t('admin.equipmentAcceptance.failureReasonAria')"
|
||||
/>
|
||||
</ElTooltip>
|
||||
</span>
|
||||
</template>
|
||||
</ElTableColumn>
|
||||
<ElTableColumn :label="t('admin.equipmentAcceptance.excelColumn')" min-width="220">
|
||||
<template #default="{ row }">
|
||||
<div v-if="(row as EquipmentAcceptanceSendRecord).files?.length" class="ea-files">
|
||||
<ElButton
|
||||
v-for="file in (row as EquipmentAcceptanceSendRecord).files"
|
||||
:key="file.id"
|
||||
link
|
||||
type="primary"
|
||||
:icon="Download"
|
||||
:loading="downloadingId === file.id"
|
||||
:title="t('admin.equipmentAcceptance.excelColumn')"
|
||||
@click="downloadFile(file)"
|
||||
>
|
||||
{{ file.excel_file_name }}
|
||||
</ElButton>
|
||||
</div>
|
||||
<span v-else>—</span>
|
||||
</template>
|
||||
</ElTableColumn>
|
||||
<ElTableColumn :label="t('admin.equipmentAcceptance.sentAt')" min-width="168" class-name="ea-ellipsis" show-overflow-tooltip>
|
||||
<template #default="{ row }">{{ sentText((row as EquipmentAcceptanceSendRecord).sent_at) }}</template>
|
||||
</ElTableColumn>
|
||||
</ElTable>
|
||||
</div>
|
||||
<div class="ea-pager">
|
||||
<ElPagination
|
||||
background
|
||||
layout="total, sizes, prev, pager, next"
|
||||
:total="total"
|
||||
:page-size="pageSize"
|
||||
:current-page="page"
|
||||
:page-sizes="PAGE_SIZES"
|
||||
@current-change="onPageChange"
|
||||
@size-change="onSizeChange"
|
||||
/>
|
||||
</div>
|
||||
</section>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.ea-pane {
|
||||
display: flex;
|
||||
flex: 1 1 auto;
|
||||
flex-direction: column;
|
||||
min-height: 0;
|
||||
min-width: 0;
|
||||
overflow: hidden;
|
||||
background: var(--el-bg-color);
|
||||
border: 1px solid var(--el-border-color);
|
||||
border-radius: var(--el-border-radius-base);
|
||||
}
|
||||
|
||||
.ea-lead {
|
||||
flex: none;
|
||||
margin: 0;
|
||||
padding: 8px 12px;
|
||||
border-bottom: 1px solid var(--el-border-color-lighter);
|
||||
font-size: var(--el-font-size-extra-small);
|
||||
line-height: 1.4;
|
||||
color: var(--el-text-color-secondary);
|
||||
}
|
||||
|
||||
.ea-table-host {
|
||||
flex: 1 1 auto;
|
||||
min-height: 0;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.ea-table :deep(.el-table__cell) {
|
||||
padding-top: 6px;
|
||||
padding-bottom: 6px;
|
||||
}
|
||||
|
||||
.ea-table :deep(.ea-ellipsis .cell) {
|
||||
white-space: nowrap;
|
||||
word-break: normal;
|
||||
}
|
||||
|
||||
.ea-strong {
|
||||
font-weight: var(--el-font-weight-primary);
|
||||
color: var(--el-text-color-primary);
|
||||
}
|
||||
|
||||
.ea-result {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 4px;
|
||||
}
|
||||
|
||||
.ea-files {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: flex-start;
|
||||
}
|
||||
|
||||
.ea-pager {
|
||||
display: flex;
|
||||
flex: none;
|
||||
justify-content: flex-end;
|
||||
padding: 8px 12px;
|
||||
border-top: 1px solid var(--el-border-color-lighter);
|
||||
}
|
||||
</style>
|
||||
@@ -6101,7 +6101,7 @@
|
||||
"configSheetLead": "Set the day threshold on the left. The right side lists who is notified. COO, purchasing deputy manager, and general manager are each chosen once and shown on every round that uses them.",
|
||||
"overPrefix": "Over",
|
||||
"roundName": "Round {n}",
|
||||
"roundFixedNote": "Follows the current order. No one is picked here.",
|
||||
"roundFixedNote": "Taken from the order's using-department representative. No one is picked here.",
|
||||
"replaceUser": "Change",
|
||||
"round4ShortHint": "Off by default. The general manager is not notified.",
|
||||
"tier1": "Tier 1",
|
||||
@@ -6132,9 +6132,9 @@
|
||||
"ruleTo": "To",
|
||||
"ruleCc": "Cc",
|
||||
"ruleOver": "Over {days} days",
|
||||
"ruleTo1": "Current handler",
|
||||
"ruleCc1": "Their supervisor and the applicant",
|
||||
"ruleTo2": "The handler's deputy manager",
|
||||
"ruleTo1": "Using-department representative",
|
||||
"ruleCc1": "Their direct supervisor and the procurement owner",
|
||||
"ruleTo2": "That representative's deputy manager",
|
||||
"ruleCc2": "COO and procurement deputy manager",
|
||||
"ruleTo3": "COO",
|
||||
"ruleCc3": "Procurement deputy manager",
|
||||
@@ -6159,12 +6159,19 @@
|
||||
"filterOverdue": "Overdue",
|
||||
"filterStopped": "No further reminders",
|
||||
"filterNotStarted": "Not started",
|
||||
"keywordPlaceholder": "Flow no., acceptance no., or PO no.",
|
||||
"badgeOverdue": "Overdue",
|
||||
"badgeOnTime": "Not yet due",
|
||||
"currentHandlers": "Current handlers",
|
||||
"daysValue": "{days} days",
|
||||
"statusAll": "All statuses",
|
||||
"status": "Status",
|
||||
"source": "Source",
|
||||
"sourceE10": "E10",
|
||||
"sourceE8": "E8",
|
||||
"flowNo": "Process no.",
|
||||
"requestTitle": "Title",
|
||||
"createdAt": "Created at",
|
||||
"acceptanceNo": "Acceptance no.",
|
||||
"purchaseOrderNo": "Purchase order no.",
|
||||
"applicant": "Applicant",
|
||||
|
||||
@@ -6101,7 +6101,7 @@
|
||||
"configSheetLead": "ด้านซ้ายกำหนดจำนวนวันที่เกิน ด้านขวาคือผู้รับในรอบนี้ COO รองผู้จัดการจัดซื้อ และผู้จัดการทั่วไปเลือกครั้งเดียว แล้วแสดงคนเดียวกันในทุกรอบที่ใช้",
|
||||
"overPrefix": "เกิน",
|
||||
"roundName": "รอบที่ {n}",
|
||||
"roundFixedNote": "ตามเอกสารปัจจุบัน ไม่ต้องเลือกคนที่นี่",
|
||||
"roundFixedNote": "ตามผู้รับผิดชอบฝ่ายใช้งานบนเอกสาร ไม่ต้องเลือกคนที่นี่",
|
||||
"replaceUser": "เปลี่ยน",
|
||||
"round4ShortHint": "ค่าเริ่มต้นคือปิด จะไม่แจ้งผู้จัดการทั่วไป",
|
||||
"tier1": "ขั้นที่ 1",
|
||||
@@ -6132,9 +6132,9 @@
|
||||
"ruleTo": "ผู้รับหลัก",
|
||||
"ruleCc": "สำเนา",
|
||||
"ruleOver": "เกิน {days} วัน",
|
||||
"ruleTo1": "ผู้ดำเนินการปัจจุบัน",
|
||||
"ruleCc1": "หัวหน้าตรงและผู้ขอ",
|
||||
"ruleTo2": "รองผู้จัดการของผู้ดำเนินการ",
|
||||
"ruleTo1": "ผู้รับผิดชอบฝ่ายใช้งาน",
|
||||
"ruleCc1": "หัวหน้าตรงของผู้นั้นและผู้ขอจัดซื้อ",
|
||||
"ruleTo2": "รองผู้จัดการของผู้รับผิดชอบฝ่ายใช้งาน",
|
||||
"ruleCc2": "COO และรองผู้จัดการจัดซื้อ",
|
||||
"ruleTo3": "COO",
|
||||
"ruleCc3": "รองผู้จัดการจัดซื้อ",
|
||||
@@ -6159,12 +6159,19 @@
|
||||
"filterOverdue": "เกินกำหนด",
|
||||
"filterStopped": "ไม่แจ้งเตือนอีก",
|
||||
"filterNotStarted": "ยังไม่เริ่ม",
|
||||
"keywordPlaceholder": "เลขที่กระบวนการ เลขที่ตรวจรับ หรือเลขที่ใบสั่งซื้อ",
|
||||
"badgeOverdue": "เกินกำหนด",
|
||||
"badgeOnTime": "ยังไม่เกินกำหนด",
|
||||
"currentHandlers": "ผู้ดำเนินการปัจจุบัน",
|
||||
"daysValue": "{days} วัน",
|
||||
"statusAll": "ทุกสถานะ",
|
||||
"status": "สถานะ",
|
||||
"source": "แหล่งที่มา",
|
||||
"sourceE10": "E10",
|
||||
"sourceE8": "E8",
|
||||
"flowNo": "เลขที่กระบวนการ",
|
||||
"requestTitle": "ชื่อเรื่อง",
|
||||
"createdAt": "เวลาที่สร้าง",
|
||||
"acceptanceNo": "เลขที่ใบตรวจรับ",
|
||||
"purchaseOrderNo": "เลขที่ใบสั่งซื้อ",
|
||||
"applicant": "ผู้ขอ",
|
||||
|
||||
@@ -6115,7 +6115,7 @@
|
||||
"configSheetLead": "左边改超过多少天。右边是这一轮的主送和抄送。COO、采购经副理、总经理各选一次,用到的轮次都显示同一个人。",
|
||||
"overPrefix": "超过",
|
||||
"roundName": "第 {n} 轮",
|
||||
"roundFixedNote": "随当前单据变化,这里不选人",
|
||||
"roundFixedNote": "随单据上的使用部门担当变化,这里不选人",
|
||||
"replaceUser": "更换",
|
||||
"round4ShortHint": "默认关闭,不通知总经理",
|
||||
"tier1": "第 1 档",
|
||||
@@ -6146,9 +6146,9 @@
|
||||
"ruleTo": "主送",
|
||||
"ruleCc": "抄送",
|
||||
"ruleOver": "超过 {days} 天",
|
||||
"ruleTo1": "当前节点处理人",
|
||||
"ruleTo1": "使用部门担当",
|
||||
"ruleCc1": "其直接主管、采购担当",
|
||||
"ruleTo2": "当前节点处理人的经副理",
|
||||
"ruleTo2": "使用部门担当的经副理",
|
||||
"ruleCc2": "COO、采购经副理",
|
||||
"ruleTo3": "COO",
|
||||
"ruleCc3": "采购经副理",
|
||||
@@ -6173,12 +6173,19 @@
|
||||
"filterOverdue": "已逾期",
|
||||
"filterStopped": "不再提醒",
|
||||
"filterNotStarted": "未开始",
|
||||
"keywordPlaceholder": "流程编号、验收单号或采购单号",
|
||||
"badgeOverdue": "已逾期",
|
||||
"badgeOnTime": "未超时",
|
||||
"currentHandlers": "当前处理人",
|
||||
"daysValue": "{days} 天",
|
||||
"statusAll": "全部状态",
|
||||
"status": "状态",
|
||||
"source": "来源",
|
||||
"sourceE10": "E10",
|
||||
"sourceE8": "E8",
|
||||
"flowNo": "流程编号",
|
||||
"requestTitle": "标题",
|
||||
"createdAt": "创建时间",
|
||||
"acceptanceNo": "验收单单号",
|
||||
"purchaseOrderNo": "采购单号",
|
||||
"applicant": "申请人",
|
||||
|
||||
@@ -6101,7 +6101,7 @@
|
||||
"configSheetLead": "左邊改超過多少天。右邊是這一輪的主送和抄送。COO、採購經副理、總經理各選一次,用到的輪次都顯示同一個人。",
|
||||
"overPrefix": "超過",
|
||||
"roundName": "第 {n} 輪",
|
||||
"roundFixedNote": "隨目前單據變化,這裡不選人",
|
||||
"roundFixedNote": "隨單據上的使用部門擔當變化,這裡不選人",
|
||||
"replaceUser": "更換",
|
||||
"round4ShortHint": "預設關閉,不通知總經理",
|
||||
"tier1": "第 1 檔",
|
||||
@@ -6132,9 +6132,9 @@
|
||||
"ruleTo": "主送",
|
||||
"ruleCc": "抄送",
|
||||
"ruleOver": "超過 {days} 天",
|
||||
"ruleTo1": "目前節點處理人",
|
||||
"ruleTo1": "使用部門擔當",
|
||||
"ruleCc1": "其直接主管、採購擔當",
|
||||
"ruleTo2": "目前節點處理人的經副理",
|
||||
"ruleTo2": "使用部門擔當的經副理",
|
||||
"ruleCc2": "COO、採購經副理",
|
||||
"ruleTo3": "COO",
|
||||
"ruleCc3": "採購經副理",
|
||||
@@ -6159,12 +6159,19 @@
|
||||
"filterOverdue": "已逾期",
|
||||
"filterStopped": "不再提醒",
|
||||
"filterNotStarted": "未開始",
|
||||
"keywordPlaceholder": "流程編號、驗收單號或採購單號",
|
||||
"badgeOverdue": "已逾期",
|
||||
"badgeOnTime": "未超時",
|
||||
"currentHandlers": "目前處理人",
|
||||
"daysValue": "{days} 天",
|
||||
"statusAll": "全部狀態",
|
||||
"status": "狀態",
|
||||
"source": "來源",
|
||||
"sourceE10": "E10",
|
||||
"sourceE8": "E8",
|
||||
"flowNo": "流程編號",
|
||||
"requestTitle": "標題",
|
||||
"createdAt": "建立時間",
|
||||
"acceptanceNo": "驗收單單號",
|
||||
"purchaseOrderNo": "採購單號",
|
||||
"applicant": "申請人",
|
||||
|
||||
Reference in new issue
Block a user