Parcourir la source

fix publicList

zwxi il y a 6 mois
Parent
commit
2f902d7577
2 fichiers modifiés avec 15 ajouts et 4 suppressions
  1. 13 3
      controllers/bi_dashboard.go
  2. 2 1
      models/bi_dashboard/bi_dashboard.go

+ 13 - 3
controllers/bi_dashboard.go

@@ -302,7 +302,7 @@ func (this *BIDaShboardController) DetailDashboard() {
 		return
 	}
 	dashboardId, _ := this.GetInt("DashboardId")
-
+	resp := new(bi_dashboard.DashboardDetailResp)
 	dashboardItem, err := bi_dashboard.GetDashboardById(dashboardId)
 	if err != nil {
 		err = errors.New("我的看板列表查询出错:" + err.Error())
@@ -311,6 +311,16 @@ func (this *BIDaShboardController) DetailDashboard() {
 		return
 	}
 
+	grantInfoList, err := bi_dashboard.GetDashboardGrantInfo(dashboardId)
+	if err != nil {
+		br.Msg = "信息获取失败"
+		br.ErrMsg = "共享信息获取失败,Err:" + err.Error()
+		return
+	}
+	if len(grantInfoList) > 0 {
+		resp.IsGrant = 1
+	}
+
 	detailList, err := bi_dashboard.GetBiDashboardDetailById(dashboardId)
 	if err != nil {
 		br.Msg = "详情获取失败"
@@ -318,7 +328,6 @@ func (this *BIDaShboardController) DetailDashboard() {
 		return
 	}
 
-	resp := new(bi_dashboard.DashboardDetailResp)
 	resp.BiDashboard = dashboardItem
 	resp.List = detailList
 
@@ -596,6 +605,7 @@ func (this *BIDaShboardController) PublicList() {
 		tmpItem := &bi_dashboard.RespPublicGroupListItem{
 			GroupId:   int64(c.BiDashboardClassifyId),
 			GroupName: c.BiDashboardClassifyName,
+			Children:  make([]*bi_dashboard.RespPublicGroupListItem, 0),
 		}
 		if _, ok := publicDashboardClassifyIdMap[c.BiDashboardClassifyId]; ok {
 			for _, v := range publicAdminIdList {
@@ -620,9 +630,9 @@ func (this *BIDaShboardController) PublicList() {
 				for _, vv := range respGroupNameListItemList {
 					if vv.BiDashboardClassifyId == c.BiDashboardClassifyId {
 						tmpRespGroupListItem.DashboardList = append(tmpRespGroupListItem.DashboardList, vv)
+						tmpItem.Children = append(tmpItem.Children, tmpRespGroupListItem)
 					}
 				}
-				tmpItem.Children = append(tmpItem.Children, tmpRespGroupListItem)
 
 				resp = append(resp, tmpItem)
 			}

+ 2 - 1
models/bi_dashboard/bi_dashboard.go

@@ -78,7 +78,8 @@ func DelDashboard(id int) (err error) {
 // DashboardDetailResp 详情响应体
 type DashboardDetailResp struct {
 	*BiDashboard
-	List []*BiDashboardDetail
+	IsGrant int `description:"是否共享,0:不是,1:是"`
+	List    []*BiDashboardDetail
 }
 
 type AddDashboardReq struct {