作者 yangfu

表单序号修改

@@ -75,7 +75,7 @@ func TemplateAdd(uid, companyId int64, request *protocol.TemplateAddRequest) (rs @@ -75,7 +75,7 @@ func TemplateAdd(uid, companyId int64, request *protocol.TemplateAddRequest) (rs
75 CompanyId: int(companyId), 75 CompanyId: int(companyId),
76 AuditTemplateId: int(templateId), 76 AuditTemplateId: int(templateId),
77 Section: input.SectionType, 77 Section: input.SectionType,
78 - SortNum: input.Sort, 78 + SortNum: i,
79 Label: input.Label, 79 Label: input.Label,
80 InputType: input.InputType, 80 InputType: input.InputType,
81 Required: int8(input.Required), 81 Required: int8(input.Required),
@@ -207,6 +207,7 @@ func TemplateUpdate(uid, companyId int64, request *protocol.TemplateUpdateReques @@ -207,6 +207,7 @@ func TemplateUpdate(uid, companyId int64, request *protocol.TemplateUpdateReques
207 } 207 }
208 for i := range request.Template.InputList { 208 for i := range request.Template.InputList {
209 input := request.Template.InputList[i] 209 input := request.Template.InputList[i]
  210 + input.Sort = i
210 if err = insertOrUpdateInput(orm, companyId, int(template.Id), input); err != nil { 211 if err = insertOrUpdateInput(orm, companyId, int(template.Id), input); err != nil {
211 log.Error(err.Error()) 212 log.Error(err.Error())
212 orm.Rollback() 213 orm.Rollback()
@@ -291,6 +292,7 @@ func insertOrUpdateInput(orm orm2.Ormer, companyId int64, templateId int, input @@ -291,6 +292,7 @@ func insertOrUpdateInput(orm orm2.Ormer, companyId int64, templateId int, input
291 "Label": input.Label, 292 "Label": input.Label,
292 "InputType": input.InputType, 293 "InputType": input.InputType,
293 "Required": int8(input.Required), 294 "Required": int8(input.Required),
  295 + "SortNum": input.Sort,
294 } 296 }
295 if err = utils.UpdateTableByMapWithOrmer(orm, auditForm, updateMap); err != nil { 297 if err = utils.UpdateTableByMapWithOrmer(orm, auditForm, updateMap); err != nil {
296 return 298 return