基础信息分页功能补回
This commit is contained in:
@ -216,6 +216,19 @@
|
|||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
|
|
||||||
|
<div class="pagination-container">
|
||||||
|
<el-pagination
|
||||||
|
v-model:current-page="queryParams.pageNum"
|
||||||
|
v-model:page-size="queryParams.pageSize"
|
||||||
|
:page-sizes="[10, 20, 50, 100]"
|
||||||
|
:background="true"
|
||||||
|
layout="total, sizes, prev, pager, next, jumper"
|
||||||
|
:total="total"
|
||||||
|
@size-change="handlePageSizeChange"
|
||||||
|
@current-change="handlePageCurrentChange"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
<el-dialog
|
<el-dialog
|
||||||
v-model="dialog.visible"
|
v-model="dialog.visible"
|
||||||
:title="dialog.title"
|
:title="dialog.title"
|
||||||
@ -665,6 +678,19 @@ const handleSizeChange = (command: 'large' | 'default' | 'small') => {
|
|||||||
tableSize.value = command;
|
tableSize.value = command;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// 新增:分页大小改变处理
|
||||||
|
const handlePageSizeChange = (val: number) => {
|
||||||
|
queryParams.pageSize = val;
|
||||||
|
queryParams.pageNum = 1; // 切换大小时重置到第一页
|
||||||
|
getList();
|
||||||
|
};
|
||||||
|
|
||||||
|
// 新增:当前页码改变处理
|
||||||
|
const handlePageCurrentChange = (val: number) => {
|
||||||
|
queryParams.pageNum = val;
|
||||||
|
getList();
|
||||||
|
};
|
||||||
|
|
||||||
const handleAdd = () => {
|
const handleAdd = () => {
|
||||||
resetForm();
|
resetForm();
|
||||||
dialog.title = '新增基础信息';
|
dialog.title = '新增基础信息';
|
||||||
@ -715,12 +741,12 @@ const handleEdit = (row: MaterialBaseVO) => {
|
|||||||
|
|
||||||
const checkDuplicate = async (name: string, spec: string): Promise<boolean> => {
|
const checkDuplicate = async (name: string, spec: string): Promise<boolean> => {
|
||||||
try {
|
try {
|
||||||
const nameRes: any = await listMaterialBase({ pageNum: 1, pageSize: 100, keyword: name });
|
const nameRes: any = await listMaterialBase({ pageNum: 1, pageSize: 100, keyword: name, category: '', type: '', company: '' });
|
||||||
if (nameRes.data?.items?.some((item: MaterialBaseVO) => item.name === name && item.id !== form.value.id)) {
|
if (nameRes.data?.items?.some((item: MaterialBaseVO) => item.name === name && item.id !== form.value.id)) {
|
||||||
ElMessage.error(`已存在名称为 "${name}" 的基础信息!`);
|
ElMessage.error(`已存在名称为 "${name}" 的基础信息!`);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
const specRes: any = await listMaterialBase({ pageNum: 1, pageSize: 100, keyword: spec });
|
const specRes: any = await listMaterialBase({ pageNum: 1, pageSize: 100, keyword: spec, category: '', type: '', company: '' });
|
||||||
if (specRes.data?.items?.some((item: MaterialBaseVO) => item.spec === spec && item.id !== form.value.id)) {
|
if (specRes.data?.items?.some((item: MaterialBaseVO) => item.spec === spec && item.id !== form.value.id)) {
|
||||||
ElMessage.error(`已存在规格/编号为 "${spec}" 的基础信息!`);
|
ElMessage.error(`已存在规格/编号为 "${spec}" 的基础信息!`);
|
||||||
return true;
|
return true;
|
||||||
@ -956,6 +982,13 @@ onMounted(() => {
|
|||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* 新增:分页样式 */
|
||||||
|
.pagination-container {
|
||||||
|
margin-top: 15px;
|
||||||
|
display: flex;
|
||||||
|
justify-content: flex-start;
|
||||||
|
}
|
||||||
|
|
||||||
/* 上传相关样式 */
|
/* 上传相关样式 */
|
||||||
.upload-container { display: flex; flex-wrap: wrap; gap: 8px; }
|
.upload-container { display: flex; flex-wrap: wrap; gap: 8px; }
|
||||||
:deep(.el-upload--picture-card) { width: 100px; height: 100px; line-height: 100px; }
|
:deep(.el-upload--picture-card) { width: 100px; height: 100px; line-height: 100px; }
|
||||||
|
|||||||
Reference in New Issue
Block a user