mirror of
https://github.com/xinnan-tech/xiaozhi-esp32-server.git
synced 2026-07-29 01:33:51 +08:00
完成“参数管理”的设置每页大小
This commit is contained in:
@@ -16,7 +16,7 @@
|
|||||||
<div class="content-area">
|
<div class="content-area">
|
||||||
<el-card class="params-card" shadow="never">
|
<el-card class="params-card" shadow="never">
|
||||||
<el-table ref="paramsTable" :data="paramsList" class="transparent-table"
|
<el-table ref="paramsTable" :data="paramsList" class="transparent-table"
|
||||||
:header-cell-class-name="headerCellClassName">
|
:header-cell-class-name="headerCellClassName" :max-height="tableMaxHeight">
|
||||||
<el-table-column label="选择" type="selection" align="center" width="120"></el-table-column>
|
<el-table-column label="选择" type="selection" align="center" width="120"></el-table-column>
|
||||||
<el-table-column label="参数编码" prop="paramCode" align="center"></el-table-column>
|
<el-table-column label="参数编码" prop="paramCode" align="center"></el-table-column>
|
||||||
<el-table-column label="参数值" prop="paramValue" align="center"
|
<el-table-column label="参数值" prop="paramValue" align="center"
|
||||||
@@ -40,6 +40,14 @@
|
|||||||
@click="deleteParam($refs.paramsTable.selection)">删除</el-button>
|
@click="deleteParam($refs.paramsTable.selection)">删除</el-button>
|
||||||
</div>
|
</div>
|
||||||
<div class="custom-pagination">
|
<div class="custom-pagination">
|
||||||
|
<el-select v-model="pageSize" @change="handlePageSizeChange" class="page-size-select">
|
||||||
|
<el-option
|
||||||
|
v-for="item in pageSizeOptions"
|
||||||
|
:key="item"
|
||||||
|
:label="`${item}条/页`"
|
||||||
|
:value="item">
|
||||||
|
</el-option>
|
||||||
|
</el-select>
|
||||||
<button class="pagination-btn" :disabled="currentPage === 1" @click="goFirst">
|
<button class="pagination-btn" :disabled="currentPage === 1" @click="goFirst">
|
||||||
首页
|
首页
|
||||||
</button>
|
</button>
|
||||||
@@ -82,10 +90,12 @@ export default {
|
|||||||
paramsList: [],
|
paramsList: [],
|
||||||
currentPage: 1,
|
currentPage: 1,
|
||||||
pageSize: 5,
|
pageSize: 5,
|
||||||
|
pageSizeOptions: [5, 10, 20, 50, 100],
|
||||||
total: 0,
|
total: 0,
|
||||||
dialogVisible: false,
|
dialogVisible: false,
|
||||||
dialogTitle: "新增参数",
|
dialogTitle: "新增参数",
|
||||||
isAllSelected: false,
|
isAllSelected: false,
|
||||||
|
tableMaxHeight: 400,
|
||||||
paramForm: {
|
paramForm: {
|
||||||
id: null,
|
id: null,
|
||||||
paramCode: "",
|
paramCode: "",
|
||||||
@@ -96,7 +106,9 @@ export default {
|
|||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
this.fetchParams();
|
this.fetchParams();
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
computed: {
|
computed: {
|
||||||
pageCount() {
|
pageCount() {
|
||||||
return Math.ceil(this.total / this.pageSize);
|
return Math.ceil(this.total / this.pageSize);
|
||||||
@@ -118,6 +130,11 @@ export default {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
handlePageSizeChange(val) {
|
||||||
|
this.pageSize = val;
|
||||||
|
this.currentPage = 1;
|
||||||
|
this.fetchParams();
|
||||||
|
},
|
||||||
fetchParams() {
|
fetchParams() {
|
||||||
Api.admin.getParamsList(
|
Api.admin.getParamsList(
|
||||||
{
|
{
|
||||||
@@ -192,7 +209,6 @@ export default {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const paramCount = params.length;
|
const paramCount = params.length;
|
||||||
this.$confirm(`确定要删除选中的${paramCount}个参数吗?`, '警告', {
|
this.$confirm(`确定要删除选中的${paramCount}个参数吗?`, '警告', {
|
||||||
confirmButtonText: '确定',
|
confirmButtonText: '确定',
|
||||||
@@ -212,7 +228,7 @@ export default {
|
|||||||
message: `成功删除${paramCount}个参数`,
|
message: `成功删除${paramCount}个参数`,
|
||||||
showClose: true
|
showClose: true
|
||||||
});
|
});
|
||||||
this.fetchParams(); // 刷新参数列表
|
this.fetchParams();
|
||||||
} else {
|
} else {
|
||||||
this.$message.error({
|
this.$message.error({
|
||||||
message: data.msg || '删除失败,请重试',
|
message: data.msg || '删除失败,请重试',
|
||||||
@@ -346,6 +362,7 @@ export default {
|
|||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
margin-top: 10px;
|
margin-top: 10px;
|
||||||
|
padding-bottom: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.ctrl_btn {
|
.ctrl_btn {
|
||||||
@@ -402,6 +419,10 @@ export default {
|
|||||||
gap: 8px;
|
gap: 8px;
|
||||||
margin-top: 15px;
|
margin-top: 15px;
|
||||||
|
|
||||||
|
.el-select {
|
||||||
|
margin-right: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
.pagination-btn:first-child,
|
.pagination-btn:first-child,
|
||||||
.pagination-btn:nth-child(2),
|
.pagination-btn:nth-child(2),
|
||||||
.pagination-btn:nth-last-child(2) {
|
.pagination-btn:nth-last-child(2) {
|
||||||
@@ -462,6 +483,7 @@ export default {
|
|||||||
|
|
||||||
:deep(.transparent-table) {
|
:deep(.transparent-table) {
|
||||||
background: white;
|
background: white;
|
||||||
|
flex: 1;
|
||||||
|
|
||||||
.el-table__header th {
|
.el-table__header th {
|
||||||
background: white !important;
|
background: white !important;
|
||||||
@@ -550,4 +572,29 @@ export default {
|
|||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.page-size-select {
|
||||||
|
width: 100px;
|
||||||
|
margin-right: 8px;
|
||||||
|
|
||||||
|
:deep(.el-input__inner) {
|
||||||
|
height: 32px;
|
||||||
|
line-height: 32px;
|
||||||
|
border-radius: 4px;
|
||||||
|
border: 1px solid #e4e7ed;
|
||||||
|
background: #dee7ff;
|
||||||
|
color: #606266;
|
||||||
|
font-size: 14px;
|
||||||
|
}
|
||||||
|
|
||||||
|
:deep(.el-input__suffix) {
|
||||||
|
line-height: 32px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
:deep(.el-table) {
|
||||||
|
.el-table__body-wrapper {
|
||||||
|
transition: height 0.3s ease;
|
||||||
|
}
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
Reference in New Issue
Block a user