init
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -9,3 +9,4 @@ docs/_book
|
||||
# TODO: where does this rule come from?
|
||||
test/
|
||||
|
||||
.idea/
|
||||
61
README.md
61
README.md
@@ -1,3 +1,62 @@
|
||||
# pig-farm-controller-fe
|
||||
|
||||
[pig-farm-controller](http://git.huangwc.com/pig/pig-farm-controller) 的前端界面
|
||||
[pig-farm-controller](http://git.huangwc.com/pig/pig-farm-controller) 的前端界面
|
||||
|
||||
## 项目介绍
|
||||
|
||||
这是一个用于猪场管理的前端系统,提供设备管理、状态监控等功能。该系统与后端服务 [pig-farm-controller](http://git.huangwc.com/pig/pig-farm-controller) 进行交互,为猪场管理人员提供直观的操作界面。
|
||||
|
||||
## 功能特性
|
||||
|
||||
- 设备管理(查看、添加、编辑、删除设备)
|
||||
- 实时监控设备状态
|
||||
- 友好的用户界面
|
||||
- 响应式设计,支持多种设备
|
||||
|
||||
## 技术栈
|
||||
|
||||
- Vue.js 3:前端框架
|
||||
- Element Plus:UI组件库
|
||||
- Vue Router:路由管理
|
||||
- Axios:HTTP客户端
|
||||
- Webpack:模块打包工具
|
||||
|
||||
## 安装与运行
|
||||
|
||||
### 环境要求
|
||||
|
||||
- Node.js >= 14.0.0
|
||||
- npm >= 6.0.0
|
||||
|
||||
### 安装依赖
|
||||
|
||||
```bash
|
||||
npm install
|
||||
```
|
||||
|
||||
### 开发环境运行
|
||||
|
||||
```bash
|
||||
npm run dev
|
||||
```
|
||||
|
||||
### 构建生产版本
|
||||
|
||||
```bash
|
||||
npm run build
|
||||
```
|
||||
|
||||
## 项目结构
|
||||
|
||||
```
|
||||
src/
|
||||
├── assets/ # 静态资源文件
|
||||
│ └── styles/ # 全局样式文件
|
||||
├── components/ # Vue组件
|
||||
├── App.vue # 根组件
|
||||
└── main.js # 入口文件
|
||||
```
|
||||
|
||||
## API接口
|
||||
|
||||
后端API文档请参考 [docs/swagger.json](docs/swagger.json)
|
||||
958
docs/swagger.json
Normal file
958
docs/swagger.json
Normal file
@@ -0,0 +1,958 @@
|
||||
{
|
||||
"schemes": [],
|
||||
"swagger": "2.0",
|
||||
"info": {
|
||||
"description": "",
|
||||
"title": "",
|
||||
"contact": {},
|
||||
"version": ""
|
||||
},
|
||||
"host": "",
|
||||
"basePath": "",
|
||||
"paths": {
|
||||
"/devices": {
|
||||
"get": {
|
||||
"description": "获取系统中所有设备的列表",
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"设备管理"
|
||||
],
|
||||
"summary": "获取设备列表",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "业务失败,具体错误码和信息见响应体",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/controller.Response"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"post": {
|
||||
"description": "根据提供的信息创建一个新设备",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"设备管理"
|
||||
],
|
||||
"summary": "创建新设备",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "设备信息",
|
||||
"name": "device",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/device.CreateDeviceRequest"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "业务失败,具体错误码和信息见响应体",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/controller.Response"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/devices/{id}": {
|
||||
"get": {
|
||||
"description": "根据设备ID获取单个设备的详细信息",
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"设备管理"
|
||||
],
|
||||
"summary": "获取设备信息",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "设备ID",
|
||||
"name": "id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "业务失败,具体错误码和信息见响应体",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/controller.Response"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"put": {
|
||||
"description": "根据设备ID更新一个已存在的设备信息",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"设备管理"
|
||||
],
|
||||
"summary": "更新设备信息",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "设备ID",
|
||||
"name": "id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"description": "要更新的设备信息",
|
||||
"name": "device",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/device.UpdateDeviceRequest"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "业务失败,具体错误码和信息见响应体",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/controller.Response"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"delete": {
|
||||
"description": "根据设备ID删除一个设备(软删除)",
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"设备管理"
|
||||
],
|
||||
"summary": "删除设备",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "设备ID",
|
||||
"name": "id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "业务失败,具体错误码和信息见响应体",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/controller.Response"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/plans": {
|
||||
"get": {
|
||||
"description": "获取所有计划的列表",
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"计划管理"
|
||||
],
|
||||
"summary": "获取计划列表",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "业务失败,具体错误码和信息见响应体(例如400, 500)",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/controller.Response"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"post": {
|
||||
"description": "创建一个新的计划,包括其基本信息和所有关联的子计划/任务。",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"计划管理"
|
||||
],
|
||||
"summary": "创建计划",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "计划信息",
|
||||
"name": "plan",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/plan.CreatePlanRequest"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "业务失败,具体错误码和信息见响应体(例如400, 500)",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/controller.Response"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/plans/{id}": {
|
||||
"get": {
|
||||
"description": "根据计划ID获取单个计划的详细信息。",
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"计划管理"
|
||||
],
|
||||
"summary": "获取计划详情",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "integer",
|
||||
"description": "计划ID",
|
||||
"name": "id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "业务失败,具体错误码和信息见响应体(例如400, 404, 500)",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/controller.Response"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"put": {
|
||||
"description": "根据计划ID更新计划的详细信息。",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"计划管理"
|
||||
],
|
||||
"summary": "更新计划",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "integer",
|
||||
"description": "计划ID",
|
||||
"name": "id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"description": "更新后的计划信息",
|
||||
"name": "plan",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/plan.UpdatePlanRequest"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "业务失败,具体错误码和信息见响应体(例如400, 404, 500)",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/controller.Response"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"delete": {
|
||||
"description": "根据计划ID删除计划。",
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"计划管理"
|
||||
],
|
||||
"summary": "删除计划",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "integer",
|
||||
"description": "计划ID",
|
||||
"name": "id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "业务失败,具体错误码和信息见响应体(例如400, 404, 500)",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/controller.Response"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/plans/{id}/start": {
|
||||
"post": {
|
||||
"description": "根据计划ID启动一个计划的执行。",
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"计划管理"
|
||||
],
|
||||
"summary": "启动计划",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "integer",
|
||||
"description": "计划ID",
|
||||
"name": "id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "业务失败,具体错误码和信息见响应体(例如400, 404, 500)",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/controller.Response"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/plans/{id}/stop": {
|
||||
"post": {
|
||||
"description": "根据计划ID停止一个正在执行的计划。",
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"计划管理"
|
||||
],
|
||||
"summary": "停止计划",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "integer",
|
||||
"description": "计划ID",
|
||||
"name": "id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "业务失败,具体错误码和信息见响应体(例如400, 404, 500)",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/controller.Response"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/users": {
|
||||
"post": {
|
||||
"description": "根据用户名和密码创建一个新的系统用户。",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"用户管理"
|
||||
],
|
||||
"summary": "创建新用户",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "用户信息",
|
||||
"name": "user",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/user.CreateUserRequest"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "业务失败,具体错误码和信息见响应体(例如400, 409, 500)",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/controller.Response"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/users/login": {
|
||||
"post": {
|
||||
"description": "用户使用用户名和密码登录,成功后返回 JWT 令牌。",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"用户管理"
|
||||
],
|
||||
"summary": "用户登录",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "登录凭证",
|
||||
"name": "credentials",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/user.LoginRequest"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "业务失败,具体错误码和信息见响应体(例如400, 401, 500)",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/controller.Response"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"definitions": {
|
||||
"controller.Properties": {
|
||||
"type": "object"
|
||||
},
|
||||
"controller.Response": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"code": {
|
||||
"description": "业务状态码",
|
||||
"type": "integer"
|
||||
},
|
||||
"data": {
|
||||
"description": "业务数据"
|
||||
},
|
||||
"message": {
|
||||
"description": "提示信息",
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"device.CreateDeviceRequest": {
|
||||
"type": "object"
|
||||
},
|
||||
"device.UpdateDeviceRequest": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"name",
|
||||
"type"
|
||||
],
|
||||
"properties": {
|
||||
"location": {
|
||||
"type": "string"
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"parent_id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"properties": {
|
||||
"$ref": "#/definitions/controller.Properties"
|
||||
},
|
||||
"sub_type": {
|
||||
"$ref": "#/definitions/models.DeviceSubType"
|
||||
},
|
||||
"type": {
|
||||
"$ref": "#/definitions/models.DeviceType"
|
||||
}
|
||||
}
|
||||
},
|
||||
"git_huangwc_com_pig_pig-farm-controller_internal_app_controller_device.DeviceResponse": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"created_at": {
|
||||
"type": "string"
|
||||
},
|
||||
"id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"location": {
|
||||
"type": "string"
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"parent_id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"properties": {
|
||||
"$ref": "#/definitions/controller.Properties"
|
||||
},
|
||||
"sub_type": {
|
||||
"$ref": "#/definitions/models.DeviceSubType"
|
||||
},
|
||||
"type": {
|
||||
"$ref": "#/definitions/models.DeviceType"
|
||||
},
|
||||
"updated_at": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"models.DeviceSubType": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"",
|
||||
"temperature",
|
||||
"humidity",
|
||||
"ammonia",
|
||||
"feed_valve",
|
||||
"fan",
|
||||
"water_curtain"
|
||||
],
|
||||
"x-enum-varnames": [
|
||||
"SubTypeNone",
|
||||
"SubTypeSensorTemp",
|
||||
"SubTypeSensorHumidity",
|
||||
"SubTypeSensorAmmonia",
|
||||
"SubTypeValveFeed",
|
||||
"SubTypeFan",
|
||||
"SubTypeWaterCurtain"
|
||||
]
|
||||
},
|
||||
"models.DeviceType": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"area_controller",
|
||||
"device"
|
||||
],
|
||||
"x-enum-varnames": [
|
||||
"DeviceTypeAreaController",
|
||||
"DeviceTypeDevice"
|
||||
]
|
||||
},
|
||||
"models.PlanContentType": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"sub_plans",
|
||||
"tasks"
|
||||
],
|
||||
"x-enum-comments": {
|
||||
"PlanContentTypeSubPlans": "计划包含子计划",
|
||||
"PlanContentTypeTasks": "计划包含任务"
|
||||
},
|
||||
"x-enum-descriptions": [
|
||||
"计划包含子计划",
|
||||
"计划包含任务"
|
||||
],
|
||||
"x-enum-varnames": [
|
||||
"PlanContentTypeSubPlans",
|
||||
"PlanContentTypeTasks"
|
||||
]
|
||||
},
|
||||
"models.PlanExecutionType": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"automatic",
|
||||
"manual"
|
||||
],
|
||||
"x-enum-comments": {
|
||||
"PlanExecutionTypeAutomatic": "自动执行 (包含定时和循环)",
|
||||
"PlanExecutionTypeManual": "手动执行"
|
||||
},
|
||||
"x-enum-descriptions": [
|
||||
"自动执行 (包含定时和循环)",
|
||||
"手动执行"
|
||||
],
|
||||
"x-enum-varnames": [
|
||||
"PlanExecutionTypeAutomatic",
|
||||
"PlanExecutionTypeManual"
|
||||
]
|
||||
},
|
||||
"models.PlanStatus": {
|
||||
"type": "integer",
|
||||
"format": "int32",
|
||||
"enum": [
|
||||
0,
|
||||
1,
|
||||
2
|
||||
],
|
||||
"x-enum-comments": {
|
||||
"PlanStatusDisabled": "禁用计划",
|
||||
"PlanStatusEnabled": "启用计划",
|
||||
"PlanStatusStopeed": "执行完毕"
|
||||
},
|
||||
"x-enum-descriptions": [
|
||||
"启用计划",
|
||||
"禁用计划",
|
||||
"执行完毕"
|
||||
],
|
||||
"x-enum-varnames": [
|
||||
"PlanStatusEnabled",
|
||||
"PlanStatusDisabled",
|
||||
"PlanStatusStopeed"
|
||||
]
|
||||
},
|
||||
"models.TaskType": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"plan_analysis",
|
||||
"waiting"
|
||||
],
|
||||
"x-enum-comments": {
|
||||
"TaskPlanAnalysis": "解析Plan的Task列表并添加到待执行队列的特殊任务",
|
||||
"TaskTypeWaiting": "等待任务"
|
||||
},
|
||||
"x-enum-descriptions": [
|
||||
"解析Plan的Task列表并添加到待执行队列的特殊任务",
|
||||
"等待任务"
|
||||
],
|
||||
"x-enum-varnames": [
|
||||
"TaskPlanAnalysis",
|
||||
"TaskTypeWaiting"
|
||||
]
|
||||
},
|
||||
"plan.CreatePlanRequest": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"content_type",
|
||||
"execution_type",
|
||||
"name"
|
||||
],
|
||||
"properties": {
|
||||
"content_type": {
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/models.PlanContentType"
|
||||
}
|
||||
],
|
||||
"example": "tasks"
|
||||
},
|
||||
"cron_expression": {
|
||||
"type": "string",
|
||||
"example": "0 0 6 * * *"
|
||||
},
|
||||
"description": {
|
||||
"type": "string",
|
||||
"example": "根据温度自动调节风扇和加热器"
|
||||
},
|
||||
"execution_type": {
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/models.PlanExecutionType"
|
||||
}
|
||||
],
|
||||
"example": "automatic"
|
||||
},
|
||||
"name": {
|
||||
"type": "string",
|
||||
"example": "猪舍温度控制计划"
|
||||
},
|
||||
"sub_plan_ids": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "integer"
|
||||
}
|
||||
},
|
||||
"tasks": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/plan.TaskRequest"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"plan.ListPlansResponse": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"plans": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/plan.PlanResponse"
|
||||
}
|
||||
},
|
||||
"total": {
|
||||
"type": "integer",
|
||||
"example": 100
|
||||
}
|
||||
}
|
||||
},
|
||||
"plan.PlanResponse": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"content_type": {
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/models.PlanContentType"
|
||||
}
|
||||
],
|
||||
"example": "tasks"
|
||||
},
|
||||
"cron_expression": {
|
||||
"type": "string",
|
||||
"example": "0 0 6 * * *"
|
||||
},
|
||||
"description": {
|
||||
"type": "string",
|
||||
"example": "根据温度自动调节风扇和加热器"
|
||||
},
|
||||
"execute_count": {
|
||||
"type": "integer",
|
||||
"example": 0
|
||||
},
|
||||
"execute_num": {
|
||||
"type": "integer",
|
||||
"example": 10
|
||||
},
|
||||
"execution_type": {
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/models.PlanExecutionType"
|
||||
}
|
||||
],
|
||||
"example": "automatic"
|
||||
},
|
||||
"id": {
|
||||
"type": "integer",
|
||||
"example": 1
|
||||
},
|
||||
"name": {
|
||||
"type": "string",
|
||||
"example": "猪舍温度控制计划"
|
||||
},
|
||||
"status": {
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/models.PlanStatus"
|
||||
}
|
||||
],
|
||||
"example": 0
|
||||
},
|
||||
"sub_plans": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/plan.SubPlanResponse"
|
||||
}
|
||||
},
|
||||
"tasks": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/plan.TaskResponse"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"plan.SubPlanResponse": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"child_plan": {
|
||||
"$ref": "#/definitions/plan.PlanResponse"
|
||||
},
|
||||
"child_plan_id": {
|
||||
"type": "integer",
|
||||
"example": 2
|
||||
},
|
||||
"execution_order": {
|
||||
"type": "integer",
|
||||
"example": 1
|
||||
},
|
||||
"id": {
|
||||
"type": "integer",
|
||||
"example": 1
|
||||
},
|
||||
"parent_plan_id": {
|
||||
"type": "integer",
|
||||
"example": 1
|
||||
}
|
||||
}
|
||||
},
|
||||
"plan.TaskRequest": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"description": {
|
||||
"type": "string",
|
||||
"example": "打开1号风扇"
|
||||
},
|
||||
"execution_order": {
|
||||
"type": "integer",
|
||||
"example": 1
|
||||
},
|
||||
"name": {
|
||||
"type": "string",
|
||||
"example": "打开风扇"
|
||||
},
|
||||
"parameters": {
|
||||
"$ref": "#/definitions/controller.Properties"
|
||||
},
|
||||
"type": {
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/models.TaskType"
|
||||
}
|
||||
],
|
||||
"example": "waiting"
|
||||
}
|
||||
}
|
||||
},
|
||||
"plan.TaskResponse": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"description": {
|
||||
"type": "string",
|
||||
"example": "打开1号风扇"
|
||||
},
|
||||
"execution_order": {
|
||||
"type": "integer",
|
||||
"example": 1
|
||||
},
|
||||
"id": {
|
||||
"type": "integer",
|
||||
"example": 1
|
||||
},
|
||||
"name": {
|
||||
"type": "string",
|
||||
"example": "打开风扇"
|
||||
},
|
||||
"parameters": {
|
||||
"$ref": "#/definitions/controller.Properties"
|
||||
},
|
||||
"plan_id": {
|
||||
"type": "integer",
|
||||
"example": 1
|
||||
},
|
||||
"type": {
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/models.TaskType"
|
||||
}
|
||||
],
|
||||
"example": "waiting"
|
||||
}
|
||||
}
|
||||
},
|
||||
"plan.UpdatePlanRequest": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"content_type": {
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/models.PlanContentType"
|
||||
}
|
||||
],
|
||||
"example": "tasks"
|
||||
},
|
||||
"cron_expression": {
|
||||
"type": "string",
|
||||
"example": "0 0 6 * * *"
|
||||
},
|
||||
"description": {
|
||||
"type": "string",
|
||||
"example": "更新后的描述"
|
||||
},
|
||||
"execution_type": {
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/models.PlanExecutionType"
|
||||
}
|
||||
],
|
||||
"example": "automatic"
|
||||
},
|
||||
"name": {
|
||||
"type": "string",
|
||||
"example": "猪舍温度控制计划V2"
|
||||
},
|
||||
"sub_plan_ids": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "integer"
|
||||
}
|
||||
},
|
||||
"tasks": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/plan.TaskRequest"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"user.CreateUserRequest": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"password",
|
||||
"username"
|
||||
],
|
||||
"properties": {
|
||||
"password": {
|
||||
"type": "string",
|
||||
"minLength": 6,
|
||||
"example": "password123"
|
||||
},
|
||||
"username": {
|
||||
"type": "string",
|
||||
"example": "newuser"
|
||||
}
|
||||
}
|
||||
},
|
||||
"user.CreateUserResponse": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "integer",
|
||||
"example": 1
|
||||
},
|
||||
"username": {
|
||||
"type": "string",
|
||||
"example": "newuser"
|
||||
}
|
||||
}
|
||||
},
|
||||
"user.LoginRequest": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"password",
|
||||
"username"
|
||||
],
|
||||
"properties": {
|
||||
"password": {
|
||||
"type": "string",
|
||||
"example": "password123"
|
||||
},
|
||||
"username": {
|
||||
"type": "string",
|
||||
"example": "testuser"
|
||||
}
|
||||
}
|
||||
},
|
||||
"user.LoginResponse": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "integer",
|
||||
"example": 1
|
||||
},
|
||||
"token": {
|
||||
"type": "string",
|
||||
"example": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
|
||||
},
|
||||
"username": {
|
||||
"type": "string",
|
||||
"example": "testuser"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user