--fix bug

This commit is contained in:
yuping
2023-03-20 18:54:36 +08:00
parent 914c9318a5
commit 87b3ddc545
2 changed files with 8 additions and 4 deletions

View File

@@ -29,6 +29,10 @@ const props = defineProps({
type: String, type: String,
default: "" default: ""
}, },
pageKey: {
type: String,
default: "pageNo"
},
params: { params: {
type: Object, type: Object,
default: () => ({}) default: () => ({})
@@ -45,7 +49,7 @@ const props = defineProps({
const emit = defineEmits(["update:params", "update:selectedRowKeys", "update:selectedRows"]); const emit = defineEmits(["update:params", "update:selectedRowKeys", "update:selectedRows"]);
const rowSelectKeys = ref([]); const rowSelectKeys = ref([]);
const selectsData = ref([]); const selectsData = ref([]);
const params = useResetRef({ pageNo: 1, pageSize: 10 }); const params = useResetRef({ [props.pageKey]: 1, pageSize: 10 });
const postParam = computed(() => ({ ...params.value, ...props.params })); const postParam = computed(() => ({ ...params.value, ...props.params }));
const { data, loading, total, fetch: onFetch } = props.request(props.url, postParam); const { data, loading, total, fetch: onFetch } = props.request(props.url, postParam);
@@ -89,12 +93,12 @@ function onSelectChange(e, l) {
const pagination = computed(() => ({ const pagination = computed(() => ({
total: total.value, total: total.value,
showSizeChanger: false, showSizeChanger: false,
current: params.value.pageNo, current: params.value[props.pageKey],
pageSize: params.value.pageSize, pageSize: params.value.pageSize,
onChange: changePagination, onChange: changePagination,
})); }));
const changePagination = (e) => { const changePagination = (e) => {
params.value.pageNo = e; params.value[props.pageKey] = e;
onFetch(); onFetch();
}; };

View File

@@ -75,7 +75,7 @@
margin: 0px 4px 120px 10px; margin: 0px 4px 120px 10px;
border: 1px solid #f0f0f0; border: 1px solid #f0f0f0;
"> ">
<BaseTable ref="stuTableRef" :columns="stuColumns" :url="USER_LIST_PAGE" <BaseTable ref="stuTableRef" :columns="stuColumns" :url="USER_LIST_PAGE" pageKey="page"
:request="useBoeApiUserInfoPage" :params="nameSearch" :request="useBoeApiUserInfoPage" :params="nameSearch"
v-model:selectedRows="stuSelectRows" type="checkbox"></BaseTable> v-model:selectedRows="stuSelectRows" type="checkbox"></BaseTable>
</div> </div>