Commit ad9db969 by lzzzzl

修改

parent ee1d5b74
......@@ -126,4 +126,14 @@ class AccessApiController extends Controller
}
/**
* 更新所有面板状态
*/
private function ApiUpdateAllBoard() {
$data = (new SpiderModel())->updateAllBoard();
$this->Export($data);
}
}
......@@ -345,4 +345,16 @@ class AccessController extends Controller
return view('spiderwindow', $data);
}
/**
* 列表页快速修改
* @param $request
* @param $data
* @param $id
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
*/
public function boardQuickModify($request, $data, $id) {
$data['title'] = '快速修改';
return view('spiderwindow', $data);
}
}
......@@ -201,3 +201,14 @@ function export_csv($data = [], $header_data = [], $file_name = '')
fclose($fp);exit;
}
function time2string($second){
$day = floor($second/(3600*24));
$second = $second%(3600*24);
$hour = floor($second/3600);
$second = $second%3600;
$minute = floor($second/60);
$second = $second%60;
// 不用管怎么实现的,能用就ok
return $day.'天'.$hour.'小时'.$minute.'分'.$second.'秒';
}
......@@ -34,7 +34,7 @@ class SpiderModel extends Model
foreach ($data['data'] as $k => $v) {
$data['data'][$k]['status_name'] = platform_status($v['status']);
$data['data'][$k]['start_time'] = date("Y-m-d H:i:s", $v['start_time']);
$data['data'][$k]['run_time'] .= '秒';
$data['data'][$k]['run_time'] = time2string($v['run_time']);
}
return $data;
......@@ -201,4 +201,24 @@ class SpiderModel extends Model
}
/**
* 更新所有面板状态
* @return array
*/
public function updateAllBoard() {
$collect = Request::all();
$collect = TrimX($collect, false, ['status']);
unset($collect['s']);
$result = DB::connection('dashboard')->table('spider_board')->where('status', '!=', '2')->update($collect);
if ($result) {
return [0,'成功'];
} else {
return [1,'失败'];
}
}
}
......@@ -6,7 +6,7 @@ return [
'NotAuth'
),
//api不用验证方法
'ApiNotAuth'=>array('ApiSpiderList','ApiUpdateStatus','ApiConfigContent','ApiAddConfig','ApiUpdateNode','ApiUpdateAllNode'
'ApiNotAuth'=>array('ApiSpiderList','ApiUpdateStatus','ApiConfigContent','ApiAddConfig','ApiUpdateNode','ApiUpdateAllNode','ApiUpdateAllBoard'
),
'MenuSign'=>'/web/',//菜单去除掉标记,生成菜单时用
......
......@@ -141,3 +141,18 @@ $('#add').click(function () {
});
});
});
$('#quick_modify').click(function () {
layui.use('layer', function () {
var layer = layui.layer;
layer.open({
type: 2,
area: ['250px', '250px'],
offset: '100px',
fixed: false,
maxmin: true,
content: '/web/boardquickmodify',
title: '快速修改',
});
});
});
var status = 1;
layui.use(['table', 'form', 'laydate', 'layer'], function () {
var form = layui.form;
form.on('switch(status)', function(){
status = this.checked ? 0:1
});
})
$('#submit').click(function () {
$.ajax({
url:'/api/ApiUpdateAllBoard',
type:'get',
dataType:'json',
data: {'status': status},
success:function () {
layer.msg('修改成功');
window.parent.location.reload();
parent.layer.closeAll();
},
error:function () {
layer.msg('修改失败');
}
});
});
......@@ -4,6 +4,9 @@
<button class="layui-btn layui-btn-fluid" id="add" lay-submit lay-filter="add" style="width: 216px">添加配置</button>
</div>
<div class="layui-inline">
<button class="layui-btn layui-btn-normal" id="quick_modify" lay-submit lay-filter="quick_modify" style="width: 216px;">一键更改</button>
</div>
<div class="layui-inline">
<input type="hidden" class="layui-input">
</div>
<div class="layui-inline">
......
<div class="layui-form">
<div class="layui-input-block">
<input type="checkbox" name="check" value="" lay-skin="switch" lay-text="启动|停止" lay-filter="status">
</div>
<br>
<br>
<br>
<div class="layui-input-block">
<button id="submit" class="layui-btn">确认</button>
</div>
</div>
\ No newline at end of file
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