fix: 健康管理系统,分页统一修复。

This commit is contained in:
tianyongbao
2025-05-10 18:46:58 +08:00
parent 935f1cd60c
commit addf3589d4
14 changed files with 297 additions and 16 deletions

View File

@@ -20,6 +20,7 @@
</div>
<div class="content-con" v-loading="loading" height="calc(100% - 0.65rem)">
<el-table v-loading="loading" :data="medicineStockInList" @selection-change="handleSelectionChange" height="calc(100% - 0.65rem)">
<el-table-column type="index" label="序号" :index="indexMethod" width="50"></el-table-column>
<el-table-column label="药品名称" align="center" prop="medicineName" />
<el-table-column label="规格总数" align="center" prop="totalCount" />
<el-table-column label="剩余数量" align="center" prop="leftCount" />
@@ -29,7 +30,14 @@
</template>
</el-table-column>
</el-table>
<el-pagination small background layout="total, prev, pager, next" :total="total" @current-change="handleCurrentChange" />
<el-pagination
small
background
layout="total,sizes, prev, pager, next"
:total="total"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
/>
</div>
</div>
</div>
@@ -113,6 +121,18 @@ const handleCurrentChange = (val) => {
getList()
}
//每页显示条数改变
const handleSizeChange = (val) => {
queryParams.value.pageSize = val
getList()
}
// 序号翻页递增
const indexMethod = (index) => {
const nowPage = queryParams.value.pageNum //当前第几页,根据组件取值即可
const nowLimit = queryParams.value.pageSize //当前每页显示几条,根据组件取值即可
return index + 1 + (nowPage - 1) * nowLimit // 这里可以理解成一个公式
}
// 多选框选中数据
function handleSelectionChange(selection) {
ids.value = selection.map((item) => item.id)