unis-oa/design/index.html

1182 lines
86 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

<!doctype html>
<html lang="zh-CN">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>UnisOA 前端设计稿 · 流程 / 表单 / 单据</title>
<style>
:root{
--primary:#14b8a6; --primary-600:#0d9488; --primary-700:#0f766e; --primary-50:#f0fdfa; --primary-100:#ccfbf1;
--gray-50:#f9fafb; --gray-100:#f3f4f6; --gray-200:#e5e7eb; --gray-300:#d1d5db; --gray-400:#9ca3af;
--gray-500:#6b7280; --gray-600:#4b5563; --gray-700:#374151; --gray-900:#111827;
--emerald:#059669; --emerald-100:#d1fae5; --amber:#d97706; --amber-100:#fef3c7;
--red:#dc2626; --red-100:#fee2e2; --violet:#7c3aed; --blue:#2563eb; --cyan:#0891b2; --indigo:#6366f1;
--card-shadow:0 1px 3px rgba(0,0,0,.04), 0 1px 2px rgba(0,0,0,.06);
}
*{box-sizing:border-box;}
body{margin:0;background:var(--gray-50);color:var(--gray-900);
font:14px/1.55 system-ui,-apple-system,"Segoe UI",Roboto,"PingFang SC","Hiragino Sans GB","Microsoft YaHei",sans-serif;}
svg{display:block;}
/* ---------- 外壳 ---------- */
.shell{display:flex;min-height:100vh;}
.sidebar{width:232px;flex:0 0 232px;background:#fff;border-right:1px solid var(--gray-200);
display:flex;flex-direction:column;position:sticky;top:0;height:100vh;}
.side-head{height:64px;display:flex;align-items:center;gap:12px;padding:0 24px;border-bottom:1px solid var(--gray-100);}
.logo{width:36px;height:36px;border-radius:12px;background:var(--primary-600);color:#fff;font-weight:700;font-size:13px;
display:flex;align-items:center;justify-content:center;box-shadow:0 0 20px rgba(20,184,166,.25);}
.side-title{font-weight:700;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
.side-sub{font-size:11px;color:var(--gray-400);}
.side-nav{flex:1;overflow-y:auto;padding:16px 12px;}
.side-section{margin-bottom:24px;}
.side-section-title{margin:0 12px 8px;font-size:11px;font-weight:600;letter-spacing:.06em;text-transform:uppercase;color:var(--gray-400);}
.side-link{display:flex;align-items:center;gap:12px;padding:10px 17px 10px 17px;border-radius:12px;
color:var(--gray-600);font-weight:500;text-decoration:none;margin-bottom:4px;cursor:pointer;}
.side-link:hover{background:var(--gray-100);color:var(--gray-900);}
.side-link.active{background:var(--primary-50);color:var(--primary-600);}
.side-link .ic{width:20px;height:20px;flex:0 0 20px;}
.side-link .txt{flex:1;white-space:nowrap;overflow:hidden;}
.count{border-radius:999px;background:var(--red);color:#fff;font-size:11px;font-weight:600;line-height:1;padding:3px 6px;}
/* ---------- 顶栏 ---------- */
.main{flex:1;min-width:0;display:flex;flex-direction:column;}
.topbar{height:64px;background:rgba(255,255,255,.85);backdrop-filter:blur(12px);border-bottom:1px solid var(--gray-200);
display:flex;align-items:center;gap:16px;padding:0 32px;position:sticky;top:0;z-index:20;}
.crumb{color:var(--gray-500);font-size:13px;}
.crumb b{color:var(--gray-900);font-weight:600;}
.topbar .spacer{flex:1;}
.avatar{width:32px;height:32px;border-radius:999px;background:var(--primary-100);color:var(--primary-700);
display:flex;align-items:center;justify-content:center;font-size:12px;font-weight:600;}
.content{padding:32px;flex:1;}
/* ---------- 设计稿视图切换 ---------- */
.switcher{position:fixed;right:24px;bottom:24px;z-index:60;background:#fff;border:1px solid var(--gray-200);
border-radius:14px;box-shadow:0 10px 40px rgba(0,0,0,.12);padding:6px;display:flex;gap:4px;}
.switcher button{border:0;background:transparent;border-radius:10px;padding:8px 12px;font:inherit;font-size:12px;
color:var(--gray-600);cursor:pointer;white-space:nowrap;}
.switcher button:hover{background:var(--gray-100);}
.switcher button.on{background:var(--indigo);color:#fff;}
.view{display:none;}
.view.on{display:block;animation:fade .25s ease-out;}
@keyframes fade{from{opacity:0;transform:translateY(6px)}to{opacity:1;transform:none}}
.note{font-size:12px;color:var(--gray-400);border-left:2px solid var(--gray-200);padding-left:10px;margin:0 0 20px;}
/* ---------- 基础件(对齐 style.css) ---------- */
.page-header{margin-bottom:24px;display:flex;align-items:flex-end;gap:16px;}
.page-title{font-size:24px;font-weight:700;margin:0;line-height:1.25;}
.page-description{margin:4px 0 0;font-size:13px;color:var(--gray-500);}
.page-header .spacer{flex:1;}
.btn{display:inline-flex;align-items:center;justify-content:center;gap:8px;white-space:nowrap;border-radius:12px;
padding:10px 16px;font:inherit;font-size:13px;font-weight:500;border:1px solid transparent;cursor:pointer;}
.btn:disabled{opacity:.5;cursor:not-allowed;}
.btn-primary{background:linear-gradient(90deg,var(--primary),var(--primary-600));color:#fff;
box-shadow:0 4px 12px rgba(20,184,166,.25);}
.btn-primary:hover{background:linear-gradient(90deg,var(--primary-600),var(--primary-700));}
.btn-secondary{background:#fff;color:var(--gray-700);border-color:var(--gray-200);box-shadow:0 1px 2px rgba(0,0,0,.05);}
.btn-secondary:hover{background:var(--gray-50);border-color:var(--gray-300);}
.btn-ghost{background:transparent;color:var(--gray-600);}
.btn-ghost:hover{background:var(--gray-100);}
.btn-danger{background:linear-gradient(90deg,#ef4444,var(--red));color:#fff;box-shadow:0 4px 12px rgba(220,38,38,.22);}
.btn-success{background:linear-gradient(90deg,#10b981,var(--emerald));color:#fff;}
.btn-sm{padding:6px 12px;font-size:12px;border-radius:10px;}
.btn-icon{padding:8px;border-radius:10px;}
.card{background:#fff;border-radius:16px;border:1px solid var(--gray-100);box-shadow:var(--card-shadow);}
.card-header{border-bottom:1px solid var(--gray-100);padding:16px 24px;display:flex;align-items:center;gap:12px;}
.card-body{padding:24px;}
.card-title{font-size:15px;font-weight:600;margin:0;}
.badge{display:inline-flex;align-items:center;gap:4px;border-radius:999px;padding:2px 10px;font-size:12px;font-weight:500;}
.badge-primary{background:var(--primary-100);color:var(--primary-700);}
.badge-success{background:var(--emerald-100);color:#047857;}
.badge-warning{background:var(--amber-100);color:#b45309;}
.badge-danger{background:var(--red-100);color:#b91c1c;}
.badge-gray{background:var(--gray-100);color:var(--gray-700);}
.badge-purple{background:#ede9fe;color:#6d28d9;}
.input-label{display:block;margin:0 0 6px;font-size:13px;font-weight:500;color:var(--gray-700);}
.input-hint{margin-top:4px;font-size:12px;color:var(--gray-500);}
.input{width:100%;border-radius:12px;padding:10px 16px;font:inherit;font-size:13px;background:#fff;
border:1px solid var(--gray-200);color:var(--gray-900);}
.input:focus{outline:none;border-color:var(--primary);box-shadow:0 0 0 3px rgba(20,184,166,.25);}
.table{width:100%;border-collapse:collapse;font-size:13px;}
.table th{text-align:left;font-weight:500;color:var(--gray-600);background:var(--gray-50);
padding:12px 16px;border-bottom:1px solid var(--gray-200);white-space:nowrap;}
.table td{padding:12px 16px;color:var(--gray-700);border-bottom:1px solid var(--gray-100);}
.table tbody tr:last-child td{border-bottom:0;}
.table tbody tr:hover{background:var(--gray-50);}
.tabs{display:flex;gap:4px;padding:4px;border-radius:12px;background:var(--gray-100);width:max-content;}
.tab{border:0;background:transparent;font:inherit;font-size:13px;font-weight:500;color:var(--gray-600);
border-radius:10px;padding:8px 16px;cursor:pointer;display:inline-flex;align-items:center;gap:6px;}
.tab:hover{color:var(--gray-900);}
.tab.active{background:#fff;color:var(--gray-900);box-shadow:0 1px 2px rgba(0,0,0,.06);}
.tab .n{font-size:11px;color:var(--gray-400);font-variant-numeric:tabular-nums;}
.dot{display:inline-block;width:8px;height:8px;border-radius:999px;}
.tool-btn{border:0;background:transparent;border-radius:9px;padding:6px;color:var(--gray-600);cursor:pointer;
display:inline-flex;align-items:center;justify-content:center;font:inherit;}
.tool-btn:hover:not(:disabled){background:var(--gray-100);color:var(--gray-900);}
.tool-btn:disabled{opacity:.4;cursor:not-allowed;}
.tool-btn.on{color:var(--indigo);}
.tool-group{display:flex;align-items:center;gap:2px;border:1px solid var(--gray-200);border-radius:12px;padding:2px;}
.tool-sep{width:1px;height:16px;background:var(--gray-200);margin:0 2px;}
.seg{border:0;background:transparent;font:inherit;font-size:11px;font-weight:500;color:var(--gray-600);
padding:6px 8px;border-radius:9px;cursor:pointer;}
.seg.on{background:var(--indigo);color:#fff;}
.zoom-read{font-size:11px;color:var(--gray-500);min-width:34px;text-align:center;font-variant-numeric:tabular-nums;}
.empty{padding:56px 24px;text-align:center;}
.empty-ic{width:80px;height:80px;margin:0 auto 20px;border-radius:16px;background:var(--gray-100);
display:flex;align-items:center;justify-content:center;color:var(--gray-400);}
.empty-title{font-size:15px;font-weight:600;margin:0 0 6px;}
.empty-desc{font-size:13px;color:var(--gray-500);margin:0 0 24px;}
.ic{width:18px;height:18px;stroke:currentColor;fill:none;stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round;}
</style>
<style>
/* ---------- 布局辅助 ---------- */
.grid{display:grid;gap:24px;}
.g4{grid-template-columns:repeat(4,minmax(0,1fr));}
.g3{grid-template-columns:repeat(3,minmax(0,1fr));}
.g2-1{grid-template-columns:minmax(0,2fr) minmax(0,1fr);}
.row{display:flex;align-items:center;gap:12px;}
.wrap{flex-wrap:wrap;}
.sp{flex:1;}
.stack{display:flex;flex-direction:column;gap:12px;}
.muted{color:var(--gray-500);}
.tiny{font-size:11px;}
.num{font-variant-numeric:tabular-nums;}
@media (max-width:1180px){.g4{grid-template-columns:repeat(2,minmax(0,1fr));}.g3,.g2-1{grid-template-columns:minmax(0,1fr);}}
/* ---------- 工作台 ---------- */
.stat-card{display:flex;gap:16px;align-items:flex-start;padding:20px;}
.stat-icon{width:44px;height:44px;border-radius:14px;display:flex;align-items:center;justify-content:center;flex:0 0 44px;}
.si-primary{background:var(--primary-50);color:var(--primary-600);}
.si-warning{background:var(--amber-100);color:var(--amber);}
.si-success{background:var(--emerald-100);color:var(--emerald);}
.si-danger{background:var(--red-100);color:var(--red);}
.stat-value{font-size:26px;font-weight:700;line-height:1.1;font-variant-numeric:tabular-nums;}
.stat-label{font-size:12px;color:var(--gray-500);margin-top:2px;}
.stat-trend{margin-top:10px;font-size:11px;color:var(--gray-500);}
.tile{padding:16px;border-radius:14px;border:1px solid var(--gray-100);background:#fff;cursor:pointer;
display:flex;gap:12px;align-items:flex-start;box-shadow:var(--card-shadow);}
.tile:hover{border-color:var(--gray-300);}
.tile-ic{width:34px;height:34px;border-radius:10px;background:var(--primary-50);color:var(--primary-600);
display:flex;align-items:center;justify-content:center;flex:0 0 34px;}
.tile b{display:block;font-size:13px;font-weight:600;}
.tile span{font-size:11px;color:var(--gray-500);}
.feed{display:flex;gap:12px;padding:14px 0;border-bottom:1px solid var(--gray-100);}
.feed:last-child{border-bottom:0;}
.feed-ic{width:30px;height:30px;flex:0 0 30px;border-radius:10px;background:var(--gray-100);color:var(--gray-600);
display:flex;align-items:center;justify-content:center;}
/* ---------- 流程画布 ---------- */
.designer{height:calc(100vh - 64px - 64px - 96px);min-height:620px;display:flex;flex-direction:column;gap:12px;}
.canvas-shell{flex:1;min-height:0;display:flex;gap:12px;}
.palette{width:212px;flex:0 0 212px;background:#fff;border:1px solid var(--gray-100);border-radius:16px;
box-shadow:var(--card-shadow);padding:14px;overflow-y:auto;}
.pal-title{font-size:11px;font-weight:600;letter-spacing:.06em;text-transform:uppercase;color:var(--gray-400);margin:0 0 8px;}
.pal-item{display:flex;align-items:center;gap:10px;padding:8px 10px;border-radius:10px;font-size:13px;color:var(--gray-700);
border:1px dashed var(--gray-200);margin-bottom:6px;cursor:grab;background:#fff;}
.pal-item:hover{border-color:var(--primary);background:var(--primary-50);}
.pal-swatch{width:10px;height:10px;border-radius:3px;flex:0 0 10px;}
.canvas{flex:1;min-width:0;position:relative;background:#fff;border:1px solid var(--gray-100);border-radius:16px;
box-shadow:var(--card-shadow);overflow:hidden;}
.canvas-scroll{position:absolute;inset:0;overflow:auto;}
.canvas-grid{position:relative;width:1422px;height:512px;
background-image:radial-gradient(circle,rgba(148,163,184,.32) 1px,transparent 1px);background-size:24px 24px;}
.edges{position:absolute;inset:0;width:1422px;height:512px;pointer-events:none;}
/* 开放折线默认会被当成闭合形状填充,命中区必须显式不填充 */
.edges path{fill:none;}
.edges path.hit{stroke:transparent;stroke-width:18;pointer-events:stroke;cursor:pointer;}
.edges path.line{fill:none;stroke:#94a3b8;stroke-width:1.6;transition:opacity .16s linear;}
.edges g.edge{transition:opacity .16s linear;}
.edges g.edge.back path.line{stroke:var(--red);stroke-dasharray:5 4;}
.edges g.edge.used path.line{stroke:#059669;}
.edges g.edge.lit path.line{stroke:var(--indigo);stroke-width:2.4;}
.edges g.edge.dim{opacity:.5;}
.edge-label{position:absolute;transform:translate(-50%,-50%);background:#fff;border:1px solid var(--gray-200);
border-radius:8px;padding:2px 7px;font-size:11px;color:var(--gray-600);white-space:nowrap;box-shadow:0 1px 2px rgba(0,0,0,.05);
font-variant-numeric:tabular-nums;}
.edge-label.back{color:#b91c1c;border-color:#fecaca;}
.edge-label code{font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:10px;color:var(--gray-500);}
.lean .edge-label.opt{display:none;}
.node{position:absolute;width:160px;height:68px;background:#fff;border:1px solid var(--gray-200);border-radius:12px;
box-shadow:0 1px 3px rgba(0,0,0,.06);padding:8px 10px 8px 14px;cursor:pointer;overflow:hidden;
transition:opacity .16s linear,box-shadow .16s ease,border-color .16s ease;}
.node:before{content:"";position:absolute;left:0;top:0;bottom:0;width:3px;background:var(--n);}
.node:hover{border-color:var(--gray-300);box-shadow:0 6px 20px rgba(0,0,0,.08);}
.node.dim{opacity:.45;}
.node.lit{border-color:var(--indigo);box-shadow:0 0 0 2px rgba(99,102,241,.25),0 6px 20px rgba(0,0,0,.08);}
.node-top{display:flex;align-items:center;gap:6px;}
.node-type{width:16px;height:16px;flex:0 0 16px;color:var(--n);stroke:currentColor;fill:none;
stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round;}
.node-kind{font-size:10px;font-weight:600;letter-spacing:.04em;text-transform:uppercase;color:var(--n);}
.node-mode{margin-left:auto;font-size:10px;color:var(--gray-500);background:var(--gray-100);border-radius:6px;padding:1px 5px;}
.node-name{margin-top:3px;font-size:12.5px;font-weight:600;color:var(--gray-900);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
.node-meta{margin-top:5px;display:flex;gap:4px;align-items:center;flex-wrap:wrap;max-height:20px;overflow:hidden;}
.chip{font-size:10px;line-height:1;padding:3px 6px;border-radius:6px;background:var(--gray-100);color:var(--gray-600);
display:inline-flex;align-items:center;gap:3px;}
.chip.round{background:var(--amber-100);color:#b45309;}
.legend{position:absolute;left:16px;bottom:14px;display:flex;gap:14px;align-items:center;background:rgba(255,255,255,.92);
border:1px solid var(--gray-200);border-radius:10px;padding:7px 12px;font-size:11px;color:var(--gray-600);}
.hintbar{position:absolute;left:16px;bottom:14px;background:rgba(17,24,39,.86);color:#fff;font-size:11px;
border-radius:10px;padding:7px 12px;}
.minimap{position:absolute;right:16px;bottom:14px;width:168px;height:64px;background:rgba(255,255,255,.92);
border:1px solid var(--gray-200);border-radius:10px;}
.minimap i{position:absolute;background:var(--gray-300);border-radius:2px;}
/* ---------- 属性面板 ---------- */
.inspector{width:352px;flex:0 0 352px;background:#fff;border:1px solid var(--gray-100);border-radius:16px;
box-shadow:var(--card-shadow);display:flex;flex-direction:column;}
.insp-head{padding:14px 16px;border-bottom:1px solid var(--gray-100);display:flex;align-items:center;gap:8px;}
.insp-body{padding:16px;overflow-y:auto;flex:1;}
.insp-foot{padding:12px 16px;border-top:1px solid var(--gray-100);display:flex;gap:8px;}
.sec{margin-bottom:20px;}
.sec-title{font-size:11px;font-weight:600;letter-spacing:.06em;text-transform:uppercase;color:var(--gray-400);margin:0 0 10px;}
.field{margin-bottom:12px;}
.switch{width:44px;height:24px;border-radius:999px;background:var(--gray-300);position:relative;cursor:pointer;transition:background .2s;}
.switch:after{content:"";position:absolute;top:2px;left:2px;width:20px;height:20px;border-radius:999px;background:#fff;
box-shadow:0 1px 2px rgba(0,0,0,.2);transition:transform .2s;}
.switch.on{background:var(--primary);}
.switch.on:after{transform:translateX(20px);}
.builder{border:1px solid var(--gray-200);border-radius:12px;background:var(--gray-50);padding:12px;}
.rule{display:grid;grid-template-columns:minmax(0,1fr) 76px minmax(0,1fr) 24px;gap:6px;margin-bottom:6px;align-items:center;}
.rule select,.rule input{padding:7px 8px !important;font-size:12px;}
.code{font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:11px;background:#0f172a;color:#e2e8f0;
border-radius:10px;padding:10px 12px;overflow-x:auto;white-space:pre;}
/* ---------- 表单设计器 ---------- */
.sheet{flex:1;min-width:0;background:#fff;border:1px solid var(--gray-100);border-radius:16px;box-shadow:var(--card-shadow);
display:flex;flex-direction:column;overflow:hidden;}
.sheet-scroll{flex:1;overflow-y:auto;padding:20px;}
.sheet-grid{display:grid;grid-template-columns:repeat(12,minmax(0,1fr));gap:12px;position:relative;}
.slot{border:1px solid var(--gray-200);border-radius:12px;padding:10px 12px;background:#fff;position:relative;}
.slot.sel{border-color:var(--indigo);box-shadow:0 0 0 2px rgba(99,102,241,.22);}
.slot.dash{border-style:dashed;background:var(--gray-50);display:flex;align-items:center;justify-content:center;
color:var(--gray-400);font-size:12px;min-height:74px;}
.slot-tag{position:absolute;top:-8px;left:8px;background:var(--primary-50);color:var(--primary-600);
border:1px solid var(--primary-100);border-radius:6px;padding:1px 6px;font-size:10px;font-variant-numeric:tabular-nums;}
.slot.sel .slot-tag{background:#eef2ff;color:var(--indigo);border-color:#e0e7ff;}
.c3{grid-column:span 3;}.c4{grid-column:span 4;}.c6{grid-column:span 6;}.c8{grid-column:span 8;}.c12{grid-column:span 12;}
.fake{border:1px solid var(--gray-200);border-radius:10px;padding:8px 12px;font-size:13px;color:var(--gray-400);background:#fff;}
.casc{display:flex;gap:6px;flex-wrap:wrap;}
.casc .step{flex:1;min-width:120px;border:1px solid var(--gray-200);border-radius:10px;padding:8px 10px;font-size:12px;
background:#fff;display:flex;align-items:center;gap:6px;color:var(--gray-700);}
.casc .step.pick{border-color:var(--primary);color:var(--primary-700);background:var(--primary-50);}
.casc .step.add{border-style:dashed;color:var(--gray-400);justify-content:center;}
/* ---------- 单据详情 ---------- */
.kv{display:grid;grid-template-columns:104px minmax(0,1fr);gap:8px 12px;font-size:13px;}
.kv dt{color:var(--gray-500);}
.kv dd{margin:0;color:var(--gray-900);}
.pane{display:none;}
.pane.on{display:block;}
.tl{position:relative;padding-left:26px;}
.tl:before{content:"";position:absolute;left:8px;top:6px;bottom:6px;width:2px;background:var(--gray-200);}
.tl-item{position:relative;padding:0 0 20px;}
.tl-item:before{content:"";position:absolute;left:-22px;top:4px;width:12px;height:12px;border-radius:999px;
background:#fff;border:2px solid var(--gray-300);}
.tl-item.ok:before{border-color:var(--emerald);background:var(--emerald);}
.tl-item.no:before{border-color:var(--red);background:var(--red);}
.tl-item.now:before{border-color:var(--primary);background:var(--primary);box-shadow:0 0 0 4px rgba(20,184,166,.18);}
.tl-h{display:flex;align-items:center;gap:8px;font-weight:600;font-size:13px;}
.tl-b{font-size:12px;color:var(--gray-500);margin-top:2px;}
.mini-legend{display:flex;gap:14px;flex-wrap:wrap;font-size:11px;color:var(--gray-500);}
</style>
</head>
<body>
<svg width="0" height="0" style="position:absolute" aria-hidden="true"><defs>
<symbol id="i-home" viewBox="0 0 24 24"><path d="M3 10.5 12 3l9 7.5M5 9.8V21h14V9.8"/></symbol>
<symbol id="i-grid" viewBox="0 0 24 24"><path d="M4 4h7v7H4zM13 4h7v7h-7zM4 13h7v7H4zM13 13h7v7h-7z"/></symbol>
<symbol id="i-plus" viewBox="0 0 24 24"><path d="M12 5v14M5 12h14"/></symbol>
<symbol id="i-inbox" viewBox="0 0 24 24"><path d="M4 13V6a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2v7m-16 0H4a2 2 0 0 0-2 2v4h4l2 2h8l2-2h4v-4a2 2 0 0 0-2-2m-16 0h4l2 2h4l2-2h4"/></symbol>
<symbol id="i-check" viewBox="0 0 24 24"><path d="M20 6 9 17l-5-5"/></symbol>
<symbol id="i-circle-check" viewBox="0 0 24 24"><path d="M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0z"/><path d="m8.5 12.2 2.4 2.4 4.6-4.7"/></symbol>
<symbol id="i-doc" viewBox="0 0 24 24"><path d="M14 3H7a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V8l-5-5zM14 3v5h5"/></symbol>
<symbol id="i-mail" viewBox="0 0 24 24"><path d="M3 6h18v12H3zM3 7l9 6 9-6"/></symbol>
<symbol id="i-clipboard" viewBox="0 0 24 24"><path d="M9 4h6v3H9zM7 5H6a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7a2 2 0 0 0-2-2h-1"/></symbol>
<symbol id="i-sync" viewBox="0 0 24 24"><path d="M4 12a8 8 0 0 1 13.7-5.7L20 8M20 12a8 8 0 0 1-13.7 5.7L4 16M20 4v4h-4M4 20v-4h4"/></symbol>
<symbol id="i-cube" viewBox="0 0 24 24"><path d="m12 3 8 4.5v9L12 21l-8-4.5v-9L12 3zM4 7.5l8 4.5 8-4.5M12 12v9"/></symbol>
<symbol id="i-list" viewBox="0 0 24 24"><path d="M8 6h13M8 12h13M8 18h13M3.5 6h.01M3.5 12h.01M3.5 18h.01"/></symbol>
<symbol id="i-badge" viewBox="0 0 24 24"><path d="M12 3 4 7v5c0 4.5 3.4 8.3 8 9 4.6-.7 8-4.5 8-9V7l-8-4z"/></symbol>
<symbol id="i-users" viewBox="0 0 24 24"><path d="M16 20v-2a4 4 0 0 0-4-4H7a4 4 0 0 0-4 4v2M12.5 7.5a3.5 3.5 0 1 1-7 0 3.5 3.5 0 0 1 7 0zM21 20v-2a4 4 0 0 0-3-3.9M16.5 4.1a4 4 0 0 1 0 6.8"/></symbol>
<symbol id="i-user" viewBox="0 0 24 24"><path d="M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2M16 7.5a4 4 0 1 1-8 0 4 4 0 0 1 8 0z"/></symbol>
<symbol id="i-shield" viewBox="0 0 24 24"><path d="M12 3 5 6.5V12c0 4.2 3 7.7 7 8.7 4-1 7-4.5 7-8.7V6.5L12 3z"/></symbol>
<symbol id="i-key" viewBox="0 0 24 24"><path d="M15 7.5a4.5 4.5 0 1 1-6 4.2M9 13l-5 5v3h3l1-1v-2h2v-2h1.5l1.5-1.5"/></symbol>
<symbol id="i-eye" viewBox="0 0 24 24"><path d="M2 12s3.6-6.5 10-6.5S22 12 22 12s-3.6 6.5-10 6.5S2 12 2 12z"/><path d="M15 12a3 3 0 1 1-6 0 3 3 0 0 1 6 0z"/></symbol>
<symbol id="i-chart" viewBox="0 0 24 24"><path d="M4 20h16M7 20V10M12 20V4M17 20v-7"/></symbol>
<symbol id="i-cog" viewBox="0 0 24 24"><path d="M12 15.5a3.5 3.5 0 1 0 0-7 3.5 3.5 0 0 0 0 7z"/><path d="M19.4 15a7.7 7.7 0 0 0 0-6l2-1.2-2-3.4-2.2 1a7.7 7.7 0 0 0-5.2-3l-.3-2.4h-4l-.3 2.4a7.7 7.7 0 0 0-5.2 3l-2.2-1-2 3.4L2.6 9a7.7 7.7 0 0 0 0 6L.6 16.2l2 3.4 2.2-1a7.7 7.7 0 0 0 5.2 3l.3 2.4h4l.3-2.4"/></symbol>
<symbol id="i-swap" viewBox="0 0 24 24"><path d="M7 4 3 8l4 4M3 8h13M17 20l4-4-4-4M21 16H8"/></symbol>
<symbol id="i-search" viewBox="0 0 24 24"><path d="M20 20l-4.5-4.5M17 10.5a6.5 6.5 0 1 1-13 0 6.5 6.5 0 0 1 13 0z"/></symbol>
<symbol id="i-download" viewBox="0 0 24 24"><path d="M12 4v11m0 0 4-4m-4 4-4-4M4 19h16"/></symbol>
<symbol id="i-print" viewBox="0 0 24 24"><path d="M7 9V4h10v5M7 18H5a2 2 0 0 1-2-2v-4a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2h-2M7 14h10v6H7z"/></symbol>
<symbol id="i-save" viewBox="0 0 24 24"><path d="M5 4h11l3 3v13H5zM8 4v6h8V4M8 20v-6h8v6"/></symbol>
<symbol id="i-undo" viewBox="0 0 24 24"><path d="M4 10h9a5 5 0 0 1 0 10H8M4 10l4-4M4 10l4 4"/></symbol>
<symbol id="i-redo" viewBox="0 0 24 24"><path d="M20 10h-9a5 5 0 0 0 0 10h5M20 10l-4-4M20 10l-4 4"/></symbol>
<symbol id="i-sparkles" viewBox="0 0 24 24"><path d="m12 3 1.8 4.7L18.5 9.5l-4.7 1.8L12 16l-1.8-4.7L5.5 9.5l4.7-1.8L12 3zM18 16l.9 2.1 2.1.9-2.1.9L18 22l-.9-2.1-2.1-.9 2.1-.9L18 16z"/></symbol>
<symbol id="i-tag" viewBox="0 0 24 24"><path d="M3 12.5V5a2 2 0 0 1 2-2h7.5L21 11.5 13.5 19 3 12.5zM7.5 7.5h.01"/></symbol>
<symbol id="i-branch" viewBox="0 0 24 24"><path d="M6 4v10a4 4 0 0 0 4 4h8M6 4a2 2 0 1 0 0 .01M18 18a2 2 0 1 0 0-.01M14 14l4 4-4 4"/></symbol>
<symbol id="i-clock" viewBox="0 0 24 24"><path d="M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0zM12 7v5.5l3.5 2"/></symbol>
<symbol id="i-arrow-left" viewBox="0 0 24 24"><path d="M19 12H5m0 0 6-6m-6 6 6 6"/></symbol>
<symbol id="i-bell" viewBox="0 0 24 24"><path d="M18 9a6 6 0 1 0-12 0c0 5-2 6-2 6h16s-2-1-2-6M13.7 21a2 2 0 0 1-3.4 0"/></symbol>
<symbol id="i-comment" viewBox="0 0 24 24"><path d="M21 12a8 8 0 0 1-8 8H8l-5 3 1.5-4.5A8 8 0 1 1 21 12z"/></symbol>
<symbol id="i-flag" viewBox="0 0 24 24"><path d="M5 21V4m0 0h11l-2 4 2 4H5"/></symbol>
<symbol id="i-expand" viewBox="0 0 24 24"><path d="M4 9V4h5M20 9V4h-5M4 15v5h5M20 15v5h-5"/></symbol>
<symbol id="i-play" viewBox="0 0 24 24"><path d="M7 4.5v15l12-7.5L7 4.5z"/></symbol>
<symbol id="i-route" viewBox="0 0 24 24"><path d="M6 19a3 3 0 1 0 0-6h6a3 3 0 1 0 0-6M6 5v8"/></symbol>
<symbol id="i-merge" viewBox="0 0 24 24"><path d="M6 4v5a4 4 0 0 0 4 4h8M6 20v-5a4 4 0 0 1 4-4h8M18 13l3-2.5-3-2.5M18 18l3-2.5-3-2.5"/></symbol>
<symbol id="i-code" viewBox="0 0 24 24"><path d="m9 8-4 4 4 4M15 8l4 4-4 4"/></symbol>
<symbol id="i-send" viewBox="0 0 24 24"><path d="m4 12 16-7-6 16-2.5-6.5L4 12z"/></symbol>
</defs></svg>
<div class="shell">
<aside class="sidebar">
<div class="side-head">
<div class="logo">OA</div>
<div style="min-width:0;flex:1">
<div class="side-title">优内 OA</div>
<div class="side-sub">流程与协同办公</div>
</div>
</div>
<nav class="side-nav">
<div class="side-section">
<div class="side-section-title">办公中心</div>
<a class="side-link" data-go="home"><svg class="ic"><use href="#i-home"/></svg><span class="txt">门户首页</span></a>
<a class="side-link active" data-go="home"><svg class="ic"><use href="#i-grid"/></svg><span class="txt">工作台</span></a>
<a class="side-link"><svg class="ic"><use href="#i-plus"/></svg><span class="txt">发起流程</span></a>
<a class="side-link"><svg class="ic"><use href="#i-inbox"/></svg><span class="txt">我的待办</span><span class="count">6</span></a>
<a class="side-link"><svg class="ic"><use href="#i-circle-check"/></svg><span class="txt">我的已办</span></a>
<a class="side-link" data-go="detail"><svg class="ic"><use href="#i-doc"/></svg><span class="txt">我发起的</span></a>
<a class="side-link"><svg class="ic"><use href="#i-mail"/></svg><span class="txt">抄送我的</span></a>
<a class="side-link"><svg class="ic"><use href="#i-clipboard"/></svg><span class="txt">草稿箱</span></a>
</div>
<div class="side-section">
<div class="side-section-title">系统管理</div>
<a class="side-link" data-go="flow"><svg class="ic"><use href="#i-sync"/></svg><span class="txt">流程设计</span></a>
<a class="side-link" data-go="form"><svg class="ic"><use href="#i-cube"/></svg><span class="txt">表单设计</span></a>
<a class="side-link"><svg class="ic"><use href="#i-list"/></svg><span class="txt">字典设计</span></a>
<a class="side-link"><svg class="ic"><use href="#i-users"/></svg><span class="txt">组织架构</span></a>
<a class="side-link"><svg class="ic"><use href="#i-shield"/></svg><span class="txt">角色权限</span></a>
<a class="side-link"><svg class="ic"><use href="#i-eye"/></svg><span class="txt">流程监控</span></a>
</div>
<div class="side-section">
<div class="side-section-title">个人中心</div>
<a class="side-link"><svg class="ic"><use href="#i-swap"/></svg><span class="txt">审批代理</span></a>
<a class="side-link"><svg class="ic"><use href="#i-user"/></svg><span class="txt">个人资料</span></a>
</div>
</nav>
<div style="border-top:1px solid var(--gray-100);padding:12px">
<a class="side-link" style="margin:0"><svg class="ic"><use href="#i-cog"/></svg><span class="txt">收起菜单</span></a>
</div>
</aside>
<div class="main">
<header class="topbar">
<div class="crumb" id="crumb">办公中心 / 工作台</div>
<div class="spacer"></div>
<button class="btn btn-ghost btn-icon" title="搜索"><svg class="ic"><use href="#i-search"/></svg></button>
<button class="btn btn-ghost btn-icon" title="通知"><svg class="ic"><use href="#i-bell"/></svg></button>
<div class="avatar" title="系统管理员">管</div>
</header>
<div class="content">
<!-- ======================= 视图 1:工作台 ======================= -->
<section class="view on" id="v-home">
<div class="page-header">
<div>
<h1 class="page-title">工作台</h1>
<p class="page-description">早上好,系统管理员。今天有 6 条待办,其中 1 条已超时。</p>
</div>
<div class="spacer"></div>
<button class="btn btn-secondary"><svg class="ic"><use href="#i-print"/></svg>打印待办清单</button>
<button class="btn btn-primary"><svg class="ic"><use href="#i-plus"/></svg>发起流程</button>
</div>
<p class="note">页面骨架:页头(标题 + 一句副标题 + 主动作)→ 统计带 → 双栏内容。主色只出现在唯一的主动作按钮上,其余都是次级动作。</p>
<div class="grid g4" style="margin-bottom:24px">
<div class="card stat-card">
<div class="stat-icon si-primary"><svg class="ic" style="width:22px;height:22px"><use href="#i-inbox"/></svg></div>
<div><div class="stat-value">6</div><div class="stat-label">待我审批</div>
<div class="stat-trend">较昨日 <span style="color:var(--emerald)">+2</span></div></div>
</div>
<div class="card stat-card">
<div class="stat-icon si-danger"><svg class="ic" style="width:22px;height:22px"><use href="#i-clock"/></svg></div>
<div><div class="stat-value">1</div><div class="stat-label">已超时待办</div>
<div class="stat-trend">采购部 · 停留 3 天 4 小时</div></div>
</div>
<div class="card stat-card">
<div class="stat-icon si-warning"><svg class="ic" style="width:22px;height:22px"><use href="#i-sync"/></svg></div>
<div><div class="stat-value">14</div><div class="stat-label">在途单据</div>
<div class="stat-trend">其中 3 条等待并联复核</div></div>
</div>
<div class="card stat-card">
<div class="stat-icon si-success"><svg class="ic" style="width:22px;height:22px"><use href="#i-circle-check"/></svg></div>
<div><div class="stat-value">92<span style="font-size:15px">%</span></div><div class="stat-label">本月按期办结率</div>
<div class="stat-trend">平均耗时 1.8 天</div></div>
</div>
</div>
<div class="grid g2-1">
<div class="card">
<div class="card-header">
<h2 class="card-title">待我审批</h2>
<span class="badge badge-gray num">6</span>
<div class="sp"></div>
<div class="tabs">
<button class="tab active">全部<span class="n num">6</span></button>
<button class="tab">超时<span class="n num">1</span></button>
<button class="tab">今天到期待<span class="n num">2</span></button>
</div>
<button class="btn btn-secondary btn-sm"><svg class="ic"><use href="#i-check"/></svg>批量同意</button>
</div>
<table class="table">
<thead><tr><th>单据</th><th>流程</th><th>发起人</th><th>当前环节</th><th>金额</th><th>到达时间</th><th></th></tr></thead>
<tbody>
<tr>
<td><a href="#" style="color:var(--primary-700);font-weight:500;text-decoration:none" data-go="detail">采购申请 · 笔记本电脑 12 台</a></td>
<td>演示流程-直角连线</td><td>张三</td>
<td><span class="badge badge-primary">总经理审批</span></td>
<td class="num">¥ 86,400.00</td><td class="muted num">09-15 08:12</td>
<td style="text-align:right"><button class="btn btn-secondary btn-sm">去办理</button></td>
</tr>
<tr>
<td><a href="#" style="color:var(--primary-700);font-weight:500;text-decoration:none">采购申请 · 会议室家具</a></td>
<td>演示流程-直角连线</td><td>李四</td>
<td><span class="badge badge-warning">复核汇聚 1/2</span></td>
<td class="num">¥ 23,800.00</td><td class="muted num">09-12 17:40</td>
<td style="text-align:right"><button class="btn btn-secondary btn-sm">去办理</button></td>
</tr>
<tr>
<td><a href="#" style="color:var(--primary-700);font-weight:500;text-decoration:none">采购申请 · 显示器 4 台</a></td>
<td>演示流程-直角连线</td><td>王五</td>
<td><span class="badge badge-danger">退回至起草确认</span></td>
<td class="num">¥ 9,200.00</td><td class="muted num" style="color:var(--red)">09-11 09:05 · 超时</td>
<td style="text-align:right"><button class="btn btn-secondary btn-sm">去办理</button></td>
</tr>
<tr>
<td><a href="#" style="color:var(--primary-700);font-weight:500;text-decoration:none">请假申请 · 年假 3 天</a></td>
<td>标准请假流程</td><td>赵六</td>
<td><span class="badge badge-primary">部门初审</span></td>
<td class="muted">—</td><td class="muted num">09-14 14:22</td>
<td style="text-align:right"><button class="btn btn-secondary btn-sm">去办理</button></td>
</tr>
</tbody>
</table>
<div class="row" style="padding:12px 16px;border-top:1px solid var(--gray-100)">
<span class="muted tiny">第 1/2 页,共 6 条</span><div class="sp"></div>
<button class="btn btn-secondary btn-sm">上一页</button><button class="btn btn-secondary btn-sm">下一页</button>
</div>
</div>
<div class="stack" style="gap:24px">
<div class="card">
<div class="card-header"><h2 class="card-title">常用发起</h2></div>
<div class="card-body grid" style="grid-template-columns:1fr 1fr;gap:12px;padding:16px">
<div class="tile"><div class="tile-ic"><svg class="ic"><use href="#i-doc"/></svg></div><div><b>采购申请</b><span>3 个必填项</span></div></div>
<div class="tile"><div class="tile-ic"><svg class="ic"><use href="#i-clock"/></svg></div><div><b>请假申请</b><span>自动算天数</span></div></div>
<div class="tile"><div class="tile-ic"><svg class="ic"><use href="#i-users"/></svg></div><div><b>用章申请</b><span>需附件</span></div></div>
<div class="tile"><div class="tile-ic"><svg class="ic"><use href="#i-send"/></svg></div><div><b>出差报销</b><span>关联出差单</span></div></div>
</div>
</div>
<div class="card">
<div class="card-header"><h2 class="card-title">我的动态</h2></div>
<div class="card-body" style="padding:8px 24px">
<div class="feed"><div class="feed-ic"><svg class="ic"><use href="#i-circle-check"/></svg></div>
<div><div style="font-weight:500">你同意了「办公用品采购」</div><div class="tiny muted">12 分钟前 · 意见:同意,走年度框架协议</div></div></div>
<div class="feed"><div class="feed-ic"><svg class="ic"><use href="#i-branch"/></svg></div>
<div><div style="font-weight:500">「会议室家具」进入复核汇聚,已得 1/2 票</div><div class="tiny muted">1 小时前</div></div></div>
<div class="feed"><div class="feed-ic"><svg class="ic"><use href="#i-flag"/></svg></div>
<div><div style="font-weight:500">「显示器 4 台」被退回至起草确认</div><div class="tiny muted">昨天 16:30 · 第 2 轮</div></div></div>
</div>
</div>
<div class="card">
<div class="card-body">
<div class="row" style="align-items:flex-start"><div class="feed-ic"><svg class="ic"><use href="#i-flag"/></svg></div>
<div><div style="font-weight:500;font-size:13px">代理生效中</div>
<div class="tiny muted">09-18 至 09-20 期间待办转给「李四」,逾期自动提醒。</div></div>
<button class="btn btn-ghost btn-sm">管理</button></div>
</div>
</div>
</div>
</div>
</section>
<!-- ======================= 视图 2:流程设计器 ======================= -->
<section class="view" id="v-flow">
<div class="card" style="padding:10px 12px;margin-bottom:12px;display:flex;align-items:center;gap:12px;flex-wrap:wrap">
<div class="row" style="min-width:0;gap:12px">
<button class="btn btn-ghost btn-sm" data-go="home"><svg class="ic"><use href="#i-arrow-left"/></svg></button>
<div style="min-width:0">
<div class="row" style="gap:8px">
<h2 style="margin:0;font-size:15px;font-weight:600;max-width:38vw;overflow:hidden;text-overflow:ellipsis;white-space:nowrap">演示流程-直角连线</h2>
<span class="badge badge-success">已发布</span><span class="badge badge-primary">v4</span>
<span class="tiny" style="color:var(--amber)"><span class="dot" style="background:var(--amber)"></span> 有未保存改动</span>
</div>
<p class="tiny muted" style="margin:2px 0 0">拖动环节摆放,从右侧圆点拖到目标环节连线。悬浮或点选环节可只看与它相关的线。</p>
</div>
</div>
<div class="sp"></div>
<div class="row" style="gap:6px;flex-wrap:wrap">
<div class="tool-group">
<button class="tool-btn" title="撤销" disabled><svg class="ic"><use href="#i-undo"/></svg></button>
<button class="tool-btn" title="重做"><svg class="ic"><use href="#i-redo"/></svg></button>
<span class="tool-sep"></span>
<button class="tool-btn on" title="对齐网格"><svg class="ic"><use href="#i-grid"/></svg></button>
<button class="tool-btn" title="自动排版"><svg class="ic"><use href="#i-sparkles"/></svg></button>
</div>
<div class="tool-group" title="连线样式">
<button class="seg on" data-edge="ortho">直角线</button>
<button class="seg" data-edge="straight">斜线</button>
<button class="seg" data-edge="curve">曲线</button>
<span class="tool-sep"></span>
<button class="tool-btn on" id="radius-btn" title="拐角圆角"><svg class="ic"><use href="#i-branch"/></svg></button>
<span class="tool-sep"></span>
<button class="tool-btn on" id="label-btn" title="精简连线标签"><svg class="ic"><use href="#i-tag"/></svg></button>
</div>
<div class="tool-group" title="画布缩放">
<button class="tool-btn" id="zoom-out" title="缩小">&minus;</button>
<span class="zoom-read" id="flow-root-read" title="点击适应宽度">100%</span>
<button class="tool-btn" id="zoom-in" title="放大">+</button>
<span class="tool-sep"></span>
<button class="tool-btn" id="zoom-fit" title="适应宽度"><svg class="ic"><use href="#i-expand"/></svg></button>
</div>
<button class="btn btn-ghost btn-sm"><svg class="ic"><use href="#i-circle-check"/></svg>校验</button>
<button class="btn btn-secondary btn-sm"><svg class="ic"><use href="#i-save"/></svg>保存</button>
<button class="btn btn-primary btn-sm">发布</button>
</div>
</div>
<p class="note">连线默认是直角折线,端口按序号分散、并行分支走不同车道、遇到节点矩形自动绕行;拐角 8px 圆角。悬浮环节时无关环节降到 45% 透明度、无关连线降到 50%,条件文案只在点亮时出现。</p>
<div class="designer">
<div class="canvas-shell">
<aside class="palette">
<p class="pal-title">环节类型</p>
<div class="pal-item"><span class="pal-swatch" style="background:#0d9488"></span>人工审批</div>
<div class="pal-item"><span class="pal-swatch" style="background:#d97706"></span>条件分支</div>
<div class="pal-item"><span class="pal-swatch" style="background:#7c3aed"></span>并行分发</div>
<div class="pal-item"><span class="pal-swatch" style="background:#7c3aed"></span>并行汇聚</div>
<div class="pal-item"><span class="pal-swatch" style="background:#7c3aed"></span>汇聚分支</div>
<div class="pal-item"><span class="pal-swatch" style="background:#2563eb"></span>脚本处理</div>
<div class="pal-item"><span class="pal-swatch" style="background:#2563eb"></span>接口调用</div>
<div class="pal-item"><span class="pal-swatch" style="background:#2563eb"></span>子流程</div>
<div class="pal-item"><span class="pal-swatch" style="background:#0891b2"></span>延时等待</div>
<p class="pal-title" style="margin-top:18px">图例</p>
<div class="stack" style="gap:8px;font-size:12px;color:var(--gray-600)">
<div class="row" style="gap:8px"><svg style="width:26px;height:8px"><path d="M0 4H26" stroke="#94a3b8" stroke-width="1.6"/></svg>普通流转</div>
<div class="row" style="gap:8px"><svg style="width:26px;height:8px"><path d="M0 4H26" stroke="#dc2626" stroke-width="1.6" stroke-dasharray="5 4"/></svg>退回</div>
<div class="row" style="gap:8px"><svg style="width:26px;height:8px"><path d="M0 4H26" stroke="#6366f1" stroke-width="2.4"/></svg>焦点连线</div>
</div>
<p class="pal-title" style="margin-top:18px">校验</p>
<div class="stack" style="gap:6px;font-size:12px">
<div class="row"><span class="dot" style="background:var(--emerald)"></span>无阻塞错误</div>
<div class="row"><span class="dot" style="background:var(--amber)"></span>1 条建议:复核汇聚未设超时</div>
</div>
</aside>
<div class="canvas">
<div class="canvas-scroll" id="canvas-scroll">
<div class="canvas-grid" id="flow-root"></div>
</div>
<div class="minimap" aria-hidden="true">
<i style="left:8px;top:26px;width:16px;height:7px"></i><i style="left:32px;top:26px;width:16px;height:7px"></i>
<i style="left:56px;top:26px;width:16px;height:7px"></i><i style="left:80px;top:26px;width:16px;height:7px"></i>
<i style="left:104px;top:10px;width:16px;height:7px"></i><i style="left:104px;top:40px;width:16px;height:7px"></i>
<i style="left:128px;top:18px;width:16px;height:7px"></i><i style="left:144px;top:18px;width:16px;height:7px"></i>
</div>
<div class="hintbar" id="focus-hint">悬浮或点选一个环节,只看它相关的线</div>
</div>
<aside class="inspector">
<div class="insp-head">
<span class="badge badge-warning" style="text-transform:none">条件分支</span>
<b style="font-size:13px">金额分支</b><div class="sp"></div>
<button class="tool-btn" title="关闭">×</button>
</div>
<div class="insp-body">
<div class="sec">
<p class="sec-title">基本信息</p>
<div class="field"><label class="input-label">环节名称</label><input class="input" value="金额分支"></div>
<div class="field"><label class="input-label">环节标识</label><input class="input num" value="demo_choice"></div>
</div>
<div class="sec">
<p class="sec-title">出口路由 · 2 条</p>
<div class="row" style="gap:6px;margin-bottom:10px">
<span class="badge badge-primary">大额 → 总经理审批</span>
<span class="badge badge-gray">默认 → 并联复核</span>
</div>
<div class="builder">
<div class="row" style="margin-bottom:10px">
<span class="tiny" style="font-weight:600;color:var(--gray-700)">条件搭建器</span><div class="sp"></div>
<span class="tiny muted">满足以下</span>
<div class="tabs" style="padding:2px">
<button class="tab" style="padding:4px 10px;font-size:12px">或</button>
<button class="tab active" style="padding:4px 10px;font-size:12px">且</button>
</div>
</div>
<div class="rule">
<select class="input" title="字段"><option>money</option><option>cate</option><option>reason</option></select>
<select class="input" title="比较符"><option>&gt;</option><option>&gt;=</option><option>&lt;</option><option>in</option></select>
<input class="input" value="20000">
<button class="tool-btn" title="删除该条件">×</button>
</div>
<div class="rule">
<select class="input" title="字段"><option>cate</option></select>
<select class="input" style="padding:7px 10px"><option>in</option></select>
<input class="input" value="it.laptop, it.desk">
<button class="tool-btn" title="删除该条件">×</button>
</div>
<button class="btn btn-ghost btn-sm" style="width:100%"><svg class="ic"><use href="#i-plus"/></svg>加一条</button>
<div class="input-hint" style="margin-bottom:8px">字段取自所有可填表单字段的并集,比较符决定是否需要一个值。</div>
<button class="btn btn-secondary btn-sm" style="width:100%"><svg class="ic"><use href="#i-save"/></svg>写入表达式</button>
</div>
<p class="sec-title" style="margin-top:14px">表达式预览</p>
<div class="code" style="white-space:pre-wrap">money &gt; 20000
and cate in ("it.laptop", "it.desk")</div>
<div class="input-hint">没有表达式的出口即默认分支,引擎在其余分支都不成立时走它。</div>
</div>
<div class="sec">
<p class="sec-title">高级</p>
<div class="row" style="justify-content:space-between;margin-bottom:10px"><span style="font-size:13px">允许退回</span><span class="switch on"></span></div>
<div class="row" style="justify-content:space-between;margin-bottom:10px"><span style="font-size:13px">退回目标</span>
<select class="input" style="width:170px;padding:7px 10px"><option>最近办理过的人工环节</option><option>起草确认</option></select></div>
<div class="row" style="justify-content:space-between"><span style="font-size:13px">超时提醒</span><span class="switch"></span></div>
</div>
</div>
<div class="insp-foot"><button class="btn btn-secondary btn-sm sp">取消</button><button class="btn btn-primary btn-sm sp">应用</button></div>
</aside>
</div>
</div>
</section>
<!-- ======================= 视图 3:表单设计器 ======================= -->
<section class="view" id="v-form">
<div class="card" style="padding:10px 12px;margin-bottom:12px;display:flex;align-items:center;gap:12px;flex-wrap:wrap">
<div class="row" style="gap:12px;min-width:0">
<button class="btn btn-ghost btn-sm" data-go="home"><svg class="ic"><use href="#i-arrow-left"/></svg></button>
<div style="min-width:0">
<div class="row" style="gap:8px">
<h2 style="margin:0;font-size:15px;font-weight:600">演示表单-采购申请</h2>
<span class="badge badge-success">已发布</span><span class="badge badge-primary">v3</span>
</div>
<p class="tiny muted" style="margin:2px 0 0">12 列栅格,字段拖到网格里,右侧调宽度与属性。角标显示每个字段落在第几行第几列。</p>
</div>
</div>
<div class="sp"></div>
<div class="tool-group">
<button class="tool-btn" disabled title="撤销"><svg class="ic"><use href="#i-undo"/></svg></button>
<button class="tool-btn" title="重做"><svg class="ic"><use href="#i-redo"/></svg></button>
<span class="tool-sep"></span>
<button class="tool-btn on" title="显示网格"><svg class="ic"><use href="#i-grid"/></svg></button>
<button class="tool-btn" title="预览"><svg class="ic"><use href="#i-eye"/></svg></button>
</div>
<div class="row" style="gap:6px">
<span class="tiny muted">布局</span>
<div class="tabs" style="padding:2px"><button class="tab" style="padding:4px 10px;font-size:12px">1 列</button><button class="tab active" style="padding:4px 10px;font-size:12px">12 列</button></div>
<button class="btn btn-ghost btn-sm"><svg class="ic"><use href="#i-circle-check"/></svg>校验</button>
<button class="btn btn-secondary btn-sm"><svg class="ic"><use href="#i-save"/></svg>保存</button>
<button class="btn btn-primary btn-sm">发布</button>
</div>
</div>
<p class="note">新增字段类型 cascader(级联选择)来自字典的层级项:一个下拉一层,改上级即清空下级;值存完整路径,只读态与导出用斜杠拼接。</p>
<div class="designer" style="min-height:560px">
<div class="canvas-shell">
<aside class="palette">
<p class="pal-title">基础</p>
<div class="pal-item"><svg class="ic" style="width:14px;height:14px"><use href="#i-doc"/></svg>单行文本</div>
<div class="pal-item"><svg class="ic" style="width:14px;height:14px"><use href="#i-doc"/></svg>多行文本</div>
<div class="pal-item"><svg class="ic" style="width:14px;height:14px"><use href="#i-chart"/></svg>数字 / 金额</div>
<div class="pal-item"><svg class="ic" style="width:14px;height:14px"><use href="#i-clock"/></svg>日期时间</div>
<p class="pal-title" style="margin-top:16px">选择</p>
<div class="pal-item"><svg class="ic" style="width:14px;height:14px"><use href="#i-list"/></svg>下拉单选</div>
<div class="pal-item"><svg class="ic" style="width:14px;height:14px"><use href="#i-check"/></svg>单选组</div>
<div class="pal-item"><svg class="ic" style="width:14px;height:14px"><use href="#i-merge"/></svg>多选</div>
<div class="pal-item" style="border-color:var(--primary);background:var(--primary-50)"><svg class="ic" style="width:14px;height:14px"><use href="#i-branch"/></svg>级联选择 <span class="badge badge-primary" style="padding:0 5px;font-size:10px;margin-left:auto">新</span></div>
<div class="pal-item"><svg class="ic" style="width:14px;height:14px"><use href="#i-users"/></svg>选人</div>
<p class="pal-title" style="margin-top:16px">高级</p>
<div class="pal-item"><svg class="ic" style="width:14px;height:14px"><use href="#i-clipboard"/></svg>明细表</div>
<div class="pal-item"><svg class="ic" style="width:14px;height:14px"><use href="#i-doc"/></svg>附件</div>
<div class="pal-item"><svg class="ic" style="width:14px;height:14px"><use href="#i-badge"/></svg>手写签名</div>
<div class="pal-item"><svg class="ic" style="width:14px;height:14px"><use href="#i-route"/></svg>关联审批单</div>
<div class="pal-item"><svg class="ic" style="width:14px;height:14px"><use href="#i-code"/></svg>公式</div>
</aside>
<div class="sheet">
<div class="card-header"><h2 class="card-title">采购申请</h2><div class="sp"></div><span class="tiny muted">12 列 · 6 行</span></div>
<div class="sheet-scroll">
<div class="sheet-grid">
<div class="slot c4"><span class="slot-tag">第 1 行 · 1/12 · 宽 4</span>
<label class="input-label">申请编号</label><div class="fake">CG-2026-0915-004</div>
<div class="input-hint">公式自动生成,只读</div></div>
<div class="slot c4"><span class="slot-tag">第 1 行 · 5/12 · 宽 4</span>
<label class="input-label">申请人</label><div class="fake">张三 · 采购部</div></div>
<div class="slot c4"><span class="slot-tag">第 1 行 · 9/12 · 宽 4</span>
<label class="input-label">申请日期</label><div class="fake">2026-09-15</div></div>
<div class="slot c6 sel"><span class="slot-tag">第 2 行 · 1/12 · 宽 6</span>
<label class="input-label">采购品类 <span style="color:var(--red)">*</span></label>
<div class="casc">
<div class="step"><svg class="ic" style="width:13px;height:13px"><use href="#i-branch"/></svg>IT设备</div>
<div class="step pick">笔记本电脑 <svg class="ic" style="width:12px;height:12px"><use href="#i-check"/></svg></div>
<div class="step add"><svg class="ic" style="width:12px;height:12px"><use href="#i-plus"/></svg>下一级</div>
</div>
<div class="input-hint">级联选择 · 来源字典「演示采购品类」· 需选到完整路径</div></div>
<div class="slot c3"><span class="slot-tag">第 2 行 · 7/12 · 宽 3</span>
<label class="input-label">数量 <span style="color:var(--red)">*</span></label><div class="fake num">12</div></div>
<div class="slot c3"><span class="slot-tag">第 2 行 · 10/12 · 宽 3</span>
<label class="input-label">申请金额 <span style="color:var(--red)">*</span></label><div class="fake num">¥ 86,400.00</div>
<div class="input-hint">公式 单价 × 数量</div></div>
<div class="slot c6"><span class="slot-tag">第 3 行 · 1/12 · 宽 6</span>
<label class="input-label">期望到货日期</label><div class="fake">2026-09-30</div></div>
<div class="slot c6"><span class="slot-tag">第 3 行 · 7/12 · 宽 6</span>
<label class="input-label">收货人</label><div class="fake">李四 · 行政部</div></div>
<div class="slot c12"><span class="slot-tag">第 4 行 · 整行</span>
<label class="input-label">申请事由 <span style="color:var(--red)">*</span></label>
<div class="fake" style="min-height:56px">研发部新入职 12 人,现有设备不足……</div>
<div class="input-hint">条件必填:金额 ≥ 20000 时必填并触发总经理审批</div></div>
<div class="slot c12"><span class="slot-tag">第 5 行 · 整行</span>
<label class="input-label">报价单附件</label>
<div class="fake" style="display:flex;gap:8px;align-items:center"><svg class="ic"><use href="#i-download"/></svg>三家报价对比.xlsx · 240 KB</div></div>
<div class="slot c6 dash">拖字段到这里 · 第 6 行 · 1/12 · 宽 6</div>
<div class="slot c6 dash">拖字段到这里 · 第 6 行 · 7/12 · 宽 6</div>
</div>
</div>
</div>
<aside class="inspector">
<div class="insp-head"><span class="badge badge-primary" style="text-transform:none">级联选择</span><b style="font-size:13px">采购品类</b><div class="sp"></div><button class="tool-btn" title="关闭">×</button></div>
<div class="insp-body">
<div class="sec">
<p class="sec-title">字段</p>
<div class="field"><label class="input-label">标题</label><input class="input" value="采购品类"></div>
<div class="field"><label class="input-label">字段名</label><input class="input num" value="cate"></div>
<div class="row" style="gap:8px">
<div style="flex:1"><label class="input-label">列宽</label>
<div class="tabs" style="padding:2px;width:100%"><button class="seg">3</button><button class="seg">4</button><button class="seg">6</button><button class="seg on">6</button><button class="seg">12</button></div></div>
</div>
</div>
<div class="sec">
<p class="sec-title">选项来源</p>
<div class="field"><label class="input-label">数据字典</label>
<select class="input"><option>演示采购品类(两级)</option><option>费用科目</option></select>
<div class="input-hint">级联选择必须绑定字典,保存时服务端会校验这条约束。</div></div>
<div class="field"><label class="input-label">字典预览</label>
<div class="code">IT设备 it
├─ 笔记本电脑 it.laptop
└─ 台式整机 it.desk
办公用品 office
├─ 打印纸 office.paper
└─ 会议室家具 office.furniture</div></div>
</div>
<div class="sec">
<p class="sec-title">校验与联动</p>
<div class="row" style="justify-content:space-between;margin-bottom:10px"><span style="font-size:13px">必填</span><span class="switch on"></span></div>
<div class="row" style="justify-content:space-between;margin-bottom:10px"><span style="font-size:13px">允许停在半级</span><span class="switch on"></span></div>
<div class="field"><label class="input-label">带出到字段</label><input class="input num" placeholder="例:cate_code"></div>
<div class="input-hint">选中末级后把字典项的扩展值写入目标字段,改上级时一并清空。</div>
</div>
<div class="sec">
<p class="sec-title">环节字段权限</p>
<table class="table" style="font-size:12px">
<thead><tr><th>环节</th><th>可见</th><th>可填</th><th>必填</th></tr></thead>
<tbody>
<tr><td>起草确认</td><td><svg class="ic" style="width:14px;height:14px;color:var(--emerald)"><use href="#i-check"/></svg></td><td><svg class="ic" style="width:14px;height:14px;color:var(--emerald)"><use href="#i-check"/></svg></td><td><svg class="ic" style="width:14px;height:14px;color:var(--emerald)"><use href="#i-check"/></svg></td></tr>
<tr><td>部门初审</td><td><svg class="ic" style="width:14px;height:14px;color:var(--emerald)"><use href="#i-check"/></svg></td><td><svg class="ic" style="width:14px;height:14px;color:var(--gray-300)"><use href="#i-check"/></svg></td><td><svg class="ic" style="width:14px;height:14px;color:var(--gray-300)"><use href="#i-check"/></svg></td></tr>
<tr><td>总经理审批</td><td><svg class="ic" style="width:14px;height:14px;color:var(--emerald)"><use href="#i-check"/></svg></td><td><svg class="ic" style="width:14px;height:14px;color:var(--gray-300)"><use href="#i-check"/></svg></td><td><svg class="ic" style="width:14px;height:14px;color:var(--gray-300)"><use href="#i-check"/></svg></td></tr>
</tbody>
</table>
</div>
</div>
<div class="insp-foot"><button class="btn btn-secondary btn-sm sp">取消</button><button class="btn btn-primary btn-sm sp">应用</button></div>
</aside>
</div>
</div>
</section>
<!-- ======================= 视图 4:单据详情 ======================= -->
<section class="view" id="v-detail">
<div class="page-header">
<div>
<div class="row" style="gap:10px">
<button class="btn btn-ghost btn-sm" data-go="home"><svg class="ic"><use href="#i-arrow-left"/></svg></button>
<h1 class="page-title" style="font-size:20px">采购申请 · 笔记本电脑 12 台</h1>
<span class="badge badge-primary">在途</span>
<span class="badge badge-gray num">CG-2026-0915-004</span>
</div>
<p class="page-description">演示流程-直角连线 v4 · 发起人 张三(采购部)· 09-15 08:12 发起 · 当前停在「总经理审批」,已等待 3 小时 26 分</p>
</div>
<div class="spacer"></div>
<button class="btn btn-secondary"><svg class="ic"><use href="#i-print"/></svg>打印</button>
<button class="btn btn-secondary"><svg class="ic"><use href="#i-download"/></svg>导出 CSV</button>
<button class="btn btn-danger">撤回</button>
</div>
<p class="note">详情固定四页签:表单内容 / 流转流程图 / 流转轨迹 / 批注。只读表单复用同一套渲染器,图上的绿=已办、青=当前、灰=未走、红=退回。</p>
<div class="tabs" style="margin-bottom:20px" id="panes">
<button class="tab active" data-pane="form">表单内容</button>
<button class="tab" data-pane="graph">流转流程图</button>
<button class="tab" data-pane="log">流转轨迹<span class="n num">6</span></button>
<button class="tab" data-pane="comment">批注<span class="n num">2</span></button>
</div>
<div class="pane on" id="p-form">
<div class="grid g2-1">
<div class="card">
<div class="card-header"><h2 class="card-title">申请内容</h2><div class="sp"></div><span class="badge badge-gray">只读</span></div>
<div class="card-body">
<div class="sheet-grid">
<div class="c4"><label class="input-label">申请编号</label><div class="num">CG-2026-0915-004</div></div>
<div class="c4"><label class="input-label">申请人</label><div>张三 · 采购部</div></div>
<div class="c4"><label class="input-label">申请日期</label><div class="num">2026-09-15</div></div>
<div class="c6"><label class="input-label">采购品类</label><div>IT设备 / 笔记本电脑</div>
<div class="input-hint">级联选择只读态按斜杠拼接完整路径</div></div>
<div class="c3"><label class="input-label">数量</label><div class="num">12</div></div>
<div class="c3"><label class="input-label">申请金额</label><div class="num" style="font-weight:600">¥ 86,400.00</div></div>
<div class="c6"><label class="input-label">期望到货日期</label><div class="num">2026-09-30</div></div>
<div class="c6"><label class="input-label">收货人</label><div>李四 · 行政部</div></div>
<div class="c12"><label class="input-label">申请事由</label>
<div>研发部新入职 12 人,现有设备不足;本次按年度框架协议价采购,单价 7,200 元。</div></div>
<div class="c12"><label class="input-label">报价单附件</label>
<div class="row" style="gap:8px"><div class="fake" style="width:auto;display:flex;gap:8px;align-items:center"><svg class="ic"><use href="#i-download"/></svg>三家报价对比.xlsx</div>
<span class="tiny muted">240 KB · 张三 上传</span></div></div>
<div class="c6"><label class="input-label">部门负责人签名</label>
<div class="fake" style="display:flex;align-items:flex-end;height:64px">
<span style="font-family:'Segoe Script','Bradley Hand',cursive;font-size:22px;color:#1e293b">王五</span></div></div>
<div class="c6"><label class="input-label">关联出差单</label>
<div class="fake" style="display:flex;gap:8px;align-items:center"><svg class="ic"><use href="#i-route"/></svg>出差申请 · 深圳供应商拜访</div></div>
</div>
</div>
</div>
<div class="stack" style="gap:24px">
<div class="card">
<div class="card-header"><h2 class="card-title">流转进度</h2></div>
<div class="card-body" style="padding:16px 24px">
<div class="tl">
<div class="tl-item ok"><div class="tl-h">起草确认 <span class="badge badge-success">同意</span></div><div class="tl-b">张三 · 09-15 08:12 · 用时 6 分</div></div>
<div class="tl-item ok"><div class="tl-h">部门初审 <span class="badge badge-success">同意</span></div><div class="tl-b">王五 · 09-15 08:40 · 签名确认,报价合理</div></div>
<div class="tl-item ok"><div class="tl-h">抄送人事 <span class="badge badge-gray">自动</span></div><div class="tl-b">系统 · 09-15 08:40</div></div>
<div class="tl-item now"><div class="tl-h">总经理审批 <span class="badge badge-primary">处理中</span></div><div class="tl-b">你 · 已等待 3 小时 26 分 · 大额通道</div></div>
<div class="tl-item"><div class="tl-h muted">自动归档</div><div class="tl-b">未开始</div></div>
</div>
</div>
</div>
<div class="card">
<div class="card-header"><h2 class="card-title">该你决策</h2></div>
<div class="card-body" style="padding:16px 24px" >
<div class="field"><label class="input-label">审批意见</label>
<textarea class="input" rows="3" placeholder="同意 / 退回时都会带上这段文字"></textarea></div>
<div class="row" style="gap:8px;margin-top:12px">
<button class="btn btn-success sp"><svg class="ic"><use href="#i-check"/></svg>同意</button>
<button class="btn btn-secondary sp"><svg class="ic"><use href="#i-swap"/></svg>转办</button>
<button class="btn btn-danger sp"><svg class="ic"><use href="#i-undo"/></svg>退回起草</button>
</div>
<div class="input-hint">退回目标默认「最近办理过的人工环节」,可在环节属性里改成指定环节。</div>
</div>
</div>
</div>
</div>
</div>
<div class="pane" id="p-graph">
<div class="card">
<div class="card-header">
<h2 class="card-title">流转流程图</h2>
<div class="sp"></div>
<div class="mini-legend">
<span><span class="dot" style="background:var(--emerald)"></span> 已办理 <b class="num" id="lg-done">0</b></span>
<span><span class="dot" style="background:var(--primary)"></span> 当前 <b class="num" id="lg-now">0</b></span>
<span><span class="dot" style="background:var(--gray-300)"></span> 未走 <b class="num" id="lg-wait">0</b></span>
<span><span class="dot" style="background:var(--red)"></span> 退回边 <b class="num" id="lg-back">0</b></span>
</div>
<div class="row" style="gap:6px;margin-left:16px">
<button class="tool-btn" title="放大"><svg class="ic"><use href="#i-search"/></svg></button>
<button class="tool-btn on" title="精简连线标签"><svg class="ic"><use href="#i-tag"/></svg></button>
</div>
</div>
<div style="padding:16px 24px 24px">
<div class="canvas" style="height:520px">
<div class="canvas-scroll"><div class="canvas-grid" id="trace-root" style="width:1422px;height:512px"></div></div>
<div class="hintbar">只读图同样支持悬浮淡化,点节点看该环节的表单快照</div>
</div>
</div>
</div>
</div>
<div class="pane" id="p-log">
<div class="card">
<div class="card-header"><h2 class="card-title">流转轨迹</h2><div class="sp"></div>
<button class="btn btn-secondary btn-sm"><svg class="ic"><use href="#i-download"/></svg>导出</button></div>
<table class="table">
<thead><tr><th>时间</th><th>环节</th><th>操作人</th><th>动作</th><th>意见</th><th>耗时</th></tr></thead>
<tbody>
<tr><td class="num">09-15 08:12</td><td>—</td><td>张三</td><td><span class="badge badge-primary">发起</span></td><td class="muted">按年度框架协议采购</td><td class="num muted">—</td></tr>
<tr><td class="num">09-15 08:18</td><td>起草确认</td><td>张三</td><td><span class="badge badge-success">同意</span></td><td class="muted">资料齐全</td><td class="num">6 分</td></tr>
<tr><td class="num">09-15 08:40</td><td>部门初审</td><td>王五</td><td><span class="badge badge-success">同意</span></td><td class="muted">报价合理,已手写签名</td><td class="num">22 分</td></tr>
<tr><td class="num">09-15 08:40</td><td>抄送人事</td><td>系统</td><td><span class="badge badge-gray">自动抄送</span></td><td class="muted">—</td><td class="num muted">—</td></tr>
<tr><td class="num">09-15 08:41</td><td>金额分支</td><td>系统</td><td><span class="badge badge-warning">命中「大额」</span></td><td class="muted num">money &gt; 20000</td><td class="num">&lt;1 秒</td></tr>
<tr><td class="num">09-15 08:41</td><td>总经理审批</td><td>系统管理员</td><td><span class="badge badge-primary">待办理</span></td><td class="muted">—</td><td class="num">已等待 3 小时 26 分</td></tr>
</tbody>
</table>
</div>
</div>
<div class="pane" id="p-comment">
<div class="card" style="margin-bottom:20px">
<div class="card-body">
<div class="field"><label class="input-label">补充说明</label><textarea class="input" rows="2" placeholder="评论不会改变流程状态,只留痕"></textarea></div>
<div class="row"><div class="sp"></div><button class="btn btn-primary btn-sm"><svg class="ic"><use href="#i-send"/></svg>发表</button></div>
</div>
</div>
<div class="card">
<div class="card-body">
<div class="feed"><div class="feed-ic"><svg class="ic"><use href="#i-user"/></svg></div>
<div><div class="row" style="gap:8px"><b style="font-size:13px">王五</b><span class="tiny muted">09-15 09:02</span></div>
<div style="font-size:13px;margin-top:2px">三家报价里第二家含税,实际差价比表上小,已在意见里说明。</div></div></div>
<div class="feed"><div class="feed-ic"><svg class="ic"><use href="#i-user"/></svg></div>
<div><div class="row" style="gap:8px"><b style="font-size:13px">张三</b><span class="tiny muted">09-15 09:15</span></div>
<div style="font-size:13px;margin-top:2px">补充:如需拆单请告知,我可以分两张提。</div></div></div>
</div>
</div>
</div>
</section>
</div>
</div>
</div>
<div class="switcher" role="tablist" aria-label="设计稿视图切换">
<button class="on" data-go="home">工作台</button>
<button data-go="flow">流程设计器</button>
<button data-go="form">表单设计器</button>
<button data-go="detail">单据详情</button>
</div>
<script>
/* ---------- 视图与页签切换 ---------- */
const CRUMB = { home:'办公中心 / 工作台', flow:'系统管理 / 流程设计', form:'系统管理 / 表单设计', detail:'办公中心 / 我发起的 / 单据详情' };
function go(key){
document.querySelectorAll('.view').forEach(v => v.classList.toggle('on', v.id === 'v-' + key));
document.getElementById('crumb').textContent = CRUMB[key];
if (location.hash.slice(1) !== key) history.replaceState(null, '', '#' + key);
document.querySelectorAll('.switcher button').forEach(b => b.classList.toggle('on', b.dataset.go === key));
window.scrollTo({ top: 0 });
if (typeof designer !== 'undefined') requestAnimationFrame(() => { designer.fit(); traceFlow.fit(); });
}
document.addEventListener('click', e => {
const t = e.target.closest('[data-go]');
if (t) { e.preventDefault(); go(t.dataset.go); }
});
document.getElementById('panes').addEventListener('click', e => {
const b = e.target.closest('.tab'); if (!b) return;
document.querySelectorAll('#panes .tab').forEach(x => x.classList.toggle('active', x === b));
document.querySelectorAll('.pane').forEach(p => p.classList.toggle('on', p.id === 'p-' + b.dataset.pane));
if (b.dataset.pane === 'graph') requestAnimationFrame(traceFlow.fit);
});
document.querySelectorAll('.tabs .tab').forEach(t => t.addEventListener('click', () => {
const g = t.parentElement; if (g.id === 'panes') return;
g.querySelectorAll('.tab').forEach(x => x.classList.toggle('active', x === t));
}));
/* ---------- 画布数据:与真实 demo 流程同构(12 环节 / 14 条连线) ---------- */
const W = 160, H = 68, GRID_W = 1422, GRID_H = 512;
const NODES = [
{ id:'begin', kind:'开始', type:'begin', color:'#059669', x:16, y:20, name:'开始' },
{ id:'draft', kind:'人工审批', type:'manual', color:'#0d9488', x:206, y:20, name:'起草确认', people:['张三'] },
{ id:'dept', kind:'人工审批', type:'manual', color:'#0d9488', x:396, y:20, name:'部门初审', people:['王五'], mode:'单人' },
{ id:'cc', kind:'脚本处理', type:'script', color:'#2563eb', x:396, y:276, name:'抄送人事', people:['人事部'] },
{ id:'choice', kind:'条件分支', type:'choice', color:'#d97706', x:586, y:20, name:'金额分支', people:['2 个出口'] },
{ id:'gm', kind:'人工审批', type:'manual', color:'#0d9488', x:866, y:20, name:'总经理审批', people:['系统管理员'] },
{ id:'par', kind:'并行分发', type:'parallel', color:'#7c3aed', x:866, y:276, name:'并联复核', people:['2 条分支'] },
{ id:'hr', kind:'人工审批', type:'manual', color:'#0d9488', x:1056, y:148, name:'行政复核', people:['李四'] },
{ id:'fin', kind:'人工审批', type:'manual', color:'#0d9488', x:1056, y:404, name:'财务复核', people:['赵六'] },
{ id:'merge', kind:'并行汇聚', type:'merge', color:'#7c3aed', x:1246, y:276, name:'复核汇聚', people:['需 2 / 2 票'], mode:'配额' },
{ id:'archive', kind:'脚本处理', type:'script', color:'#2563eb', x:1246, y:148, name:'自动归档', people:['写入台账'] },
{ id:'end', kind:'结束', type:'end', color:'#dc2626', x:1246, y:20, name:'结束' }
];
// 每条线给出「端口 + 拐点」,口径与 utils/flowGraph.ts 的折线一致:
// 同侧端口按序号错开、并行分支各占一条车道、竖直段绕开节点矩形。
const EDGES = [
{ from:'begin', to:'draft', pts:[[176,54],[206,54]] },
{ from:'draft', to:'dept', pts:[[366,54],[396,54]] },
{ from:'dept', to:'cc', pts:[[476,88],[476,276]] },
{ from:'cc', to:'choice', pts:[[556,310],[571,310],[571,54],[586,54]] },
{ from:'choice', to:'gm', pts:[[746,46],[806,46],[806,54],[866,54]], label:'大额 · money > 20000', at:[806,26], cond:true },
{ from:'choice', to:'par', pts:[[746,62],[806,62],[806,310],[866,310]], label:'默认分支', at:[806,190], cond:true },
{ from:'par', to:'hr', pts:[[1026,302],[1041,302],[1041,182],[1056,182]] },
{ from:'par', to:'fin', pts:[[1026,318],[1041,318],[1041,438],[1056,438]] },
{ from:'hr', to:'merge', pts:[[1216,182],[1234,182],[1234,310],[1246,310]] },
{ from:'fin', to:'merge', pts:[[1216,438],[1234,438],[1234,320],[1246,320]] },
{ from:'gm', to:'merge', pts:[[1026,54],[1224,54],[1224,300],[1246,300]] },
{ from:'merge', to:'archive', pts:[[1326,276],[1326,216]] },
{ from:'archive',to:'end', pts:[[1326,148],[1326,88]] },
{ from:'gm', to:'draft', back:true, pts:[[946,88],[946,112],[286,112],[286,88]], label:'退回', at:[616,112] }
];
const TRACE = {
node: { begin:'done', draft:'done', dept:'done', cc:'done', choice:'done', gm:'current', par:'pending',
hr:'pending', fin:'pending', merge:'pending', archive:'pending', end:'pending' },
edge: { 'begin>draft':1, 'draft>dept':1, 'dept>cc':1, 'cc>choice':1, 'choice>gm':1 },
round: { gm:'第 1 轮 · 处理中 3 小时 26 分', draft:'第 1 轮', dept:'第 1 轮' }
};
const SVG_NS = 'http://www.w3.org/2000/svg';
const el = (n, a) => { const e = document.createElementNS(SVG_NS, n); for (const k in a) e.setAttribute(k, a[k]); return e; };
const nodeById = id => NODES.find(n => n.id === id);
const seg = (a, b) => Math.hypot(b[0]-a[0], b[1]-a[1]);
function orthoPath(pts, r) {
let d = 'M' + pts[0][0] + ' ' + pts[0][1];
for (let i = 1; i < pts.length - 1; i++) {
const p = pts[i-1], c = pts[i], n = pts[i+1];
const rr = Math.min(r, seg(p, c) / 2, seg(c, n) / 2);
const u = [(p[0]-c[0]) / seg(p,c), (p[1]-c[1]) / seg(p,c)], v = [(n[0]-c[0]) / seg(c,n), (n[1]-c[1]) / seg(c,n)];
d += ' L' + (c[0]+u[0]*rr) + ' ' + (c[1]+u[1]*rr) + ' Q' + c[0] + ' ' + c[1] + ' ' + (c[0]+v[0]*rr) + ' ' + (c[1]+v[1]*rr);
}
const last = pts[pts.length-1];
return d + ' L' + last[0] + ' ' + last[1];
}
function path(edge, style, radius) {
const p = edge.pts, a = p[0], b = p[p.length-1];
if (style === 'straight') return 'M' + a[0] + ' ' + a[1] + ' L' + b[0] + ' ' + b[1];
if (style === 'curve') {
const k = Math.abs(b[0]-a[0]) >= Math.abs(b[1]-a[1]) ? [Math.abs(b[0]-a[0])*0.45, 0] : [0, Math.abs(b[1]-a[1])*0.45];
return 'M' + a[0] + ' ' + a[1] + ' C' + (a[0]+k[0]) + ' ' + (a[1]+k[1]) + ' ' + (b[0]-k[0]) + ' ' + (b[1]-k[1]) + ' ' + b[0] + ' ' + b[1];
}
return orthoPath(p, radius);
}
function renderFlow(rootId, opts) {
const root = document.getElementById(rootId);
const trace = !!(opts && opts.trace);
const state = { style:'ortho', radius:8, lean:trace, focus:'', pin:'' };
root.innerHTML = '';
const svg = el('svg', { class:'edges', viewBox:'0 0 ' + GRID_W + ' ' + GRID_H, width:GRID_W, height:GRID_H });
const defs = el('defs', {});
defs.innerHTML =
'<marker id="'+rootId+'-ar" markerWidth="9" markerHeight="9" refX="6.5" refY="4.5" orient="auto">' +
'<path d="M0.6 0.9 7.2 4.5 0.6 8.1" fill="none" stroke="#94a3b8" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/></marker>' +
'<marker id="'+rootId+'-lit" markerWidth="9" markerHeight="9" refX="6.5" refY="4.5" orient="auto">' +
'<path d="M0.6 0.9 7.4 4.5 0.6 8.1z" fill="#6366f1" stroke="#6366f1" stroke-width="1.2" stroke-linejoin="round"/></marker>' +
'<marker id="'+rootId+'-used" markerWidth="9" markerHeight="9" refX="6.5" refY="4.5" orient="auto">' +
'<path d="M0.6 0.9 7.2 4.5 0.6 8.1" fill="none" stroke="#059669" stroke-width="1.5" stroke-linecap="round"/></marker>' +
'<marker id="'+rootId+'-back" markerWidth="9" markerHeight="9" refX="6.5" refY="4.5" orient="auto">' +
'<path d="M0.6 0.9 7.2 4.5 0.6 8.1" fill="none" stroke="#dc2626" stroke-width="1.5" stroke-linecap="round"/></marker>';
svg.appendChild(defs);
root.appendChild(svg);
const groups = EDGES.map(e => {
const g = el('g', { class:'edge' + (e.back ? ' back' : ''), 'data-from':e.from, 'data-to':e.to });
const hit = el('path', { class:'hit' });
const line = el('path', { class:'line' });
g.appendChild(hit); g.appendChild(line); svg.appendChild(g);
if (trace && TRACE.edge[e.from + '>' + e.to]) { g.classList.add('used'); g.setAttribute('data-used', '1'); }
let label = null;
if (e.label) {
label = document.createElement('div');
label.className = 'edge-label' + (e.back ? ' back' : '') + (e.cond ? ' opt' : '');
label.innerHTML = e.cond ? e.label.replace(' · ', ' <code>') + '</code>' : e.label;
root.appendChild(label);
}
return { e, g, hit, line, label };
});
const cards = NODES.map(n => {
const d = document.createElement('div');
d.className = 'node';
d.style.cssText = 'left:' + n.x + 'px;top:' + n.y + 'px;--n:' + n.color;
const st = trace ? TRACE.node[n.id] : null;
const stamp = trace && TRACE.round[n.id];
const chips = [];
(n.people || []).forEach(p => chips.push('<span class="chip">' + p + '</span>'));
if (trace && st === 'done') chips.push('<span class="chip" style="background:#d1fae5;color:#047857">已同意</span>');
if (trace && st === 'current') chips.push('<span class="chip" style="background:var(--primary-100);color:var(--primary-700)">处理中</span>');
if (stamp) chips.push('<span class="chip round">' + stamp + '</span>');
d.innerHTML =
'<div class="node-top"><svg class="node-type"><use href="#' + iconOf(n) + '"/></svg>' +
'<span class="node-kind">' + n.kind + '</span>' +
(n.mode ? '<span class="node-mode">' + n.mode + '</span>' : '') + '</div>' +
'<div class="node-name">' + n.name + '</div>' +
'<div class="node-meta">' + chips.join('') + '</div>';
if (trace && st === 'pending') d.style.opacity = '.72';
if (trace && st === 'done') d.style.setProperty('--n', '#059669');
if (trace && st === 'current') { d.style.setProperty('--n', '#0d9488'); d.classList.add('lit'); }
root.appendChild(d);
const set = f => { state.focus = f; paint(); };
d.addEventListener('pointerenter', () => { if (!state.pin) set(n.id); });
d.addEventListener('pointerleave', () => { if (!state.pin) set(''); });
d.addEventListener('click', () => { state.pin = state.pin === n.id ? '' : n.id; set(state.pin || ''); });
return { n, d };
});
function iconOf(n) {
return { begin:'i-play', end:'i-flag', manual:'i-user', choice:'i-branch',
parallel:'i-merge', merge:'i-merge', script:'i-code' }[n.type] || 'i-cog';
}
function touches(e, f) { return !f || e.from === f || e.to === f; }
function paint() {
const f = state.focus || state.pin;
const near = new Set([f]);
if (f) EDGES.forEach(e => { if (e.from === f) near.add(e.to); if (e.to === f) near.add(e.from); });
groups.forEach(({ e, g, hit, line, label }) => {
const d = path(e, state.style, state.radius);
hit.setAttribute('d', d); line.setAttribute('d', d);
const lit = f && touches(e, f);
g.classList.toggle('lit', !!lit);
g.classList.toggle('dim', !!f && !lit);
line.setAttribute('marker-end', 'url(#' + rootId + '-' + (lit ? 'lit' : e.back ? 'back' : g.getAttribute('data-used') ? 'used' : 'ar') + ')');
if (label) {
label.style.left = e.at[0] + 'px';
label.style.top = e.at[1] + 'px';
if (trace) label.style.display = (g.getAttribute('data-used') || state.lean === false || lit) ? 'block' : 'none';
}
});
cards.forEach(({ n, d }) => {
d.classList.toggle('lit', !!f && n.id === f && !trace);
d.classList.toggle('dim', !!f && !near.has(n.id));
});
const hint = document.getElementById('focus-hint');
if (hint) hint.textContent = f ? '只看「' + nodeById(f).name + '」的 ' +
EDGES.filter(e => e.from === f || e.to === f).length + ' 条连线 · 再点一次取消' : '悬浮或点选一个环节,只看它相关的线';
}
groups.forEach(({ e, g }) => {
g.addEventListener('pointerenter', () => { if (!state.pin) { state.focus = e.to; paint(); } });
g.addEventListener('pointerleave', () => { if (!state.pin) { state.focus = ''; paint(); } });
});
function setZoom(k) {
state.zoom = Math.max(0.5, Math.min(1.2, Math.round(k * 100) / 100));
root.style.zoom = state.zoom;
const read = document.getElementById(rootId + '-read');
if (read) read.textContent = Math.round(state.zoom * 100) + '%';
}
function fit() {
const box = root.parentElement;
if (!box.clientWidth || !box.clientHeight) return;
setZoom(Math.min((box.clientWidth - 32) / GRID_W, (box.clientHeight - 32) / GRID_H));
}
if (trace) {
const n = k => Object.keys(TRACE.node).filter(x => TRACE.node[x] === k).length;
const put = (id, v) => { const e = document.getElementById(id); if (e) e.textContent = v; };
put('lg-done', n('done')); put('lg-now', n('current')); put('lg-wait', n('pending'));
put('lg-back', EDGES.filter(e => e.back).length);
}
if (state.lean) root.classList.add('lean');
paint();
setZoom(1);
return { state, paint, root, setZoom, fit };
}
const designer = renderFlow('flow-root');
const traceFlow = renderFlow('trace-root', { trace:true });
document.getElementById('flow-root-read').addEventListener('click', designer.fit);
document.getElementById('zoom-in').addEventListener('click', () => designer.setZoom(designer.state.zoom + 0.1));
document.getElementById('zoom-out').addEventListener('click', () => designer.setZoom(designer.state.zoom - 0.1));
document.getElementById('zoom-fit').addEventListener('click', designer.fit);
window.addEventListener('resize', () => { designer.fit(); traceFlow.fit(); });
document.getElementById('label-btn').addEventListener('click', function () {
designer.state.lean = !designer.state.lean;
this.classList.toggle('on', !designer.state.lean);
designer.root.classList.toggle('lean', designer.state.lean);
});
document.getElementById('radius-btn').addEventListener('click', function () {
const on = designer.state.radius > 0;
designer.state.radius = on ? 0 : 8;
this.classList.toggle('on', !on);
designer.paint();
});
/* 支持 #flow / #form / #detail 直达,方便把某一屏发给别人看 */
if (location.hash.slice(1) && CRUMB[location.hash.slice(1)]) go(location.hash.slice(1));
document.querySelectorAll('[data-edge]').forEach(b => b.addEventListener('click', () => {
document.querySelectorAll('[data-edge]').forEach(x => x.classList.toggle('on', x === b));
designer.state.style = b.dataset.edge;
designer.paint();
}));
</script>
</body>
</html>