feat:完善项目
This commit is contained in:
@ -50,3 +50,56 @@ func (*Config) Area(c *gin.Context) {
|
||||
data := config.NewInstance()(getSession()(c).(*service.Session)).Area(form.Key)
|
||||
APIResponse(nil, data)(c)
|
||||
}
|
||||
|
||||
/**
|
||||
* @api {post} /api/v1/config/breakdown 故障信息
|
||||
* @apiVersion 1.0.0
|
||||
* @apiName ConfigBreakdown
|
||||
* @apiGroup Config
|
||||
*
|
||||
* @apiHeader {string} x-token token
|
||||
* @apiHeader {string} Content-Type=application/json 传输方式
|
||||
*
|
||||
* @apiParam {String} [title="''"] 标题名称
|
||||
* @apiParam {Number} current 当前页
|
||||
* @apiParam {Number} page_size 页展示数
|
||||
*
|
||||
* @apiSuccess (200) {Number} code 成功响应状态码!
|
||||
* @apiSuccess (200) {String} msg 成功提示
|
||||
* @apiSuccess (200) {Array} data 数据信息
|
||||
* @apiSuccess (200) {String} data.id ID
|
||||
* @apiSuccess (200) {String} data.title 标题名称
|
||||
* @apiSuccess (200) {String} data.remark 备注信息
|
||||
* @apiSuccess (200) {Time} data.created_at 创建时间
|
||||
*
|
||||
* @apiSuccessExample {json} Success response:
|
||||
* HTTPS 200 OK
|
||||
* {
|
||||
* "code": 200
|
||||
* "msg": "ok"
|
||||
* "data": [
|
||||
* {
|
||||
* "id": "m9Qa2ZaOvE",
|
||||
* "title": "刹车盘",
|
||||
* "remark": "",
|
||||
* "created_at": "2021-11-05T14:24:07+08:00",
|
||||
* }
|
||||
* ]
|
||||
* }
|
||||
*/
|
||||
func (*Config) Breakdown(c *gin.Context) {
|
||||
form := &struct {
|
||||
Title string `json:"title" form:"title"`
|
||||
PageForm
|
||||
}{}
|
||||
if err := bind(form)(c); err != nil {
|
||||
APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
data, err := config.NewBreakdown()(getSession()(c).(*service.Session)).List(form.Title, form.Page, form.PageSize)
|
||||
APIResponse(err, data)(c)
|
||||
}
|
||||
|
||||
func (*Config) BreakdownAdd() {
|
||||
|
||||
}
|
||||
|
||||
@ -19,6 +19,40 @@ type roleForm struct {
|
||||
* @apiDefine Role 角色管理
|
||||
*/
|
||||
|
||||
/**
|
||||
* @api {get} /api/v1/role/list 角色列表
|
||||
* @apiVersion 1.0.0
|
||||
* @apiName RoleList
|
||||
* @apiGroup Role
|
||||
*
|
||||
* @apiHeader {string} x-token token
|
||||
*
|
||||
* @apiSuccess (200) {Number} code 成功响应状态码!
|
||||
* @apiSuccess (200) {String} msg 成功提示
|
||||
* @apiSuccess (200) {Array} data 具体信息
|
||||
* @apiSuccess (200) {String} data.id 角色ID
|
||||
* @apiSuccess (200) {String} data.name 角色名称
|
||||
* @apiSuccess (200) {Array} data.children="[]" 子集
|
||||
*
|
||||
* @apiSuccessExample {json} Success response:
|
||||
* HTTPS 200 OK
|
||||
* {
|
||||
* "code": 200
|
||||
* "msg": "ok"
|
||||
* "data": [
|
||||
* {
|
||||
* "id": "EgmJ4Ga7LQ",
|
||||
* "name": "分管领导",
|
||||
* "children": [
|
||||
* {
|
||||
* "id": "7K1Jx6VYod",
|
||||
* "name": "区域支队",
|
||||
* }
|
||||
* ]
|
||||
* }
|
||||
* ]
|
||||
* }
|
||||
*/
|
||||
func (*Role) List(c *gin.Context) {
|
||||
data, err := role.NewInstance()(getSession()(c).(*service.Session)).List()
|
||||
APIResponse(err, data)(c)
|
||||
@ -74,7 +108,7 @@ func (a *Role) Delete(c *gin.Context) {
|
||||
* @apiSuccess (200) {Number} code 成功响应状态码!
|
||||
* @apiSuccess (200) {String} msg 成功提示
|
||||
* @apiSuccess (200) {Array} data 具体信息
|
||||
* @apiSuccess (200) {Number} data.id 菜单ID
|
||||
* @apiSuccess (200) {String} data.id 菜单ID
|
||||
* @apiSuccess (200) {Number} data.parent_id 父级ID
|
||||
* @apiSuccess (200) {String} data.name 菜单名称
|
||||
* @apiSuccess (200) {Number} data.kind 类型(1:目录,2:菜单)
|
||||
@ -129,7 +163,7 @@ func (a *Role) Menu(c *gin.Context) {
|
||||
* @apiHeader {string} x-token token
|
||||
*
|
||||
* @apiParam {Number} role_id 角色ID
|
||||
* @apiParam {Array.Number} menu_ids 菜单ID
|
||||
* @apiParam {Array.String} menu_ids 菜单ID
|
||||
*
|
||||
* @apiSuccess (200) {Number} code=200 成功响应状态码!
|
||||
* @apiSuccess (200) {String} msg="ok" 成功提示
|
||||
@ -145,12 +179,20 @@ func (a *Role) Menu(c *gin.Context) {
|
||||
func (a *Role) MenuBind(c *gin.Context) {
|
||||
form := &struct {
|
||||
RoleID uint64 `json:"role_id" form:"role_id" binding:"required"`
|
||||
MenuIDs []uint64 `json:"menu_ids" form:"menu_ids" binding:"required"`
|
||||
MenuIDs []string `json:"menu_ids" form:"menu_ids" binding:"required"`
|
||||
}{}
|
||||
if err := bind(form)(c); err != nil {
|
||||
APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
err := role.NewMenu()(getSession()(c).(*service.Session)).Bind(form.RoleID, form.MenuIDs)
|
||||
menuIDs := make([]uint64, 0)
|
||||
|
||||
handle := new(IDStringForm)
|
||||
|
||||
for _, v := range form.MenuIDs {
|
||||
handle.ID = v
|
||||
menuIDs = append(menuIDs, handle.Convert())
|
||||
}
|
||||
err := role.NewMenu()(getSession()(c).(*service.Session)).Bind(form.RoleID, menuIDs)
|
||||
APIResponse(err)(c)
|
||||
}
|
||||
|
||||
@ -1,7 +1,80 @@
|
||||
package api
|
||||
|
||||
type Work struct{}
|
||||
import (
|
||||
"ArmedPolice/app/controller/work"
|
||||
"ArmedPolice/app/service"
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
/**
|
||||
* @apiDefine Work 工单管理
|
||||
*/
|
||||
|
||||
type Work struct{}
|
||||
|
||||
/**
|
||||
* @api {post} /api/v1/work/list 工单信息
|
||||
* @apiVersion 1.0.0
|
||||
* @apiName WorkList
|
||||
* @apiGroup Work
|
||||
*
|
||||
* @apiHeader {string} x-token token
|
||||
* @apiHeader {string} Content-Type=application/json 传输方式
|
||||
*
|
||||
* @apiParam {String} [material_id=0] 装备ID
|
||||
* @apiParam {String} [kind=0] 工单类型
|
||||
* @apiParam {Number} current 当前页
|
||||
* @apiParam {Number} page_size 页展示数
|
||||
*
|
||||
* @apiSuccess (200) {Number} code 成功响应状态码!
|
||||
* @apiSuccess (200) {String} msg 成功提示
|
||||
* @apiSuccess (200) {Array} data 数据信息
|
||||
* @apiSuccess (200) {String} data.id ID
|
||||
* @apiSuccess (200) {String} data.title 标题名称
|
||||
* @apiSuccess (200) {String} data.material_code 装备编码
|
||||
* @apiSuccess (200) {String} data.material_title 装备名称
|
||||
* @apiSuccess (200) {String} data.breakdown_title 故障信息
|
||||
* @apiSuccess (200) {Number} data.priority 紧急状态(1:普通,2:紧急,3:非常紧急)
|
||||
* @apiSuccess (200) {Number} data.status 状态(0:进行中,1:已完成)
|
||||
* @apiSuccess (200) {Time} data.created_at 创建时间
|
||||
*
|
||||
* @apiSuccessExample {json} Success response:
|
||||
* HTTPS 200 OK
|
||||
* {
|
||||
* "code": 200
|
||||
* "msg": "ok"
|
||||
* "data": [
|
||||
* {
|
||||
* "id": "m9Qa2ZaOvE",
|
||||
* "title": "刹车盘",
|
||||
* "material_code": "装备编码",
|
||||
* "material_title": "装备名称",
|
||||
* "breakdown_title": "发动机,刹车盘",
|
||||
* "priority": 1,
|
||||
* "status": 0,
|
||||
* "created_at": "2021-11-05T14:24:07+08:00",
|
||||
* }
|
||||
* ]
|
||||
* }
|
||||
*/
|
||||
func (*Work) Instance(c *gin.Context) {
|
||||
form := &struct {
|
||||
MaterialID uint64 `json:"material_id" form:"material_id"`
|
||||
Kind int `json:"kind" form:"kind"`
|
||||
PageForm
|
||||
}{}
|
||||
if err := bind(form)(c); err != nil {
|
||||
APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
data, err := work.NewInstance()(getSession()(c).(*service.Session)).List(form.MaterialID, form.Kind, form.Page, form.PageSize)
|
||||
APIResponse(err, data)(c)
|
||||
}
|
||||
|
||||
func (*Work) Launch(c *gin.Context) {
|
||||
|
||||
}
|
||||
|
||||
func (*Work) Examine(c *gin.Context) {
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user