feat:完善项目
This commit is contained in:
196
app/api/work.go
196
app/api/work.go
@ -33,6 +33,15 @@ type (
|
||||
Mobile string `json:"mobile" form:"mobile" binding:"required"` // 联系方式
|
||||
Address string `json:"address" form:"address" binding:"required"` // 联系地址
|
||||
}
|
||||
// scheduleForm 流程信息
|
||||
scheduleForm struct {
|
||||
Title string `json:"title" form:"title" binding:"required"`
|
||||
Stage int `json:"stage" form:"stage"`
|
||||
Step int `json:"step" form:"step"`
|
||||
Target int `json:"target" form:"target" binding:"required"`
|
||||
TargetValue []string `json:"target_value" form:"target_value" binding:"required"`
|
||||
IsCountersign int `json:"is_countersign" form:"is_countersign"`
|
||||
}
|
||||
)
|
||||
|
||||
/**
|
||||
@ -49,17 +58,18 @@ type (
|
||||
* @apiParam {Number} current 当前页
|
||||
* @apiParam {Number} page_size 页展示数
|
||||
*
|
||||
* @apiSuccess (200) {Number} code 成功响应状态码!
|
||||
* @apiSuccess (200) {String} msg 成功提示
|
||||
* @apiSuccess (200) {Array} data 数据信息
|
||||
* @apiSuccess (200) {Object} 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) {String} data.schedule_title 流程名称
|
||||
* @apiSuccess (200) {Number} data.priority 紧急状态(1:普通,2:紧急,3:非常紧急)
|
||||
* @apiSuccess (200) {Number} data.status 状态(0:进行中,1:已完成)
|
||||
* @apiSuccess (200) {Time} data.created_at 创建时间
|
||||
* @apiSuccess (200) {Number} code 成功响应状态码!
|
||||
* @apiSuccess (200) {String} msg 成功提示
|
||||
*
|
||||
* @apiSuccessExample {json} Success response:
|
||||
* HTTPS 200 OK
|
||||
@ -73,6 +83,7 @@ type (
|
||||
* "material_code": "装备编码",
|
||||
* "material_title": "装备名称",
|
||||
* "breakdown_title": "发动机,刹车盘",
|
||||
* "schedule_title": "分管领导审批",
|
||||
* "priority": 1,
|
||||
* "status": 0,
|
||||
* "created_at": "2021-11-05T14:24:07+08:00",
|
||||
@ -108,17 +119,18 @@ func (*Work) Instance(c *gin.Context) {
|
||||
* @apiParam {Number} current 当前页
|
||||
* @apiParam {Number} page_size 页展示数
|
||||
*
|
||||
* @apiSuccess (200) {Number} code 成功响应状态码!
|
||||
* @apiSuccess (200) {String} msg 成功提示
|
||||
* @apiSuccess (200) {Array} data 数据信息
|
||||
* @apiSuccess (200) {Object} 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) {String} data.schedule_title 流程名称
|
||||
* @apiSuccess (200) {Number} data.priority 紧急状态(1:普通,2:紧急,3:非常紧急)
|
||||
* @apiSuccess (200) {Number} data.status 状态(0:进行中,1:已完成)
|
||||
* @apiSuccess (200) {Time} data.created_at 创建时间
|
||||
* @apiSuccess (200) {Number} code 成功响应状态码!
|
||||
* @apiSuccess (200) {String} msg 成功提示
|
||||
*
|
||||
* @apiSuccessExample {json} Success response:
|
||||
* HTTPS 200 OK
|
||||
@ -132,6 +144,7 @@ func (*Work) Instance(c *gin.Context) {
|
||||
* "material_code": "装备编码",
|
||||
* "material_title": "装备名称",
|
||||
* "breakdown_title": "发动机,刹车盘",
|
||||
* "schedule_title": "分管领导审批",
|
||||
* "priority": 1,
|
||||
* "status": 0,
|
||||
* "created_at": "2021-11-05T14:24:07+08:00",
|
||||
@ -153,6 +166,53 @@ func (*Work) Person(c *gin.Context) {
|
||||
APIResponse(err, data)(c)
|
||||
}
|
||||
|
||||
/**
|
||||
* @api {post} /api/v1/work/workbench 个人待办事项
|
||||
* @apiVersion 1.0.0
|
||||
* @apiName WorkWorkbench
|
||||
* @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) {Object} 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) {String} data.schedule_title 流程名称
|
||||
* @apiSuccess (200) {Number} data.priority 紧急状态(1:普通,2:紧急,3:非常紧急)
|
||||
* @apiSuccess (200) {Number} data.status 状态(0:进行中,1:已完成)
|
||||
* @apiSuccess (200) {Time} data.created_at 创建时间
|
||||
* @apiSuccess (200) {Number} code 成功响应状态码!
|
||||
* @apiSuccess (200) {String} msg 成功提示
|
||||
*
|
||||
* @apiSuccessExample {json} Success response:
|
||||
* HTTPS 200 OK
|
||||
* {
|
||||
* "code": 200
|
||||
* "msg": "ok"
|
||||
* "data": [
|
||||
* {
|
||||
* "id": "m9Qa2ZaOvE",
|
||||
* "title": "刹车盘",
|
||||
* "material_code": "装备编码",
|
||||
* "material_title": "装备名称",
|
||||
* "breakdown_title": "发动机,刹车盘",
|
||||
* "schedule_title": "分管领导审批",
|
||||
* "priority": 1,
|
||||
* "status": 0,
|
||||
* "created_at": "2021-11-05T14:24:07+08:00",
|
||||
* }
|
||||
* ]
|
||||
* }
|
||||
*/
|
||||
func (*Work) Workbench(c *gin.Context) {
|
||||
form := &struct {
|
||||
MaterialID uint64 `json:"material_id" form:"material_id"`
|
||||
@ -221,7 +281,131 @@ func (*Work) Delete(c *gin.Context) {
|
||||
APIResponse(err)(c)
|
||||
}
|
||||
|
||||
/**
|
||||
* @api {get} /api/v1/work/schedule 工单流程信息
|
||||
* @apiVersion 1.0.0
|
||||
* @apiName WorkSchedule
|
||||
* @apiGroup Work
|
||||
*
|
||||
* @apiHeader {string} x-token token
|
||||
*
|
||||
* @apiSuccess (200) {Object} data 数据信息
|
||||
* @apiSuccess (200) {Number} data.kind 流程类型(1;维修工单)
|
||||
* @apiSuccess (200) {String} data.title 流程名称
|
||||
* @apiSuccess (200) {Object} data.schedules 流程信息
|
||||
* @apiSuccess (200) {String} data.schedules.id 流程详细ID
|
||||
* @apiSuccess (200) {String} data.schedules.title 流程详细名称
|
||||
* @apiSuccess (200) {Number} data.schedules.stage 阶段
|
||||
* @apiSuccess (200) {Number} data.schedules.step 步骤
|
||||
* @apiSuccess (200) {Number} data.schedules.target 触发对象(1:个人,2:角色)
|
||||
* @apiSuccess (200) {String} data.schedules.target_value 触发对象信息
|
||||
* @apiSuccess (200) {String} data.schedules.target_value_title 触发对象具体信息
|
||||
* @apiSuccess (200) {Number} data.schedules.is_countersign 是否会签(0:否,1:是)暂不需要此字段
|
||||
* @apiSuccess (200) {Time} data.schedules.created_at 创建时间
|
||||
* @apiSuccess (200) {Number} code 成功响应状态码!
|
||||
* @apiSuccess (200) {String} msg 成功提示
|
||||
*
|
||||
* @apiSuccessExample {json} Success response:
|
||||
* HTTPS 200 OK
|
||||
* {
|
||||
* "code": 200
|
||||
* "msg": "ok"
|
||||
* "data": [
|
||||
* {
|
||||
* "kind": "m9Qa2ZaOvE",
|
||||
* "title": "刹车盘",
|
||||
* "schedules": [
|
||||
* {
|
||||
* "id": "A9GVg5JZdr",
|
||||
* "title": "发起工单",
|
||||
* "stage": 1,
|
||||
* "step": 2,
|
||||
* "target": 2,
|
||||
* "target_value": "9",
|
||||
* "target_value_title": "区域修理队",
|
||||
* "is_countersign": 0,
|
||||
* "created_at": "2021-11-05T14:24:07+08:00",
|
||||
* ]
|
||||
* }
|
||||
* }
|
||||
* ]
|
||||
* }
|
||||
*/
|
||||
func (*Work) Schedule(c *gin.Context) {
|
||||
data, err := work.NewSchedule()(getSession()(c).(*service.Session)).List()
|
||||
APIResponse(err, data)(c)
|
||||
}
|
||||
|
||||
/**
|
||||
* @api {get} /api/v1/work/schedule/edit 工单流程信息修改
|
||||
* @apiVersion 1.0.0
|
||||
* @apiName WorkSchedulEdit
|
||||
* @apiGroup Work
|
||||
*
|
||||
* @apiHeader {string} x-token token
|
||||
*
|
||||
* @apiParam {String} id Id
|
||||
* @apiParam {String} title 名称
|
||||
* @apiParam {Number} target 触发对象
|
||||
* @apiParam {Array.String} target_value 触发对象具体信息
|
||||
*
|
||||
* @apiSuccess (200) {Object} data 数据信息
|
||||
* @apiSuccess (200) {Number} code 成功响应状态码!
|
||||
* @apiSuccess (200) {String} msg 成功提示
|
||||
*
|
||||
* @apiSuccessExample {json} Success response:
|
||||
* HTTPS 200 OK
|
||||
* {
|
||||
* "code": 200
|
||||
* "msg": "ok"
|
||||
* "data": null
|
||||
* }
|
||||
*/
|
||||
func (*Work) ScheduleEdit(c *gin.Context) {
|
||||
form := &struct {
|
||||
IDStringForm
|
||||
scheduleForm
|
||||
}{}
|
||||
if err := bind(form)(c); err != nil {
|
||||
APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
err := work.NewSchedule()(getSession()(c).(*service.Session)).Form(&work.ScheduleParams{
|
||||
ID: form.Convert(), Title: form.Title, Stage: form.Stage, Step: form.Step,
|
||||
Target: form.Target, IsCountersign: form.IsCountersign, TargetValue: form.TargetValue,
|
||||
})
|
||||
APIResponse(err)(c)
|
||||
}
|
||||
|
||||
/**
|
||||
* @api {get} /api/v1/work/schedule/delete 工单流程信息删除
|
||||
* @apiVersion 1.0.0
|
||||
* @apiName WorkSchedulDelete
|
||||
* @apiGroup Work
|
||||
*
|
||||
* @apiHeader {string} x-token token
|
||||
*
|
||||
* @apiParam {String} id Id
|
||||
*
|
||||
* @apiSuccess (200) {Object} data 数据信息
|
||||
* @apiSuccess (200) {Number} code 成功响应状态码!
|
||||
* @apiSuccess (200) {String} msg 成功提示
|
||||
*
|
||||
* @apiSuccessExample {json} Success response:
|
||||
* HTTPS 200 OK
|
||||
* {
|
||||
* "code": 200
|
||||
* "msg": "ok"
|
||||
* "data": null
|
||||
* }
|
||||
*/
|
||||
func (*Work) ScheduleDelete(c *gin.Context) {
|
||||
form := new(IDStringForm)
|
||||
|
||||
if err := bind(form)(c); err != nil {
|
||||
APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
err := work.NewSchedule()(getSession()(c).(*service.Session)).Delete(form.Convert())
|
||||
APIResponse(err)(c)
|
||||
}
|
||||
|
Reference in New Issue
Block a user