调整首页,完善列表
This commit is contained in:
parent
e4358c9acc
commit
45a7e3d9e1
@ -90,16 +90,19 @@ public class RouteHandler extends BaseHandler {
|
||||
* @return
|
||||
*/
|
||||
public Mono<ServerResponse> list(ServerRequest serverRequest) {
|
||||
Optional<String> keyword = serverRequest.queryParam("keyword");
|
||||
Optional<String> keywords = serverRequest.queryParam("keywords");
|
||||
|
||||
Route route = new Route();
|
||||
Example example = Example.of(route);
|
||||
if (keywords.isPresent()) {
|
||||
route.setSystem(keywords.get());
|
||||
route.setSummary(keywords.get());
|
||||
|
||||
ExampleMatcher exampleMatcher = ExampleMatcher.matchingAny()
|
||||
.withMatcher("system", ExampleMatcher.GenericPropertyMatcher::contains)
|
||||
.withMatcher("summary", ExampleMatcher.GenericPropertyMatcher::contains)
|
||||
.withIgnoreCase("id");
|
||||
Example example = Example.of(route, exampleMatcher);
|
||||
if (keyword.isPresent()) {
|
||||
route.setSystem(keyword.get());
|
||||
route.setSummary(keyword.get());
|
||||
example = Example.of(route, exampleMatcher);
|
||||
}
|
||||
return ServerResponse.ok().contentType(MediaType.APPLICATION_JSON).body(routeDao.findAll(example), Route.class);
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ public class RouteRouter {
|
||||
@Bean
|
||||
public RouterFunction<ServerResponse> routeRouterFunction(RouteHandler routeHandler) {
|
||||
// 嵌套
|
||||
return RouterFunctions.nest(RequestPredicates.path("/wg/route"),
|
||||
return RouterFunctions.nest(RequestPredicates.path("/wg/api/route"),
|
||||
RouterFunctions
|
||||
.route(RequestPredicates.POST("/save"), routeHandler::save)
|
||||
.andRoute(RequestPredicates.DELETE("/delete/{ids}"), routeHandler::delete)
|
||||
|
@ -0,0 +1,25 @@
|
||||
html {
|
||||
background: #f3f3f3
|
||||
}
|
||||
|
||||
.iframe-container {
|
||||
margin: 15px;
|
||||
background: #FFFFFF;
|
||||
}
|
||||
|
||||
.iframe-container .iframe-box {}
|
||||
|
||||
.iframe-container .iframe-box iframe {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.iframe-container .iframe-breadcrumb-box {
|
||||
padding: 15px;
|
||||
border-bottom: 1px solid #F3F3F3;
|
||||
}
|
||||
|
||||
.list-page-container {
|
||||
background: #FFFFFF;
|
||||
padding: 15px 15px 5px 15px;
|
||||
}
|
||||
|
@ -4,10 +4,11 @@
|
||||
<base href="/wg/">
|
||||
<meta charset="UTF-8">
|
||||
<title>网关管理</title>
|
||||
<link rel="stylesheet" href="assets/layui-v2.6.4/layui/css/layui.css">
|
||||
<link rel="stylesheet" href="assets/layui-v2.6.4/layui/css/layui.css"/>
|
||||
<link rel="stylesheet" href="assets/layui-v2.6.4/layui/css/admin.css"/>
|
||||
</head>
|
||||
<body>
|
||||
<div>
|
||||
<div class="layui-app">
|
||||
<div class="layui-header">
|
||||
<ul class="layui-nav layui-bg-blue" lay-filter="">
|
||||
<li class="layui-nav-item">
|
||||
@ -26,8 +27,16 @@
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="layui-body" id="LAY_app_body">
|
||||
<div class="layadmin-tabsbody-item layui-show">
|
||||
<div class="iframe-container">
|
||||
<div class="iframe-breadcrumb-box">
|
||||
<span class="layui-breadcrumb">
|
||||
<a href="">首页</a>
|
||||
<a href="">国际新闻</a>
|
||||
<a href="">亚太地区</a>
|
||||
<a><cite>正文</cite></a>
|
||||
</span>
|
||||
</div>
|
||||
<div class="iframe-box">
|
||||
<iframe id="defaultIFrame" frameborder="0" class="layadmin-iframe"></iframe>
|
||||
</div>
|
||||
</div>
|
||||
@ -36,16 +45,27 @@
|
||||
<script>
|
||||
layui.config({
|
||||
base: 'assets/layui-v2.6.4/layui/modules/'
|
||||
}).extend({}).use(['restajax', 'datamessage', 'dialog'], function() {
|
||||
}).extend({}).use(['restajax', 'datamessage', 'dialog'], function () {
|
||||
var $ = layui.$;
|
||||
var $win = $(window);
|
||||
var layer = layui.layer;
|
||||
window.dialog = layui.dialog;
|
||||
window.restAjax = layui.restajax;
|
||||
window.dataMessage = layui.datamessage;
|
||||
|
||||
function resize() {
|
||||
$('#defaultIFrame').css({
|
||||
width: ($win.width() - 30) +'px',
|
||||
height: ($win.height() - 145) +'px'
|
||||
})
|
||||
}
|
||||
resize();
|
||||
|
||||
window.onresize = resize;
|
||||
|
||||
$('#defaultIFrame').attr('src', 'route/route/list.html');
|
||||
$('#LAY-logout').on('click', function() {
|
||||
top.dialog.confirm('确认退出?', function() {
|
||||
$('#LAY-logout').on('click', function () {
|
||||
top.dialog.confirm('确认退出?', function () {
|
||||
window.location.href = 'logout';
|
||||
});
|
||||
});
|
||||
|
@ -4,20 +4,16 @@
|
||||
<base href="/wg/">
|
||||
<meta charset="UTF-8">
|
||||
<link rel="stylesheet" href="assets/layui-v2.6.4/layui/css/layui.css">
|
||||
<link rel="stylesheet" href="assets/layui-v2.6.4/layui/css/admin.css"/>
|
||||
</head>
|
||||
<body>
|
||||
<div class="layui-anim layui-anim-fadein">
|
||||
<div class="layui-row">
|
||||
<div class="layui-col-md12">
|
||||
<div class="layui-card">
|
||||
<div class="layui-card-body">
|
||||
<div class="test-table-reload-btn" style="margin-bottom: 10px;">
|
||||
<div class="layui-anim layui-anim-fadein list-page-container">
|
||||
<div class="test-table-reload-btn">
|
||||
<div class="layui-inline">
|
||||
<input type="text" id="keywords" class="layui-input search-item" placeholder="输入关键字">
|
||||
</div>
|
||||
<div class="layui-inline">
|
||||
<input type="text" id="startTime" class="layui-input search-item" placeholder="开始时间"
|
||||
readonly>
|
||||
<input type="text" id="startTime" class="layui-input search-item" placeholder="开始时间" readonly>
|
||||
</div>
|
||||
<div class="layui-inline">
|
||||
<input type="text" id="endTime" class="layui-input search-item" placeholder="结束时间" readonly>
|
||||
@ -41,16 +37,8 @@
|
||||
lay-event="removeEvent">
|
||||
<i class="fa fa-lg fa-trash"></i> 删除
|
||||
</button>
|
||||
<button id="levelUpBtn" type="button" class="layui-btn layui-btn-warm layui-btn-sm"
|
||||
lay-event="levelUpEvent" style="display: none;">
|
||||
返回上级 <i class="fa fa-lg fa-level-up"></i>
|
||||
</button>
|
||||
</div>
|
||||
</script>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script src="assets/layui-v2.6.4/layui/layui.js"></script>
|
||||
<script>
|
||||
@ -59,36 +47,38 @@
|
||||
var $win = $(window);
|
||||
var layer = layui.layer;
|
||||
var table = layui.table;
|
||||
var laydate = layui.laydate;
|
||||
var resizeTimeout = null;
|
||||
|
||||
var tableUrl = 'api/chapter/listpage/{courseId}/{parentId}';
|
||||
var tableUrl = 'api/route/list';
|
||||
var dataArray = [];
|
||||
var dataTable = null;
|
||||
|
||||
function initTable() {
|
||||
table.render({
|
||||
top.restAjax.get(top.restAjax.path(tableUrl, []), {
|
||||
keywords: $('#keywords').val(),
|
||||
startTime: $('#startTime').val(),
|
||||
endTime: $('#endTime').val()
|
||||
}, null, function(code, data) {
|
||||
dataArray = [];
|
||||
for(var i = 0, item; item = data[i++];) {
|
||||
dataArray.push(item);
|
||||
}
|
||||
if(dataTable) {
|
||||
table.reload('dataTable', {data: dataArray});
|
||||
return;
|
||||
}
|
||||
dataTable = table.render({
|
||||
elem: '#dataTable',
|
||||
id: 'dataTable',
|
||||
url: top.restAjax.path(tableUrl, []),
|
||||
width: '100%',
|
||||
height: $win.height() - 60,
|
||||
height: $win.height() - 78,
|
||||
limit: 20,
|
||||
limits: [20, 40, 60, 80, 100, 200],
|
||||
toolbar: '#headerToolBar',
|
||||
request: {
|
||||
pageName: 'page',
|
||||
limitName: 'rows'
|
||||
},
|
||||
cols: [[
|
||||
{type: 'checkbox', fixed: 'left'},
|
||||
{
|
||||
field: 'rowNum',
|
||||
width: 80,
|
||||
title: '序号',
|
||||
fixed: 'left',
|
||||
align: 'center',
|
||||
templet: '<span>{{d.LAY_INDEX}}</span>'
|
||||
},
|
||||
{
|
||||
field: 'courseName', width: 200, title: '课程名称', align: 'center',
|
||||
{field: 'rowNum', width: 80, title: '序号', fixed: 'left', align: 'center', templet: '<span>{{d.LAY_INDEX}}</span>'},
|
||||
{field: 'system', width: 200, title: '系统名称', align: 'center', sort: true,
|
||||
templet: function (row) {
|
||||
var rowData = row[this.field];
|
||||
if (typeof (rowData) === 'undefined' || rowData == null || rowData == '') {
|
||||
@ -98,37 +88,40 @@
|
||||
}
|
||||
}
|
||||
]],
|
||||
data: dataArray,
|
||||
page: true
|
||||
});
|
||||
}
|
||||
|
||||
// 重载表格
|
||||
function reloadTable(currentPage) {
|
||||
table.reload('dataTable', {
|
||||
url: top.restAjax.path(tableUrl, []),
|
||||
where: {
|
||||
keywords: $('#keywords').val(),
|
||||
startTime: $('#startTime').val(),
|
||||
endTime: $('#endTime').val()
|
||||
},
|
||||
page: {
|
||||
curr: currentPage
|
||||
},
|
||||
height: $win.height() - 60,
|
||||
console.log(table);
|
||||
}, function(code, data) {
|
||||
top.dialog.msg(data.msg);
|
||||
})
|
||||
}
|
||||
// 初始化日期
|
||||
function initDate() {
|
||||
// 日期选择
|
||||
laydate.render({
|
||||
elem: '#startTime',
|
||||
format: 'yyyy-MM-dd'
|
||||
});
|
||||
laydate.render({
|
||||
elem: '#endTime',
|
||||
format: 'yyyy-MM-dd'
|
||||
});
|
||||
}
|
||||
|
||||
initDate();
|
||||
initTable();
|
||||
// 事件 - 页面变化
|
||||
$win.on('resize', function() {
|
||||
clearTimeout(resizeTimeout);
|
||||
resizeTimeout = setTimeout(function() {
|
||||
reloadTable();
|
||||
initTable();
|
||||
}, 500);
|
||||
});
|
||||
// 事件 - 搜索
|
||||
$(document).on('click', '#search', function() {
|
||||
reloadTable(1);
|
||||
initTable();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
Loading…
Reference in New Issue
Block a user