Files

80 lines
1.9 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.
# 车辆管理系统 (Vehicle Management System)
一个基于 Python Flask 的轻量级车辆管理系统,提供车辆的增删改查、搜索和统计功能。
## 功能特性
- ✅ 车辆列表展示
- ✅ 添加新车辆
- ✅ 编辑车辆信息
- ✅ 删除车辆
- ✅ 按车牌/品牌/型号搜索
- ✅ 车辆统计(总数、按状态统计)
- ✅ 数据持久化(SQLite)
## 技术栈
- 后端:Python 3.8+ / Flask
- 数据库:SQLite
- 前端:HTML / CSS / JavaScript
## 目录结构
```
vehicle-management-system/
├── app.py # Flask 应用入口
├── models.py # 数据模型
├── requirements.txt # 依赖列表
├── README.md # 项目说明
├── static/
│ ├── style.css # 样式文件
│ └── script.js # 前端脚本
└── templates/
├── index.html # 首页(车辆列表)
└── edit.html # 编辑页面
```
## 快速开始
### 1. 安装依赖
```bash
pip install -r requirements.txt
```
### 2. 启动应用
```bash
python app.py
```
### 3. 访问
打开浏览器访问:http://127.0.0.1:5000
## API 接口
| 方法 | 路径 | 说明 |
|--------|-----------------------|--------------------|
| GET | / | 首页(车辆列表) |
| GET | /api/vehicles | 获取所有车辆 |
| POST | /api/vehicles | 添加车辆 |
| GET | /api/vehicles/<id> | 获取单个车辆 |
| PUT | /api/vehicles/<id> | 更新车辆 |
| DELETE | /api/vehicles/<id> | 删除车辆 |
| GET | /api/stats | 获取统计数据 |
## 车辆字段
- `plate`:车牌号(唯一)
- `brand`:品牌
- `model`:型号
- `year`:年份
- `color`:颜色
- `status`:状态(available / in_use / maintenance)
- `owner`:车主
## License
MIT