mirror of
https://gitee.com/huangge1199_admin/vue-pro.git
synced 2024-11-30 11:11:55 +08:00
fix: role bugs
This commit is contained in:
parent
843e521141
commit
c8c6e349ae
@ -92,9 +92,9 @@
|
|||||||
<el-select v-model="dataScopeForm.dataScope">
|
<el-select v-model="dataScopeForm.dataScope">
|
||||||
<el-option
|
<el-option
|
||||||
v-for="item in dataScopeDictDatas"
|
v-for="item in dataScopeDictDatas"
|
||||||
:key="parseInt(item.value)"
|
:key="item.value"
|
||||||
:label="item.label"
|
:label="item.label"
|
||||||
:value="parseInt(item.value)"
|
:value="item.value"
|
||||||
/>
|
/>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
@ -166,7 +166,7 @@ import { useMessage } from '@/hooks/web/useMessage'
|
|||||||
import { useVxeGrid } from '@/hooks/web/useVxeGrid'
|
import { useVxeGrid } from '@/hooks/web/useVxeGrid'
|
||||||
import { handleTree, defaultProps } from '@/utils/tree'
|
import { handleTree, defaultProps } from '@/utils/tree'
|
||||||
import { SystemDataScopeEnum } from '@/utils/constants'
|
import { SystemDataScopeEnum } from '@/utils/constants'
|
||||||
import { DICT_TYPE, getDictOptions } from '@/utils/dict'
|
import { DICT_TYPE, getIntDictOptions } from '@/utils/dict'
|
||||||
import { rules, allSchemas } from './role.data'
|
import { rules, allSchemas } from './role.data'
|
||||||
import * as RoleApi from '@/api/system/role'
|
import * as RoleApi from '@/api/system/role'
|
||||||
import { listSimpleMenusApi } from '@/api/system/menu'
|
import { listSimpleMenusApi } from '@/api/system/menu'
|
||||||
@ -301,18 +301,20 @@ const handleScope = async (type: string, row: RoleApi.RoleVO) => {
|
|||||||
}
|
}
|
||||||
// 保存权限
|
// 保存权限
|
||||||
const submitScope = async () => {
|
const submitScope = async () => {
|
||||||
const keys = treeRef.value!.getCheckedKeys(false) as unknown as Array<number>
|
|
||||||
if ('data' === actionScopeType.value) {
|
if ('data' === actionScopeType.value) {
|
||||||
const data = ref<PermissionApi.PermissionAssignRoleDataScopeReqVO>({
|
const data = ref<PermissionApi.PermissionAssignRoleDataScopeReqVO>({
|
||||||
roleId: dataScopeForm.id,
|
roleId: dataScopeForm.id,
|
||||||
dataScope: dataScopeForm.dataScope,
|
dataScope: dataScopeForm.dataScope,
|
||||||
dataScopeDeptIds: dataScopeForm.dataScope !== SystemDataScopeEnum.DEPT_CUSTOM ? [] : keys
|
dataScopeDeptIds:
|
||||||
|
dataScopeForm.dataScope !== SystemDataScopeEnum.DEPT_CUSTOM
|
||||||
|
? []
|
||||||
|
: (treeRef.value!.getCheckedKeys(false) as unknown as Array<number>)
|
||||||
})
|
})
|
||||||
await PermissionApi.assignRoleDataScopeApi(data.value)
|
await PermissionApi.assignRoleDataScopeApi(data.value)
|
||||||
} else if ('menu' === actionScopeType.value) {
|
} else if ('menu' === actionScopeType.value) {
|
||||||
const data = ref<PermissionApi.PermissionAssignRoleMenuReqVO>({
|
const data = ref<PermissionApi.PermissionAssignRoleMenuReqVO>({
|
||||||
roleId: dataScopeForm.id,
|
roleId: dataScopeForm.id,
|
||||||
menuIds: keys
|
menuIds: treeRef.value!.getCheckedKeys(false) as unknown as Array<number>
|
||||||
})
|
})
|
||||||
await PermissionApi.assignRoleMenuApi(data.value)
|
await PermissionApi.assignRoleMenuApi(data.value)
|
||||||
}
|
}
|
||||||
@ -320,7 +322,7 @@ const submitScope = async () => {
|
|||||||
dialogScopeVisible.value = false
|
dialogScopeVisible.value = false
|
||||||
}
|
}
|
||||||
const init = () => {
|
const init = () => {
|
||||||
dataScopeDictDatas.value = getDictOptions(DICT_TYPE.SYSTEM_DATA_SCOPE)
|
dataScopeDictDatas.value = getIntDictOptions(DICT_TYPE.SYSTEM_DATA_SCOPE)
|
||||||
}
|
}
|
||||||
// ========== 初始化 ==========
|
// ========== 初始化 ==========
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
|
Loading…
Reference in New Issue
Block a user