diff --git a/src/api/role.ts b/src/api/role.ts index 0c70ab8abb7d466136fce2df711ceae057ab97b9..c253c89d37573630209b03eac091d2ee6113d917 100644 --- a/src/api/role.ts +++ b/src/api/role.ts @@ -1,4 +1,5 @@ import { Menu } from '@/types/menu' +import { User } from '@/types/user' import { Role } from '../types/role' import request, { QuickResponseData } from '../utils/request' @@ -23,6 +24,17 @@ export const getMenuPermission = ( }, }) } +export const getUserPermission = ( + roleId: string +): Promise>> => { + return request>>({ + url: Api.userList, + method: 'GET', + params: { + id: roleId, + }, + }) +} export const getRoleList = (): Promise>> => { return request>>({ diff --git a/src/components/QuickCrud/index.vue b/src/components/QuickCrud/index.vue index 92cd07a5854cc116ed465fb08e8222a6c302ef8f..cf5fbdc71910d51e93c3da063821e68edb6c0704 100644 --- a/src/components/QuickCrud/index.vue +++ b/src/components/QuickCrud/index.vue @@ -159,6 +159,7 @@ const emits = defineEmits([ 'onSizeChange', 'onCurrentChange', 'onSelectionChange', + 'onTableRef', ]) /** * 常规属性 @@ -377,6 +378,7 @@ const handleCustomToolbarClick = (done: any) => { const handleSelectionChange = (userList: Array) => { checkDataList.length = 0 checkDataList.push(...userList) + emits('onSelectionChange', checkDataList) } /** * 分页 @@ -394,6 +396,9 @@ const handleCurrentChange = (val: number) => { const handleDone = () => { load() } +const handleTbaleRef = (tableRef: any): void => { + emits('onTableRef', tableRef) +} onMounted(() => { if (leftTree.value) { treeLoad() @@ -473,6 +478,7 @@ onActivated(() => { @on-row-detail="handleDetail" @on-selection-change="handleSelectionChange" @on-done="handleDone" + @on-table-ref="handleTbaleRef" > -import { defineProps, defineEmits, toRefs, Ref } from 'vue' +import { ElTable } from 'element-plus' +import { + defineProps, + defineEmits, + toRefs, + Ref, + ref, + onMounted, + nextTick, +} from 'vue' import { Column, Actionbar } from '../../types/table' /** * props @@ -86,6 +95,7 @@ const { * 类型转换 */ const actionbar = tableActionbar.value as Actionbar +const tableRef = ref>() /** * emits */ @@ -95,6 +105,7 @@ const emits = defineEmits([ 'onRowDelete', 'onRowDetail', 'onDone', + 'onTableRef', ]) /** *函数 @@ -108,9 +119,15 @@ const getActionbarWidth = () => { const handleSelectionChange = (val: any) => { emits('onSelectionChange', val) } +onMounted(() => { + nextTick(() => { + emits('onTableRef', tableRef) + }) +})