This commit is contained in:
Teo
2025-08-21 21:39:42 +08:00
parent 1cdd24271c
commit 65f4191211
7 changed files with 57 additions and 63 deletions

View File

@ -88,20 +88,7 @@
</el-table>
<!-- 分页 -->
<div class="flex items-center justify-between p-4 border-t" v-if="total > 0">
<div class="text-gray-500 text-sm">
{{ total }} 条记录当前显示第 {{ (currentPage - 1) * pageSize + 1 }} {{ Math.min(currentPage * pageSize, total) }}
</div>
<el-pagination
v-model:current-page="currentPage"
v-model:page-size="pageSize"
:page-sizes="[10, 20, 50, 100]"
:total="total"
layout="prev, pager, next, jumper, sizes"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
></el-pagination>
</div>
<pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize" @pagination="fetchData" />
</div>
<!-- 新增/编辑对话框 -->
<el-dialog
@ -264,6 +251,13 @@ const formRules = reactive({
findType: [{ required: true, message: '请选择类型', trigger: 'change' }]
});
const queryParams = reactive({
pageSize: 10,
pageNum: 1,
findType: 1,
projectId: currentProject.value?.id
});
// 格式化日期
const formatDate = (dateString) => {
if (!dateString) return '-';
@ -289,10 +283,7 @@ const tableRowClassName = ({ row, rowIndex }) => {
const fetchData = async () => {
loading.value = true;
try {
const res = await useMaterialsQueryList({
projectId: currentProject.value?.id,
findType: 1
});
const res = await useMaterialsQueryList(queryParams);
tableData.value = res.rows;
total.value = res.total;