UP 控制台模块权限化

This commit is contained in:
sc 2022-10-26 15:11:11 +08:00
parent 530390f9d4
commit 625a7303d0
4 changed files with 47 additions and 1 deletions

View File

@ -133,7 +133,8 @@
return allCompsList
},
myCompsList(){
return this.allCompsList.filter(item => !item.disabled )
var myGrid = this.$TOOL.data.get("DASHBOARDGRID")
return this.allCompsList.filter(item => !item.disabled && myGrid.includes(item.key))
},
nowCompsList(){
return this.grid.copmsList.reduce(function(a, b){return a.concat(b)})

View File

@ -106,6 +106,7 @@
}
this.$TOOL.data.set("MENU", menu.data.menu)
this.$TOOL.data.set("PERMISSIONS", menu.data.permissions)
this.$TOOL.data.set("DASHBOARDGRID", menu.data.dashboardGrid)
}else{
this.islogin = false
this.$message.warning(menu.message)

View File

@ -121,6 +121,7 @@
this.$TOOL.data.remove("USER_INFO")
this.$TOOL.data.remove("MENU")
this.$TOOL.data.remove("PERMISSIONS")
this.$TOOL.data.remove("DASHBOARDGRID")
this.$TOOL.data.remove("grid")
this.$store.commit("clearViewTags")
this.$store.commit("clearKeepLive")

View File

@ -28,6 +28,11 @@
</el-form-item>
</el-form>
</el-tab-pane>
<el-tab-pane label="控制台模块">
<div class="treeMain">
<el-tree ref="grid" node-key="key" :data="grid.list" :props="grid.props" :default-checked-keys="grid.checked" show-checkbox></el-tree>
</div>
</el-tab-pane>
<el-tab-pane label="控制台">
<el-form label-width="100px" label-position="left">
<el-form-item label="控制台视图">
@ -65,6 +70,15 @@
}
}
},
grid: {
list: [],
checked: ["welcome", "ver", "time", "progress", "echarts", "about"],
props: {
label: (data)=>{
return data.title
}
}
},
data: {
dataType :"1",
list: [],
@ -91,6 +105,7 @@
mounted() {
this.getMenu()
this.getDept()
this.getGrid()
},
methods: {
open(){
@ -132,6 +147,34 @@
let filterKeys = this.data.checked.filter(key => this.$refs.dept.getNode(key).isLeaf)
this.$refs.dept.setCheckedKeys(filterKeys, true)
})
},
getGrid(){
this.grid.list = [
{
key: "welcome",
title: "欢迎"
},
{
key: "ver",
title: "版本信息"
},
{
key: "time",
title: "时钟"
},
{
key: "progress",
title: "进度环"
},
{
key: "echarts",
title: "实时收入"
},
{
key: "about",
title: "关于项目"
}
]
}
}
}