feat:完善项目
This commit is contained in:
@ -122,6 +122,11 @@ func (*Manage) Equipment(c *gin.Context) {
|
||||
APIResponse(err, data)(c)
|
||||
}
|
||||
|
||||
func (*Manage) EquipmentTree(c *gin.Context) {
|
||||
data, err := manage.NewEquipment()(getSession()(c).(*service.Session)).Tree()
|
||||
APIResponse(err, data)(c)
|
||||
}
|
||||
|
||||
/**
|
||||
* @api {get} /api/v1/manage/equipment/select 装备Select信息
|
||||
* @apiVersion 1.0.0
|
||||
|
@ -34,6 +34,11 @@ type (
|
||||
SupplierID string `json:"supplier_id" form:"supplier_id"`
|
||||
Number float64 `json:"number" form:"number"`
|
||||
}
|
||||
// workLaunchPurchaseForm 工单发起配件信息
|
||||
workLaunchPurchaseForm struct {
|
||||
workLaunchMaterialForm
|
||||
Price float64 `json:"price" form:"price"`
|
||||
}
|
||||
// workLaunchDistributionForm 工单发起地址信息
|
||||
workLaunchDistributionForm struct {
|
||||
Name string `json:"name" form:"name"` // 联系人
|
||||
@ -357,10 +362,15 @@ func (*Work) Detail(c *gin.Context) {
|
||||
* @apiHeader {string} Content-Type=application/json 传输方式
|
||||
*
|
||||
* @apiParam {Object} within 内修参数信息
|
||||
* @apiParam {Object[]} within.material 配件信息,内修才需要上传
|
||||
* @apiParam {Object[]} within.material 配件信息
|
||||
* @apiParam {String} within.material.id 配件ID
|
||||
* @apiParam {String} within.material.supplier_id 供应商ID
|
||||
* @apiParam {Number} within.material.number 配件数量
|
||||
* @apiParam {Float} within.material.number 配件数量
|
||||
* @apiParam {Object[]} within.purchase 采购信息
|
||||
* @apiParam {String} within.purchase.id 配件ID
|
||||
* @apiParam {String} within.purchase.supplier_id 供应商ID
|
||||
* @apiParam {Float} within.purchase.number 采购数量
|
||||
* @apiParam {Float} within.purchase.Price 采购价格
|
||||
* @apiParam {Object} outside 外修参数信息
|
||||
* @apiParam {String} outside.supplier_id 配件ID
|
||||
* @apiParam {Number} kind 工单类型
|
||||
@ -396,6 +406,7 @@ func (*Work) Launch(c *gin.Context) {
|
||||
} `json:"outside" form:"outside"`
|
||||
Within struct {
|
||||
Material []*workLaunchMaterialForm `json:"material" form:"material"`
|
||||
Purchase []*workLaunchPurchaseForm `json:"purchase" form:"purchase"`
|
||||
} `json:"within" form:"within"`
|
||||
Distribution workLaunchDistributionForm `json:"distribution" form:"distribution"`
|
||||
}{}
|
||||
@ -410,11 +421,18 @@ func (*Work) Launch(c *gin.Context) {
|
||||
ID: v.IDInfo(), SupplierID: v.SupplierInfo(), Number: v.Number,
|
||||
})
|
||||
}
|
||||
purchase := make([]*work.InstanceLaunchParamsForPurchase, 0)
|
||||
|
||||
for _, v := range form.Within.Purchase {
|
||||
purchase = append(purchase, &work.InstanceLaunchParamsForPurchase{
|
||||
ID: v.IDInfo(), SupplierID: v.SupplierInfo(), Number: v.Number, Price: v.Price,
|
||||
})
|
||||
}
|
||||
err := work.NewInstance()(getSession()(c).(*service.Session)).Launch(&work.InstanceLaunchParams{
|
||||
Kind: form.Kind, Title: form.Title, EquipmentID: form.EquipmentInfo(), Breakdowns: form.BreakdownInfo(),
|
||||
PlateNumber: form.PlateNumber, Priority: form.Priority, IsAssist: form.IsAssist, Remark: form.Remark,
|
||||
Supplier: &work.InstanceLaunchParamsForSupplier{SupplierID: form.Outside.SupplierInfo()},
|
||||
Material: materials,
|
||||
Material: materials, Purchase: purchase,
|
||||
Distribution: &work.InstanceLaunchParamsForDistribution{
|
||||
Name: form.Distribution.Name, Mobile: form.Distribution.Mobile, Address: form.Distribution.Address,
|
||||
},
|
||||
@ -431,6 +449,16 @@ func (*Work) Launch(c *gin.Context) {
|
||||
* @apiHeader {string} x-token token
|
||||
* @apiHeader {string} Content-Type=application/json 传输方式
|
||||
*
|
||||
* @apiParam {Object} within 内修参数信息
|
||||
* @apiParam {Object[]} within.material 配件信息
|
||||
* @apiParam {String} within.material.id 配件ID
|
||||
* @apiParam {String} within.material.supplier_id 供应商ID
|
||||
* @apiParam {Float} within.material.number 配件数量
|
||||
* @apiParam {Object[]} within.purchase 采购信息
|
||||
* @apiParam {String} within.purchase.id 配件ID
|
||||
* @apiParam {String} within.purchase.supplier_id 供应商ID
|
||||
* @apiParam {Float} within.purchase.number 采购数量
|
||||
* @apiParam {Float} within.purchase.Price 采购价格
|
||||
* @apiParam {String} id 工单ID
|
||||
* @apiParam {String} status 审核状态
|
||||
* @apiParam {String} remark 备注信息
|
||||
@ -454,12 +482,31 @@ func (*Work) Examine(c *gin.Context) {
|
||||
Status int `json:"status" form:"status" binding:"required"`
|
||||
Remark string `json:"remark" form:"remark"`
|
||||
IsAssist int `json:"is_assist" form:"is_assist"`
|
||||
Within struct {
|
||||
Material []*workLaunchMaterialForm `json:"material" form:"material"`
|
||||
Purchase []*workLaunchPurchaseForm `json:"purchase" form:"purchase"`
|
||||
} `json:"within" form:"within"`
|
||||
}{}
|
||||
if err := bind(form)(c); err != nil {
|
||||
APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
err := work.NewInstance()(getSession()(c).(*service.Session)).Examine(form.Convert(), form.Status, form.Remark, form.IsAssist)
|
||||
materials := make([]*work.InstanceLaunchParamsForMaterial, 0)
|
||||
|
||||
for _, v := range form.Within.Material {
|
||||
materials = append(materials, &work.InstanceLaunchParamsForMaterial{
|
||||
ID: v.IDInfo(), SupplierID: v.SupplierInfo(), Number: v.Number,
|
||||
})
|
||||
}
|
||||
purchase := make([]*work.InstanceLaunchParamsForPurchase, 0)
|
||||
|
||||
for _, v := range form.Within.Purchase {
|
||||
purchase = append(purchase, &work.InstanceLaunchParamsForPurchase{
|
||||
ID: v.IDInfo(), SupplierID: v.SupplierInfo(), Number: v.Number, Price: v.Price,
|
||||
})
|
||||
}
|
||||
err := work.NewInstance()(getSession()(c).(*service.Session)).Examine(form.Convert(), form.Status, form.Remark,
|
||||
form.IsAssist, &work.InstanceExamineParams{Material: materials, Purchase: purchase})
|
||||
APIResponse(err)(c)
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user