Commit ee1d5b74 by lzzzzl

体验更改

parent c34a5b04
...@@ -59,8 +59,9 @@ class AccessApiController extends Controller ...@@ -59,8 +59,9 @@ class AccessApiController extends Controller
$limit = $request['limit']; $limit = $request['limit'];
$p = $request['p']; $p = $request['p'];
$task_code = !empty($request['task_code']) ? $request['task_code'] : '';
$data = (new SpiderModel())->spiderList($limit, $p); $data = (new SpiderModel())->spiderList($limit, $p, $task_code);
$this->ExportLayui(0,'成功',$data['data'],$data['total']); $this->ExportLayui(0,'成功',$data['data'],$data['total']);
} }
......
...@@ -20,12 +20,16 @@ class SpiderModel extends Model ...@@ -20,12 +20,16 @@ class SpiderModel extends Model
* @param $p * @param $p
* @return mixed * @return mixed
*/ */
public function spiderList($limit, $p) { public function spiderList($limit, $p, $task_code) {
$limit = !empty($limit) ? $limit : ''; $limit = !empty($limit) ? $limit : '';
$p = !empty($p) ? $p : 1; $p = !empty($p) ? $p : 1;
$data = $this->where('status','!=',2)->paginate($limit,['*'],'p',$p)->toArray(); $map = [];
if (!empty($task_code))
$map[] = ['task_code', '=', $task_code];
$data = $this->where('status','!=',2)->where($map)->paginate($limit,['*'],'p',$p)->toArray();
foreach ($data['data'] as $k => $v) { foreach ($data['data'] as $k => $v) {
$data['data'][$k]['status_name'] = platform_status($v['status']); $data['data'][$k]['status_name'] = platform_status($v['status']);
......
...@@ -6,28 +6,50 @@ layui.use(['table', 'form', 'laydate', 'layer'], function () { ...@@ -6,28 +6,50 @@ layui.use(['table', 'form', 'laydate', 'layer'], function () {
table.render({ table.render({
elem:'#table', elem:'#table',
loading:true, loading:true,
cellMinWidth: 150, cellMinWidth: 100,
page:true, page:true,
limit: 50,
url: '/api/ApiSpiderList/', url: '/api/ApiSpiderList/',
request:{pageName:'p', limitName:'limit'}, request:{pageName:'p', limitName:'limit'},
cols: [[ cols: [[
{field:'status', title:'状态', width:85, templet: '#switchTpl', unresize: true}, {field:'status', title:'状态', width:85, templet: '#switchTpl', unresize: true},
{field:'platform', title:'平台名称'}, {field:'task_code', title:'任务码', sort: true},
{field:'task_code', title:'任务码'}, {field:'concurrency', title:'并发数', sort: true},
{field:'concurrency', title:'并发数'}, {field:'platform', title:'平台名称', sort: true},
{field:'queue', title:'队列'}, {field:'queue', title:'队列', width: 250, sort: true},
{field:'unique_code', title:'唯一码'}, {field:'remain_task', title:'剩余任务数', width: 140, sort: true},
{field:'start_time', title:'开始时间', width:200}, {field:'remain_wrong_task', title:'剩余异常任务数', width:140, sort: true},
{field:'run_time', title:'运行时间', width:200}, {field:'wrong_radio', title:'错误率', sort: true},
{field:'task_type', title:'任务类型'}, {field:'start_time', title:'开始时间', width:200, sort: true},
{field:'remain_task', title:'剩余任务数'}, {field:'run_time', title:'运行时间', width:200, sort: true},
{field:'remain_wrong_task', title:'剩余异常任务数'}, {field:'task_type', title:'任务类型', sort: true},
{field:'wrong_radio', title:'错误率'}, {field:'unique_code', title:'唯一码', width: 250, sort: true},
{fixed: 'right', title:'', align:'center', toolbar: '#modify', width: 200}, {fixed: 'right', title:'', align:'center', toolbar: '#modify', width: 200},
]], ]],
id: 'idTest' id: 'idTest'
}); });
var $ = layui.$, active = {
reload: function(){
//执行重载
table.reload('idTest', {
page: {
curr: 1 //重新从第 1 页开始
}
, where: {
task_code: $('#task_code').val(),
}
})
},
};
$('.load').on('click', function(){
var type = $(this).data('type');
active[type] ? active[type].call(this) : '';
});
form.on('switch(status)', function(){ form.on('switch(status)', function(){
var data = { var data = {
id:$(this).attr('data-id'), id:$(this).attr('data-id'),
......
...@@ -18,10 +18,8 @@ layui.use(['table', 'form', 'laydate', 'layer'], function () { ...@@ -18,10 +18,8 @@ layui.use(['table', 'form', 'laydate', 'layer'], function () {
var data = { var data = {
id:$('#id').val(), id:$('#id').val(),
platform: $("#platform").val(), platform: $("#platform").val(),
task_code:$("#task_code").val(),
concurrency:$("#concurrency").val(), concurrency:$("#concurrency").val(),
queue:$("#queue").val(), queue:$("#queue").val(),
start_time:$("#start_time").val(),
task_type:$("#task_type").val(), task_type:$("#task_type").val(),
} }
$.ajax({ $.ajax({
......
<div class="layui-form"> <div class="layui-form">
<div class="layui-form-item"> <div class="layui-form-item">
<button class="layui-btn layui-btn-fluid" id="add" lay-submit lay-filter="add" style="width: 216px">添加配置</button> <div class="layui-inline">
<button class="layui-btn layui-btn-fluid" id="add" lay-submit lay-filter="add" style="width: 216px">添加配置</button>
</div>
<div class="layui-inline">
<input type="hidden" class="layui-input">
</div>
<div class="layui-inline">
<div class="layui-input-inline">
<input type="text" id="task_code" placeholder="请输入任务码" autocomplete="off" class="layui-input" value="{{$_GET['name'] or ''}}">
</div>
</div>
<div class="layui-inline">
<button class="btn btn btn-outline btn-primary load" id="search" lay-submit lay-filter="*" data-type="reload">搜索</button>
</div>
</div> </div>
<table class="layui-table" id="table" lay-filter="demo"> <table class="layui-table" id="table" lay-filter="demo">
</table> </table>
......
...@@ -8,12 +8,6 @@ ...@@ -8,12 +8,6 @@
<input type="text" name="platform" id="platform" value="{{$detail['platform'] or ''}}" lay-verify="required" autocomplete="off" class="layui-input"> <input type="text" name="platform" id="platform" value="{{$detail['platform'] or ''}}" lay-verify="required" autocomplete="off" class="layui-input">
</div> </div>
</div> </div>
<div class="layui-form-item">
<label class="layui-form-label">任务码</label>
<div class="layui-input-block">
<input type="text" name="task_code" id="task_code" value="{{$detail['task_code'] or ''}}" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-form-item layui-form-text"> <div class="layui-form-item layui-form-text">
<label class="layui-form-label">并发数</label> <label class="layui-form-label">并发数</label>
<div class="layui-input-block"> <div class="layui-input-block">
...@@ -27,12 +21,6 @@ ...@@ -27,12 +21,6 @@
</div> </div>
</div> </div>
<div class="layui-form-item layui-form-text"> <div class="layui-form-item layui-form-text">
<label class="layui-form-label"><span class="layui-badge-dot"></span>开始时间</label>
<div class="layui-input-block">
<input type="text" name="start_time" id="start_time" autocomplete="off" class="layui-input" value="{{$detail['start_time'] or ''}}" lay-verify="required">
</div>
</div>
<div class="layui-form-item layui-form-text">
<label class="layui-form-label">任务类型</label> <label class="layui-form-label">任务类型</label>
<div class="layui-input-block"> <div class="layui-input-block">
<input type="text" name="task_type" id="task_type" value="{{$detail['task_type'] or ''}}" autocomplete="off" class="layui-input"> <input type="text" name="task_type" id="task_type" value="{{$detail['task_type'] or ''}}" autocomplete="off" class="layui-input">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment