mirror of
https://github.com/TeaOSLab/EdgeAdmin.git
synced 2025-11-04 05:00:25 +08:00
可以在管理界面设置里设置默认每页显示数
This commit is contained in:
@@ -94,5 +94,6 @@ func defaultAdminUIConfig() *systemconfigs.AdminUIConfig {
|
|||||||
ShowOpenSourceInfo: true,
|
ShowOpenSourceInfo: true,
|
||||||
ShowVersion: true,
|
ShowVersion: true,
|
||||||
ShowFinance: true,
|
ShowFinance: true,
|
||||||
|
DefaultPageSize: 10,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"github.com/TeaOSLab/EdgeAdmin/internal/configloaders"
|
||||||
"github.com/TeaOSLab/EdgeAdmin/internal/oplogs"
|
"github.com/TeaOSLab/EdgeAdmin/internal/oplogs"
|
||||||
"github.com/TeaOSLab/EdgeAdmin/internal/rpc"
|
"github.com/TeaOSLab/EdgeAdmin/internal/rpc"
|
||||||
"github.com/TeaOSLab/EdgeAdmin/internal/utils"
|
"github.com/TeaOSLab/EdgeAdmin/internal/utils"
|
||||||
@@ -55,7 +56,14 @@ func (this *ParentAction) NewPage(total int64, size ...int64) *Page {
|
|||||||
if len(size) > 0 {
|
if len(size) > 0 {
|
||||||
return NewActionPage(this, total, size[0])
|
return NewActionPage(this, total, size[0])
|
||||||
}
|
}
|
||||||
return NewActionPage(this, total, 10)
|
|
||||||
|
var pageSize int64 = 10
|
||||||
|
adminConfig, err := configloaders.LoadAdminUIConfig()
|
||||||
|
if err == nil && adminConfig.DefaultPageSize > 0 {
|
||||||
|
pageSize = int64(adminConfig.DefaultPageSize)
|
||||||
|
}
|
||||||
|
|
||||||
|
return NewActionPage(this, total, pageSize)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *ParentAction) Nav(mainMenu string, tab string, firstMenu string) {
|
func (this *ParentAction) Nav(mainMenu string, tab string, firstMenu string) {
|
||||||
|
|||||||
@@ -22,6 +22,9 @@ func (this *IndexAction) RunGet(params struct{}) {
|
|||||||
this.ErrorPage(err)
|
this.ErrorPage(err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
if config.DefaultPageSize == 0 {
|
||||||
|
config.DefaultPageSize = 10
|
||||||
|
}
|
||||||
this.Data["config"] = config
|
this.Data["config"] = config
|
||||||
|
|
||||||
this.Show()
|
this.Show()
|
||||||
@@ -36,6 +39,7 @@ func (this *IndexAction) RunPost(params struct {
|
|||||||
Version string
|
Version string
|
||||||
FaviconFile *actions.File
|
FaviconFile *actions.File
|
||||||
LogoFile *actions.File
|
LogoFile *actions.File
|
||||||
|
DefaultPageSize int
|
||||||
|
|
||||||
Must *actions.Must
|
Must *actions.Must
|
||||||
CSRF *actionutils.CSRF
|
CSRF *actionutils.CSRF
|
||||||
@@ -46,7 +50,10 @@ func (this *IndexAction) RunPost(params struct {
|
|||||||
Field("productName", params.ProductName).
|
Field("productName", params.ProductName).
|
||||||
Require("请输入产品名称").
|
Require("请输入产品名称").
|
||||||
Field("adminSystemName", params.AdminSystemName).
|
Field("adminSystemName", params.AdminSystemName).
|
||||||
Require("请输入管理员系统名称")
|
Require("请输入管理员系统名称").
|
||||||
|
Field("defaultPageSize", params.DefaultPageSize).
|
||||||
|
Gte(0, "默认每页显示数不能小于0").
|
||||||
|
Lte(100, "默认每页显示数不能大于100")
|
||||||
|
|
||||||
config, err := configloaders.LoadAdminUIConfig()
|
config, err := configloaders.LoadAdminUIConfig()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -60,6 +67,12 @@ func (this *IndexAction) RunPost(params struct {
|
|||||||
config.ShowVersion = params.ShowVersion
|
config.ShowVersion = params.ShowVersion
|
||||||
config.Version = params.Version
|
config.Version = params.Version
|
||||||
|
|
||||||
|
if params.DefaultPageSize > 0 {
|
||||||
|
config.DefaultPageSize = params.DefaultPageSize
|
||||||
|
} else {
|
||||||
|
config.DefaultPageSize = 10
|
||||||
|
}
|
||||||
|
|
||||||
// 上传Favicon文件
|
// 上传Favicon文件
|
||||||
if params.FaviconFile != nil {
|
if params.FaviconFile != nil {
|
||||||
createResp, err := this.RPC().FileRPC().CreateFile(this.AdminContext(), &pb.CreateFileRequest{
|
createResp, err := this.RPC().FileRPC().CreateFile(this.AdminContext(), &pb.CreateFileRequest{
|
||||||
|
|||||||
@@ -76,5 +76,16 @@
|
|||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
|
<h4>其他</h4>
|
||||||
|
<table class="ui table definition selectable">
|
||||||
|
<tr>
|
||||||
|
<td class="title">每页显示数</td>
|
||||||
|
<td>
|
||||||
|
<input type="text" name="defaultPageSize" v-model="config.defaultPageSize" maxlength="3" style="width: 4em"/>
|
||||||
|
<p class="comment">在有分页的地方每页显示数量;不能超过100。</p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
|
||||||
<submit-btn></submit-btn>
|
<submit-btn></submit-btn>
|
||||||
</form>
|
</form>
|
||||||
Reference in New Issue
Block a user