feat(oa): add owner person/dept fields with initiator defaults
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
3b46b10604
commit
4ebc2dbe82
18 files changed
+791
-15
No files matched your search
@@ -0,0 +1,50 @@
|
||||
# 归属人 / 归属部门 Implementation Plan
|
||||
|
||||
> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.
|
||||
|
||||
**Goal:** 表单设计器新增「归属人」「归属部门」,发起时默认当前登录人/主部门,属性「允许修改」默认关闭。
|
||||
|
||||
**Architecture:** 新控件类型 `ownerPerson` / `ownerDept` 包装现有人员/部门选择器;发起页注入默认值;后端发布白名单 + 只读强制回填。
|
||||
|
||||
**Tech Stack:** Vue 3、FormCreate Designer、FastAPI
|
||||
|
||||
**Spec:** `docs/superpowers/specs/2026-07-30-oa-owner-fields-design.md`
|
||||
|
||||
---
|
||||
|
||||
### Task 1: 前端控件与注册
|
||||
|
||||
**Files:**
|
||||
- Create: `web-admin/src/utils/oa-owner-person-select-rule.ts`
|
||||
- Create: `web-admin/src/utils/oa-owner-dept-select-rule.ts`
|
||||
- Create: `web-admin/src/utils/oa-form-create-owner-person.ts`
|
||||
- Create: `web-admin/src/utils/oa-form-create-owner-dept.ts`
|
||||
- Create: `web-admin/src/components/oa-approval/OaOwnerPersonSelect.vue`
|
||||
- Create: `web-admin/src/components/oa-approval/OaOwnerDeptSelect.vue`
|
||||
- Create: `web-admin/src/utils/oa-owner-field-defaults.ts`
|
||||
- Modify: `web-admin/src/main.ts`, `web-admin/src/oa-fc-host/main.ts`
|
||||
- Modify: `web-admin/src/views/oa-approval/start/index.vue`
|
||||
- Modify: print / condition / related display as needed
|
||||
|
||||
- [x] 拖拽规则:label 归属人/归属部门;props.allowModify 默认 false;单选
|
||||
- [x] 组件:`disabled || !allowModify`;包装 OaPersonSelect / OaDeptSelect
|
||||
- [x] `applyOwnerFieldDefaults` + 发起页调用
|
||||
- [x] 注册 setup;打印识别新 type;条件候选含 ownerPerson
|
||||
|
||||
### Task 2: 后端白名单与强制回填
|
||||
|
||||
**Files:**
|
||||
- Modify: `backend/app/services/oa_publish.py`
|
||||
- Modify: `backend/app/services/oa_person_select.py` / `oa_dept_select.py` 或新增 apply
|
||||
- Modify: `backend/app/services/oa_engine.py` start_instance
|
||||
- Modify: `backend/app/services/oa_related_approval.py`
|
||||
- Test: `backend/tests/test_oa_owner_fields.py`
|
||||
|
||||
- [x] FILLABLE + CONDITION(ownerPerson)
|
||||
- [x] 校验 owner* 同单选 person/dept
|
||||
- [x] allowModify 为假时强制当前用户/部门
|
||||
- [x] 单测覆盖
|
||||
|
||||
### Task 3: 图谱更新
|
||||
|
||||
- [x] `./scripts/update-graph.sh frontend`(backend 因节点过多 HTML 失败,服务代码已落地)
|
||||
@@ -0,0 +1,112 @@
|
||||
# OA 表单设计 · 归属人 / 归属部门 设计文档
|
||||
|
||||
**日期**: 2026-07-30
|
||||
**状态**: 已实现(计划见 `docs/superpowers/plans/2026-07-30-oa-owner-fields.md`)
|
||||
**范围**: `web-admin` 审批设计器「2 表单设计」组件 Tab;发起页默认值;`backend` 发布白名单与提交时只读强制回填
|
||||
**界面模式**: 对齐现有「人员」「部门」控件;视觉 Fresh Mint
|
||||
|
||||
---
|
||||
|
||||
## 1. 背景与目标
|
||||
|
||||
表单设计「组件」Tab 已有 **人员**、**部门**。业务需要两个带默认值的同类控件:
|
||||
|
||||
- **归属人**:默认当前登录人
|
||||
- **归属部门**:默认当前登录人主部门
|
||||
|
||||
### 1.1 目标
|
||||
|
||||
- 左侧「组件」新增「归属人」「归属部门」,与人员/部门并列。
|
||||
- 发起时自动填入当前登录人 / 主部门。
|
||||
- 设计器属性「允许修改」:默认 **关**(只读);开则可改选。
|
||||
- 值结构与人员/部门一致,便于打印、详情、条件(归属人)复用。
|
||||
|
||||
### 1.2 非目标
|
||||
|
||||
- 不改现有「人员」「部门」行为。
|
||||
- 不放入「套件」Tab。
|
||||
- 不支持多选。
|
||||
|
||||
---
|
||||
|
||||
## 2. 产品决策(已确认)
|
||||
|
||||
| 项 | 决策 |
|
||||
|----|------|
|
||||
| 控件类型 | `ownerPerson` / `ownerDept` |
|
||||
| 默认值时机 | 发起审批表单加载时写入;设计器画布不依赖设计者登录身份作为业务默认 |
|
||||
| 默认来源 | 归属人 = 当前用户 id + 姓名;归属部门 = 主部门 id + 名称(全路径优先) |
|
||||
| 允许修改 | 属性开关 `allowModify`,**默认 false** |
|
||||
| 选型 | 固定单选 |
|
||||
| 值格式 | `{ id, name }`(与 person / dept 一致) |
|
||||
| 只读防篡改 | `allowModify === false` 时,后端发起提交强制回填为当前用户 / 主部门 |
|
||||
|
||||
---
|
||||
|
||||
## 3. Schema
|
||||
|
||||
```json
|
||||
{
|
||||
"type": "ownerPerson",
|
||||
"field": "Fxxxx",
|
||||
"title": "归属人",
|
||||
"props": {
|
||||
"allowModify": false
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
```json
|
||||
{
|
||||
"type": "ownerDept",
|
||||
"field": "Fyyyy",
|
||||
"title": "归属部门",
|
||||
"props": {
|
||||
"allowModify": false
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 4. 运行时
|
||||
|
||||
### 4.1 前端(发起页)
|
||||
|
||||
- 加载 schema 后:对空字段写入默认值。
|
||||
- `allowModify === false`:控件 `disabled`(只读展示)。
|
||||
- `allowModify === true`:复用人员/部门选择器,可改选。
|
||||
- 详情页:展示已存 `formData`,不再按当前查看者覆盖。
|
||||
|
||||
### 4.2 后端(发起)
|
||||
|
||||
- 发布白名单纳入 `ownerPerson` / `ownerDept`。
|
||||
- 校验值格式同单选 person / dept。
|
||||
- `allowModify` 为假时:提交前强制写入发起人 id/姓名、主部门 id/名称。
|
||||
- 条件分支:`ownerPerson` 与 `person` 同属人员类(`contains`);`ownerDept` 暂不进条件候选(与现有 `dept` 一致)。
|
||||
|
||||
### 4.3 打印 / 关联展示
|
||||
|
||||
- 打印与关联审批摘要:按 person / dept 同路径格式化展示。
|
||||
|
||||
---
|
||||
|
||||
## 5. 登录用户字段约定
|
||||
|
||||
web-admin `userInfo`(见 `backend/app/api/public.py` `_build_user_info_payload`):
|
||||
|
||||
| 用途 | 字段 |
|
||||
|------|------|
|
||||
| 用户 id | `id`(兼容 `userId`) |
|
||||
| 姓名 | `realName`(兼容 username) |
|
||||
| 部门 id | `regionId`(即 `sys_user.dept_id`) |
|
||||
| 部门名称 | 登录态常无 `regionName`;前端用部门树解析全路径,后端用库表 `dept_name` |
|
||||
|
||||
---
|
||||
|
||||
## 6. 自检
|
||||
|
||||
- [x] 无未决占位符
|
||||
- [x] 与「人员/部门」值格式一致
|
||||
- [x] 默认不允许修改 + 后端强制回填
|
||||
- [x] 范围不含套件、不多选
|
||||
Reference in new issue
Block a user