Commit 56331e95 authored by 冯超鹏's avatar 冯超鹏

Merge branch 'release/101'

# Conflicts:
#	app/Console/Commands/alarm.php
#	app/Console/Commands/chemicalswb.php
#	app/Console/Commands/firewb.php
#	app/Console/Commands/swoole.php
#	app/Console/Commands/swooleMeTcp.php
#	app/Http/Controllers/HomepageController.php
#	resources/js/views/dashboard/index.vue
#	resources/js/views/user/index.vue
parents b3f364f2 29e35bf0
Pipeline #188 canceled with stages
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 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
......@@ -58,6 +58,7 @@ class alarm extends Command
$url = config('public.swoolwebsocketurl');
$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(
'reactor_num' => 2, //reactor线程数
'worker_num' => 4, //worker进程数
......
......@@ -57,7 +57,7 @@ class chemicalswb extends Command
{
$url = config('public.swoolwebsocketurl');
$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, SWOOLE_SOCK_TCP | SWOOLE_SSL); //创建一个端口
$this->ws->set(array(
'reactor_num' => 2, //reactor线程数
'worker_num' => 4, //worker进程数
......
......@@ -57,7 +57,7 @@ class firewb extends Command
{
$url = config('public.swoolwebsocketurl');
$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, SWOOLE_SOCK_TCP | SWOOLE_SSL); //创建一个端口
$this->ws->set(array(
'reactor_num' => 2, //reactor线程数
'worker_num' => 4, //worker进程数
......
......@@ -57,7 +57,7 @@ class swoole extends Command
{
$url = config('public.swoolwebsocketurl');
$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|SWOOLE_PROCESS, SWOOLE_SOCK_TCP | SWOOLE_SSL); //创建一个端口
$this->ws->set(array(
'reactor_num' => 2, //reactor线程数
'worker_num' => 4, //worker进程数
......@@ -89,7 +89,6 @@ class swoole extends Command
echo "client:{$fd} is closed\n";
swoole_timer_clear($this->time);
});
$this->ws->start();
}
}
......@@ -5,6 +5,7 @@ namespace App\Console\Commands;
use App\Http\Controllers\Auth\SwooleCommandMeTcpController;
use Illuminate\Support\Facades\Log;
use Illuminate\Console\Command;
use App\Http\Controllers\Auth\ZehongTcpController;
class swooleMeTcp extends Command
{
public $tcp;
......@@ -55,14 +56,10 @@ class swooleMeTcp extends Command
public function start()
{
$url = config('public.swooletcpurl');
// $this->tcp = new \swoole_server('0.0.0.0', 9503, SWOOLE_PROCESS,SWOOLE_SOCK_TCP | SWOOLE_SSL);
//// $this->tcp->addlistener('0.0.0.0', 9504, SWOOLE_SOCK_TCP | SWOOLE_SSL); // 添加 TCP端口监听
//// $this->tcp->addlistener('0.0.0.0', 9505, SWOOLE_SOCK_TCP | SWOOLE_SSL); // 添加 TCP端口监听
//// $this->tcp->addlistener('0.0.0.0', 9506, SWOOLE_SOCK_TCP | SWOOLE_SSL); // 添加 TCP端口监听
$this->tcp = new \swoole_server('0.0.0.0', 9503, SWOOLE_PROCESS,SWOOLE_SOCK_TCP);
$this->tcp->addlistener('0.0.0.0', 9504, SWOOLE_SOCK_TCP); // 添加 TCP端口监听
$this->tcp->addlistener('0.0.0.0', 9505, SWOOLE_SOCK_TCP); // 添加 TCP端口监听
$this->tcp->addlistener('0.0.0.0', 9506, SWOOLE_SOCK_TCP); // 添加 TCP端口监听
$this->tcp = new \swoole_server('0.0.0.0', 9504,SWOOLE_PROCESS);
$this->tcp->addlistener('0.0.0.0', 9504,SWOOLE_SOCK_TCP); // 添加 TCP端口监听
$this->tcp->addlistener('0.0.0.0', 9505,SWOOLE_SOCK_TCP); // 添加 TCP端口监听
// $this->tcp->addlistener('0.0.0.0', 9506,SWOOLE_SOCK_TCP); // 添加 TCP端口监听
$this->tcp->set([
'worker_num' => 2,//设置启动的 Worker 进程数
'max_request' =>30,//最大任务数
......@@ -71,8 +68,6 @@ class swooleMeTcp extends Command
'backlog' => 128,
'heartbeat_check_interval' => 30,
'heartbeat_idle_time' => 65,
// 'ssl_cert_file' => base_path() . config('app.ssl_cert_file'),
// 'ssl_key_file' => base_path() . config('app.ssl_key_file'),
]);
//监听连接进入事件
$this->tcp->on('Connect', function ($serv, $fd) {
......@@ -88,10 +83,14 @@ class swooleMeTcp extends Command
$this->tcp->on('Receive', function ($serv, $fd, $from_id, $data) {
Log::channel('slack')->info($data);
//验证数据格式
if($this->formatData($data)){
$swooletcp = new SwooleCommandMeTcpController();
$swooletcp->swooletcplist($data);
}
// $serv->send($fd,$data);
// if($this->formatData($data)){
// $swooletcp = new SwooleCommandMeTcpController();
// $swooletcp->swooletcplist($data);
// }
$swooletcp = new ZehongTcpController();
// $swooletcp->swooletcplist($data);
$serv->send($fd,$swooletcp->swooletcplist($data));
});
//监听连接关闭事件
......
File mode changed from 100644 to 100755
<?php
namespace App\Console\Commands;
use App\Http\Controllers\Auth\ZehongTcpController;
use Illuminate\Support\Facades\Log;
use Illuminate\Console\Command;
class zehongTcp extends Command
{
public $tcp;
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'zehongTcp {action?}';
/**
* The console command description.
*
* @var string
*/
protected $description = 'zehongTcp';
/**
* Create a new command instance.
*
* @return void
*/
public function __construct()
{
parent::__construct();
}
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
$action = $this->argument('action');
switch ($action) {
case 'close':
break;
default:
$this->start();//开启tcp服务
break;
}
}
//开启
public function start()
{
$url = config('public.swooletcpurl');
$this->tcp = new \swoole_server('0.0.0.0', 9503, SWOOLE_PROCESS);
$this->tcp->set([
'worker_num' => 2,//设置启动的 Worker 进程数
'max_request' => 30,//最大任务数
'max_connection' => 50,
'daemonize' => 0,//守护进程
'backlog' => 128,
'heartbeat_check_interval' => 30,
'heartbeat_idle_time' => 65,
]);
//监听连接进入事件
$this->tcp->on('Connect', function ($serv, $fd) {
$data = [
'stats[得到当前 Server 的活动 TCP 连接数]' => $this->tcp->stats(),
'getClientInfo[获取连swooletcplist接的信息]' => $this->tcp->getClientInfo($fd, 1, true)
];//链接信息写入.log
Log::channel('slack')->info($data);
$serv->send($fd, '连接成功' . ',' . 'id=>' . $fd);
});
//监听数据接收事件
$this->tcp->on('Receive', function ($serv, $fd, $from_id, $data) {
//验证数据格式
$swooletcp = new ZehongTcpController();
// $swooletcp->swooletcplist($data);
$serv->send($fd,$swooletcp->swooletcplist($data));
});
//监听连接关闭事件
$this->tcp->on('Close', function ($serv, $fd) {
Log::channel('slack')->info('连接已断开' . ',' . 'id=>' . $fd);
});
//启动服务器
$this->tcp->start();
}
public function formatData($str)
{
$str = preg_replace("/[^a-z,A-Z,0-9,\/,\.,-]/", '', $str);
$str = rtrim(trim($str), '/');
$str = str_replace('null', -1, $str);
preg_match("/^[a-z,A-Z,0-9,\-]{6,32}\/(\d{1,2})\/(\-?)([0-9,\.]{1,8})$/", $str, $out);
if (count($out) > 0) {
return $str;
} else {
return false;
}
}
}
\ No newline at end of file
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
<?php
namespace App\Http\Controllers\Auth;
use Illuminate\Support\Facades\DB;
use App\Laravue\Models\Users;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use Illuminate\Support\Facades\Redis;
use App\Http\Controllers\DevicesController;
use Illuminate\Support\Facades\Config;
class ZehongTcpController extends Controller
{
//获取 tcp 上传数据
public function swooletcplist($data = '')
{
if ($data != '') {
return $this->substrdata($data);
}
}
// 解开数据包
protected function substrdata($data)
{
if (is_string($data) && strlen($data) == 26) {
$deviceId = substr($data, 0, 15); // 设备编号
$status = substr($data, 15, 1); // 状态
$devicenp = substr($data, 16, 3); // 浓度
$devicefamen = substr($data, 19, 1);
$devicechongqi = substr($data, 20, 1);
$devicezijian = substr($data, 21, 1);
$devicecrc = substr($data, 22, 4);
$isdata = substr($data, 0, 22);
if($this->getPrc($isdata) == $devicecrc){
$data = ['id'=>$deviceId,'status'=>$status,'np'=>$devicenp,'famen'=>$devicefamen,'chongqi'=>$devicechongqi,'zijian'=>$devicezijian];
$totcp = json_decode($this->mysqldb($data),true);
if ($totcp == "暂无设备"){
return $totcp;
}
if($totcp['nd'] < 999 ){
$totcp['nd'] = '0' . $totcp['nd'];
}
$totcpdata = $totcp['devicenum'] .$totcp['devicepolice'] .$totcp['nd'] . $totcp['shutoff_status'] . $devicechongqi . $devicezijian;
$crcdata = $this->getPrc($totcpdata);
return $totcpdata . $crcdata;
}
} else {
return "数据格式错误";
}
}
//解出prc
protected function getPrc($msg)
{
/**
* If your input string is HEX-formatted you should comment #15 line
* for example: $msg="0123" equals to 0x0123 without leading 0x
*/
//conversion input string to plain HEX string. See comment above
$msg = bin2hex($msg);
//pack HEX-formatted $msg to the pure HEX array
$data = pack('H*', $msg);
//initialize crc as start HEX value;
$crc = 0xFFFF;
//loop $data array of HEX bytes
for ($i = 0; $i < strlen($data); $i++) {
//xor bits in the first byte of HEX value
$crc ^= ord($data[$i]);
//loop to shift every of 8 bits
for ($j = 8; $j != 0; $j--) {
//shift bits to the right and xor with polynome
if (($crc & 0x0001) != 0) {
$crc >>= 1;
$crc ^= 0xA001;
} else $crc >>= 1;
}
}
//return the result as HEX-formatted string
$data = strrev(sprintf('%04X', $crc));
$crc1 = strrev(substr($data, 0, 2));
$crc2 = strrev(substr($data, 2, 2));
return $crc1 . $crc2;
}
//获取上报数据从数据库查询
public function mysqldb($data){
if($data != []){
$datainfo = DB::table('device')
->where('devicenum','=',$data['id'])
->update(['nd'=>intval($data['np']),'shutoff_status'=>$data['famen'],'devicepolice'=>$data['status'] == 0 ? '1' : $data['status']]);
$todata = DB::table('device')
->where('devicenum','=',$data['id'])
->select('devicenum','nd','shutoff_status','devicepolice')
->first();
if ($todata){
return json_encode($todata);
}else{
return "暂无设备";
}
}
}
}
\ No newline at end of file
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
......@@ -30,10 +30,11 @@ class DevicesController extends Controller
$type = $request->input('type');//设备类型id
$limit = $request->input('limit');
$pagenNum = $limit * ($request->input('page') - 1);//页数
$isuser = $request->input('isuser');
if ($pagenNum === '' || $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
->leftjoin('gas', 'de.status', '=', 'gas.id')
->leftjoin('danwei as da', 'de.devicemonad', '=', 'da.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();
return $this->jsonSuccessData($devi);
}
}
//返回设备类型和单位和介质
public function devicetype()
public function devicetype(Request $request)
{
$gas = DB::table('gas')->get();
$danwei = DB::table('danwei')->get();
......@@ -198,8 +199,26 @@ class DevicesController extends Controller
}
//返回设备列表
private function whertype($type, $pagenNum, $limit): array
private function whertype($type, $pagenNum, $limit, $isuser): array
{
if ($isuser == 'user') {
$devicelist = DB::table('device')
->where('dtype', '=', $type)
->where('uid', '=', Auth::id())
->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)
->where('uid', '=', Auth::id())
->count();
} else {
$devicelist = DB::table('device')
->where('dtype', '=', $type)
->leftjoin('device_type as dy', "device.dtype", '=', 'dy.tid')
......@@ -214,6 +233,7 @@ class DevicesController extends Controller
$count = DB::table('device')
->where('dtype', '=', $type)
->count();
}
return ['devicelist' => $devicelist, 'count' => $count];
}
......@@ -352,7 +372,7 @@ class DevicesController extends Controller
{
$request = $request->input();
$time_start = $time_stop = false;
if(!is_null($request['timeRange'])) {
if (!is_null($request['timeRange'])) {
$time_start = strtotime($request['timeRange'][0]);
$time_stop = strtotime($request['timeRange'][1]);
}
......@@ -378,15 +398,15 @@ class DevicesController extends Controller
if (!is_null($this->isadmin())) {
$data = DB::table('reportpolice as r')
->join('status as s', 'r.policestatus', '=', 's.id')
->join('device as d' , 'r.devicenumber','=','d.devicenum')
->select('r.*', 's.status_name','d.id as deid')
->join('device as d', 'r.devicenumber', '=', 'd.devicenum')
->select('r.*', 's.status_name', 'd.id as deid')
->get();
}else{
} else {
$data = DB::table('reportpolice as r')
->join('status as s', 'r.policestatus', '=', 's.id')
->join('device as d' , 'r.devicenumber','=','d.devicenum')
->where('d.uid','=',Auth::id())
->select('r.*', 's.status_name','d.id as deid')
->join('device as d', 'r.devicenumber', '=', 'd.devicenum')
->where('d.uid', '=', Auth::id())
->select('r.*', 's.status_name', 'd.id as deid')
->get();
}
return $this->jsonSuccessData($data);
......@@ -407,6 +427,12 @@ class DevicesController extends Controller
{
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()
......@@ -460,6 +486,7 @@ class DevicesController extends Controller
return $status ? $this->jsonSuccessData($status) : $this->jsonErrorData(202, 'error');
}
public function delteClassify($id)
{
//删除分类
......@@ -476,15 +503,15 @@ class DevicesController extends Controller
$where['device.uid'] = $user_id;
}
$data = DB::table('device')
->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')
->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')
->where($where)
->get();
} else {
$data = DB::table('device')
->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')
->where('device.uid','=',Auth::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')
->where('device.uid', '=', Auth::id())
->get();
}
......@@ -510,16 +537,16 @@ class DevicesController extends Controller
}
$search = json_decode($request->input('search'), true);
$where = [];
if(!empty($search['deviceNum'])) {
if (!empty($search['deviceNum'])) {
$where[] = ['devicenum', 'like', "%{$search['deviceNum']}%"];
}
if(!empty($search['deviceName'])) {
if (!empty($search['deviceName'])) {
$where[] = ['username', 'like', "%{$search['deviceName']}%"];
}
if($search['deviceType'] != 0) {
if ($search['deviceType'] != 0) {
$wherein = [$search['deviceType']];
}
if($search['deviceStatus'] != 0) {
if ($search['deviceStatus'] != 0) {
$where[] = ['device.devicepolice', '=', $search['deviceStatus']];
}
......@@ -540,14 +567,14 @@ class DevicesController extends Controller
->whereIn('dtype', $wherein)
->where($where)
->count();
}else{
} else {
$devicelist = DB::table('device')
->whereIn('dtype', $wherein)
->leftjoin('device_type as dy', "device.dtype", '=', 'dy.tid')
->leftjoin('gas as g', "device.status", '=', 'g.id')
->leftjoin('status as p', "device.devicepolice", '=', 'p.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')
->where($where)
->orderBy('device.id', 'desc')
......@@ -556,40 +583,55 @@ class DevicesController extends Controller
->get()->toArray();
$count = DB::table('device')
->whereIn('dtype', $wherein)
->where('uid','=',Auth::id())
->where('uid', '=', Auth::id())
->where($where)
->count();
}
return $this->jsonSuccessData(['devicelist' => $devicelist, 'count' => $count]);
}
public function devicepolice(Request $request)
{
$devicenum = $request->input('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);
}else{
return $this->jsonErrorData(105,'设备编号不能为空');
} else {
return $this->jsonErrorData(105, '设备编号不能为空');
}
}
//返回报警记录中的报类型和区域
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){
public function devicepoliceinfo(Request $request)
{
$devicenum = $request->input('devicenum');
if ($devicenum) {
$data = DB::table('device as d')
->join('device_type as t','d.dtype','=','t.tid')
->join('gas as g','d.status','=','g.id')
->join('status as s','d.devicepolice','=','s.id')
->join('danwei as w','d.devicemonad','=','w.id')
->join('users as u','d.uid','=','u.id')
->join('reportpolice as r','d.devicenum','=','r.devicenumber')
->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')
->join('device_type as t', 'd.dtype', '=', 't.tid')
->join('gas as g', 'd.status', '=', 'g.id')
->join('status as s', 'd.devicepolice', '=', 's.id')
->join('danwei as w', 'd.devicemonad', '=', 'w.id')
->join('users as u', 'd.uid', '=', 'u.id')
->join('reportpolice as r', 'd.devicenum', '=', 'r.devicenumber')
->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')
->first();
return $this->jsonSuccessData($data);
}else{
return $this->jsonErrorData(105,'设备编号不能为空');
} else {
return $this->jsonErrorData(105, '设备编号不能为空');
}
}
/**
* @param bool $isNew
* @return array
......@@ -687,7 +729,7 @@ class DevicesController extends Controller
* @return array
* @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');
$host = $influxDb['default']['host'];
......@@ -702,10 +744,10 @@ class DevicesController extends Controller
$tbuilde = $tdatabase->getQueryBuilder();
$result = [];
if($time_start === false) {
if ($time_start === false) {
$time_start = 0;
}
if($time_stop === false) {
if ($time_stop === false) {
$time_stop = time();
}
$time_start -= 8 * 3600;
......@@ -716,17 +758,17 @@ class DevicesController extends Controller
$tresult = $tbuilde->select('*')
->from('devices')
->setTimeRange($time_start, $time_stop);
if(!empty($device_num)) {
if (!empty($device_num)) {
$where = ["device_num='{$device_num}'"];
$result = $result->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}'"];
$result = $result->where($where);
$tresult = $tresult->where($where);
}
if($this->isadmin() != 1) {
if ($this->isadmin() != 1) {
$user_id = Auth::id();
$where = ["user_id='{$user_id}'"];
$result = $result->where($where);
......@@ -734,9 +776,9 @@ class DevicesController extends Controller
}
$total = $tresult->count('value')->getResultSet()->getPoints();
if(count($total) > 0) {
$result = $result->orderBy('time','DESC')
->limit($size)->offset(($page-1)*$size)
if (count($total) > 0) {
$result = $result->orderBy('time', 'DESC')
->limit($size)->offset(($page - 1) * $size)
->getResultSet()->getPoints();
} else {
$result = [];
......
......@@ -21,8 +21,26 @@ use Validator;
class HomepageController extends Controller
{
//返回用户数量 设备数量, 报警数量 ,
public function homepagecount()
public function homepagecount(Request $request)
{
$type = $request->input('isuser');
if ($type == 'user') {
$usercount = Users::count();
$devicecount = Device::where('uid','=',Auth::id())->count();
$devicepolice = Device::where('uid','=',Auth::id())->where('devicepolice', '>', '1')->count();
// 设备在线数量
$device_online = Device::where('uid','=',Auth::id())->whereNotIn('devicepolice', [9, 15])->count();
// 设备报警数量
$device_alarm = Device::where('uid','=',Auth::id())->whereIn('devicepolice', [4, 5, 6, 16])->count();
// 未报警设备数量
$device_normal = Device::where('uid','=',Auth::id())->where('devicepolice', 1)->count();
// 故障设备
$device_offline = Device::where('uid','=',Auth::id())->whereNotIn('devicepolice', [1, 4, 5, 6, 16])->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();
} else {
$usercount = Users::count();
$devicecount = Device::count();
$devicepolice = Device::where('devicepolice', '>', '1')->count();
......@@ -38,6 +56,7 @@ class HomepageController extends Controller
$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();
}
return $this->jsonSuccessData([
'usercount' => $usercount,
'devicecount' => $devicecount,
......@@ -58,8 +77,29 @@ class HomepageController extends Controller
}
//返回一年当前月份
public function devicemonthcount()
public function devicemonthcount(Request $request)
{
$type = $request->input('isuser');
if ($type == 'user') {
$year_start = strtotime(date("Y") . "-01-01"); // 获取当前的1月份的时间戳
$endThismonth = mktime(23, 59, 59, date('m'), date('t'), date('Y')); //获取当月的时间戳
$devicedata = Device::where('uid','=',Auth::id())->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::where('uid','=',Auth::id())->whereBetween('deviceaddtime', [$year_start, $endThismonth])
->where('devicepolice', '>', 1)
->selectRaw('from_unixtime(deviceaddtime,"%Y-%m") as date,COUNT(id) as value')
->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])
......@@ -67,7 +107,7 @@ class HomepageController extends Controller
->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)])
$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()
......@@ -78,19 +118,21 @@ class HomepageController extends Controller
->groupBy('date')
->get()
->toArray();
}
return $this->jsonSuccessData(['devicedata' => $this->datamonth($devicedata), 'policedata' => $this->datamonth($policedata), 'devicepolice' => $this->datamonth($devicepolice)]);
}
//用户统计
public function UserStatistics (){
$devicecount = Device::where('uid','=',Auth::id())->count();
$devicepolice = Device::where('devicepolice', '>', '1')->where('uid','=',Auth::id())->count();
public function UserStatistics()
{
$devicecount = Device::where('uid', '=', Auth::id())->count();
$devicepolice = Device::where('devicepolice', '>', '1')->where('uid', '=', Auth::id())->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 as r')
->join('device as d','d.devicenum','=','r.devicenumber')
->where('d.uid','=',Auth::id())
->join('device as d', 'd.devicenum', '=', 'r.devicenumber')
->where('d.uid', '=', Auth::id())
->where('r.status', '=', '1')
->whereBetween('r.starttime', [$start, $end])
->count();
......@@ -103,12 +145,12 @@ class HomepageController extends Controller
\Session::put(['loginuid' => Auth::id()]);
$year_start = strtotime(date("Y") . "-01-01"); // 获取当前的1月份的时间戳
$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')
->groupBy('date')
->get()
->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)
->selectRaw('from_unixtime(deviceaddtime,"%Y-%m") as date,COUNT(id) as value')
->groupBy('date')
......@@ -128,7 +170,7 @@ class HomepageController extends Controller
$size = $this->getDirSize($phay);
$base_path = @round($size / pow(1024, ($i = floor(log($size, 1024)))), 2);
$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,9 +40,10 @@ class UinappHomeController extends Controller
public function imitation(Request $request)
{
$imitationdata = $request->input('imitationdata');
$type = $request->input('isuser');
if ($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')
......@@ -50,9 +51,34 @@ class UinappHomeController extends Controller
->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')
......@@ -63,6 +89,8 @@ class UinappHomeController extends Controller
->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('');
......@@ -74,7 +102,9 @@ class UinappHomeController extends Controller
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')
->join('device_type as t', 'd.dtype', '=', 't.tid')
->join('gas as g', 'd.status', '=', 'g.id')
......@@ -82,9 +112,33 @@ class UinappHomeController extends Controller
->join('status as s', 'd.devicepolice', '=', 's.id')
->join('users as u', 'd.uid', '=', 'u.id')
->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')
->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', '=', $setdata)
->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', '=', $setdata)
->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')
......@@ -95,6 +149,7 @@ class UinappHomeController extends Controller
->select('d.*', 't.tname', 'g.gas', 'w.danwei', 's.status_name', 'u.username as nameh', 'u.isadmin')
->get();
}
}
return $this->jsonSuccessData($data);
}
......@@ -141,9 +196,9 @@ class UinappHomeController extends Controller
// die();
$isemail = $request->input('email');
$num = str_pad(mt_rand(0, 999999), 6, "0", STR_PAD_BOTH);
if ($isemail != ''){
$send = $this->PHPMailer($isemail,$num);
if($send == 200){
if ($isemail != '') {
$send = $this->PHPMailer($isemail, $num);
if ($send == 200) {
return $this->jsonSuccessData($num);
}
}
......@@ -158,11 +213,12 @@ class UinappHomeController extends Controller
return false;
}
}
/*
* $name 发件人
* $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/SMTP.php';
......
......@@ -16,7 +16,7 @@ class UploadimgController extends Controller
// 上传图片接口
public function uploadingimg(Request $request)
{
if ($request->isMethod('POST')) { //判断文件是否是 POST的方式上传
if ($request->isMethod('post')) { //判断文件是否是 POST的方式上传
$tmp = $request->file('file');
if (is_null($tmp)){
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 chemicalsUrl = 'ws://127.0.0.1:9507';
const fireUrl = 'ws://127.0.0.1:9508';
const alarmUrl = 'ws://127.0.0.1:9601';
const mapkey = '2719fe261fee06a08dcb4980990879da';
const mapurl = 'https://webapi.amap.com/maps?v=1.4.15&key=';
export default {
baseURL,
mapkey,
mapurl,
chemicalsUrl,
fireUrl,
alarmUrl,
};
const baseURL = 'ws://127.0.0.:9502';
const chemicalsUrl = 'ws://127.0.0.1:9507';
const fireUrl = 'ws://127.0.0.1:9508';
const alarmUrl = 'ws://127.0.0.1:9601';
const baseURL = 'wss://127.0.0.:9502';
const chemicalsUrl = 'wss://127.0.0.1:9507';
const fireUrl = 'wss://127.0.0.1:9508';
const alarmUrl = 'wss://127.0.0.1:9601';
const mapkey = '2719fe261fee06a08dcb4980990879da';
const mapurl = 'https://webapi.amap.com/maps?v=1.4.15&key=';
export default {
......
......@@ -174,3 +174,11 @@ export function devicepoliceinfo(devicenum) {
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
<template>
<div :id="id" :class="className" :style="{height:height,width:width}" />
</template>
<script>
import echarts from 'echarts';
import resize from './mixins/resize';
import { userdevicemonthcount } from '@/api/homepage';
export default {
mixins: [resize],
props: {
className: {
type: String,
default: 'chart',
},
id: {
type: String,
default: 'chart',
},
width: {
type: String,
default: '200px',
},
height: {
type: String,
default: '200px',
},
},
data() {
return {
chart: null,
userdevicepolice: [],
userdevicecount: [],
};
},
created() {
this.UserStatistics();
},
beforeDestroy() {
if (!this.chart) {
return;
}
this.chart.dispose();
this.chart = null;
},
methods: {
initChart() {
const xData = (function() {
const data = [];
const date = new Date();
for (let i = 1; i < date.getMonth() + 1 + 1; i++) {
data.push(i + '月');
}
return data;
}());
this.chart = echarts.init(document.getElementById(this.id));
this.chart.setOption({
backgroundColor: '#394056',
title: {
top: 20,
text: '设备统计',
textStyle: {
fontWeight: 'normal',
fontSize: 16,
color: '#F1F1F3',
},
left: '1%',
},
tooltip: {
trigger: 'axis',
axisPointer: {
lineStyle: {
color: '#57617B',
},
},
},
legend: {
top: 20,
icon: 'rect',
itemWidth: 14,
itemHeight: 5,
itemGap: 13,
data: ['设备数量', '报警数量'],
right: '4%',
textStyle: {
fontSize: 12,
color: '#F1F1F3',
},
},
grid: {
top: 100,
left: '2%',
right: '2%',
bottom: '2%',
containLabel: true,
},
xAxis: [{
type: 'category',
boundaryGap: false,
axisLine: {
lineStyle: {
color: '#57617B',
},
},
data: xData,
}],
yAxis: [{
type: 'value',
name: '(%)',
axisTick: {
show: false,
},
axisLine: {
lineStyle: {
color: '#57617B',
},
},
axisLabel: {
margin: 10,
textStyle: {
fontSize: 14,
},
},
splitLine: {
lineStyle: {
color: '#57617B',
},
},
}],
series: [{
name: '设备数量',
type: 'line',
smooth: true,
symbol: 'circle',
symbolSize: 5,
showSymbol: false,
lineStyle: {
normal: {
width: 1,
},
},
areaStyle: {
normal: {
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
offset: 0,
color: 'rgba(0, 136, 212, 0.3)',
}, {
offset: 0.8,
color: 'rgba(0, 136, 212, 0)',
}], false),
shadowColor: 'rgba(0, 0, 0, 0.1)',
shadowBlur: 10,
},
},
itemStyle: {
normal: {
color: 'rgb(0,136,212)',
borderColor: 'rgba(0,136,212,0.2)',
borderWidth: 12,
},
},
data: this.userdevicecount,
}, {
name: '报警数量',
type: 'line',
smooth: true,
symbol: 'circle',
symbolSize: 5,
showSymbol: false,
lineStyle: {
normal: {
width: 1,
},
},
areaStyle: {
normal: {
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
offset: 0,
color: 'rgba(219, 50, 51, 0.3)',
}, {
offset: 0.8,
color: 'rgba(219, 50, 51, 0)',
}], false),
shadowColor: 'rgba(0, 0, 0, 0.1)',
shadowBlur: 10,
},
},
itemStyle: {
normal: {
color: 'rgb(219,50,51)',
borderColor: 'rgba(219,50,51,0.2)',
borderWidth: 12,
},
},
data: this.userdevicepolice,
}],
});
},
UserStatistics() {
userdevicemonthcount()
.then(response => {
if (response.code === 200) {
this.userdevicecount = response.data.devicedata;
this.userdevicepolice = response.data.devicepolice;
this.initChart();
}
})
.catch(err => {
console.log(err);
});
},
},
};
</script>
File mode changed from 100644 to 100755
<template>
<div :id="id" :class="className" :style="{height:height,width:width}" />
</template>
<script>
import echarts from 'echarts';
import resize from './mixins/resize';
import { userdevicemonthcount } from '@/api/homepage';
export default {
mixins: [resize],
props: {
className: {
type: String,
default: 'chart',
},
id: {
type: String,
default: 'chart',
},
width: {
type: String,
default: '200px',
},
height: {
type: String,
default: '200px',
},
},
data() {
return {
chart: null,
userdevicepolice: [],
userdevicecount: [],
};
},
created() {
this.UserStatistics();
},
beforeDestroy() {
if (!this.chart) {
return;
}
this.chart.dispose();
this.chart = null;
},
methods: {
initChart() {
const xData = (function() {
const data = [];
const date = new Date();
for (let i = 1; i < date.getMonth() + 1 + 1; i++) {
data.push(i + '月');
}
return data;
}());
this.chart = echarts.init(document.getElementById(this.id));
this.chart.setOption({
backgroundColor: '#394056',
title: {
top: 20,
text: '设备统计',
textStyle: {
fontWeight: 'normal',
fontSize: 16,
color: '#F1F1F3',
},
left: '1%',
},
tooltip: {
trigger: 'axis',
axisPointer: {
lineStyle: {
color: '#57617B',
},
},
},
legend: {
top: 20,
icon: 'rect',
itemWidth: 14,
itemHeight: 5,
itemGap: 13,
data: ['设备数量', '报警数量'],
right: '4%',
textStyle: {
fontSize: 12,
color: '#F1F1F3',
},
},
grid: {
top: 100,
left: '2%',
right: '2%',
bottom: '2%',
containLabel: true,
},
xAxis: [{
type: 'category',
boundaryGap: false,
axisLine: {
lineStyle: {
color: '#57617B',
},
},
data: xData,
}],
yAxis: [{
type: 'value',
name: '(%)',
axisTick: {
show: false,
},
axisLine: {
lineStyle: {
color: '#57617B',
},
},
axisLabel: {
margin: 10,
textStyle: {
fontSize: 14,
},
},
splitLine: {
lineStyle: {
color: '#57617B',
},
},
}],
series: [{
name: '设备数量',
type: 'line',
smooth: true,
symbol: 'circle',
symbolSize: 5,
showSymbol: false,
lineStyle: {
normal: {
width: 1,
},
},
areaStyle: {
normal: {
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
offset: 0,
color: 'rgba(0, 136, 212, 0.3)',
}, {
offset: 0.8,
color: 'rgba(0, 136, 212, 0)',
}], false),
shadowColor: 'rgba(0, 0, 0, 0.1)',
shadowBlur: 10,
},
},
itemStyle: {
normal: {
color: 'rgb(0,136,212)',
borderColor: 'rgba(0,136,212,0.2)',
borderWidth: 12,
},
},
data: this.userdevicecount,
}, {
name: '报警数量',
type: 'line',
smooth: true,
symbol: 'circle',
symbolSize: 5,
showSymbol: false,
lineStyle: {
normal: {
width: 1,
},
},
areaStyle: {
normal: {
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
offset: 0,
color: 'rgba(219, 50, 51, 0.3)',
}, {
offset: 0.8,
color: 'rgba(219, 50, 51, 0)',
}], false),
shadowColor: 'rgba(0, 0, 0, 0.1)',
shadowBlur: 10,
},
},
itemStyle: {
normal: {
color: 'rgb(219,50,51)',
borderColor: 'rgba(219,50,51,0.2)',
borderWidth: 12,
},
},
data: this.userdevicepolice,
}],
});
},
UserStatistics() {
userdevicemonthcount()
.then(response => {
if (response.code === 200) {
this.userdevicecount = response.data.devicedata;
this.userdevicepolice = response.data.devicepolice;
this.initChart();
}
})
.catch(err => {
console.log(err);
});
},
},
};
</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
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1599788886331" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2341" data-spm-anchor-id="a313x.7781069.0.i3" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><defs><style type="text/css"></style></defs><path d="M834.1 469.2c-19.5-43.8-47.4-82.6-82.9-115.2l-29.1-26.7c-4.3-3.8-11.1-2.1-13 3.3l-13 37.3c-8.1 23.4-23 47.3-44.1 70.8-1.4 1.5-3 1.9-4.1 2-1.1 0.1-2.8-0.1-4.3-1.5-1.4-1.2-2.1-3-2-4.8 3.7-60.2-14.3-128.1-53.7-202C555.3 171 510 123.1 453.4 89.7l-41.3-24.3c-5.4-3.2-12.3 1-12 7.3l2.2 48c1.5 32.8-2.3 61.8-11.3 85.9-11 29.5-26.8 56.9-47 81.5-14.2 17.2-30.1 32.7-47.5 46.1-42.1 32.3-76.8 74.4-100.3 121.5C172.5 503.3 160 556.6 160 610c0 47.2 9.3 92.9 27.7 136 17.8 41.5 43.2 78.9 75.5 110.9 32.4 32 70 57.2 111.9 74.7C418.5 949.8 464.5 959 512 959s93.5-9.2 136.9-27.3c41.9-17.5 79.6-42.6 111.9-74.7 32.4-32 57.8-69.4 75.5-110.9 18.4-43.1 27.7-88.8 27.7-136 0-48.8-10-96.2-29.9-140.9zM713 808.5c-53.7 53.2-125 82.4-201 82.4s-147.3-29.2-201-82.4c-53.5-53.1-83-123.5-83-198.4 0-43.5 9.8-85.2 29.1-124 18.8-37.9 46.8-71.8 80.8-97.9 21.5-16.4 41.2-35.5 58.6-56.8 25-30.5 44.6-64.5 58.2-101 5.4-14.5 9.5-30 12.1-46.5 24.1 22.2 44.3 49 61.2 80.4 33.4 62.6 48.8 118.3 45.8 165.7-1.4 22.8 7.5 44.5 24.4 59.8 14.7 13.2 33.7 19.9 53.4 18.8 19.7-1 37.8-9.7 51-24.4 13.3-14.9 24.8-30.1 34.4-45.6 14 17.9 25.7 37.4 35 58.4 15.9 35.8 24 73.9 24 113.1 0 74.9-29.5 145.4-83 198.4zM512 825c22.091 0 40-17.909 40-40s-17.909-40-40-40-40 17.909-40 40 17.909 40 40 40z" fill="#ffffff" p-id="2342"></path></svg>
\ No newline at end of file
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
......@@ -8,57 +8,51 @@
<el-row :gutter="20">
<el-col :span="6"><el-card shadow="always">用户数量<span style="margin-left: 12px;color: #606266;">{{ synthesizecount.usercount }}</span></el-card></el-col>
<el-col :span="6"><el-card shadow="always">设备数量<span style="margin-left: 12px;color: #409EFF;">{{ synthesizecount.devicecount }}</span></el-card></el-col>
<el-col :span="6"><el-card shadow="always">在线设备<span style="margin-left: 12px;color: green;">{{ synthesizecount.device_online }}</span></el-card></el-col>
<el-col :span="6"><el-card shadow="always">报警数量<span style="margin-left: 12px;color: #e50015;">{{ synthesizecount.device_alarm }}</span></el-card></el-col>
<el-col :span="6"><el-card shadow="always">未报警数量<span style="margin-left: 12px;color: green;">{{ synthesizecount.device_normal }}</span></el-card></el-col>
<el-col :span="6"><el-card shadow="always">设备故障<span style="margin-left: 12px;color: #5d5f5f;">{{ synthesizecount.device_offline }}</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-row>
<el-row :align="'middle'">
<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>
<!-- 混合统计 -->
<el-card class="box-card" style="margin-top:12px;padding-bottom:24px">
<div class="chart-container" style="position: relative; top: 2px; height: 560px;">
<chart height="100%" width="100%" />
</div>
</el-card>
<!-- 统计 -->
<el-card class="box-card" style="margin-top:12px;height: 200px;">
<el-col :span="4" style="text-align: center;">
<el-progress type="dashboard" :percentage="synthesizecount.percent_alarm" color="red"></el-progress>
<el-tooltip class="item" effect="red" :content="synthesizecount.percent_alarm + '%'" placement="top-start">
<p>当前报警率</p>
</el-tooltip>
</el-col>
<el-col :span="4" style="text-align: center;">
<el-progress type="dashboard" :percentage="synthesizecount.percent_online" color="green"></el-progress>
<el-tooltip class="item" effect="green" :content="synthesizecount.percent_online + '%'" placement="top-start">
<p>设备在线率</p>
</el-tooltip>
</el-col>
<el-col :span="4" style="text-align: center;">
<div style="display: inline-block;">
<el-progress type="dashboard" :percentage="memory" :color="colors"></el-progress>
<el-tooltip class="item" effect="dark" :content="memory + 'MB'" placement="top-start">
<p>项目运行速度</p>
<span style="position: relative;left: -115px;top: 12px;">项目运行速度</span>
</el-tooltip>
</el-col>
<el-col :span="4" style="text-align: center;">
</div>
<div style="display: inline-block;">
<el-progress type="dashboard" :percentage="base_path" :color="colors"></el-progress>
<el-tooltip class="item" effect="dark" :content="base_path * 10 + 'MB'" placement="top-start">
<p>项目容量</p>
<span style="position: relative;left: -108px;top: 12px;">项目容量</span>
</el-tooltip>
</el-col>
<el-col :span="4" style="text-align: center;">
</div>
<div style="display: inline-block;">
<el-progress type="dashboard" :percentage="end_time" :color="colors"></el-progress>
<el-tooltip class="item" effect="dark" :content="end_time + 'S'" placement="top-start">
<p>访问接口速度</p>
<span style="position: relative;left: -112px;top: 12px;">访问接口速度</span>
</el-tooltip>
</el-col>
<el-col :span="4" style="text-align: center;">
</div>
<div style="display: inline-block; position: relative;left: -36px;">
<el-progress type="dashboard" :percentage="databas" :color="colors"></el-progress>
<el-tooltip class="item" effect="dark" :content="databas + 'S'" placement="top-start">
<p>访问数据库速度</p>
<span style="position: relative;left: -122px;top: 12px;">访问数据库速度</span>
</el-tooltip>
</el-col>
</el-card>
</el-row>
</div>
<!-- 混合统计 -->
<el-card class="box-card" style="margin-top:12px;padding-bottom:24px">
<div class="chart-container" style="position: relative; top: 2px; height: 560px;">
<chart height="100%" width="100%" />
<div style="display: inline-block;position: relative;right: -808px;bottom: 127px;">
<el-progress type="dashboard" :percentage="rand" :color="colors"></el-progress>
<el-tooltip class="item" effect="dark" :content="rand + 'MB'" placement="top-start">
<span style="position: relative;left: -112px;top: 12px;">进程占用情况</span>
</el-tooltip>
</div>
</el-card>
</el-col>
......
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 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>
<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">
<template slot-scope="scope">
<span @click="handleCopy(scope.row.devicenumber,$event)">{{ scope.row.devicenumber }}</span>
......@@ -59,7 +67,7 @@
</template>
<script>
import { police } from '@/api/device';
import { police, history_device_type } from '@/api/device';
import clip from '@/utils/clipboard';
import BackToTop from '@/components/BackToTop';
export default {
......@@ -77,10 +85,17 @@ export default {
'line-height': '45px', // Please keep consistent with height to center vertically
background: '#e7eaf1', // The background color of the button
},
devicetime: '', // 时间
devicehtime: '', // 年月
device_type: '', // 搜索数据设备报警类型
device_quyu: '', // 设备区域
data_device_type: '', // 设备数据
data_device_quyu: '', // 设备区域
};
},
created() {
this.police(); // 列表
this.historydevicetype(); // 设备搜索所需数据
},
methods: {
shutoffStatus(id) {
......@@ -106,9 +121,26 @@ export default {
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) {
clip(text, event);
},
deviceonut() {
console.log(this.devicetime);
console.log(this.devicehtime);
console.log(this.device_type);
},
},
};
</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
......@@ -47,17 +47,7 @@
</el-table-column>
<el-table-column align="center" label="用户地址" width="340">
<template slot-scope="scope">
<span>{{ scope.row.province }}<br>{{ scope.row.area }}<br>{{ scope.row.city }}</span>
</template>
</el-table-column>
<el-table-column align="center" label="手机号">
<template slot-scope="scope">
<span>{{ scope.row.phone_number }}</span>
</template>
</el-table-column>
<el-table-column align="center" label="角色">
<template slot-scope="scope">
<span>{{ scope.row.role_name }}</span>
<span>{{ scope.row.province }}-{{ scope.row.area }}-{{ scope.row.city }}</span>
</template>
</el-table-column>
<el-table-column align="center" label="创建时间" width="170">
......@@ -88,6 +78,22 @@
<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-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-input v-model.number="upUserData.username"></el-input>
</el-form-item>
......@@ -97,14 +103,6 @@
<el-form-item label="邮箱" prop="email">
<el-input v-model.number="upUserData.email"></el-input>
</el-form-item>
<el-form-item label="手机号" prop="phone_number">
<el-input v-model.number="upUserData.phone_number"></el-input>
</el-form-item>
<el-form-item label="角色" prop="user_role">
<el-select v-model="upUserData.user_role_id" clearable class="filter-item" @change="selectOne">
<el-option v-for="item in user_roles" :key="item.id" :label="item.name" :value="item.id" />
</el-select>
</el-form-item>
<el-form-item label="自定义标题" prop="title">
<el-input v-model.number="upUserData.title"></el-input>
</el-form-item>
......@@ -115,6 +113,9 @@
<el-button type="primary" @click="submitForm()">提交</el-button>
<el-button @click="resetForm()">重置</el-button>
</el-form-item>
<el-dialog :visible.sync="dialogVisible">
<img width="100%" :src="dialogImageUrl" alt="">
</el-dialog>
</el-form>
</el-dialog>
</div>
......@@ -151,16 +152,12 @@ export default {
email: undefined,
company: undefined,
userid: undefined,
phone_number: undefined,
user_role_id: undefined,
},
paper: undefined,
user_roles: [
{ id: 1, name: '行业主管部门负责人' },
{ id: 2, name: '燃气用户' },
{ id: 3, name: '应急抢修人员' },
{ id: 4, name: '村内“两员”' },
],
dialogImageUrl: '', // 图片地址
dialogVisible: false,
disabled: false,
userimgdisabled: false, // 用户上传图片
};
},
created() {
......@@ -306,7 +303,6 @@ export default {
type: 'warning',
});
} else {
console.log(response.data);
for (const key in this.upUserData) {
for (const k in response.data) {
if (key === k) {
......@@ -355,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>
......
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
......@@ -58,7 +58,7 @@ 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('userimgdetele/userimgdetele','UploadimgController@userimgdetele');//删除图片
Route::match(['get','post'],'updateimg/updateimg','UploadimgController@updateimg');//更新图片信息,返回逻辑图片列表
......@@ -113,6 +113,8 @@ Route::group(['middleware'=>'auth:api'],function (){
Route::get('devices/device_info/{id}','DevicesController@device_info');//返回设备地图详情信息
Route::get('devices/devicepolice','DevicesController@devicepolice');//设备消警
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::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