cockpit-source/README.md
2026-04-02 14:12:43 +08:00

75 lines
1.8 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 数据驾驶舱Go+Gin+Gorm / Vite+Vue3+Tailwind / ECharts
本仓库包含两个子项目:
- `backend/`:后端 APIGo + Gin + Gorm
- `frontend/`:前端管理台 + 总览大屏Vite + Vue3 + Tailwind + ECharts
## 1. 运行前准备
### 必需软件
- Go建议 1.22+
- Node.js建议 20+
- MySQL示例 DSN 默认:`cockpit` 库)
### 初始化数据库(示例)
```sql
CREATE DATABASE cockpit DEFAULT CHARACTER SET utf8mb4;
```
## 2. 后端启动
1) 复制配置文件:
```bash
cp backend/configs/config.example.yaml backend/configs/config.yaml
```
2) 修改 `backend/configs/config.yaml``db.dsn`、`auth.accessTokenSecret`、`auth.refreshTokenSecret`
3) 安装依赖并启动:
```bash
cd backend
go mod tidy
go run ./cmd/server
```
后端默认监听:`http://localhost:8080`
### 默认账号
系统启动时会自动创建默认管理员:
- username: `admin`
- password: `admin123`
> 生产环境请务必修改密码或自行实现用户管理页面/接口。
## 3. 前端启动
```bash
cd frontend
npm install
npm run dev
```
前端默认:`http://localhost:5173`
如需配置后端地址,可在 `frontend/.env.local` 中指定:
```bash
VITE_API_BASE=http://localhost:8080
```
## 4. 功能清单(已实现)
- 登录JWT Access + Refresh Token自动刷新
- 权限RBAC后端中间件校验 + 前端按权限显示菜单)
- 字典维护:客户、状态 CRUD
- 订单 CRUD筛选 + 新增/编辑/删除(金额两口径)
- 导入中心:
- Excel 模板下载
- Excel 上传预览、确认入库
- JSON 批量入库
- 导入任务列表、错误明细
- 总览大屏:
- 年度 KPI年度下单/出货/未出货、平均客单价)
- 按月趋势(下单/出货)
- 客户 Top10按金额口径
- 状态分布(饼图)
- 客户下单次数与环比(表格)