更新 @riwa/api-types 依赖至 0.0.23,调整分页接口参数,优化表格组件的类型定义
This commit is contained in:
@@ -50,7 +50,7 @@
|
||||
"@better-scroll/core": "2.5.1",
|
||||
"@elysiajs/eden": "^1.4.5",
|
||||
"@iconify/vue": "5.0.0",
|
||||
"@riwa/api-types": "http://192.168.1.36:9527/api/riwa-api-types-0.0.17.tgz",
|
||||
"@riwa/api-types": "http://192.168.1.36:9527/api/riwa-api-types-0.0.23.tgz",
|
||||
"@sa/axios": "workspace:*",
|
||||
"@sa/color": "workspace:*",
|
||||
"@sa/hooks": "workspace:*",
|
||||
|
||||
12
pnpm-lock.yaml
generated
12
pnpm-lock.yaml
generated
@@ -18,8 +18,8 @@ importers:
|
||||
specifier: 5.0.0
|
||||
version: 5.0.0(vue@3.5.25(typescript@5.9.3))
|
||||
'@riwa/api-types':
|
||||
specifier: http://192.168.1.36:9527/api/riwa-api-types-0.0.17.tgz
|
||||
version: http://192.168.1.36:9527/api/riwa-api-types-0.0.17.tgz(@elysiajs/eden@1.4.5(elysia@1.4.19(@sinclair/typebox@0.34.41)(exact-mirror@0.2.5(@sinclair/typebox@0.34.41))(file-type@21.1.1)(openapi-types@12.1.3)(typescript@5.9.3)))
|
||||
specifier: http://192.168.1.36:9527/api/riwa-api-types-0.0.23.tgz
|
||||
version: http://192.168.1.36:9527/api/riwa-api-types-0.0.23.tgz(@elysiajs/eden@1.4.5(elysia@1.4.19(@sinclair/typebox@0.34.41)(exact-mirror@0.2.5(@sinclair/typebox@0.34.41))(file-type@21.1.1)(openapi-types@12.1.3)(typescript@5.9.3)))
|
||||
'@sa/axios':
|
||||
specifier: workspace:*
|
||||
version: link:packages/axios
|
||||
@@ -1074,9 +1074,9 @@ packages:
|
||||
'@quansync/fs@0.1.6':
|
||||
resolution: {integrity: sha512-zoA8SqQO11qH9H8FCBR7NIbowYARIPmBz3nKjgAaOUDi/xPAAu1uAgebtV7KXHTc6CDZJVRZ1u4wIGvY5CWYaw==}
|
||||
|
||||
'@riwa/api-types@http://192.168.1.36:9527/api/riwa-api-types-0.0.17.tgz':
|
||||
resolution: {tarball: http://192.168.1.36:9527/api/riwa-api-types-0.0.17.tgz}
|
||||
version: 0.0.17
|
||||
'@riwa/api-types@http://192.168.1.36:9527/api/riwa-api-types-0.0.23.tgz':
|
||||
resolution: {tarball: http://192.168.1.36:9527/api/riwa-api-types-0.0.23.tgz}
|
||||
version: 0.0.23
|
||||
peerDependencies:
|
||||
'@elysiajs/eden': ^1.4.5
|
||||
|
||||
@@ -5082,7 +5082,7 @@ snapshots:
|
||||
dependencies:
|
||||
quansync: 0.3.0
|
||||
|
||||
'@riwa/api-types@http://192.168.1.36:9527/api/riwa-api-types-0.0.17.tgz(@elysiajs/eden@1.4.5(elysia@1.4.19(@sinclair/typebox@0.34.41)(exact-mirror@0.2.5(@sinclair/typebox@0.34.41))(file-type@21.1.1)(openapi-types@12.1.3)(typescript@5.9.3)))':
|
||||
'@riwa/api-types@http://192.168.1.36:9527/api/riwa-api-types-0.0.23.tgz(@elysiajs/eden@1.4.5(elysia@1.4.19(@sinclair/typebox@0.34.41)(exact-mirror@0.2.5(@sinclair/typebox@0.34.41))(file-type@21.1.1)(openapi-types@12.1.3)(typescript@5.9.3)))':
|
||||
dependencies:
|
||||
'@elysiajs/eden': 1.4.5(elysia@1.4.19(@sinclair/typebox@0.34.41)(exact-mirror@0.2.5(@sinclair/typebox@0.34.41))(file-type@21.1.1)(openapi-types@12.1.3)(typescript@5.9.3))
|
||||
|
||||
|
||||
@@ -5,19 +5,23 @@ import type { InternalRowData } from 'naive-ui/es/data-table/src/interface';
|
||||
import type { safeClient } from '@/service/api';
|
||||
import type TableBase from './table-base.vue';
|
||||
|
||||
type TableBaseColumn<T = InternalRowData> = DataTableColumn<T> & {
|
||||
export type TableBaseExpandColumn<T = InternalRowData> = {
|
||||
operations?: (row: T) => Array<Partial<ButtonProps> & { contentText: string }>;
|
||||
key: string;
|
||||
title: string;
|
||||
};
|
||||
|
||||
type TableBaseColumn<T = InternalRowData> = DataTableColumn<T> & TableBaseExpandColumn<T>;
|
||||
|
||||
export type TableBaseColumns<T = InternalRowData> = Array<TableBaseColumn<T>>;
|
||||
|
||||
export type TableInst = InstanceType<typeof TableBase>;
|
||||
|
||||
export interface Pagination {
|
||||
limit: number;
|
||||
offset: number;
|
||||
pageIndex: number;
|
||||
pageSize: number;
|
||||
total?: number;
|
||||
[key: string]: any;
|
||||
}
|
||||
|
||||
export type TableFetchData = (page: Pagination) => ReturnType<typeof safeClient>;
|
||||
|
||||
@@ -29,8 +29,8 @@ async function loadData() {
|
||||
const page = pagination.value.page || 1;
|
||||
const pageSize = pagination.value.pageSize || 10;
|
||||
const { data } = await props.fetchData({
|
||||
limit: pageSize,
|
||||
offset: (page - 1) * pageSize
|
||||
pageIndex: page,
|
||||
pageSize
|
||||
});
|
||||
|
||||
tableData.value = (data.value as any).data;
|
||||
@@ -41,6 +41,10 @@ function handlePageChange(curPage: number) {
|
||||
pagination.value.page = curPage;
|
||||
loadData();
|
||||
}
|
||||
function handlePageSizeChange(curPageSize: number) {
|
||||
pagination.value.pageSize = curPageSize;
|
||||
loadData();
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
loadData();
|
||||
@@ -66,6 +70,7 @@ defineExpose({
|
||||
:pagination="pagination"
|
||||
:bordered="false"
|
||||
:on-update:page="handlePageChange"
|
||||
:on-update:page-size="handlePageSizeChange"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -3,16 +3,16 @@ import { h, ref, useTemplateRef } from 'vue';
|
||||
import { NInputNumber, useDialog, useMessage } from 'naive-ui';
|
||||
import { client, safeClient } from '@/service/api';
|
||||
import { DepositTypeEnum } from '@/enum';
|
||||
import type { TableBaseColumns, TableFetchData, TableInst } from '@/components/table';
|
||||
import type { Pagination, TableBaseColumns, TableFetchData, TableInst } from '@/components/table';
|
||||
|
||||
const dialog = useDialog();
|
||||
const message = useMessage();
|
||||
const tableInst = useTemplateRef<TableInst>('tableInst');
|
||||
|
||||
const fetchData: TableFetchData = () => {
|
||||
const fetchData: TableFetchData = (pagination: Pagination) => {
|
||||
return safeClient(() =>
|
||||
client.api.admin.deposit.pending.get({
|
||||
query: {}
|
||||
query: pagination
|
||||
})
|
||||
);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user