新增目录菜单的删除功能,下级有目录时间无法删除
This commit is contained in:
@ -4,6 +4,7 @@ import java.util.List;
|
|||||||
|
|
||||||
import com.ruoyi.common.core.domain.entity.SysUser;
|
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||||
import com.ruoyi.common.core.domain.model.LoginUser;
|
import com.ruoyi.common.core.domain.model.LoginUser;
|
||||||
|
import com.sun.org.apache.bcel.internal.generic.NEW;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.security.core.Authentication;
|
import org.springframework.security.core.Authentication;
|
||||||
@ -123,8 +124,31 @@ public class SqMenuController extends BaseController
|
|||||||
@PreAuthorize("@ss.hasPermi('bookmark:menu:remove')")
|
@PreAuthorize("@ss.hasPermi('bookmark:menu:remove')")
|
||||||
@Log(title = "书签菜单", businessType = BusinessType.DELETE)
|
@Log(title = "书签菜单", businessType = BusinessType.DELETE)
|
||||||
@DeleteMapping("/{menuIds}")
|
@DeleteMapping("/{menuIds}")
|
||||||
public AjaxResult remove(@PathVariable Long[] menuIds)
|
public AjaxResult removes(@PathVariable Long[] menuIds)
|
||||||
{
|
{
|
||||||
return toAjax(sqMenuService.deleteSqMenuByIds(menuIds));
|
return toAjax(sqMenuService.deleteSqMenuByIds(menuIds));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除书签菜单
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Log(title = "书签菜单", businessType = BusinessType.DELETE)
|
||||||
|
@DeleteMapping("/delete/{menuId}")
|
||||||
|
public AjaxResult remove(@PathVariable Long menuId)
|
||||||
|
{
|
||||||
|
SysUser sysUser=getAuthUser();
|
||||||
|
//查询目录下是否还有目录
|
||||||
|
SqMenu sqMenu=new SqMenu();
|
||||||
|
sqMenu.setParentId(menuId);
|
||||||
|
List<SqMenu> sqMenuList=sqMenuService.selectSqMenuList(sqMenu);
|
||||||
|
if (sqMenuList==null||sqMenuList.isEmpty()){
|
||||||
|
return toAjax(sqMenuService.deleteSqMenuById(menuId,sysUser.getUserId()));
|
||||||
|
}else{
|
||||||
|
return AjaxResult.error("删除失败,该目录下级还有目录菜单");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -49,7 +49,7 @@ export function updateMenu(data) {
|
|||||||
// 删除书签菜单
|
// 删除书签菜单
|
||||||
export function delMenu(menuId) {
|
export function delMenu(menuId) {
|
||||||
return request({
|
return request({
|
||||||
url: '/bookmark/menu/' + menuId,
|
url: '/bookmark/menu/delete/' + menuId,
|
||||||
method: 'delete'
|
method: 'delete'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -69,7 +69,7 @@
|
|||||||
<hr class="bookamrk-hr"/>
|
<hr class="bookamrk-hr"/>
|
||||||
<el-col :span="24" v-for="bm in bookmarkList">
|
<el-col :span="24" v-for="bm in bookmarkList">
|
||||||
|
|
||||||
<div class="bookmark">
|
<div class="bookmark" :data-id="bm.id" @click="windowurl(bm.url,bm.bookmarkId)">
|
||||||
<p class="bookmark-title">{{bm.title}}</p>
|
<p class="bookmark-title">{{bm.title}}</p>
|
||||||
<div class="">
|
<div class="">
|
||||||
<p class="description">{{bm.description}}</p>
|
<p class="description">{{bm.description}}</p>
|
||||||
@ -138,6 +138,7 @@
|
|||||||
start: undefined,
|
start: undefined,
|
||||||
},
|
},
|
||||||
bookmarkList:[],
|
bookmarkList:[],
|
||||||
|
urltext:'?from=yunshuqian.com',//网址域名起推广作用
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
filters: {
|
filters: {
|
||||||
@ -175,11 +176,32 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
windowurl(url,bookmarkId){
|
||||||
|
// window.open(url+this.urltext);
|
||||||
|
window.open(url);
|
||||||
|
|
||||||
|
|
||||||
|
//如果是回收站打开的 就修改状态
|
||||||
|
// if (this.$route.params.menuId=6666){
|
||||||
|
// this.$axios.get(`/api/bookmark/updateBookmarkStart?bookmarkId=${bookmarkId}`).then(response => {
|
||||||
|
//
|
||||||
|
// if (response.status == 200 && response.data.status == 'success') {
|
||||||
|
// this.momentlList()
|
||||||
|
// this.$message({type: 'success', message: '此书签被打开,移除稍后再看,并且公开显示!'})
|
||||||
|
//
|
||||||
|
// }else {
|
||||||
|
// this.$message({type: 'error', message: '移除失败!'})
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// });
|
||||||
|
// }
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
<el-container>
|
<el-container>
|
||||||
<transition name="el-zoom-in-left">
|
<transition name="el-zoom-in-left">
|
||||||
<el-aside width="300px" style="height:900px" v-show="isShowZtree" class="transition-box">
|
<el-aside width="300px" style="height:900px;box-shadow: inset -1px 0 0 rgba(0,0,0,.1);" v-show="isShowZtree" class="transition-box">
|
||||||
|
|
||||||
|
|
||||||
<el-header class="aside-logo">
|
<el-header class="aside-logo">
|
||||||
@ -137,6 +137,10 @@
|
|||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
<div slot="footer" class="dialog-footer">
|
<div slot="footer" class="dialog-footer">
|
||||||
|
|
||||||
|
<el-button type="danger" round @click="deleteMmenu(form.menuId)">删除</el-button>
|
||||||
|
|
||||||
|
|
||||||
<el-button type="primary" round @click="submitForm">确定</el-button>
|
<el-button type="primary" round @click="submitForm">确定</el-button>
|
||||||
<el-button round @click="cancel">取消</el-button>
|
<el-button round @click="cancel">取消</el-button>
|
||||||
|
|
||||||
@ -273,7 +277,7 @@
|
|||||||
getTreeselect() {
|
getTreeselect() {
|
||||||
listMenuByUserId().then(response => {
|
listMenuByUserId().then(response => {
|
||||||
this.menuOptions = [];
|
this.menuOptions = [];
|
||||||
const data = { menuId: 0, menuName: '顶级节点', children: [] };
|
const data = { menuId: 0, menuName: '顶级菜单', children: [] };
|
||||||
data.children = this.handleTree(response.data, "menuId", "parentId");
|
data.children = this.handleTree(response.data, "menuId", "parentId");
|
||||||
this.menuOptions.push(data);
|
this.menuOptions.push(data);
|
||||||
});
|
});
|
||||||
@ -298,6 +302,12 @@
|
|||||||
this.$refs["form"].validate(valid => {
|
this.$refs["form"].validate(valid => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
if (this.form.menuId != undefined) {
|
if (this.form.menuId != undefined) {
|
||||||
|
if (this.form.menuId==this.form.parentId){
|
||||||
|
this.msgError("不能讲上级菜单设置为本身");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
updateMenu(this.form).then(response => {
|
updateMenu(this.form).then(response => {
|
||||||
if (response.code === 200) {
|
if (response.code === 200) {
|
||||||
this.msgSuccess("修改成功");
|
this.msgSuccess("修改成功");
|
||||||
@ -465,6 +475,33 @@
|
|||||||
return false;
|
return false;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
//删除书签目录
|
||||||
|
deleteMmenu(menuId){
|
||||||
|
|
||||||
|
this.$confirm('是否删除此目录菜单?', '提示', {
|
||||||
|
confirmButtonText: '确定',
|
||||||
|
cancelButtonText: '取消',
|
||||||
|
type: 'warning'
|
||||||
|
}).then(() => {
|
||||||
|
delMenu(menuId).then(response => {
|
||||||
|
// if(){}
|
||||||
|
this.$message({
|
||||||
|
type: 'success',
|
||||||
|
message: '删除成功!'
|
||||||
|
});
|
||||||
|
|
||||||
|
this.open = false;
|
||||||
|
this.getList();
|
||||||
|
});
|
||||||
|
}).catch(() => {
|
||||||
|
this.$message({
|
||||||
|
type: 'info',
|
||||||
|
message: '已取消删除'
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
},
|
},
|
||||||
mounted(){
|
mounted(){
|
||||||
window['editBookmark'] = (e) => {
|
window['editBookmark'] = (e) => {
|
||||||
@ -479,6 +516,8 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
<style >
|
<style >
|
||||||
@ -569,7 +608,7 @@
|
|||||||
margin-right: 11px;
|
margin-right: 11px;
|
||||||
}
|
}
|
||||||
.aside-logo{
|
.aside-logo{
|
||||||
background-color: #fff;
|
/*background-color: #fff;*/
|
||||||
opacity: 0.9;
|
opacity: 0.9;
|
||||||
}
|
}
|
||||||
.aside-logo img{
|
.aside-logo img{
|
||||||
|
@ -61,7 +61,7 @@ public interface SqMenuMapper extends MyMapper<SqMenu>
|
|||||||
* @param menuId 书签菜单ID
|
* @param menuId 书签菜单ID
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int deleteSqMenuById(Long menuId);
|
public int deleteSqMenuById(@Param("menuId")Long menuId,@Param("userId")Long userId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 批量删除书签菜单
|
* 批量删除书签菜单
|
||||||
|
@ -65,5 +65,5 @@ public interface ISqMenuService
|
|||||||
* @param menuId 书签菜单ID
|
* @param menuId 书签菜单ID
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int deleteSqMenuById(Long menuId);
|
public int deleteSqMenuById(Long menuId,Long userId);
|
||||||
}
|
}
|
||||||
|
@ -101,8 +101,8 @@ public class SqMenuServiceImpl implements ISqMenuService
|
|||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int deleteSqMenuById(Long menuId)
|
public int deleteSqMenuById(Long menuId,Long userId)
|
||||||
{
|
{
|
||||||
return sqMenuMapper.deleteSqMenuById(menuId);
|
return sqMenuMapper.deleteSqMenuById(menuId,userId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -73,8 +73,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
where menu_id = #{menuId}
|
where menu_id = #{menuId}
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
<delete id="deleteSqMenuById" parameterType="Long">
|
<delete id="deleteSqMenuById" parameterType="SqMenu">
|
||||||
delete from sq_menu where menu_id = #{menuId}
|
delete from sq_menu where menu_id = #{menuId} and user_id = #{userId}
|
||||||
</delete>
|
</delete>
|
||||||
|
|
||||||
<delete id="deleteSqMenuByIds" parameterType="String">
|
<delete id="deleteSqMenuByIds" parameterType="String">
|
||||||
|
Reference in New Issue
Block a user