refactor: 优化角色管理、用户管理相关代码

This commit is contained in:
2024-04-24 21:18:31 +08:00
parent 62d4432c00
commit efa1c32e00
9 changed files with 42 additions and 40 deletions

View File

@@ -21,7 +21,7 @@
title="功能权限"
:column="2"
size="large"
class="general-description"
class="permission general-description"
style="margin-top: 20px; position: relative"
>
<a-descriptions-item :span="2">
@@ -67,7 +67,6 @@ const { data_scope_enum } = useDict('data_scope_enum')
const { deptList, getDeptList } = useDept()
const { menuList, getMenuList } = useMenu()
const visible = ref(false)
const dataId = ref('')
const dataDetail = ref<RoleDetailResp>()
// 查询详情
@@ -76,8 +75,9 @@ const getDataDetail = async () => {
dataDetail.value = res.data
}
// 打开详情
const open = async (id: string) => {
const visible = ref(false)
// 详情
const onDetail = async (id: string) => {
if (!menuList.value.length) {
await getMenuList()
}
@@ -89,7 +89,11 @@ const open = async (id: string) => {
visible.value = true
}
defineExpose({ open })
defineExpose({ onDetail })
</script>
<style lang="scss" scoped></style>
<style lang="scss" scoped>
.permission :deep(.arco-descriptions-item-label-block) {
padding-right: 0;
}
</style>

View File

@@ -32,7 +32,7 @@
</a-button>
</template>
<template #name="{ record }">
<a-link @click="openDetail(record)">{{ record.name }}</a-link>
<a-link @click="onDetail(record)">{{ record.name }}</a-link>
</template>
<template #status="{ record }">
<GiCellStatus :status="record.status" />
@@ -74,8 +74,8 @@ import type { TableInstanceColumns } from '@/components/GiTable/type'
import { useTable } from '@/hooks'
import { useDict } from '@/hooks/app'
import { isMobile } from '@/utils'
import { DisEnableStatusList } from '@/constant/common'
import has from '@/utils/has'
import { DisEnableStatusList } from '@/constant/common'
defineOptions({ name: 'SystemRole' })
@@ -147,9 +147,9 @@ const onUpdate = (item: RoleResp) => {
}
const RoleDetailDrawerRef = ref<InstanceType<typeof RoleDetailDrawer>>()
// 打开详情
const openDetail = (item: RoleResp) => {
RoleDetailDrawerRef.value?.open(item.id)
// 详情
const onDetail = (item: RoleResp) => {
RoleDetailDrawerRef.value?.onDetail(item.id)
}
</script>