@agile-team/wl-skills-kit 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +13 -0
- package/README.md +328 -0
- package/bin/wl-skills.js +104 -0
- package/files/.github/copilot-instructions.md +211 -0
- package/files/.github/docs/SYS_MENU_INFO.md +247 -0
- package/files/.github/docs/menu-sync-design.md +265 -0
- package/files/.github/docs/use-skill.md +379 -0
- package/files/.github/docs/wl-skills-kit.md +266 -0
- package/files/.github/skills/api-contract/SKILL.md +247 -0
- package/files/.github/skills/convention-extract/SKILL.md +355 -0
- package/files/.github/skills/menu-sync/SKILL.md +255 -0
- package/files/.github/skills/menu-sync/env/guide.md +73 -0
- package/files/.github/skills/page-codegen/SKILL.md +825 -0
- package/files/.github/skills/page-codegen/TPL-CHANGE-HISTORY.md +281 -0
- package/files/.github/skills/page-codegen/TPL-DETAIL-TABS.md +1112 -0
- package/files/.github/skills/page-codegen/TPL-DRIVEN.md +124 -0
- package/files/.github/skills/page-codegen/TPL-FORM-ROUTE.md +441 -0
- package/files/.github/skills/page-codegen/TPL-LIST.md +196 -0
- package/files/.github/skills/page-codegen/TPL-MASTER-DETAIL.md +153 -0
- package/files/.github/skills/page-codegen/TPL-OPERATION-STATION.md +442 -0
- package/files/.github/skills/page-codegen/TPL-RECORD-FORM.md +376 -0
- package/files/.github/skills/page-codegen/TPL-TREE-LIST.md +191 -0
- package/files/.github/skills/prototype-scan/SKILL.md +414 -0
- package/files/demo/README.md +44 -0
- package/files/demo/produce/aiflow/mmwr-customer-apply-add/api.md +54 -0
- package/files/demo/produce/aiflow/mmwr-customer-apply-add/data.ts +346 -0
- package/files/demo/produce/aiflow/mmwr-customer-apply-add/index.scss +1 -0
- package/files/demo/produce/aiflow/mmwr-customer-apply-add/index.vue +28 -0
- package/files/demo/produce/aiflow/mmwr-customer-apply-add-form/data.ts +115 -0
- package/files/demo/produce/aiflow/mmwr-customer-apply-add-form/index.scss +44 -0
- package/files/demo/produce/aiflow/mmwr-customer-apply-add-form/index.vue +43 -0
- package/files/demo/produce/aiflow/mmwr-customer-apply-change/data.ts +338 -0
- package/files/demo/produce/aiflow/mmwr-customer-apply-change/index.scss +1 -0
- package/files/demo/produce/aiflow/mmwr-customer-apply-change/index.vue +28 -0
- package/files/demo/produce/aiflow/mmwr-customer-apply-change-form/data.ts +115 -0
- package/files/demo/produce/aiflow/mmwr-customer-apply-change-form/index.scss +44 -0
- package/files/demo/produce/aiflow/mmwr-customer-apply-change-form/index.vue +43 -0
- package/files/demo/produce/aiflow/mmwr-customer-apply-change-history/data.ts +196 -0
- package/files/demo/produce/aiflow/mmwr-customer-apply-change-history/index.scss +150 -0
- package/files/demo/produce/aiflow/mmwr-customer-apply-change-history/index.vue +79 -0
- package/files/demo/produce/aiflow/mmwr-customer-archive/api.md +88 -0
- package/files/demo/produce/aiflow/mmwr-customer-archive/data.ts +601 -0
- package/files/demo/produce/aiflow/mmwr-customer-archive/index.scss +1 -0
- package/files/demo/produce/aiflow/mmwr-customer-archive/index.vue +64 -0
- package/files/demo/produce/aiflow/mmwr-customer-detail/api.md +67 -0
- package/files/demo/produce/aiflow/mmwr-customer-detail/data.ts +286 -0
- package/files/demo/produce/aiflow/mmwr-customer-detail/index.scss +139 -0
- package/files/demo/produce/aiflow/mmwr-customer-detail/index.vue +318 -0
- package/files/demo/produce/aiflow/mmwr-temp-customer-archive/api.md +98 -0
- package/files/demo/produce/aiflow/mmwr-temp-customer-archive/data.ts +543 -0
- package/files/demo/produce/aiflow/mmwr-temp-customer-archive/index.scss +1 -0
- package/files/demo/produce/aiflow/mmwr-temp-customer-archive/index.vue +52 -0
- package/files/demo/sale/demo/add-demo/data.ts +518 -0
- package/files/demo/sale/demo/add-demo/index.scss +207 -0
- package/files/demo/sale/demo/add-demo/index.vue +167 -0
- package/files/demo/sale/demo/billet-flame-cut-plan/data.ts +524 -0
- package/files/demo/sale/demo/billet-flame-cut-plan/index.scss +155 -0
- package/files/demo/sale/demo/billet-flame-cut-plan/index.vue +117 -0
- package/files/demo/sale/demo/domestic-trade-order/data.ts +308 -0
- package/files/demo/sale/demo/domestic-trade-order/index.scss +99 -0
- package/files/demo/sale/demo/domestic-trade-order/index.vue +77 -0
- package/files/demo/sale/demo/heat-batch-return/data.ts +367 -0
- package/files/demo/sale/demo/heat-batch-return/index.scss +100 -0
- package/files/demo/sale/demo/heat-batch-return/index.vue +170 -0
- package/files/demo/sale/demo/heat-batch-return/meltDialog.vue +320 -0
- package/files/demo/sale/demo/metallurgical-spec/data.ts +825 -0
- package/files/demo/sale/demo/metallurgical-spec/index.scss +264 -0
- package/files/demo/sale/demo/metallurgical-spec/index.vue +309 -0
- package/files/docs/jh-date-range.md +257 -0
- package/files/docs/jh-date.md +222 -0
- package/files/docs/jh-dept-picker.md +190 -0
- package/files/docs/jh-drag-row.md +590 -0
- package/files/docs/jh-file-upload.md +216 -0
- package/files/docs/jh-pagination.md +505 -0
- package/files/docs/jh-picker.md +218 -0
- package/files/docs/jh-select.md +148 -0
- package/files/docs/jh-text.md +248 -0
- package/files/docs/jh-user-picker.md +197 -0
- package/files/docs/page-query-hook-best-practices.md +362 -0
- package/files/docs/request.md +925 -0
- package/files/src/components/global/C_ParentView/index.vue +3 -0
- package/files/src/components/global/C_RightToolbar/index.vue +459 -0
- package/files/src/components/global/C_Splitter/index.vue +195 -0
- package/files/src/components/global/C_SvgIcon/index.vue +61 -0
- package/files/src/components/global/C_SvgIcon/svgicon.js +10 -0
- package/files/src/components/global/C_TagStatus/README.md +264 -0
- package/files/src/components/global/C_TagStatus/config.ts +192 -0
- package/files/src/components/global/C_TagStatus/index.vue +127 -0
- package/files/src/components/global/C_TagStatus/types.ts +64 -0
- package/files/src/components/global/C_Tree/README.md +153 -0
- package/files/src/components/global/C_Tree/index.scss +42 -0
- package/files/src/components/global/C_Tree/index.vue +119 -0
- package/files/src/components/global/C_Tree/types.ts +59 -0
- package/files/src/components/local/c_formModal/README.md +235 -0
- package/files/src/components/local/c_formModal/data.ts +95 -0
- package/files/src/components/local/c_formModal/index.scss +8 -0
- package/files/src/components/local/c_formModal/index.vue +107 -0
- package/files/src/components/local/c_formSections/README.md +496 -0
- package/files/src/components/local/c_formSections/data.ts +175 -0
- package/files/src/components/local/c_formSections/index.scss +280 -0
- package/files/src/components/local/c_formSections/index.vue +429 -0
- package/files/src/components/local/c_listModal/data.ts +41 -0
- package/files/src/components/local/c_listModal/index.vue +136 -0
- package/files/src/components/local/c_spliterTitle/index.scss +25 -0
- package/files/src/components/local/c_spliterTitle/index.vue +21 -0
- package/files/src/components/remote/AGGrid/README.md +530 -0
- package/files/src/components/remote/BaseForm/README.md +508 -0
- package/files/src/components/remote/BaseQuery/README.md +865 -0
- package/files/src/components/remote/BaseTable/README.md +941 -0
- package/files/src/components/remote/BaseToolbar/README.md +496 -0
- package/files/src/types/page.ts +24 -0
- package/package.json +31 -0
|
@@ -0,0 +1,255 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: menu-sync
|
|
3
|
+
description: "Use when: creating system menus for newly generated pages, batch registering menus, or syncing pages.ts entries to the backend menu table. Triggers on: 创建菜单, 注册菜单, 同步菜单, 补菜单, menu sync, create menu, register menu."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Skill: 菜单同步(menu-sync)
|
|
7
|
+
|
|
8
|
+
将 pages.ts 中注册的页面同步到后端菜单表,使系统能够路由到新页面。
|
|
9
|
+
|
|
10
|
+
> **背景**:本项目是 Module Federation 子应用,页面在 `pages.ts` 注册后,
|
|
11
|
+
> 还需要在后端菜单表中创建对应记录,系统才能路由到该页面。
|
|
12
|
+
> 设计文档:`.github/docs/menu-sync-design.md`
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
## 配置与使用方式(一次配置,无需反复填写)
|
|
17
|
+
|
|
18
|
+
### 数据来源分工
|
|
19
|
+
|
|
20
|
+
| 数据 | 来源 | 说明 |
|
|
21
|
+
| ------------------------------------------------ | ------------------ | --------------------------------------- |
|
|
22
|
+
| 菜单名称、路径、组件、权限、隐藏、排序、应用编码 | `SYS_MENU_INFO.md` | 原型/详设阶段自动生成,AI 直接读取 |
|
|
23
|
+
| `parentMenuNameCode` | API 自动查询 | AI 调 children 接口获取,无需手填 |
|
|
24
|
+
| **gatewayPath、parentMenuId、token** | `env.local.json` | 每套环境不同,唯一需要手动维护的 3 个值 |
|
|
25
|
+
|
|
26
|
+
### 配置文件(只需填 3 个字段)
|
|
27
|
+
|
|
28
|
+
`.github/skills/menu-sync/env/env.local.json`(已加入 `.gitignore`,本地维护,不提交)
|
|
29
|
+
|
|
30
|
+
```json
|
|
31
|
+
{
|
|
32
|
+
"gatewayPath": "http://网关地址:端口",
|
|
33
|
+
"parentMenuId": "父级菜单ID",
|
|
34
|
+
"token": "Bearer Token(不含bearer前缀)"
|
|
35
|
+
}
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
> 字段说明及获取方式见 `env/guide.md`
|
|
39
|
+
|
|
40
|
+
### 使用步骤
|
|
41
|
+
|
|
42
|
+
1. **首次**:按 `env/guide.md` 填写 `env.local.json` 的 3 个字段
|
|
43
|
+
2. **之后**:直接对 AI 说「帮我创建菜单」/「同步菜单」/「补菜单」
|
|
44
|
+
3. AI 自动执行:读 `SYS_MENU_INFO.md` → 读 `env.local.json` → 查父级已有子节点 → 逐条对比去重 → 调 `/system/menu/save` → 输出 created/skipped 结果表
|
|
45
|
+
4. **全程无需手动执行任何命令**
|
|
46
|
+
|
|
47
|
+
---
|
|
48
|
+
|
|
49
|
+
## 方案演进路线
|
|
50
|
+
|
|
51
|
+
| 阶段 | 方案 | 状态 | 说明 |
|
|
52
|
+
| ----------- | --------------------------------- | ------------- | ---------------------------------------------------- |
|
|
53
|
+
| **Phase 1** | AI 调用现有 API 逐条创建 | ✅ 当前可用 | 利用 `/system/menu/save` 接口,AI 充当自动化脚本 |
|
|
54
|
+
| **Phase 2** | 前端推送脚本 `pnpm run menu:push` | ⏳ 待后端接口 | 需后端提供 `POST /system/menu/batchPush` upsert 接口 |
|
|
55
|
+
|
|
56
|
+
---
|
|
57
|
+
|
|
58
|
+
## Phase 1:AI 调用 API 创建菜单(当前方案)
|
|
59
|
+
|
|
60
|
+
> 此方案参考平台伙伴的 jh4j-cloud skill,适配 cx-ui-produce 项目。
|
|
61
|
+
> 本质是 **menu-sync-design.md 的方案 C(只增不删)**,由 AI 自动执行。
|
|
62
|
+
|
|
63
|
+
### 前置条件
|
|
64
|
+
|
|
65
|
+
1. 用户提供后端系统管理地址(如 `http://localhost:9000` 或实际网关地址)
|
|
66
|
+
2. 用户提供有效的 Bearer Token(从浏览器开发者工具 Network 面板复制)
|
|
67
|
+
3. 用户提供父级菜单 ID(`menuId`),可通过查询接口获取
|
|
68
|
+
|
|
69
|
+
### 输入
|
|
70
|
+
|
|
71
|
+
用户提供以下信息(或 AI 从 pages.ts 自动提取):
|
|
72
|
+
|
|
73
|
+
- **父级菜单 ID**:`menuId`(后端菜单树中的上级目录 ID)
|
|
74
|
+
- **应用编码**:`sysAppNo`(如 `produce`、`sale`、`system`)
|
|
75
|
+
- **菜单数据**:可以是 pages.ts 中的条目,或用户手动指定
|
|
76
|
+
|
|
77
|
+
菜单类型:
|
|
78
|
+
|
|
79
|
+
| type | 含义 | 必填字段 |
|
|
80
|
+
| ---- | ------------ | --------------------------------------------- |
|
|
81
|
+
| `M` | 目录 | `menuName`, `path` |
|
|
82
|
+
| `C` | 菜单(页面) | `menuName`, `path`, `permission`, `component` |
|
|
83
|
+
| `A` | 动作按钮 | `menuName`, `path` |
|
|
84
|
+
|
|
85
|
+
### 执行流程
|
|
86
|
+
|
|
87
|
+
#### Step 1: 查询父级下已有菜单(防重复)
|
|
88
|
+
|
|
89
|
+
```
|
|
90
|
+
GET {gatewayPath}/system/menu/children?current=1&size=100&menuId={parentMenuId}
|
|
91
|
+
Headers:
|
|
92
|
+
authorization: bearer {token}
|
|
93
|
+
Sysappno: {appNo}
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
#### Step 2: 逐条创建菜单
|
|
97
|
+
|
|
98
|
+
对于每条待创建的菜单,先检查是否与已有菜单重名(`menuName` 或 `path` 相同),重复则跳过。
|
|
99
|
+
|
|
100
|
+
```
|
|
101
|
+
POST {gatewayPath}/system/menu/save
|
|
102
|
+
Headers:
|
|
103
|
+
authorization: bearer {token}
|
|
104
|
+
Sysappno: {appNo}
|
|
105
|
+
Content-Type: application/json
|
|
106
|
+
|
|
107
|
+
Body:
|
|
108
|
+
{
|
|
109
|
+
"useCache": 1,
|
|
110
|
+
"icon": "list",
|
|
111
|
+
"common": 2,
|
|
112
|
+
"hidden": false,
|
|
113
|
+
"type": "C",
|
|
114
|
+
"parentId": "{parentMenuId}",
|
|
115
|
+
"sysAppNo": "{appNo}",
|
|
116
|
+
"orderNum": {nextOrder},
|
|
117
|
+
"menuName": "客户档案",
|
|
118
|
+
"menuNameCode": "{parentMenuNameCode}:{pinyinName}",
|
|
119
|
+
"path": "mmwrCustomerArchive",
|
|
120
|
+
"permission": "produce:mmwrCustomerArchive:list",
|
|
121
|
+
"component": "produce/production-mmwr/aiflow/mmwr-customer-archive/index.vue"
|
|
122
|
+
}
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
#### Step 3: 记录结果
|
|
126
|
+
|
|
127
|
+
创建完成后输出结果表格:
|
|
128
|
+
|
|
129
|
+
| 菜单名 | path | type | 状态 | id |
|
|
130
|
+
| -------- | ------------------- | ---- | ------------------- | ------ |
|
|
131
|
+
| 客户档案 | mmwrCustomerArchive | C | ✅ created | 123456 |
|
|
132
|
+
| 客户详情 | mmwrCustomerDetail | C | ⏭️ skipped (已存在) | - |
|
|
133
|
+
|
|
134
|
+
### 字段生成规则
|
|
135
|
+
|
|
136
|
+
| 字段 | 规则 |
|
|
137
|
+
| -------------- | -------------------------------------------------------------------------------------------- |
|
|
138
|
+
| `menuName` | 取 pages.ts 的 `label` |
|
|
139
|
+
| `path` | 页面目录名转 camelCase(如 `mmwr-customer-archive` → `mmwrCustomerArchive`) |
|
|
140
|
+
| `component` | 取 pages.ts 的 `name`(如 `produce/production-mmwr/aiflow/mmwr-customer-archive/index.vue`) |
|
|
141
|
+
| `permission` | `{域}:{path}:list`(如 `produce:mmwrCustomerArchive:list`) |
|
|
142
|
+
| `menuNameCode` | `{父级menuNameCode}:{菜单名拼音}`(小写连续拼接) |
|
|
143
|
+
| `hidden` | 表单页/详情页等隐藏路由设为 `true`,菜单可见页面设为 `false` |
|
|
144
|
+
| `orderNum` | 从父级已有菜单最大 orderNum + 1 开始递增 |
|
|
145
|
+
| `icon` | 目录级 `"list"`,菜单级 `"list"` |
|
|
146
|
+
|
|
147
|
+
### pages.ts → 菜单数据映射示例
|
|
148
|
+
|
|
149
|
+
以 `aiflow` 子模块为例:
|
|
150
|
+
|
|
151
|
+
```
|
|
152
|
+
pages.ts 条目:
|
|
153
|
+
["mmwr-customer-archive", "客户档案"]
|
|
154
|
+
|
|
155
|
+
→ 菜单数据:
|
|
156
|
+
{
|
|
157
|
+
type: "C",
|
|
158
|
+
menuName: "客户档案",
|
|
159
|
+
path: "mmwrCustomerArchive",
|
|
160
|
+
component: "produce/production-mmwr/aiflow/mmwr-customer-archive/index.vue",
|
|
161
|
+
permission: "produce:mmwrCustomerArchive:list",
|
|
162
|
+
hidden: false
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
隐藏页面示例:
|
|
166
|
+
["mmwr-customer-apply-add-form", "客户申请新增表单"]
|
|
167
|
+
|
|
168
|
+
→ 菜单数据:
|
|
169
|
+
{
|
|
170
|
+
type: "C",
|
|
171
|
+
menuName: "客户申请新增表单",
|
|
172
|
+
path: "mmwrCustomerApplyAddForm",
|
|
173
|
+
component: "produce/production-mmwr/aiflow/mmwr-customer-apply-add-form/index.vue",
|
|
174
|
+
permission: "produce:mmwrCustomerApplyAddForm:list",
|
|
175
|
+
hidden: true // ← 表单页隐藏
|
|
176
|
+
}
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
### 隐藏页面判断规则
|
|
180
|
+
|
|
181
|
+
以下页面类型应设置 `hidden: true`:
|
|
182
|
+
|
|
183
|
+
- 目录名含 `-form`(独立路由表单页)
|
|
184
|
+
- 目录名含 `-detail`(详情页)
|
|
185
|
+
- 目录名含 `-history`(历史查询页)
|
|
186
|
+
- SYS_MENU_INFO.md 中标注为"隐藏菜单"的页面
|
|
187
|
+
|
|
188
|
+
### 跳过规则
|
|
189
|
+
|
|
190
|
+
- 当前父级下已有同名 `menuName` → 跳过
|
|
191
|
+
- 当前父级下已有相同 `path` → 跳过
|
|
192
|
+
- 跳过时不做更新、不做覆盖,只记录"已跳过"
|
|
193
|
+
|
|
194
|
+
### 树形菜单处理
|
|
195
|
+
|
|
196
|
+
如果需要先创建目录再创建子菜单:
|
|
197
|
+
|
|
198
|
+
1. 先以 `type: "M"` 创建目录
|
|
199
|
+
2. 保存成功后取返回的 `data.id`
|
|
200
|
+
3. 以新 `id` 作为 `parentId` 继续创建子菜单
|
|
201
|
+
|
|
202
|
+
---
|
|
203
|
+
|
|
204
|
+
## Phase 2:推送脚本方案(待后端接口就绪后启用)
|
|
205
|
+
|
|
206
|
+
> 对应 menu-sync-design.md 的 **方案 D(推送覆盖)**,是最终目标方案。
|
|
207
|
+
|
|
208
|
+
### 与 Phase 1 的差异
|
|
209
|
+
|
|
210
|
+
| 维度 | Phase 1 (AI 调 API) | Phase 2 (推送脚本) |
|
|
211
|
+
| -------- | ------------------- | ---------------------------- |
|
|
212
|
+
| 执行者 | AI | `pnpm run menu:push` 脚本 |
|
|
213
|
+
| 更新能力 | 只增不删(方案 C) | upsert 覆盖(方案 D) |
|
|
214
|
+
| 改名支持 | ❌ 会产生重复 | ✅ 按 componentPath 匹配更新 |
|
|
215
|
+
| 权限影响 | 无 | 无(只写结构字段) |
|
|
216
|
+
| 依赖 | Token + 网关地址 | 后端 `batchPush` 接口 |
|
|
217
|
+
|
|
218
|
+
### 所需后端接口
|
|
219
|
+
|
|
220
|
+
```
|
|
221
|
+
POST /system/menu/batchPush
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
- 按 `componentPath` 做 upsert(存在则更新结构字段,不存在则新增)
|
|
225
|
+
- **不删除**后端多余的菜单
|
|
226
|
+
- **不碰**权限/角色绑定字段
|
|
227
|
+
- 详见 `.github/docs/menu-sync-design.md`
|
|
228
|
+
|
|
229
|
+
### pages.ts 扩展
|
|
230
|
+
|
|
231
|
+
在 `SharedPageItem` 中增加 `menuMeta` 字段:
|
|
232
|
+
|
|
233
|
+
```typescript
|
|
234
|
+
export interface SharedPageItem {
|
|
235
|
+
name: string;
|
|
236
|
+
label: string;
|
|
237
|
+
menuMeta?: {
|
|
238
|
+
parentName: string;
|
|
239
|
+
menuPath: string;
|
|
240
|
+
sortOrder: number;
|
|
241
|
+
appCode: string;
|
|
242
|
+
hidden?: boolean;
|
|
243
|
+
icon?: string;
|
|
244
|
+
};
|
|
245
|
+
}
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
### 切换步骤
|
|
249
|
+
|
|
250
|
+
1. 后端提供 `batchPush` 接口
|
|
251
|
+
2. 在 pages.ts 的页面条目中补充 `menuMeta`
|
|
252
|
+
3. 创建 `scripts/menu-push.ts`(vite-node 执行)
|
|
253
|
+
4. 注册 `pnpm run menu:push` 命令
|
|
254
|
+
5. page-codegen Skill 生成页面时自动填充 `menuMeta`
|
|
255
|
+
6. 废弃 Phase 1 的 AI 手动调 API 流程
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
# env.local.json 配置说明
|
|
2
|
+
|
|
3
|
+
> 该目录下的 `env.local.json` 已加入 `.gitignore`,**不会提交到远端仓库**。
|
|
4
|
+
> 每位成员在本地维护自己的副本,首次使用时按本文档填写即可。
|
|
5
|
+
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## 文件结构
|
|
9
|
+
|
|
10
|
+
```json
|
|
11
|
+
{
|
|
12
|
+
"gatewayPath": "http://192.168.10.50:9000",
|
|
13
|
+
"parentMenuId": "1803456789012345678",
|
|
14
|
+
"token": "eyJhbGci..."
|
|
15
|
+
}
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## 字段说明
|
|
21
|
+
|
|
22
|
+
| 字段 | 说明 | 示例 |
|
|
23
|
+
|---|---|---|
|
|
24
|
+
| `gatewayPath` | 后端网关地址,含协议和端口,**末尾不加斜杠** | `http://192.168.10.50:9000` |
|
|
25
|
+
| `parentMenuId` | 目标父级目录的菜单数据库 ID(每套环境不同) | `1803456789012345678` |
|
|
26
|
+
| `token` | 当前登录用户的 Bearer Token,**不含 `bearer ` 前缀** | `eyJhbGci...` |
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
## 如何获取各字段
|
|
31
|
+
|
|
32
|
+
### gatewayPath
|
|
33
|
+
|
|
34
|
+
询问后端同事,或查看浏览器 Network 面板中任意接口请求的 URL,取协议 + 域名/IP + 端口部分。
|
|
35
|
+
|
|
36
|
+
### parentMenuId
|
|
37
|
+
|
|
38
|
+
**方法 A(推荐)**:系统管理后台 → 菜单管理 → 找到目标父级目录 → 点编辑/查看 → 复制菜单 ID
|
|
39
|
+
|
|
40
|
+
**方法 B(API 查询)**:
|
|
41
|
+
|
|
42
|
+
```
|
|
43
|
+
GET {gatewayPath}/system/menu/children?menuId=0
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
从顶级节点向下逐层查找,直到找到目标父级目录。也可以告诉 AI「帮我查一下父级菜单 ID」,AI 会自动调接口查询。
|
|
47
|
+
|
|
48
|
+
### token
|
|
49
|
+
|
|
50
|
+
1. 在浏览器中登录系统
|
|
51
|
+
2. 按 F12 打开 DevTools → Network 面板
|
|
52
|
+
3. 随便点一个接口请求
|
|
53
|
+
4. 查看 Request Headers → `authorization` 字段
|
|
54
|
+
5. 去掉 `bearer ` 前缀,复制剩余字符串粘贴到 `token` 字段
|
|
55
|
+
|
|
56
|
+
> Token 有有效期,若创建菜单时提示鉴权失败,重新登录后刷新 token 即可。
|
|
57
|
+
|
|
58
|
+
---
|
|
59
|
+
|
|
60
|
+
## 使用方式
|
|
61
|
+
|
|
62
|
+
配置完成后,直接对 AI 说:
|
|
63
|
+
|
|
64
|
+
> 「帮我创建菜单」/ 「同步菜单」/ 「补菜单」
|
|
65
|
+
|
|
66
|
+
AI 会自动执行:
|
|
67
|
+
1. 读取 `SYS_MENU_INFO.md`(菜单定义)
|
|
68
|
+
2. 读取 `env.local.json`(环境配置)
|
|
69
|
+
3. 调 `/system/menu/children` 查询父级已有子节点(去重)
|
|
70
|
+
4. 逐条调 `/system/menu/save` 创建缺失菜单
|
|
71
|
+
5. 输出 `created / skipped` 结果表
|
|
72
|
+
|
|
73
|
+
**全程无需手动执行任何命令。**
|