diff --git a/apps/vben5/packages/@abp/auditing/src/components/audit-logs/AuditLogTable.vue b/apps/vben5/packages/@abp/auditing/src/components/audit-logs/AuditLogTable.vue index cc97d7b5b..5eb7e7e92 100644 --- a/apps/vben5/packages/@abp/auditing/src/components/audit-logs/AuditLogTable.vue +++ b/apps/vben5/packages/@abp/auditing/src/components/audit-logs/AuditLogTable.vue @@ -1,5 +1,4 @@ diff --git a/apps/vben5/packages/@abp/identity/src/components/organization-units/SelectRoleModal.vue b/apps/vben5/packages/@abp/identity/src/components/organization-units/SelectRoleModal.vue index ec5e33f3f..9f34ab20f 100644 --- a/apps/vben5/packages/@abp/identity/src/components/organization-units/SelectRoleModal.vue +++ b/apps/vben5/packages/@abp/identity/src/components/organization-units/SelectRoleModal.vue @@ -68,27 +68,30 @@ const [Modal, modalApi] = useVbenModal({ }); const gridOptions: VxeGridProps = { - checkboxConfig: { - highlight: true, - labelField: 'name', - }, columns: [ + { + align: 'center', + type: 'checkbox', + width: 80, + }, { align: 'left', field: 'name', + sortable: true, title: $t('AbpIdentity.DisplayName:RoleName'), - type: 'checkbox', }, ], exportConfig: {}, keepSource: true, proxyConfig: { ajax: { - query: async ({ page }, formValues) => { + query: async ({ page, sort }, formValues) => { + const sorting = sort.order ? `${sort.field} ${sort.order}` : undefined; const state = modalApi.getData>(); return await getUnaddedRoleListApi({ id: state.id, maxResultCount: page.pageSize, + sorting, skipCount: (page.currentPage - 1) * page.pageSize, ...formValues, }); @@ -100,7 +103,11 @@ const gridOptions: VxeGridProps = { list: 'items', }, }, - toolbarConfig: {}, + toolbarConfig: { + refresh: { + code: 'query', + }, + }, }; const gridEvents: VxeGridListeners = { @@ -110,15 +117,18 @@ const gridEvents: VxeGridListeners = { checkboxChange: (e) => { selectedRoles.value = e.records; }, + sortChange: () => { + gridApi.query(); + }, }; -const [Grid, { query }] = useVbenVxeGrid({ +const [Grid, gridApi] = useVbenVxeGrid({ formOptions, gridEvents, gridOptions, }); function onRefresh() { - nextTick(query); + nextTick(gridApi.query); } diff --git a/apps/vben5/packages/@abp/identity/src/components/roles/RoleTable.vue b/apps/vben5/packages/@abp/identity/src/components/roles/RoleTable.vue index b64758168..85aad1ba7 100644 --- a/apps/vben5/packages/@abp/identity/src/components/roles/RoleTable.vue +++ b/apps/vben5/packages/@abp/identity/src/components/roles/RoleTable.vue @@ -37,7 +37,6 @@ const MenuOutlined = createIconifyIcon('heroicons-outline:menu-alt-3'); const ClaimOutlined = createIconifyIcon('la:id-card-solid'); const PermissionsOutlined = createIconifyIcon('icon-park-outline:permissions'); const AuditLogIcon = createIconifyIcon('fluent-mdl2:compliance-audit'); -const ProtectedIcon = createIconifyIcon('mdi:protected-outline'); const RoleModal = defineAsyncComponent(() => import('./RoleModal.vue')); const ClaimModal = defineAsyncComponent(() => import('./RoleClaimModal.vue')); @@ -88,6 +87,7 @@ const gridOptions: VxeGridProps = { align: 'left', field: 'name', slots: { default: 'name' }, + sortable: true, title: $t('AbpIdentity.DisplayName:RoleName'), }, { @@ -102,8 +102,10 @@ const gridOptions: VxeGridProps = { keepSource: true, proxyConfig: { ajax: { - query: async ({ page }, formValues) => { + query: async ({ page, sort }, formValues) => { + const sorting = sort.order ? `${sort.field} ${sort.order}` : undefined; return await getPagedListApi({ + sorting, maxResultCount: page.pageSize, skipCount: (page.currentPage - 1) * page.pageSize, ...formValues, @@ -118,19 +120,23 @@ const gridOptions: VxeGridProps = { toolbarConfig: { custom: true, export: true, - // import: true, - refresh: true, + refresh: { + code: 'query', + }, zoom: true, }, }; const gridEvents: VxeGridListeners = { cellClick: () => {}, + sortChange: () => { + gridApi.query(); + }, }; const [RoleEditModal, roleModalApi] = useVbenModal({ connectedComponent: RoleModal, }); -const [Grid, { query }] = useVbenVxeGrid({ +const [Grid, gridApi] = useVbenVxeGrid({ formOptions, gridEvents, gridOptions, @@ -156,7 +162,7 @@ const handleDelete = (row: IdentityRoleDto) => { onOk: async () => { await deleteApi(row.id); message.success($t('AbpUi.DeletedSuccessfully')); - query(); + gridApi.query(); }, title: $t('AbpUi.AreYouSure'), }); @@ -291,7 +297,7 @@ function onPermissionChange(_name: string, key: string) { > {{ $t('AbpAuditLogging.EntitiesChanged') }} - + {{ '数据权限' }} @@ -301,8 +307,8 @@ function onPermissionChange(_name: string, key: string) { - - + + diff --git a/apps/vben5/packages/@abp/identity/src/components/security-logs/SecurityLogTable.vue b/apps/vben5/packages/@abp/identity/src/components/security-logs/SecurityLogTable.vue index fc3d3ae42..ef0910f31 100644 --- a/apps/vben5/packages/@abp/identity/src/components/security-logs/SecurityLogTable.vue +++ b/apps/vben5/packages/@abp/identity/src/components/security-logs/SecurityLogTable.vue @@ -1,5 +1,4 @@ - - - - + + + + diff --git a/apps/vben5/packages/@abp/localization/src/components/languages/LocalizationLanguageTable.vue b/apps/vben5/packages/@abp/localization/src/components/languages/LocalizationLanguageTable.vue index e70fc11fe..5e1620476 100644 --- a/apps/vben5/packages/@abp/localization/src/components/languages/LocalizationLanguageTable.vue +++ b/apps/vben5/packages/@abp/localization/src/components/languages/LocalizationLanguageTable.vue @@ -5,12 +5,12 @@ import type { VbenFormProps } from '@vben/common-ui'; import type { LanguageDto } from '../../types/languages'; -import { defineAsyncComponent, h, onMounted, reactive, ref } from 'vue'; +import { defineAsyncComponent, h, onMounted, ref } from 'vue'; import { useVbenModal } from '@vben/common-ui'; import { $t } from '@vben/locales'; -import { useAbpStore } from '@abp/core'; +import { sortby, useAbpStore } from '@abp/core'; import { useVbenVxeGrid } from '@abp/ui'; import { DeleteOutlined, @@ -28,11 +28,6 @@ defineOptions({ }); const dataSource = ref([]); -const pageState = reactive({ - current: 1, - size: 10, - total: 0, -}); const abpStore = useAbpStore(); const { deleteApi, getListApi } = useLanguagesApi(); @@ -43,7 +38,6 @@ const formOptions: VbenFormProps = { collapsed: false, handleReset: onReset, async handleSubmit(params) { - pageState.current = 1; await onGet(params); }, schema: [ @@ -66,18 +60,21 @@ const gridOptions: VxeGridProps = { align: 'left', field: 'cultureName', minWidth: 150, + sortable: true, title: $t('AbpLocalization.DisplayName:CultureName'), }, { align: 'left', field: 'displayName', minWidth: 150, + sortable: true, title: $t('AbpLocalization.DisplayName:DisplayName'), }, { align: 'left', field: 'uiCultureName', minWidth: 150, + sortable: true, title: $t('AbpLocalization.DisplayName:UiCultureName'), }, { @@ -90,6 +87,30 @@ const gridOptions: VxeGridProps = { ], exportConfig: {}, keepSource: true, + proxyConfig: { + ajax: { + query: async ({ page, sort }) => { + let items = sortby(dataSource.value, sort.field); + if (sort.order === 'desc') { + items = items.reverse(); + } + const result = { + totalCount: dataSource.value.length, + items: items.slice( + (page.currentPage - 1) * page.pageSize, + page.currentPage * page.pageSize, + ), + }; + return new Promise((resolve) => { + resolve(result); + }); + }, + }, + response: { + total: 'totalCount', + list: 'items', + }, + }, toolbarConfig: { custom: true, export: true, @@ -99,10 +120,8 @@ const gridOptions: VxeGridProps = { }; const gridEvents: VxeGridListeners = { - pageChange(params) { - pageState.current = params.currentPage; - pageState.size = params.pageSize; - onPageChange(); + sortChange: () => { + gridApi.query(); }, }; @@ -122,9 +141,8 @@ async function onGet(input?: Record) { try { gridApi.setLoading(true); const { items } = await getListApi(input); - pageState.total = items.length; dataSource.value = items; - onPageChange(); + setTimeout(() => gridApi.reload(), 100); } finally { gridApi.setLoading(false); } @@ -136,21 +154,6 @@ async function onReset() { await onGet(input); } -function onPageChange() { - const items = dataSource.value.slice( - (pageState.current - 1) * pageState.size, - pageState.current * pageState.size, - ); - gridApi.setGridOptions({ - data: items, - pagerConfig: { - currentPage: pageState.current, - pageSize: pageState.size, - total: pageState.total, - }, - }); -} - function onCreate() { modalApi.setData({}); modalApi.open(); diff --git a/apps/vben5/packages/@abp/localization/src/components/resources/LocalizationResourceTable.vue b/apps/vben5/packages/@abp/localization/src/components/resources/LocalizationResourceTable.vue index 3a1c6f7d0..17588471e 100644 --- a/apps/vben5/packages/@abp/localization/src/components/resources/LocalizationResourceTable.vue +++ b/apps/vben5/packages/@abp/localization/src/components/resources/LocalizationResourceTable.vue @@ -5,12 +5,12 @@ import type { VbenFormProps } from '@vben/common-ui'; import type { ResourceDto } from '../../types/resources'; -import { defineAsyncComponent, h, onMounted, reactive, ref } from 'vue'; +import { defineAsyncComponent, h, onMounted, ref } from 'vue'; import { useVbenModal } from '@vben/common-ui'; import { $t } from '@vben/locales'; -import { useAbpStore } from '@abp/core'; +import { sortby, useAbpStore } from '@abp/core'; import { useVbenVxeGrid } from '@abp/ui'; import { DeleteOutlined, @@ -28,12 +28,6 @@ defineOptions({ }); const dataSource = ref([]); -const pageState = reactive({ - current: 1, - size: 10, - total: 0, -}); - const abpStore = useAbpStore(); const { deleteApi, getListApi } = useResourcesApi(); const { getLocalizationApi } = useLocalizationsApi(); @@ -43,7 +37,6 @@ const formOptions: VbenFormProps = { collapsed: false, handleReset: onReset, async handleSubmit(params) { - pageState.current = 1; await onGet(params); }, schema: [ @@ -66,12 +59,14 @@ const gridOptions: VxeGridProps = { align: 'left', field: 'name', minWidth: 150, + sortable: true, title: $t('AbpFeatureManagement.DisplayName:Name'), }, { align: 'left', field: 'displayName', minWidth: 150, + sortable: true, title: $t('AbpFeatureManagement.DisplayName:DisplayName'), }, { @@ -84,6 +79,30 @@ const gridOptions: VxeGridProps = { ], exportConfig: {}, keepSource: true, + proxyConfig: { + ajax: { + query: async ({ page, sort }) => { + let items = sortby(dataSource.value, sort.field); + if (sort.order === 'desc') { + items = items.reverse(); + } + const result = { + totalCount: dataSource.value.length, + items: items.slice( + (page.currentPage - 1) * page.pageSize, + page.currentPage * page.pageSize, + ), + }; + return new Promise((resolve) => { + resolve(result); + }); + }, + }, + response: { + total: 'totalCount', + list: 'items', + }, + }, toolbarConfig: { custom: true, export: true, @@ -93,10 +112,8 @@ const gridOptions: VxeGridProps = { }; const gridEvents: VxeGridListeners = { - pageChange(params) { - pageState.current = params.currentPage; - pageState.size = params.pageSize; - onPageChange(); + sortChange: () => { + gridApi.query(); }, }; @@ -116,9 +133,8 @@ async function onGet(input?: Record) { try { gridApi.setLoading(true); const { items } = await getListApi(input); - pageState.total = items.length; dataSource.value = items; - onPageChange(); + setTimeout(() => gridApi.reload(), 100); } finally { gridApi.setLoading(false); } @@ -130,21 +146,6 @@ async function onReset() { await onGet(input); } -function onPageChange() { - const items = dataSource.value.slice( - (pageState.current - 1) * pageState.size, - pageState.current * pageState.size, - ); - gridApi.setGridOptions({ - data: items, - pagerConfig: { - currentPage: pageState.current, - pageSize: pageState.size, - total: pageState.total, - }, - }); -} - function onCreate() { modalApi.setData({}); modalApi.open(); diff --git a/apps/vben5/packages/@abp/localization/src/components/texts/LocalizationTextTable.vue b/apps/vben5/packages/@abp/localization/src/components/texts/LocalizationTextTable.vue index 4b0dada4e..dac88ef0c 100644 --- a/apps/vben5/packages/@abp/localization/src/components/texts/LocalizationTextTable.vue +++ b/apps/vben5/packages/@abp/localization/src/components/texts/LocalizationTextTable.vue @@ -11,7 +11,7 @@ import { defineAsyncComponent, h, onMounted, reactive, ref } from 'vue'; import { useVbenModal } from '@vben/common-ui'; import { $t } from '@vben/locales'; -import { useAbpStore } from '@abp/core'; +import { sortby, useAbpStore } from '@abp/core'; import { useVbenVxeGrid } from '@abp/ui'; import { EditOutlined, PlusOutlined } from '@ant-design/icons-vue'; import { Button, Select } from 'ant-design-vue'; @@ -39,11 +39,6 @@ const targetValueOptions = reactive([ value: 'true', }, ]); -const pageState = reactive({ - current: 1, - size: 10, - total: 0, -}); const abpStore = useAbpStore(); const { getListApi } = useTextsApi(); @@ -61,10 +56,8 @@ const formOptions: VbenFormProps = { class: 'w-full', }, }, - compact: false, handleReset: onReset, async handleSubmit(params) { - pageState.current = 1; await onGet(params); }, schema: [ @@ -111,24 +104,28 @@ const gridOptions: VxeGridProps = { align: 'left', field: 'key', minWidth: 150, + sortable: true, title: $t('AbpLocalization.DisplayName:Key'), }, { align: 'left', field: 'value', minWidth: 150, + sortable: true, title: $t('AbpLocalization.DisplayName:Value'), }, { align: 'left', field: 'targetValue', minWidth: 150, + sortable: true, title: $t('AbpLocalization.DisplayName:TargetValue'), }, { align: 'left', field: 'resourceName', minWidth: 150, + sortable: true, title: $t('AbpLocalization.DisplayName:ResourceName'), }, { @@ -141,6 +138,30 @@ const gridOptions: VxeGridProps = { ], exportConfig: {}, keepSource: true, + proxyConfig: { + ajax: { + query: async ({ page, sort }) => { + let items = sortby(dataSource.value, sort.field); + if (sort.order === 'desc') { + items = items.reverse(); + } + const result = { + totalCount: dataSource.value.length, + items: items.slice( + (page.currentPage - 1) * page.pageSize, + page.currentPage * page.pageSize, + ), + }; + return new Promise((resolve) => { + resolve(result); + }); + }, + }, + response: { + total: 'totalCount', + list: 'items', + }, + }, toolbarConfig: { custom: true, export: true, @@ -150,10 +171,8 @@ const gridOptions: VxeGridProps = { }; const gridEvents: VxeGridListeners = { - pageChange(params) { - pageState.current = params.currentPage; - pageState.size = params.pageSize; - onPageChange(); + sortChange: () => { + gridApi.query(); }, }; @@ -186,9 +205,8 @@ async function onGet(input: Record) { try { gridApi.setLoading(true); const { items } = await getListApi(input as any); - pageState.total = items.length; dataSource.value = items; - onPageChange(); + setTimeout(() => gridApi.reload(), 100); } finally { gridApi.setLoading(false); } @@ -200,21 +218,6 @@ async function onReset() { await onGet(input); } -function onPageChange() { - const items = dataSource.value.slice( - (pageState.current - 1) * pageState.size, - pageState.current * pageState.size, - ); - gridApi.setGridOptions({ - data: items, - pagerConfig: { - currentPage: pageState.current, - pageSize: pageState.size, - total: pageState.total, - }, - }); -} - async function onCreate() { const input = await gridApi.formApi.getValues(); modalApi.setData({ diff --git a/apps/vben5/packages/@abp/notifications/src/components/definitions/groups/NotificationGroupDefinitionTable.vue b/apps/vben5/packages/@abp/notifications/src/components/definitions/groups/NotificationGroupDefinitionTable.vue index 67abc62ee..06e245ec9 100644 --- a/apps/vben5/packages/@abp/notifications/src/components/definitions/groups/NotificationGroupDefinitionTable.vue +++ b/apps/vben5/packages/@abp/notifications/src/components/definitions/groups/NotificationGroupDefinitionTable.vue @@ -6,14 +6,14 @@ import type { VbenFormProps } from '@vben/common-ui'; import type { NotificationGroupDefinitionDto } from '../../../types/groups'; -import { defineAsyncComponent, h, onMounted, reactive, ref } from 'vue'; +import { defineAsyncComponent, h, onMounted, ref } from 'vue'; import { useAccess } from '@vben/access'; import { useVbenModal } from '@vben/common-ui'; import { createIconifyIcon } from '@vben/icons'; import { $t } from '@vben/locales'; -import { useLocalization, useLocalizationSerializer } from '@abp/core'; +import { sortby, useLocalization, useLocalizationSerializer } from '@abp/core'; import { useVbenVxeGrid } from '@abp/ui'; import { DeleteOutlined, @@ -37,11 +37,6 @@ const MenuItem = Menu.Item; const DefinitionIcon = createIconifyIcon('nimbus:notification'); const dataSource = ref([]); -const pageState = reactive({ - current: 1, - size: 10, - total: 0, -}); const { Lr } = useLocalization(); const { hasAccessByCodes } = useAccess(); @@ -53,7 +48,6 @@ const formOptions: VbenFormProps = { collapsed: false, handleReset: onReset, async handleSubmit(params) { - pageState.current = 1; await onGet(params); }, schema: [ @@ -76,12 +70,14 @@ const gridOptions: VxeGridProps = { align: 'left', field: 'name', minWidth: 150, + sortable: true, title: $t('Notifications.DisplayName:Name'), }, { align: 'left', field: 'displayName', minWidth: 150, + sortable: true, title: $t('Notifications.DisplayName:DisplayName'), }, { @@ -94,6 +90,30 @@ const gridOptions: VxeGridProps = { ], exportConfig: {}, keepSource: true, + proxyConfig: { + ajax: { + query: async ({ page, sort }) => { + let items = sortby(dataSource.value, sort.field); + if (sort.order === 'desc') { + items = items.reverse(); + } + const result = { + totalCount: dataSource.value.length, + items: items.slice( + (page.currentPage - 1) * page.pageSize, + page.currentPage * page.pageSize, + ), + }; + return new Promise((resolve) => { + resolve(result); + }); + }, + }, + response: { + total: 'totalCount', + list: 'items', + }, + }, toolbarConfig: { custom: true, export: true, @@ -103,10 +123,8 @@ const gridOptions: VxeGridProps = { }; const gridEvents: VxeGridListeners = { - pageChange(params) { - pageState.current = params.currentPage; - pageState.size = params.pageSize; - onPageChange(); + sortChange: () => { + gridApi.query(); }, }; @@ -131,7 +149,6 @@ async function onGet(input?: Record) { try { gridApi.setLoading(true); const { items } = await getListApi(input); - pageState.total = items.length; dataSource.value = items.map((item) => { const localizableString = deserialize(item.displayName); return { @@ -139,7 +156,7 @@ async function onGet(input?: Record) { displayName: Lr(localizableString.resourceName, localizableString.name), }; }); - onPageChange(); + setTimeout(() => gridApi.reload(), 100); } finally { gridApi.setLoading(false); } @@ -151,21 +168,6 @@ async function onReset() { await onGet(input); } -function onPageChange() { - const items = dataSource.value.slice( - (pageState.current - 1) * pageState.size, - pageState.current * pageState.size, - ); - gridApi.setGridOptions({ - data: items, - pagerConfig: { - currentPage: pageState.current, - pageSize: pageState.size, - total: pageState.total, - }, - }); -} - function onCreate() { groupModalApi.setData({}); groupModalApi.open(); diff --git a/apps/vben5/packages/@abp/notifications/src/components/definitions/notifications/NotificationDefinitionTable.vue b/apps/vben5/packages/@abp/notifications/src/components/definitions/notifications/NotificationDefinitionTable.vue index 96762869f..dc49327ba 100644 --- a/apps/vben5/packages/@abp/notifications/src/components/definitions/notifications/NotificationDefinitionTable.vue +++ b/apps/vben5/packages/@abp/notifications/src/components/definitions/notifications/NotificationDefinitionTable.vue @@ -7,7 +7,7 @@ import type { VbenFormProps } from '@vben/common-ui'; import type { NotificationDefinitionDto } from '../../../types/definitions'; import type { NotificationGroupDefinitionDto } from '../../../types/groups'; -import { defineAsyncComponent, h, onMounted, reactive, ref } from 'vue'; +import { defineAsyncComponent, h, onMounted, ref } from 'vue'; import { useAccess } from '@vben/access'; import { useVbenModal } from '@vben/common-ui'; @@ -16,6 +16,7 @@ import { $t } from '@vben/locales'; import { listToTree, + sortby, useLocalization, useLocalizationSerializer, } from '@abp/core'; @@ -79,18 +80,12 @@ const { deleteApi, getListApi: getDefinitionsApi } = useNotificationDefinitionsApi(); const definitionGroups = ref([]); -const pageState = reactive({ - current: 1, - size: 10, - total: 0, -}); const formOptions: VbenFormProps = { // 默认展开 collapsed: false, handleReset: onReset, async handleSubmit(params) { - pageState.current = 1; await onGet(params); }, schema: [ @@ -125,12 +120,14 @@ const gridOptions: VxeGridProps = { align: 'left', field: 'name', minWidth: 150, + sortable: true, title: $t('Notifications.DisplayName:Name'), }, { align: 'left', field: 'displayName', minWidth: 150, + sortable: true, title: $t('Notifications.DisplayName:DisplayName'), }, ], @@ -140,6 +137,30 @@ const gridOptions: VxeGridProps = { }, exportConfig: {}, keepSource: true, + proxyConfig: { + ajax: { + query: async ({ page, sort }) => { + let items = sortby(definitionGroups.value, sort.field); + if (sort.order === 'desc') { + items = items.reverse(); + } + const result = { + totalCount: definitionGroups.value.length, + items: items.slice( + (page.currentPage - 1) * page.pageSize, + page.currentPage * page.pageSize, + ), + }; + return new Promise((resolve) => { + resolve(result); + }); + }, + }, + response: { + total: 'totalCount', + list: 'items', + }, + }, toolbarConfig: { custom: true, export: true, @@ -157,6 +178,8 @@ const subGridColumns: VxeGridProps['columns'] = [ align: 'left', field: 'name', minWidth: 150, + resizable: true, + sortable: true, title: $t('Notifications.DisplayName:Name'), treeNode: true, }, @@ -164,12 +187,16 @@ const subGridColumns: VxeGridProps['columns'] = [ align: 'left', field: 'displayName', minWidth: 120, + resizable: true, + sortable: true, title: $t('Notifications.DisplayName:DisplayName'), }, { align: 'left', field: 'description', minWidth: 120, + resizable: true, + sortable: true, title: $t('Notifications.DisplayName:Description'), }, { @@ -177,37 +204,49 @@ const subGridColumns: VxeGridProps['columns'] = [ field: 'allowSubscriptionToClients', minWidth: 120, slots: { default: 'allowSubscriptionToClients' }, + resizable: true, + sortable: true, title: $t('Notifications.DisplayName:AllowSubscriptionToClients'), }, { align: 'left', field: 'template', minWidth: 150, + resizable: true, + sortable: true, title: $t('Notifications.DisplayName:Template'), }, { align: 'left', field: 'notificationLifetime', minWidth: 150, + resizable: true, + sortable: true, title: $t('Notifications.DisplayName:NotificationLifetime'), }, { align: 'left', field: 'notificationType', minWidth: 150, + resizable: true, + sortable: true, title: $t('Notifications.DisplayName:NotificationType'), }, { align: 'left', field: 'contentType', minWidth: 150, + resizable: true, + sortable: true, title: $t('Notifications.DisplayName:ContentType'), }, { align: 'left', field: 'providers', minWidth: 150, + resizable: true, slots: { default: 'providers' }, + sortable: true, title: $t('Notifications.DisplayName:Providers'), }, { @@ -220,10 +259,8 @@ const subGridColumns: VxeGridProps['columns'] = [ ]; const gridEvents: VxeGridListeners = { - pageChange(params) { - pageState.current = params.currentPage; - pageState.size = params.pageSize; - onPageChange(); + sortChange: () => { + gridApi.query(); }, }; @@ -249,7 +286,6 @@ async function onGet(input?: Record) { gridApi.setLoading(true); const groupRes = await getGroupsApi(input); const definitionRes = await getDefinitionsApi(input); - pageState.total = groupRes.items.length; definitionGroups.value = groupRes.items.map((group) => { const localizableGroup = deserialize(group.displayName); const definitions = definitionRes.items @@ -276,7 +312,7 @@ async function onGet(input?: Record) { }), }; }); - onPageChange(); + setTimeout(() => gridApi.reload(), 100); } finally { gridApi.setLoading(false); } @@ -288,21 +324,6 @@ async function onReset() { await onGet(input); } -function onPageChange() { - const items = definitionGroups.value.slice( - (pageState.current - 1) * pageState.size, - pageState.current * pageState.size, - ); - gridApi.setGridOptions({ - data: items, - pagerConfig: { - currentPage: pageState.current, - pageSize: pageState.size, - total: pageState.total, - }, - }); -} - function onCreate() { modalApi.setData({}); modalApi.open(); diff --git a/apps/vben5/packages/@abp/notifications/src/components/my-notifilers/MyNotificationTable.vue b/apps/vben5/packages/@abp/notifications/src/components/my-notifilers/MyNotificationTable.vue index e59bb8a3e..7d824f144 100644 --- a/apps/vben5/packages/@abp/notifications/src/components/my-notifilers/MyNotificationTable.vue +++ b/apps/vben5/packages/@abp/notifications/src/components/my-notifilers/MyNotificationTable.vue @@ -107,6 +107,7 @@ const gridOptions: VxeGridProps = { } }, minWidth: 50, + sortable: true, title: $t('Notifications.Notifications:Type'), }, { @@ -116,6 +117,7 @@ const gridOptions: VxeGridProps = { return cellValue ? formatToDateTime(cellValue) : ''; }, minWidth: 120, + sortable: true, title: $t('Notifications.Notifications:SendTime'), }, { @@ -144,8 +146,10 @@ const gridOptions: VxeGridProps = { keepSource: true, proxyConfig: { ajax: { - query: async ({ page }, formValues) => { + query: async ({ page, sort }, formValues) => { + const sorting = sort.order ? `${sort.field} ${sort.order}` : undefined; const { totalCount, items } = await getMyNotifilersApi({ + sorting, maxResultCount: page.pageSize, skipCount: (page.currentPage - 1) * page.pageSize, ...formValues, @@ -171,8 +175,9 @@ const gridOptions: VxeGridProps = { toolbarConfig: { custom: true, export: true, - // import: true, - refresh: true, + refresh: { + code: 'query', + }, zoom: true, }, }; @@ -184,6 +189,9 @@ const gridEvents: VxeGridListeners = { checkboxChange: (params) => { selectedKeys.value = params.records.map((record) => record.id); }, + sortChange: () => { + gridApi.query(); + }, }; const [Grid, gridApi] = useVbenVxeGrid({ diff --git a/apps/vben5/packages/@abp/openiddict/src/components/applications/ApplicationTable.vue b/apps/vben5/packages/@abp/openiddict/src/components/applications/ApplicationTable.vue index 9c32c2566..76d5f5bec 100644 --- a/apps/vben5/packages/@abp/openiddict/src/components/applications/ApplicationTable.vue +++ b/apps/vben5/packages/@abp/openiddict/src/components/applications/ApplicationTable.vue @@ -1,5 +1,5 @@