作者 yangfu

导出修改

... ... @@ -112,7 +112,7 @@ func (this *BaseController) Valid(obj interface{}) (result bool, msg *protocol.R
func (this *BaseController) ResponseExcelByFile(ctx *context.Context, excelMaker *exceltool.ExcelMaker) error {
ctx.Output.Header("Content-Disposition", "attachment; filename="+excelMaker.FileName)
ctx.Output.Header("Content-Description", "File Transfer")
ctx.Output.Header("Content-Type", "application/octet-stream")
ctx.Output.Header("Content-Type", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet")
ctx.Output.Header("Content-Transfer-Encoding", "binary")
ctx.Output.Header("Expires", "0")
ctx.Output.Header("Cache-Control", "must-revalidate")
... ...
... ... @@ -83,6 +83,10 @@ var errmessge ErrorMap = map[string]string{
"10277": "最多一个小数",
"10278": "公告标题大于30个字符",
"10279": "该子分类名称已存在",
"10280": "请为您选择的特殊人员设置审批流程",
"10281": "请您选择的审批人员",
"10282": "请您选择的审批角色",
"10283": "特殊审批流程被审批人不可重复",
"10170": "请选择指定成员",
"10171": "请选择审批人类别",
... ...
... ... @@ -682,3 +682,90 @@ func CategoryEditSort(uid, companyId int64, request *protocol.CategoryEditSortRe
rsp = &protocol.CategoryEditSortResponse{}
return
}
//验证模板配置
func ValidAuditFlowConfig(flowConfig protocol.AuditFlowConfig) (msg *protocol.ResponseMessage) {
var (
count int
specailUser map[int]int
)
msg = protocol.NewMessage("0")
for i := range flowConfig.ProcessConfig {
config := flowConfig.ProcessConfig[i]
if !(config.ApproveType == models.AuditByDepartmentor || config.ApproveType == models.AuditByUser || config.ApproveType == models.AuditByRole) {
msg = protocol.BadRequestParam("10171")
return
}
if !(config.AcitonType == models.ActionTypeOr || config.AcitonType == models.ActionTypeAnd) {
msg = protocol.BadRequestParam("10172")
return
}
if config.ApproveType == models.AuditByUser {
if len(config.ToUser) == 0 {
msg = protocol.BadRequestParam("10170")
return
}
if len(config.ToUser) > 10 {
msg = protocol.BadRequestParam("10174")
return
}
}
if config.ApproveType == models.AuditByRole {
if len(config.ToRole) == 0 {
msg = protocol.BadRequestParam("10173")
return
}
if len(config.ToRole) > 1 {
msg = protocol.BadRequestParam("10175")
return
}
}
if config.ProcessType == models.FlowTypeNormal {
count++
if count > 1 {
msg = protocol.BadRequestParam("10176")
return
}
}
if config.ProcessType == models.FlowTypeSpecail {
if len(config.FromSpecialUser) == 0 { //特殊人为空
msg = protocol.BadRequestParam("10281")
return
}
msg = ValidProcessConfig(&config)
if msg.Errno != 0 {
return
}
for i := range config.ToUser {
u := config.ToUser[i]
if _, ok := specailUser[u.Id]; ok {
msg = protocol.BadRequestParam("10283")
return
}
}
}
}
return
}
//检验审核配置
func ValidProcessConfig(config *protocol.ProcessConfig) (msg *protocol.ResponseMessage) {
msg = &protocol.ResponseMessage{}
switch config.ApproveType {
case models.AuditByDepartmentor:
break
case models.AuditByUser:
if len(config.ToUser) == 0 {
msg = protocol.BadRequestParam("10281")
return
}
break
case models.AuditByRole:
if len(config.ToRole) == 0 {
msg = protocol.BadRequestParam("10282")
return
}
break
}
return
}
... ...