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