fix:1、修复项目设置没有权限但团队可见的问题

2、修复删除项目团队失败的BUG
pull/425/head
lifei6671 2018-11-15 18:31:02 +08:00
parent 31b628060b
commit 2d3b0ab674
5 changed files with 14 additions and 9 deletions

View File

@ -895,18 +895,22 @@ func (c *BookController) TeamDelete() {
teamId, _ := c.GetInt("teamId")
if teamId <= 0 {
c.JsonResult(5001,"参数错误")
}
book, err := c.IsPermission()
if err != nil {
c.JsonResult(500, err.Error())
c.JsonResult(5002, err.Error())
}
beego.Error(book)
err = models.NewTeamRelationship().DeleteByBookId(book.BookId, teamId)
if err != nil {
if err == orm.ErrNoRows {
c.JsonResult(500, "团队未加入项目")
c.JsonResult(5003, "团队未加入项目")
}
c.JsonResult(500, err.Error())
c.JsonResult(5004, err.Error())
}
c.JsonResult(0, "OK")
}

View File

@ -75,7 +75,8 @@ func (m *TeamRelationship) DeleteByBookId(bookId int, teamId int) error {
beego.Error("查询项目团队失败 ->", err)
return err
}
return m.Delete(teamId)
m.Include()
return m.Delete(m.TeamRelationshipId)
}
//保存团队项目.

View File

@ -28,9 +28,9 @@
<ul class="menu">
<li class="active"><a href="{{urlfor "BookController.Dashboard" ":key" .Model.Identify}}" class="item"><i class="fa fa-dashboard" aria-hidden="true"></i> 概要</a> </li>
<li><a href="{{urlfor "BookController.Users" ":key" .Model.Identify}}" class="item"><i class="fa fa-user" aria-hidden="true"></i> 成员</a> </li>
<li><a href="{{urlfor "BookController.Team" ":key" .Model.Identify}}" class="item"><i class="fa fa-group" aria-hidden="true"></i> 团队</a> </li>
{{if eq .Model.RoleId 0 1}}
<li><a href="{{urlfor "BookController.Setting" ":key" .Model.Identify}}" class="item"><i class="fa fa-gear" aria-hidden="true"></i> 设置</a> </li>
<li><a href="{{urlfor "BookController.Team" ":key" .Model.Identify}}" class="item"><i class="fa fa-group" aria-hidden="true"></i> 团队</a> </li>
<li><a href="{{urlfor "BookController.Setting" ":key" .Model.Identify}}" class="item"><i class="fa fa-gear" aria-hidden="true"></i> 设置</a> </li>
{{end}}
</ul>

View File

@ -29,8 +29,8 @@
<ul class="menu">
<li><a href="{{urlfor "BookController.Dashboard" ":key" .Model.Identify}}" class="item"><i class="fa fa-dashboard" aria-hidden="true"></i> 概要</a></li>
<li><a href="{{urlfor "BookController.Users" ":key" .Model.Identify}}" class="item"><i class="fa fa-user" aria-hidden="true"></i> 成员</a></li>
<li class="active"><a href="{{urlfor "BookController.Team" ":key" .Model.Identify}}" class="item"><i class="fa fa-group" aria-hidden="true"></i> 团队</a></li>
{{if eq .Model.RoleId 0 1}}
<li class="active"><a href="{{urlfor "BookController.Team" ":key" .Model.Identify}}" class="item"><i class="fa fa-group" aria-hidden="true"></i> 团队</a></li>
<li><a href="{{urlfor "BookController.Setting" ":key" .Model.Identify}}" class="item"><i class="fa fa-gear" aria-hidden="true"></i> 设置</a></li>
{{end}}
</ul>

View File

@ -23,10 +23,10 @@
<ul class="menu">
<li><a href="{{urlfor "BookController.Dashboard" ":key" .Model.Identify}}" class="item"><i class="fa fa-dashboard" aria-hidden="true"></i> 概要</a> </li>
<li class="active"><a href="{{urlfor "BookController.Users" ":key" .Model.Identify}}" class="item"><i class="fa fa-user" aria-hidden="true"></i> 成员</a> </li>
<li><a href="{{urlfor "BookController.Team" ":key" .Model.Identify}}" class="item"><i class="fa fa-group" aria-hidden="true"></i> 团队</a> </li>
{{if eq .Model.RoleId 0 1}}
<li><a href="{{urlfor "BookController.Team" ":key" .Model.Identify}}" class="item"><i class="fa fa-group" aria-hidden="true"></i> 团队</a> </li>
<li><a href="{{urlfor "BookController.Setting" ":key" .Model.Identify}}" class="item"><i class="fa fa-gear" aria-hidden="true"></i> 设置</a> </li>
{{end}}
{{end}}
</ul>
</div>