【Codex】用部门管理模块维护组织架构与管理层级

部门管理在教育管理系统中的价值,在于维护后台权限、组织结构和用户可访问的功能边界。模块需要和现有接口、权限、页面状态保持一致,不能只写成普通后台表格。

本文基于 系统功能/系统管理_部门管理 对应源码,把业务目标拆成模型字段、接口规则、页面交互和验收标准,形成 Codex 可执行的项目代码生成任务。

文章目录

设计与需求

部门管理不能只按普通 CRUD 理解。源码范围包括 server_backend/dvadmin/system/models.py、server_backend/dvadmin/system/views/dept.py、server_vue3/src/views/system/SystemAdministration/dept/api.ts、server_vue3/src/views/system/SystemAdministration/dept/components/DeptTreeCom/index.vue、server_vue3/src/views/system/SystemAdministration/dept/index.vue,这些文件共同决定页面入口、字段保存、接口动作、权限边界和验收口径。交给 Codex 的任务需要明确业务字段、接口前缀、页面回显和异常处理,避免后端字段、前端表单和 PDD 文档相互脱节。
#mermaid-svg-Ll8EmA5dpLSuEvv4{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;fill:#333;}@keyframes edge-animation-frame{from{stroke-dashoffset:0;}}@keyframes dash{to{stroke-dashoffset:0;}}#mermaid-svg-Ll8EmA5dpLSuEvv4 .edge-animation-slow{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 50s linear infinite;stroke-linecap:round;}#mermaid-svg-Ll8EmA5dpLSuEvv4 .edge-animation-fast{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 20s linear infinite;stroke-linecap:round;}#mermaid-svg-Ll8EmA5dpLSuEvv4 .error-icon{fill:#552222;}#mermaid-svg-Ll8EmA5dpLSuEvv4 .error-text{fill:#552222;stroke:#552222;}#mermaid-svg-Ll8EmA5dpLSuEvv4 .edge-thickness-normal{stroke-width:1px;}#mermaid-svg-Ll8EmA5dpLSuEvv4 .edge-thickness-thick{stroke-width:3.5px;}#mermaid-svg-Ll8EmA5dpLSuEvv4 .edge-pattern-solid{stroke-dasharray:0;}#mermaid-svg-Ll8EmA5dpLSuEvv4 .edge-thickness-invisible{stroke-width:0;fill:none;}#mermaid-svg-Ll8EmA5dpLSuEvv4 .edge-pattern-dashed{stroke-dasharray:3;}#mermaid-svg-Ll8EmA5dpLSuEvv4 .edge-pattern-dotted{stroke-dasharray:2;}#mermaid-svg-Ll8EmA5dpLSuEvv4 .marker{fill:#333333;stroke:#333333;}#mermaid-svg-Ll8EmA5dpLSuEvv4 .marker.cross{stroke:#333333;}#mermaid-svg-Ll8EmA5dpLSuEvv4 svg{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;}#mermaid-svg-Ll8EmA5dpLSuEvv4 p{margin:0;}#mermaid-svg-Ll8EmA5dpLSuEvv4 .label{font-family:"trebuchet ms",verdana,arial,sans-serif;color:#333;}#mermaid-svg-Ll8EmA5dpLSuEvv4 .cluster-label text{fill:#333;}#mermaid-svg-Ll8EmA5dpLSuEvv4 .cluster-label span{color:#333;}#mermaid-svg-Ll8EmA5dpLSuEvv4 .cluster-label span p{background-color:transparent;}#mermaid-svg-Ll8EmA5dpLSuEvv4 .label text,#mermaid-svg-Ll8EmA5dpLSuEvv4 span{fill:#333;color:#333;}#mermaid-svg-Ll8EmA5dpLSuEvv4 .node rect,#mermaid-svg-Ll8EmA5dpLSuEvv4 .node circle,#mermaid-svg-Ll8EmA5dpLSuEvv4 .node ellipse,#mermaid-svg-Ll8EmA5dpLSuEvv4 .node polygon,#mermaid-svg-Ll8EmA5dpLSuEvv4 .node path{fill:#ECECFF;stroke:#9370DB;stroke-width:1px;}#mermaid-svg-Ll8EmA5dpLSuEvv4 .rough-node .label text,#mermaid-svg-Ll8EmA5dpLSuEvv4 .node .label text,#mermaid-svg-Ll8EmA5dpLSuEvv4 .image-shape .label,#mermaid-svg-Ll8EmA5dpLSuEvv4 .icon-shape .label{text-anchor:middle;}#mermaid-svg-Ll8EmA5dpLSuEvv4 .node .katex path{fill:#000;stroke:#000;stroke-width:1px;}#mermaid-svg-Ll8EmA5dpLSuEvv4 .rough-node .label,#mermaid-svg-Ll8EmA5dpLSuEvv4 .node .label,#mermaid-svg-Ll8EmA5dpLSuEvv4 .image-shape .label,#mermaid-svg-Ll8EmA5dpLSuEvv4 .icon-shape .label{text-align:center;}#mermaid-svg-Ll8EmA5dpLSuEvv4 .node.clickable{cursor:pointer;}#mermaid-svg-Ll8EmA5dpLSuEvv4 .root .anchor path{fill:#333333!important;stroke-width:0;stroke:#333333;}#mermaid-svg-Ll8EmA5dpLSuEvv4 .arrowheadPath{fill:#333333;}#mermaid-svg-Ll8EmA5dpLSuEvv4 .edgePath .path{stroke:#333333;stroke-width:2.0px;}#mermaid-svg-Ll8EmA5dpLSuEvv4 .flowchart-link{stroke:#333333;fill:none;}#mermaid-svg-Ll8EmA5dpLSuEvv4 .edgeLabel{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-Ll8EmA5dpLSuEvv4 .edgeLabel p{background-color:rgba(232,232,232, 0.8);}#mermaid-svg-Ll8EmA5dpLSuEvv4 .edgeLabel rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-Ll8EmA5dpLSuEvv4 .labelBkg{background-color:rgba(232, 232, 232, 0.5);}#mermaid-svg-Ll8EmA5dpLSuEvv4 .cluster rect{fill:#ffffde;stroke:#aaaa33;stroke-width:1px;}#mermaid-svg-Ll8EmA5dpLSuEvv4 .cluster text{fill:#333;}#mermaid-svg-Ll8EmA5dpLSuEvv4 .cluster span{color:#333;}#mermaid-svg-Ll8EmA5dpLSuEvv4 div.mermaidTooltip{position:absolute;text-align:center;max-width:200px;padding:2px;font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:12px;background:hsl(80, 100%, 96.2745098039%);border:1px solid #aaaa33;border-radius:2px;pointer-events:none;z-index:100;}#mermaid-svg-Ll8EmA5dpLSuEvv4 .flowchartTitleText{text-anchor:middle;font-size:18px;fill:#333;}#mermaid-svg-Ll8EmA5dpLSuEvv4 rect.text{fill:none;stroke-width:0;}#mermaid-svg-Ll8EmA5dpLSuEvv4 .icon-shape,#mermaid-svg-Ll8EmA5dpLSuEvv4 .image-shape{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-Ll8EmA5dpLSuEvv4 .icon-shape p,#mermaid-svg-Ll8EmA5dpLSuEvv4 .image-shape p{background-color:rgba(232,232,232, 0.8);padding:2px;}#mermaid-svg-Ll8EmA5dpLSuEvv4 .icon-shape .label rect,#mermaid-svg-Ll8EmA5dpLSuEvv4 .image-shape .label rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-Ll8EmA5dpLSuEvv4 .label-icon{display:inline-block;height:1em;overflow:visible;vertical-align:-0.125em;}#mermaid-svg-Ll8EmA5dpLSuEvv4 .node .label-icon path{fill:currentColor;stroke:revert;stroke-width:revert;}#mermaid-svg-Ll8EmA5dpLSuEvv4 :root{--mermaid-font-family:"trebuchet ms",verdana,arial,sans-serif;}#mermaid-svg-Ll8EmA5dpLSuEvv4 .input>*{fill:#EEF4FF!important;stroke:#5B8FF9!important;color:#1D39C4!important;stroke-width:1.2px!important;}#mermaid-svg-Ll8EmA5dpLSuEvv4 .input span{fill:#EEF4FF!important;stroke:#5B8FF9!important;color:#1D39C4!important;stroke-width:1.2px!important;}#mermaid-svg-Ll8EmA5dpLSuEvv4 .input tspan{fill:#1D39C4!important;}#mermaid-svg-Ll8EmA5dpLSuEvv4 .design>*{fill:#F6FFED!important;stroke:#52C41A!important;color:#237804!important;stroke-width:1.2px!important;}#mermaid-svg-Ll8EmA5dpLSuEvv4 .design span{fill:#F6FFED!important;stroke:#52C41A!important;color:#237804!important;stroke-width:1.2px!important;}#mermaid-svg-Ll8EmA5dpLSuEvv4 .design tspan{fill:#237804!important;}#mermaid-svg-Ll8EmA5dpLSuEvv4 .process>*{fill:#FFF7E6!important;stroke:#FA8C16!important;color:#AD4E00!important;stroke-width:1.2px!important;}#mermaid-svg-Ll8EmA5dpLSuEvv4 .process span{fill:#FFF7E6!important;stroke:#FA8C16!important;color:#AD4E00!important;stroke-width:1.2px!important;}#mermaid-svg-Ll8EmA5dpLSuEvv4 .process tspan{fill:#AD4E00!important;}#mermaid-svg-Ll8EmA5dpLSuEvv4 .check>*{fill:#F9F0FF!important;stroke:#722ED1!important;color:#531DAB!important;stroke-width:1.2px!important;}#mermaid-svg-Ll8EmA5dpLSuEvv4 .check span{fill:#F9F0FF!important;stroke:#722ED1!important;color:#531DAB!important;stroke-width:1.2px!important;}#mermaid-svg-Ll8EmA5dpLSuEvv4 .check tspan{fill:#531DAB!important;}#mermaid-svg-Ll8EmA5dpLSuEvv4 .output>*{fill:#E6FFFB!important;stroke:#13C2C2!important;color:#006D75!important;stroke-width:1.2px!important;}#mermaid-svg-Ll8EmA5dpLSuEvv4 .output span{fill:#E6FFFB!important;stroke:#13C2C2!important;color:#006D75!important;stroke-width:1.2px!important;}#mermaid-svg-Ll8EmA5dpLSuEvv4 .output tspan{fill:#006D75!important;} 生成阶段
设计阶段
输入阶段
教育需求
部门管理
页面结构
数据模型
接口规则
权限验收
读取源码
生成代码
验收修复

需求层描述 设计层转换 Codex 代码生成方向
业务目标 维护后台权限、组织结构和用户可访问的功能边界。 生成模块入口、页面结构和业务说明
数据模型 name(部门名称)、key(关联字符)、sort(显示排序)、owner(负责人)、phone(联系电话)、email(邮箱)、status(部门状态)、parent(上级部门) 生成序列化、字段校验、查询筛选和保存回显
页面结构 server_vue3/src/views/system/SystemAdministration/dept/api.ts、server_vue3/src/views/system/SystemAdministration/dept/components/DeptTreeCom/index.vue、server_vue3/src/views/system/SystemAdministration/dept/index.vue 生成列表、筛选区、表单、详情、预览或自定义操作区
接口规则 /api/system/dept/、/api/system/user/、/api/system/dept/all_dept/、/api/system/dept/move_up/、/api/system/dept/move_down/ 保持 GetList、GetObj、AddObj、UpdateObj、DelObj、lazyLoadDept、deptMoveUp、deptMoveDown、getDeptUserList、getAllDeptList、all_dept、move_up、move_down、dept_info 与页面调用一致
权限验收 按钮权限、接口权限、用户数据范围、异常响应 在 PDD 中列出角色、接口和越权用例
扩展能力 数据联动、导入导出 只实现源码中真实存在的扩展入口和服务边界

更适合交给 Codex 的需求说明,应覆盖源码路径、字段、接口和验收口径。部门管理的重点是把 Dept 与前端接口封装、列表配置、表单状态或自定义页面逻辑合并成一个可测试的模块任务。

可以直接使用下面的Prompt进行模块功能的设计

text 复制代码
请 Codex 基于教育管理系统真实源码设计"部门管理"模块。

业务说明:维护后台权限、组织结构和用户可访问的功能边界。
源码范围:server_backend/dvadmin/system/models.py、server_backend/dvadmin/system/views/dept.py、server_vue3/src/views/system/SystemAdministration/dept/api.ts、server_vue3/src/views/system/SystemAdministration/dept/components/DeptTreeCom/index.vue、server_vue3/src/views/system/SystemAdministration/dept/index.vue
接口范围:/api/system/dept/、/api/system/user/、/api/system/dept/all_dept/、/api/system/dept/move_up/、/api/system/dept/move_down/
字段范围:name(部门名称)、key(关联字符)、sort(显示排序)、owner(负责人)、phone(联系电话)、email(邮箱)、status(部门状态)、parent(上级部门)
已有动作:GetList、GetObj、AddObj、UpdateObj、DelObj、lazyLoadDept、deptMoveUp、deptMoveDown、getDeptUserList、getAllDeptList、all_dept、move_up、move_down、dept_info
扩展能力边界:数据联动、导入导出

请输出模块页面结构、数据模型、接口规则、权限验收、测试用例和 Codex 代码生成任务。只允许使用源码中存在的字段、接口和页面状态。

后端设计

部门管理的后端设计重点不是堆 CRUD 接口,而是建立可复用的数据底座。当前后端范围包括 server_backend/dvadmin/system/models.py、server_backend/dvadmin/system/views/dept.py。Codex 需要识别模型字段、序列化器、ViewSet、筛选逻辑和自定义 action,并让接口返回结构稳定服务前端。

源码中可识别的模型或查询对象为 Dept,核心字段覆盖 name(部门名称)、key(关联字符)、sort(显示排序)、owner(负责人)、phone(联系电话)、email(邮箱)、status(部门状态)、parent(上级部门)。接口动作包含 GetList、GetObj、AddObj、UpdateObj、DelObj、lazyLoadDept、deptMoveUp、deptMoveDown、getDeptUserList、getAllDeptList、all_dept、move_up、move_down、dept_info,查询参数关注 dept_id(dept_id)、show_all(show_all),这些内容需要和前端封装保持同名语义,避免页面有按钮但后端没有对应能力。

后端设计项 设计重点 Codex 生成方向
核心字段 name(部门名称)、key(关联字符)、sort(显示排序)、owner(负责人)、phone(联系电话) 生成序列化、查询筛选、表单回显和保存校验
补充字段 email(邮箱)、status(部门状态)、parent(上级部门) 处理状态、时间、JSON、资源或关联字段的格式转换
接口视图 server_backend/dvadmin/system/models.py、server_backend/dvadmin/system/views/dept.py /api/system/dept/、/api/system/user/、/api/system/dept/all_dept/、/api/system/dept/move_up/、/api/system/dept/move_down/ 注册列表、详情、保存、删除和已有 action
查询筛选 dept_id(dept_id)、show_all(show_all) 生成 filterset、SearchFilter 或自定义查询参数
权限控制 后端接口承担真实访问边界,前端按钮只做入口展示 生成权限判断、异常响应和越权测试
扩展服务 数据联动、导入导出 按真实源码补齐服务函数、异步任务或状态回写

可以直接使用下面的Prompt进行后端代码的设计

text 复制代码
请 Codex 按"部门管理"业务从源码上下文设计或补齐后端代码。

后端源码范围:server_backend/dvadmin/system/models.py、server_backend/dvadmin/system/views/dept.py
模型或查询对象:Dept
模型字段范围:name(部门名称)、key(关联字符)、sort(显示排序)、owner(负责人)、phone(联系电话)、email(邮箱)、status(部门状态)、parent(上级部门)
接口前缀:/api/system/dept/、/api/system/user/、/api/system/dept/all_dept/、/api/system/dept/move_up/、/api/system/dept/move_down/
已有接口动作:GetList、GetObj、AddObj、UpdateObj、DelObj、lazyLoadDept、deptMoveUp、deptMoveDown、getDeptUserList、getAllDeptList、all_dept、move_up、move_down、dept_info
查询参数:dept_id(dept_id)、show_all(show_all)

需要生成或修正数据模型、序列化规则、接口视图、路由注册、筛选查询、权限控制和基础校验。同时补齐 数据联动、导入导出 对应的后端接口或服务边界。

输出时列出涉及文件、字段校验、接口返回结构和需要执行的测试。

前端设计

部门管理的前端设计重点不是把字段堆到页面上,而是让用户能按业务路径完成查询、编辑、状态处理和结果确认。当前前端范围包括 server_vue3/src/views/system/SystemAdministration/dept/api.ts、server_vue3/src/views/system/SystemAdministration/dept/components/DeptTreeCom/index.vue、server_vue3/src/views/system/SystemAdministration/dept/index.vue,其中 api.ts 负责接口封装,crud.tsxindex.vue 负责列表、表单、自定义布局和按钮交互。

页面需要围绕 name(部门名称)、key(关联字符)、sort(显示排序)、owner(负责人)、phone(联系电话)、email(邮箱)、status(部门状态)、parent(上级部门) 组织筛选、表单和详情。保存前要处理字段格式转换,保存后刷新列表或回显详情;存在扩展能力时,还要把 数据联动、导入导出 的入口、状态和结果纳入同一套页面状态。

前端设计项 设计重点 Codex 生成方向
页面结构 server_vue3/src/views/system/SystemAdministration/dept/api.ts、server_vue3/src/views/system/SystemAdministration/dept/components/DeptTreeCom/index.vue、server_vue3/src/views/system/SystemAdministration/dept/index.vue 生成列表、筛选区、表单、详情抽屉、弹窗或自定义操作区
接口封装 /api/system/dept/、/api/system/user/、/api/system/dept/all_dept/、/api/system/dept/move_up/、/api/system/dept/move_down/ 统一封装查询、详情、保存、删除和 GetList、GetObj、AddObj、UpdateObj、DelObj、lazyLoadDept、deptMoveUp、deptMoveDown、getDeptUserList、getAllDeptList、all_dept、move_up、move_down、dept_info 等动作
字段回显 name(部门名称)、key(关联字符)、sort(显示排序)、owner(负责人)、phone(联系电话)、email(邮箱)、status(部门状态)、parent(上级部门) 处理下拉、树形、JSON、状态、时间和资源字段回显
权限按钮 根据 auth、按钮权限或后端权限结果展示操作入口 生成新增、编辑、删除、处理、下载或预览按钮
扩展交互 数据联动、导入导出 生成入口按钮、加载状态、结果回填、人工确认和异常提示

可以直接使用下面的Prompt进行前端代码的设计

text 复制代码
请 Codex 按"部门管理"业务生成或补齐前端页面代码。

前端源码范围:server_vue3/src/views/system/SystemAdministration/dept/api.ts、server_vue3/src/views/system/SystemAdministration/dept/components/DeptTreeCom/index.vue、server_vue3/src/views/system/SystemAdministration/dept/index.vue
接口范围:/api/system/dept/、/api/system/user/、/api/system/dept/all_dept/、/api/system/dept/move_up/、/api/system/dept/move_down/
字段范围:name(部门名称)、key(关联字符)、sort(显示排序)、owner(负责人)、phone(联系电话)、email(邮箱)、status(部门状态)、parent(上级部门)
已有动作:GetList、GetObj、AddObj、UpdateObj、DelObj、lazyLoadDept、deptMoveUp、deptMoveDown、getDeptUserList、getAllDeptList、all_dept、move_up、move_down、dept_info

需要生成页面结构、列表查询、筛选区域、新增编辑表单、详情预览、权限按钮、保存回显和接口调用;源码已有批量入口时再接入批量操作。涉及扩展交互时只实现源码已有的 数据联动、导入导出,包括入口按钮、状态提示、结果回填和保存回显。

输出时说明字段转换、表单初始化、异常提示和刷新策略。

扩展功能

部门管理的扩展能力来自源码中的字段结构、接口动作或页面组件,不属于单纯 CRUD。它们的价值在于把教育管理系统中的生成、识别、统计、文件、审批、任务或批量流程接入真实业务数据。

扩展功能 主要用途 落地重点
数据联动 把筛选条件、树节点、状态字段、远程下拉和表单回显组织成稳定数据流。 字段变化要同步查询参数、保存载荷和回显结构,避免页面临时状态与后端字段脱节。
导入导出 把模板导入、批量导出、Excel/CSV/Zip 或下载任务纳入模块流程。 导入要校验字段和权限,导出任务要返回下载任务或文件结果。

数据联动

源码中的 name(部门名称)、key(关联字符)、sort(显示排序)、owner(负责人)、phone(联系电话)、email(邮箱)、status(部门状态)、parent(上级部门)、接口参数和页面状态之间存在联动关系。Codex 生成时需要把查询条件、表单选择、字段转换和详情回显串成一条数据流,不能把每个下拉框或状态开关写成互不关联的临时变量。
#mermaid-svg-vfW6PSJYErbKxJgh{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;fill:#333;}@keyframes edge-animation-frame{from{stroke-dashoffset:0;}}@keyframes dash{to{stroke-dashoffset:0;}}#mermaid-svg-vfW6PSJYErbKxJgh .edge-animation-slow{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 50s linear infinite;stroke-linecap:round;}#mermaid-svg-vfW6PSJYErbKxJgh .edge-animation-fast{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 20s linear infinite;stroke-linecap:round;}#mermaid-svg-vfW6PSJYErbKxJgh .error-icon{fill:#552222;}#mermaid-svg-vfW6PSJYErbKxJgh .error-text{fill:#552222;stroke:#552222;}#mermaid-svg-vfW6PSJYErbKxJgh .edge-thickness-normal{stroke-width:1px;}#mermaid-svg-vfW6PSJYErbKxJgh .edge-thickness-thick{stroke-width:3.5px;}#mermaid-svg-vfW6PSJYErbKxJgh .edge-pattern-solid{stroke-dasharray:0;}#mermaid-svg-vfW6PSJYErbKxJgh .edge-thickness-invisible{stroke-width:0;fill:none;}#mermaid-svg-vfW6PSJYErbKxJgh .edge-pattern-dashed{stroke-dasharray:3;}#mermaid-svg-vfW6PSJYErbKxJgh .edge-pattern-dotted{stroke-dasharray:2;}#mermaid-svg-vfW6PSJYErbKxJgh .marker{fill:#333333;stroke:#333333;}#mermaid-svg-vfW6PSJYErbKxJgh .marker.cross{stroke:#333333;}#mermaid-svg-vfW6PSJYErbKxJgh svg{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;}#mermaid-svg-vfW6PSJYErbKxJgh p{margin:0;}#mermaid-svg-vfW6PSJYErbKxJgh .label{font-family:"trebuchet ms",verdana,arial,sans-serif;color:#333;}#mermaid-svg-vfW6PSJYErbKxJgh .cluster-label text{fill:#333;}#mermaid-svg-vfW6PSJYErbKxJgh .cluster-label span{color:#333;}#mermaid-svg-vfW6PSJYErbKxJgh .cluster-label span p{background-color:transparent;}#mermaid-svg-vfW6PSJYErbKxJgh .label text,#mermaid-svg-vfW6PSJYErbKxJgh span{fill:#333;color:#333;}#mermaid-svg-vfW6PSJYErbKxJgh .node rect,#mermaid-svg-vfW6PSJYErbKxJgh .node circle,#mermaid-svg-vfW6PSJYErbKxJgh .node ellipse,#mermaid-svg-vfW6PSJYErbKxJgh .node polygon,#mermaid-svg-vfW6PSJYErbKxJgh .node path{fill:#ECECFF;stroke:#9370DB;stroke-width:1px;}#mermaid-svg-vfW6PSJYErbKxJgh .rough-node .label text,#mermaid-svg-vfW6PSJYErbKxJgh .node .label text,#mermaid-svg-vfW6PSJYErbKxJgh .image-shape .label,#mermaid-svg-vfW6PSJYErbKxJgh .icon-shape .label{text-anchor:middle;}#mermaid-svg-vfW6PSJYErbKxJgh .node .katex path{fill:#000;stroke:#000;stroke-width:1px;}#mermaid-svg-vfW6PSJYErbKxJgh .rough-node .label,#mermaid-svg-vfW6PSJYErbKxJgh .node .label,#mermaid-svg-vfW6PSJYErbKxJgh .image-shape .label,#mermaid-svg-vfW6PSJYErbKxJgh .icon-shape .label{text-align:center;}#mermaid-svg-vfW6PSJYErbKxJgh .node.clickable{cursor:pointer;}#mermaid-svg-vfW6PSJYErbKxJgh .root .anchor path{fill:#333333!important;stroke-width:0;stroke:#333333;}#mermaid-svg-vfW6PSJYErbKxJgh .arrowheadPath{fill:#333333;}#mermaid-svg-vfW6PSJYErbKxJgh .edgePath .path{stroke:#333333;stroke-width:2.0px;}#mermaid-svg-vfW6PSJYErbKxJgh .flowchart-link{stroke:#333333;fill:none;}#mermaid-svg-vfW6PSJYErbKxJgh .edgeLabel{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-vfW6PSJYErbKxJgh .edgeLabel p{background-color:rgba(232,232,232, 0.8);}#mermaid-svg-vfW6PSJYErbKxJgh .edgeLabel rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-vfW6PSJYErbKxJgh .labelBkg{background-color:rgba(232, 232, 232, 0.5);}#mermaid-svg-vfW6PSJYErbKxJgh .cluster rect{fill:#ffffde;stroke:#aaaa33;stroke-width:1px;}#mermaid-svg-vfW6PSJYErbKxJgh .cluster text{fill:#333;}#mermaid-svg-vfW6PSJYErbKxJgh .cluster span{color:#333;}#mermaid-svg-vfW6PSJYErbKxJgh div.mermaidTooltip{position:absolute;text-align:center;max-width:200px;padding:2px;font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:12px;background:hsl(80, 100%, 96.2745098039%);border:1px solid #aaaa33;border-radius:2px;pointer-events:none;z-index:100;}#mermaid-svg-vfW6PSJYErbKxJgh .flowchartTitleText{text-anchor:middle;font-size:18px;fill:#333;}#mermaid-svg-vfW6PSJYErbKxJgh rect.text{fill:none;stroke-width:0;}#mermaid-svg-vfW6PSJYErbKxJgh .icon-shape,#mermaid-svg-vfW6PSJYErbKxJgh .image-shape{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-vfW6PSJYErbKxJgh .icon-shape p,#mermaid-svg-vfW6PSJYErbKxJgh .image-shape p{background-color:rgba(232,232,232, 0.8);padding:2px;}#mermaid-svg-vfW6PSJYErbKxJgh .icon-shape .label rect,#mermaid-svg-vfW6PSJYErbKxJgh .image-shape .label rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-vfW6PSJYErbKxJgh .label-icon{display:inline-block;height:1em;overflow:visible;vertical-align:-0.125em;}#mermaid-svg-vfW6PSJYErbKxJgh .node .label-icon path{fill:currentColor;stroke:revert;stroke-width:revert;}#mermaid-svg-vfW6PSJYErbKxJgh :root{--mermaid-font-family:"trebuchet ms",verdana,arial,sans-serif;}#mermaid-svg-vfW6PSJYErbKxJgh .input>*{fill:#EEF4FF!important;stroke:#5B8FF9!important;color:#1D39C4!important;stroke-width:1.2px!important;}#mermaid-svg-vfW6PSJYErbKxJgh .input span{fill:#EEF4FF!important;stroke:#5B8FF9!important;color:#1D39C4!important;stroke-width:1.2px!important;}#mermaid-svg-vfW6PSJYErbKxJgh .input tspan{fill:#1D39C4!important;}#mermaid-svg-vfW6PSJYErbKxJgh .process>*{fill:#FFF7E6!important;stroke:#FA8C16!important;color:#AD4E00!important;stroke-width:1.2px!important;}#mermaid-svg-vfW6PSJYErbKxJgh .process span{fill:#FFF7E6!important;stroke:#FA8C16!important;color:#AD4E00!important;stroke-width:1.2px!important;}#mermaid-svg-vfW6PSJYErbKxJgh .process tspan{fill:#AD4E00!important;}#mermaid-svg-vfW6PSJYErbKxJgh .check>*{fill:#F9F0FF!important;stroke:#722ED1!important;color:#531DAB!important;stroke-width:1.2px!important;}#mermaid-svg-vfW6PSJYErbKxJgh .check span{fill:#F9F0FF!important;stroke:#722ED1!important;color:#531DAB!important;stroke-width:1.2px!important;}#mermaid-svg-vfW6PSJYErbKxJgh .check tspan{fill:#531DAB!important;}#mermaid-svg-vfW6PSJYErbKxJgh .output>*{fill:#E6FFFB!important;stroke:#13C2C2!important;color:#006D75!important;stroke-width:1.2px!important;}#mermaid-svg-vfW6PSJYErbKxJgh .output span{fill:#E6FFFB!important;stroke:#13C2C2!important;color:#006D75!important;stroke-width:1.2px!important;}#mermaid-svg-vfW6PSJYErbKxJgh .output tspan{fill:#006D75!important;} 结果阶段
处理阶段
输入阶段
筛选条件
表单选择
参数转换
接口请求
字段回显
列表刷新
状态更新

交给 Codex 生成时,边界要限定在 server_backend/dvadmin/system/models.py、server_backend/dvadmin/system/views/dept.py、server_vue3/src/views/system/SystemAdministration/dept/api.ts、server_vue3/src/views/system/SystemAdministration/dept/components/DeptTreeCom/index.vue、server_vue3/src/views/system/SystemAdministration/dept/index.vue 内。字段变化要同步查询参数、保存载荷和回显结构,避免页面临时状态与后端字段脱节。 同时需要补齐权限判断、异常提示、保存回显和测试用例。

可以直接使用下面的Prompt进行数据联动设计

text 复制代码
请 Codex 基于真实源码补齐"部门管理"的数据联动能力。

模块源码范围:server_backend/dvadmin/system/models.py、server_backend/dvadmin/system/views/dept.py、server_vue3/src/views/system/SystemAdministration/dept/api.ts、server_vue3/src/views/system/SystemAdministration/dept/components/DeptTreeCom/index.vue、server_vue3/src/views/system/SystemAdministration/dept/index.vue
接口范围:/api/system/dept/、/api/system/user/、/api/system/dept/all_dept/、/api/system/dept/move_up/、/api/system/dept/move_down/
字段范围:name(部门名称)、key(关联字符)、sort(显示排序)、owner(负责人)、phone(联系电话)、email(邮箱)、status(部门状态)、parent(上级部门)
功能用途:把筛选条件、树节点、状态字段、远程下拉和表单回显组织成稳定数据流。
落地边界:字段变化要同步查询参数、保存载荷和回显结构,避免页面临时状态与后端字段脱节。

要求只使用源码中已经存在的字段、接口和页面状态,不新增未确认的业务能力。输出接口设计、前端交互、权限约束、异常处理和验收清单。

导入导出

导入导出能力用于把模板导入、批量导出、Excel/CSV/Zip 或下载任务纳入模块流程。交给 Codex 生成时,边界要限定在 server_backend/dvadmin/system/models.py、server_backend/dvadmin/system/views/dept.py、server_vue3/src/views/system/SystemAdministration/dept/api.ts、server_vue3/src/views/system/SystemAdministration/dept/components/DeptTreeCom/index.vue、server_vue3/src/views/system/SystemAdministration/dept/index.vue 内,重点是导入要校验字段和权限,导出任务要返回下载任务或文件结果。
#mermaid-svg-nPd4pyELgEBR2UeQ{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;fill:#333;}@keyframes edge-animation-frame{from{stroke-dashoffset:0;}}@keyframes dash{to{stroke-dashoffset:0;}}#mermaid-svg-nPd4pyELgEBR2UeQ .edge-animation-slow{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 50s linear infinite;stroke-linecap:round;}#mermaid-svg-nPd4pyELgEBR2UeQ .edge-animation-fast{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 20s linear infinite;stroke-linecap:round;}#mermaid-svg-nPd4pyELgEBR2UeQ .error-icon{fill:#552222;}#mermaid-svg-nPd4pyELgEBR2UeQ .error-text{fill:#552222;stroke:#552222;}#mermaid-svg-nPd4pyELgEBR2UeQ .edge-thickness-normal{stroke-width:1px;}#mermaid-svg-nPd4pyELgEBR2UeQ .edge-thickness-thick{stroke-width:3.5px;}#mermaid-svg-nPd4pyELgEBR2UeQ .edge-pattern-solid{stroke-dasharray:0;}#mermaid-svg-nPd4pyELgEBR2UeQ .edge-thickness-invisible{stroke-width:0;fill:none;}#mermaid-svg-nPd4pyELgEBR2UeQ .edge-pattern-dashed{stroke-dasharray:3;}#mermaid-svg-nPd4pyELgEBR2UeQ .edge-pattern-dotted{stroke-dasharray:2;}#mermaid-svg-nPd4pyELgEBR2UeQ .marker{fill:#333333;stroke:#333333;}#mermaid-svg-nPd4pyELgEBR2UeQ .marker.cross{stroke:#333333;}#mermaid-svg-nPd4pyELgEBR2UeQ svg{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;}#mermaid-svg-nPd4pyELgEBR2UeQ p{margin:0;}#mermaid-svg-nPd4pyELgEBR2UeQ .label{font-family:"trebuchet ms",verdana,arial,sans-serif;color:#333;}#mermaid-svg-nPd4pyELgEBR2UeQ .cluster-label text{fill:#333;}#mermaid-svg-nPd4pyELgEBR2UeQ .cluster-label span{color:#333;}#mermaid-svg-nPd4pyELgEBR2UeQ .cluster-label span p{background-color:transparent;}#mermaid-svg-nPd4pyELgEBR2UeQ .label text,#mermaid-svg-nPd4pyELgEBR2UeQ span{fill:#333;color:#333;}#mermaid-svg-nPd4pyELgEBR2UeQ .node rect,#mermaid-svg-nPd4pyELgEBR2UeQ .node circle,#mermaid-svg-nPd4pyELgEBR2UeQ .node ellipse,#mermaid-svg-nPd4pyELgEBR2UeQ .node polygon,#mermaid-svg-nPd4pyELgEBR2UeQ .node path{fill:#ECECFF;stroke:#9370DB;stroke-width:1px;}#mermaid-svg-nPd4pyELgEBR2UeQ .rough-node .label text,#mermaid-svg-nPd4pyELgEBR2UeQ .node .label text,#mermaid-svg-nPd4pyELgEBR2UeQ .image-shape .label,#mermaid-svg-nPd4pyELgEBR2UeQ .icon-shape .label{text-anchor:middle;}#mermaid-svg-nPd4pyELgEBR2UeQ .node .katex path{fill:#000;stroke:#000;stroke-width:1px;}#mermaid-svg-nPd4pyELgEBR2UeQ .rough-node .label,#mermaid-svg-nPd4pyELgEBR2UeQ .node .label,#mermaid-svg-nPd4pyELgEBR2UeQ .image-shape .label,#mermaid-svg-nPd4pyELgEBR2UeQ .icon-shape .label{text-align:center;}#mermaid-svg-nPd4pyELgEBR2UeQ .node.clickable{cursor:pointer;}#mermaid-svg-nPd4pyELgEBR2UeQ .root .anchor path{fill:#333333!important;stroke-width:0;stroke:#333333;}#mermaid-svg-nPd4pyELgEBR2UeQ .arrowheadPath{fill:#333333;}#mermaid-svg-nPd4pyELgEBR2UeQ .edgePath .path{stroke:#333333;stroke-width:2.0px;}#mermaid-svg-nPd4pyELgEBR2UeQ .flowchart-link{stroke:#333333;fill:none;}#mermaid-svg-nPd4pyELgEBR2UeQ .edgeLabel{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-nPd4pyELgEBR2UeQ .edgeLabel p{background-color:rgba(232,232,232, 0.8);}#mermaid-svg-nPd4pyELgEBR2UeQ .edgeLabel rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-nPd4pyELgEBR2UeQ .labelBkg{background-color:rgba(232, 232, 232, 0.5);}#mermaid-svg-nPd4pyELgEBR2UeQ .cluster rect{fill:#ffffde;stroke:#aaaa33;stroke-width:1px;}#mermaid-svg-nPd4pyELgEBR2UeQ .cluster text{fill:#333;}#mermaid-svg-nPd4pyELgEBR2UeQ .cluster span{color:#333;}#mermaid-svg-nPd4pyELgEBR2UeQ div.mermaidTooltip{position:absolute;text-align:center;max-width:200px;padding:2px;font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:12px;background:hsl(80, 100%, 96.2745098039%);border:1px solid #aaaa33;border-radius:2px;pointer-events:none;z-index:100;}#mermaid-svg-nPd4pyELgEBR2UeQ .flowchartTitleText{text-anchor:middle;font-size:18px;fill:#333;}#mermaid-svg-nPd4pyELgEBR2UeQ rect.text{fill:none;stroke-width:0;}#mermaid-svg-nPd4pyELgEBR2UeQ .icon-shape,#mermaid-svg-nPd4pyELgEBR2UeQ .image-shape{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-nPd4pyELgEBR2UeQ .icon-shape p,#mermaid-svg-nPd4pyELgEBR2UeQ .image-shape p{background-color:rgba(232,232,232, 0.8);padding:2px;}#mermaid-svg-nPd4pyELgEBR2UeQ .icon-shape .label rect,#mermaid-svg-nPd4pyELgEBR2UeQ .image-shape .label rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-nPd4pyELgEBR2UeQ .label-icon{display:inline-block;height:1em;overflow:visible;vertical-align:-0.125em;}#mermaid-svg-nPd4pyELgEBR2UeQ .node .label-icon path{fill:currentColor;stroke:revert;stroke-width:revert;}#mermaid-svg-nPd4pyELgEBR2UeQ :root{--mermaid-font-family:"trebuchet ms",verdana,arial,sans-serif;}#mermaid-svg-nPd4pyELgEBR2UeQ .input>*{fill:#EEF4FF!important;stroke:#5B8FF9!important;color:#1D39C4!important;stroke-width:1.2px!important;}#mermaid-svg-nPd4pyELgEBR2UeQ .input span{fill:#EEF4FF!important;stroke:#5B8FF9!important;color:#1D39C4!important;stroke-width:1.2px!important;}#mermaid-svg-nPd4pyELgEBR2UeQ .input tspan{fill:#1D39C4!important;}#mermaid-svg-nPd4pyELgEBR2UeQ .process>*{fill:#FFF7E6!important;stroke:#FA8C16!important;color:#AD4E00!important;stroke-width:1.2px!important;}#mermaid-svg-nPd4pyELgEBR2UeQ .process span{fill:#FFF7E6!important;stroke:#FA8C16!important;color:#AD4E00!important;stroke-width:1.2px!important;}#mermaid-svg-nPd4pyELgEBR2UeQ .process tspan{fill:#AD4E00!important;}#mermaid-svg-nPd4pyELgEBR2UeQ .check>*{fill:#F9F0FF!important;stroke:#722ED1!important;color:#531DAB!important;stroke-width:1.2px!important;}#mermaid-svg-nPd4pyELgEBR2UeQ .check span{fill:#F9F0FF!important;stroke:#722ED1!important;color:#531DAB!important;stroke-width:1.2px!important;}#mermaid-svg-nPd4pyELgEBR2UeQ .check tspan{fill:#531DAB!important;}#mermaid-svg-nPd4pyELgEBR2UeQ .output>*{fill:#E6FFFB!important;stroke:#13C2C2!important;color:#006D75!important;stroke-width:1.2px!important;}#mermaid-svg-nPd4pyELgEBR2UeQ .output span{fill:#E6FFFB!important;stroke:#13C2C2!important;color:#006D75!important;stroke-width:1.2px!important;}#mermaid-svg-nPd4pyELgEBR2UeQ .output tspan{fill:#006D75!important;} 结果阶段
处理阶段
输入阶段
模板文件
导出条件
字段校验
任务生成
结果记录
下载文件
失败明细

交给 Codex 生成时,边界要限定在 server_backend/dvadmin/system/models.py、server_backend/dvadmin/system/views/dept.py、server_vue3/src/views/system/SystemAdministration/dept/api.ts、server_vue3/src/views/system/SystemAdministration/dept/components/DeptTreeCom/index.vue、server_vue3/src/views/system/SystemAdministration/dept/index.vue 内。导入要校验字段和权限,导出任务要返回下载任务或文件结果。 同时需要补齐权限判断、异常提示、保存回显和测试用例。

可以直接使用下面的Prompt进行导入导出功能设计

text 复制代码
请 Codex 基于真实源码补齐"部门管理"的导入导出能力。

模块源码范围:server_backend/dvadmin/system/models.py、server_backend/dvadmin/system/views/dept.py、server_vue3/src/views/system/SystemAdministration/dept/api.ts、server_vue3/src/views/system/SystemAdministration/dept/components/DeptTreeCom/index.vue、server_vue3/src/views/system/SystemAdministration/dept/index.vue
接口范围:/api/system/dept/、/api/system/user/、/api/system/dept/all_dept/、/api/system/dept/move_up/、/api/system/dept/move_down/
字段范围:name(部门名称)、key(关联字符)、sort(显示排序)、owner(负责人)、phone(联系电话)、email(邮箱)、status(部门状态)、parent(上级部门)
功能用途:把模板导入、批量导出、Excel/CSV/Zip 或下载任务纳入模块流程。
落地边界:导入要校验字段和权限,导出任务要返回下载任务或文件结果。

要求只使用源码中已经存在的字段、接口和页面状态,不新增未确认的业务能力。输出接口设计、前端交互、权限约束、异常处理和验收清单。

Codex开发标准

使用 Codex 开发 部门管理 时,不能直接让它随意写代码。需求边界、PDD、SOP、接口权限规则和验收标准需要同时约束后端、前端和扩展能力,让生成结果能回到项目源码中运行。
#mermaid-svg-ixLGEZrnnLqNvqta{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;fill:#333;}@keyframes edge-animation-frame{from{stroke-dashoffset:0;}}@keyframes dash{to{stroke-dashoffset:0;}}#mermaid-svg-ixLGEZrnnLqNvqta .edge-animation-slow{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 50s linear infinite;stroke-linecap:round;}#mermaid-svg-ixLGEZrnnLqNvqta .edge-animation-fast{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 20s linear infinite;stroke-linecap:round;}#mermaid-svg-ixLGEZrnnLqNvqta .error-icon{fill:#552222;}#mermaid-svg-ixLGEZrnnLqNvqta .error-text{fill:#552222;stroke:#552222;}#mermaid-svg-ixLGEZrnnLqNvqta .edge-thickness-normal{stroke-width:1px;}#mermaid-svg-ixLGEZrnnLqNvqta .edge-thickness-thick{stroke-width:3.5px;}#mermaid-svg-ixLGEZrnnLqNvqta .edge-pattern-solid{stroke-dasharray:0;}#mermaid-svg-ixLGEZrnnLqNvqta .edge-thickness-invisible{stroke-width:0;fill:none;}#mermaid-svg-ixLGEZrnnLqNvqta .edge-pattern-dashed{stroke-dasharray:3;}#mermaid-svg-ixLGEZrnnLqNvqta .edge-pattern-dotted{stroke-dasharray:2;}#mermaid-svg-ixLGEZrnnLqNvqta .marker{fill:#333333;stroke:#333333;}#mermaid-svg-ixLGEZrnnLqNvqta .marker.cross{stroke:#333333;}#mermaid-svg-ixLGEZrnnLqNvqta svg{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;}#mermaid-svg-ixLGEZrnnLqNvqta p{margin:0;}#mermaid-svg-ixLGEZrnnLqNvqta .label{font-family:"trebuchet ms",verdana,arial,sans-serif;color:#333;}#mermaid-svg-ixLGEZrnnLqNvqta .cluster-label text{fill:#333;}#mermaid-svg-ixLGEZrnnLqNvqta .cluster-label span{color:#333;}#mermaid-svg-ixLGEZrnnLqNvqta .cluster-label span p{background-color:transparent;}#mermaid-svg-ixLGEZrnnLqNvqta .label text,#mermaid-svg-ixLGEZrnnLqNvqta span{fill:#333;color:#333;}#mermaid-svg-ixLGEZrnnLqNvqta .node rect,#mermaid-svg-ixLGEZrnnLqNvqta .node circle,#mermaid-svg-ixLGEZrnnLqNvqta .node ellipse,#mermaid-svg-ixLGEZrnnLqNvqta .node polygon,#mermaid-svg-ixLGEZrnnLqNvqta .node path{fill:#ECECFF;stroke:#9370DB;stroke-width:1px;}#mermaid-svg-ixLGEZrnnLqNvqta .rough-node .label text,#mermaid-svg-ixLGEZrnnLqNvqta .node .label text,#mermaid-svg-ixLGEZrnnLqNvqta .image-shape .label,#mermaid-svg-ixLGEZrnnLqNvqta .icon-shape .label{text-anchor:middle;}#mermaid-svg-ixLGEZrnnLqNvqta .node .katex path{fill:#000;stroke:#000;stroke-width:1px;}#mermaid-svg-ixLGEZrnnLqNvqta .rough-node .label,#mermaid-svg-ixLGEZrnnLqNvqta .node .label,#mermaid-svg-ixLGEZrnnLqNvqta .image-shape .label,#mermaid-svg-ixLGEZrnnLqNvqta .icon-shape .label{text-align:center;}#mermaid-svg-ixLGEZrnnLqNvqta .node.clickable{cursor:pointer;}#mermaid-svg-ixLGEZrnnLqNvqta .root .anchor path{fill:#333333!important;stroke-width:0;stroke:#333333;}#mermaid-svg-ixLGEZrnnLqNvqta .arrowheadPath{fill:#333333;}#mermaid-svg-ixLGEZrnnLqNvqta .edgePath .path{stroke:#333333;stroke-width:2.0px;}#mermaid-svg-ixLGEZrnnLqNvqta .flowchart-link{stroke:#333333;fill:none;}#mermaid-svg-ixLGEZrnnLqNvqta .edgeLabel{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-ixLGEZrnnLqNvqta .edgeLabel p{background-color:rgba(232,232,232, 0.8);}#mermaid-svg-ixLGEZrnnLqNvqta .edgeLabel rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-ixLGEZrnnLqNvqta .labelBkg{background-color:rgba(232, 232, 232, 0.5);}#mermaid-svg-ixLGEZrnnLqNvqta .cluster rect{fill:#ffffde;stroke:#aaaa33;stroke-width:1px;}#mermaid-svg-ixLGEZrnnLqNvqta .cluster text{fill:#333;}#mermaid-svg-ixLGEZrnnLqNvqta .cluster span{color:#333;}#mermaid-svg-ixLGEZrnnLqNvqta div.mermaidTooltip{position:absolute;text-align:center;max-width:200px;padding:2px;font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:12px;background:hsl(80, 100%, 96.2745098039%);border:1px solid #aaaa33;border-radius:2px;pointer-events:none;z-index:100;}#mermaid-svg-ixLGEZrnnLqNvqta .flowchartTitleText{text-anchor:middle;font-size:18px;fill:#333;}#mermaid-svg-ixLGEZrnnLqNvqta rect.text{fill:none;stroke-width:0;}#mermaid-svg-ixLGEZrnnLqNvqta .icon-shape,#mermaid-svg-ixLGEZrnnLqNvqta .image-shape{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-ixLGEZrnnLqNvqta .icon-shape p,#mermaid-svg-ixLGEZrnnLqNvqta .image-shape p{background-color:rgba(232,232,232, 0.8);padding:2px;}#mermaid-svg-ixLGEZrnnLqNvqta .icon-shape .label rect,#mermaid-svg-ixLGEZrnnLqNvqta .image-shape .label rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-ixLGEZrnnLqNvqta .label-icon{display:inline-block;height:1em;overflow:visible;vertical-align:-0.125em;}#mermaid-svg-ixLGEZrnnLqNvqta .node .label-icon path{fill:currentColor;stroke:revert;stroke-width:revert;}#mermaid-svg-ixLGEZrnnLqNvqta :root{--mermaid-font-family:"trebuchet ms",verdana,arial,sans-serif;}#mermaid-svg-ixLGEZrnnLqNvqta .input>*{fill:#EEF4FF!important;stroke:#5B8FF9!important;color:#1D39C4!important;stroke-width:1.2px!important;}#mermaid-svg-ixLGEZrnnLqNvqta .input span{fill:#EEF4FF!important;stroke:#5B8FF9!important;color:#1D39C4!important;stroke-width:1.2px!important;}#mermaid-svg-ixLGEZrnnLqNvqta .input tspan{fill:#1D39C4!important;}#mermaid-svg-ixLGEZrnnLqNvqta .design>*{fill:#F6FFED!important;stroke:#52C41A!important;color:#237804!important;stroke-width:1.2px!important;}#mermaid-svg-ixLGEZrnnLqNvqta .design span{fill:#F6FFED!important;stroke:#52C41A!important;color:#237804!important;stroke-width:1.2px!important;}#mermaid-svg-ixLGEZrnnLqNvqta .design tspan{fill:#237804!important;}#mermaid-svg-ixLGEZrnnLqNvqta .dev>*{fill:#FFF7E6!important;stroke:#FA8C16!important;color:#AD4E00!important;stroke-width:1.2px!important;}#mermaid-svg-ixLGEZrnnLqNvqta .dev span{fill:#FFF7E6!important;stroke:#FA8C16!important;color:#AD4E00!important;stroke-width:1.2px!important;}#mermaid-svg-ixLGEZrnnLqNvqta .dev tspan{fill:#AD4E00!important;}#mermaid-svg-ixLGEZrnnLqNvqta .check>*{fill:#F9F0FF!important;stroke:#722ED1!important;color:#531DAB!important;stroke-width:1.2px!important;}#mermaid-svg-ixLGEZrnnLqNvqta .check span{fill:#F9F0FF!important;stroke:#722ED1!important;color:#531DAB!important;stroke-width:1.2px!important;}#mermaid-svg-ixLGEZrnnLqNvqta .check tspan{fill:#531DAB!important;} 验收交付
Codex开发
模块设计
输入约束
需求边界
PDD设计
SOP目录
接口权限
后端设计
前端设计
扩展功能
读取上下文
生成后端
生成前端
补齐扩展
功能自检
PDD验收
问题修复
模块交付

SOP 标准

SOP 用于约束代码目录、文件职责和开发顺序。Codex 在动手写代码前,需要先确认目录结构和文档位置,再按后端、前端、联动、验收的顺序推进。

text 复制代码
docs/modules/部门管理/
├── pdd.md
├── api.md
├── test-cases.md
└── codex-sop.md
server_backend/
└── dvadmin/system/models.py
└── dvadmin/system/views/dept.py
server_vue3/
└── src/views/system/SystemAdministration/dept/api.ts
└── src/views/system/SystemAdministration/dept/components/DeptTreeCom/index.vue
└── src/views/system/SystemAdministration/dept/index.vue
开发阶段 Codex 执行目标 输出结果
模块设计 读取源码、确认字段、接口和页面入口 输出模块边界和设计说明
目录规划 规划后端、前端和 docs/modules 文档 输出目录结构和文件职责
后端实现 补齐模型、序列化、ViewSet、路由和权限 输出可调用接口和基础校验
前端实现 补齐 api.ts、crud.tsx、index.vue 或自定义组件 输出可操作页面和保存回显
数据联动或功能补齐 校验筛选、下拉、状态、详情和异常提示 输出联动说明和修复记录
扩展功能 按源码补齐 数据联动、导入导出 输出扩展接口、交互和边界测试
验收修复 按 PDD 和测试用例检查模块 输出验收结果和问题修复

可以直接使用下面的Prompt进行SOP撰写

text 复制代码
请 Codex 按教育管理系统模块开发 SOP,从零实现或补齐"部门管理"。

源码范围:server_backend/dvadmin/system/models.py、server_backend/dvadmin/system/views/dept.py、server_vue3/src/views/system/SystemAdministration/dept/api.ts、server_vue3/src/views/system/SystemAdministration/dept/components/DeptTreeCom/index.vue、server_vue3/src/views/system/SystemAdministration/dept/index.vue
接口范围:/api/system/dept/、/api/system/user/、/api/system/dept/all_dept/、/api/system/dept/move_up/、/api/system/dept/move_down/
字段范围:name(部门名称)、key(关联字符)、sort(显示排序)、owner(负责人)、phone(联系电话)、email(邮箱)、status(部门状态)、parent(上级部门)

执行要求:
1. 先输出目录结构,不要直接写代码。
2. 先生成 docs/modules/部门管理/pdd.md、api.md、test-cases.md 和 codex-sop.md。
3. 再根据文档生成后端代码、前端代码、接口封装、权限控制和测试用例。
4. 开发阶段需要包含 数据联动、导入导出,但只能写源码真实存在的能力。
5. 每个阶段输出涉及文件、修改目标和验收方式。

PDD 标准

PDD 是 部门管理 的设计与验收文档,用于约束 Codex 输出是否符合真实业务。验收不能只看页面能否打开,还要检查字段、接口、权限、异常、回显和扩展功能是否与源码一致。

验收维度 验收重点 通过标准
业务目标 维护后台权限、组织结构和用户可访问的功能边界 页面和接口围绕该目标闭环
页面结构 server_vue3/src/views/system/SystemAdministration/dept/api.ts、server_vue3/src/views/system/SystemAdministration/dept/components/DeptTreeCom/index.vue、server_vue3/src/views/system/SystemAdministration/dept/index.vue 列表、表单、详情或自定义操作区可用
数据模型 name(部门名称)、key(关联字符)、sort(显示排序)、owner(负责人)、phone(联系电话)、email(邮箱)、status(部门状态)、parent(上级部门) 字段保存、查询、回显和校验一致
接口规则 /api/system/dept/、/api/system/user/、/api/system/dept/all_dept/、/api/system/dept/move_up/、/api/system/dept/move_down/ GetList、GetObj、AddObj、UpdateObj、DelObj、lazyLoadDept、deptMoveUp、deptMoveDown、getDeptUserList、getAllDeptList、all_dept、move_up、move_down、dept_info 能被前端正确调用
权限控制 按角色、按钮和接口权限检查 越权访问有后端拦截和错误响应
测试用例 覆盖新增、编辑、删除、查询、异常和回显 测试记录包含输入、输出和修复位置
数据联动 把筛选条件、树节点、状态字段、远程下拉和表单回显组织成稳定数据流。 字段变化要同步查询参数、保存载荷和回显结构,避免页面临时状态与后端字段脱节。
导入导出 把模板导入、批量导出、Excel/CSV/Zip 或下载任务纳入模块流程。 导入要校验字段和权限,导出任务要返回下载任务或文件结果。

可以直接使用下面的Prompt进行PDD 验收

text 复制代码
请 Codex 根据 docs/modules/部门管理/pdd.md 对"部门管理"进行验收。

源码范围:server_backend/dvadmin/system/models.py、server_backend/dvadmin/system/views/dept.py、server_vue3/src/views/system/SystemAdministration/dept/api.ts、server_vue3/src/views/system/SystemAdministration/dept/components/DeptTreeCom/index.vue、server_vue3/src/views/system/SystemAdministration/dept/index.vue
接口范围:/api/system/dept/、/api/system/user/、/api/system/dept/all_dept/、/api/system/dept/move_up/、/api/system/dept/move_down/
字段范围:name(部门名称)、key(关联字符)、sort(显示排序)、owner(负责人)、phone(联系电话)、email(邮箱)、status(部门状态)、parent(上级部门)
验收范围必须包含 数据联动、导入导出。

请输出验收结果表,标记通过、未通过和需要修复的文件位置。不要只给结论,需要指出具体问题、影响范围和修复建议。

总结

部门管理的开发价值在于维护后台权限、组织结构和用户可访问的功能边界。它把核心字段、接口规则和页面状态连成业务闭环,避免模块停留在普通列表维护。

Codex 开发该模块时,PDD 定义业务边界和验收标准,SOP 约束目录结构和开发顺序,Prompt 把页面、模型、接口、权限和扩展功能 分阶段交给 Codex 实现。

相关推荐
Mr数据杨19 分钟前
【Codex】用附件管理模块统一维护系统文件资源
django·codex·项目开发
IT毕设实战小研1 小时前
基于安卓的空气质量查询系统
android·大数据·vue.js·爬虫·python·django·课程设计
Capricorn19881 小时前
个人知识库接入大模型频现“幻觉引用”?排查 RAG 溯源失效问题,解析知芽构建可信第三大脑的底层架构
大数据·论文阅读·人工智能·笔记·架构·论文笔记
商业看点解说1 小时前
2026 桌面 Agent 选型指南:QoderWork、AiPy 与工程 Agent 的架构博弈
其他·架构
做一个AK梦1 小时前
论秒杀场景及其技术解决方案
架构
ZGIAI1 小时前
ZGI Workflow:外部接口成功后,任务状态怎么落下来
人工智能·架构
ZGIAI1 小时前
ZGI Agent 发布:配置改了,线上为何还是旧版本
人工智能·架构
宸津-代码粉碎机2 小时前
AI工程化高阶实战|从Demo到生产落地核心架构、全套源码与避坑指南
java·大数据·开发语言·人工智能·python·架构
志栋智能2 小时前
超自动化运维:支持微服务架构的运维模式
运维·架构·自动化