feat: 增加分页工具栏和标签
This commit is contained in:
@@ -31,14 +31,15 @@ class OverviewController {
|
||||
"items" to result.content.map {
|
||||
val iframe = (sites.firstOrNull { site -> site.code == it.code }?.properties?.get("iframe")?: "false").toBoolean()
|
||||
mapOf(
|
||||
"code" to code,
|
||||
"code" to it.code,
|
||||
"title" to it.title,
|
||||
"subtitle" to it.subtitle,
|
||||
"author" to it.author,
|
||||
"description" to it.description,
|
||||
"url" to it.url,
|
||||
"createTime" to it.createTime,
|
||||
"iframe" to iframe
|
||||
"iframe" to iframe,
|
||||
"category" to it.category,
|
||||
)
|
||||
},
|
||||
"total" to result.totalElements,
|
||||
|
||||
@@ -1,3 +1,31 @@
|
||||
function pagination() {
|
||||
return {
|
||||
type: 'pagination',
|
||||
layout: 'total,perPage,pager',
|
||||
model: 'normal',
|
||||
maxButtons: 10,
|
||||
showPageInput: false,
|
||||
perPageAvailable: [10, 15, 20],
|
||||
activePage: '${page|default:1}',
|
||||
total: '${total|default:0}',
|
||||
className: 'text-right',
|
||||
onEvent: {
|
||||
change: {
|
||||
actions: [
|
||||
{
|
||||
actionType: 'reload',
|
||||
componentId: 'news_list',
|
||||
args: {
|
||||
page: '${event.data.page}',
|
||||
count: '${event.data.perPage}',
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function overviewTab() {
|
||||
return {
|
||||
title: '总览',
|
||||
@@ -14,6 +42,18 @@ function overviewTab() {
|
||||
}
|
||||
},
|
||||
body: [
|
||||
{
|
||||
type: 'action',
|
||||
icon: 'fa fa-refresh',
|
||||
label: '刷新',
|
||||
className: 'mb-2',
|
||||
actionType: 'reload',
|
||||
target: 'news_list',
|
||||
},
|
||||
{
|
||||
...pagination(),
|
||||
className: 'float-right',
|
||||
},
|
||||
{
|
||||
type: 'list',
|
||||
listItem: {
|
||||
@@ -92,38 +132,34 @@ function overviewTab() {
|
||||
tpl: '${description}',
|
||||
},
|
||||
{
|
||||
type: 'tpl',
|
||||
className: 'text-sm font-medium mt-1 text-dark',
|
||||
tpl: '${DATETOSTR(DATE(createTime), \'YYYY-MM-DD HH:mm\')} ${author}',
|
||||
type: 'wrapper',
|
||||
size: 'none',
|
||||
className: 'mt-2',
|
||||
body: [
|
||||
{
|
||||
type: 'tag',
|
||||
label: '${DATETOSTR(DATE(createTime), \'YYYY-MM-DD HH:mm\')}',
|
||||
displayMode: 'rounded',
|
||||
color: '#4096ff',
|
||||
},
|
||||
{
|
||||
type: 'tag',
|
||||
label: '${category}',
|
||||
displayMode: 'rounded',
|
||||
color: '#2fa15d',
|
||||
},
|
||||
{
|
||||
type: 'tag',
|
||||
label: '${author}',
|
||||
displayMode: 'rounded',
|
||||
color: '#ff8888',
|
||||
},
|
||||
]
|
||||
},
|
||||
]
|
||||
},
|
||||
},
|
||||
{
|
||||
type: 'pagination',
|
||||
layout: 'total,perPage,pager',
|
||||
model: 'normal',
|
||||
maxButtons: 10,
|
||||
showPageInput: false,
|
||||
perPageAvailable: [10, 15, 20],
|
||||
activePage: '${page|default:1}',
|
||||
total: '${total|default:0}',
|
||||
className: 'text-right',
|
||||
onEvent: {
|
||||
change: {
|
||||
actions: [
|
||||
{
|
||||
actionType: 'reload',
|
||||
componentId: 'news_list',
|
||||
args: {
|
||||
page: '${event.data.page}',
|
||||
count: '${event.data.perPage}',
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
pagination(),
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user