Commit 50361874 authored by 冯超鹏's avatar 冯超鹏

应用

parent 68275847
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
.rnd 100644 → 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
...@@ -57,18 +57,13 @@ class alarm extends Command ...@@ -57,18 +57,13 @@ class alarm extends Command
{ {
$url = config('public.swoolwebsocketurl'); $url = config('public.swoolwebsocketurl');
$por = config('public.swoolwebsocketurlpor'); $por = config('public.swoolwebsocketurlpor');
$this->ws = new \swoole_websocket_server('0.0.0.0', 9601,SWOOLE_PROCESS,SWOOLE_SOCK_TCP | SWOOLE_SSL); //创建一个端口 $this->ws = new \swoole_websocket_server('0.0.0.0', 9601,SWOOLE_PROCESS); //创建一个端口
$this->ws->set(array( $this->ws->set(array(
'reactor_num' => 2, //reactor线程数 'reactor_num' => 2, //reactor线程数
'worker_num' => 4, //worker进程数 'worker_num' => 4, //worker进程数
'backlog' => 128, //Listen队列长度 'backlog' => 128, //Listen队列长度
'max_request' => 10,//最大连接 'max_request' => 10,//最大连接
'daemonize'=>0,//守护进程 'daemonize'=>0,//守护进程
'ssl_cert_file' => base_path() . '/tests/textcert/ssl.pem',
'ssl_key_file' => base_path() . '/tests/textcert/4544322_iot.zhkjgf.com.key',
// 'ssl_verify_peer' => true,
// 'ssl_allow_self_signed' => true,
// 'ssl_client_cert_file' => base_path() . '/tests/textcert/4544322_iot.zhkjgf.com_chain',
)); ));
$this->ws->on('open', function ($ws, $request) { $this->ws->on('open', function ($ws, $request) {
// //链接成功 // //链接成功
......
...@@ -57,18 +57,13 @@ class chemicalswb extends Command ...@@ -57,18 +57,13 @@ class chemicalswb extends Command
{ {
$url = config('public.swoolwebsocketurl'); $url = config('public.swoolwebsocketurl');
$por = config('public.swoolwebsocketurlpor'); $por = config('public.swoolwebsocketurlpor');
$this->ws = new \swoole_websocket_server('0.0.0.0', 9507,SWOOLE_PROCESS,SWOOLE_SOCK_TCP | SWOOLE_SSL); //创建一个端口 $this->ws = new \swoole_websocket_server('0.0.0.0', 9507,SWOOLE_PROCESS); //创建一个端口
$this->ws->set(array( $this->ws->set(array(
'reactor_num' => 2, //reactor线程数 'reactor_num' => 2, //reactor线程数
'worker_num' => 4, //worker进程数 'worker_num' => 4, //worker进程数
'backlog' => 128, //Listen队列长度 'backlog' => 128, //Listen队列长度
'max_request' => 10,//最大连接 'max_request' => 10,//最大连接
'daemonize'=>0,//守护进程 'daemonize'=>0,//守护进程
'ssl_cert_file' => base_path() . '/tests/textcert/4544322_iot.zhkjgf.com_public.crt',
'ssl_key_file' => base_path() . '/tests/textcert/4544322_iot.zhkjgf.com.key',
// 'ssl_verify_peer' => true,
// 'ssl_allow_self_signed' => true,
// 'ssl_client_cert_file' => base_path() . '/tests/textcert/4544322_iot.zhkjgf.com_chain',
)); ));
$this->ws->on('open', function ($ws, $request) { $this->ws->on('open', function ($ws, $request) {
// //链接成功 // //链接成功
......
...@@ -57,18 +57,13 @@ class firewb extends Command ...@@ -57,18 +57,13 @@ class firewb extends Command
{ {
$url = config('public.swoolwebsocketurl'); $url = config('public.swoolwebsocketurl');
$por = config('public.swoolwebsocketurlpor'); $por = config('public.swoolwebsocketurlpor');
$this->ws = new \swoole_websocket_server('0.0.0.0', 9508,SWOOLE_PROCESS,SWOOLE_SOCK_TCP | SWOOLE_SSL); //创建一个端口 $this->ws = new \swoole_websocket_server('0.0.0.0', 9508,SWOOLE_PROCESS); //创建一个端口
$this->ws->set(array( $this->ws->set(array(
'reactor_num' => 2, //reactor线程数 'reactor_num' => 2, //reactor线程数
'worker_num' => 4, //worker进程数 'worker_num' => 4, //worker进程数
'backlog' => 128, //Listen队列长度 'backlog' => 128, //Listen队列长度
'max_request' => 10,//最大连接 'max_request' => 10,//最大连接
'daemonize'=>0,//守护进程 'daemonize'=>0,//守护进程
'ssl_cert_file' => base_path() . '/tests/textcert/4544322_iot.zhkjgf.com_public.crt',
'ssl_key_file' => base_path() . '/tests/textcert/4544322_iot.zhkjgf.com.key',
'ssl_verify_peer' => true,
'ssl_allow_self_signed' => true,
'ssl_client_cert_file' => base_path() . '/tests/textcert/4544322_iot.zhkjgf.com_chain',
)); ));
$this->ws->on('open', function ($ws, $request) { $this->ws->on('open', function ($ws, $request) {
// //链接成功 // //链接成功
......
...@@ -57,18 +57,13 @@ class swoole extends Command ...@@ -57,18 +57,13 @@ class swoole extends Command
{ {
$url = config('public.swoolwebsocketurl'); $url = config('public.swoolwebsocketurl');
$por = config('public.swoolwebsocketurlpor'); $por = config('public.swoolwebsocketurlpor');
$this->ws = new \swoole_websocket_server('0.0.0.0', 9502,SWOOLE_PROCESS,SWOOLE_SOCK_TCP | SWOOLE_SSL); //创建一个端口 $this->ws = new \swoole_websocket_server('0.0.0.0', 9502); //创建一个端口
$this->ws->set(array( $this->ws->set(array(
'reactor_num' => 2, //reactor线程数 'reactor_num' => 2, //reactor线程数
'worker_num' => 4, //worker进程数 'worker_num' => 4, //worker进程数
'backlog' => 128, //Listen队列长度 'backlog' => 128, //Listen队列长度
'max_request' => 10,//最大连接 'max_request' => 10,//最大连接
'daemonize'=>0,//守护进程 'daemonize'=>0,//守护进程
'ssl_cert_file' => base_path() . '/tests/textcert/4544322_iot.zhkjgf.com_public.crt',
'ssl_key_file' => base_path() . '/tests/textcert/4544322_iot.zhkjgf.com.key',
'ssl_verify_peer' => true,
'ssl_allow_self_signed' => true,
'ssl_client_cert_file' => base_path() . '/tests/textcert/4544322_iot.zhkjgf.com_chain',
)); ));
$this->ws->on('open', function ($ws, $request) { $this->ws->on('open', function ($ws, $request) {
// //链接成功 // //链接成功
...@@ -92,7 +87,6 @@ class swoole extends Command ...@@ -92,7 +87,6 @@ class swoole extends Command
echo "client:{$fd} is closed\n"; echo "client:{$fd} is closed\n";
swoole_timer_clear($this->time); swoole_timer_clear($this->time);
}); });
$this->ws->start(); $this->ws->start();
} }
} }
...@@ -55,10 +55,10 @@ class swooleMeTcp extends Command ...@@ -55,10 +55,10 @@ class swooleMeTcp extends Command
public function start() public function start()
{ {
$url = config('public.swooletcpurl'); $url = config('public.swooletcpurl');
$this->tcp = new \swoole_server('0.0.0.0', 9503, SWOOLE_PROCESS,SWOOLE_SOCK_TCP | SWOOLE_SSL); $this->tcp = new \swoole_server('0.0.0.0', 9504,SWOOLE_PROCESS);
$this->tcp->addlistener('0.0.0.0', 9504, SWOOLE_PROCESS,SWOOLE_SOCK_TCP | SWOOLE_SSL); // 添加 TCP端口监听 $this->tcp->addlistener('0.0.0.0', 9504,SWOOLE_SOCK_TCP); // 添加 TCP端口监听
$this->tcp->addlistener('0.0.0.0', 9505, SWOOLE_PROCESS,SWOOLE_SOCK_TCP | SWOOLE_SSL); // 添加 TCP端口监听 $this->tcp->addlistener('0.0.0.0', 9505,SWOOLE_SOCK_TCP); // 添加 TCP端口监听
$this->tcp->addlistener('0.0.0.0', 9506, SWOOLE_PROCESS,SWOOLE_SOCK_TCP | SWOOLE_SSL); // 添加 TCP端口监听 // $this->tcp->addlistener('0.0.0.0', 9506,SWOOLE_SOCK_TCP); // 添加 TCP端口监听
$this->tcp->set([ $this->tcp->set([
'worker_num' => 2,//设置启动的 Worker 进程数 'worker_num' => 2,//设置启动的 Worker 进程数
'max_request' =>30,//最大任务数 'max_request' =>30,//最大任务数
...@@ -67,11 +67,6 @@ class swooleMeTcp extends Command ...@@ -67,11 +67,6 @@ class swooleMeTcp extends Command
'backlog' => 128, 'backlog' => 128,
'heartbeat_check_interval' => 30, 'heartbeat_check_interval' => 30,
'heartbeat_idle_time' => 65, 'heartbeat_idle_time' => 65,
'ssl_cert_file' => base_path() . '/tests/textcert/4544322_iot.zhkjgf.com_public.crt',
'ssl_key_file' => base_path() . '/tests/textcert/4544322_iot.zhkjgf.com.key',
'ssl_verify_peer' => true,
'ssl_allow_self_signed' => true,
'ssl_client_cert_file' => base_path() . '/tests/textcert/4544322_iot.zhkjgf.com_chain',
]); ]);
//监听连接进入事件 //监听连接进入事件
$this->tcp->on('Connect', function ($serv, $fd) { $this->tcp->on('Connect', function ($serv, $fd) {
...@@ -86,6 +81,7 @@ class swooleMeTcp extends Command ...@@ -86,6 +81,7 @@ class swooleMeTcp extends Command
//监听数据接收事件 //监听数据接收事件
$this->tcp->on('Receive', function ($serv, $fd, $from_id, $data) { $this->tcp->on('Receive', function ($serv, $fd, $from_id, $data) {
//验证数据格式 //验证数据格式
$serv->send($fd,$data);
if($this->formatData($data)){ if($this->formatData($data)){
$swooletcp = new SwooleCommandMeTcpController(); $swooletcp = new SwooleCommandMeTcpController();
$swooletcp->swooletcplist($data); $swooletcp->swooletcplist($data);
......
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
...@@ -30,10 +30,11 @@ class DevicesController extends Controller ...@@ -30,10 +30,11 @@ class DevicesController extends Controller
$type = $request->input('type');//设备类型id $type = $request->input('type');//设备类型id
$limit = $request->input('limit'); $limit = $request->input('limit');
$pagenNum = $limit * ($request->input('page') - 1);//页数 $pagenNum = $limit * ($request->input('page') - 1);//页数
$isuser = $request->input('isuser');
if ($pagenNum === '' || $limit == '') { if ($pagenNum === '' || $limit == '') {
return $this->jsonErrorData(105, '页数或limit不能为空'); return $this->jsonErrorData(105, '页数或limit不能为空');
} }
return $this->jsonSuccessData($this->whertype($type == '' ? '1' : $type, $pagenNum, $limit)); return $this->jsonSuccessData($this->whertype($type == '' ? '1' : $type, $pagenNum, $limit, $isuser));
} }
//用户设备列表 //用户设备列表
...@@ -178,14 +179,14 @@ class DevicesController extends Controller ...@@ -178,14 +179,14 @@ class DevicesController extends Controller
->leftjoin('gas', 'de.status', '=', 'gas.id') ->leftjoin('gas', 'de.status', '=', 'gas.id')
->leftjoin('danwei as da', 'de.devicemonad', '=', 'da.id') ->leftjoin('danwei as da', 'de.devicemonad', '=', 'da.id')
->leftjoin('users as ud', 'de.uid', '=', 'ud.id') ->leftjoin('users as ud', 'de.uid', '=', 'ud.id')
->select('dt.tid','ud.name', 'de.username','de.deviceremark','de.devicelinkman','de.devicephone','de.deviceinfo','de.devicecoord','de.uid','de.devicenum','de.devicemonad','de.status') ->select('dt.tid', 'ud.name', 'de.username', 'de.deviceremark', 'de.devicelinkman', 'de.devicephone', 'de.deviceinfo', 'de.devicecoord', 'de.uid', 'de.devicenum', 'de.devicemonad', 'de.status')
->first(); ->first();
return $this->jsonSuccessData($devi); return $this->jsonSuccessData($devi);
} }
} }
//返回设备类型和单位和介质 //返回设备类型和单位和介质
public function devicetype() public function devicetype(Request $request)
{ {
$gas = DB::table('gas')->get(); $gas = DB::table('gas')->get();
$danwei = DB::table('danwei')->get(); $danwei = DB::table('danwei')->get();
...@@ -198,22 +199,41 @@ class DevicesController extends Controller ...@@ -198,22 +199,41 @@ class DevicesController extends Controller
} }
//返回设备列表 //返回设备列表
private function whertype($type, $pagenNum, $limit): array private function whertype($type, $pagenNum, $limit, $isuser): array
{ {
$devicelist = DB::table('device') if ($isuser == 'user') {
->where('dtype', '=', $type) $devicelist = DB::table('device')
->leftjoin('device_type as dy', "device.dtype", '=', 'dy.tid') ->where('dtype', '=', $type)
->leftjoin('gas as g', "device.status", '=', 'g.id') ->where('uid', '=', Auth::id())
->leftjoin('users as u', "device.uid", '=', 'u.id') ->leftjoin('device_type as dy', "device.dtype", '=', 'dy.tid')
->leftjoin('status as p', "device.devicepolice", '=', 'p.id') ->leftjoin('gas as g', "device.status", '=', 'g.id')
->select('dy.tname', 'g.gas', 'device.*', 'p.status_name', 'u.name as usernickname') ->leftjoin('users as u', "device.uid", '=', 'u.id')
->orderBy('device.id', 'desc') ->leftjoin('status as p', "device.devicepolice", '=', 'p.id')
->offset($pagenNum) ->select('dy.tname', 'g.gas', 'device.*', 'p.status_name', 'u.name as usernickname')
->limit($limit) ->orderBy('device.id', 'desc')
->get()->toArray(); ->offset($pagenNum)
$count = DB::table('device') ->limit($limit)
->where('dtype', '=', $type) ->get()->toArray();
->count(); $count = DB::table('device')
->where('dtype', '=', $type)
->where('uid', '=', Auth::id())
->count();
} else {
$devicelist = DB::table('device')
->where('dtype', '=', $type)
->leftjoin('device_type as dy', "device.dtype", '=', 'dy.tid')
->leftjoin('gas as g', "device.status", '=', 'g.id')
->leftjoin('users as u', "device.uid", '=', 'u.id')
->leftjoin('status as p', "device.devicepolice", '=', 'p.id')
->select('dy.tname', 'g.gas', 'device.*', 'p.status_name', 'u.name as usernickname')
->orderBy('device.id', 'desc')
->offset($pagenNum)
->limit($limit)
->get()->toArray();
$count = DB::table('device')
->where('dtype', '=', $type)
->count();
}
return ['devicelist' => $devicelist, 'count' => $count]; return ['devicelist' => $devicelist, 'count' => $count];
} }
...@@ -352,7 +372,7 @@ class DevicesController extends Controller ...@@ -352,7 +372,7 @@ class DevicesController extends Controller
{ {
$request = $request->input(); $request = $request->input();
$time_start = $time_stop = false; $time_start = $time_stop = false;
if(!is_null($request['timeRange'])) { if (!is_null($request['timeRange'])) {
$time_start = strtotime($request['timeRange'][0]); $time_start = strtotime($request['timeRange'][0]);
$time_stop = strtotime($request['timeRange'][1]); $time_stop = strtotime($request['timeRange'][1]);
} }
...@@ -378,15 +398,15 @@ class DevicesController extends Controller ...@@ -378,15 +398,15 @@ class DevicesController extends Controller
if (!is_null($this->isadmin())) { if (!is_null($this->isadmin())) {
$data = DB::table('reportpolice as r') $data = DB::table('reportpolice as r')
->join('status as s', 'r.policestatus', '=', 's.id') ->join('status as s', 'r.policestatus', '=', 's.id')
->join('device as d' , 'r.devicenumber','=','d.devicenum') ->join('device as d', 'r.devicenumber', '=', 'd.devicenum')
->select('r.*', 's.status_name','d.id as deid') ->select('r.*', 's.status_name', 'd.id as deid')
->get(); ->get();
}else{ } else {
$data = DB::table('reportpolice as r') $data = DB::table('reportpolice as r')
->join('status as s', 'r.policestatus', '=', 's.id') ->join('status as s', 'r.policestatus', '=', 's.id')
->join('device as d' , 'r.devicenumber','=','d.devicenum') ->join('device as d', 'r.devicenumber', '=', 'd.devicenum')
->where('d.uid','=',Auth::id()) ->where('d.uid', '=', Auth::id())
->select('r.*', 's.status_name','d.id as deid') ->select('r.*', 's.status_name', 'd.id as deid')
->get(); ->get();
} }
return $this->jsonSuccessData($data); return $this->jsonSuccessData($data);
...@@ -407,6 +427,12 @@ class DevicesController extends Controller ...@@ -407,6 +427,12 @@ class DevicesController extends Controller
{ {
return $this->jsonSuccessData(DB::table('users')->where('state', '=', '2')->select('name', 'id')->get()); return $this->jsonSuccessData(DB::table('users')->where('state', '=', '2')->select('name', 'id')->get());
} }
//获取用户自定义用户标题
public function companyuser()
{
$data = DB::table('users')->where('id','=',Auth::id())->value('company');
return $this->jsonSuccessData($data);
}
//返回设备废纸篓和禁用设备 //返回设备废纸篓和禁用设备
public function deviceBasketList() public function deviceBasketList()
...@@ -427,7 +453,7 @@ class DevicesController extends Controller ...@@ -427,7 +453,7 @@ class DevicesController extends Controller
$type = $request->input('type'); $type = $request->input('type');
if ($type == 1) {//丢弃废纸篓 if ($type == 1) {//丢弃废纸篓
$this->timeline('设备放到废纸篓[设备id' . $id . ']'); $this->timeline('设备放到废纸篓[设备id' . $id . ']');
return $this->jsonSuccessData(DB::table('device')->where('id', '=', $id)->update(['delete' => 1, 'devicestatus' => 6, 'devicedeleteinfo' => $this->isadmin() == 1 ? '管理员将设备放置废纸篓' : '用户将设备放置废纸篓'])); return $this->jsonSuccessData(DB::table('device')->where('id', '=', $id)->update(['delete' => 1, 'devicestatus' => 6, 'devicedeleteinfo' => $this->isadmin() == 1 ? '管理员将设备放置废纸篓' : '用户将设备放置废纸篓']));
} else { } else {
$this->timeline('删除了设备'); $this->timeline('删除了设备');
return $this->jsonSuccessData(DB::table('device')->where('id', '=', $id)->delete()); return $this->jsonSuccessData(DB::table('device')->where('id', '=', $id)->delete());
...@@ -457,9 +483,10 @@ class DevicesController extends Controller ...@@ -457,9 +483,10 @@ class DevicesController extends Controller
$status = DB::table('device_type')->where('tid', '=', $data['tid'])->update([ $status = DB::table('device_type')->where('tid', '=', $data['tid'])->update([
'tname' => $data['tname'] 'tname' => $data['tname']
]); ]);
return $status ? $this->jsonSuccessData($status) : $this->jsonErrorData(202, 'error'); return $status ? $this->jsonSuccessData($status) : $this->jsonErrorData(202, 'error');
} }
public function delteClassify($id) public function delteClassify($id)
{ {
//删除分类 //删除分类
...@@ -476,15 +503,15 @@ class DevicesController extends Controller ...@@ -476,15 +503,15 @@ class DevicesController extends Controller
$where['device.uid'] = $user_id; $where['device.uid'] = $user_id;
} }
$data = DB::table('device') $data = DB::table('device')
->join('status as s','device.devicepolice','=','s.id') ->join('status as s', 'device.devicepolice', '=', 's.id')
->select('device.id', 'device.uid', 'device.nd', 'device.deviceinfo', 'device.devicenum', 'device.devicecoord', 'device.devicepolice', 'device.deviceremark', 'device.devicelinkman','s.status_name') ->select('device.id', 'device.uid', 'device.nd', 'device.deviceinfo', 'device.devicenum', 'device.devicecoord', 'device.devicepolice', 'device.deviceremark', 'device.devicelinkman', 's.status_name')
->where($where) ->where($where)
->get(); ->get();
} else { } else {
$data = DB::table('device') $data = DB::table('device')
->join('status as s','device.devicepolice','=','s.id') ->join('status as s', 'device.devicepolice', '=', 's.id')
->select('device.id', 'device.uid', 'device.nd', 'device.deviceinfo', 'device.devicenum', 'device.devicecoord', 'device.devicepolice', 'device.deviceremark', 'device.devicelinkman','s.status_name') ->select('device.id', 'device.uid', 'device.nd', 'device.deviceinfo', 'device.devicenum', 'device.devicecoord', 'device.devicepolice', 'device.deviceremark', 'device.devicelinkman', 's.status_name')
->where('device.uid','=',Auth::id()) ->where('device.uid', '=', Auth::id())
->get(); ->get();
} }
...@@ -510,16 +537,16 @@ class DevicesController extends Controller ...@@ -510,16 +537,16 @@ class DevicesController extends Controller
} }
$search = json_decode($request->input('search'), true); $search = json_decode($request->input('search'), true);
$where = []; $where = [];
if(!empty($search['deviceNum'])) { if (!empty($search['deviceNum'])) {
$where[] = ['devicenum', 'like', "%{$search['deviceNum']}%"]; $where[] = ['devicenum', 'like', "%{$search['deviceNum']}%"];
} }
if(!empty($search['deviceName'])) { if (!empty($search['deviceName'])) {
$where[] = ['username', 'like', "%{$search['deviceName']}%"]; $where[] = ['username', 'like', "%{$search['deviceName']}%"];
} }
if($search['deviceType'] != 0) { if ($search['deviceType'] != 0) {
$wherein = [$search['deviceType']]; $wherein = [$search['deviceType']];
} }
if($search['deviceStatus'] != 0) { if ($search['deviceStatus'] != 0) {
$where[] = ['device.devicepolice', '=', $search['deviceStatus']]; $where[] = ['device.devicepolice', '=', $search['deviceStatus']];
} }
...@@ -540,14 +567,14 @@ class DevicesController extends Controller ...@@ -540,14 +567,14 @@ class DevicesController extends Controller
->whereIn('dtype', $wherein) ->whereIn('dtype', $wherein)
->where($where) ->where($where)
->count(); ->count();
}else{ } else {
$devicelist = DB::table('device') $devicelist = DB::table('device')
->whereIn('dtype', $wherein) ->whereIn('dtype', $wherein)
->leftjoin('device_type as dy', "device.dtype", '=', 'dy.tid') ->leftjoin('device_type as dy', "device.dtype", '=', 'dy.tid')
->leftjoin('gas as g', "device.status", '=', 'g.id') ->leftjoin('gas as g', "device.status", '=', 'g.id')
->leftjoin('status as p', "device.devicepolice", '=', 'p.id') ->leftjoin('status as p', "device.devicepolice", '=', 'p.id')
->leftjoin('danwei as dw', 'device.devicemonad', '=', 'dw.id') ->leftjoin('danwei as dw', 'device.devicemonad', '=', 'dw.id')
->where('device.uid','=',Auth::id()) ->where('device.uid', '=', Auth::id())
->select('dy.tname', 'g.gas', 'device.*', 'p.status_name', 'dw.danwei') ->select('dy.tname', 'g.gas', 'device.*', 'p.status_name', 'dw.danwei')
->where($where) ->where($where)
->orderBy('device.id', 'desc') ->orderBy('device.id', 'desc')
...@@ -556,40 +583,55 @@ class DevicesController extends Controller ...@@ -556,40 +583,55 @@ class DevicesController extends Controller
->get()->toArray(); ->get()->toArray();
$count = DB::table('device') $count = DB::table('device')
->whereIn('dtype', $wherein) ->whereIn('dtype', $wherein)
->where('uid','=',Auth::id()) ->where('uid', '=', Auth::id())
->where($where) ->where($where)
->count(); ->count();
} }
return $this->jsonSuccessData(['devicelist' => $devicelist, 'count' => $count]); return $this->jsonSuccessData(['devicelist' => $devicelist, 'count' => $count]);
} }
public function devicepolice(Request $request) public function devicepolice(Request $request)
{ {
$devicenum = $request->input('devicenum'); $devicenum = $request->input('devicenum');
if ($devicenum) { if ($devicenum) {
$police = DB::table('reportpolice')->where('devicenumber','=',$devicenum)->update(['police'=>2]); $police = DB::table('reportpolice')->where('devicenumber', '=', $devicenum)->update(['police' => 2]);
$this->jsonSuccessData($police); $this->jsonSuccessData($police);
}else{ } else {
return $this->jsonErrorData(105,'设备编号不能为空'); return $this->jsonErrorData(105, '设备编号不能为空');
} }
} }
public function devicepoliceinfo(Request $request){
//返回报警记录中的报类型和区域
public function history_device_type()
{
$device_type = DB::table('status')->get();
$device_quyu = DB::table('device')
->select('deviceinfo', 'id as deviceid')
->groupBy('deviceinfo')
->get();
return $this->jsonSuccessData(['device_type' => $device_type, 'device_quyu' => $device_quyu]);
}
public function devicepoliceinfo(Request $request)
{
$devicenum = $request->input('devicenum'); $devicenum = $request->input('devicenum');
if ($devicenum) { if ($devicenum) {
$data = DB::table('device as d') $data = DB::table('device as d')
->join('device_type as t','d.dtype','=','t.tid') ->join('device_type as t', 'd.dtype', '=', 't.tid')
->join('gas as g','d.status','=','g.id') ->join('gas as g', 'd.status', '=', 'g.id')
->join('status as s','d.devicepolice','=','s.id') ->join('status as s', 'd.devicepolice', '=', 's.id')
->join('danwei as w','d.devicemonad','=','w.id') ->join('danwei as w', 'd.devicemonad', '=', 'w.id')
->join('users as u','d.uid','=','u.id') ->join('users as u', 'd.uid', '=', 'u.id')
->join('reportpolice as r','d.devicenum','=','r.devicenumber') ->join('reportpolice as r', 'd.devicenum', '=', 'r.devicenumber')
->where('d.devicenum','=',$devicenum) ->where('d.devicenum', '=', $devicenum)
->select('d.devicenum','d.username','d.nd','d.deviceremark','d.devicecoord','d.deviceaddtime','d.devicestatus','t.tname','g.gas','s.status_name','w.danwei','u.name','u.email','r.location','r.concentration','r.starttime') ->select('d.devicenum', 'd.username', 'd.nd', 'd.deviceremark', 'd.devicecoord', 'd.deviceaddtime', 'd.devicestatus', 't.tname', 'g.gas', 's.status_name', 'w.danwei', 'u.name', 'u.email', 'r.location', 'r.concentration', 'r.starttime')
->first(); ->first();
return $this->jsonSuccessData($data); return $this->jsonSuccessData($data);
}else{ } else {
return $this->jsonErrorData(105,'设备编号不能为空'); return $this->jsonErrorData(105, '设备编号不能为空');
} }
} }
/** /**
* @param bool $isNew * @param bool $isNew
* @return array * @return array
...@@ -687,7 +729,7 @@ class DevicesController extends Controller ...@@ -687,7 +729,7 @@ class DevicesController extends Controller
* @return array * @return array
* @throws \Exception * @throws \Exception
*/ */
private function getDeviceData($time_start = false, $time_stop = false, $device_num = '', $device_status = 0, $size=0, $page=0) private function getDeviceData($time_start = false, $time_stop = false, $device_num = '', $device_status = 0, $size = 0, $page = 0)
{ {
$influxDb = Config::get('database.influxdb'); $influxDb = Config::get('database.influxdb');
$host = $influxDb['default']['host']; $host = $influxDb['default']['host'];
...@@ -702,31 +744,31 @@ class DevicesController extends Controller ...@@ -702,31 +744,31 @@ class DevicesController extends Controller
$tbuilde = $tdatabase->getQueryBuilder(); $tbuilde = $tdatabase->getQueryBuilder();
$result = []; $result = [];
if($time_start === false) { if ($time_start === false) {
$time_start = 0; $time_start = 0;
} }
if($time_stop === false) { if ($time_stop === false) {
$time_stop = time(); $time_stop = time();
} }
$time_start -= 8 * 3600; $time_start -= 8 * 3600;
$time_stop -= 8 * 3600; $time_stop -= 8 * 3600;
$result = $builde->select('*') $result = $builde->select('*')
->from('devices') ->from('devices')
->setTimeRange($time_start, $time_stop); ->setTimeRange($time_start, $time_stop);
$tresult = $tbuilde->select('*') $tresult = $tbuilde->select('*')
->from('devices') ->from('devices')
->setTimeRange($time_start, $time_stop); ->setTimeRange($time_start, $time_stop);
if(!empty($device_num)) { if (!empty($device_num)) {
$where = ["device_num='{$device_num}'"]; $where = ["device_num='{$device_num}'"];
$result = $result->where($where); $result = $result->where($where);
$tresult = $tresult->where($where); $tresult = $tresult->where($where);
} }
if($device_status != 0 && $device_status != null) { if ($device_status != 0 && $device_status != null) {
$where = ["device_status='{$device_status}'"]; $where = ["device_status='{$device_status}'"];
$result = $result->where($where); $result = $result->where($where);
$tresult = $tresult->where($where); $tresult = $tresult->where($where);
} }
if($this->isadmin() != 1) { if ($this->isadmin() != 1) {
$user_id = Auth::id(); $user_id = Auth::id();
$where = ["user_id='{$user_id}'"]; $where = ["user_id='{$user_id}'"];
$result = $result->where($where); $result = $result->where($where);
...@@ -734,9 +776,9 @@ class DevicesController extends Controller ...@@ -734,9 +776,9 @@ class DevicesController extends Controller
} }
$total = $tresult->count('value')->getResultSet()->getPoints(); $total = $tresult->count('value')->getResultSet()->getPoints();
if(count($total) > 0) { if (count($total) > 0) {
$result = $result->orderBy('time','DESC') $result = $result->orderBy('time', 'DESC')
->limit($size)->offset(($page-1)*$size) ->limit($size)->offset(($page - 1) * $size)
->getResultSet()->getPoints(); ->getResultSet()->getPoints();
} else { } else {
$result = []; $result = [];
......
...@@ -21,16 +21,33 @@ use Validator; ...@@ -21,16 +21,33 @@ use Validator;
class HomepageController extends Controller class HomepageController extends Controller
{ {
//返回用户数量 设备数量, 报警数量 , //返回用户数量 设备数量, 报警数量 ,
public function homepagecount() public function homepagecount(Request $request)
{ {
$usercount = Users::count(); $type = $request->input('isuser');
$devicecount = Device::count(); if ($type == 'user') {
$devicepolice = Device::where('devicepolice', '>', '1')->count(); $usercount = Users::count();
$t = time();//当前时间 $devicecount = Device::where('uid','=',Auth::id())->count();
$start = mktime(0, 0, 0, date("m", $t), date("d", $t), date("Y", $t));//今天的开始 $devicepolice = Device::where('devicepolice', '>', '1')->where('uid','=',Auth::id())->count();
$end = mktime(23, 59, 59, date("m", $t), date("d", $t), date("Y", $t));//今天的结束 $t = time();//当前时间
$timedevicepolice = DB::table('reportpolice')->where('status', '=', '1')->whereBetween('starttime', [$start, $end])->count(); $start = mktime(0, 0, 0, date("m", $t), date("d", $t), date("Y", $t));//今天的开始
return $this->jsonSuccessData(['usercount' => $usercount, 'devicecount' => $devicecount, 'devicepolice' => $devicepolice, 'timedevicepolice' => $timedevicepolice]); $end = mktime(23, 59, 59, date("m", $t), date("d", $t), date("Y", $t));//今天的结束
$timedevicepolice = DB::table('reportpolice')->where('status', '=', '1')->whereBetween('starttime', [$start, $end])->count();
$offdevice = Device::where('devicepolice', '=', '1')->where('uid','=',Auth::id())->count();
//计算设备在线
$deviceurt = $devicecount / $offdevice;
} else {
$usercount = Users::count();
$devicecount = Device::count();
$devicepolice = Device::where('devicepolice', '>', '1')->count();
$t = time();//当前时间
$start = mktime(0, 0, 0, date("m", $t), date("d", $t), date("Y", $t));//今天的开始
$end = mktime(23, 59, 59, date("m", $t), date("d", $t), date("Y", $t));//今天的结束
$timedevicepolice = DB::table('reportpolice')->where('status', '=', '1')->whereBetween('starttime', [$start, $end])->count();
$offdevice = Device::where('devicepolice', '=', '1')->count();
//计算设备在线
$deviceurt = $devicecount / $offdevice;
}
return $this->jsonSuccessData(['usercount' => $usercount, 'devicecount' => $devicecount, 'devicepolice' => $devicepolice, 'timedevicepolice' => $timedevicepolice, 'offdevice' => $offdevice, 'deviceurt' => round($deviceurt)]);
} }
public function gettimeline() public function gettimeline()
...@@ -39,39 +56,62 @@ class HomepageController extends Controller ...@@ -39,39 +56,62 @@ class HomepageController extends Controller
} }
//返回一年当前月份 //返回一年当前月份
public function devicemonthcount() public function devicemonthcount(Request $request)
{ {
$year_start = strtotime(date("Y") . "-01-01"); // 获取当前的1月份的时间戳 $type = $request->input('isuser');
$endThismonth = mktime(23, 59, 59, date('m'), date('t'), date('Y')); //获取当月的时间戳 if ($type == 'user') {
$devicedata = Device::whereBetween('deviceaddtime', [$year_start, $endThismonth]) $year_start = strtotime(date("Y") . "-01-01"); // 获取当前的1月份的时间戳
->selectRaw('from_unixtime(deviceaddtime,"%Y-%m") as date,COUNT(id) as value') $endThismonth = mktime(23, 59, 59, date('m'), date('t'), date('Y')); //获取当月的时间戳
->groupBy('date') $devicedata = Device::where('uid','=',Auth::id())->whereBetween('deviceaddtime', [$year_start, $endThismonth])
->get() ->selectRaw('from_unixtime(deviceaddtime,"%Y-%m") as date,COUNT(id) as value')
->toArray(); ->groupBy('date')
$policedata = Users::whereBetween('created_at', [date('Y-m-d H:i:s',$year_start), date('Y-m-d H:i:s',$endThismonth)]) ->get()
->selectRaw('from_unixtime(unix_timestamp(created_at),"%Y-%m") as date,COUNT(id) as value') ->toArray();
->groupBy('date') $policedata = Users::whereBetween('created_at', [date('Y-m-d H:i:s', $year_start), date('Y-m-d H:i:s', $endThismonth)])
->get() ->selectRaw('from_unixtime(unix_timestamp(created_at),"%Y-%m") as date,COUNT(id) as value')
->toArray(); ->groupBy('date')
$devicepolice = Device::whereBetween('deviceaddtime', [$year_start, $endThismonth]) ->get()
->where('devicepolice', '>', 1) ->toArray();
->selectRaw('from_unixtime(deviceaddtime,"%Y-%m") as date,COUNT(id) as value') $devicepolice = Device::where('uid','=',Auth::id())->whereBetween('deviceaddtime', [$year_start, $endThismonth])
->groupBy('date') ->where('devicepolice', '>', 1)
->get() ->selectRaw('from_unixtime(deviceaddtime,"%Y-%m") as date,COUNT(id) as value')
->toArray(); ->groupBy('date')
->get()
->toArray();
}else{
$year_start = strtotime(date("Y") . "-01-01"); // 获取当前的1月份的时间戳
$endThismonth = mktime(23, 59, 59, date('m'), date('t'), date('Y')); //获取当月的时间戳
$devicedata = Device::whereBetween('deviceaddtime', [$year_start, $endThismonth])
->selectRaw('from_unixtime(deviceaddtime,"%Y-%m") as date,COUNT(id) as value')
->groupBy('date')
->get()
->toArray();
$policedata = Users::whereBetween('created_at', [date('Y-m-d H:i:s', $year_start), date('Y-m-d H:i:s', $endThismonth)])
->selectRaw('from_unixtime(unix_timestamp(created_at),"%Y-%m") as date,COUNT(id) as value')
->groupBy('date')
->get()
->toArray();
$devicepolice = Device::whereBetween('deviceaddtime', [$year_start, $endThismonth])
->where('devicepolice', '>', 1)
->selectRaw('from_unixtime(deviceaddtime,"%Y-%m") as date,COUNT(id) as value')
->groupBy('date')
->get()
->toArray();
}
return $this->jsonSuccessData(['devicedata' => $this->datamonth($devicedata), 'policedata' => $this->datamonth($policedata), 'devicepolice' => $this->datamonth($devicepolice)]); return $this->jsonSuccessData(['devicedata' => $this->datamonth($devicedata), 'policedata' => $this->datamonth($policedata), 'devicepolice' => $this->datamonth($devicepolice)]);
} }
//用户统计 //用户统计
public function UserStatistics (){ public function UserStatistics()
$devicecount = Device::where('uid','=',Auth::id())->count(); {
$devicepolice = Device::where('devicepolice', '>', '1')->where('uid','=',Auth::id())->count(); $devicecount = Device::where('uid', '=', Auth::id())->count();
$devicepolice = Device::where('devicepolice', '>', '1')->where('uid', '=', Auth::id())->count();
$t = time();//当前时间 $t = time();//当前时间
$start = mktime(0, 0, 0, date("m", $t), date("d", $t), date("Y", $t));//今天的开始 $start = mktime(0, 0, 0, date("m", $t), date("d", $t), date("Y", $t));//今天的开始
$end = mktime(23, 59, 59, date("m", $t), date("d", $t), date("Y", $t));//今天的结束 $end = mktime(23, 59, 59, date("m", $t), date("d", $t), date("Y", $t));//今天的结束
$timedevicepolice = DB::table('reportpolice as r') $timedevicepolice = DB::table('reportpolice as r')
->join('device as d','d.devicenum','=','r.devicenumber') ->join('device as d', 'd.devicenum', '=', 'r.devicenumber')
->where('d.uid','=',Auth::id()) ->where('d.uid', '=', Auth::id())
->where('r.status', '=', '1') ->where('r.status', '=', '1')
->whereBetween('r.starttime', [$start, $end]) ->whereBetween('r.starttime', [$start, $end])
->count(); ->count();
...@@ -84,12 +124,12 @@ class HomepageController extends Controller ...@@ -84,12 +124,12 @@ class HomepageController extends Controller
\Session::put(['loginuid' => Auth::id()]); \Session::put(['loginuid' => Auth::id()]);
$year_start = strtotime(date("Y") . "-01-01"); // 获取当前的1月份的时间戳 $year_start = strtotime(date("Y") . "-01-01"); // 获取当前的1月份的时间戳
$endThismonth = mktime(23, 59, 59, date('m'), date('t'), date('Y')); //获取当月的时间戳 $endThismonth = mktime(23, 59, 59, date('m'), date('t'), date('Y')); //获取当月的时间戳
$devicedata = Device::where('uid','=',Auth::id())->whereBetween('deviceaddtime', [$year_start, $endThismonth]) $devicedata = Device::where('uid', '=', Auth::id())->whereBetween('deviceaddtime', [$year_start, $endThismonth])
->selectRaw('from_unixtime(deviceaddtime,"%Y-%m") as date,COUNT(id) as value') ->selectRaw('from_unixtime(deviceaddtime,"%Y-%m") as date,COUNT(id) as value')
->groupBy('date') ->groupBy('date')
->get() ->get()
->toArray(); ->toArray();
$devicepolice = Device::where('uid','=',Auth::id())->whereBetween('deviceaddtime', [$year_start, $endThismonth]) $devicepolice = Device::where('uid', '=', Auth::id())->whereBetween('deviceaddtime', [$year_start, $endThismonth])
->where('devicepolice', '>', 1) ->where('devicepolice', '>', 1)
->selectRaw('from_unixtime(deviceaddtime,"%Y-%m") as date,COUNT(id) as value') ->selectRaw('from_unixtime(deviceaddtime,"%Y-%m") as date,COUNT(id) as value')
->groupBy('date') ->groupBy('date')
...@@ -109,7 +149,7 @@ class HomepageController extends Controller ...@@ -109,7 +149,7 @@ class HomepageController extends Controller
$size = $this->getDirSize($phay); $size = $this->getDirSize($phay);
$base_path = @round($size / pow(1024, ($i = floor(log($size, 1024)))), 2); $base_path = @round($size / pow(1024, ($i = floor(log($size, 1024)))), 2);
$end_time = microtime(true); $end_time = microtime(true);
return $this->jsonSuccessData(['memory' => round($memory), 'base_path' => round($base_path) / 10, 'end_time' => round($end_time - $start_time), 'dabatime' => ceil($this->dabadas()),'rand'=>rand(1,100)]); return $this->jsonSuccessData(['memory' => round($memory), 'base_path' => round($base_path) / 10, 'end_time' => round($end_time - $start_time), 'dabatime' => ceil($this->dabadas()), 'rand' => rand(1, 100)]);
} }
......
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
...@@ -40,60 +40,115 @@ class UinappHomeController extends Controller ...@@ -40,60 +40,115 @@ class UinappHomeController extends Controller
public function imitation(Request $request) public function imitation(Request $request)
{ {
$imitationdata = $request->input('imitationdata'); $imitationdata = $request->input('imitationdata');
$type = $request->input('isuser');
if ($imitationdata != '') { if ($imitationdata != '') {
if ($this->isKanji($imitationdata)) { if ($this->isKanji($imitationdata)) {
if ($type == 'user') {
$data = DB::table('device as d')
->join('device_type as t', 'd.dtype', '=', 't.tid')
->join('gas as g', 'd.status', '=', 'g.id')
->join('danwei as w', 'd.devicemonad', '=', 'w.id')
->join('status as s', 'd.devicepolice', '=', 's.id')
->join('users as u', 'd.uid', '=', 'u.id')
->where('d.username', 'like', '%' . $imitationdata . '%')
->where('u.id', '=', Auth::id())
->select('d.*', 't.tname', 'g.gas', 'w.danwei', 's.status_name', 'u.username as nameh', 'u.isadmin')
->get();
} else {
$data = DB::table('device as d')
->join('device_type as t', 'd.dtype', '=', 't.tid')
->join('gas as g', 'd.status', '=', 'g.id')
->join('danwei as w', 'd.devicemonad', '=', 'w.id')
->join('status as s', 'd.devicepolice', '=', 's.id')
->join('users as u', 'd.uid', '=', 'u.id')
->where('d.username', 'like', '%' . $imitationdata . '%')
->select('d.*', 't.tname', 'g.gas', 'w.danwei', 's.status_name', 'u.username as nameh', 'u.isadmin')
->get();
}
} else {
if ($type == 'user') {
$data = DB::table('device as d')
->join('device_type as t', 'd.dtype', '=', 't.tid')
->join('gas as g', 'd.status', '=', 'g.id')
->join('danwei as w', 'd.devicemonad', '=', 'w.id')
->join('status as s', 'd.devicepolice', '=', 's.id')
->join('users as u', 'd.uid', '=', 'u.id')
->where('d.devicenum', 'like', '%' . $imitationdata . '%')
->where('u.id','=',Auth::id())
->select('d.*', 't.tname', 'g.gas', 'w.danwei', 's.status_name', 'u.username as nameh', 'u.isadmin')
->get();
}else{
$data = DB::table('device as d')
->join('device_type as t', 'd.dtype', '=', 't.tid')
->join('gas as g', 'd.status', '=', 'g.id')
->join('danwei as w', 'd.devicemonad', '=', 'w.id')
->join('status as s', 'd.devicepolice', '=', 's.id')
->join('users as u', 'd.uid', '=', 'u.id')
->where('d.devicenum', 'like', '%' . $imitationdata . '%')
->select('d.*', 't.tname', 'g.gas', 'w.danwei', 's.status_name', 'u.username as nameh', 'u.isadmin')
->get();
}
}
return $this->jsonSuccessData($data);
} else {
return $this->jsonSuccessData('');
}
}
//指定查询
public function setseachdata(Request $request)
{
$setdata = $request->input('setseachdata');
$type = $request->input('isuser');
if ($this->isKanji($setdata)) {
if($type == 'user'){
$data = DB::table('device as d') $data = DB::table('device as d')
->join('device_type as t', 'd.dtype', '=', 't.tid') ->join('device_type as t', 'd.dtype', '=', 't.tid')
->join('gas as g', 'd.status', '=', 'g.id') ->join('gas as g', 'd.status', '=', 'g.id')
->join('danwei as w', 'd.devicemonad', '=', 'w.id') ->join('danwei as w', 'd.devicemonad', '=', 'w.id')
->join('status as s', 'd.devicepolice', '=', 's.id') ->join('status as s', 'd.devicepolice', '=', 's.id')
->join('users as u', 'd.uid', '=', 'u.id') ->join('users as u', 'd.uid', '=', 'u.id')
->where('d.username', 'like', '%' . $imitationdata . '%') ->where('d.username', '=', $setdata)
->where('u.id','=',Auth::id())
->select('d.*', 't.tname', 'g.gas', 'w.danwei', 's.status_name', 'u.username as nameh', 'u.isadmin') ->select('d.*', 't.tname', 'g.gas', 'w.danwei', 's.status_name', 'u.username as nameh', 'u.isadmin')
->get(); ->get();
} else { }else{
$data = DB::table('device as d') $data = DB::table('device as d')
->join('device_type as t', 'd.dtype', '=', 't.tid') ->join('device_type as t', 'd.dtype', '=', 't.tid')
->join('gas as g', 'd.status', '=', 'g.id') ->join('gas as g', 'd.status', '=', 'g.id')
->join('danwei as w', 'd.devicemonad', '=', 'w.id') ->join('danwei as w', 'd.devicemonad', '=', 'w.id')
->join('status as s', 'd.devicepolice', '=', 's.id') ->join('status as s', 'd.devicepolice', '=', 's.id')
->join('users as u', 'd.uid', '=', 'u.id') ->join('users as u', 'd.uid', '=', 'u.id')
->where('d.devicenum', 'like', '%' . $imitationdata . '%') ->where('d.username', '=', $setdata)
->select('d.*', 't.tname', 'g.gas', 'w.danwei', 's.status_name', 'u.username as nameh', 'u.isadmin') ->select('d.*', 't.tname', 'g.gas', 'w.danwei', 's.status_name', 'u.username as nameh', 'u.isadmin')
->get(); ->get();
} }
return $this->jsonSuccessData($data);
} else { } else {
return $this->jsonSuccessData(''); if($type == 'user'){
} $data = DB::table('device as d')
->join('device_type as t', 'd.dtype', '=', 't.tid')
} ->join('gas as g', 'd.status', '=', 'g.id')
->join('danwei as w', 'd.devicemonad', '=', 'w.id')
//指定查询 ->join('status as s', 'd.devicepolice', '=', 's.id')
public function setseachdata(Request $request) ->join('users as u', 'd.uid', '=', 'u.id')
{ ->where('d.devicenum', '=', $setdata)
$setdata = $request->input('setseachdata'); ->where('u.id','=',Auth::id())
if ($this->isKanji($setdata)) { ->select('d.*', 't.tname', 'g.gas', 'w.danwei', 's.status_name', 'u.username as nameh', 'u.isadmin')
$data = DB::table('device as d') ->get();
->join('device_type as t', 'd.dtype', '=', 't.tid') }else{
->join('gas as g', 'd.status', '=', 'g.id') $data = DB::table('device as d')
->join('danwei as w', 'd.devicemonad', '=', 'w.id') ->join('device_type as t', 'd.dtype', '=', 't.tid')
->join('status as s', 'd.devicepolice', '=', 's.id') ->join('gas as g', 'd.status', '=', 'g.id')
->join('users as u', 'd.uid', '=', 'u.id') ->join('danwei as w', 'd.devicemonad', '=', 'w.id')
->where('d.username', '=', $setdata) ->join('status as s', 'd.devicepolice', '=', 's.id')
->select('d.*', 't.tname', 'g.gas', 'w.danwei', 's.status_name', 'u.username as nameh', 'u.isadmin') ->join('users as u', 'd.uid', '=', 'u.id')
->get(); ->where('d.devicenum', '=', $setdata)
} else { ->select('d.*', 't.tname', 'g.gas', 'w.danwei', 's.status_name', 'u.username as nameh', 'u.isadmin')
$data = DB::table('device as d') ->get();
->join('device_type as t', 'd.dtype', '=', 't.tid') }
->join('gas as g', 'd.status', '=', 'g.id')
->join('danwei as w', 'd.devicemonad', '=', 'w.id')
->join('status as s', 'd.devicepolice', '=', 's.id')
->join('users as u', 'd.uid', '=', 'u.id')
->where('d.devicenum', '=', $setdata)
->select('d.*', 't.tname', 'g.gas', 'w.danwei', 's.status_name', 'u.username as nameh', 'u.isadmin')
->get();
} }
return $this->jsonSuccessData($data); return $this->jsonSuccessData($data);
} }
...@@ -141,11 +196,11 @@ class UinappHomeController extends Controller ...@@ -141,11 +196,11 @@ class UinappHomeController extends Controller
// die(); // die();
$isemail = $request->input('email'); $isemail = $request->input('email');
$num = str_pad(mt_rand(0, 999999), 6, "0", STR_PAD_BOTH); $num = str_pad(mt_rand(0, 999999), 6, "0", STR_PAD_BOTH);
if ($isemail != ''){ if ($isemail != '') {
$send = $this->PHPMailer($isemail,$num); $send = $this->PHPMailer($isemail, $num);
if($send == 200){ if ($send == 200) {
return $this->jsonSuccessData($num); return $this->jsonSuccessData($num);
} }
} }
} }
...@@ -158,11 +213,12 @@ class UinappHomeController extends Controller ...@@ -158,11 +213,12 @@ class UinappHomeController extends Controller
return false; return false;
} }
} }
/* /*
* $name 发件人 * $name 发件人
* $num 随机字符串 验证码 * $num 随机字符串 验证码
* */ * */
private function PHPMailer($name,$num) private function PHPMailer($name, $num)
{ {
include_once app_path() . '/Http/Controllers/src/PHPMailer.php'; include_once app_path() . '/Http/Controllers/src/PHPMailer.php';
include_once app_path() . '/Http/Controllers/src/SMTP.php'; include_once app_path() . '/Http/Controllers/src/SMTP.php';
......
...@@ -16,7 +16,7 @@ class UploadimgController extends Controller ...@@ -16,7 +16,7 @@ class UploadimgController extends Controller
// 上传图片接口 // 上传图片接口
public function uploadingimg(Request $request) public function uploadingimg(Request $request)
{ {
if ($request->isMethod('POST')) { //判断文件是否是 POST的方式上传 if ($request->isMethod('post')) { //判断文件是否是 POST的方式上传
$tmp = $request->file('file'); $tmp = $request->file('file');
if (is_null($tmp)){ if (is_null($tmp)){
return $this->jsonErrorData(105,'上传图片不能为空'); return $this->jsonErrorData(105,'上传图片不能为空');
......
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
const baseURL = 'ws://127.0.0.:9502'; const baseURL = 'wss://127.0.0.:9502';
const chemicalsUrl = 'ws://127.0.0.1:9507'; const chemicalsUrl = 'wss://127.0.0.1:9507';
const fireUrl = 'ws://127.0.0.1:9508'; const fireUrl = 'wss://127.0.0.1:9508';
const alarmUrl = 'ws://127.0.0.1:9601'; const alarmUrl = 'wss://127.0.0.1:9601';
const mapkey = '2719fe261fee06a08dcb4980990879da'; const mapkey = '2719fe261fee06a08dcb4980990879da';
const mapurl = 'https://webapi.amap.com/maps?v=1.4.15&key='; const mapurl = 'https://webapi.amap.com/maps?v=1.4.15&key=';
export default { export default {
......
...@@ -174,3 +174,11 @@ export function devicepoliceinfo(devicenum) { ...@@ -174,3 +174,11 @@ export function devicepoliceinfo(devicenum) {
method: 'get', method: 'get',
}); });
} }
export function history_device_type() {
return request({
url: '/devices/history_device_type',
method: 'get',
});
}
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
...@@ -11,6 +11,10 @@ ...@@ -11,6 +11,10 @@
<el-col :span="6"><el-card shadow="always">报警数量<span style="margin-left: 12px;color: #E6A23C;">{{ synthesizecount.devicepolice }}</span></el-card></el-col> <el-col :span="6"><el-card shadow="always">报警数量<span style="margin-left: 12px;color: #E6A23C;">{{ synthesizecount.devicepolice }}</span></el-card></el-col>
<el-col :span="6"><el-card shadow="always">今天报警次数<span style="margin-left: 12px;color: #F56C6C;">{{ synthesizecount.timedevicepolice }}</span></el-card></el-col> <el-col :span="6"><el-card shadow="always">今天报警次数<span style="margin-left: 12px;color: #F56C6C;">{{ synthesizecount.timedevicepolice }}</span></el-card></el-col>
</el-row> </el-row>
<el-row :gutter="50">
<el-col :span="8" style="margin-left:20px ;"><el-card shadow="always">未报警总数<span style="margin-left: 12px;color: #409EFF;">{{ synthesizecount.offdevice }}</span></el-card></el-col>
<el-col :span="8" style="float: right; margin-right: 25px;"><el-card shadow="always">设备在线率<span style="margin-left: 12px;color: #23E610;">{{ synthesizecount.deviceurt == 0 ? '1' : synthesizecount.deviceurt }}</span>%</el-card></el-col>
</el-row>
</div> </div>
<!-- 混合统计 --> <!-- 混合统计 -->
<el-card class="box-card" style="margin-top:12px;padding-bottom:24px"> <el-card class="box-card" style="margin-top:12px;padding-bottom:24px">
......
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
<template> <template>
<div class="app-container"> <div class="app-container">
<el-table :key="tableKey" :data="reportpolice" border fit highlight-current-rows> <el-date-picker v-model="devicehtime" type="date" placeholder="选择日期" style="width: 15%;"></el-date-picker>--<el-time-picker v-model="devicetime" placeholder="选择时间" style="width: 15%;"></el-time-picker>
<el-select v-model="data_device_type" placeholder="报警类型">
<el-option v-for="item in device_type" :key="item.id" :label="item.status_name" :value="item.id"></el-option>
</el-select>
<el-select v-model="data_device_quyu" placeholder="区域">
<el-option v-for="item in device_quyu" :key="item.deviceid" :label="item.deviceinfo" :value="item.deviceid"></el-option>
</el-select>
<el-button type="primary" icon="el-icon-search" style="margin-left: 12px;" @click="deviceonut()">搜索</el-button>
<el-table :key="tableKey" :data="reportpolice" border fit highlight-current-rows style="margin-top: 20px;">
<el-table-column label="设备编号" width="150"> <el-table-column label="设备编号" width="150">
<template slot-scope="scope"> <template slot-scope="scope">
<span @click="handleCopy(scope.row.devicenumber,$event)">{{ scope.row.devicenumber }}</span> <span @click="handleCopy(scope.row.devicenumber,$event)">{{ scope.row.devicenumber }}</span>
...@@ -49,7 +57,7 @@ ...@@ -49,7 +57,7 @@
</template> </template>
<script> <script>
import { police } from '@/api/device'; import { police, history_device_type } from '@/api/device';
import clip from '@/utils/clipboard'; import clip from '@/utils/clipboard';
import BackToTop from '@/components/BackToTop'; import BackToTop from '@/components/BackToTop';
export default { export default {
...@@ -67,10 +75,17 @@ export default { ...@@ -67,10 +75,17 @@ export default {
'line-height': '45px', // Please keep consistent with height to center vertically 'line-height': '45px', // Please keep consistent with height to center vertically
background: '#e7eaf1', // The background color of the button background: '#e7eaf1', // The background color of the button
}, },
devicetime: '', // 时间
devicehtime: '', // 年月
device_type: '', // 搜索数据设备报警类型
device_quyu: '', // 设备区域
data_device_type: '', // 设备数据
data_device_quyu: '', // 设备区域
}; };
}, },
created() { created() {
this.police(); // 列表 this.police(); // 列表
this.historydevicetype(); // 设备搜索所需数据
}, },
methods: { methods: {
police() { police() {
...@@ -89,9 +104,26 @@ export default { ...@@ -89,9 +104,26 @@ export default {
console.log(err); console.log(err);
}); });
}, },
historydevicetype(){
history_device_type()
.then(response => {
if (response.code === 200) {
this.device_type = response.data.device_type;
this.device_quyu = response.data.device_quyu;
}
})
.catch(err => {
console.log(err);
});
},
handleCopy(text, event) { handleCopy(text, event) {
clip(text, event); clip(text, event);
}, },
deviceonut() {
console.log(this.devicetime);
console.log(this.devicehtime);
console.log(this.device_type);
},
}, },
}; };
</script> </script>
......
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
...@@ -78,6 +78,22 @@ ...@@ -78,6 +78,22 @@
<pagination v-show="total>0" :total="total" :page.sync="userdata.page" :limit.sync="userdata.limit" @pagination="getUserList" /> <pagination v-show="total>0" :total="total" :page.sync="userdata.page" :limit.sync="userdata.limit" @pagination="getUserList" />
<el-dialog :visible.sync="dialogPvVisible" title="编辑用户" width="85%" style="margin-top: auto;"> <el-dialog :visible.sync="dialogPvVisible" title="编辑用户" width="85%" style="margin-top: auto;">
<el-form :model="upUserData" class="demo-ruleForm" status-icon> <el-form :model="upUserData" class="demo-ruleForm" status-icon>
<el-form-item label="头像上传" prop="userfile">
<el-upload action="#" list-type="picture-card" :drag="true" :auto-upload="false" :disabled="userimgdisabled" :limit="1" style="float:right;margin-right: 12rpx;">
<i slot="default" class="el-icon-plus"></i>
<div slot="file" slot-scope="{file}">
<img class="el-upload-list__item-thumbnail" :src="file.url" alt="" :on-success="onfile(file)">
<span class="el-upload-list__item-actions">
<span class="el-upload-list__item-preview" @click="handlePictureCardPreview(file)">
<i class="el-icon-zoom-in"></i>
</span>
<span v-if="!disabled" class="el-upload-list__item-delete" @click="handleRemove(file)">
<i class="el-icon-delete"></i>
</span>
</span>
</div>
</el-upload>
</el-form-item>
<el-form-item label="账号名称" prop="username"> <el-form-item label="账号名称" prop="username">
<el-input v-model.number="upUserData.username"></el-input> <el-input v-model.number="upUserData.username"></el-input>
</el-form-item> </el-form-item>
...@@ -97,6 +113,9 @@ ...@@ -97,6 +113,9 @@
<el-button type="primary" @click="submitForm()">提交</el-button> <el-button type="primary" @click="submitForm()">提交</el-button>
<el-button @click="resetForm()">重置</el-button> <el-button @click="resetForm()">重置</el-button>
</el-form-item> </el-form-item>
<el-dialog :visible.sync="dialogVisible">
<img width="100%" :src="dialogImageUrl" alt="">
</el-dialog>
</el-form> </el-form>
</el-dialog> </el-dialog>
</div> </div>
...@@ -135,6 +154,10 @@ export default { ...@@ -135,6 +154,10 @@ export default {
userid: undefined, userid: undefined,
}, },
paper: undefined, paper: undefined,
dialogImageUrl: '', // 图片地址
dialogVisible: false,
disabled: false,
userimgdisabled: false, // 用户上传图片
}; };
}, },
created() { created() {
...@@ -328,6 +351,18 @@ export default { ...@@ -328,6 +351,18 @@ export default {
}); });
}); });
}, },
// 删除文件
handleRemove(file) {
console.log(file);
},
// 放大文件
handlePictureCardPreview(file) {
this.dialogImageUrl = file.url;
this.dialogVisible = true;
},
onfile(file){
console.log(file);
},
}, },
}; };
</script> </script>
......
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
...@@ -51,7 +51,7 @@ Route::group(['middleware' => 'auth:api'], function () { ...@@ -51,7 +51,7 @@ Route::group(['middleware' => 'auth:api'], function () {
//上传图片路由 //上传图片路由
Route::group(['middleware'=>'auth:api'],function (){ Route::group(['middleware'=>'auth:api'],function (){
Route::post('upload_img/uploadingimg','UploadimgController@uploadingimg')->middleware('permission:' . \App\Laravue\Acl::PERMISSION_PERMISSION_MANAGE);//添加图片 Route::post('upload_img/uploadingimg','UploadimgController@uploadingimg');//添加图片
Route::get('userimglist/userimglist','UploadimgController@userlist');//图片列表 Route::get('userimglist/userimglist','UploadimgController@userlist');//图片列表
Route::get('userimgdetele/userimgdetele','UploadimgController@userimgdetele');//删除图片 Route::get('userimgdetele/userimgdetele','UploadimgController@userimgdetele');//删除图片
Route::match(['get','post'],'updateimg/updateimg','UploadimgController@updateimg');//更新图片信息,返回逻辑图片列表 Route::match(['get','post'],'updateimg/updateimg','UploadimgController@updateimg');//更新图片信息,返回逻辑图片列表
...@@ -106,6 +106,8 @@ Route::group(['middleware'=>'auth:api'],function (){ ...@@ -106,6 +106,8 @@ Route::group(['middleware'=>'auth:api'],function (){
Route::get('devices/device_info/{id}','DevicesController@device_info');//返回设备地图详情信息 Route::get('devices/device_info/{id}','DevicesController@device_info');//返回设备地图详情信息
Route::get('devices/devicepolice','DevicesController@devicepolice');//设备消警 Route::get('devices/devicepolice','DevicesController@devicepolice');//设备消警
Route::get('devices/devicepoliceinfo','DevicesController@devicepoliceinfo');//设备报警弹窗详情 Route::get('devices/devicepoliceinfo','DevicesController@devicepoliceinfo');//设备报警弹窗详情
Route::get('login/history_device_type','DevicesController@history_device_type');//报警数据搜索所需数据
Route::get('devices/companyuser','DevicesController@companyuser');//用户获取自定义公司名称
// 设备型号 // 设备型号
Route::get('device/models', 'ModelNumberController@index'); Route::get('device/models', 'ModelNumberController@index');
Route::post('device/models', 'ModelNumberController@store'); Route::post('device/models', 'ModelNumberController@store');
......
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
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 to comment