diff --git a/apis/process/workOrder.go b/apis/process/workOrder.go index 3899b06..79aa52c 100644 --- a/apis/process/workOrder.go +++ b/apis/process/workOrder.go @@ -297,12 +297,13 @@ func ProcessWorkOrder(c *gin.Context) { handle service.Handle params struct { Tasks []string - TargetState string `json:"target_state"` // 目标状态 - SourceState string `json:"source_state"` // 源状态 - WorkOrderId int `json:"work_order_id"` // 工单ID - Circulation string `json:"circulation"` // 流转ID - FlowProperties int `json:"flow_properties"` // 流转类型 0 拒绝,1 同意,2 其他 - Remarks string `json:"remarks"` // 处理的备注信息 + TargetState string `json:"target_state"` // 目标状态 + SourceState string `json:"source_state"` // 源状态 + WorkOrderId int `json:"work_order_id"` // 工单ID + Circulation string `json:"circulation"` // 流转ID + FlowProperties int `json:"flow_properties"` // 流转类型 0 拒绝,1 同意,2 其他 + Remarks string `json:"remarks"` // 处理的备注信息 + Tpls []map[string]interface{} `json:"tpls"` // 表单数据 } ) @@ -332,6 +333,7 @@ func ProcessWorkOrder(c *gin.Context) { params.Circulation, // 流转标题 params.FlowProperties, // 流转属性 params.Remarks, // 备注信息 + params.Tpls, // 工单数据更新 ) if err != nil { app.Error(c, -1, nil, fmt.Sprintf("处理工单失败,%v", err.Error())) diff --git a/pkg/service/handle.go b/pkg/service/handle.go index d8d0c15..242e4c4 100644 --- a/pkg/service/handle.go +++ b/pkg/service/handle.go @@ -325,6 +325,7 @@ func (h *Handle) HandleWorkOrder( circulationValue string, flowProperties int, remarks string, + tpls []map[string]interface{}, ) (err error) { h.workOrderId = workOrderId h.flowProperties = flowProperties @@ -626,6 +627,21 @@ func (h *Handle) HandleWorkOrder( } } + // 更新表单数据 + for _, t := range tpls { + var tplValue []byte + tplValue, err = json.Marshal(t["tplValue"]) + if err != nil { + h.tx.Rollback() + return + } + err = h.tx.Model(&process.TplData{}).Where("id = ?", t["tplDataId"]).Update("form_data", tplValue).Error + if err != nil { + h.tx.Rollback() + return + } + } + // 流转历史写入 err = orm.Eloquent.Model(&cirHistoryValue). Where("work_order = ?", workOrderId). @@ -663,7 +679,6 @@ func (h *Handle) HandleWorkOrder( CostDuration: costDurationValue, Remarks: remarks, } - err = h.tx.Create(&cirHistoryData).Error if err != nil { h.tx.Rollback()