zwxi 5 months ago
parent
commit
bc87e78d69

+ 69 - 3
controllers/bi_dashboard.go

@@ -6,6 +6,7 @@ import (
 	"eta_gn/eta_api/models"
 	"eta_gn/eta_api/models/bi_dashboard"
 	"eta_gn/eta_api/models/system"
+	biapprove "eta_gn/eta_api/services/bi_approve"
 	"eta_gn/eta_api/utils"
 	"fmt"
 	"strconv"
@@ -152,8 +153,18 @@ func (this *BIDaShboardController) EditDashboard() {
 	item.ModifyTime = time.Now()
 
 	err = bi_dashboard.EditDashboard(item)
+	if err != nil {
+		br.Msg = "编辑失败"
+		br.ErrMsg = "编辑失败,Err:" + err.Error()
+		return
+	}
 
 	err = bi_dashboard.DeleteBiDashboardDetail(req.BiDashboardId)
+	if err != nil {
+		br.Msg = "删除详情失败"
+		br.ErrMsg = "删除详情失败,Err:" + err.Error()
+		return
+	}
 
 	detailList := make([]*bi_dashboard.BiDashboardDetail, 0)
 	for _, v := range req.List {
@@ -743,8 +754,8 @@ func (this *BIDaShboardController) DelDashboardClassify() {
 }
 
 // Grant
-// @Title 分配ppt权限
-// @Description 分配ppt权限接口
+// @Title 分配看板权限
+// @Description 分配看板权限接口
 // @Param	request	body models.GrantPptReq true "type json string"
 // @Success 200 Ret=200 分配成功
 // @router /grant [post]
@@ -807,7 +818,7 @@ func (this *BIDaShboardController) Grant() {
 		tmpV := &bi_dashboard.BiDashboardGrant{
 			BiDashboardId: req.BiDashboardId,
 			GrantAdminId:  grantAdminId,
-			CreateTime:    time.Time{},
+			CreateTime:    time.Now(),
 		}
 		list = append(list, tmpV)
 	}
@@ -830,3 +841,58 @@ func (this *BIDaShboardController) Grant() {
 	br.IsAddLog = true
 	br.Msg = "分配成功"
 }
+
+// Public
+// @Title
+// @Description 设置公共看板
+// @Param	request	body models.GrantPptReq true "type json string"
+// @Success 200 Ret=200 分配成功
+// @router /public [post]
+func (this *BIDaShboardController) Public() {
+	br := new(models.BaseResponse).Init()
+	defer func() {
+		this.Data["json"] = br
+		this.ServeJSON()
+	}()
+	var req bi_dashboard.PublicDashboardReq
+	err := json.Unmarshal(this.Ctx.Input.RequestBody, &req)
+	if err != nil {
+		br.Msg = "参数解析异常!"
+		br.ErrMsg = "参数解析失败,Err:" + err.Error()
+		return
+	}
+
+	// 校验是否开启了审批流
+	opening, e := biapprove.CheckBiOpenApprove(req.ClassifyId)
+	if e != nil {
+		br.Msg = "操作失败"
+		br.ErrMsg = "校验报告是否开启审批流失败, Err: " + e.Error()
+		return
+	}
+
+
+	if opening {
+
+
+	}
+
+	item, err := bi_dashboard.GetDashboardById(req.BiDashboardId)
+	if err != nil && !utils.IsErrNoRow(err) {
+		br.Msg = "获取数据异常!"
+		br.ErrMsg = "获取数据异常,Err:" + err.Error()
+		return
+	}
+	item.BiDashboardClassifyId = req.ClassifyId
+
+	err = bi_dashboard.EditDashboard(item)
+	if err != nil {
+		br.Msg = "编辑失败"
+		br.ErrMsg = "编辑失败,Err:" + err.Error()
+		return
+	}
+
+	br.Ret = 200
+	br.Success = true
+	br.IsAddLog = true
+	br.Msg = "分配成功"
+}

+ 7 - 1
models/bi_dashboard/bi_dashboard_grant.go

@@ -54,4 +54,10 @@ func MultiAddDashboardGrant(pptId int, list []*BiDashboardGrant) (err error) {
 	}
 
 	return
-}
+}
+
+// PublicDashboardReq 设置公共看板权限
+type PublicDashboardReq struct {
+	BiDashboardId int `description:"看板id" `
+	ClassifyId    int `description:"分类id"`
+}

+ 9 - 0
routers/commentsRouter.go

@@ -8323,6 +8323,15 @@ func init() {
             Filters: nil,
             Params: nil})
 
+    beego.GlobalControllerRouter["eta_gn/eta_api/controllers:BIDaShboardController"] = append(beego.GlobalControllerRouter["eta_gn/eta_api/controllers:BIDaShboardController"],
+        beego.ControllerComments{
+            Method: "Public",
+            Router: `/public`,
+            AllowHTTPMethods: []string{"post"},
+            MethodParams: param.Make(),
+            Filters: nil,
+            Params: nil})
+
     beego.GlobalControllerRouter["eta_gn/eta_api/controllers:BIDaShboardController"] = append(beego.GlobalControllerRouter["eta_gn/eta_api/controllers:BIDaShboardController"],
         beego.ControllerComments{
             Method: "PublicList",