邓洁: 修复bug

This commit is contained in:
邓洁
2023-12-29 10:31:46 +08:00
parent abdbbbda31
commit 57b22361dc
5 changed files with 69 additions and 21 deletions

View File

@@ -112,11 +112,11 @@
</template>
</el-dialog>
<div class="pagination">
<span>首页</span>
<span @click="firstPage" v-if="showFirst">首页</span>
<el-pagination background v-model:current-page="pageInfo.pageNum" v-model:page-size="pageInfo.pageSize"
:total="total" prev-text="上一页" next-text="下一页" layout="prev, pager, next"
@current-change="handleCurrentChange"/>
<span>尾页</span>
@current-change="handleCurrentChange" :hide-on-single-page="true"/>
<span @click="lastPage" v-if="showFirst">尾页</span>
</div>
</div>
</template>
@@ -135,12 +135,13 @@ const siteId = reactive(router.currentRoute.value.params.siteId)
const tunnelIndex = ref()
const username = ref()
const userIds = ref()
const showFirst = ref(true)
const currentSite = ref()
const formInstance = ref()
const userData = ref([])
const pageInfo = reactive({
pageNum: 1,
pageSize: 6
pageSize: 10
});
const total = ref(10);
const isVisited = ref(false);
@@ -224,16 +225,30 @@ getRoleOptionInfo()
const getInfo = () => {
getUser({
siteId: siteId,
userName: username.value
userName: username.value,
...pageInfo
}).then(res => {
if (res.code === 1000) {
console.log('res', res)
userData.value = res.data.rows
total.value = res.data.total
showFirst.value = total.value / pageInfo.pageSize >= 1;
}
})
}
getInfo()
const firstPage=()=>{
pageInfo.pageNum = 1
getInfo()
}
const lastPage=()=>{
pageInfo.pageNum = total.value/pageInfo.pageSize
getInfo()
}
//点击页码进行分页功能
const handleCurrentChange = (val) => {
pageInfo.pageNum = val
getInfo()
}
const handleSubmit = async (formInstance) => {
if (!formInstance) return;
formInstance.validate(async (valid) => {