爬虫列表页增加搜索功能
This commit is contained in:
parent
e8d4239d06
commit
942f87d800
@ -9,6 +9,7 @@ import java.util.stream.Collectors;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
@ -100,8 +101,8 @@ public class SpiderFlowController {
|
||||
* @return Page<SpiderFlow> 所有爬虫的列表页
|
||||
*/
|
||||
@RequestMapping("/list")
|
||||
public IPage<SpiderFlow> list(@RequestParam(name = "page",defaultValue = "1")Integer page, @RequestParam(name = "limit",defaultValue = "1")Integer size){
|
||||
return spiderFlowService.page(new Page<SpiderFlow>(page, size), new QueryWrapper<SpiderFlow>().orderByDesc("create_date"));
|
||||
public IPage<SpiderFlow> list(@RequestParam(name = "page", defaultValue = "1") Integer page, @RequestParam(name = "limit", defaultValue = "1") Integer size, @RequestParam(name = "name", defaultValue = "") String name) {
|
||||
return spiderFlowService.page(new Page<>(page, size), new QueryWrapper<SpiderFlow>().like("name", name).orderByDesc("create_date"));
|
||||
}
|
||||
|
||||
@RequestMapping("/save")
|
||||
|
@ -8,7 +8,17 @@
|
||||
<script type="text/javascript" src="js/layui/layui.all.js" ></script>
|
||||
</head>
|
||||
<body style="padding:5px;">
|
||||
<a class="layui-btn layui-btn-sm layui-btn-normal" href="editor.html"><i class="layui-icon"></i> 添加爬虫</a>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">爬虫名称</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" name="name" required lay-verify="required" placeholder="请输入爬虫名称" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
<div class="layui-input-inline" style="margin-top:5px">
|
||||
<a class="layui-btn layui-btn-sm layui-btn-normal btn-search"><i class="layui-icon"></i> 搜索</a>
|
||||
<a class="layui-btn layui-btn-sm layui-btn-normal" href="editor.html"><i class="layui-icon"></i> 添加爬虫</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<hr>
|
||||
<table class="layui-table" id="table" lay-filter="table"></table>
|
||||
<script>
|
||||
@ -17,6 +27,7 @@
|
||||
id : 'table',
|
||||
elem : '#table',
|
||||
url : 'spider/list',
|
||||
method : 'post',
|
||||
page : true,
|
||||
parseData : function(resp){
|
||||
return {
|
||||
@ -97,7 +108,19 @@
|
||||
}
|
||||
})
|
||||
})
|
||||
$("body").on('click','.btn-remove',function(){
|
||||
function reloadTable(){
|
||||
$table.reload({
|
||||
where : {
|
||||
name : $('input[name=name]').val()
|
||||
},
|
||||
page : {
|
||||
curr : 1
|
||||
}
|
||||
})
|
||||
}
|
||||
$("body").on('click','.btn-search',function(){
|
||||
reloadTable();
|
||||
}).on('click','.btn-remove',function(){
|
||||
var id = $(this).data('id');
|
||||
layui.layer.confirm('您确定要删除此爬虫吗?',{
|
||||
title : '删除'
|
||||
|
Loading…
Reference in New Issue
Block a user