Commit c78948b1 authored by drigle's avatar drigle

docs: sync subject definitions

parent 552e550c
......@@ -32,153 +32,13 @@ type Record = {
---
## 2. 核心 Subject Definitions
## 2. 业务结构补充约束
## 2.1 流程监控分组
`fields_definition` 建议统一写成对象数组,例如 `[{ "display_name": "提交人", "type": "member" }]`;同时兼容历史数据中的 `{ "提交人": "member" }` 对象映射格式。支持类型包括 `text`、`member`、`department`、`date` 和 `attachment`。
- **subject**: `process_monitor_group`
`metadata.detail` 中每一项推荐结构为 `{ label, type, value }`。当 `type = "file"` 时,`value` 建议为文件数组。页面不直接持久化下载后的 URL,下载前先调用 `executeAction("sync_progress:get_attachment_link", { fileUrl })`。
用于承接一个流程监控分组,以及该分组下已纳入监控范围的模板列表。
| 字段标签 | 字段别名 | 字段类型 | 是否必填 | 说明 |
| --- | --- | --- | --- | --- |
| 分组名称 | `title` | text | 是 | 分组展示名称 |
| 监控模板列表 | `progresses` | reference[] | 否 | 关联 `audit_related_progress` 记录 ID 数组 |
写入约束:
- `metadata.progresses` 中只保存监控模板记录 `_id[]`
- 页面查询分组详情时可依赖 `mode = full` 获得已填充的模板对象
---
## 2.2 监控模板
- **subject**: `audit_related_progress`
用于保存已被纳入监控的模板快照,以及模板层级的监控配置。
| 字段标签 | 字段别名 | 字段类型 | 是否必填 | 说明 |
| --- | --- | --- | --- | --- |
| 模板标题 | `title` | text | 是 | 当前监控模板显示标题 |
| 外部模板 ID | `external_id` | text | 是 | 同步接口返回的原始模板 ID |
| 所属部门 | `department` | text | 否 | 模板归属部门,用于列表筛选 |
| 模板编码 | `template_code` | text | 否 | 模板业务编码 |
| 显示条件 | `conditions` | object | 否 | 形如 `{ key, value }`,用于筛选实例列表 |
| 显示字段定义 | `fields_definition` | object[] / object | 否 | 实例列表动态列配置 |
### 2.2.1 `fields_definition` 结构
建议统一写成对象数组:
```json
[
{
"display_name": "提交人",
"type": "member"
},
{
"display_name": "所属部门",
"type": "department"
}
]
```
兼容说明:
- 历史数据也可能是 `{ "提交人": "member" }` 这种对象映射格式
- 前端需同时兼容数组和对象映射两种读取方式
支持类型:
- `text`
- `member`
- `department`
- `date`
- `attachment`
---
## 2.3 流程实例
- **subject**: `audit_progress_info`
用于保存某个流程模板下实际提交的实例数据。
| 字段标签 | 字段别名 | 字段类型 | 是否必填 | 说明 |
| --- | --- | --- | --- | --- |
| 表单名称 | `title` | text | 是 | 流程实例标题 |
| 关联模板 | `related_progress` | reference | 是 | 指向 `audit_related_progress` |
| 提交人 | `submitter` | text | 否 | 提交流程用户名或名称 |
| 审批人 | `approver` | text | 否 | 审批流程用户名或名称 |
| 所属部门 | `department` | text | 否 | 业务部门名称 |
| 提交时间 | `submit_at` | date | 否 | 提交流程时间 |
| 动态明细 | `detail` | object[] | 否 | 表单动态字段数组 |
### 2.3.1 `detail` 子结构
`metadata.detail` 中每一项推荐结构如下:
```ts
type DetailField = {
label: string;
type: string;
value: any;
};
```
常见类型:
- `string`
- `text`
- `member`
- `department`
- `date`
- `file`
### 2.3.2 文件字段
当 `type = "file"` 时,`value` 建议为文件数组:
```json
[
{
"filename": "整改附件.pdf",
"fileUrl": "https://..."
}
]
```
前端处理约束:
- 页面中不直接持久化下载后的 URL
- 下载前先调用 `executeAction("sync_progress:get_attachment_link", { fileUrl })`
---
## 2.4 辅助对象
### 2.4.1 成员对象
- **subject**: `oa_member`
当前模块主要读取:
| 字段标签 | 字段别名 | 字段类型 | 说明 |
| --- | --- | --- | --- |
| 成员 ID | `member_id` | text | 外部成员标识 |
| 成员名称 | `name` | text | 展示名称 |
### 2.4.2 部门对象
- **subject**: `oa_department`
当前模块主要读取:
| 字段标签 | 字段别名 | 字段类型 | 说明 |
| --- | --- | --- | --- |
| 部门 ID | `department_id` | text | 外部部门标识 |
| 部门名称 | `department_name` | text | 展示名称 |
`process_monitor_group.metadata.progresses` 只保存监控模板记录 `_id[]`;查询分组详情时可依赖 `mode = full` 获得已填充的模板对象。
---
......@@ -221,3 +81,108 @@ type DetailField = {
- `actions[]`:服务端配置的待办动作,执行时只发送通知 `_id` 作为 `notice_id`
页面不把通知对象转换为业务 Record,也不修改任何 Subject 字段结构。
## 6. Subject Definitions(同步快照)
<!-- SUBJECT_SCHEMA_SYNC:START -->
> 同步根对象:`audit_progress_info`、`audit_related_progress`、`oa_department`、`oa_member`、`process_monitor_group`
> 当前依赖闭包:5 个 Subject。
### `audit_progress_info`:流程信息
- 类型:`normal`
- 字段数量:10
| 字段标签 | 字段别名 | 字段类型 | 多值 | 必填 | 主键 | 关联/配置 |
| --- | --- | --- | --- | --- | --- | --- |
| 提交者 | `submitter` | text | 否 | 否 | 否 | |
| 审批者 | `approver` | text | 否 | 否 | 否 | |
| 所属部门 | `department` | text | 否 | 否 | 否 | |
| 流程主题 | `related_progress` | reference | 否 | 否 | 否 | Subject: audit_related_progress |
| 提交时间 | `submit_at` | text | 否 | 否 | 否 | |
| 状态 | `status` | text | 否 | 否 | 否 | |
| 详细信息 | `detail` | object | 否 | 否 | 否 | |
| 外部id | `external_id` | text | 否 | 否 | 否 | |
| 审批通过时间 | `approve_date` | text | 否 | 否 | 否 | |
| 创建日期 | `created_at` | text | 否 | 否 | 否 | |
### `audit_related_progress`:流程模版
- 类型:`normal`
- 字段数量:5
| 字段标签 | 字段别名 | 字段类型 | 多值 | 必填 | 主键 | 关联/配置 |
| --- | --- | --- | --- | --- | --- | --- |
| 所属部门 | `department` | text | 否 | 否 | 否 | |
| 外部id | `external_id` | text | 否 | 否 | 否 | |
| 模版Code | `template_code` | text | 否 | 否 | 否 | |
| 字段定义 | `fields_definition` | object | 是 | 否 | 否 | |
| 显示条件 | `conditions` | object | 否 | 否 | 否 | |
### `oa_department`:oa-部门
- 类型:`normal`
- 字段数量:14
| 字段标签 | 字段别名 | 字段类型 | 多值 | 必填 | 主键 | 关联/配置 |
| --- | --- | --- | --- | --- | --- | --- |
| 部门id | `department_id` | text | 否 | 否 | 是 | |
| 部门名称 | `department_name` | text | 否 | 否 | 否 | |
| 第二名称 | `second_name` | text | 否 | 否 | 否 | |
| 编号 | `code` | text | 否 | 否 | 否 | |
| 简称 | `short_name` | text | 否 | 否 | 否 | |
| 机构类型 | `type` | text | 否 | 否 | 否 | |
| 是否是集团 | `is_group` | text | 否 | 否 | 否 | |
| 路径 | `path` | text | 否 | 否 | 否 | |
| 是否是内部机构 | `is_internal` | text | 否 | 否 | 否 | |
| 排序 | `sort_id` | text | 否 | 否 | 否 | |
| 是否启用 | `is_enable` | text | 否 | 否 | 否 | |
| 是否被删除 | `is_deleted` | text | 否 | 否 | 否 | |
| 状态 | `status` | text | 否 | 否 | 否 | |
| ORG_ACCOUNT_ID | `org_account_id` | text | 否 | 否 | 否 | |
### `oa_member`:oa-人员
- 类型:`normal`
- 字段数量:18
| 字段标签 | 字段别名 | 字段类型 | 多值 | 必填 | 主键 | 关联/配置 |
| --- | --- | --- | --- | --- | --- | --- |
| 姓名 | `name` | text | 否 | 否 | 否 | |
| 人员id | `member_id` | text | 否 | 否 | 是 | |
| 人员编号 | `code` | text | 否 | 否 | 否 | |
| 是否是内部 | `is_internal` | text | 否 | 否 | 否 | |
| 是否可以登录 | `is_loginable` | text | 否 | 否 | 否 | |
| 是否是虚拟账号 | `is_virtual` | text | 否 | 否 | 否 | |
| 是否是管理员 | `is_admin` | text | 否 | 否 | 否 | |
| 是否被分配 | `is_assigned` | text | 否 | 否 | 否 | |
| 正式或非正式 | `type` | text | 否 | 否 | 否 | |
| 在职或离职 | `state` | text | 否 | 否 | 否 | |
| 是否启用 | `is_enable` | text | 否 | 否 | 否 | |
| 是否被删除 | `is_deleted` | text | 否 | 否 | 否 | |
| 在职或离职 | `status` | text | 否 | 否 | 否 | |
| 排序 | `sort_id` | text | 否 | 否 | 否 | |
| 主岗部门 | `org_department_id` | text | 否 | 否 | 否 | |
| 主岗岗位 | `org_post_id` | text | 否 | 否 | 否 | |
| 主岗职务级别 | `org_level_id` | text | 否 | 否 | 否 | |
| 主岗单位 | `org_account_id` | text | 否 | 否 | 否 | |
### `process_monitor_group`:流程监控分组
- 类型:`normal`
- 字段数量:2
| 字段标签 | 字段别名 | 字段类型 | 多值 | 必填 | 主键 | 关联/配置 |
| --- | --- | --- | --- | --- | --- | --- |
| 分组名称 | `group_name` | text | 否 | 否 | 否 | |
| 流程 | `progresses` | reference | 是 | 否 | 否 | Subject: audit_related_progress |
### 关联对象与子对象定义
依赖字段通过 `settings.subject` 指向的对象会递归纳入本节;`form` 资源不属于 Subject 依赖。
- `audit_progress_info.related_progress` -> `audit_related_progress`
- `process_monitor_group.progresses` -> `audit_related_progress`
<!-- SUBJECT_SCHEMA_SYNC:END -->
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment