feat:完善项目
This commit is contained in:
@ -12,8 +12,28 @@ import (
|
||||
|
||||
type Work struct{}
|
||||
|
||||
type workLaunchForm struct {
|
||||
}
|
||||
type (
|
||||
// workLaunchForm 工单发起基本信息
|
||||
workLaunchForm struct {
|
||||
Kind int `json:"kind" form:"kind" binding:"required"` // 类型
|
||||
Title string `json:"title" form:"title"`
|
||||
EquipmentID uint64 `json:"equipment_id" form:"equipment_id" binding:"required"` // 装备ID
|
||||
Breakdowns []uint64 `json:"breakdowns" form:"breakdowns"` // 故障类型
|
||||
PlateNumber string `json:"plate_number" form:"plate_number"` // 车牌号
|
||||
Priority int `json:"priority" form:"priority" binding:"required"` // 优先级
|
||||
IsAssist int `json:"is_assist" form:"is_assist"` // 是否需要上级审批
|
||||
Remark string `json:"remark" form:"remark"` // 备注信息
|
||||
}
|
||||
// workLaunchMaterialForm 工单发起配件信息
|
||||
workLaunchMaterialForm struct {
|
||||
}
|
||||
// workLaunchDistributionForm 工单发起地址信息
|
||||
workLaunchDistributionForm struct {
|
||||
Name string `json:"name" form:"name" binding:"required"` // 联系人
|
||||
Mobile string `json:"mobile" form:"mobile" binding:"required"` // 联系方式
|
||||
Address string `json:"address" form:"address" binding:"required"` // 联系地址
|
||||
}
|
||||
)
|
||||
|
||||
/**
|
||||
* @api {post} /api/v1/work/list 工单信息
|
||||
@ -80,16 +100,18 @@ func (*Work) ToDo(c *gin.Context) {
|
||||
|
||||
func (*Work) Launch(c *gin.Context) {
|
||||
form := &struct {
|
||||
IDStringForm
|
||||
Status int `json:"status" form:"status" binding:"required"`
|
||||
Remark string `json:"remark" form:"remark"`
|
||||
IsAssist int `json:"is_assist" form:"is_assist"`
|
||||
workLaunchForm
|
||||
Material []*workLaunchMaterialForm `json:"material" form:"material"`
|
||||
Address workLaunchDistributionForm `json:"distribution" form:"distribution"`
|
||||
}{}
|
||||
if err := bind(form)(c); err != nil {
|
||||
APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
err := work.NewInstance()(getSession()(c).(*service.Session)).Launch()
|
||||
err := work.NewInstance()(getSession()(c).(*service.Session)).Launch(&work.InstanceLaunchParams{
|
||||
Kind: form.Kind, Title: form.Title, EquipmentID: form.EquipmentID, Breakdowns: form.Breakdowns,
|
||||
PlateNumber: form.PlateNumber, Priority: form.Priority, IsAssist: form.IsAssist, Remark: form.Remark,
|
||||
})
|
||||
APIResponse(err)
|
||||
}
|
||||
|
||||
@ -104,6 +126,6 @@ func (*Work) Examine(c *gin.Context) {
|
||||
APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
err := work.NewPerson()(getSession()(c).(*service.Session)).Examine(form.Convert(), form.Status, form.Remark, form.IsAssist)
|
||||
err := work.NewInstance()(getSession()(c).(*service.Session)).Examine(form.Convert(), form.Status, form.Remark, form.IsAssist)
|
||||
APIResponse(err)
|
||||
}
|
||||
|
Reference in New Issue
Block a user