Merge pull request #69 from lanyulei/dev

fix: 修复工单列表展示bug。
This commit is contained in:
lanyulei 2020-10-09 00:59:01 +08:00 committed by GitHub
commit db8b5faf0e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 26 additions and 15 deletions

View File

@ -143,11 +143,16 @@ func ProcessStructure(c *gin.Context, processId int, workOrderId int) (result ma
for _, stateValue := range stateList {
for _, processNodeValue := range processStructureDetails["nodes"].([]interface{}) {
if stateValue["id"].(string) == processNodeValue.(map[string]interface{})["id"] {
for _, userId := range stateValue["processor"].([]interface{}) {
if int(userId.(float64)) == tools.GetUserId(c) {
workOrderInfo.CurrentState = stateValue["id"].(string)
break breakStateTag
if _, ok := stateValue["processor"]; ok {
for _, userId := range stateValue["processor"].([]interface{}) {
if int(userId.(float64)) == tools.GetUserId(c) {
workOrderInfo.CurrentState = stateValue["id"].(string)
break breakStateTag
}
}
} else {
err = errors.New("未查询到对应的处理人字段,请确认。")
return
}
}
}

View File

@ -122,18 +122,24 @@ func (w *WorkOrder) WorkOrderList() (result interface{}, err error) {
authStatus bool
)
if len(StateList) != 0 {
structResult, err = ProcessStructure(w.GinObj, v.Process, v.Id)
if err != nil {
return
}
// 仅待办工单需要验证
// todo还需要找最优解决方案
if w.Classify == 1 {
structResult, err = ProcessStructure(w.GinObj, v.Process, v.Id)
if err != nil {
return
}
authStatus, err = JudgeUserAuthority(w.GinObj, v.Id, structResult["workOrder"].(WorkOrderData).CurrentState)
if err != nil {
return
}
if !authStatus {
minusTotal += 1
continue
authStatus, err = JudgeUserAuthority(w.GinObj, v.Id, structResult["workOrder"].(WorkOrderData).CurrentState)
if err != nil {
return
}
if !authStatus {
minusTotal += 1
continue
}
} else {
authStatus = true
}
processorList := make([]int, 0)