refactor(web): 增加分页通用配置

This commit is contained in:
2023-06-14 15:21:01 +08:00
parent edbf54a519
commit 58487be66a
5 changed files with 28 additions and 66 deletions

View File

@@ -8,6 +8,22 @@ function crudCommonOptions() {
}
}
function paginationCommonOptions(perPage = true) {
let option = {
type: 'pagination',
layout: [
'pager'
],
maxButtons: 5,
showPageInput: false,
perPageAvailable: [10, 15, 20, 50, 100, 200],
}
if (perPage) {
option.layout.push('perPage')
}
return option
}
function timeAndFrom(field, fromNow, emptyText = '未停止', showSource = true) {
let tpl = "${IF(" + field + " === 0, '(" + emptyText + ")', CONCATENATE('<span class=\"font-bold\">'," + fromNow + ",'</span>'))}"
if (showSource) {
@@ -543,12 +559,7 @@ function simpleYarnDialog(cluster, title, filterField) {
perPage: 10,
headerToolbar: [
"reload",
{
type: 'pagination',
layout: ['pager', 'perPage'],
maxButtons: 5,
showPageInput: false,
}
paginationCommonOptions(),
],
footerToolbar: [],
columns: yarnCrudColumns(),
@@ -769,28 +780,14 @@ function tableMetaDialog() {
filter_type: 'active',
},
},
affixHeader: true,
syncLocation: false,
silentPolling: true,
stopAutoRefreshWhenModalIsOpen: true,
resizable: false,
perPage: 10,
...crudCommonOptions(),
perPage: 15,
headerToolbar: [
"reload",
{
type: 'pagination',
layout: ['pager', 'perPage'],
maxButtons: 5,
showPageInput: false,
},
paginationCommonOptions(),
],
footerToolbar: [
{
type: 'pagination',
layout: ['pager', 'perPage'],
maxButtons: 5,
showPageInput: false,
},
paginationCommonOptions(),
],
columns: [
{