fix : 屏蔽导出修复角色权限

This commit is contained in:
2024-06-11 20:56:22 +08:00
parent 78ab1ddc45
commit a2977d0702
4 changed files with 47 additions and 36 deletions

View File

@@ -9,6 +9,7 @@ import Tag from '@/components/Tag.vue'
import { ElMessageBox, ElNotification } from 'element-plus';
import { deleteRole } from "@/api/role/role";
import { useAuthStore } from '@/stores/userstore.js'
import {getSubCompOpt} from "@/api/user/user";
const authStore = useAuthStore()
const router = useRouter()
@@ -43,7 +44,19 @@ const shortcuts = [
},
]
const searchConfig = reactive([
const searchConfig = ref([
{
label: '子公司名称',
prop: 'subCompanyId',
component: 'el-tree-select',
props: {
placeholder: '请输入',
clearable: true,
data: [],
filterable: true,
checkStrictly: true
},
},
{
label: '角色名称',
prop: 'roleName',
@@ -108,6 +121,11 @@ const tableConfig = reactive({
label: '角色权限',
align: 'center'
},
{
prop: 'companyName',
label: '公司名称',
align: 'center'
},
{
prop: 'template',
label: '是否为模版角色',
@@ -144,7 +162,7 @@ const tableConfig = reactive({
// }
// )
if(authStore.roles.includes('superAdmin')) {
btn.push({label: '删除', auth: auths.del, func: ()=>handleDel(row) , type: 'danger'})
btn.push({label: '删除', auth: auths.del, func: ()=>handleDel(row) , type: 'danger'})
} else if(!row.template) {
btn.push({label: '删除', auth: auths.del, func: ()=>handleDel(row) , type: 'danger'})
}
@@ -152,9 +170,9 @@ const tableConfig = reactive({
<div>
{
btn.map(item=>(
<el-button
type={item.type}
v-perm={item.auth}
<el-button
type={item.type}
v-perm={item.auth}
onClick={()=>item.func()}
link
>
@@ -183,20 +201,6 @@ const search = (val) => {
tableIns.value.refresh()
}
const formatDataScope = (dataScope) => {
let text = '--'
switch(dataScope) {
case '1': text = '所有数据权限'
break
case '2': text = '自定义数据权限'
break
case '3': text = '本部门数据权限'
break
case '4': text = '本部门及以下数据权限'
break
}
return text
}
const handleAdd = () => {
router.push({
@@ -229,7 +233,7 @@ const handleDel = (row) => {
// })
// return
// }
ElMessageBox.confirm('确定删除该条数据吗?', '确定删除', {
type: 'warning',
confirmButtonText: '确定',
@@ -252,8 +256,18 @@ const headBtnClick = (key) => {
}
}
const init = async () => {
if(!authStore.roles.includes('superAdmin')) {
searchConfig.value = searchConfig.value.slice(1)
}
searchConfig.value = searchConfig.value
const res = await getSubCompOpt()
searchConfig.value.find(item=>item.prop == 'subCompanyId').props.data = res.data
}
init()
</script>
<style lang="scss" scoped>
</style>
</style>