20260820223837

This commit is contained in:
oneao committed 2026-08-20 22:38:37 +08:00
1 parent 68ac5db038
commit 45854b0570
48 files changed
+7545 -650

No files matched your search

+20 -28
View File
@@ -1,8 +1,8 @@
# AI Context — FMS 新系统元数据配置 Demo
# AI Context — FMS 新系统配置中心 Demo
## 项目目标
这是一个 **FMS 新系统元数据配置演示**,用 React 实现,用于直观展示如何配置模块体系,对应《FMS新系统核心表结构设计.md》中的 17 张核心表。
这是一个 **FMS 新系统配置中心演示**,用 React 实现,用于直观展示如何配置业务域、实体、菜单与权限,对应《FMS新系统核心表结构设计.md》中的核心元数据结构。
命名风格参考旧系统:表名 `s_` 前缀、字段 `b_` 前缀 + 驼峰(如 `b_viewtable`、`b_inputdatetime`)。
@@ -19,36 +19,27 @@
```
src/
├── types/index.ts # 元数据模型(对应 17 张表)+ 工具函数
├── data/mock.ts # 演示数据:海运订舱 ocean 模块全链路示例
├── components/
│ ├── ui.tsx # 共享 UI 小组件(Card/Badge/Field/Input/Toggle/表格)
│ ├── ModulePanel.tsx # Tab1 模块:s_module 树 + 基本信息 + s_module_dependency DAG
│ ├── EntityPanel.tsx # Tab2 实体与字段:s_entity + s_field_group + s_field 合并单表
│ ├── MenuPanel.tsx # Tab3 菜单页面:s_menu 导航树(挂模块 + 引用实体)
│ ├── AutoCodePanel.tsx # Tab4 编码与多语言:s_autocode + s_i18n
│ └── PermissionPanel.tsx # Tab5 权限:s_role + s_user_role + s_power + s_role_power
├── App.tsx # 主布局 + Tab + 全局状态 + 统计
├── main.tsx # 入口
└── index.css # Tailwind 入口
└── src/
├── App.tsx # 单页配置中心:总览 / 业务域与实体 / 菜单与权限 / 角色与用户
├── index.css # 整体样式
└── main.tsx # 入口
```
## 设计理念
1. **四 Tab 对应四组表**:模块(模块+依赖)、实体与字段(实体+分组+字段)、菜单页面、编码与多语言
2. **所有数据为前端内存状态**:`App.tsx` 统一持有 state,面板组件通过 onChange 回调修改,演示"配置后立即生效"
3. **字段配置合并单表**:旧系统 4 张配置表(field/edit/list/query)合并为 `s_field` 单表,行内展开编辑
4. **模块树 vs 菜单树分离**:`s_module.b_parent_id` 只做业务分组,`s_menu.b_parent_id` 才是导航层级
5. **开关直接可拨**:必填/列表显示/可查询/启用等布尔字段用 Toggle 拨动
1. **四个工作区**:总览、业务域与实体、菜单与权限、角色与用户
2. **业务域只管归属**:`s_module` 仅表示业务分组,不承载菜单和权限
3. **实体维护数据边界**:`s_entity` 负责数据源、保存表、主键,字段属于实体
4. **菜单承载访问入口**:`s_menu` 直接绑定实体或固定页面,动作权限跟着菜单生成
5. **权限跟随菜单**:角色只做授权主体,权限点来源于菜单动作
## 覆盖的表
| Tab | 表 |
| 工作区 | 表 |
| --- | --- |
| 模块 | `s_module`、`s_module_dependency` |
| 实体与字段 | `s_entity`、`s_field_group`、`s_field` |
| 菜单页面 | `s_menu` |
| 编码与多语言 | `s_autocode`、`s_i18n` |
| 业务域 | `s_module` |
| 实体与字段 | `s_entity`、`s_field_group`、`s_field`、`s_field_list`、`s_field_edit`、`s_field_query` |
| 菜单与页面 | `s_menu` |
| 权限 | `s_role`、`s_user_role`、`s_power`、`s_role_power` |
## 启动
@@ -60,7 +51,8 @@ pnpm dev # http://localhost:3000
## 注意事项
- 演示数据在 `src/data/mock.ts`,`resetAll` 会重置所有 state 到初始值
- 菜单 `s_menu` 通过 `b_module_id` 挂模块(组织维度)、`b_entity_id` 引用实体,两者可独立演进
- 权限演示:角色(左)→ 角色-权限授权矩阵(授权/拒绝/未授权三态)→ 角色-用户 → 权限点字典,覆盖 `s_role`/`s_user_role`/`s_power`/`s_role_power` 四表
- 新表结构中的日志表(`s_log_technical`/`s_log_login`/`s_log_audit`/`s_log_audit_field`)未在 Demo 中展示,如需可扩展 Tab
- 这版 Demo 按维护关联度合并页面:业务域、实体和实体关系在同一棵配置树及详情工作区维护,菜单和权限一起维护
- 业务模型树同时展示 `s_module` 和 `s_entity`:业务域节点表达归属,实体节点表达数据对象;只有 `owned` 主从实体继续嵌套,`reference` 引用不改变树位置
- 权限是跟着菜单走的:一个数据菜单或页面菜单会生成一组动作权限,再由角色去勾选
- `s_relation` 在实体详情中维护关系类型、来源字段、目标字段、所有权和删除策略
- `src/index.css` 里有完整布局样式;如果要继续精修,可以在这份文件上直接改
+25 -27
View File
@@ -1,32 +1,30 @@
# React + TypeScript + Vite
# FMS 配置中心 Demo
This template provides a minimal setup to get React working in Vite with HMR and some Oxlint rules.
这是一个用于验证 FMS 新系统元数据维护方式的前端演示。业务域和实体在同一棵配置树中展示:业务域表达归属,实体表达数据边界,实体的主从关系可以继续嵌套,普通引用关系在实体详情中配置。
Currently, two official plugins are available:
## 启动
- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react) uses [Oxc](https://oxc.rs)
- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react-swc) uses [SWC](https://swc.rs/)
## React Compiler
The React Compiler is not enabled on this template because of its impact on dev & build performances. To add it, see [this documentation](https://react.dev/learn/react-compiler/installation).
## Expanding the Oxlint configuration
If you are developing a production application, we recommend enabling type-aware lint rules by installing `oxlint-tsgolint` and editing `.oxlintrc.json`:
```json
{
"$schema": "./node_modules/oxlint/configuration_schema.json",
"plugins": ["react", "typescript", "oxc"],
"options": {
"typeAware": true
},
"rules": {
"react/rules-of-hooks": "error",
"react/only-export-components": ["warn", { "allowConstantExport": true }]
}
}
```bash
pnpm install
pnpm dev
```
See the [Oxlint rules documentation](https://oxc.rs/docs/guide/usage/linter/rules) for the full list of rules and categories.
浏览器访问 `http://localhost:3000/`。
## 使用流程
1. 在“业务域与实体”中选择或创建业务域,并直接维护该域下的实体、数据源、主键和字段。
2. 在“菜单与权限”中维护菜单树。选中菜单后,通过页签同时维护页面绑定、动作权限、角色授权和数据范围。
3. 在“角色与用户”中维护角色本身及其成员,具体菜单授权仍在菜单工作区完成。
4. 顶部“保存”用于模拟保存配置;菜单权限工作区的“发布”用于模拟发布。
## 对应核心表
| 工作区 | 主要表 |
| --- | --- |
| 业务模型树 | `s_module`、`s_entity`、`s_relation` |
| 实体与字段 | `s_entity`、`s_field_group`、`s_field`、`s_field_list`、`s_field_edit`、`s_field_query` |
| 菜单与页面 | `s_menu` |
| 权限 | `s_role`、`s_user_role`、`s_power`、`s_role_power` |
Demo 当前使用内存状态模拟维护,不连接后端接口;刷新页面会恢复示例数据。
+1891 -214
View File
File diff suppressed because it is too large. Load diff
+1464 -140
View File
File diff suppressed because it is too large. Load diff