diff --git a/src/api/role.ts b/src/api/role.ts index 0c70ab8abb7d466136fce2df711ceae057ab97b9..b885836e6f1fe69e94ce40e02cd610eb5a1034f8 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/api/user.ts b/src/api/user.ts index 9b6fab333fe7367483d8fb325b0cf8783ab0484b..944fe78138375341c86a9fc650545fde57b0300b 100644 --- a/src/api/user.ts +++ b/src/api/user.ts @@ -7,6 +7,7 @@ const Api = { getUserInfo: '/api/getUserInfo', changePassword: '/api/changePassword', pageList: '/api/user/getPageList', + list: '/api/user/getList', info: '/api/user/getInfo', add: '/api/user/add', update: '/api/user/update', @@ -44,6 +45,12 @@ export const getUserPageList = ( params, }) } +export const getUserList = (): Promise>> => { + return request>>({ + url: Api.list, + method: 'GET', + }) +} export const getUserInfo = ( userName: string ): Promise> => { diff --git a/src/components/QuickCrud/index.vue b/src/components/QuickCrud/index.vue index 92cd07a5854cc116ed465fb08e8222a6c302ef8f..5e5444f6905d34a874cb6a1216dff0dfdb4ce914 100644 --- a/src/components/QuickCrud/index.vue +++ b/src/components/QuickCrud/index.vue @@ -159,6 +159,7 @@ const emits = defineEmits([ 'onSizeChange', 'onCurrentChange', 'onSelectionChange', + 'onTableRef', ]) /** * 常规属性 @@ -374,9 +375,10 @@ const handleCustomToolbarClick = (done: any) => { /** * 选中 */ -const handleSelectionChange = (userList: Array) => { +const handleSelectionChange = (selectList: Array) => { checkDataList.length = 0 - checkDataList.push(...userList) + checkDataList.push(...selectList) + 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() @@ -449,7 +454,7 @@ onActivated(() => { :hidden-import-button="toolbar?.hiddenImportButton" :hidden-export-button="toolbar?.hiddenExportButton" :hidden-print-button="toolbar?.hiddenPrintButton" - :hidden-refres-hbutton="toolbar?.hiddenRefreshButton" + :hidden-refresh-button="toolbar?.hiddenRefreshButton" @on-add="handleAdd" @on-batch-delete="handleBatchDelete" @on-import="handleImport" @@ -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) + }) +})