新增模版管理功能。

This commit is contained in:
Mr. Lan 2020-08-28 01:00:57 +08:00
parent 2b102a82d5
commit c7d842eb33
2 changed files with 24 additions and 7 deletions

View File

@ -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()))

View File

@ -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()