diff --git a/kinit-admin/src/api/vadmin/auth/dept.ts b/kinit-admin/src/api/vadmin/auth/dept.ts new file mode 100644 index 0000000..c40f8c0 --- /dev/null +++ b/kinit-admin/src/api/vadmin/auth/dept.ts @@ -0,0 +1,25 @@ +import request from '@/config/axios' + +export const getDeptListApi = (params: any): Promise => { + return request.get({ url: '/vadmin/auth/depts', params }) +} + +export const delDeptListApi = (data: any): Promise => { + return request.delete({ url: '/vadmin/auth/depts', data }) +} + +export const addDeptListApi = (data: any): Promise => { + return request.post({ url: '/vadmin/auth/depts', data }) +} + +export const putDeptListApi = (data: any): Promise => { + return request.put({ url: `/vadmin/auth/depts/${data.id}`, data }) +} + +export const getDeptTreeOptionsApi = (): Promise => { + return request.get({ url: '/vadmin/auth/dept/tree/options' }) +} + +export const getDeptUserTreeOptionsApi = (): Promise => { + return request.get({ url: '/vadmin/auth/dept/user/tree/options' }) +} diff --git a/kinit-admin/src/views/Vadmin/Auth/Dept/Dept.vue b/kinit-admin/src/views/Vadmin/Auth/Dept/Dept.vue new file mode 100644 index 0000000..b9e04b2 --- /dev/null +++ b/kinit-admin/src/views/Vadmin/Auth/Dept/Dept.vue @@ -0,0 +1,232 @@ + + + diff --git a/kinit-admin/src/views/Vadmin/Auth/Dept/components/Write.vue b/kinit-admin/src/views/Vadmin/Auth/Dept/components/Write.vue new file mode 100644 index 0000000..a781f49 --- /dev/null +++ b/kinit-admin/src/views/Vadmin/Auth/Dept/components/Write.vue @@ -0,0 +1,167 @@ + + + diff --git a/kinit-admin/src/views/Vadmin/Auth/Role/Role.vue b/kinit-admin/src/views/Vadmin/Auth/Role/Role.vue index a39ec84..58c9dde 100644 --- a/kinit-admin/src/views/Vadmin/Auth/Role/Role.vue +++ b/kinit-admin/src/views/Vadmin/Auth/Role/Role.vue @@ -15,7 +15,10 @@ import { Search } from '@/components/Search' import { FormSchema } from '@/components/Form' import { ContentWrap } from '@/components/ContentWrap' import Write from './components/Write.vue' +import AuthManage from './components/AuthManage.vue' import { Dialog } from '@/components/Dialog' +import { DictDetail, selectDictLabel } from '@/utils/dict' +import { useDictStore } from '@/store/modules/dict' defineOptions({ name: 'AuthRole' @@ -45,12 +48,22 @@ const { tableRegister, tableState, tableMethods } = useTable({ const { dataList, loading, total, pageSize, currentPage } = tableState const { getList, delList } = tableMethods +let dataRangeOptions = ref([]) + +const getOptions = async () => { + const dictStore = useDictStore() + const dictOptions = await dictStore.getDictObj(['sys_vadmin_data_range']) + dataRangeOptions.value = dictOptions.sys_vadmin_data_range +} + +getOptions() + const tableColumns = reactive([ { field: 'id', label: '角色编号', - show: true, - disabled: true + show: false, + disabled: false }, { field: 'name', @@ -63,6 +76,21 @@ const tableColumns = reactive([ label: '权限字符', show: true }, + { + field: 'data_range', + label: '数据范围', + show: true, + slots: { + default: (data: any) => { + const row = data.row + return ( + <> +
{selectDictLabel(unref(dataRangeOptions), row.data_range.toString())}
+ + ) + } + } + }, { field: 'order', label: '显示顺序', @@ -92,7 +120,7 @@ const tableColumns = reactive([ const row = data.row return ( <> - + ) } @@ -105,7 +133,7 @@ const tableColumns = reactive([ }, { field: 'action', - width: '150px', + width: '170px', label: '操作', show: true, slots: { @@ -125,6 +153,15 @@ const tableColumns = reactive([ > 编辑 + authManageActive(row)} + > + 权限管理 + { }) } +const authManageRef = ref>() + +// 权限管理 +const authManageActive = async (row: any) => { + const res = await getRoleApi(row.id) + if (res) { + res.data.data_range = res.data.data_range.toString() + currentRow.value = res.data + authManageRef.value?.openDrawer() + } +} + const dialogVisible = ref(false) const dialogTitle = ref('') @@ -217,15 +266,16 @@ const saveLoading = ref(false) const editAction = async (row: any) => { const res = await getRoleApi(row.id) if (res) { - dialogTitle.value = '编辑' + dialogTitle.value = '编辑角色' actionType.value = 'edit' + res.data.data_range = res.data.data_range.toString() currentRow.value = res.data dialogVisible.value = true } } const addAction = () => { - dialogTitle.value = '新增' + dialogTitle.value = '新增角色' actionType.value = 'add' currentRow.value = undefined dialogVisible.value = true @@ -298,4 +348,6 @@ const save = async () => { {{ t('dialogDemo.close') }} + + diff --git a/kinit-admin/src/views/Vadmin/Auth/Role/components/AuthManage.vue b/kinit-admin/src/views/Vadmin/Auth/Role/components/AuthManage.vue new file mode 100644 index 0000000..6f4d65c --- /dev/null +++ b/kinit-admin/src/views/Vadmin/Auth/Role/components/AuthManage.vue @@ -0,0 +1,255 @@ + + + + + + + diff --git a/kinit-admin/src/views/Vadmin/Auth/Role/components/Write.vue b/kinit-admin/src/views/Vadmin/Auth/Role/components/Write.vue index 54c8920..452bb3b 100644 --- a/kinit-admin/src/views/Vadmin/Auth/Role/components/Write.vue +++ b/kinit-admin/src/views/Vadmin/Auth/Role/components/Write.vue @@ -1,11 +1,11 @@