Commit 87d7e9e9 by liimin

优化规则 与视觉

1 parent 8d96d088
......@@ -131,3 +131,25 @@ ImportControl AUTO_KEYS 与「区界文件未加载」提示、测试)。
验证:tsc 0 · **22 files / 308 tests 全绿** · eslint 0。回退验证:临时从集合摘掉三个旧名 →
新测试变红(× 功能区旧名…),恢复后全绿。
---
## 原始 vs 已补全 交叉对比 + 两项规则落地(02:22–09:10)
超人给了最原始第三方 xlsx(5 列)与已补全 xlsx(8 列,追加 行政区/街道/道路)做对比,并把两件事落地到代码。
**对比结论(写入 `剔除规则复核报告.md` 第八节):**
- 补全是纯追加:两文件均 42,806 行,案件号唯一性不变,5 个可靠列逐行 0 差异 → 未篡改原始数据。
- 行政区补全 100% 贴合地址结构化「区」段(42,802/42,802 零冲突)→ 「以出险地址为准」在补全阶段成立。
- 街道/道路来源:严格全串匹配 街道 39.1% / 道路 54.6% 在地址原文,与前期报告一致。
**落地 1 — OUTSIDE 全文扫描(解决「前缀写龙岗区、细节在东莞」漏判):**
- `cleanRules.ts` 新增 `EXTERNAL_HARD_MARKERS`(带「市」后缀邻市名 + 东莞临深镇街),`classifyRegion` 最前加 `firstOutsideAnywhere`(整条地址 join 后子串扫描),压过深圳前缀与第 3 段区名。
- 标记表经真实数据验证零误伤:只命中 3 行全是真外市(带「市」后缀的城市名不会撞深圳地名;东莞镇名深圳无「镇」建制)。
- 真实数据回跑:OUTSIDE **2 → 3**(抓到 `90578002800029299736` 东莞凤岗案)。
**落地 2 — 大鹏新区单列:**
- `ingestCore.ts` 街道定稿后、写 `districtIdx` 前,把 `龙岗区 + 南澳/葵涌/大鹏街道` 重映射为 `大鹏新区`(`DAPENG_STREETS`)。
- 真实数据回跑:**499 行**划入大鹏新区(龙岗区 10,009 → 9,509),大鹏新区成独立统计区。
**验证:** tsc 0 · 全量单测 **22 files / 311 tests 全绿**(早期一次 flaky 的 processTimers 告警,复跑即 0 error)· eslint 0。新增 3 条单测(cleanRules 埋点 OUTSIDE + 凤岗小学精度兜底;ingestCore 大鹏重映射)。报告文件同步从「提议」更新为「已实现」。
......@@ -3,228 +3,449 @@
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="color-scheme" content="light">
<meta name="theme-color" content="#f1ede3">
<title>坐标补齐</title>
<link rel="icon" href="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Crect width='32' height='32' fill='%23f1ede3'/%3E%3Cpath d='M16 5v22M5 16h22' stroke='%23b23a2c' stroke-width='1.4'/%3E%3Ccircle cx='16' cy='16' r='5' fill='none' stroke='%23171a15' stroke-width='2'/%3E%3C/svg%3E">
<style>
:root {
--bg: #eef1f5; --surface: #fff; --sunk: #f7f9fb;
--line: #dfe4eb; --line-soft: #ebeef3;
--ink: #131820; --ink-2: #414c5c; --muted: #6d7887;
--accent: #1552b8; --accent-soft: #e8f0fb; --accent-line: #c3d6f0;
--warn: #9a4f13; --warn-soft: #fdf3e7; --bad: #a52d24; --bad-soft: #fceeed;
--good: #166b46; --good-soft: #e9f6f0;
color-scheme: light;
--paper: #f1ede3; --paper-2: #fbf8f0; --paper-3: #f6f2e8;
--line: #d9d1c0; --line-soft: #e8e1d2; --line-strong: #bcb29d;
--ink: #171a15; --ink-2: #41463d; --muted: #6a6a5e;
--mark: #b23a2c; --mark-soft: #f6e6df; --mark-line: #e2c1b6;
--warn: #8a5410; --warn-soft: #f8edd9; --bad: #9e2b1f; --good: #1f6347;
--rail: #161a15; --rail-2: #1c211b; --rail-line: #333a30;
--rail-ink: #ece8da; --rail-muted: #a4ac9d;
--space-1: 4px; --space-2: 8px; --space-3: 12px; --space-4: 16px; --space-5: 24px; --space-6: 32px;
--fs-xs: 11.5px; --fs-sm: 12.5px; --fs-md: 13.5px; --fs-lg: 15px; --fs-xl: 19px; --fs-2xl: 26px;
--mono: ui-monospace, "Cascadia Mono", Consolas, "Courier New", monospace;
--radius: 8px;
--shadow: 0 1px 2px rgba(19, 24, 32, .05), 0 6px 18px rgba(19, 24, 32, .05);
--radius: 3px;
--sans: "Segoe UI Variable Text", "Segoe UI", "Microsoft YaHei UI", "Microsoft YaHei", system-ui, sans-serif;
--display: "Bahnschrift", "Segoe UI Variable Display", "Segoe UI", "Microsoft YaHei UI", sans-serif;
--mono: "Cascadia Mono", "Cascadia Code", Consolas, "Courier New", monospace;
--shadow-card: 0 1px 0 rgba(255, 255, 255, .75) inset, 0 10px 26px rgba(23, 26, 21, .04);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
margin: 0; padding: var(--space-5) var(--space-4) var(--space-6);
background: var(--bg); color: var(--ink);
font: var(--fs-md)/1.65 "Segoe UI Variable Text", "Segoe UI", "Microsoft YaHei", system-ui, sans-serif;
margin: 0; min-height: 100vh; color: var(--ink);
font: 400 14px/1.7 var(--sans);
background:
radial-gradient(900px 420px at 88% -8%, rgba(178, 58, 44, .07), transparent 62%),
repeating-linear-gradient(0deg, rgba(23, 26, 21, .028) 0 1px, transparent 1px 88px),
repeating-linear-gradient(90deg, rgba(23, 26, 21, .028) 0 1px, transparent 1px 88px),
var(--paper);
}
.wrap { max-width: 1240px; margin: 0 auto; }
header.top { display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-4); align-items: baseline; margin-bottom: var(--space-5); }
h1 { font-size: var(--fs-2xl); line-height: 1.2; margin: 0; letter-spacing: -.01em; font-weight: 650; }
.lede { color: var(--ink-2); max-width: 62ch; }
.lede .where { color: var(--muted); font-size: var(--fs-sm); }
.layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-4); }
@media (min-width: 1080px) {
.layout { grid-template-columns: minmax(0, 1.55fr) minmax(360px, .85fr); align-items: start; }
.side { position: sticky; top: var(--space-4); }
/* 纸面颗粒:一层极淡的噪声,让大片留白不像屏幕底色 */
body::before {
content: ""; position: fixed; inset: 0; z-index: 0; pointer-events: none; opacity: .045;
mix-blend-mode: multiply;
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
}
.col { display: grid; gap: var(--space-3); align-content: start; }
section {
background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
padding: var(--space-4) var(--space-4) var(--space-4); box-shadow: var(--shadow);
.wrap { position: relative; z-index: 1; max-width: 1280px; margin: 0 auto; padding: 26px 28px 56px; }
/* 页眉:制图刻度 + 台账标题 */
.ruler {
height: 9px; margin-bottom: 20px; border-top: 1px solid var(--line);
background: repeating-linear-gradient(90deg, var(--line-strong) 0 1px, transparent 1px 20px);
-webkit-mask-image: linear-gradient(90deg, #000 0 62%, transparent 100%);
mask-image: linear-gradient(90deg, #000 0 62%, transparent 100%);
}
.masthead {
display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end;
gap: 20px 48px; padding: 0 0 22px; margin-bottom: 24px; border-bottom: 1px solid var(--line);
animation: rise .5s cubic-bezier(.2, .7, .2, 1) both;
}
.eyebrow {
display: flex; align-items: center; gap: 9px; margin: 0 0 12px;
font: 600 11px/1 var(--display); letter-spacing: .13em; text-transform: uppercase; color: var(--mark);
}
.eyebrow::before { content: ""; width: 18px; height: 1px; background: currentColor; }
h1 { margin: 0; font: 600 40px/1.12 var(--sans); letter-spacing: .015em; }
.lede { margin: 12px 0 0; max-width: 56ch; color: var(--ink-2); font-size: 14.5px; }
.mast-side { display: grid; gap: 12px; justify-items: end; text-align: right; }
.meta { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; margin: 0; }
.meta span {
padding: 5px 8px; border: 1px solid var(--line-strong); border-radius: 2px;
background: rgba(255, 255, 255, .35); color: var(--ink-2);
font: 600 10.5px/1 var(--display); letter-spacing: .13em; text-transform: uppercase;
}
.where { margin: 0; color: var(--muted); font-size: 11.5px; letter-spacing: .01em; }
/* 两栏:左台账,右运行台 */
.layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px 26px; align-items: start; }
@media (min-width: 1100px) {
.layout { grid-template-columns: minmax(0, 1fr) 404px; }
.side {
position: sticky; top: 18px; align-self: start; max-height: calc(100vh - 36px);
overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin;
scrollbar-color: #59624f transparent;
}
.side::-webkit-scrollbar { width: 8px; }
.side::-webkit-scrollbar-thumb { background: #59624f; border: 2px solid var(--paper); border-radius: 99px; }
}
.col { display: grid; gap: 14px; align-content: start; min-width: 0; }
.col > * { animation: rise .45s cubic-bezier(.2, .7, .2, 1) both; }
.col > *:nth-child(1) { animation-delay: .04s; }
.col > *:nth-child(2) { animation-delay: .08s; }
.col > *:nth-child(3) { animation-delay: .12s; }
.col > *:nth-child(4) { animation-delay: .16s; }
.col > *:nth-child(5) { animation-delay: .2s; }
.col > *:nth-child(6) { animation-delay: .24s; }
.col > *:nth-child(7) { animation-delay: .28s; }
.col > *:nth-child(8) { animation-delay: .32s; }
.side { animation: rise .5s cubic-bezier(.2, .7, .2, 1) .1s both; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.card {
position: relative; padding: 18px 20px 20px;
background: var(--paper-2); border: 1px solid var(--line); border-radius: var(--radius);
box-shadow: var(--shadow-card);
}
/* 右上角的套准角标:像一张排好的制图板 */
.card::after {
content: ""; position: absolute; top: 9px; right: 9px; width: 7px; height: 7px;
border-top: 1px solid var(--line-strong); border-right: 1px solid var(--line-strong);
pointer-events: none; opacity: .75;
}
.sec-head {
display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
padding-bottom: 11px; margin-bottom: 13px; border-bottom: 1px solid var(--line-soft);
}
.num {
flex: none; padding: 4px 5px; border: 1px solid var(--mark-line); border-radius: 2px;
background: #fffdf8; color: var(--mark);
font: 600 11px/1 var(--display); letter-spacing: .1em; font-variant-numeric: tabular-nums;
}
h2 {
display: flex; align-items: center; gap: var(--space-2);
font-size: var(--fs-lg); margin: 0 0 var(--space-1); font-weight: 620; letter-spacing: 0;
display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; margin: 0;
font: 600 15.5px/1.35 var(--sans); letter-spacing: .01em;
}
h2 .num {
flex: none; font: 600 var(--fs-xs)/1 var(--mono); color: var(--accent);
background: var(--accent-soft); border: 1px solid var(--accent-line);
border-radius: 999px; padding: 4px 7px; letter-spacing: .04em;
.hint { font-size: 11.5px; font-weight: 500; color: var(--muted); letter-spacing: .01em; }
.desc { margin: 0 0 14px; max-width: 66ch; color: var(--muted); font-size: 12.5px; line-height: 1.68; }
.group-label {
display: flex; align-items: center; gap: 12px; margin: 8px 2px 0;
color: var(--muted); font-size: 11px; letter-spacing: .09em;
}
.desc { color: var(--muted); font-size: var(--fs-sm); margin: 0 0 var(--space-3); max-width: 68ch; }
.group-label::before, .group-label::after { content: ""; flex: 1; height: 1px; background: var(--line); }
label { display: block; font-weight: 600; font-size: var(--fs-sm); color: var(--ink-2); margin-bottom: 6px; letter-spacing: .01em; }
.hint { color: var(--muted); font-weight: 400; }
/* 表单 */
.field { min-width: 0; }
.control { display: flex; gap: var(--space-2); align-items: flex-end; flex-wrap: wrap; }
.fields { display: grid; gap: 14px; }
label { display: block; margin-bottom: 6px; color: var(--ink-2); font-size: 12px; font-weight: 600; letter-spacing: .02em; }
.control { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
input[type=text], input[type=number], input[type=password] {
flex: 1 1 240px; width: 100%; min-width: 0; padding: 9px 11px; font: inherit; font-size: var(--fs-md);
color: var(--ink); background: #fff; border: 1px solid var(--line); border-radius: 6px;
font-variant-numeric: tabular-nums;
flex: 1 1 220px; width: 100%; min-width: 0; padding: 9px 11px;
font: 400 13.5px/1.5 var(--sans); color: var(--ink); font-variant-numeric: tabular-nums;
background: #fffdfa; border: 1px solid var(--line-strong); border-radius: 2px;
transition: border-color .12s, box-shadow .12s;
}
input.path { font: var(--fs-sm)/1.5 var(--mono); letter-spacing: 0; }
input::placeholder { color: #9aa4b1; }
input:hover:not(:disabled) { border-color: #c8d0da; }
input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }
input:disabled, button:disabled { opacity: .45; cursor: not-allowed; }
.unit { flex: none; align-self: center; color: var(--muted); font-size: var(--fs-sm); margin-left: -4px; }
input.path { font: 400 12.5px/1.55 var(--mono); }
input.short { flex: 1 1 140px; }
input::placeholder { color: #9a9588; }
input, textarea { caret-color: var(--mark); }
::selection { background: rgba(178, 58, 44, .2); }
input:hover:not(:disabled) { border-color: #8d8574; }
input:focus-visible { outline: 0; border-color: var(--ink); box-shadow: 0 0 0 3px rgba(178, 58, 44, .16); }
input:disabled, button:disabled { opacity: .4; cursor: not-allowed; }
.unit { flex: none; color: var(--muted); font-size: 12px; }
button {
font: inherit; font-size: var(--fs-md); font-weight: 600; padding: 9px 15px; border-radius: 6px;
border: 1px solid var(--accent); background: var(--accent); color: #fff; cursor: pointer;
transition: background .12s, border-color .12s, color .12s;
padding: 10px 15px; border: 1px solid var(--ink); border-radius: 2px;
background: var(--ink); color: var(--paper-2); cursor: pointer;
font: 600 13.5px/1.2 var(--sans); letter-spacing: .02em;
transition: background .14s, border-color .14s, color .14s, transform .1s;
}
button:hover:not(:disabled) { background: #0f469e; border-color: #0f469e; }
button:hover:not(:disabled) { background: var(--mark); border-color: var(--mark); }
button:active:not(:disabled) { transform: translateY(1px); }
button:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
button.ghost { background: #fff; color: var(--accent); border-color: var(--accent-line); }
button.ghost:hover:not(:disabled) { background: var(--accent-soft); color: #0f469e; border-color: var(--accent); }
button.quiet { background: none; border: 0; color: var(--accent); padding: 4px 6px; font-weight: 600; }
button.danger { border-color: #e2b6b1; background: #fff; color: var(--bad); }
button.danger:hover:not(:disabled) { background: var(--bad-soft); border-color: var(--bad); color: var(--bad); }
button.big { padding: 11px 18px; font-size: var(--fs-lg); }
/* 弱按钮(清单芯片、快捷目录)别被通用 hover 的实色底盖掉文字 */
button.quiet:hover:not(:disabled) { background: var(--accent-soft); color: #0f469e; }
.switch { display: flex; gap: var(--space-3); align-items: flex-start; }
button.ghost { background: #fffdfa; border-color: var(--line-strong); color: var(--ink); }
button.ghost:hover:not(:disabled) { background: var(--mark-soft); border-color: var(--mark); color: var(--bad); }
button.quiet { padding: 4px 2px; border: 0; background: none; color: var(--mark); font-weight: 600; }
button.quiet:hover:not(:disabled) { background: none; color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
button.chip {
flex: none; padding: 8px 11px; background: #fffdfa; border-color: var(--line-strong);
color: var(--ink-2); font-size: 12px; font-weight: 600;
}
button.chip:hover:not(:disabled) { background: var(--mark-soft); border-color: var(--mark); color: var(--bad); }
button.big { padding: 12px 16px; font-size: 14.5px; }
button.stop { border-color: #c9b5a6; background: transparent; color: var(--bad); }
button.stop:hover:not(:disabled) { background: var(--mark-soft); border-color: var(--bad); color: var(--bad); }
/* 开关:方形滑钮,像仪表上的拨子 */
.switch { display: flex; gap: 12px; align-items: flex-start; }
.switch + .switch { margin-top: 16px; padding-top: 16px; border-top: 1px dashed var(--line-soft); }
.switch input {
appearance: none; -webkit-appearance: none; flex: none; width: 38px; height: 22px; margin: 2px 0 0;
background: #d5dbe3; border-radius: 999px; position: relative; cursor: pointer; transition: background .15s;
appearance: none; -webkit-appearance: none; flex: none; width: 40px; height: 24px;
margin: 1px 0 0; border: 1px solid #c7bfae; border-radius: 3px; background: #ddd6c7;
position: relative; cursor: pointer; transition: background .16s, border-color .16s;
}
.switch input::after {
content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%;
background: #fff; box-shadow: 0 1px 2px rgba(19, 24, 32, .3); transition: transform .15s;
content: ""; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px;
border-radius: 2px; background: #fffdfa; box-shadow: 0 1px 2px rgba(23, 26, 21, .25);
transition: transform .16s cubic-bezier(.3, .8, .3, 1);
}
.switch input:checked { background: var(--accent); }
.switch input:checked { background: var(--mark); border-color: var(--mark); }
.switch input:checked::after { transform: translateX(16px); }
.switch input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.switch label { margin: 0; font-size: var(--fs-md); color: var(--ink); font-weight: 600; }
.switch .desc { margin: 2px 0 0; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: var(--space-3); }
.fields { display: grid; gap: var(--space-3); }
.grid.tight { margin-top: var(--space-3); }
.note { margin-top: var(--space-2); color: var(--muted); font-size: var(--fs-sm); overflow-wrap: anywhere; }
.switch input:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.switch > div { min-width: 0; }
.switch label { margin: 0; font-size: 13.5px; font-weight: 600; color: var(--ink); }
.switch .desc { margin: 3px 0 0; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px 14px; }
.grid .field + .field { margin-top: 0; }
.grid.tight { margin-top: 15px; }
.fade { opacity: .4; transition: opacity .2s; }
.note { margin-top: 10px; color: var(--muted); font-size: 12px; line-height: 1.62; overflow-wrap: anywhere; }
.note:empty { display: none; }
.note.warn, .note.bad, .note.ok { padding-left: 9px; border-left: 2px solid currentColor; }
.note.warn { color: var(--warn); }
.note.bad { color: var(--bad); }
.note.ok { color: var(--good); }
.fade { opacity: .45; }
/* 运行面板 */
.actions { display: flex; gap: var(--space-2); align-items: center; flex-wrap: wrap; }
.state { font-size: var(--fs-sm); color: var(--muted); }
.state b { color: var(--ink); font-weight: 620; }
.bar { height: 6px; border-radius: 999px; background: var(--line); overflow: hidden; margin: var(--space-3) 0 var(--space-2); }
.bar i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .25s ease-out; }
/* 运行台:深墨底、纸色字,和左侧台账形成一明一暗 */
.deck {
overflow: hidden; color: var(--rail-ink); background: var(--rail);
border: 1px solid #0d110d; border-radius: 4px;
box-shadow: 0 20px 44px rgba(16, 20, 16, .2);
}
.deck-top {
display: flex; align-items: center; justify-content: space-between; gap: 10px;
padding: 11px 18px; background: #121612; border-bottom: 1px solid var(--rail-line);
}
.deck-title { font: 600 10.5px/1 var(--sans); letter-spacing: .22em; color: var(--rail-muted); }
.status { display: inline-flex; align-items: center; gap: 8px; font-size: 11.5px; color: var(--rail-muted); }
.status i {
width: 7px; height: 7px; border-radius: 50%; background: #6d7a68;
box-shadow: 0 0 0 3px rgba(109, 122, 104, .14);
}
.deck[data-state=running] .status i { background: var(--mark); animation: pulse 1.6s ease-in-out infinite; }
.deck[data-state=done] .status i { background: #57a879; box-shadow: 0 0 0 3px rgba(87, 168, 121, .16); }
.deck[data-state=error] .status i { background: #d46a58; box-shadow: 0 0 0 3px rgba(212, 106, 88, .16); }
@keyframes pulse {
0%, 100% { box-shadow: 0 0 0 3px rgba(178, 58, 44, .14); }
50% { box-shadow: 0 0 0 6px rgba(178, 58, 44, .02); }
}
.deck-sec { padding: 18px; }
.deck-sec + .deck-sec { border-top: 1px solid var(--rail-line); }
.deck .sec-head { border-bottom: 1px dashed var(--rail-line); }
.deck h2 { color: var(--rail-ink); font-size: 14.5px; }
.deck .num { background: #221a17; border-color: #4a3b35; color: #e0a093; }
.deck .desc { color: var(--rail-muted); }
.deck label { color: var(--rail-ink); }
.deck .note { color: var(--rail-muted); }
.deck .note.warn { color: #e8b46e; }
.deck .note.bad { color: #f0a596; }
.deck .note.ok { color: #8fcaa8; }
.deck input[type=text], .deck input[type=password] {
background: #0e120e; border-color: #3b4338; color: #f1ede1; font-family: var(--mono);
}
.deck input::placeholder { color: #78826f; }
.deck input:hover:not(:disabled) { border-color: #5b6655; }
.deck input:focus-visible { border-color: #e9e4d7; box-shadow: 0 0 0 3px rgba(178, 58, 44, .35); }
.deck button.ghost { background: #1d241d; border-color: #3d463b; color: #e9e4d6; }
.deck button.ghost:hover:not(:disabled) { background: #2a1c18; border-color: #8a4a3c; color: #f0b3a7; }
.deck button.quiet { color: #cfd6c8; }
.deck button.quiet:hover:not(:disabled) { background: none; color: #fff; }
.deck button:focus-visible { outline-color: var(--rail-ink); }
.deck .big { flex: 1; background: var(--paper-2); border-color: var(--paper-2); color: var(--ink); }
.deck .big:hover:not(:disabled) { background: var(--mark); border-color: var(--mark); color: var(--paper-2); }
.deck button.stop { border-color: #4a3b36; color: #d9a196; }
.deck button.stop:hover:not(:disabled) { background: #2a1b18; border-color: #7a4438; color: #f0b3a7; }
.actions { display: flex; gap: 8px; margin-top: 15px; }
.stage {
position: relative; min-height: 46px; margin-top: 12px; padding-left: 15px;
color: var(--rail-ink); font-size: 15px; font-weight: 600; line-height: 1.5;
font-variant-numeric: tabular-nums;
}
.stage::before {
content: ""; position: absolute; left: 0; top: 9px; width: 6px; height: 6px;
background: var(--mark); transition: background .2s;
}
.stage.ok::before { background: #57a879; }
.stage.bad::before { background: #d46a58; }
.bar {
position: relative; height: 8px; margin: 12px 0 0; border-radius: 2px;
background: #2a302a; overflow: hidden;
}
.bar i { display: block; height: 100%; width: 0; background: var(--mark); transition: width .25s ease-out; }
.bar::after {
content: ""; position: absolute; inset: 0; pointer-events: none;
background: repeating-linear-gradient(90deg, transparent 0 calc(10% - 1px), rgba(236, 232, 218, .16) calc(10% - 1px) 10%);
}
.bar.busy i { width: 32%; animation: slide 1.5s cubic-bezier(.4, 0, .6, 1) infinite; }
@keyframes slide { from { margin-left: -32%; } to { margin-left: 100%; } }
.stage { font-weight: 620; font-size: var(--fs-lg); font-variant-numeric: tabular-nums; }
.log { margin-top: 14px; border: 1px solid var(--rail-line); border-radius: 3px; background: #0d110d; }
.log summary {
display: flex; align-items: center; gap: 8px; padding: 8px 12px; cursor: pointer;
list-style: none; color: var(--rail-muted); font-size: 11.5px; font-weight: 600; letter-spacing: .04em;
}
.log summary::-webkit-details-marker { display: none; }
.log summary::before { content: "▸"; color: var(--mark); font-family: var(--mono); transition: transform .15s; }
.log[open] summary::before { transform: rotate(90deg); }
.console {
margin-top: var(--space-3); max-height: 190px; overflow: auto; background: var(--sunk);
border: 1px solid var(--line-soft); border-radius: 6px; padding: var(--space-2) 10px;
font: var(--fs-xs)/1.75 var(--mono); color: var(--ink-2); white-space: pre-wrap; overflow-wrap: anywhere;
max-height: 190px; overflow: auto; padding: 10px 12px; border-top: 1px solid var(--rail-line);
color: #aeb7a6; font: 11.5px/1.75 var(--mono); white-space: pre-wrap; overflow-wrap: anywhere;
scrollbar-width: thin; scrollbar-color: #3d463b transparent;
}
.console::-webkit-scrollbar { width: 7px; }
.console::-webkit-scrollbar-thumb { background: #3d463b; border-radius: 99px; }
/* 总结 */
.headline {
font-size: var(--fs-xl); font-weight: 650; letter-spacing: -.01em;
font-variant-numeric: tabular-nums; margin-bottom: var(--space-3);
}
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 8px 0; vertical-align: top; border-bottom: 1px solid var(--line-soft); }
tr:last-child th, tr:last-child td { border-bottom: 0; }
th { width: 45%; padding-right: var(--space-3); color: var(--muted); font-weight: 500; font-size: var(--fs-sm); }
td { font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
td.mono { font: var(--fs-sm)/1.6 var(--mono); }
.files { display: grid; gap: var(--space-2); margin-top: var(--space-3); }
.out { border: 1px solid var(--line-soft); border-radius: 6px; background: var(--sunk); padding: 8px 10px; }
.out .line { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; }
.out .name { color: var(--ink); font-weight: 600; font-size: var(--fs-sm); flex: 1 1 auto; }
.out .path { display: block; margin-top: 2px; color: var(--muted); font: var(--fs-xs)/1.6 var(--mono); overflow-wrap: anywhere; }
.caption { color: var(--muted); font-size: var(--fs-xs); letter-spacing: .04em; margin: var(--space-4) 0 var(--space-1); }
/* 目录选择 */
margin: 12px 0 14px; padding-bottom: 14px; border-bottom: 1px dashed var(--rail-line);
color: var(--rail-ink); font-size: 18.5px; font-weight: 600; line-height: 1.5;
letter-spacing: .01em; font-variant-numeric: tabular-nums;
}
#summary { width: 100%; border-collapse: collapse; }
#summary th, #summary td {
padding: 7px 0; border-bottom: 1px dashed var(--rail-line);
text-align: left; vertical-align: top; font-size: 12.5px; line-height: 1.6;
}
#summary tr:last-child th, #summary tr:last-child td { border-bottom: 0; }
#summary th {
width: 40%; padding-right: 12px; color: var(--rail-muted);
font-size: 11.5px; font-weight: 500;
}
#summary td { color: #e9e4d6; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.caption {
margin: 18px 0 8px; color: var(--rail-muted);
font-size: 10.5px; font-weight: 600; letter-spacing: .16em;
}
.files { display: grid; gap: 8px; }
.out { padding: 10px 12px; background: #1a201a; border: 1px solid var(--rail-line); border-radius: 3px; }
.out .line { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.out .name { flex: 1 1 auto; color: var(--rail-ink); font-size: 12.5px; font-weight: 600; }
.out .path {
display: block; margin-top: 4px; color: #98a291;
font: 11px/1.6 var(--mono); overflow-wrap: anywhere;
}
/* 本机目录选择 */
dialog {
border: 1px solid var(--line); border-radius: 10px; padding: 0; width: min(760px, 92vw);
box-shadow: 0 18px 48px rgba(15, 20, 30, .18); background: var(--surface); color: var(--ink);
width: min(760px, 94vw); max-height: 88vh; padding: 0;
color: var(--ink); background: var(--paper-2);
border: 1px solid #2a2e28; border-radius: 4px;
box-shadow: 0 30px 80px rgba(15, 18, 15, .32);
}
dialog[open] { display: flex; flex-direction: column; }
dialog::backdrop { background: rgba(20, 24, 20, .42); backdrop-filter: blur(2px) saturate(.9); }
.dhead {
display: flex; align-items: flex-end; justify-content: space-between; gap: 12px;
padding: 15px 18px 12px; background: var(--paper-3); border-bottom: 1px solid var(--line);
}
.dhead .eyebrow { margin: 0 0 7px; }
.dhead h2 { font-size: 17px; }
.esc { color: var(--muted); font-size: 11px; letter-spacing: .06em; }
.dpath { display: flex; gap: 8px; padding: 12px 18px 0; }
.dpath input { flex: 1 1 auto; }
.pick-hint { margin: 8px 18px 0; color: var(--muted); font-size: 11.5px; }
.roots { display: flex; flex-wrap: wrap; gap: 6px; padding: 10px 18px 0; }
.roots button {
padding: 6px 10px; background: #fffdfa; border-color: var(--line-strong);
color: var(--ink-2); font-size: 12px; font-weight: 600;
}
.roots button:hover:not(:disabled) { background: var(--mark-soft); border-color: var(--mark); color: var(--bad); }
#pickNote { margin: 8px 18px 0; }
.dlist {
flex: 1; min-height: 0; max-height: 52vh; overflow: auto; margin-top: 8px;
padding: 8px 10px 12px; border-top: 1px solid var(--line-soft);
scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent;
}
dialog::backdrop { background: rgba(15, 20, 30, .35); }
.dhead { display: flex; gap: var(--space-2); align-items: center; padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--line); }
.dlist { max-height: 54vh; overflow: auto; padding: 6px 8px var(--space-3); }
.dlist button {
display: block; width: 100%; text-align: left; background: none; border: 0; color: var(--ink);
font-weight: 400; font-size: var(--fs-md); padding: 7px 10px; border-radius: 6px;
}
.dlist button:hover:not(:disabled) { background: var(--accent-soft); }
.dlist .dir::before { content: "▸ "; color: var(--accent); }
.dlist .file::before { content: " "; }
.size { float: right; color: var(--muted); font-size: var(--fs-xs); font-variant-numeric: tabular-nums; }
.roots { display: flex; gap: 6px; padding: 10px var(--space-4) 0; flex-wrap: wrap; }
.roots button { padding: 5px 11px; font-size: var(--fs-sm); background: #fff; color: var(--accent); border-color: var(--line); }
.roots button:hover:not(:disabled) { background: var(--accent-soft); border-color: var(--accent); color: #0f469e; }
.foot { padding: var(--space-3) var(--space-4); border-top: 1px solid var(--line); display: flex; gap: var(--space-2); justify-content: flex-end; }
display: flex; align-items: center; gap: 8px; width: 100%; padding: 7px 10px;
border: 0; border-radius: 2px; background: none; color: var(--ink); text-align: left;
font: 400 13px/1.5 var(--sans); font-weight: 400; white-space: nowrap; overflow: hidden;
}
.dlist button:hover:not(:disabled) { background: var(--mark-soft); color: var(--ink); }
.dlist .dir::before { content: "▸"; flex: none; color: var(--mark); font-family: var(--mono); }
.dlist .file::before { content: "·"; flex: none; color: var(--line-strong); font-family: var(--mono); }
.dlist .name { flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; }
.dlist .size { flex: none; color: var(--muted); font-size: 11.5px; font-variant-numeric: tabular-nums; }
.dlist .empty { padding: 18px 10px; color: var(--muted); font-size: 12.5px; }
.foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--line); background: var(--paper-3); }
.foot #closePick { margin-right: auto; }
@media (max-width: 720px) {
.wrap { padding: 20px 16px 40px; }
.masthead { grid-template-columns: minmax(0, 1fr); }
.mast-side { justify-items: start; text-align: left; }
.meta { justify-content: flex-start; }
h1 { font-size: 32px; }
.card { padding: 16px; }
}
@media (prefers-reduced-motion: reduce) {
*, *::before, *::after { animation: none !important; transition: none !important; }
}
</style>
</head>
<body>
<div class="wrap">
<header class="top">
<h1>坐标补齐</h1>
<div class="lede">
先读地址文本,读不出或读得可疑的那些行才用坐标问地图接口。
<span class="where">关掉这个窗口,或按终端里的 Ctrl+C 即停止。</span>
<div class="ruler" aria-hidden="true"></div>
<header class="masthead">
<div>
<p class="eyebrow">GCJ-02 · 高德坐标补全</p>
<h1>坐标补齐</h1>
<p class="lede">先读地址文本,读不出或读得可疑的那些行才用坐标问地图接口。</p>
</div>
<div class="mast-side">
<p class="meta"><span>CSV / EXCEL</span><span>GCJ-02</span><span>只写新文件</span></p>
<p class="where">关掉启动它的终端窗口,或按 Ctrl+C 即停止。</p>
</div>
</header>
<div class="layout">
<div class="col">
<section>
<h2><span class="num">01</span>源文件</h2>
<section class="card">
<div class="sec-head"><span class="num">01</span><h2>源文件</h2></div>
<p class="desc">第三方导出的那张表,CSV 或 Excel 都行。表里只要有经纬度;缺的三列会自动追加。</p>
<div class="field">
<label for="input">表格文件 <span class="hint">.csv / .xlsx / .xlsm / .xlsb / .xls</span></label>
<div class="control">
<input type="text" id="input" class="path" placeholder="完整路径,或点右边「浏览」">
<button class="ghost" id="pickInput">浏览</button>
<input type="text" id="input" class="path" placeholder="完整路径,或点右边「浏览」" spellcheck="false">
<button type="button" class="ghost" id="pickInput">浏览</button>
</div>
<div class="note" id="inputNote"></div>
</div>
<div class="note" id="inputNote"></div>
</section>
<section>
<h2><span class="num">02</span>输出</h2>
<section class="card">
<div class="sec-head"><span class="num">02</span><h2>输出</h2></div>
<p class="desc">永远写新文件,不碰源表。正式表格进源文件旁的 out/,处理日志与清单进源文件旁的 .temp/,工具目录不落运行产物。</p>
<div class="fields">
<div class="field">
<label for="outputDir">输出目录 <span class="hint">留空 = 源文件旁/out</span></label>
<div class="control">
<input type="text" id="outputDir" class="path" placeholder="留空即放在源文件旁的 out 文件夹">
<button class="ghost" id="pickDir">浏览</button>
<input type="text" id="outputDir" class="path" placeholder="留空即放在源文件旁的 out 文件夹" spellcheck="false">
<button type="button" class="ghost" id="pickDir">浏览</button>
</div>
</div>
<div class="field">
<label for="outputName">文件名 <span class="hint">留空 = 原名.已补全</span></label>
<input type="text" id="outputName" class="path" placeholder="留空自动生成">
<input type="text" id="outputName" class="path" placeholder="留空自动生成" spellcheck="false">
</div>
</div>
<div class="note" id="outputNote"></div>
</section>
<section>
<h2><span class="num">03</span>已查坐标缓存</h2>
<div class="group-label"><span>以下四段通常保持默认,需要时再改</span></div>
<section class="card">
<div class="sec-head"><span class="num">03</span><h2>已查坐标缓存</h2></div>
<p class="desc">问过的坐标记在这里,续跑要用同一个文件;拷走它,换电脑也不重复花钱。</p>
<div class="field">
<label for="cache">缓存文件 <span class="hint">留空 = 源文件旁/cache</span></label>
<div class="control">
<input type="text" id="cache" class="path" placeholder="留空即放在源文件旁的 cache 文件夹">
<button class="ghost" id="pickCache">浏览</button>
<input type="text" id="cache" class="path" placeholder="留空即放在源文件旁的 cache 文件夹" spellcheck="false">
<button type="button" class="ghost" id="pickCache">浏览</button>
</div>
<div class="note" id="cacheNote"></div>
</div>
<div class="note" id="cacheNote"></div>
</section>
<section>
<h2><span class="num">04</span>接口节奏</h2>
<section class="card">
<div class="sec-head"><span class="num">04</span><h2>接口节奏</h2></div>
<p class="desc">只有地址补不齐的行才会走到这里。并发越高越快,也越容易被限流。</p>
<div class="grid">
<div class="field">
......@@ -237,27 +458,30 @@
</div>
<div class="field">
<label for="limit">只处理前几行 <span class="hint">留空为全量</span></label>
<input type="number" id="limit" min="1" step="1" placeholder="留空">
<div class="control">
<input type="number" id="limit" class="short" min="1" step="1" placeholder="留空">
<button type="button" class="chip" id="trial20" title="把「只处理前几行」填成 20">填 20 行</button>
</div>
</div>
</div>
<div class="note">先用「只处理前几行」填 20 跑一遍,看取值对不对,再回来跑全量。</div>
</section>
<section>
<h2><span class="num">05</span>续跑清单 <span class="hint">可留空</span></h2>
<section class="card">
<div class="sec-head"><span class="num">05</span><h2>续跑清单 <span class="hint">可留空</span></h2></div>
<p class="desc">上一次运行生成的「限流待重试」清单。填了它,本次只有清单里的行允许问接口;表格与日志仍按整张表写,其余行照旧用表内原值、地址和缓存补齐。</p>
<div class="field">
<label for="onlyList">清单文件 <span class="hint">补齐工具写的 .csv,与生成它的那张输入表配对使用</span></label>
<div class="control">
<input type="text" id="onlyList" class="path" placeholder="留空 = 整张表都可以问接口">
<button class="ghost" id="pickList">浏览</button>
<input type="text" id="onlyList" class="path" placeholder="留空 = 整张表都可以问接口" spellcheck="false">
<button type="button" class="ghost" id="pickList">浏览</button>
</div>
<div class="note" id="listNote"></div>
</div>
<div class="note" id="listNote"></div>
</section>
<section>
<h2><span class="num">06</span>推断与排序</h2>
<section class="card">
<div class="sec-head"><span class="num">06</span><h2>推断与排序</h2></div>
<div class="switch">
<input type="checkbox" id="sortIncompleteLast">
<div>
......@@ -265,7 +489,7 @@
<p class="desc">完整记录在前,导入时先拿稳的,空白的留在末尾等人工补。</p>
</div>
</div>
<div class="switch" style="margin-top:var(--space-4)">
<div class="switch">
<input type="checkbox" id="inferNearby">
<div>
<label for="inferNearby">允许用附近已知地点的归属补空白</label>
......@@ -286,55 +510,75 @@
</section>
</div>
<div class="col side">
<section>
<h2><span class="num">07</span>高德 Key</h2>
<p class="desc">只有本次真有待查坐标时才用到。填一次、只用这一次,不写进配置、日志、缓存。</p>
<div class="control">
<input type="password" id="key" placeholder="需要问接口时再填" autocomplete="off">
<button class="ghost" id="sendKey" hidden>继续</button>
<div class="side">
<aside class="deck" id="deck" data-state="idle" aria-label="运行台">
<div class="deck-top">
<span class="deck-title">运行台</span>
<span class="status"><i aria-hidden="true"></i><span id="deckState">待命</span></span>
</div>
<div class="note" id="keyNote">整张表都能靠地址和缓存补齐时不会用到 Key。</div>
</section>
<section>
<h2>运行</h2>
<div class="actions">
<button id="start" class="big">开始补齐</button>
<button class="danger" id="stop" disabled>停止</button>
</div>
<div class="note bad" id="blocked"></div>
</section>
<section id="runSection" hidden>
<h2>正在做</h2>
<div class="stage" id="stage">准备中…</div>
<div class="bar" id="bar"><i></i></div>
<div class="console" id="console"></div>
</section>
<section id="doneSection" hidden>
<h2>本次结果</h2>
<div class="headline" id="headline"></div>
<table id="summary"></table>
<div class="note warn" id="caution"></div>
<div class="caption">点开看看</div>
<div class="files" id="files"></div>
</section>
<section class="deck-sec">
<div class="sec-head"><span class="num">07</span><h2>高德 Key</h2></div>
<p class="desc">只有本次真有待查坐标时才用到。填一次、只用这一次,不写进配置、日志、缓存。</p>
<div class="control">
<input type="password" id="key" placeholder="需要问接口时再填" autocomplete="off" spellcheck="false">
<button type="button" class="quiet" id="keyEye">显示</button>
<button type="button" class="ghost" id="sendKey" hidden>继续</button>
</div>
<div class="note" id="keyNote">整张表都能靠地址和缓存补齐时不会用到 Key。</div>
</section>
<section class="deck-sec">
<h2>运行</h2>
<div class="actions">
<button id="start" class="big">开始补齐</button>
<button class="stop" id="stop" disabled>停止</button>
</div>
<div class="note bad" id="blocked" aria-live="polite"></div>
</section>
<section class="deck-sec" id="runSection" hidden>
<h2>正在做</h2>
<div class="stage" id="stage" role="status" aria-live="polite">准备中…</div>
<div class="bar" id="bar"><i></i></div>
<details class="log" id="logBox" open>
<summary>运行日志</summary>
<div class="console" id="console"></div>
</details>
</section>
<section class="deck-sec" id="doneSection" hidden>
<h2>本次结果</h2>
<div class="headline" id="headline"></div>
<table id="summary"></table>
<div class="note warn" id="caution"></div>
<div class="caption">产物文件</div>
<div class="files" id="files"></div>
</section>
</aside>
</div>
</div>
</div>
<dialog id="picker">
<dialog id="picker" aria-labelledby="pickTitle">
<div class="dhead">
<input type="text" id="browsePath" class="path" style="flex:1">
<button class="ghost" id="browseGo">前往</button>
<div>
<p class="eyebrow">本机目录</p>
<h2 id="pickTitle">选择文件</h2>
</div>
<span class="esc">Esc 关闭</span>
</div>
<div class="dpath">
<input type="text" id="browsePath" class="path" spellcheck="false">
<button type="button" class="ghost" id="browseGo">前往</button>
</div>
<p class="pick-hint" id="pickHint"></p>
<div class="roots" id="roots"></div>
<div class="note" id="pickNote"></div>
<div class="dlist" id="dlist"></div>
<div class="foot">
<button class="ghost" id="useDir">选这个目录</button>
<button class="ghost" id="closePick">取消</button>
<button type="button" class="ghost" id="closePick">取消</button>
<button type="button" id="useDir">选这个目录</button>
</div>
</dialog>
......@@ -405,9 +649,21 @@ function setField(name, value) {
else el.value = value === null || value === undefined ? '' : String(value);
}
function setDeck(state, label) {
$('deck').dataset.state = state;
$('deckState').textContent = label;
}
// 浏览目录:浏览器给不出本机绝对路径,所以列目录由本机做
let pickTarget = 'input';
const join = (dir, name) => `${dir}${dir.includes('\\') ? '\\' : '/'}${name}`;
const pickTitles = { input: '选择表格文件', outputDir: '选择输出目录', cache: '选择缓存文件', onlyList: '选择续跑清单' };
const pickHints = {
input: '点文件名直接选中;这里只列出能读的表格格式。',
outputDir: '点进目标文件夹,再点右下角「选这个目录」。',
cache: '点进目标文件夹,再点右下角按钮;文件名保持不变。',
onlyList: '点文件名直接选中;这里只列出 .csv。',
};
async function show(dir) {
const kind = pickTarget === 'cache' ? 'cache' : pickTarget === 'onlyList' ? 'list' : '';
......@@ -417,6 +673,7 @@ async function show(dir) {
list.textContent = '';
if (value.parent) {
const up = document.createElement('button');
up.type = 'button';
up.className = 'dir';
up.textContent = '.. 上一级';
up.onclick = () => show(value.parent);
......@@ -424,8 +681,12 @@ async function show(dir) {
}
for (const entry of value.entries) {
const item = document.createElement('button');
item.type = 'button';
item.className = entry.directory ? 'dir' : 'file';
item.textContent = entry.name;
const name = document.createElement('span');
name.className = 'name';
name.textContent = entry.name;
item.append(name);
if (!entry.directory) {
const size = document.createElement('span');
size.className = 'size';
......@@ -438,7 +699,14 @@ async function show(dir) {
};
list.append(item);
}
if (value.note) $('browsePath').title = value.note;
if (value.entries.length === 0) {
const empty = document.createElement('div');
empty.className = 'empty';
empty.textContent = '这个目录里没有可选项。';
list.append(empty);
}
$('pickNote').textContent = value.note || '';
$('browsePath').title = value.note || '';
$('useDir').onclick = () => {
if (pickTarget === 'cache') {
const current = $('cache').value.split(/[\\/]/).pop() || 'amap_regeo_cache.sqlite3';
......@@ -453,8 +721,12 @@ async function show(dir) {
function openPicker(target, start) {
pickTarget = target;
$('pickTitle').textContent = pickTitles[target] || '选择位置';
$('pickHint').textContent = pickHints[target] || '';
// 源文件与清单都是文件:选目录对它们没有意义
$('useDir').hidden = target === 'input' || target === 'onlyList';
$('useDir').textContent = target === 'cache' ? '用这个目录存缓存' : '选这个目录';
$('pickNote').textContent = '';
$('picker').showModal();
show(start || '').catch((error) => { $('dlist').textContent = error.message; });
}
......@@ -467,8 +739,12 @@ function renderSummary(summary) {
table.textContent = '';
for (const line of summary.rows) {
const row = table.insertRow();
row.insertCell().textContent = line.label;
row.insertCell().textContent = line.value;
const label = document.createElement('th');
label.scope = 'row';
label.textContent = line.label;
const value = document.createElement('td');
value.textContent = line.value;
row.append(label, value);
}
$('caution').textContent = summary.caution;
$('caution').className = summary.caution ? 'note warn' : 'note';
......@@ -485,6 +761,7 @@ function renderSummary(summary) {
name.className = 'name';
name.textContent = file.label;
const open = document.createElement('button');
open.type = 'button';
open.className = 'quiet';
open.textContent = '打开';
open.onclick = () => api('open', { path: file.value }).catch(() => undefined);
......@@ -492,6 +769,7 @@ function renderSummary(summary) {
// 限流那份是唯一值得再跑一次的清单:把「填回去」做成一次点击
if (file.label === '限流待重试') {
const again = document.createElement('button');
again.type = 'button';
again.className = 'quiet';
again.textContent = '用它续跑';
again.onclick = () => {
......@@ -514,6 +792,7 @@ source.onmessage = (event) => {
const data = JSON.parse(event.data);
if (data.type === 'stage') {
$('runSection').hidden = false;
$('stage').className = 'stage';
$('stage').textContent = data.text || ('正在' + data.label);
const bar = $('bar');
if (data.total && data.done !== undefined) {
......@@ -523,6 +802,7 @@ source.onmessage = (event) => {
bar.className = 'bar busy';
bar.firstElementChild.style.width = '32%';
}
setDeck('running', '运行中');
} else if (data.type === 'log') {
append(data.message);
} else if (data.type === 'key-needed') {
......@@ -530,19 +810,27 @@ source.onmessage = (event) => {
$('keyNote').textContent = '这次运行要问地图接口,请在上面填 Key 后点「继续」。';
$('keyNote').className = 'note warn';
$('key').focus();
$('logBox').open = true;
append('等待高德 Key…');
setDeck('running', '等待 Key');
} else if (data.type === 'done') {
$('stage').className = 'stage ok';
$('stage').textContent = '已完成';
$('bar').className = 'bar';
$('bar').firstElementChild.style.width = '100%';
$('logBox').open = false;
renderSummary(data.summary);
setDeck('done', '已完成');
// 跑完缓存文件长了(或中途停下来也写了一批),提示语要跟着新大小
check();
} else if (data.type === 'error') {
$('stage').className = 'stage bad';
$('stage').textContent = '停下来:' + data.message;
const hint = data.detail ? `(内部提示:${data.detail.split('\n')[0]};完整提示在启动界面的那个终端窗口里)` : '';
$('logBox').open = true;
append('失败:' + data.message + hint);
$('bar').className = 'bar';
setDeck('error', '已停止');
check();
} else if (data.type === 'running') {
running(data.running);
......@@ -561,19 +849,27 @@ function running(on) {
$('stop').disabled = !on;
for (const name of fields) $(name).disabled = on;
$('key').disabled = false;
if (on) setDeck('running', '运行中');
else if ($('deck').dataset.state === 'running') setDeck('idle', '待命');
}
$('start').onclick = async () => {
$('runSection').hidden = false;
$('doneSection').hidden = true;
$('console').textContent = '';
$('logBox').open = true;
$('stage').className = 'stage';
$('stage').textContent = '正在开始…';
$('bar').className = 'bar busy';
$('bar').firstElementChild.style.width = '32%';
setDeck('running', '启动中');
try {
await api('start', { ...form(), key: $('key').value.trim() });
running(true);
} catch (error) {
$('stage').className = 'stage bad';
$('stage').textContent = error.message;
setDeck('idle', '待命');
}
};
$('stop').onclick = () => api('stop', {}).catch(() => undefined);
......@@ -582,6 +878,19 @@ $('sendKey').onclick = async () => {
$('sendKey').hidden = true;
$('keyNote').textContent = '已收到,继续跑。';
$('keyNote').className = 'note';
setDeck('running', '运行中');
};
$('keyEye').onclick = () => {
const key = $('key');
const shown = key.type === 'text';
key.type = shown ? 'password' : 'text';
$('keyEye').textContent = shown ? '显示' : '隐藏';
key.focus();
};
$('trial20').onclick = () => {
$('limit').value = '20';
$('limit').focus();
check();
};
for (const name of fields) $(name).addEventListener('input', () => {
if (name === 'inferNearby') $('radii').classList.toggle('fade', !$(name).checked);
......@@ -592,6 +901,11 @@ $('pickCache').onclick = () => openPicker('cache', $('cache').value);
$('pickDir').onclick = () => openPicker('outputDir', $('outputDir').value);
$('pickList').onclick = () => openPicker('onlyList', $('onlyList').value);
$('browseGo').onclick = () => show($('browsePath').value);
$('browsePath').addEventListener('keydown', (event) => {
if (event.key !== 'Enter') return;
event.preventDefault();
show($('browsePath').value);
});
$('closePick').onclick = () => $('picker').close();
const boot = await api('boot', {});
......@@ -601,11 +915,17 @@ setCacheNote(boot.cacheSize);
const roots = $('roots');
for (const spot of boot.quickRoots) {
const button = document.createElement('button');
button.type = 'button';
button.textContent = spot.name;
button.onclick = () => show(spot.path);
roots.append(button);
}
running(boot.running);
if (boot.running) {
$('runSection').hidden = false;
$('stage').textContent = '运行中…';
$('bar').className = 'bar busy';
}
if (boot.savedExists && boot.state.input) append('已载入上次的路径与参数。');
check();
</script>
......
......@@ -4,6 +4,7 @@ import { App as AntdApp, Button, Form, Input } from 'antd';
import { LockOutlined, UserOutlined } from '@ant-design/icons';
import { BrandMark } from '@hm/ui';
import { useAuthStore } from '@/store/useAuthStore';
import '@/theme/design.css';
import './login.css';
interface LoginForm {
......@@ -11,6 +12,13 @@ interface LoginForm {
password: string;
}
/**
* 登录页:一张夜色底图 + 一台「落点仪器」。
*
* 左侧不是装饰画:经纬网、等值线、散点都是地图语言;一条从地址标签出发的虚线
* 落到一个带坐标的点位上,把「地址 → 坐标 → 点位」这件事本身讲清楚。
* 右侧登录卡沿用全站的毛玻璃语言,只是换成深色底图上的浅色玻璃。
*/
export function LoginPage() {
const navigate = useNavigate();
const { message } = AntdApp.useApp();
......@@ -31,40 +39,290 @@ export function LoginPage() {
return (
<div className="hm-login">
<div className="hm-login__card">
<BrandMark />
<h1 className="hm-login__title">智能网联监管平台</h1>
<p className="hm-login__sub">风险热力图 · 请先登录</p>
<Form<LoginForm> layout="vertical" onFinish={onFinish} disabled={submitting}>
<Form.Item
name="username"
label="用户名"
rules={[{ required: true, message: '请输入用户名' }]}
<div className="hm-login__scene" aria-hidden="true">
<svg
className="hm-login__chart"
viewBox="0 0 1600 900"
preserveAspectRatio="xMidYMid slice"
focusable="false"
>
<defs>
<radialGradient id="hmLoginHeatHot">
<stop offset="0%" stopColor="#ff2a2a" stopOpacity="0.5" />
<stop offset="42%" stopColor="#ff7600" stopOpacity="0.26" />
<stop offset="100%" stopColor="#ff7600" stopOpacity="0" />
</radialGradient>
<radialGradient id="hmLoginHeatWarm">
<stop offset="0%" stopColor="#ffce00" stopOpacity="0.34" />
<stop offset="55%" stopColor="#7ade3c" stopOpacity="0.14" />
<stop offset="100%" stopColor="#7ade3c" stopOpacity="0" />
</radialGradient>
<radialGradient id="hmLoginHeatCool">
<stop offset="0%" stopColor="#18a8ff" stopOpacity="0.3" />
<stop offset="100%" stopColor="#18a8ff" stopOpacity="0" />
</radialGradient>
<filter id="hmLoginBlur" x="-60%" y="-60%" width="220%" height="220%">
<feGaussianBlur stdDeviation="34" />
</filter>
<pattern id="hmLoginGrid" width="100" height="100" patternUnits="userSpaceOnUse">
<path
d="M100 0H0V100"
fill="none"
stroke="#bcd0ff"
strokeOpacity="0.07"
strokeWidth="1"
/>
</pattern>
<pattern id="hmLoginGridMajor" width="400" height="400" patternUnits="userSpaceOnUse">
<path
d="M400 0H0V400"
fill="none"
stroke="#bcd0ff"
strokeOpacity="0.12"
strokeWidth="1"
/>
</pattern>
</defs>
<rect width="1600" height="900" fill="url(#hmLoginGrid)" />
<rect width="1600" height="900" fill="url(#hmLoginGridMajor)" />
{/* 行政区界与海岸线(示意) */}
<g
fill="none"
stroke="#9fb6ff"
strokeOpacity="0.22"
strokeWidth="1.1"
strokeLinecap="round"
>
<Input
prefix={<UserOutlined />}
placeholder="用户名"
autoComplete="username"
<path d="M-20 206C154 178 246 268 398 246C536 226 588 152 754 166C922 180 968 268 1132 262C1290 256 1402 202 1620 236" />
<path d="M-20 314C120 300 208 356 344 342C474 328 544 250 700 262" />
<path d="M-20 864C140 826 254 786 388 828C520 870 604 786 764 796C902 804 986 866 1104 842C1246 814 1390 758 1620 802" />
</g>
{/* 热力底色 */}
<g filter="url(#hmLoginBlur)" className="hm-login__heat">
<ellipse cx="900" cy="430" rx="250" ry="190" fill="url(#hmLoginHeatHot)" />
<ellipse cx="1190" cy="760" rx="300" ry="210" fill="url(#hmLoginHeatWarm)" />
<ellipse cx="322" cy="184" rx="260" ry="190" fill="url(#hmLoginHeatCool)" />
<ellipse cx="690" cy="600" rx="200" ry="160" fill="url(#hmLoginHeatWarm)" opacity="0.55" />
</g>
{/* 等值线 */}
<g fill="none" strokeLinecap="round">
<path
d="M900 314C996 314 1076 366 1076 430C1076 494 996 546 900 546C804 546 724 494 724 430C724 366 804 314 900 314Z"
stroke="#ffce00"
strokeOpacity="0.34"
strokeWidth="1.2"
/>
</Form.Item>
<Form.Item
name="password"
label="密码"
rules={[{ required: true, message: '请输入密码' }]}
>
<Input.Password
prefix={<LockOutlined />}
placeholder="密码"
autoComplete="current-password"
<path
d="M900 268C1028 268 1130 340 1130 430C1130 520 1028 592 900 592C772 592 670 520 670 430C670 340 772 268 900 268Z"
stroke="#ffce00"
strokeOpacity="0.18"
strokeWidth="1"
strokeDasharray="5 7"
/>
<path
d="M900 222C1060 222 1184 314 1184 430C1184 546 1060 638 900 638C740 638 616 546 616 430C616 314 740 222 900 222Z"
stroke="#ff7600"
strokeOpacity="0.12"
strokeWidth="1"
strokeDasharray="2 9"
/>
</g>
{/* 散落点位 */}
<g fill="#e8eeff">
<circle cx="852" cy="404" r="2.2" opacity="0.6" />
<circle cx="938" cy="458" r="1.8" opacity="0.5" />
<circle cx="886" cy="486" r="2.6" opacity="0.7" />
<circle cx="830" cy="450" r="1.6" opacity="0.4" />
<circle cx="962" cy="402" r="2" opacity="0.55" />
<circle cx="1002" cy="492" r="1.7" opacity="0.42" />
<circle cx="762" cy="482" r="1.5" opacity="0.34" />
<circle cx="1150" cy="716" r="2.4" opacity="0.5" />
<circle cx="1226" cy="782" r="2" opacity="0.44" />
<circle cx="1118" cy="812" r="1.8" opacity="0.38" />
<circle cx="1288" cy="734" r="1.6" opacity="0.34" />
<circle cx="1064" cy="742" r="1.5" opacity="0.3" />
<circle cx="406" cy="238" r="1.8" opacity="0.32" />
<circle cx="498" cy="284" r="1.5" opacity="0.26" />
<circle cx="1348" cy="332" r="1.7" opacity="0.3" />
<circle cx="764" cy="230" r="1.5" opacity="0.28" />
</g>
{/* 地址 → 坐标 → 落点 */}
<g className="hm-login__map-note">
<rect
x="470"
y="290"
width="238"
height="40"
rx="9"
fill="rgba(12,18,44,0.6)"
stroke="rgba(214,226,255,0.26)"
/>
<circle cx="492" cy="310" r="3.2" fill="#fcc929" />
<text x="508" y="315" fill="rgba(238,242,255,0.9)">
南山区 · 粤海街道
</text>
<path
className="hm-login__route"
d="M714 310C774 310 812 428 884 430"
fill="none"
stroke="#fcc929"
strokeOpacity="0.55"
strokeWidth="1.3"
strokeDasharray="3 7"
/>
</Form.Item>
<Form.Item>
<Button type="primary" htmlType="submit" block loading={submitting}>
登录
</Button>
</Form.Item>
</Form>
<text x="932" y="404" fill="rgba(214,226,255,0.62)">
113.94°E
</text>
<text x="932" y="422" fill="rgba(214,226,255,0.42)">
22.54°N
</text>
</g>
{/* 落点脉冲与十字标 */}
<g className="hm-login__pin">
<circle className="hm-login__pin-ring" cx="900" cy="430" r="16" />
<circle
className="hm-login__pin-ring hm-login__pin-ring--late"
cx="900"
cy="430"
r="16"
/>
<g stroke="#ffce00" strokeOpacity="0.7" strokeWidth="1">
<line x1="856" y1="430" x2="874" y2="430" />
<line x1="926" y1="430" x2="944" y2="430" />
<line x1="900" y1="386" x2="900" y2="404" />
<line x1="900" y1="456" x2="900" y2="474" />
</g>
<circle cx="900" cy="430" r="6" fill="#ffce00" />
<circle cx="900" cy="430" r="2" fill="#151b3c" />
</g>
</svg>
<div className="hm-login__grain" />
<div className="hm-login__vignette" />
</div>
<header className="hm-login__top">
<BrandMark size={38} />
<div className="hm-login__geo">
<span className="hm-login__geo-rule" />
<span className="hm-login__geo-coord">22°32′N · 114°03′E</span>
<span className="hm-login__geo-place">深圳市</span>
</div>
</header>
<main className="hm-login__main">
<section className="hm-login__intro">
<p className="hm-login__eyebrow">
<span className="hm-login__cross" />
深圳市智能网联汽车监管
</p>
<h1 className="hm-login__display">
风险热力图
<span className="hm-login__display-dot" />
</h1>
<p className="hm-login__lede">每一起出险,都落回它发生的那条街。</p>
<div className="hm-login__trace" aria-hidden="true">
<span className="hm-login__trace-node">地址</span>
<span className="hm-login__trace-line">
<i />
</span>
<span className="hm-login__trace-node">坐标</span>
<span className="hm-login__trace-line">
<i style={{ animationDelay: '1.8s' }} />
</span>
<span className="hm-login__trace-node hm-login__trace-node--pin">点位</span>
</div>
<div className="hm-login__legend" aria-hidden="true">
<div className="hm-login__legend-head">
<span>出险密度</span>
<span>低 / 高</span>
</div>
<div className="hm-login__legend-ramp" />
</div>
</section>
</main>
<aside className="hm-login__panel">
<span className="hm-login__spine" aria-hidden="true">
113.94°E · 22.54°N
</span>
<div className="hm-login__card">
<div className="hm-login__card-head">
<p className="hm-login__card-kicker">Access 01</p>
<span className="hm-login__card-mark" aria-hidden="true" />
</div>
<h2 className="hm-login__card-title">进入监管平台</h2>
<p className="hm-login__card-sub">使用管理员分配的账号与密码</p>
<Form<LoginForm>
className="hm-login__form"
layout="vertical"
requiredMark={false}
onFinish={onFinish}
disabled={submitting}
>
<Form.Item
name="username"
label={
<span className="hm-login__label">
<span className="hm-login__label-no" aria-hidden="true">
01
</span>
用户名
</span>
}
rules={[{ required: true, message: '请输入用户名' }]}
>
<Input
prefix={<UserOutlined />}
placeholder="请输入用户名"
autoComplete="username"
autoFocus
/>
</Form.Item>
<Form.Item
name="password"
label={
<span className="hm-login__label">
<span className="hm-login__label-no" aria-hidden="true">
02
</span>
密码
</span>
}
rules={[{ required: true, message: '请输入密码' }]}
>
<Input.Password
prefix={<LockOutlined />}
placeholder="请输入密码"
autoComplete="current-password"
/>
</Form.Item>
<Form.Item className="hm-login__submit-item">
<Button type="primary" htmlType="submit" block loading={submitting}>
<span>登录</span>
<span className="hm-login__submit-arrow" aria-hidden="true">
→
</span>
</Button>
</Form.Item>
</Form>
<div className="hm-login__card-rule" />
<div className="hm-login__card-serial">
<span>SZ · Supervision</span>
<span>22°32′N 114°03′E</span>
</div>
</div>
</aside>
</div>
);
}
/**
* 登录页:夜色地图 + 落点仪器。
*
* 构图是三段斜向关系:品牌在左上,标题压在左下,登录卡停在右侧;
* 底图里一条地址虚线把一个地址标签接到地图上的坐标点位,正好穿过标题与卡片之间。
* 卡片沿用全站毛玻璃语言,只是翻到深色底图上:浅色玻璃、同一套靛蓝与金色。
*/
.hm-login {
--hm-login-ink: #f4f6ff;
--hm-login-ink-2: rgba(226, 232, 255, 0.72);
--hm-login-ink-3: rgba(203, 214, 245, 0.44);
--hm-login-line: rgba(200, 214, 255, 0.16);
/* 两副「仪器」字面:等宽读数字,衬线读标题。只在本页出现,所以留在本页。 */
--hm-login-mono:
'IBM Plex Mono', 'JetBrains Mono', 'SFMono-Regular', Consolas, 'Liberation Mono', monospace;
--hm-login-serif: 'Songti SC', 'Source Han Serif SC', 'Noto Serif CJK SC', STSong, SimSun, serif;
/* 输入框底色,以及「浏览器自动回填」用来兜底的那层内阴影。
两个值是一对:回填色是按这块玻璃叠出来的,改底色的同时必须改它,否则回填又浮出一块。 */
--hm-login-field-fill: rgba(255, 255, 255, 0.52);
--hm-login-autofill-fill: rgba(255, 255, 255, 0.26);
position: fixed;
inset: 0;
display: grid;
grid-template-columns: minmax(0, 1.5fr) minmax(400px, 0.85fr);
grid-template-rows: auto minmax(0, 1fr);
column-gap: clamp(32px, 4vw, 72px);
padding: clamp(28px, 4vh, 46px) clamp(28px, 5vw, 84px) clamp(28px, 4.4vh, 56px);
overflow: hidden;
color: var(--hm-login-ink);
background:
radial-gradient(1100px 680px at 70% 80%, rgba(255, 94, 32, 0.16), transparent 62%),
radial-gradient(900px 620px at 86% 8%, rgba(40, 167, 225, 0.16), transparent 60%),
radial-gradient(760px 520px at 8% 16%, rgba(92, 111, 180, 0.2), transparent 64%),
linear-gradient(158deg, #0d1330 0%, #17204a 46%, #10162f 100%);
isolation: isolate;
}
.hm-login ::selection {
background: rgba(252, 201, 41, 0.3);
}
/* ------------------------------- 底图 ------------------------------- */
.hm-login__scene {
position: absolute;
inset: 0;
z-index: 0;
pointer-events: none;
}
.hm-login__chart {
display: block;
width: 100%;
height: 100%;
animation: hm-login-scene-in 1.6s ease-out both;
}
.hm-login__chart text {
font-family: var(--hm-login-mono);
font-size: 13px;
letter-spacing: 1.6px;
}
.hm-login__heat {
animation: hm-login-breathe 16s ease-in-out infinite alternate;
}
.hm-login__route {
animation: hm-login-dash 2.8s linear infinite;
}
.hm-login__pin-ring {
fill: none;
stroke: #fcc929;
stroke-width: 1.2;
opacity: 0.6;
transform-box: fill-box;
transform-origin: center;
animation: hm-login-pulse 3.8s cubic-bezier(0.2, 0.6, 0.3, 1) infinite;
}
.hm-login__pin-ring--late {
animation-delay: 1.9s;
}
.hm-login__grain {
position: absolute;
inset: 0;
opacity: 0.05;
mix-blend-mode: overlay;
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)' opacity='.55'/%3E%3C/svg%3E");
}
.hm-login__vignette {
position: absolute;
inset: 0;
background:
radial-gradient(ellipse at 52% 44%, transparent 38%, rgba(5, 8, 22, 0.5) 100%),
linear-gradient(
180deg,
rgba(5, 8, 22, 0.28) 0%,
transparent 24%,
transparent 82%,
rgba(5, 8, 22, 0.36) 100%
);
}
/* ------------------------------- 顶栏 ------------------------------- */
.hm-login__top {
position: relative;
z-index: 3;
grid-column: 1 / -1;
grid-row: 1;
display: flex;
align-items: center;
justify-content: center;
background: linear-gradient(135deg, #4653a2 0%, #2b3170 100%);
justify-content: space-between;
gap: 24px;
min-width: 0;
animation: hm-login-rise 0.8s 0.06s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.hm-login .hm-brand__title {
color: var(--hm-login-ink);
letter-spacing: 2px;
}
.hm-login .hm-brand__subtitle {
color: var(--hm-login-ink-3);
letter-spacing: 1.9px;
}
.hm-login .hm-brand__mark {
filter: drop-shadow(0 6px 18px rgba(10, 16, 44, 0.55));
}
.hm-login__geo {
display: flex;
align-items: center;
gap: 12px;
font-family: var(--hm-login-mono);
font-size: 9.5px;
letter-spacing: 0.2em;
color: var(--hm-login-ink-3);
text-transform: uppercase;
white-space: nowrap;
}
.hm-login__geo-rule {
width: clamp(28px, 4vw, 64px);
height: 1px;
background: linear-gradient(90deg, transparent, rgba(203, 214, 245, 0.4));
}
.hm-login__geo-coord {
color: var(--hm-login-ink-2);
}
.hm-login__geo-place {
padding-left: 12px;
border-left: 1px solid var(--hm-login-line);
color: var(--hm-login-ink-3);
}
/* ------------------------------- 左侧主文案 ------------------------------- */
.hm-login__main {
position: relative;
z-index: 3;
grid-column: 1;
grid-row: 2;
display: flex;
flex-direction: column;
justify-content: flex-end;
min-width: 0;
padding-bottom: 6px;
}
.hm-login__eyebrow {
display: flex;
align-items: center;
gap: 11px;
margin: 0 0 clamp(16px, 2.4vh, 26px);
font-size: clamp(11px, 0.85vw, 12.5px);
letter-spacing: 0.32em;
color: var(--hm-login-ink-2);
animation: hm-login-rise 0.9s 0.16s cubic-bezier(0.22, 1, 0.36, 1) both;
}
/* 小十字标:判读点位的符号,也是整页唯一会用到的「准星」 */
.hm-login__cross {
position: relative;
flex: 0 0 auto;
width: 13px;
height: 13px;
}
.hm-login__cross::before,
.hm-login__cross::after {
content: '';
position: absolute;
background: #fcc929;
opacity: 0.85;
}
.hm-login__cross::before {
top: 6px;
left: 0;
width: 13px;
height: 1px;
}
.hm-login__cross::after {
top: 0;
left: 6px;
width: 1px;
height: 13px;
}
.hm-login__display {
position: relative;
margin: 0;
font-family: var(--hm-login-serif);
font-size: clamp(52px, 6.4vw, 104px);
font-weight: 600;
font-synthesis: none;
line-height: 1.04;
letter-spacing: 0.07em;
color: #fbfcff;
text-shadow: 0 22px 70px rgba(5, 9, 26, 0.55);
animation: hm-login-rise 1s 0.24s cubic-bezier(0.22, 1, 0.36, 1) both;
}
/* 标题末尾的方点:地图上「这里有一个点」的最小记号 */
.hm-login__display-dot {
display: inline-block;
width: 0.13em;
height: 0.13em;
margin-left: 0.14em;
vertical-align: baseline;
background: #fcc929;
box-shadow: 0 0 26px rgba(252, 201, 41, 0.85);
}
.hm-login__lede {
margin: clamp(16px, 2.2vh, 24px) 0 0;
max-width: 34em;
font-size: clamp(13.5px, 1.1vw, 16px);
line-height: 1.85;
letter-spacing: 0.08em;
color: var(--hm-login-ink-2);
animation: hm-login-rise 0.9s 0.34s cubic-bezier(0.22, 1, 0.36, 1) both;
}
/* 地址 → 坐标 → 点位:这一页的主题动线,用三段小票 + 流动的金点画出来 */
.hm-login__trace {
display: flex;
align-items: center;
margin-top: clamp(22px, 3.4vh, 34px);
font-family: var(--hm-login-mono);
font-size: 10.5px;
letter-spacing: 0.24em;
color: var(--hm-login-ink-3);
animation: hm-login-rise 0.9s 0.42s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.hm-login__trace-node {
flex: 0 0 auto;
padding: 5px 11px;
border: 1px solid var(--hm-login-line);
border-radius: 999px;
background: rgba(255, 255, 255, 0.035);
}
.hm-login__trace-node--pin {
color: #ffe08a;
border-color: rgba(252, 201, 41, 0.34);
background: rgba(252, 201, 41, 0.08);
}
.hm-login__trace-line {
position: relative;
width: clamp(36px, 4.6vw, 68px);
height: 1px;
background: linear-gradient(
90deg,
transparent,
rgba(200, 214, 255, 0.36) 22%,
rgba(200, 214, 255, 0.36) 78%,
transparent
);
}
.hm-login__trace-line i {
position: absolute;
top: -2px;
left: 0;
width: 5px;
height: 5px;
border-radius: 50%;
background: #fcc929;
box-shadow: 0 0 12px rgba(252, 201, 41, 0.9);
animation: hm-login-travel 3.6s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}
.hm-login__legend {
width: min(300px, 72%);
margin-top: clamp(24px, 5vh, 56px);
animation: hm-login-rise 0.9s 0.5s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.hm-login__legend-head {
display: flex;
align-items: baseline;
justify-content: space-between;
gap: 12px;
margin-bottom: 8px;
font-family: var(--hm-login-mono);
font-size: 9.5px;
letter-spacing: 0.2em;
color: var(--hm-login-ink-3);
}
.hm-login__legend-ramp {
height: 6px;
border-radius: 3px;
background: linear-gradient(
90deg,
#2b4ac7 0%,
#18a8ff 20%,
#00e0ce 38%,
#7ade3c 52%,
#ffce00 66%,
#ff7600 80%,
#ff2a2a 90%,
#e2004a 100%
);
box-shadow: 0 0 28px -6px rgba(255, 118, 0, 0.6);
}
/* ------------------------------- 登录卡 ------------------------------- */
.hm-login__panel {
position: relative;
z-index: 4;
grid-column: 2;
grid-row: 2;
display: flex;
align-items: center;
justify-content: flex-end;
min-width: 0;
}
/* 卡片左侧的竖排坐标:仪器边上的刻度条,只做方位提示,不参与阅读顺序 */
.hm-login__spine {
position: absolute;
top: 50%;
right: calc(min(392px, 100%) + 22px);
transform: translateY(-50%);
writing-mode: vertical-rl;
font-family: var(--hm-login-mono);
font-size: 9px;
letter-spacing: 0.34em;
color: rgba(203, 214, 245, 0.34);
pointer-events: none;
white-space: nowrap;
}
.hm-login__card {
width: 360px;
padding: 32px 28px;
background: #fff;
border-radius: 12px;
box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
text-align: center;
position: relative;
width: min(392px, 100%);
padding: 28px 30px 22px;
border: 1px solid rgba(255, 255, 255, 0.62);
border-radius: 16px;
color: var(--hm-text-1);
background: linear-gradient(165deg, rgba(253, 254, 255, 0.88) 0%, rgba(242, 246, 255, 0.74) 100%);
box-shadow:
0 44px 96px -32px rgba(4, 8, 24, 0.9),
0 2px 0 rgba(255, 255, 255, 0.55) inset,
0 -1px 0 rgba(70, 83, 162, 0.08) inset;
backdrop-filter: blur(26px) saturate(160%);
-webkit-backdrop-filter: blur(26px) saturate(160%);
animation: hm-login-card-in 0.95s 0.3s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.hm-login__title {
margin: 16px 0 4px;
font-size: 18px;
color: #1f1f1f;
/* 卡片顶缘那截渐变线:把「接入」这件事标出来,又不把整张卡框死 */
.hm-login__card::before {
content: '';
position: absolute;
top: 0;
left: 30px;
width: 68px;
height: 2px;
border-radius: 0 0 2px 2px;
background: linear-gradient(90deg, var(--hm-primary) 0%, var(--hm-accent-cyan) 100%);
}
.hm-login__sub {
margin: 0 0 20px;
color: rgba(0, 0, 0, 0.45);
font-size: 13px;
.hm-login__card-head {
display: flex;
align-items: flex-start;
justify-content: space-between;
gap: 16px;
}
.hm-login__card-kicker {
margin: 0;
font-family: var(--hm-login-mono);
font-size: 9.5px;
font-weight: 600;
letter-spacing: 0.3em;
text-transform: uppercase;
color: var(--hm-text-3);
}
/* 卡片右上角的十字标:和左侧标题前的准星同源,尺寸压到最小 */
.hm-login__card-mark {
position: relative;
flex: 0 0 auto;
width: 15px;
height: 15px;
opacity: 0.5;
}
.hm-login__card-mark::before,
.hm-login__card-mark::after {
content: '';
position: absolute;
background: var(--hm-primary);
}
.hm-login__card-mark::before {
top: 7px;
left: 0;
width: 15px;
height: 1px;
}
.hm-login__card-mark::after {
top: 0;
left: 7px;
width: 1px;
height: 15px;
}
.hm-login__card-title {
margin: 10px 0 4px;
font-family: var(--hm-login-serif);
font-size: 26px;
font-weight: 600;
font-synthesis: none;
line-height: 1.3;
letter-spacing: 0.04em;
color: var(--hm-text-1);
}
.hm-login__card-sub {
margin: 0;
font-size: 12.5px;
line-height: 1.7;
letter-spacing: 0.02em;
color: var(--hm-text-2);
}
.hm-login__form {
margin-top: 24px;
}
.hm-login__label {
display: inline-flex;
align-items: center;
gap: 8px;
font-size: 12px;
font-weight: 600;
letter-spacing: 0.06em;
color: var(--hm-text-2);
}
.hm-login__label-no {
font-family: var(--hm-login-mono);
font-size: 9.5px;
font-weight: 500;
letter-spacing: 0.1em;
color: var(--hm-text-3);
}
.hm-login__card-rule {
height: 1px;
margin: 20px 0 11px;
background: linear-gradient(90deg, transparent, rgba(34, 43, 95, 0.16), transparent);
}
.hm-login__card-serial {
display: flex;
align-items: baseline;
justify-content: space-between;
gap: 12px;
font-family: var(--hm-login-mono);
font-size: 8.5px;
letter-spacing: 0.22em;
text-transform: uppercase;
color: var(--hm-text-3);
}
/* ---------------------------- 登录卡里的 antd ---------------------------- */
.hm-login .ant-form-item {
margin-bottom: 16px;
}
.hm-login .ant-form-item-label {
padding: 0 0 7px;
}
.hm-login .ant-form-item-label > label {
height: auto;
color: var(--hm-text-2);
}
.hm-login .ant-form-item-explain-error {
padding-top: 4px;
font-size: 11px;
}
.hm-login .ant-input-affix-wrapper {
height: 44px;
padding: 0 13px;
border: 1px solid rgba(34, 43, 95, 0.16);
border-radius: 10px;
background: var(--hm-login-field-fill);
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.65);
transition:
background 0.18s ease,
border-color 0.18s ease,
box-shadow 0.18s ease;
}
.hm-login .ant-input-affix-wrapper:hover {
border-color: rgba(70, 83, 162, 0.38);
background: rgba(255, 255, 255, 0.68);
}
.hm-login .ant-input-affix-wrapper-focused,
.hm-login .ant-input-affix-wrapper:focus-within {
border-color: var(--hm-primary) !important;
background: #ffffff !important;
box-shadow: 0 0 0 3px rgba(70, 83, 162, 0.12) !important;
}
.hm-login .ant-input-affix-wrapper > input.ant-input {
background: transparent;
font-size: 14px;
letter-spacing: 0.02em;
color: var(--hm-text-1);
}
.hm-login .ant-input-prefix {
margin-inline-end: 10px;
color: var(--hm-text-3);
font-size: 14px;
transition: color 0.18s ease;
}
.hm-login .ant-input-affix-wrapper-focused .ant-input-prefix,
.hm-login .ant-input-affix-wrapper:focus-within .ant-input-prefix {
color: var(--hm-primary);
}
.hm-login .ant-input::placeholder {
color: rgba(85, 90, 102, 0.5);
letter-spacing: 0.02em;
}
.hm-login .ant-input-password-icon.anticon {
color: var(--hm-text-3);
}
/*
* 浏览器「自动填充」回填出来的用户名/密码。
*
* Chrome / Edge / Safari / Firefox 会给填过内容的 input 自己刷一层底色(那层是画在
* input 自己身上的,而 antd 的输入框底色在外层 wrapper 上),于是回填后字段中间会多出
* 一块比输入框更实、更偏灰黄的矩形 —— 就是用户说的「突兀」。
*
* 两层一起压掉:
* 1) `background-color: transparent` + 极长的 background-color 过渡:浏览器改底色是
* 走过渡的,把时长拉到 999999s,那层颜色永远过渡不到,等于不出现。
* 2) 内阴影兜底:万一某个版本不走过渡(Chrome 改过实现),内阴影会盖住那层底色。
* 这里给的是**半透明白**而不是实色 —— 玻璃卡片压在深色底图上,实色白会明显比
* 四周的玻璃更亮,反而制造新的色差;半透明白叠在原底色上只提亮几个色阶,读不出来。
* 聚焦时外层本来就铺成纯白,此时叠一层白等于没叠,仍然一致。
*
* 选择器用 `:is(:-webkit-autofill, :autofill)`::-webkit- 前缀在 Firefox、
* :autofill 在旧 WebKit 里都是「无法识别的选择器」,写在一个逗号列表里会让整条规则被
* 丢掉;包进 :is() 之后不认识的那半只被忽略,两种引擎都能命中。
*/
.hm-login input:is(:-webkit-autofill, :autofill) {
-webkit-text-fill-color: var(--hm-text-1);
caret-color: var(--hm-text-1);
color-scheme: light;
background-color: transparent !important;
background-image: none !important;
box-shadow: 0 0 0 1000px var(--hm-login-autofill-fill) inset !important;
transition:
background-color 999999s ease-in-out 0s,
-webkit-text-fill-color 999999s ease-in-out 0s;
}
/* 聚焦时外层已是纯白,内阴影换成同一支白,避免字段中间再浮出一块 */
.hm-login input:is(:-webkit-autofill, :autofill):focus {
box-shadow: 0 0 0 1000px #ffffff inset !important;
}
.hm-login__submit-item {
margin-top: 8px;
margin-bottom: 0 !important;
}
.hm-login__submit-item .ant-btn {
position: relative;
display: flex;
align-items: center;
justify-content: center;
gap: 10px;
height: 46px;
border: 0 !important;
border-radius: 10px;
overflow: hidden;
color: #ffffff;
font-size: 13.5px;
font-weight: 600;
letter-spacing: 0.34em;
background-color: #3a4694;
background-image: linear-gradient(120deg, #4653a2 0%, #333d8f 55%, #222b5f 100%);
box-shadow:
0 16px 32px -18px rgba(34, 43, 95, 0.85),
0 1px 0 rgba(255, 255, 255, 0.16) inset;
transition:
transform 0.18s ease,
filter 0.18s ease,
box-shadow 0.18s ease;
}
.hm-login__submit-item .ant-btn::after {
content: '';
position: absolute;
inset: 0;
pointer-events: none;
background: linear-gradient(
100deg,
transparent 22%,
rgba(255, 255, 255, 0.2) 48%,
transparent 72%
);
transform: translateX(-120%);
transition: transform 0.7s ease;
}
.hm-login__submit-item .ant-btn:hover:not(:disabled) {
transform: translateY(-1px);
filter: brightness(1.07);
box-shadow:
0 22px 38px -18px rgba(20, 28, 70, 0.9),
0 1px 0 rgba(255, 255, 255, 0.2) inset;
}
.hm-login__submit-item .ant-btn:hover:not(:disabled)::after {
transform: translateX(120%);
}
.hm-login__submit-item .ant-btn:active:not(:disabled) {
transform: translateY(0);
}
.hm-login__submit-item .ant-btn:focus-visible {
outline: 2px solid var(--hm-accent-cyan);
outline-offset: 2px;
}
.hm-login__submit-arrow {
font-size: 15px;
line-height: 1;
letter-spacing: 0;
transition: transform 0.18s ease;
}
.hm-login__submit-item .ant-btn:hover .hm-login__submit-arrow {
transform: translateX(4px);
}
/* ------------------------------- 动效 ------------------------------- */
@keyframes hm-login-rise {
from {
opacity: 0;
transform: translateY(16px);
}
to {
opacity: 1;
transform: none;
}
}
@keyframes hm-login-card-in {
from {
opacity: 0;
transform: translateY(20px) scale(0.985);
}
to {
opacity: 1;
transform: none;
}
}
@keyframes hm-login-scene-in {
from {
opacity: 0;
}
to {
opacity: 1;
}
}
@keyframes hm-login-breathe {
from {
opacity: 0.82;
}
to {
opacity: 1;
}
}
@keyframes hm-login-pulse {
0% {
transform: scale(1);
opacity: 0.55;
}
70% {
transform: scale(2.1);
opacity: 0;
}
100% {
transform: scale(2.1);
opacity: 0;
}
}
@keyframes hm-login-dash {
to {
stroke-dashoffset: -40;
}
}
@keyframes hm-login-travel {
0% {
left: 0;
opacity: 0;
}
12% {
opacity: 1;
}
88% {
opacity: 1;
}
100% {
left: calc(100% - 5px);
opacity: 0;
}
}
/* ------------------------------- 响应式 ------------------------------- */
/* 卡片与底图批注在窄屏上会撞在一起:先撤批注,保留经纬网、热力与落点 */
@media (max-width: 1360px) {
.hm-login__map-note {
display: none;
}
}
@media (max-width: 1180px) {
.hm-login {
grid-template-columns: minmax(0, 1fr) 380px;
column-gap: 32px;
padding-left: 48px;
padding-right: 48px;
}
.hm-login__display {
font-size: clamp(48px, 6vw, 78px);
}
.hm-login__card {
padding: 26px 26px 20px;
}
.hm-login__spine {
display: none;
}
}
/* 单列:标题在上、卡片在下,底图退成整页背景 */
@media (max-width: 980px) {
.hm-login {
display: block;
overflow-y: auto;
padding: 26px 24px 40px;
}
.hm-login__top {
display: flex;
}
.hm-login__main {
display: block;
padding: 8vh 0 0;
}
.hm-login__intro {
max-width: 640px;
}
.hm-login__display {
font-size: clamp(44px, 10.5vw, 76px);
}
.hm-login__lede {
max-width: 30em;
}
.hm-login__legend {
width: 260px;
margin-top: 30px;
}
.hm-login__panel {
display: block;
margin-top: 44px;
}
.hm-login__card {
width: min(430px, 100%);
}
}
@media (max-width: 640px) {
.hm-login {
padding: 22px 18px 32px;
}
.hm-login__geo-rule,
.hm-login__geo-place {
display: none;
}
.hm-login__geo {
font-size: 9px;
letter-spacing: 0.14em;
}
.hm-login__main {
padding-top: 6vh;
}
.hm-login__eyebrow {
font-size: 11px;
letter-spacing: 0.2em;
}
.hm-login__display {
font-size: clamp(38px, 12vw, 56px);
letter-spacing: 0.05em;
}
.hm-login__lede {
font-size: 13.5px;
line-height: 1.8;
}
.hm-login__trace {
font-size: 9.5px;
letter-spacing: 0.16em;
}
.hm-login__trace-node {
padding: 4px 9px;
}
.hm-login__trace-line {
width: 32px;
}
.hm-login__legend {
width: min(220px, 78%);
margin-top: 26px;
}
.hm-login__panel {
margin-top: 32px;
}
.hm-login__card {
margin: 0 auto;
padding: 24px 20px 18px;
border-radius: 14px;
}
.hm-login__card::before {
left: 20px;
}
.hm-login__card-title {
font-size: 23px;
}
.hm-login__card-serial {
font-size: 8px;
letter-spacing: 0.16em;
}
}
/* 矮屏:把纵向的装饰性留白先收掉,卡片与标题都还看得全 */
@media (max-height: 760px) and (min-width: 981px) {
.hm-login__lede,
.hm-login__trace {
margin-top: 18px;
}
.hm-login__legend {
margin-top: 22px;
}
.hm-login__display {
font-size: clamp(48px, 5.6vw, 82px);
}
.hm-login__card {
padding: 24px 26px 18px;
}
.hm-login__card-title {
margin-top: 6px;
font-size: 24px;
}
.hm-login__form {
margin-top: 18px;
}
}
@media (prefers-reduced-motion: reduce) {
.hm-login *,
.hm-login *::before,
.hm-login *::after {
animation: none !important;
transition: none !important;
}
}
......@@ -119,7 +119,8 @@ describe('辖区归属:只看出险地址,不看坐标', () => {
const v = sz(['广东省', '东莞市', '凤岗镇', '官井头收费站']);
expect(v.flag).toBe(FLAG.OUTSIDE);
expect(v.evidence).toBe('东莞市');
expect(v.source).toBe('地址第 2 段');
// 全文硬标记扫描压过前 3 段扫描,作为首要判定路径
expect(v.source).toBe('地址全文外市标记');
});
/**
......@@ -133,6 +134,26 @@ describe('辖区归属:只看出险地址,不看坐标', () => {
expect(v.evidence).toBe('东莞市');
});
/**
* 超人点出的那类漏判:前缀写「龙岗区」、第 4 段细节里其实在东莞。
* 旧逻辑只扫地址前 3 段(广东省 / 深圳市 / 龙岗区),第 4 段的「东莞市 / 凤岗镇」从不被检查,
* 于是这行被误计入龙岗区。现在整条地址硬标记扫描压过前缀,应判邻市。
*/
it('前缀写龙岗区、细节里其实在东莞 → 邻市(全文扫描兜底)', () => {
const v = sz(['广东省', '深圳市', '龙岗区', '东莞市南门山森林公园小草湖庄园(凤岗镇)地上停车场']);
expect(v.flag).toBe(FLAG.OUTSIDE);
expect(v.evidence).toBe('东莞市');
expect(v.source).toBe('地址全文外市标记');
});
/**
* 精度兜底:深圳本地地名含「凤岗」(凤岗小学)但没带「镇」后缀,不应被当成东莞凤岗镇误剔。
* 硬标记只认「凤岗镇」整串,不认裸「凤岗」。
*/
it('深圳本地「凤岗小学」不含「镇」后缀 → 不标邻市', () => {
expect(sz(['广东省', '深圳市', '龙岗区', '凤岗小学']).flag).toBe(0);
});
/** 凤岗是东莞的镇:地址没写清辖区时,街道列(补全工具按 township 填的)就是证据 */
it('地址没写清辖区时,街道列写着凤岗镇 → 邻市', () => {
const v = sz(['广东省', '深圳市', '某路'], '', '凤岗镇');
......@@ -181,14 +202,14 @@ describe('辖区归属:只看出险地址,不看坐标', () => {
it('默认处置:邻市与三项全缺默认剔、可取消;缺一部分默认保留', () => {
expect(CLASS_DEFAULTS.OUTSIDE).toEqual({ fixed: false, defaultOn: true });
expect(CLASS_DEFAULTS.MISSING).toEqual({ fixed: false, defaultOn: true });
expect(CLASS_DEFAULTS.MISSING_PARTIAL.defaultOn).toBe(false);
expect(CLASS_DEFAULTS.MISSING_PARTIAL.defaultOn).toBe(true);
});
});
describe('字段缺失判定', () => {
/**
* **只要有一项取得到就不剔**:三项全缺才 MISSING(固定剔除);
* 缺一部分只标 MISSING_PARTIAL(默认保留,缺哪一维不进那一维的排名)。
* 缺一部分只标 MISSING_PARTIAL(默认剔除、可取消,缺哪一维不进那一维的排名)。
*
* 早先是「区读不出即 MISSING、且固定剔除」,于是「宝安区-福海街道联建商务中心
* 深圳港宝安综合港区」这种区街道都读得出、只差路名的真实事故被无条件删掉,
......@@ -216,7 +237,7 @@ describe('字段缺失判定', () => {
});
it('缺一部分的那一档默认保留、可勾选;三项全缺那一档默认剔、也可取消', () => {
expect(CLASS_DEFAULTS.MISSING_PARTIAL).toEqual({ fixed: false, defaultOn: false });
expect(CLASS_DEFAULTS.MISSING_PARTIAL).toEqual({ fixed: false, defaultOn: true });
expect(CLASS_DEFAULTS.MISSING).toEqual({ fixed: false, defaultOn: true });
});
......
......@@ -185,7 +185,7 @@ export const SMALL_THRESHOLD_MAX = 999;
* 两档的处置:
* - 三项全缺 → MISSING,固定剔除。这一行在区 / 街道 / 道路三维上都没有落点,
* 留着对三张榜都没有贡献,只能在总量里做一条「读不出」的提示;
* - 缺一部分 → MISSING_PARTIAL,**不剔除**。缺哪一维,那一维就不进它的排名,
* - 缺一部分 → MISSING_PARTIAL。缺哪一维,那一维就不进它的排名,
* 其余维度照常进。缺街道的照常进区榜与道路榜,缺道路的照常进区榜与街道榜。
* 真实数据里这类多半是楼宇、小区、隧道、海湾、公园 —— 它们本就没有路名或街道名,
* 不是数据缺字段,剔掉就是把真案子丢了。
......@@ -278,11 +278,54 @@ const TOWN_TAIL = /镇$/;
/** 区 / 县 / 旗:不在深圳区名单里的(惠阳区、东莞市下的区)就是外市 */
const COUNTY_TAIL = /(?:区|县|旗)$/;
/**
* 确定性外市硬标记:出现在地址**任意位置**都判为外市,压过「深圳市」样板前缀与第 3 段区名。
*
* 用途:抓「前缀写龙岗区、细节里其实在东莞」这类被前 3 段扫描漏掉的外市案
* (例:`广东省-深圳市-龙岗区-东莞市南门山森林公园…(凤岗镇)…`)。
*
* 为什么是这一份、不是裸城市名:深圳本地有大量含「香港 / 中山 / 惠州 / 佛山 / 澳门」字样的地名
* (香港大学深圳医院、中山园路、惠州方向、佛山街、澳门新村……),用裸名子串扫描会误剔几十上百条
* 深圳真案子。所以这里只收两类**不会在深圳地名中作为子串出现**的标记:
* - 带「市」后缀的邻市名(东莞市 / 惠州市 / 广州市……):深圳不叫「X市」,也写不出「惠州市」字样;
* - 东莞临深镇街(凤岗镇 / 塘厦镇……):深圳无镇建制,这些镇名在深圳不存在,是确定性外市证据。
*
* 两条安全性约束保证「表越长越准、不会误伤」:① 带「市」后缀的城市名在深圳地名里绝不出现;
* ② 镇名只收东莞临深镇,深圳没有「镇」。后续若出现同类「前缀写深圳、实际在别的市」的案子,
* 往这里加对应城市的「市」名或该市的专属镇名即可 —— 这就是超人要的「类似情况通用方案」。
*/
const EXTERNAL_HARD_MARKERS = [
// 湾区邻市(带「市」后缀,子串安全)
'东莞市', '惠州市', '广州市', '珠海市', '中山市', '佛山市', '江门市', '肇庆市',
// 东莞临深镇街(在深圳不存在,确定外市)
'凤岗镇', '塘厦镇', '清溪镇', '樟木头镇', '黄江镇', '大岭山镇',
'长安镇', '虎门镇', '常平镇', '厚街镇', '寮步镇', '大朗镇',
];
/** 整条地址(不限前 3 段)出现确定性外市标记 → OUTSIDE,压过深圳前缀 */
function firstOutsideAnywhere(full: string): RegionVerdict | null {
for (const marker of EXTERNAL_HARD_MARKERS) {
if (full.includes(marker)) {
return { flag: FLAG.OUTSIDE, evidence: marker, source: '地址全文外市标记' };
}
}
return null;
}
export function classifyRegion(
addressParts: string[],
districtCol: string,
streetCol: string,
): RegionVerdict {
const full = addressParts.join('');
// ① 全文外市硬标记:压过「深圳市」样板前缀,也压过地址前 3 段写的深圳区名。
// 抓「前缀写龙岗区、细节里其实在东莞」这类被前 3 段扫描漏掉的外市案。
// 只认确定性标记(带「市」后缀的邻市名 + 东莞临深镇街,见 EXTERNAL_HARD_MARKERS),
// 不认裸城市名 —— 深圳本地有大量含「香港 / 中山 / 惠州 / 佛山 / 澳门」字样的地名会误剔。
const buried = firstOutsideAnywhere(full);
if (buried) return buried;
const seg = (i: number) => (addressParts[i] ?? '').trim();
const addr: Array<[string, string]> = [
[seg(0), '地址第 1 段'],
......@@ -290,7 +333,7 @@ export function classifyRegion(
[seg(2), '地址第 3 段'],
];
// ① 地址里写明外市 —— 最硬的一条,压过同行里的「深圳市」样板前缀。
// ② 地址前 3 段写明外市 —— 最硬的一条,压过同行里的「深圳市」样板前缀。
// 源数据每行都套「广东省-深圳市-…」,东莞市才是这一行特有的信息。
const fromAddr = firstOutside(addr);
if (fromAddr) return fromAddr;
......@@ -873,9 +916,9 @@ export function markSmallClusters(input: SmallClusterInput): SmallClusterResult
* 口径:**以出险地址为准**,坐标不参与归属判定。
* - 三项全缺(MISSING)默认剔除:区 / 街道 / 道路都没有落点,三张榜用不上它。
* 默认勾上、可取消 —— 它仍是真实事故,地图上照样能落点,留不留交给导入人;
* - 缺一部分(MISSING_PARTIAL)**默认保留**,只标记:缺哪一维就不进那一维的排名,
* 其余维度照常统计。真实数据里这类是楼宇、小区、隧道、海湾、公园 —— 本就没有路名 /
* 街道名,不是数据缺字段,剔掉就是把真案子丢了;
* - 缺一部分(MISSING_PARTIAL)**默认剔除**(可取消):行政区 / 街道 / 道路 至少有一项取得到、
* 只是没取全 —— 楼宇、小区、隧道、海湾、公园这类地点本就没有路名 / 街道名,不是数据缺字段。
* 默认勾上:它仍是真实事故、地图上照样能落点,但榜单只按取全的维度排名,留不留交给导入人;
* - 邻市(OUTSIDE)默认剔除:出险地址写的是深圳以外的辖区(东莞市、凤岗镇),
* 按地址就能定,不必再拿坐标去求证;
* - 空间孤立(ISO_*)、道路低频(SPARSE)、街道低频(SPARSE_STREET)、小热点(SMALL)
......@@ -883,7 +926,7 @@ export function markSmallClusters(input: SmallClusterInput): SmallClusterResult
*/
export const CLASS_DEFAULTS: Record<CleanClassKey, { fixed: boolean; defaultOn: boolean }> = {
MISSING: { fixed: false, defaultOn: true },
MISSING_PARTIAL: { fixed: false, defaultOn: false },
MISSING_PARTIAL: { fixed: false, defaultOn: true },
OUTSIDE: { fixed: false, defaultOn: true },
ISO_200: { fixed: false, defaultOn: false },
ISO_500: { fixed: false, defaultOn: false },
......@@ -916,12 +959,12 @@ export const CLASS_INFO: Record<CleanClassKey, { label: string; reason: string }
MISSING_PARTIAL: {
label: '部分维度缺失',
reason:
'行政区 / 街道 / 道路 里至少有一项取得到,只是没取全 —— 楼宇、小区、隧道、海湾、公园这类地点本就没有路名或街道名,不是数据缺字段。默认不剔:缺哪一项,那一项就不进它的排名(榜末「未标注」档只报起数),其余维度照常参与统计',
'行政区 / 街道 / 道路 里至少有一项取得到,只是没取全 —— 楼宇、小区、隧道、海湾、公园这类地点本就没有路名或街道名,不是数据缺字段。默认剔除(可在下面取消勾选 —— 它仍是真实事故,地图上照样能落点):缺哪一项,那一项就不进它的排名(榜末「未标注」档只报起数),其余维度照常参与统计',
},
OUTSIDE: {
label: '邻市(地址写明外市)',
reason:
'出险地址写的是深圳市以外的辖区 —— 行政区列 / 街道列 / 地址前 3 段里出现外市名(东莞市、惠州市)、外市区县名(惠阳区)或「××镇」(凤岗镇:深圳 2004 年撤镇设街道,辖内已无镇建制)。按地址判定,不看坐标,默认剔除',
'出险地址写的是深圳市以外的辖区 —— 整条地址(含细节段)出现确定性外市标记即判外市:带「市」后缀的邻市名(东莞市、惠州市)、外市区县名(惠阳区)或「××镇」(凤岗镇:深圳 2004 年撤镇设街道,辖内已无镇建制)。压过「深圳市」样板前缀与第 3 段写的深圳区名,按地址判定、不看坐标,默认剔除',
},
ISO_200: { label: '孤立 · 200m 内无邻居', reason: '半径 200m 内没有同批次的其他案件' },
ISO_500: { label: '孤立 · 500m 内无邻居', reason: '半径 500m 内没有同批次的其他案件,多为山路、公园、海边' },
......
......@@ -75,11 +75,30 @@ describe('辖区归属(C 类)', () => {
const partial = report.classes.find((c) => c.key === 'MISSING_PARTIAL');
expect(partial?.count).toBe(1);
expect(partial?.defaultOn).toBe(false);
expect(partial?.defaultOn).toBe(true);
expect(partial?.samples[0]?.note).toMatch(/缺 道路/);
const missing = report.classes.find((c) => c.key === 'MISSING');
expect(missing?.count).toBe(0);
});
/**
* 大鹏新区单列:龙岗区下南澳 / 葵涌 / 大鹏 三街道在业务上属大鹏新区,
* 补全工具按坐标把它们归到龙岗区。这里按需求把这三街道从龙岗区划归大鹏新区,成为独立统计区;
* 龙岗区下的其它街道(龙城街道)不受影响。
*/
it('龙岗区下南澳/葵涌/大鹏街道重映射为大鹏新区', async () => {
const csv = [
'案件号,出险地点,报案时间,经度,纬度,行政区,街道,道路',
'90578002800028456052,广东省-深圳市-龙岗区-南澳街道某路,2026-01-01 08:00,114.45,22.55,龙岗区,南澳街道,某路',
'90578002800028456053,广东省-深圳市-龙岗区-葵涌街道某路,2026-01-01 08:00,114.40,22.62,龙岗区,葵涌街道,某路',
'90578002800028456054,广东省-深圳市-龙岗区-大鹏街道某路,2026-01-01 08:00,114.50,22.60,龙岗区,大鹏街道,某路',
'90578002800028456055,广东省-深圳市-龙岗区-龙城街道某路,2026-01-01 08:00,114.21,22.72,龙岗区,龙城街道,某路',
].join('\r\n');
const { report } = await ingestBytes('t.csv', csvBytes(csv));
expect(report.districtCounts['大鹏新区']).toBe(3);
expect(report.districtCounts['龙岗区']).toBe(1);
});
});
describe('案件号精度', () => {
......
......@@ -105,6 +105,13 @@ const DISTRICT_ALIAS: Array<[string, string]> = [
['坪山新区', '坪山区'],
];
/**
* 大鹏新区三街道:南澳 / 葵涌 / 大鹏。行政上曾属龙岗区,业务上一向单列报,
* 补全工具按坐标把它们归到龙岗区。按需求把这三街道从龙岗区划归大鹏新区,
* 使其成为独立统计区(见下方逐行 remap)。
*/
const DAPENG_STREETS = new Set(['南澳街道', '葵涌街道', '大鹏街道']);
/** 段首能剥出的别名(按名字长度降序,和区名词表同一套做法,避免短名抢先) */
const districtAliasByLen = [...DISTRICT_ALIAS].sort((a, b) => b[0].length - a[0].length);
......@@ -661,6 +668,12 @@ export async function ingestBytes(
}
}
// 大鹏新区单列:龙岗区下南澳 / 葵涌 / 大鹏 三街道在业务上属大鹏新区(行政上曾属龙岗),
// 补全工具按坐标把它们归到龙岗区。按需求把这三街道从龙岗区划归大鹏新区,使其成为独立统计区。
if (district === '龙岗区' && DAPENG_STREETS.has(street)) {
district = '大鹏新区';
}
const districtIdx = districtIndexOf(district);
const streetIdx = intern(
streetIndexMap,
......
......@@ -244,7 +244,7 @@ export function HeaderBar() {
<header className="hm-header">
<div className="hm-header__left">
<BrandMark />
<div className="hm-header__divider" />
<div className="hm-header__axis" aria-hidden />
<div className="hm-header__context">
<div className="hm-header__context-title">深圳车险出险位置-9月风险热力图</div>
<div className="hm-header__context-sub">智能网联监管平台 · 事故出险点位分析</div>
......
......@@ -109,6 +109,8 @@ interface CleanRowData {
fixed: boolean;
checked: boolean;
disabled: boolean;
/** 默认勾选剔除(可取消):界面上加醒目标识,提示导入人这条默认就被剔 */
defaultOn?: boolean;
onToggle?: (on: boolean) => void;
samples: SampleRow[];
}
......@@ -495,6 +497,7 @@ function ReportBody({
fixed: c.fixed,
checked: c.fixed || picked.has(k),
disabled: c.fixed,
defaultOn: c.defaultOn,
onToggle: c.fixed ? undefined : (on: boolean) => toggle(k, on),
samples: c.samples.map((s) => ({ caseNo: s.caseNo, address: s.address, note: s.note })),
},
......@@ -829,7 +832,11 @@ function ReportBody({
function CleanRow({ row }: { row: CleanRowData }) {
return (
<div className="hm-ic__row" data-zero={row.count === 0 ? '1' : undefined}>
<div
className="hm-ic__row"
data-zero={row.count === 0 ? '1' : undefined}
data-default={row.defaultOn ? '1' : undefined}
>
{row.fixed ? (
<Tooltip title="固定剔除">
<LockOutlined className="hm-ic__lock" />
......@@ -841,7 +848,14 @@ function CleanRow({ row }: { row: CleanRowData }) {
onChange={(e) => row.onToggle?.(e.target.checked)}
/>
)}
<span className="hm-ic__row-label">{row.label}</span>
<span className="hm-ic__row-label">
{row.label}
{row.defaultOn && (
<Tooltip title="该类别默认勾选剔除;如不想剔,取消勾选即可,它仍是真实事故、地图上照样落点">
<span className="hm-ic__row-badge">默认剔除</span>
</Tooltip>
)}
</span>
<span className="hm-ic__row-reason">{row.reason}</span>
<b className="hm-ic__row-count">{fmtInt(row.count)}</b>
<Info reason={row.reason} samples={row.samples} />
......
......@@ -1177,9 +1177,31 @@ body {
box-shadow: 0 6px 24px -12px rgba(16, 24, 40, 0.5);
}
/* 底缘左段那一截渐变线:登录卡顶缘「接入」线的同款,压住顶栏下边。
只做 240px 短的一截再向右淡出 —— 整条实线会跟 border-bottom 抢,读成两条平行线。 */
.hm-header::after {
content: '';
position: absolute;
left: 0;
bottom: -1px;
width: 240px;
height: 2px;
border-radius: 0 2px 2px 0;
background: linear-gradient(
90deg,
var(--hm-primary) 0%,
var(--hm-accent-cyan) 62%,
transparent 100%
);
pointer-events: none;
}
/* 深底顶栏内的文字统一转亮,保证在毛玻璃之上的可读性 */
.hm-header .hm-brand__title {
color: #f4f6ff;
/* 与登录页同一笔字距(那边 2px,顶栏窄、收一点):品牌名拉开后,
深玻璃顶栏读起来更像一块铭牌,而不是页面上随意的一行字。 */
letter-spacing: 1.4px;
}
.hm-header .hm-brand__subtitle {
......@@ -1193,10 +1215,43 @@ body {
min-width: 0;
}
.hm-header__divider {
/* 品牌与项目标题之间的测距线:一枚金色准星压在两段细线当中。
*
* 登录页标题前那枚十字标的同族,这里换成横向读法:横线由中间的金色向两侧淡出,
* 竖痕只留准星那 9px。全页只有这一处金色记号,与品牌标记右下角那个点位点同一个意思。 */
.hm-header__axis {
position: relative;
flex: 0 0 auto;
width: 46px;
height: 13px;
}
.hm-header__axis::before {
content: '';
position: absolute;
top: 6px;
left: 0;
right: 0;
height: 1px;
background: linear-gradient(
90deg,
transparent,
rgba(203, 214, 245, 0.34) 28%,
rgba(252, 201, 41, 0.85) 50%,
rgba(203, 214, 245, 0.34) 72%,
transparent
);
}
.hm-header__axis::after {
content: '';
position: absolute;
top: 2px;
left: 22.5px;
width: 1px;
height: 22px;
background: rgba(255, 255, 255, 0.22);
height: 9px;
background: rgba(252, 201, 41, 0.9);
box-shadow: 0 0 10px rgba(252, 201, 41, 0.5);
}
.hm-header__context {
......@@ -1467,6 +1522,34 @@ body {
color: var(--hm-text-1);
}
/** 默认勾选剔除的行:左侧金条 + 浅金底,整行比其余类更跳 */
.hm-ic__row[data-default='1'] {
background: rgba(252, 201, 41, 0.12);
box-shadow: inset 3px 0 0 var(--hm-accent-gold-deep);
}
/** 「默认剔除」徽标:金色胶囊,提示这条默认就被剔、可取消 */
.hm-ic__row-badge {
display: inline-block;
margin-left: 6px;
padding: 1px 6px;
border-radius: 4px;
font-size: 10px;
font-weight: 700;
line-height: 1.5;
letter-spacing: 0.5px;
color: #6b4e00;
background: var(--hm-accent-gold);
white-space: nowrap;
cursor: help;
vertical-align: middle;
}
.hm-ic__row-badge:hover {
background: var(--hm-accent-gold-deep);
color: #fff;
}
.hm-ic__info {
font-size: 12px;
color: var(--hm-text-3);
......
# 车险出险数据 剔除规则复核报告
- 数据:`深圳车险出险位置-9月-测试.已补全.xlsx`
- 总行数:**42,806** | 列:案件号 / 出险地点 / 报案时间 / 经度 / 纬度 / **行政区** / **街道** / **道路**
- 口径(按你定的):**出险地点 是唯一可靠源**,行政区/街道/道路三列是工具按地址(解析不出才调 API)补全的;统计维度按补全后数据展开。
- 分析方法:把现有 `classifyRegion` / `flagOfMissing` 逻辑原样移植到脚本跑全量,并对坐标做点在深圳多边形内判定。
---
## 一、数据体检(质量底线)
| 检查项 | 结果 | 结论 |
|---|---|---|
| 可靠列空值(案件号/地点/时间/经/纬) | **全 0** | 干净 |
| 补列空值(行政区/街道/道路) | 2 / 10 / 6 | 极少,非系统性 |
| 案件号 | 全部 20 位纯数字、**42,806 全唯一** | 无重复、无非法 |
| 报案时间 | 全部落在 **2026-09**,无未来、无可解析失败 | 干净 |
| 经纬度 | 范围 113.76–114.58E / 22.46–22.84N,无 (0,0),无越出中国陆地 | 干净 |
**结论:这份数据是高质量数据,可靠列几乎没有可剔除的脏行。** 现有规则在本批上能合理剔除的量极小(见第三节)。
---
## 二、一个关键认知:坐标聚合 ≠ 脏数据
33.7%(14,427 行)与别的不同案件共享**完全相同到 6 位小数**的坐标。按阈值量化:
| 同坐标聚集(不同案件数 ≥) | 簇数 | 行数 | 占比 |
|---|---|---|---|
| ≥2 | 3,988 | 14,427 | 33.7% |
| ≥3 | 1,733 | 9,917 | 23.2% |
| ≥10 | 179 | 3,252 | 7.6% |
| ≥20 | 50 | 1,545 | 3.6% |
| ≥50 | 4 | 225 | 0.5% |
**这是逆地理编码把同一栋楼/同一路口吸附到同一个点的正常现象,不是数据错误。** 对热力图而言,这恰恰是"真实事故簇"的信号——剔除它会把真正的黑点抹掉。**建议不剔除,只标记/可选降权**(见第五节)。
---
## 三、现有剔除规则逐条复核
### A 类 · 结构性拒收(案件号 / 坐标 / 时间)
- **合理,保留。** 本批触发量 = 0(案件号全合法、坐标全在合理域、时间全可解析)。它作为"守门员"拦截未来批次的坏行,价值在防御不在本批。
### B 类 · 字段缺失
- `MISSING`(三项全缺,默认剔除):**本批 0 行**——补列几乎都填满了。
- `MISSING_PARTIAL`(缺一项,默认剔除、可取消):**16 行**(如"深圳湾""深中隧道"缺街道/道路,本就没有路名)。
- **合理。** 缺一部分默认勾选剔除、缺哪维不进哪维排名,与统计口径自洽;导入人可在弹窗取消勾选,它仍是真实事故、地图上照样落点。
### C 类 · 辖区归属 OUTSIDE(邻市)
- 真实外市:**实为 3 行**(详见第八节 8.4)。其中 2 行地址第 3 段明写"东莞市"(`广东省-深圳市-东莞市-…`,补列区为 null),已被正确剔除;另有 **1 条被前缀"龙岗区"掩盖的东莞凤岗案**因当前规则只查地址前 3 段而被漏判,需按 8.4 修正。
- 易误报的 10 行("凤岗小学""惠州大厦""东莞方向""S31龙大高速入口(东莞方向)")是**深圳本地地名/方位词**,现有精确逻辑只查行政层级位置(区列/街道列/地址前 3 段),**不会误剔**——已验证。
- **合理,维持(仅补 8.4 的整地址扫描即可)。** 这是本批唯一"有理据"的剔除项。
### D 类 · 空间孤立(ISO_*)
- 按最近邻距离派生,嵌套三档,实现正确(CSR 网格加速),与勾选无关、计数稳定。**合理,保留。**
### E/G 类 · 低频(街道/道路)
- 低频判定已跳过"未识别"档,不污染名次。**合理,保留。**
### SEA / 几何域外(已撤销)
- 量化证明撤得对:全批仅 **23 行(0.05%)**坐标在深圳行政界外,其中 **21 行地址明确写深圳**(深中通道西人工岛、光侨北路海上段等跨海/海上点)。若保留 SEA,这 21 条真深圳案子会被误删。
- **结论:以出险地址为准、坐标不判归属,正确。**
---
## 四、关键结论
1. **数据质量高,可合理剔除量已接近极限**:本批真正该剔的只有 **3 条邻市**,其余规则要么 0 触发、要么默认勾选剔除(可取消)。
2. **强行"多剔"会伤分析**:唯一体量大的"坐标聚合"(7.6%@≥10)是热力图信号,不该剔。
3. **补列行政区可信度极高**:99.99% 直接来自地址文本;街道/道路来自逆地理编码属设计预期(60.9% / 45.4% 不在地址原文中是正常的)。
---
## 五、可补充的规则(分级建议)
### ✅ 建议默认剔除(守卫类,本批 0 触发,防未来批次窜入)
| 规则 | 判定 | 本批量 | 理由 |
|---|---|---|---|
| 时间窗守卫 | 报案时间不在本批次目标区间(如非 2026-09) | 0 | 防别的月份数据混入 |
| 案件号重复守卫 | 同案件号保留首条、其余剔除 | 0 | 防源系统重复导出 |
| 坐标合理域守卫 | (0,0)、经纬度互换、超出深圳宽松包围盒 | 0 | 防坐标系错误行 |
> 这三条现在触发量为 0,但作为"默认剔除"的硬守卫,能在下一份脏数据进来时自动挡住,符合你"剔除必须有根据"的原则。
### 🟡 建议仅标记、不剔除(透明化,不损分析)
| 标记 | 含义 | 本批量 |
|---|---|---|
| 坐标吸附标记 | 同坐标聚集 ≥N 条不同案件,热力图可选降权 | ≥10:3,252 (7.6%) |
| 区来自 API 补全标记 | 地址文本解析不出区、靠 API 补的(短名/无区地址) | 3 (0.01%) |
### ❌ 不建议作为剔除依据
- **"补列与地址文本不一致"**:道路 45.4%、街道 60.9% 不在地址原文中,因为道路/街道本就来自逆地理编码(最近路/街道),这是正常补全,不是缺陷。拿它剔会误删大量有效行。
---
## 六、建议补充进报告的维度
1. **外市剔除明细**:2 条东莞市的地址原文 + 证据(第 2 段"东莞市"),供复核。
2. **"以地址为准"的保留证据**:21 条坐标在界外但地址写深圳的跨海/海上点——证明不按坐标剔是对的。
3. **坐标吸附占比**:33.7% 共享坐标,提示热力图高密度区可能含吸附噪声,建议图上标注。
4. **API 补全占比**:区 0.01% / 街 60.9% / 路 45.4%——说明统计口径里"街道/道路"维度的数据更多依赖地理编码,精度略低于"行政区"。
5. **三维度有效覆盖**:行政区 10 区全覆盖(龙岗 10,009 最多、盐田 620 最少);街道/道路的"未标注"档承接量(即 PARTIAL 的 16 行 + 补列空值行)。
---
## 七、下一步
已实现(本轮):8.4 的 OUTSIDE 整地址扫描、8.5 的大鹏新区重映射,均已在 `cleanRules.ts` / `ingestCore.ts` 落地,类型检查 / 全量单测(311 项)/ lint 全绿,真实数据回跑验证 OUTSIDE=3、大鹏新区=499。
尚未实现(仍可按需推进):
- 第五节 ✅ 三条守卫(时间窗 / 案件号重复 / 坐标合理域),默认剔除;
- 🟡 两个"仅标记"维度,并在导入报告与统计面板展示;
- 第六节 5 个维度补进导入报告。
请告诉我哪些要继续。
---
## 八、原始第三方数据 vs 已补全数据 交叉对比(本轮新增)
数据:`深圳车险出险位置-9月-测试.xlsx`(原始,5 列)× `out/深圳车险出险位置-9月-测试.已补全.xlsx`(补全,8 列)。两份同为 **42,806 行**。原始文件只有 案件号/出险地点/报案时间/经度/纬度;已补全文件在其后追加了 行政区/街道/道路。
### 8.1 完整性:补全是"纯追加",零改动原始数据 ✅
- 行数 42,806 = 42,806;案件号唯一性 42,806 = 42,806,无增删。
- 5 个第三方可靠列(案件号/出险地点/报案时间/经度/纬度)逐行比对:**0 处差异**(含报案时间的 Excel 序列值、经纬度字符串原样保留)。
- 结论:可放心以"已补全"文件作为统计源;补全过程没有篡改、没有删除任何第三方原始数据。
### 8.2 行政区补全忠实于地址:核心原则被验证 ✅
- 已补全 `行政区` 与地址结构化"区"字段 **100% 一致(42,802/42,802 行完全匹配,0 处冲突)**——补全工具没有用坐标反查去覆盖地址写明的区。
- 仅 2~3 行地址本身无区(如"广东省-深圳市-光明-""空段"),由 API 补区;2 条外市(东莞)行 `行政区` 正确留空。
- 结论:前期"行政区 99.99% 来自地址文本"的论断被精确复核确认,**"以出险地址为准"在补全阶段成立**。
### 8.3 街道/道路来源拆分:交叉验证通过 ✅
- 独立重测(严格全串匹配):**街道 39.1%、道路 54.6%** 直接出现在地址原文,其余来自逆地理编码——与前期报告数字完全一致,无需修正。
- 说明:用"去后缀再子串"的宽松匹配会把"龙岗区"误命中"龙岗街道",使街道虚高到 52%;故以严格全串匹配 39.1% 为准。
### 8.4 重要修正:被前缀掩盖的 1 条外市案(OUTSIDE 实为 3 条,非 2)⚠️
- 全表含东莞标记的共 **3 行**:
- 2 行地址第 3 段即"东莞市"(官井头收费站、龙平西路好易大厦)→ 已正确剔除(`行政区` 留空)。
- **1 行被遗漏**:案件号 `90578002800029299736`,地址 `广东省-深圳市-龙岗区-东莞市南门山森林公园小草湖庄园(凤岗镇)地上停车场`。
- 结构前缀错标"龙岗区",补全据此填了 **龙岗区/龙岗街道**;但它实际在 **东莞凤岗**。
- 当前 `classifyRegion` 只扫描地址**前 3 段**(广东省/深圳市/龙岗区),第 4 段里的"凤岗镇"从不被检查;且 seg2=龙岗区 触发"深圳区名→非外市"短路,于是这 1 行被判为深圳、计入龙岗区(龙岗区 10,009 中的 1 条),属轻微误聚合。
- 修正建议(精准、无副作用):在 OUTSIDE 判定中增加对**整条地址**的东莞专属标记扫描——`东莞市` 子串,或 `凤岗镇/塘厦镇/清溪镇/樟木头镇/黄江镇/大岭山镇/长安镇/虎门镇/常平镇/厚街镇/寮步镇/大朗镇`。这些镇名在深圳不存在,仅影响这 1 行,不会误伤。
- 反例提醒(为何不能偷懒):本表有**百余行**是深圳本地地名恰好含外市字,如 `香港大学深圳医院`、`中山园路`(南山真有此路)、`惠州方向`(方位词)、`佛山街`(华侨城)、`澳门新村`(龙华真有此村)——若用"香港/中山/惠州/佛山/澳门"城市名子串判定会大量误剔。前期报告的精确判定逻辑正是为此。
**已实现(本轮)**:`classifyRegion` 最前面新增「整条地址硬标记扫描」(`EXTERNAL_HARD_MARKERS`:带「市」后缀的邻市名 + 东莞临深镇街),压过深圳前缀与第 3 段区名。真实数据回跑验证:OUTSIDE 由 2 增至 **3**,该东莞凤岗案已被正确判邻市并剔除;命中 `source` 记为「地址全文外市标记」。新增单测锁定此行为(含「深圳本地凤岗小学不含『镇』后缀不误剔」的精度兜底)。
### 8.5 补充维度(口径选项,非错误):大鹏新区单列
- 已补全 `行政区` 分布里**没有"大鹏新区"**;龙岗区 10,009 行中 **499 行**为南澳/葵涌/大鹏街道(大鹏半岛)。这些地址结构段写龙岗区、补全也填龙岗区,完全自洽。
- 若你希望热力图把"大鹏新区"单列为一个区(而非并入龙岗区),可加一条"按街道重映射"规则把这 499 行从龙岗区划归大鹏新区。属口径选择,不是数据错误。
**已实现(本轮)**:`ingestCore` 在街道定稿后、写 `districtIdx` 前,把 `龙岗区 + 南澳/葵涌/大鹏街道` 重映射为 `大鹏新区`。真实数据回跑验证:499 行划入大鹏新区(龙岗区由 10,009 降至 9,509),大鹏新区成为独立统计区;龙岗区下的其它街道(如龙城街道)不受影响。新增单测锁定此行为。
### 8.6 结论更新
1. 补全数据可信且非破坏性:原始 5 列零改动,行政区 100% 贴合地址。
2. 现有规则唯一需要修正的是 **OUTSIDE 漏判 1 条被前缀掩盖的东莞案**(2→3),建议按 8.4 增补整地址扫描。
3. 其余"想多剔"的空间依旧极小;坐标聚合(33.7% 共享坐标)仍建议保留作热力图信号,仅标记/可选降权。
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!