Browse Source

fix:审批列表显示分类

zqbao 5 months ago
parent
commit
567f828a8b

+ 19 - 0
controllers/bi_approve/bi_approve.go

@@ -68,6 +68,22 @@ func (this *BiApproveController) List() {
 	var total int
 	var msg string
 	var err error
+
+	classifyList, msg, err := biapprove.GetBiClassifyAll()
+	if err != nil {
+		if msg != "" {
+			br.Msg = msg
+		} else {
+			br.Msg = "获取审批列表成功"
+		}
+		br.ErrMsg = "获取分类列表失败, Err: " + err.Error()
+		return
+	}
+	classifyMap := make(map[int]string)
+	for _, v := range classifyList {
+		classifyMap[v.BiDashboardClassifyId] = v.BiDashboardClassifyName
+	}
+
 	switch listType {
 	case 1:
 		list, total, msg, err = biapprove.ProcessingBiApprove(sysUser.AdminId, classifyId, timeType, sortField, sortRule, startSize, pageSize, sysUser.RealName, startTime, endTime, keyword)
@@ -88,6 +104,9 @@ func (this *BiApproveController) List() {
 		br.ErrMsg = "获取审批列表失败, Err: " + err.Error()
 		return
 	}
+	for _, v := range list {
+		v.ClassifyName = classifyMap[v.ClassifyId]
+	}
 
 	resp := new(response.BiApproveListResp)
 	page := paging.GetPaging(currentIndex, pageSize, total)

+ 1 - 0
models/bi_approve/response/bi_approve.go

@@ -71,6 +71,7 @@ type BiApproveItemOrmResp struct {
 	BiId              int    `description:"报告ID"`
 	BiTitle           string `description:"报告标题"`
 	ClassifyId        int    `description:"分类ID"`
+	ClassifyName      string `description:"分类名称"`
 	State             int    `description:"审批状态:1-待审批;2-已审批;3-已驳回;4-已撤回"`
 	RecordState       int    `description:"审批记录状态:1-待审批;2-已通过;3-已驳回"`
 	FlowId            int    `description:"审批流ID"`

+ 11 - 0
services/bi_approve/bi_approve.go

@@ -1167,3 +1167,14 @@ func toBiApproveItemOrmResp(src []*biapprove.BiApproveItemOrm) (res []*response.
 	}
 	return
 }
+
+func GetBiClassifyAll() (list []*bi_dashboard.BiDashboardClassify, msg string, err error) {
+	ClassifyList, e := bi_dashboard.GetBiDashboardClassifyAllList()
+	if e != nil {
+		msg = "获取失败"
+		err = fmt.Errorf("GetBiDashboardClassifyAllList err: %s", e.Error())
+		return
+	}
+	list = ClassifyList
+	return
+}