init: 管理会计OS初始代码
包含前后端完整代码: - 前端:Vue3+Vite+ElementPlus - 后端:FastAPI+SQLAlchemy - 模块:驾驶舱/KPI/战略地图/预警/预算/成本/预测/改善行动 - 当前版本:v1.0.0
This commit is contained in:
@@ -0,0 +1,117 @@
|
||||
# 管理会计OS
|
||||
|
||||
管理会计操作系统,基于 FastAPI + MariaDB + Vue 3 + Element Plus。
|
||||
|
||||
## 快速开始
|
||||
|
||||
### 开发环境
|
||||
|
||||
```bash
|
||||
# 一键启动(前后端同时)
|
||||
./start-dev.sh
|
||||
|
||||
# 或分步启动:
|
||||
# 后端
|
||||
cd backend && ./dev.sh
|
||||
|
||||
# 前端(新终端)
|
||||
cd frontend && ./dev.sh
|
||||
```
|
||||
|
||||
### 生产部署
|
||||
|
||||
```bash
|
||||
# 一键构建+部署
|
||||
./deploy.sh
|
||||
```
|
||||
|
||||
### 访问地址
|
||||
|
||||
| 环境 | 地址 |
|
||||
|------|------|
|
||||
| 开发前端 | http://localhost:5173 |
|
||||
| 开发后端API | http://127.0.0.1:8010 |
|
||||
| 开发API文档 | http://127.0.0.1:8010/docs |
|
||||
| 生产环境 | https://cma.sxbh.ltd |
|
||||
|
||||
## 项目结构
|
||||
|
||||
```
|
||||
cma-management/
|
||||
├── start-dev.sh # 一键启动开发环境
|
||||
├── deploy.sh # 一键部署生产
|
||||
├── .gitignore
|
||||
│
|
||||
├── backend/
|
||||
│ ├── .env / .env.example
|
||||
│ ├── dev.sh # 后端开发启动
|
||||
│ ├── deploy.sh # 后端部署
|
||||
│ ├── requirements.txt
|
||||
│ ├── app/
|
||||
│ │ ├── main.py # 入口 + 全局异常处理
|
||||
│ │ ├── database.py # 数据库连接池
|
||||
│ │ ├── models/ # SQLAlchemy 模型
|
||||
│ │ ├── api/ # 路由
|
||||
│ │ │ ├── auth.py
|
||||
│ │ │ ├── kpis.py
|
||||
│ │ │ ├── maps.py
|
||||
│ │ │ ├── dashboard.py
|
||||
│ │ │ ├── alerts.py
|
||||
│ │ │ ├── data.py
|
||||
│ │ │ ├── users.py
|
||||
│ │ │ ├── ai_analysis.py
|
||||
│ │ │ └── alert_rules.py
|
||||
│ │ └── utils/
|
||||
│ └── tests/
|
||||
│
|
||||
├── frontend/
|
||||
│ ├── .env / .env.example
|
||||
│ ├── dev.sh # 前端开发启动
|
||||
│ ├── deploy.sh # 前端构建部署
|
||||
│ ├── .prettierrc
|
||||
│ ├── vite.config.ts
|
||||
│ ├── index.html
|
||||
│ └── src/
|
||||
│ ├── main.ts
|
||||
│ ├── App.vue
|
||||
│ ├── router/index.ts
|
||||
│ ├── layouts/MainLayout.vue
|
||||
│ ├── views/
|
||||
│ │ ├── Login.vue
|
||||
│ │ ├── Dashboard.vue
|
||||
│ │ ├── KPIList.vue
|
||||
│ │ ├── KPIDetail.vue
|
||||
│ │ ├── MapList.vue
|
||||
│ │ ├── MapCanvas.vue
|
||||
│ │ ├── AlertList.vue
|
||||
│ │ ├── DataManage.vue
|
||||
│ │ └── UserManage.vue
|
||||
│ └── api/index.ts
|
||||
│
|
||||
└── deploy/ # 部署配置
|
||||
```
|
||||
|
||||
## 系统架构
|
||||
|
||||
```
|
||||
用户 → https://cma.sxbh.ltd → Nginx (Brotli+缓存)
|
||||
├── / → 前端 SPA (Vue 3)
|
||||
└── /api/cma/ → FastAPI:8010 → MariaDB
|
||||
```
|
||||
|
||||
## 运维命令
|
||||
|
||||
```bash
|
||||
# 后端
|
||||
systemctl status cma-backend # 查看状态
|
||||
journalctl -u cma-backend -f # 查看日志
|
||||
systemctl restart cma-backend # 重启
|
||||
|
||||
# Nginx
|
||||
nginx -t # 检查配置
|
||||
nginx -s reload # 重载配置
|
||||
|
||||
# 前端
|
||||
cd frontend && pnpm dev # 开发
|
||||
cd frontend && pnpm build # 构建
|
||||
```
|
||||
Reference in New Issue
Block a user