fix: 修复工单因流程删除而无法显示的bug。
This commit is contained in:
parent
6595acb5d4
commit
0ca5490e81
@ -34,11 +34,12 @@ func ProcessStructure(c *gin.Context, processId int, workOrderId int) (result ma
|
||||
)
|
||||
|
||||
err = orm.Eloquent.Model(&processValue).Where("id = ?", processId).Find(&processValue).Error
|
||||
if err != nil {
|
||||
err = fmt.Errorf("查询流程失败,%v", err.Error())
|
||||
return
|
||||
}
|
||||
//if err != nil {
|
||||
// err = fmt.Errorf("查询流程失败,%v", err.Error())
|
||||
// return
|
||||
//}
|
||||
|
||||
if processValue.Structure != nil && len(processValue.Structure) > 0 {
|
||||
err = json.Unmarshal([]byte(processValue.Structure), &processStructureDetails)
|
||||
if err != nil {
|
||||
err = fmt.Errorf("json转map失败,%v", err.Error())
|
||||
@ -67,6 +68,7 @@ func ProcessStructure(c *gin.Context, processId int, workOrderId int) (result ma
|
||||
} else {
|
||||
processNode = processStructureDetails["nodes"].([]map[string]interface{})
|
||||
}
|
||||
}
|
||||
|
||||
processValue.Structure = nil
|
||||
result = map[string]interface{}{
|
||||
@ -141,6 +143,7 @@ func ProcessStructure(c *gin.Context, processId int, workOrderId int) (result ma
|
||||
if len(stateList) > 0 {
|
||||
breakStateTag:
|
||||
for _, stateValue := range stateList {
|
||||
if processStructureDetails["nodes"] != nil {
|
||||
for _, processNodeValue := range processStructureDetails["nodes"].([]interface{}) {
|
||||
if stateValue["id"].(string) == processNodeValue.(map[string]interface{})["id"] {
|
||||
if _, ok := stateValue["processor"]; ok {
|
||||
@ -157,6 +160,7 @@ func ProcessStructure(c *gin.Context, processId int, workOrderId int) (result ma
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if workOrderInfo.CurrentState == "" {
|
||||
workOrderInfo.CurrentState = stateList[0]["id"].(string)
|
||||
|
@ -44,13 +44,16 @@ func JudgeUserAuthority(c *gin.Context, workOrderId int, currentState string) (s
|
||||
|
||||
// 获取流程信息
|
||||
err = orm.Eloquent.Model(&process.Info{}).Where("id = ?", workOrderInfo.Process).Find(&processInfo).Error
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
//if err != nil {
|
||||
// return
|
||||
//}
|
||||
|
||||
if processInfo.Structure != nil && len(processInfo.Structure) > 0 {
|
||||
err = json.Unmarshal(processInfo.Structure, &processState.Structure)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
stateValue, err = processState.GetNode(currentState)
|
||||
if err != nil {
|
||||
|
Loading…
x
Reference in New Issue
Block a user