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

View File

@@ -75,7 +75,7 @@
margin: 0px 4px 120px 10px;
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"
v-model:selectedRows="stuSelectRows" type="checkbox"></BaseTable>
</div>