底座bug修改

This commit is contained in:
bimei 2023-03-02 09:47:36 +08:00
parent 5718c78811
commit a16751f258
4 changed files with 96 additions and 34 deletions

View File

@ -99,37 +99,47 @@
</el-select> </el-select>
</el-form-item> </el-form-item>
<!-- 分配角色的菜单权限对话框 --> <!-- 分配角色的菜单权限对话框 -->
<el-form-item <el-row>
label="权限范围" <el-col :span="24">
v-if=" <el-form-item
actionScopeType === 'menu' || dataScopeForm.dataScope === SystemDataScopeEnum.DEPT_CUSTOM label="权限范围"
" v-if="
> actionScopeType === 'menu' ||
<el-card shadow="never"> dataScopeForm.dataScope === SystemDataScopeEnum.DEPT_CUSTOM
<template #header> "
父子联动(选中父节点自动选择子节点): style="display: flex"
<el-switch v-model="checkStrictly" inline-prompt active-text="" inactive-text="" /> >
全选/全不选: <el-card class="card" shadow="never">
<el-switch <template #header>
v-model="treeNodeAll" 父子联动(选中父节点自动选择子节点):
inline-prompt <el-switch
active-text="是" v-model="checkStrictly"
inactive-text="否" inline-prompt
@change="handleCheckedTreeNodeAll()" active-text="是"
/> inactive-text="否"
</template> />
<el-tree 全选/全不选:
ref="treeRef" <el-switch
node-key="id" v-model="treeNodeAll"
show-checkbox inline-prompt
:default-checked-keys="defaultCheckedKeys" active-text="是"
:check-strictly="!checkStrictly" inactive-text="否"
:props="defaultProps" @change="handleCheckedTreeNodeAll()"
:data="treeOptions" />
empty-text="加载中,请稍后" </template>
/> <el-tree
</el-card> ref="treeRef"
</el-form-item> node-key="id"
show-checkbox
:default-checked-keys="defaultCheckedKeys"
:check-strictly="!checkStrictly"
:props="defaultProps"
:data="treeOptions"
empty-text="加载中,请稍后"
/>
</el-card>
</el-form-item> </el-col
></el-row>
</el-form> </el-form>
<!-- 操作按钮 --> <!-- 操作按钮 -->
<template #footer> <template #footer>
@ -312,3 +322,10 @@ onMounted(() => {
init() init()
}) })
</script> </script>
<style scoped>
.card {
width: 100%;
max-height: 400px;
overflow-y: scroll;
}
</style>

View File

@ -25,7 +25,7 @@
ref="formRef" ref="formRef"
> >
<template #menuIds> <template #menuIds>
<el-card class="w-120"> <el-card>
<template #header> <template #header>
<div class="card-header"> <div class="card-header">
全选/全不选: 全选/全不选:
@ -91,6 +91,16 @@ const dialogTitle = ref('edit') // 弹出层标题
const handleCheckedTreeNodeAll = () => { const handleCheckedTreeNodeAll = () => {
treeRef.value!.setCheckedNodes(treeNodeAll.value ? menuOptions.value : []) treeRef.value!.setCheckedNodes(treeNodeAll.value ? menuOptions.value : [])
} }
const validateCategory = (rule: any, value: any, callback: any) => {
if (!treeRef.value!.getCheckedKeys().length) {
callback(new Error('该项为必填项'))
} else {
callback()
}
}
rules.menuIds = [{ required: true, validator: validateCategory, trigger: 'blur' }]
const getTree = async () => { const getTree = async () => {
const res = await listSimpleMenusApi() const res = await listSimpleMenusApi()
menuOptions.value = handleTree(res) menuOptions.value = handleTree(res)
@ -166,3 +176,10 @@ onMounted(async () => {
}) })
// getList() // getList()
</script> </script>
<style scoped>
.el-card {
width: 100%;
max-height: 400px;
overflow-y: scroll;
}
</style>

View File

@ -33,7 +33,12 @@ const crudSchemas = reactive<VxeCrudSchema>({
{ {
title: '菜单权限', title: '菜单权限',
field: 'menuIds', field: 'menuIds',
isTable: false isTable: false,
form: {
colProps: {
span: 24
}
}
}, },
{ {
title: t('form.remark'), title: t('form.remark'),

View File

@ -159,7 +159,7 @@
:data="detailData" :data="detailData"
> >
<template #deptId="{ row }"> <template #deptId="{ row }">
<span>{{ row.dept?.name }}</span> <el-tag>{{ dataFormater(row.deptId) }}</el-tag>
</template> </template>
<template #postIds="{ row }"> <template #postIds="{ row }">
<template v-if="row.postIds !== ''"> <template v-if="row.postIds !== ''">
@ -332,6 +332,29 @@ const getPostOptions = async () => {
const res = await listSimplePostsApi() const res = await listSimplePostsApi()
postOptions.value.push(...res) postOptions.value.push(...res)
} }
const dataFormater = (val) => {
return deptFormater(deptOptions.value, val)
}
//
const deptFormater = (ary, val: any) => {
var o = ''
if (ary && val) {
for (const v of ary) {
if (v.id == val) {
o = v.name
if (o) return o
} else if (v.children?.length) {
o = deptFormater(v.children, val)
if (o) return o
}
}
return o
} else {
return val
}
}
// //
const setDialogTile = async (type: string) => { const setDialogTile = async (type: string) => {
dialogTitle.value = t('action.' + type) dialogTitle.value = t('action.' + type)