81 lines
2.1 KiB
Go
81 lines
2.1 KiB
Go
package api
|
||
|
||
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) {
|
||
|
||
}
|