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