feat:完善项目

This commit is contained in:
henry
2021-11-11 17:10:43 +08:00
parent 3b09ec1efc
commit 27e61ed093
8 changed files with 396 additions and 3 deletions

View File

@ -598,3 +598,70 @@ func (*Work) ScheduleDelete(c *gin.Context) {
err := work.NewSchedule()(getSession()(c).(*service.Session)).Delete(form.Convert())
APIResponse(err)(c)
}
func (*Work) Repair(c *gin.Context) {
form := &struct {
OrderNo string `json:"order_no" form:"order_no"`
EquipmentCode string `json:"equipment_code" form:"equipment_code"`
EquipmentTitle string `json:"equipment_title" form:"equipment_title"`
PageForm
}{}
if err := bind(form)(c); err != nil {
APIFailure(err.(error))(c)
return
}
data, err := work.NewRepair()(getSession()(c).(*service.Session)).List(form.OrderNo, form.EquipmentCode, form.EquipmentTitle,
form.Page, form.PageSize)
APIResponse(err, data)(c)
}
func (*Work) RepairDetail(c *gin.Context) {
form := new(IDStringForm)
if err := bind(form)(c); err != nil {
APIFailure(err.(error))(c)
return
}
data, err := work.NewRepair()(getSession()(c).(*service.Session)).Detail(form.Convert())
APIResponse(err, data)(c)
}
func (*Work) RepairBegin(c *gin.Context) {
form := &struct {
IDStringForm
Remark string `json:"remark" form:"remark"`
}{}
if err := bind(form)(c); err != nil {
APIFailure(err.(error))(c)
return
}
err := work.NewRepair()(getSession()(c).(*service.Session)).Begin(form.Convert(), form.Remark)
APIResponse(err)(c)
}
func (*Work) RepairFinish(c *gin.Context) {
form := &struct {
IDStringForm
ImageForm
Remark string `json:"remark" form:"remark"`
}{}
if err := bind(form)(c); err != nil {
APIFailure(err.(error))(c)
return
}
err := work.NewRepair()(getSession()(c).(*service.Session)).Finish(form.Convert(), form.Image, form.Remark)
APIResponse(err)(c)
}
func (*Work) RepairEvaluate(c *gin.Context) {
form := &struct {
IDStringForm
Score float64 `json:"score" form:"score" binding:"required"`
}{}
if err := bind(form)(c); err != nil {
APIFailure(err.(error))(c)
return
}
err := work.NewRepair()(getSession()(c).(*service.Session)).Evaluate(form.Convert(), form.Score)
APIResponse(err)(c)
}