- <el-pagination @size-change="onHandleSizeChange" @current-change="onHandleCurrentChange" class="mt15"
- :pager-count="5" :page-sizes="[10, 20, 30]" v-model:current-page="queryForm.pageNo" background
- v-model:page-size="queryForm.pageSize" layout="total, sizes, prev, pager, next, jumper" :total="total">
- </el-pagination>
- const total = ref(0)
- const queryForm = ref({
- pageNo: 1,
- pageSize: 10,
- name: '',
- code: '',
-
- })
- // 初始化表格数据
- const getTableData = async () => {
- try {
- loading.value = true
- const res = await getRoleValue(queryForm.value)
- tableData.value = res.rows
- total.value = res.totalRows
- loading.value = false
- } catch (error) {
-
- }
-
-
- // 查询
- const onQuery = () => {
- queryForm.value.pageNo = 1;
- getTableData()
- }
- // 重置
- const resetForm = () => {
- resetValue();
- getTableData()
- }
- // 分页改变
- const onHandleSizeChange = (val: number) => {
- queryForm.value.pageSize = val;
- getTableData();
- };
- // 分页改变
- const onHandleCurrentChange = (val: number) => {
- queryForm.value.pageNo = val;
- getTableData();
- };