|
|
@@ -0,0 +1,447 @@
|
|
|
+<!DOCTYPE html>
|
|
|
+<html lang="zh-CN">
|
|
|
+<head>
|
|
|
+<meta charset="UTF-8">
|
|
|
+<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
|
+<title>单元管理 - 恒隆公寓AMS</title>
|
|
|
+<!-- ============================================================
|
|
|
+ 单元管理 · 单元详情-家具信息 · 高保真原型(任务11328 页面改造-接口)
|
|
|
+ 事实来源:线上系统实测(2026-08-27 local.hltech.com:21080 测试环境) + service-rent/gateway-pc 源码 + 墨刀需求6310
|
|
|
+ 本次变化(任务11328,2026-08-27 推送 dev 并已部署测试环境实测生效):
|
|
|
+ 1.新增删除接口 DELETE /v1/unit/furniture?id=(gateway-pc 透传 service-rent 两层),逻辑删除 unit_furniture.deleted='1'
|
|
|
+ 2.家具列表 SQL 增加 deleted='0' 过滤:已删除行不再返回、也不再进入合同保存时的家具快照(contract_furniture)
|
|
|
+ 口径红线:
|
|
|
+ 1.移出≠删除:移出=软操作(记录移出时间,N/Y 均保留可查);删除=硬移除(N/Y 列表彻底消失)
|
|
|
+ 2.保存接口整行覆盖更新:移出/编辑必须整行回传,漏传字段会被清空
|
|
|
+ 3.已移除行(removeFlag=Y)再保存,后端静默跳过(不生效、不报错)
|
|
|
+ 4.【线上实证】改动前前端删除按钮已上线但后端无接口:点击返回200行却不消失(前端本地隐藏,刷新即回);
|
|
|
+ 2026-08-27 接口补齐后实测删除生效(线上截图:docs/恒隆AMS-单元管理家具-线上截图/)
|
|
|
+============================================================ -->
|
|
|
+<style>
|
|
|
+ * { margin:0; padding:0; box-sizing:border-box; }
|
|
|
+ html { overflow-x:hidden; }
|
|
|
+ body { font-family:"PingFang SC","Microsoft YaHei",sans-serif; font-size:13px; color:#333; background:#f0f2f5;
|
|
|
+ display:flex; counter-reset:note; }
|
|
|
+ #protoWrap { flex:1; min-width:0; overflow-x:auto; }
|
|
|
+ .layout { display:flex; min-width:0; flex:1; min-height:100vh; }
|
|
|
+ .nav { width:200px; background:#1f2d3d; color:#bfcbd9; flex-shrink:0; }
|
|
|
+ .nav .logo { height:56px; display:flex; align-items:center; justify-content:center; color:#fff; font-size:15px; font-weight:600; letter-spacing:2px; background:#18222e; }
|
|
|
+ .nav .group { padding:12px 0; border-bottom:1px solid rgba(255,255,255,.06); }
|
|
|
+ .nav .group-title { padding:4px 20px; font-size:11px; color:#7f95ad; }
|
|
|
+ .nav .item { padding:10px 20px 10px 28px; cursor:pointer; }
|
|
|
+ .nav .item:hover { color:#fff; }
|
|
|
+ .nav .item.active { color:#fff; background:#2563eb; position:relative; }
|
|
|
+ .topbar { height:56px; background:#fff; border-bottom:1px solid #e4e7ed; display:flex; align-items:center; padding:0 24px; justify-content:space-between; flex:1; }
|
|
|
+ .breadcrumb { color:#909399; }
|
|
|
+ .breadcrumb b { color:#303133; font-weight:600; }
|
|
|
+ .user { display:flex; align-items:center; gap:10px; color:#606266; }
|
|
|
+ .avatar { width:30px; height:30px; border-radius:50%; background:#2563eb; color:#fff; display:flex; align-items:center; justify-content:center; font-size:12px; }
|
|
|
+ .main { flex:1; display:flex; flex-direction:column; }
|
|
|
+ .content { padding:20px 24px; flex:1; }
|
|
|
+ .unit-head { display:flex; align-items:center; gap:12px; margin-bottom:14px; }
|
|
|
+ .unit-head b { font-size:17px; }
|
|
|
+ .tag { display:inline-block; padding:2px 8px; border-radius:3px; font-size:12px; }
|
|
|
+ .tag-blue { background:#eff6ff; color:#2563eb; }
|
|
|
+ .tag-green { background:#f0fdf4; color:#16a34a; }
|
|
|
+ .tag-gray { background:#f4f4f5; color:#909399; }
|
|
|
+ .card { background:#fff; border-radius:6px; padding:18px 20px; margin-bottom:16px; box-shadow:0 1px 3px rgba(0,0,0,.05); }
|
|
|
+ .card-title { font-size:15px; font-weight:600; display:flex; justify-content:space-between; align-items:center; margin-bottom:14px; }
|
|
|
+ .card-title .tip { font-size:12px; color:#909399; font-weight:400; margin-left:10px; }
|
|
|
+ .btn { height:32px; padding:0 18px; border:none; border-radius:4px; cursor:pointer; font-size:13px; }
|
|
|
+ .btn-primary { background:#2563eb; color:#fff; }
|
|
|
+ .btn-primary:hover { background:#1d4ed8; }
|
|
|
+ .btn-plain { background:#fff; color:#606266; border:1px solid #dcdfe6; }
|
|
|
+ .btn-danger-plain { background:#fff; color:#dc2626; border:1px solid #fca5a5; }
|
|
|
+ .btn-danger-plain:hover { background:#fef2f2; }
|
|
|
+ .info-grid { display:flex; flex-wrap:wrap; }
|
|
|
+ .info-grid .cell { width:20%; min-width:150px; padding:6px 12px; display:flex; gap:6px; }
|
|
|
+ .info-grid .k { color:#909399; white-space:nowrap; }
|
|
|
+ .info-grid .v { color:#303133; font-weight:500; }
|
|
|
+ .table-wrap { background:#fff; border-radius:6px; padding:0 0 12px; box-shadow:0 1px 3px rgba(0,0,0,.05); overflow-x:auto; }
|
|
|
+ .table-title { padding:16px 20px 12px; font-size:15px; font-weight:600; border-bottom:1px solid #ebeef5; display:flex; justify-content:space-between; align-items:center;}
|
|
|
+ table { width:100%; border-collapse:collapse; }
|
|
|
+ th { background:#f5f7fa; color:#606266; font-weight:600; padding:10px 8px; text-align:left; white-space:nowrap; border-bottom:1px solid #ebeef5; }
|
|
|
+ td { padding:11px 8px; border-bottom:1px solid #f2f4f7; white-space:nowrap; }
|
|
|
+ tr:hover td { background:#f8fafd; }
|
|
|
+ .empty-cell { color:#c0c4cc; }
|
|
|
+ .link { color:#2563eb; cursor:pointer; text-decoration:none; }
|
|
|
+ .link:hover { text-decoration:underline; }
|
|
|
+ .op-link { color:#2563eb; cursor:pointer; margin-right:10px; }
|
|
|
+ .op-link:hover { text-decoration:underline; }
|
|
|
+ .op-link.danger { color:#dc2626; }
|
|
|
+ .removed-row td { color:#909399; background:#fafafa; }
|
|
|
+ .removed-row:hover td { background:#f5f5f5; }
|
|
|
+ .imgs { display:flex; gap:14px; flex-wrap:wrap; }
|
|
|
+ .imgs .ph { width:220px; height:120px; border:1px dashed #dcdfe6; border-radius:6px; display:flex; flex-direction:column;
|
|
|
+ align-items:center; justify-content:center; gap:6px; color:#c0c4cc; background:#fafbfc; }
|
|
|
+ body:not(.show-notes) .note { display:none !important; }
|
|
|
+ body:not(.show-notes) #noteDrawer { display:none !important; }
|
|
|
+ .note { display:inline-flex; min-width:16px; height:16px; padding:0 3px; margin-left:4px; border-radius:8px;
|
|
|
+ background:#f59e0b; color:#fff; font-size:10px; font-style:normal; font-weight:700;
|
|
|
+ align-items:center; justify-content:center; cursor:pointer; position:relative; vertical-align:middle; flex-shrink:0;
|
|
|
+ counter-increment:note; transition:transform .12s; }
|
|
|
+ .note::before { content:counter(note); }
|
|
|
+ .note:hover { background:#d97706; transform:scale(1.15); }
|
|
|
+ .note.cur { background:#22c55e; box-shadow:0 0 0 3px rgba(34,197,94,.35); }
|
|
|
+ #noteLine { position:fixed; inset:0; z-index:1099; pointer-events:none; }
|
|
|
+ #noteDrawer { display:none; position:relative; z-index:1100; width:370px; height:100vh; flex-shrink:0;
|
|
|
+ background:#fffdf5; border-left:1px solid #f3ce84;
|
|
|
+ box-shadow:-8px 0 24px rgba(31,45,61,.14); flex-direction:column; }
|
|
|
+ #noteDrawer.show { display:flex; }
|
|
|
+ @media (max-width:1550px) { #noteDrawer { width:310px; } }
|
|
|
+ @media (max-width:1300px) { #noteDrawer { width:280px; } }
|
|
|
+ #noteDrawer .nd-head { padding:14px 18px; border-bottom:1px solid #f3ce84; display:flex;
|
|
|
+ align-items:center; justify-content:space-between; background:#fff7e8; }
|
|
|
+ #noteDrawer .nd-head b { font-size:14px; color:#1f2d3d; }
|
|
|
+ #noteDrawer .nd-pos { font-size:12px; color:#b45309; margin-left:8px; font-weight:400; }
|
|
|
+ #noteDrawer .nd-close { cursor:pointer; color:#909399; font-size:18px; padding:0 4px; }
|
|
|
+ #noteDrawer .nd-close:hover { color:#303133; }
|
|
|
+ #noteDrawer .nd-body { flex:1; overflow-y:auto; padding:16px 18px; font-size:12.5px; line-height:1.85; color:#4b5563; }
|
|
|
+ #noteDrawer .nd-foot { padding:12px 18px; border-top:1px solid #f3ce84; display:flex;
|
|
|
+ justify-content:space-between; align-items:center; background:#fff7e8; }
|
|
|
+ #noteDrawer .nd-foot .nav-btn { height:30px; padding:0 16px; border:1px solid #f3ce84; background:#fff;
|
|
|
+ color:#b45309; border-radius:4px; cursor:pointer; font-size:12.5px; }
|
|
|
+ #noteDrawer .nd-foot .nav-btn:hover { background:#fef3c7; }
|
|
|
+ #noteDrawer .nd-foot .nav-btn:disabled { color:#c0c4cc; cursor:not-allowed; background:#fafafa; }
|
|
|
+ #noteDrawer .np-t { font-size:13.5px; font-weight:700; color:#1f2d3d; padding-bottom:8px; margin-bottom:6px;
|
|
|
+ border-bottom:1px dashed #f3ce84; }
|
|
|
+ #noteDrawer .nd-body > div { margin-top:5px; }
|
|
|
+ #noteDrawer .np-k { color:#2563eb; font-weight:600; }
|
|
|
+ #noteDrawer .np-c { font-family:Consolas,"Courier New",monospace; color:#c2410c; background:#fdf2e9;
|
|
|
+ padding:1px 5px; border-radius:3px; font-size:12px; }
|
|
|
+ #noteDrawer .np-i { font-family:Consolas,"Courier New",monospace; color:#0e7490; font-size:12px; }
|
|
|
+ #noteDrawer .np-w { color:#d97706; font-weight:600; }
|
|
|
+ .btn-note { background:#fff7ed; color:#d97706; border:1px solid #fdba74; }
|
|
|
+ .btn-note.on { background:#f59e0b; color:#fff; border-color:#f59e0b; }
|
|
|
+ .mask { display:none; position:fixed; inset:0; background:rgba(0,0,0,.45); z-index:100; align-items:flex-start; justify-content:center; overflow:auto; padding:60px 0; }
|
|
|
+ .mask.show { display:flex; }
|
|
|
+ .dialog { width:560px; max-width:100%; background:#fff; border-radius:8px; box-shadow:0 8px 30px rgba(0,0,0,.18); }
|
|
|
+ .dialog-head { padding:16px 24px; border-bottom:1px solid #ebeef5; display:flex; justify-content:space-between; align-items:center; }
|
|
|
+ .dialog-head b { font-size:15px; }
|
|
|
+ .close { cursor:pointer; color:#909399; font-size:18px; }
|
|
|
+ .dialog-body { padding:20px 24px 8px; }
|
|
|
+ .fgrid { display:flex; flex-wrap:wrap; }
|
|
|
+ .fgrid .fitem { width:50%; padding:0 12px 16px 0; }
|
|
|
+ .fgrid .fitem label { display:block; color:#606266; margin-bottom:6px; }
|
|
|
+ .fgrid .fitem input { width:100%; height:34px; border:1px solid #dcdfe6; border-radius:4px; padding:0 10px; color:#606266; outline:none; }
|
|
|
+ .fgrid .fitem input:focus { border-color:#2563eb; }
|
|
|
+ .dialog-foot { padding:14px 24px 18px; display:flex; justify-content:flex-end; gap:10px; }
|
|
|
+ .confirm-box { width:400px; }
|
|
|
+ .confirm-body { padding:26px 24px; text-align:center; font-size:14px; color:#303133; }
|
|
|
+ .confirm-foot { padding:0 24px 20px; display:flex; justify-content:center; gap:12px; }
|
|
|
+ .toast { position:fixed; top:70px; left:50%; transform:translateX(-50%); background:#1f2d3d; color:#fff;
|
|
|
+ padding:10px 22px; border-radius:6px; font-size:13px; z-index:2000; box-shadow:0 4px 16px rgba(0,0,0,.25); }
|
|
|
+</style>
|
|
|
+</head>
|
|
|
+<body>
|
|
|
+<div id="protoWrap">
|
|
|
+<div class="layout">
|
|
|
+ <div class="nav">
|
|
|
+ <div class="logo">恒隆公寓AMS</div>
|
|
|
+ <div class="group"><div class="group-title">业务工作台</div>
|
|
|
+ <div class="item">招商管理</div><div class="item">租控管理</div>
|
|
|
+ <div class="item">预定管理</div><div class="item">合同管理</div><div class="item">入住管理</div>
|
|
|
+ </div>
|
|
|
+ <div class="group"><div class="group-title">资源规划</div>
|
|
|
+ <div class="item">项目配置</div><div class="item">费项配置</div><div class="item">底价管理</div>
|
|
|
+ <div class="item">楼宇管理</div><div class="item active">单元管理</div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="main">
|
|
|
+ <div class="topbar">
|
|
|
+ <div class="breadcrumb">资源规划 / 单元管理 / <b>单元详情</b></div>
|
|
|
+ <div class="user"><div class="avatar">管</div>系统管理员</div>
|
|
|
+ </div>
|
|
|
+ <div class="content">
|
|
|
+
|
|
|
+ <div class="unit-head"><b>单元 1</b><span class="tag tag-blue">普通单元</span><span class="tag tag-green">空置</span><i class="note" data-tip="单元详情主体\n接口:GET /v1/unit/info?unit_id=(网关 ProjectGatewayController,面积精度走 NumFormatAnnotation 字典)\n本原型聚焦家具信息区块,基础信息/图片信息仅作页面上下文示意"></i></div>
|
|
|
+
|
|
|
+ <!-- 基础信息 -->
|
|
|
+ <div class="card">
|
|
|
+ <div class="card-title"><span>基础信息<i class="note" data-tip="基础信息区块\n接口:GET /v1/unit/info?unit_id=\n字段即 ProjectUnitInfoVO(projectName/buildingName/floorName/unitName/unitType/basePrice/unitAcreage/consAcreage/innerAcreage/otherAcreage/houseStyle/streetType/decorationType/orientationType 等)\n与家具信息无耦合,此处仅示意"></i></span><span style="font-size:12px;color:#909399;font-weight:400">编辑</span></div>
|
|
|
+ <div class="info-grid">
|
|
|
+ <div class="cell"><span class="k">项目:</span><span class="v">研发测试项目</span></div>
|
|
|
+ <div class="cell"><span class="k">楼栋:</span><span class="v">1号楼</span></div>
|
|
|
+ <div class="cell"><span class="k">楼层:</span><span class="v">18楼</span></div>
|
|
|
+ <div class="cell"><span class="k">单元名称:</span><span class="v">1</span></div>
|
|
|
+ <div class="cell"><span class="k">单元类型:</span><span class="v">普通单元</span></div>
|
|
|
+ <div class="cell"><span class="k">单元面积:</span><span class="v">100.00㎡</span></div>
|
|
|
+ <div class="cell"><span class="k">建筑面积:</span><span class="v">100.00㎡</span></div>
|
|
|
+ <div class="cell"><span class="k">套内面积:</span><span class="v">80.00㎡</span></div>
|
|
|
+ <div class="cell"><span class="k">户型:</span><span class="v">两室一厅</span></div>
|
|
|
+ <div class="cell"><span class="k">朝向:</span><span class="v">南</span></div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <!-- 家具信息(核心) -->
|
|
|
+ <div class="table-wrap">
|
|
|
+ <div class="table-title"><span>家具信息<i class="note" data-tip="★家具信息区块(本页核心)\n上线:2026-07(单元家具配置,rent+gateway+contract 三层);本次任务11328(2026-08-27)补齐删除接口并已部署测试环境\n合同联动:创建合同(预订单转合同)时后端自动拉取本单元[未移除且未删除]的家具快照入 contract_furniture,合同详情返回 furnitureList——前端零传参\n联调文档:docs/恒隆AMS-单元管理家具信息-前端联调说明.md"></i></span><span class="tip">在创建合同时自动带出该单元家具</span>
|
|
|
+ <span style="display:flex;gap:8px;align-items:center">
|
|
|
+ <button class="btn btn-primary" onclick="openAdd()">新增</button>
|
|
|
+ <button class="btn btn-note" id="noteBtn" onclick="toggleNotes()">ⓘ 逻辑标注</button>
|
|
|
+ </span>
|
|
|
+ </div>
|
|
|
+ <table>
|
|
|
+ <thead><tr>
|
|
|
+ <th style="width:40px">序<i class="note" data-tip="列结构(以线上实测为准)\n线上列头:序/家具中文名/家具英文名/型号/位置/台数/购置年份/移出时间/操作\n【设计差异】墨刀需求稿无[序]列且叫[移除时间],线上实现叫[移出时间]——以线上为准"></i></th>
|
|
|
+ <th>家具中文名<i class="note" data-tip="家具中文名\n字段:furnitureName(文本,varchar 64)\n返回项无 unitId,行归属靠列表上下文"></i></th>
|
|
|
+ <th>家具英文名<i class="note" data-tip="家具英文名\n字段:furnitureNameEn(文本)"></i></th>
|
|
|
+ <th>型号<i class="note" data-tip="型号\n字段:furnitureModel(文本)"></i></th>
|
|
|
+ <th>位置<i class="note" data-tip="位置\n字段:furniturePosition(文本,如 客厅/卧室)"></i></th>
|
|
|
+ <th>台数<i class="note" data-tip="台数\n字段:furnitureNum(字符串整数)\n约束:数量整数——前端数字控件保证,后端字段为 varchar 不再校验"></i></th>
|
|
|
+ <th>购置年份<i class="note" data-tip="购置年份\n字段:furniturePurchaseDate(日期,date 型)\n需求说任选年份,线上控件为完整日期选择(如 2026-07-08)\n【坑】日期为空串提交会 500(Jackson 日期解析失败)——前端不选日期时应不传该字段而非传空串"></i></th>
|
|
|
+ <th>移出时间<i class="note" data-tip="移出时间(墨刀叫移除时间,线上叫移出时间)\n字段:removeTime——后端在移出时自动写当前时间+移出人(removeUserName)\n只读列:未移出显示 --,前端不输入\n返回为毫秒时间戳,前端自行格式化"></i></th>
|
|
|
+ <th style="width:170px">操作<i class="note" data-tip="操作列按行状态显隐\n未移除行(N):编辑 / 移出\n已移除行(Y):仅 编辑(整行置灰)\n【后端红线】已移除行再点编辑保存,后端静默跳过——不生效也不报错"></i></th>
|
|
|
+ </tr></thead>
|
|
|
+ <tbody id="tbody"></tbody>
|
|
|
+ </table>
|
|
|
+ <div class="empty" id="emptyBox" style="display:none; text-align:center; padding:50px 0; color:#909399;"><div style="font-size:36px; margin-bottom:10px;">🛋️</div>暂无家具,点击右上角[新增]</div>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <!-- 图片信息 -->
|
|
|
+ <div class="card">
|
|
|
+ <div class="card-title"><span>图片信息<i class="note" data-tip="图片信息区块\n接口:PUT /v1/units/{unit_id}/imgs(unit_position_img/unit_plain_img/cons_imgs/inner_imgs)\n与家具无关,仅作页面上下文示意"></i></span><span style="font-size:12px;color:#909399;font-weight:400">编辑</span></div>
|
|
|
+ <div class="imgs">
|
|
|
+ <div class="ph"><span style="font-size:26px">🗺️</span>楼层平面落位:暂无图片,请上传</div>
|
|
|
+ <div class="ph"><span style="font-size:26px">📐</span>单元平面图:暂无图片,请上传</div>
|
|
|
+ <div class="ph"><span style="font-size:26px">🧰</span>装修图:暂无图片,请上传</div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+</div>
|
|
|
+</div><!-- /protoWrap -->
|
|
|
+
|
|
|
+<!-- 新增/编辑弹窗 -->
|
|
|
+<div class="mask" id="fDlg">
|
|
|
+ <div class="dialog">
|
|
|
+ <div class="dialog-head"><b id="fDlgTitle">家具新增</b><i class="note" data-tip="编辑弹窗(线上实测形态)\n线上为弹窗编辑(非墨刀的行内编辑);新增态无[删除]按钮,编辑态有\n弹窗数据来自所在行的行内编辑,整行字段全部回传"></i><span class="close" onclick="closeF()">✕</span></div>
|
|
|
+ <div class="dialog-body">
|
|
|
+ <div class="fgrid">
|
|
|
+ <div class="fitem"><label>家具中文名</label><input id="fName" placeholder="请输入家具中文名"></div>
|
|
|
+ <div class="fitem"><label>家具英文名</label><input id="fNameEn" placeholder="请输入家具英文名"></div>
|
|
|
+ <div class="fitem"><label>型号</label><input id="fModel" placeholder="请输入型号"></div>
|
|
|
+ <div class="fitem"><label>位置</label><input id="fPos" placeholder="请输入位置"></div>
|
|
|
+ <div class="fitem"><label>台数</label><input id="fNum" type="number" min="1" step="1" placeholder="请输入台数"></div>
|
|
|
+ <div class="fitem"><label>购置年份</label><input id="fDate" type="date"></div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="dialog-foot">
|
|
|
+ <span style="flex:1"></span>
|
|
|
+ <button class="btn btn-primary" onclick="saveF()">确定<i class="note" data-tip="确定=保存\n接口:POST /v1/unit/furniture(JSON body:{unitId, furnitureList:[整行]})\n规则:行内 id 空=新增(removeFlag 强制 N,记录创建人);id 有值=整行覆盖更新\n【红线】整行覆盖更新——漏传的文本字段会被清成空,移出时务必整行回传\noperatorId/operatorName 由网关按登录态注入,前端不传"></i></button>
|
|
|
+ <button class="btn btn-danger-plain" id="fDelBtn" onclick="confirmDel()">删除<i class="note" data-tip="★删除按钮——任务11328 本次新增的后端能力\n前端按钮线上早已存在,后端接口 2026-08-27 补齐(gateway-pc+service-rent 同日部署测试环境实测生效)\n【改动前实证】点删除返回200但行不消失——后端无接口,前端仅本地隐藏,刷新页面行又回来"></i></button>
|
|
|
+ <button class="btn btn-plain" onclick="closeF()">取消</button>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+</div>
|
|
|
+
|
|
|
+<!-- 确认弹窗(移出/删除共用) -->
|
|
|
+<div class="mask" id="cDlg">
|
|
|
+ <div class="dialog confirm-box">
|
|
|
+ <div class="confirm-body" id="cText">确认移除该家具?</div>
|
|
|
+ <div class="confirm-foot">
|
|
|
+ <button class="btn btn-primary" id="cOk">确认</button>
|
|
|
+ <button class="btn btn-plain" onclick="closeC()">取消</button>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+</div>
|
|
|
+
|
|
|
+<script>
|
|
|
+/* ===== 示例数据(与测试环境真实数据同构:2 未移除 + 2 已移除) ===== */
|
|
|
+let SEQ = 6;
|
|
|
+const DATA = [
|
|
|
+ { id:"3", name:"沙发", nameEn:"shafa", model:"慕客", pos:"客厅", num:"1", date:"2026-07-08", removeFlag:"Y", removeTime:"2026-07-08 18:07" },
|
|
|
+ { id:"4", name:"空调", nameEn:"kongtiao", model:"美的", pos:"卧室", num:"3", date:"2026-07-17", removeFlag:"N", removeTime:null },
|
|
|
+ { id:"5", name:"家具2", nameEn:"jiaju2", model:"型号2", pos:"客厅2", num:"3", date:"2026-07-09", removeFlag:"Y", removeTime:"2026-07-08 18:25" },
|
|
|
+ { id:"6", name:"电视机", nameEn:"TV", model:"TCL", pos:"客厅", num:"2", date:"2025-03-21", removeFlag:"N", removeTime:null }
|
|
|
+];
|
|
|
+let editingId = null;
|
|
|
+
|
|
|
+function render(){
|
|
|
+ const tb = document.getElementById("tbody");
|
|
|
+ if(!DATA.length){ tb.innerHTML=""; document.getElementById("emptyBox").style.display="block"; return; }
|
|
|
+ document.getElementById("emptyBox").style.display="none";
|
|
|
+ tb.innerHTML = DATA.map((f,i)=>{
|
|
|
+ const removed = f.removeFlag==="Y";
|
|
|
+ const ops = removed
|
|
|
+ ? `<span class="op-link" style="color:#909399" onclick="openEdit('${f.id}')">编辑</span>`
|
|
|
+ : `<span class="op-link" onclick="openEdit('${f.id}')">编辑</span><span class="op-link danger" onclick="confirmRemove('${f.id}')">移出</span>`;
|
|
|
+ return `<tr class="${removed?"removed-row":""}">
|
|
|
+ <td>${i+1}</td>
|
|
|
+ <td>${f.name}</td><td>${f.nameEn}</td><td>${f.model}</td><td>${f.pos}</td>
|
|
|
+ <td>${f.num}</td><td>${f.date}</td>
|
|
|
+ <td>${removed ? f.removeTime : '<span class="empty-cell">--</span>'}</td>
|
|
|
+ <td>${ops}</td></tr>`;
|
|
|
+ }).join("");
|
|
|
+}
|
|
|
+
|
|
|
+function openAdd(){
|
|
|
+ editingId = null;
|
|
|
+ document.getElementById("fDlgTitle").textContent = "家具新增";
|
|
|
+ ["fName","fNameEn","fModel","fPos","fNum","fDate"].forEach(i=>document.getElementById(i).value="");
|
|
|
+ document.getElementById("fDelBtn").style.display = "none";
|
|
|
+ document.getElementById("fDlg").classList.add("show");
|
|
|
+}
|
|
|
+function openEdit(id){
|
|
|
+ const f = DATA.find(x=>x.id===id); if(!f) return;
|
|
|
+ editingId = id;
|
|
|
+ document.getElementById("fDlgTitle").textContent = "家具编辑";
|
|
|
+ document.getElementById("fName").value=f.name; document.getElementById("fNameEn").value=f.nameEn;
|
|
|
+ document.getElementById("fModel").value=f.model; document.getElementById("fPos").value=f.pos;
|
|
|
+ document.getElementById("fNum").value=f.num; document.getElementById("fDate").value=f.date;
|
|
|
+ document.getElementById("fDelBtn").style.display = "";
|
|
|
+ document.getElementById("fDlg").classList.add("show");
|
|
|
+}
|
|
|
+function closeF(){ document.getElementById("fDlg").classList.remove("show"); }
|
|
|
+
|
|
|
+function saveF(){
|
|
|
+ const name = document.getElementById("fName").value.trim();
|
|
|
+ const num = document.getElementById("fNum").value;
|
|
|
+ if(!name){ toast("请输入家具中文名"); return; }
|
|
|
+ if(num!=="" && !/^\d+$/.test(num)){ toast("台数必须为整数"); return; }
|
|
|
+ if(!editingId){
|
|
|
+ DATA.push({ id:String(++SEQ), name, nameEn:document.getElementById("fNameEn").value.trim(),
|
|
|
+ model:document.getElementById("fModel").value.trim(), pos:document.getElementById("fPos").value.trim(),
|
|
|
+ num:num||"1", date:document.getElementById("fDate").value||"—", removeFlag:"N", removeTime:null });
|
|
|
+ toast("已新增(POST 行内 id 为空)");
|
|
|
+ } else {
|
|
|
+ const f = DATA.find(x=>x.id===editingId);
|
|
|
+ if(f.removeFlag==="Y"){ closeF(); toast("已移除的行保存会被后端静默跳过(不生效不报错)"); return; }
|
|
|
+ f.name=name; f.nameEn=document.getElementById("fNameEn").value.trim();
|
|
|
+ f.model=document.getElementById("fModel").value.trim(); f.pos=document.getElementById("fPos").value.trim();
|
|
|
+ f.num=num||"1"; f.date=document.getElementById("fDate").value||"—";
|
|
|
+ toast("已保存(POST 整行回传,整行覆盖更新)");
|
|
|
+ }
|
|
|
+ closeF(); render();
|
|
|
+}
|
|
|
+
|
|
|
+let cAction = null;
|
|
|
+function confirmRemove(id){
|
|
|
+ document.getElementById("cText").innerHTML = '确认移除该家具?<i class="note" data-tip="移出确认弹窗(线上实测文案)\n文案:确认移除该家具?\n确认=POST /v1/unit/furniture 整行回传+removeFlag=Y;后端自动写移出时间/移出人\n误操作恢复=重新[新增]一条同样信息,后端不去重(Y 行保留可查)"></i>';
|
|
|
+ cAction = ()=>{ const f=DATA.find(x=>x.id===id); if(f){ f.removeFlag="Y"; f.removeTime=fmtNow(); render(); toast("已移出:行置灰,操作列仅剩[编辑]"); } };
|
|
|
+ document.getElementById("cDlg").classList.add("show");
|
|
|
+}
|
|
|
+function confirmDel(){
|
|
|
+ document.getElementById("cText").innerHTML = '确认删除该家具?删除后不可恢复。<i class="note" data-tip="★删除确认弹窗(线上实测文案)——本次任务11328 核心\n文案:确认删除该家具?删除后不可恢复。\n确认=DELETE /v1/unit/furniture?id=家具id(2026-08-27 新增,gateway-pc 透传 service-rent)\n行为:逻辑删除 unit_furniture.deleted=1——N/Y 列表彻底消失,也不再进入合同家具快照\n错误:id 不存在返回业务错误码 UNIT_FURNITURE_NOT_EXIST(该家具不存在)\n【与移出的区别】移出=软操作留痕(N/Y 可查);删除=硬移除"></i>';
|
|
|
+ cAction = ()=>{ const i=DATA.findIndex(x=>x.id===editingId); if(i>-1){ DATA.splice(i,1); render(); toast("已删除(DELETE ?id=):行从列表彻底消失"); } closeF(); };
|
|
|
+ document.getElementById("cDlg").classList.add("show");
|
|
|
+}
|
|
|
+document.getElementById("cOk").onclick = ()=>{ if(cAction) cAction(); closeC(); };
|
|
|
+function closeC(){ document.getElementById("cDlg").classList.remove("show"); cAction=null; }
|
|
|
+
|
|
|
+function fmtNow(){ const d=new Date(), p=n=>String(n).padStart(2,"0"); return `${d.getFullYear()}-${p(d.getMonth()+1)}-${p(d.getDate())} ${p(d.getHours())}:${p(d.getMinutes())}`; }
|
|
|
+let toastTimer=null;
|
|
|
+function toast(msg){ const t=document.createElement("div"); t.className="toast"; t.textContent=msg; document.body.appendChild(t);
|
|
|
+ clearTimeout(toastTimer); toastTimer=setTimeout(()=>t.remove(), 2600); }
|
|
|
+
|
|
|
+function toggleNotes(){
|
|
|
+ document.body.classList.toggle("show-notes");
|
|
|
+ document.getElementById("noteBtn").classList.toggle("on");
|
|
|
+ if(!document.body.classList.contains("show-notes") && window.closeNotes) window.closeNotes();
|
|
|
+ if(document.body.classList.contains("show-notes") && window.openNotes) window.openNotes();
|
|
|
+ fitLayout();
|
|
|
+}
|
|
|
+function fitLayout(){
|
|
|
+ var layout=document.querySelector(".layout");
|
|
|
+ if(!document.body.classList.contains("show-notes")){ layout.style.zoom=""; layout.style.width=""; return; }
|
|
|
+ var wrap=document.getElementById("protoWrap");
|
|
|
+ var scale=Math.max(0.62, Math.min(1,(wrap.clientWidth-2)/1500));
|
|
|
+ layout.style.width="1500px";
|
|
|
+ layout.style.zoom=scale;
|
|
|
+}
|
|
|
+(function(){
|
|
|
+ const drawer = document.createElement("div"); drawer.id="noteDrawer";
|
|
|
+ drawer.innerHTML = `
|
|
|
+ <div class="nd-head"><span><b>逻辑标注</b><span class="nd-pos" id="ndPos"></span></span>
|
|
|
+ <span class="nd-close" onclick="closeNotes()">✕</span></div>
|
|
|
+ <div class="nd-body" id="ndBody"></div>
|
|
|
+ <div class="nd-foot"><button class="nav-btn" id="ndPrev">‹ 上一条</button>
|
|
|
+ <span style="font-size:12px;color:#b45309" id="ndStep"></span>
|
|
|
+ <button class="nav-btn" id="ndNext">下一条 ›</button></div>`;
|
|
|
+ document.body.appendChild(drawer);
|
|
|
+ const svg = document.createElementNS("http://www.w3.org/2000/svg","svg");
|
|
|
+ svg.id="noteLine"; document.body.appendChild(svg);
|
|
|
+ function drawLine(n){
|
|
|
+ svg.innerHTML="";
|
|
|
+ if(!n) return;
|
|
|
+ const r = n.getBoundingClientRect(), d = drawer.getBoundingClientRect();
|
|
|
+ const x1 = r.right + 3, y1 = r.top + r.height/2;
|
|
|
+ const x2 = d.left - 3, y2 = Math.max(d.top + 50, Math.min(y1, d.bottom - 50));
|
|
|
+ svg.innerHTML = `<path d="M ${x1} ${y1} C ${x1+50} ${y1}, ${x2-50} ${y2}, ${x2} ${y2}" fill="none"
|
|
|
+ stroke="#f59e0b" stroke-width="1.5" stroke-dasharray="5 3"/>
|
|
|
+ <circle cx="${x1}" cy="${y1}" r="3" fill="#16a34a"/>
|
|
|
+ <circle cx="${x2}" cy="${y2}" r="3.5" fill="#f59e0b"/>`;
|
|
|
+ }
|
|
|
+ window.closeNotes = function(){
|
|
|
+ drawer.classList.remove("show");
|
|
|
+ curNote().classList.remove("cur");
|
|
|
+ drawLine(null);
|
|
|
+ document.body.classList.remove("show-notes");
|
|
|
+ var btn=document.getElementById("noteBtn"); if(btn) btn.classList.remove("on");
|
|
|
+ if(window.fitLayout) fitLayout();
|
|
|
+ };
|
|
|
+ window.openNotes = function(){ collect(); if(notes.length) show(0); };
|
|
|
+ window.addEventListener("resize", ()=>{ if(drawer.classList.contains("show")) drawLine(notes[idx]); });
|
|
|
+ function fmt(text){
|
|
|
+ const lines = (text||"").replace(/\\n/g,"\n").split("\n");
|
|
|
+ const esc = t => t.replace(/&/g,"&").replace(/</g,"<");
|
|
|
+ const rich = t => t.split(/([A-Za-z][A-Za-z0-9_.\/={}\-]*)/g)
|
|
|
+ .map((p,i)=> i%2===1 ? `<span class="np-i">${p}</span>` : esc(p)).join("");
|
|
|
+ let html = "";
|
|
|
+ lines.forEach((line,i)=>{
|
|
|
+ const s = line;
|
|
|
+ if(i===0 && s.trim()){ html += `<div class="np-t">${esc(s)}</div>`; return; }
|
|
|
+ if(!s.trim()){ return; }
|
|
|
+ let body;
|
|
|
+ const m = s.match(/^([^::=]{2,14})([::])([\s\S]*)$/);
|
|
|
+ if(m){
|
|
|
+ const val = m[3];
|
|
|
+ body = `<span class="np-k">${esc(m[1])}${m[2]}</span>` +
|
|
|
+ (/[=Σ]|max\(/.test(val) ? `<span class="np-c">${esc(val)}</span>` : rich(val));
|
|
|
+ } else if(/[=Σ]|max\(/.test(s)){
|
|
|
+ body = `<span class="np-c">${esc(s)}</span>`;
|
|
|
+ } else {
|
|
|
+ body = rich(s);
|
|
|
+ }
|
|
|
+ body = body.replace(/【(.+?)】/g,'<span class="np-w">【$1】</span>');
|
|
|
+ html += `<div>${body}</div>`;
|
|
|
+ });
|
|
|
+ return html;
|
|
|
+ }
|
|
|
+ let notes = [], idx = -1;
|
|
|
+ const collect = () => { notes = Array.prototype.slice.call(document.querySelectorAll(".note")); return notes; };
|
|
|
+ function curNote(){ return notes[idx] || document.createElement("span"); }
|
|
|
+ function show(i){
|
|
|
+ const c = curNote(); c.classList && c.classList.remove("cur");
|
|
|
+ idx = i;
|
|
|
+ const n = notes[i];
|
|
|
+ document.getElementById("ndBody").innerHTML = fmt(n.dataset.tip);
|
|
|
+ document.getElementById("ndPos").textContent = "";
|
|
|
+ document.getElementById("ndStep").textContent = (i+1) + " / " + notes.length;
|
|
|
+ document.getElementById("ndPrev").disabled = (i<=0);
|
|
|
+ document.getElementById("ndNext").disabled = (i>=notes.length-1);
|
|
|
+ n.classList.add("cur");
|
|
|
+ n.scrollIntoView({block:"nearest", behavior:"smooth"});
|
|
|
+ drawer.classList.add("show");
|
|
|
+ drawLine(n);
|
|
|
+ }
|
|
|
+ document.addEventListener("click",e=>{
|
|
|
+ if(!document.body.classList.contains("show-notes")) return;
|
|
|
+ const n = e.target.closest(".note");
|
|
|
+ if(n){ e.stopPropagation(); collect(); show(notes.indexOf(n)); return; }
|
|
|
+ });
|
|
|
+ document.getElementById("ndPrev").onclick = ()=>{ if(idx>0) show(idx-1); };
|
|
|
+ document.getElementById("ndNext").onclick = ()=>{ if(idx<notes.length-1) show(idx+1); };
|
|
|
+ document.addEventListener("keydown",e=>{
|
|
|
+ if(!drawer.classList.contains("show")) return;
|
|
|
+ if(e.key==="Escape") closeNotes();
|
|
|
+ if(e.key==="ArrowLeft" && idx>0) show(idx-1);
|
|
|
+ if(e.key==="ArrowRight" && idx<notes.length-1) show(idx+1);
|
|
|
+ });
|
|
|
+})();
|
|
|
+window.addEventListener("resize", fitLayout);
|
|
|
+render();
|
|
|
+</script>
|
|
|
+</body>
|
|
|
+</html>
|