计划列表接口添加分页

This commit is contained in:
2026-01-13 09:56:56 +08:00
parent 67c742acee
commit 0325df38ec

View File

@@ -74,6 +74,18 @@
<div v-if="tableData.length === 0 && !tableLoading" class="empty-data">
<el-empty description="暂无数据"></el-empty>
</div>
<!-- 分页组件 -->
<el-pagination
v-if="total > 0"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
:current-page="queryForm.pageNum"
:page-sizes="[10, 20, 50, 100]"
:page-size="queryForm.pageSize"
layout="total, sizes, prev, pager, next, jumper"
:total="total"
style="margin-top: 15px; text-align: right;"
></el-pagination>
</div>
<div>
@@ -143,10 +155,17 @@ export default {
data() {
return {
activeTab: 'basicInfo',
queryForm: { coilid: '', startDate: '', endDate: '' },
queryForm: {
coilid: '',
startDate: '',
endDate: '',
pageNum: 1,
pageSize: 20
},
printOpen: false,
certificateVisible: false, // 质保书对话框显示状态
tableData: [],
total: 0, // 总记录数
tableLoading: false,
btnLoading: false,
dialogVisible: false,
@@ -171,27 +190,51 @@ export default {
this.getPdoList()
},
methods: {
// 获取列表数据(保持不变
// 获取列表数据(支持分页
getPdoList() {
this.tableLoading = true
getPdoList(this.queryForm).then(res => {
this.tableData = res.data.map(item => ({ ...item, deleteLoading: false }))
if (res.code === 200) {
// 处理分页数据
this.tableData = (res.rows || res.data || []).map(item => ({ ...item, deleteLoading: false }))
this.total = res.total || 0
} else {
this.$message.error(res.msg || '获取数据失败')
this.tableData = []
this.total = 0
}
}).catch(err => {
console.error(err)
this.$message.error('获取数据失败')
this.tableData = []
this.total = 0
}).finally(() => {
this.tableLoading = false
this.btnLoading = false
})
},
// 分页大小改变
handleSizeChange(val) {
this.queryForm.pageSize = val
this.queryForm.pageNum = 1 // 重置到第一页
this.getPdoList()
},
// 当前页改变
handleCurrentChange(val) {
this.queryForm.pageNum = val
this.getPdoList()
},
// 查询(保持不变)
handleQuery() {
this.btnLoading = true;
this.queryForm.pageNum = 1; // 重置到第一页
this.getPdoList()
},
// 重置(保持不变)
handleReset() {
this.$refs.queryForm.resetFields();
this.queryForm.pageNum = 1;
this.queryForm.pageSize = 20;
this.getPdoList()
},
// 行点击(保持不变)