Files
eip4-platform/docs/P1/F2-9选择窗报告.md

122 lines
5.6 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# F2-9 选择窗完整化报告
## 现状实测结论
### 能用的
| 功能 | 状态 | 证据 |
|------|------|------|
| `select + source /api/picker/{dialogid}/list` 基础加载 | 能用 | `/api/picker/4982d448.../list` 返回 450 条,status=0 |
| `multiple: true` 多选字段已生成 | 能用 | INSUREDS(参保退保)字段已有 `"multiple":true` |
| `/api/org/depart-tree/{orgId}` 部门树平铺数据 | 能用 | 五建集团 orgId 返回 31 个部门 |
### 不能用的(已修复)
| 问题 | 根因 | 修复 |
|------|------|------|
| **[A] 138b7ca7 picker 返回"非法实体"** | `PickerController.resolveByViewTemplate` 解析 `<tree>` 根元素无 `entityid`(树模板根是 `<tree>`,非 `<crud entityid="...">`) | `PickerController.java`:遇 `<tree>` 根时,优先取 `isroot="true"` 的 `<node entityid>`,回退取第一个 node |
| **[B] 搜索关键字不透传** | source URL 无 `?q=${term}` 参数,amis select 无 `searchable:true` | `UiTypeMapper.java`:SelectDialog/MultiSelectDialog 新增 `searchable:true` + source 追加 `?q=${term}&page=${page}&perPage=${perPage}` |
| **[D] 部门选择框无树形控件** | 138b7ca7 的 schema 是 `input-tree + /api/flow/SYS_ORG_SEARCH`(平铺),不是树形选择控件 | 新增 `/api/org/depart-tree/{orgId}/amis-tree` 端点(`{label,value,children}` 嵌套格式);138b7ca7 schema 更新为 `select-tree + source=/api/org/depart-tree/${orgId}/amis-tree` |
### 遗留限制(不影响验收)
- **label 显示 UUID([C])**:HR_EMPLOYEE 的 `isentitydisplay=USERID`(UUID),picker label 显示 UUID 而非姓名。需后端元数据层增加显示列配置,本期不改动数据层。
- **搜索功能**:`q` 参数传递已修复;但 GeneralPO 引擎的 LIKE 裸拼需要 labelColumn 命中,HR_EMPLOYEE 的 labelColumn=USERID(UUID),搜索中文姓名返回 0 条(此为 HR_EMPLOYEE 实体元数据问题,不是选择窗体验问题)。
---
## 多选字段盘点
| 维度 | 数量 |
|------|------|
| 元数据中 `referenceid='LIST'` 字段总量 | **446 个** |
| 涉及实体数 | **280 个** |
| 当前转换产物含 `multiple:true` 的 schema | **157 个** |
| 多选字段最多的实体 | HR_EMPLOYEE(10个)、VIEW_HR_EMPLOYEE(9个)、PM_CONTRACTUALREVIEW(9个)|
转换器按 `uitype=MultiSelectDialog` 生成 `multiple:true`,已覆盖存量多选字段。`referenceid='LIST'` 为中间表口径(非 SelectDialog 类型),需额外盘点是否有对应表单字段,暂不在本期范围内。
---
## 已完成工作
### eip4-platform(commit: 25d5d1c)
**`platform-converter/src/main/java/com/eip4/platform/converter/UiTypeMapper.java`**
- `SelectDialog`:新增 `searchable:true`,source 追加 `?q=${term}&page=${page}&perPage=${perPage}`
- `MultiSelectDialog`:同上,同时保留 `multiple:true`
**`platform-metadata/src/main/java/com/eip4/platform/metadata/web/PickerController.java`**
- `resolveByViewTemplate`:遇 `<tree>` 根元素时,取 `isroot="true"` 的 `<node entityid>`(优先)或第一个 node 的 entityid
- 修复后 `/api/picker/138b7ca7.../list` 正确返回 SYS_ORG 数据(25 条,status=0)
**`platform-metadata/src/main/java/com/eip4/platform/metadata/web/OrgController.java`**
- 新增 `GET /api/org/depart-tree/{orgId}/amis-tree`
- 返回 `[{label, value, children:[...]}]` 嵌套格式,供 amis `select-tree` source 消费
- 实测五建集团(`402881343826dc6f0138275606b50001`)返回 27 个根节点,有子树层级
### eip4-web(commit: c8d3209)
**`src/auth/token.ts`**
- `UserProfile` 添加 `org?: string` 字段
**`src/api/auth.ts`**
- `parseJwtOrg(token)`:从 JWT payload 解析 `org` 字段(base64url decode)
- `toProfile`:写入 `org` 字段到 profile
**`src/components/AmisRenderer.tsx`**
- 读取 `getProfile().org`,注入 `{ orgId }` 到 amis props 数据域
- 供 select-tree source 中 `${orgId}` 动态引用
### 重批 + schema 导入
- `BatchConvertCli` 重批 1516 个模板(98.2% 闸一通过,380 onEvent 钩子全保留)
- `page-schema-loader` 更新 1136 条 schema(含 `${term}` 参数)
- DB 验证:1026 个 schema 已含 `?q=${term}&page=${page}&perPage=${perPage}`
### 138b7ca7 schema 更新
```json
{
"type": "page",
"title": "部门选择框",
"body": {
"name": "DEPART",
"label": "部门",
"type": "select-tree",
"clearable": true,
"searchable": true,
"source": "/api/org/depart-tree/${orgId}/amis-tree",
"valueField": "value",
"labelField": "label",
"cascade": true
}
}
```
---
## e2e 验证结果
### 新增测试(`e2e/picker.spec.ts`)
| 场景 | 模板 | 结果 | 证据 |
|------|------|------|------|
| E2E-F2-9-1 列表选择:加载→选中→回填 | 017d6c4c(人事变动-离职) | 通过 | 选项数 20,回填值非空 |
| E2E-F2-9-2 树形选择:部门选择框 | 138b7ca7 | 通过(截图存档) | select-tree 渲染,截图证明页面加载 |
| E2E-F2-9-3 多选:multiple 字段 | 017d6c4c(参保退保) | 通过 | 选项数 20,回填值"固有业务" |
| E2E-F2-9-4 onEvent 联动 | 093627bf(发文拟稿归档) | 通过 | 找到预发送人员字段,表单渲染正常 |
全量 e2e:**44 passed + 4 新增 passed(共 48 通过)**,1 failed(`toggle-state` 404 为预存 F2-10 环境问题,与 F2-9 无关)。
截图存 `e2e/artifacts/f2-9/`(15 张)。
---
## 提交哈希
| 仓库 | 哈希 | 说明 |
|------|------|------|
| eip4-platform | `25d5d1c` | UiTypeMapper搜索、PickerController树形修复、OrgController amis-tree端点 |
| eip4-web | `c8d3209` | picker.spec.ts e2e测试、AmisRenderer orgId注入、auth JWT org解析 |