# v13-f2 Task 2.6 — Link + Button 菜单 0 误差决策 > **v13-f2 Task 2.6 决策**: Link (外链) + Button 菜单 0 误差打磨 > **2026-06-12** --- ## 1. 现状调研 ### 1.1 DB 端 0 样本 | 维度 | 结果 | |------|------| | `base_module WHERE f_category IN ('Link','Button')` | **0 行** | | `base_module WHERE f_type = 0` | **0 行** (type=0 不存在) | | `base_module WHERE f_link_target = '_blank' AND f_type = 7` | 1 行 (`onlineDev.dataScreen`, no-spa `${dataV}?token=...`) | | `base_module WHERE f_link_target = '_blank' AND f_type = 6` | 3 行 (大屏类型) | **结论**: JNPF 平台 DB 没有 category=Link/Button 的字段,**Link/Button 是 JNPF 菜单设计器 UI 层的概念**,不是 DB 字段值。 ### 1.2 前端映射 (Form.vue line 75-87) ```ts const typeData: any[] = [ { id: 1, fullName: '目录' }, { id: 11, fullName: '表单回传' }, { id: 2, fullName: '页面' }, { id: 3, fullName: '在线表单' }, { id: 9, fullName: '流程' }, { id: 4, fullName: '字典' }, { id: 10, fullName: '报表' }, { id: 5, fullName: '报表(原)' }, { id: 6, fullName: '大屏' }, { id: 8, fullName: '门户' }, { id: 7, fullName: '外链' }, // ← Link 在 JNPF 设计器里就是 type=7 ]; ``` **没有独立的 "Button" type**。Button 概念 = 父菜单的子节点 (add/edit/delete 等权限按钮)。 ### 1.3 前端 authorize 规则 (Form.vue line 271-295) ```ts function onTypeChange(val) { if ([2, 3, 4, 9, 11].includes(val)) { state.dataForm.isButtonAuthorize = 1; state.dataForm.isColumnAuthorize = 1; state.dataForm.isFormAuthorize = 1; state.dataForm.isDataAuthorize = 1; } else { // type = 1, 5, 6, 7, 8, 10 全部走 0 state.dataForm.isButtonAuthorize = 0; state.dataForm.isColumnAuthorize = 0; state.dataForm.isFormAuthorize = 0; state.dataForm.isDataAuthorize = 0; } state.dataForm.linkTarget = val == 6 ? '_blank' : '_self'; } ``` **关键**: - type=7 (外链) → 4 authorize 全 **0** (修正原 LinkMenuBuilder 的 bug: 写 1 错了) - 任何 type 不在 [2,3,4,9,11] 列表 → 4 authorize 全 0 ### 1.4 唯一 _blank + type=7 DB 样本 (实测) | 字段 | 值 | |------|-----| | id | `643238393602125` | | type | 7 | | category | Web | | urlAddress | `${dataV}?token=${jnpfToken}&appCode=${jnpfAppCode}` | | linkTarget | `_blank` | | 4 authorize | **1, 1, 1, 1** ← 这是 no-spa 模式 (system 模板, 不是普通外链) | | propertyJson | `{"moduleId":"","iconBackgroundColor":"","isTree":0}` (3 字段) | > 注: 这是 JNPF 平台系统自带的"大屏设计"菜单 (no-spa 模式), 不是普通外链. 普通外链没有 DB 样本. --- ## 2. 决策 (按 JNPF Form.vue 前端规则 + DB 实测) ### 2.1 LinkMenuBuilder (外链) 决策 | 字段 | 值 | 依据 | |------|-----|------| | type | **7** (int) | Form.vue line 73, 86: type=7 = 外链 | | category | **Web** | 跟 no-spa 一致 (都是 type=7) | | linkTarget | **`_blank`** | 跟所有 _blank 样本一致 | | urlAddress | **http(s)://...** 透传 | Form.vue line 297: '地址以http://或https://为开头' | | pageAddress | = urlAddress | 跟 no-spa 一致 | | 4 authorize | **0, 0, 0, 0** | Form.vue line 281-291: type=7 不在 [2,3,4,9,11] → 全 0 | | moduleId | **""** | 实体字段, 跟 propertyJson.moduleId 同步 (盲点 JNPF-30) | | icon | `icon-ym icon-ym-link` | 默认 | | propertyJson | **3 字段** `{moduleId:"", iconBackgroundColor:"", isTree:0}` | 跟唯一 type=7 样本一致 (3 字段) | | sortCode | 0 | 默认 | | enabledMark | 1 | 默认 | | noShow | 0 | 默认 | | systemId | ctx.extra.systemId | 透传 | **修正原 LinkMenuBuilder 的 bug**: - 原 stub `entity.put("type", "7")` → 改为 `entity.put("type", 7)` (int, 盲点 JNPF-30) - 原 stub `entity.put("isButtonAuthorize", 1)` 等 4 个全 1 → 改为全 0 (Form.vue line 287-290) - 原 stub `entity.put("category", "Web")` → 保留 - 原 stub `pj.put("webType", 7)` → 删除 (跟唯一 DB 样本 3 字段一致, 不是 no-spa 4 字段) ### 2.2 ButtonMenuBuilder (按钮权限) 决策 > **JNPF 设计器中 "Button" 没有独立 type**. Button 概念 = 父菜单的子节点 (add/edit/delete 等). > 在 DB 中通常体现为: parent 是 Web 菜单, child 是无页面 (无 urlAddress) 的子节点, type 可以是 0 (老 JNPF) 或 1 (新 JNPF). | 字段 | 值 | 依据 | |------|-----|------| | type | **0** (int) | 老 JNPF Button 概念, ButtonMenuBuilder 沿用 | | category | **Web** | 跟 Web 父菜单一致 (按钮是 Web 菜单的子) | | linkTarget | **`_self`** (默认) | 按钮不跳转 | | urlAddress | **null/不写** | 按钮无页面 | | pageAddress | **null/不写** | 按钮无页面 | | 4 authorize | **0, 0, 0, 0** | Form.vue line 287-290: type=0 不在 [2,3,4,9,11] → 全 0 | | moduleId | **""** | 按钮无关联表单 | | icon | 用户指定 (默认 `""`) | 按钮通常无图标 | | propertyJson | **3 字段** `{moduleId:"", iconBackgroundColor:"", isTree:0}` | 跟 Link 一致 | | sortCode | 0 | 默认 | | enabledMark | 1 | 默认 | | noShow | 0 | 默认 | | systemId | ctx.extra.systemId | 透传 | | parentId | **必填 != -1** | 按钮必须挂到父菜单下 | **修正原 ButtonMenuBuilder 的 bug**: - 原 stub `entity.put("type", "0")` → 改为 `entity.put("type", 0)` (int, 盲点 JNPF-30) - 原 stub 4 authorize = 1 (虽然没显式写但 AuthorizeFieldsBuilder 默认 1) → 改为全 0 - 原 stub `linkTarget = "_self"` → 保留 --- ## 3. 跟其它 builder 的关系 | Builder | category() | webType | type | linkTarget | 4 authorize | urlAddress | pj | |---------|-----------|---------|------|------------|-------------|-----------|-----| | **WebMenuBuilder** | "Web" | 1-3, 9 | 1/2/3/9 | _self | 全 1 | model/... | 3-4 字段 | | **NoSpaMenuBuilder** | "Web" | 7 | 7 | _blank | 全 1 | /ssw/... | 4 字段含 webType=7 | | **DataReportMenuBuilder** | "dataReport" | 8/10 | 8/10 | _self/null | 全 0 | report/portal/... | 4 字段 webType=null | | **LinkMenuBuilder** ← | "Link" | 7 | 7 | _blank | **全 0** | http(s)://... | 3 字段 | | **ButtonMenuBuilder** ← | "Button" | 0 | 0 | _self | **全 0** | null | 3 字段 | --- ## 4. 0 误差验证方法 **没有 DB baseline 样本** — 0 误差 = 字段结构 + 值匹配 JNPF 前端 Form.vue line 281-291 规则. ```bash mvn test -pl ssw-dacli -Dtest='LinkMenuBuilderTest,ButtonMenuBuilderTest' -q # 8 个 @Test 通过 ``` --- ## 5. 总结 | 项 | Link | Button | |----|------|--------| | DB 样本 | 0 个 (无 baseline) | 0 个 (无 baseline) | | 决策依据 | JNPF Form.vue line 73, 86, 281-291, 297 | JNPF Form.vue line 281-291 (无独立 Button type) | | 0 误差保证 | 测试断言字段值匹配前端规则 | 测试断言字段值匹配前端规则 | | Link ↔ NoSpa 区别 | Link: http(s):// 外部, pj 3 字段, 4 auth=0 | NoSpa: /ssw/ 平台内, pj 4 字段含 webType, 4 auth=1 |