Commit dda57577 authored by Administrator's avatar Administrator

Merge branch 'feature/alarm_order_vue' into develop

parents 9d295b8e 756f51d4
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
...@@ -26,3 +26,4 @@ composer.lock ...@@ -26,3 +26,4 @@ composer.lock
/resources/js/api/configurl.js /resources/js/api/configurl.js
devicelistdata.text devicelistdata.text
cert/test cert/test
mix-manifest.json
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 ...@@ -58,6 +58,7 @@ 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, 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进程数
......
...@@ -57,7 +57,7 @@ class chemicalswb extends Command ...@@ -57,7 +57,7 @@ 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, SWOOLE_SOCK_TCP | SWOOLE_SSL); //创建一个端口
$this->ws->set(array( $this->ws->set(array(
'reactor_num' => 2, //reactor线程数 'reactor_num' => 2, //reactor线程数
'worker_num' => 4, //worker进程数 'worker_num' => 4, //worker进程数
......
...@@ -57,7 +57,7 @@ class firewb extends Command ...@@ -57,7 +57,7 @@ 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, SWOOLE_SOCK_TCP | SWOOLE_SSL); //创建一个端口
$this->ws->set(array( $this->ws->set(array(
'reactor_num' => 2, //reactor线程数 'reactor_num' => 2, //reactor线程数
'worker_num' => 4, //worker进程数 'worker_num' => 4, //worker进程数
......
...@@ -57,7 +57,7 @@ class swoole extends Command ...@@ -57,7 +57,7 @@ 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, SWOOLE_PROCESS, SWOOLE_SOCK_TCP | SWOOLE_SSL); //创建一个端口
$this->ws->set(array( $this->ws->set(array(
'reactor_num' => 2, //reactor线程数 'reactor_num' => 2, //reactor线程数
'worker_num' => 4, //worker进程数 'worker_num' => 4, //worker进程数
...@@ -89,7 +89,6 @@ class swoole extends Command ...@@ -89,7 +89,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();
} }
} }
...@@ -5,6 +5,7 @@ namespace App\Console\Commands; ...@@ -5,6 +5,7 @@ namespace App\Console\Commands;
use App\Http\Controllers\Auth\SwooleCommandMeTcpController; use App\Http\Controllers\Auth\SwooleCommandMeTcpController;
use Illuminate\Support\Facades\Log; use Illuminate\Support\Facades\Log;
use Illuminate\Console\Command; use Illuminate\Console\Command;
use App\Http\Controllers\Auth\ZehongTcpController;
class swooleMeTcp extends Command class swooleMeTcp extends Command
{ {
public $tcp; public $tcp;
...@@ -55,14 +56,9 @@ class swooleMeTcp extends Command ...@@ -55,14 +56,9 @@ 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', 9503,SWOOLE_PROCESS);
//// $this->tcp->addlistener('0.0.0.0', 9504, 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_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_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->set([ $this->tcp->set([
'worker_num' => 2,//设置启动的 Worker 进程数 'worker_num' => 2,//设置启动的 Worker 进程数
'max_request' =>30,//最大任务数 'max_request' =>30,//最大任务数
...@@ -71,8 +67,6 @@ class swooleMeTcp extends Command ...@@ -71,8 +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() . config('app.ssl_cert_file'),
// 'ssl_key_file' => base_path() . config('app.ssl_key_file'),
]); ]);
//监听连接进入事件 //监听连接进入事件
$this->tcp->on('Connect', function ($serv, $fd) { $this->tcp->on('Connect', function ($serv, $fd) {
...@@ -88,10 +82,16 @@ class swooleMeTcp extends Command ...@@ -88,10 +82,16 @@ class swooleMeTcp extends Command
$this->tcp->on('Receive', function ($serv, $fd, $from_id, $data) { $this->tcp->on('Receive', function ($serv, $fd, $from_id, $data) {
Log::channel('slack')->info($data); Log::channel('slack')->info($data);
//验证数据格式 //验证数据格式
if($this->formatData($data)){ // $serv->send($fd,$data);
$swooletcp = new SwooleCommandMeTcpController(); // if($this->formatData($data)){
$swooletcp->swooletcplist($data); // $swooletcp = new SwooleCommandMeTcpController();
} // $swooletcp->swooletcplist($data);
// }
$swooletcp = new ZehongTcpController();
// $swooletcp->swooletcplist($data);
$todata = $swooletcp->swooletcplist($data);
Log::channel('slack')->info('返回值' . $todata);
$serv->send($fd,$todata);
}); });
//监听连接关闭事件 //监听连接关闭事件
......
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', 9506, 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;
}
}
}
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
...@@ -8,6 +8,7 @@ use Illuminate\Http\Request; ...@@ -8,6 +8,7 @@ use Illuminate\Http\Request;
use App\Models\AlarmOrder; use App\Models\AlarmOrder;
use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\DB;
use App\Models\AlarmOrderSchedule; use App\Models\AlarmOrderSchedule;
use Illuminate\Support\Facades\Auth;
class AlarmOrderController extends Controller class AlarmOrderController extends Controller
{ {
...@@ -18,33 +19,87 @@ class AlarmOrderController extends Controller ...@@ -18,33 +19,87 @@ class AlarmOrderController extends Controller
*/ */
public function index(Request $request) public function index(Request $request)
{ {
if($this->isadmin()) { $where = [];
$limit = 20; $whereBetween = [0, date('Y-m-d H:i:s')];
$offset = $limit * ($request->input('page') - 1); $limit = 20;
$orders = AlarmOrder::selectRaw(' if($request->input('limit') > 0) {
$limit = $request->input('limit');
}
$offset = $limit * ($request->input('page') - 1);
if($request->input('isuser') == 'user'){
$where[] = ['u.id','=',Auth::id()];
print_r(explode(',',$request->input('userstate')));
}
if($request->input('order_num')) {
$where[] = ['alarm_order.order_num' , '=', $request->input('order_num')];
}
if($request->input('deviceNum')) {
$where[] = ['r.devicenumber' , '=', $request->input('deviceNum')];
}
if($request->input('state') != 99) {
$where[] = ['alarm_order.state' , '=', $request->input('state')];
}
if($request->input('user_id')) {
$where[] = ['alarm_order.user_id' , '=', $request->input('user_id')];
}
if($request->input('timeRange') != "null") {
$times = explode(',', $request->input('timeRange'));
$whereBetween = [$times[0], $times[1]];
}
$orders = AlarmOrder::selectRaw('
FROM_UNIXTIME(r.starttime) AS start_time, FROM_UNIXTIME(r.starttime) AS start_time,
FROM_UNIXTIME(r.endtime) AS end_time, FROM_UNIXTIME(r.endtime) AS end_time,
alarm_order.*, alarm_order.*,
r.devicenumber, r.concentration, r.location, r.policestatus, r.shutoff_status, r.devicenumber, r.concentration, r.location, r.policestatus, r.shutoff_status,
d.devicecoord, d.username, d.devicecoord, d.username,t.tname,
u.name, u.phone_number, u.name, u.phone_number,
s.status_name s.status_name
') ')
->leftjoin('reportpolice AS r', 'r.id', '=', 'alarm_order.reportpolice_id') ->leftjoin('reportpolice AS r', 'r.id', '=', 'alarm_order.reportpolice_id')
->leftjoin('device AS d', 'd.id', '=', 'alarm_order.device_id') ->leftjoin('device AS d', 'd.id', '=', 'alarm_order.device_id')
->leftjoin('users AS u', 'alarm_order.user_id', '=', 'u.id') ->leftjoin('users AS u', 'alarm_order.user_id', '=', 'u.id')
->leftjoin('status AS s', 's.id', '=', 'alarm_order.reportpolice_id') ->leftjoin('status AS s', 's.id', '=', 'alarm_order.reportpolice_id')
->offset($offset) ->leftjoin('device_type AS t', 'r.policestatus', '=', 't.tid')
->limit($limit) ->offset($offset)
->get()->toArray(); ->where($where)
return $this->jsonSuccessData($orders); ->whereBetween('alarm_order.created_at',$whereBetween)
}else{ ->limit($limit)
return $this->jsonErrorData(500, '没有权限,请联系管理员'); ->get()->toArray();
} $count = AlarmOrder::leftjoin('reportpolice AS r', 'r.id', '=', 'alarm_order.reportpolice_id')
->leftjoin('users AS u', 'alarm_order.user_id', '=', 'u.id')
->whereBetween('alarm_order.created_at',$whereBetween)
->where($where)
->count();
$meta = [
'count' => $count,
'current_page' => $request->input('page'),
'limit' => $limit
];
return $this->jsonSuccessData(compact('orders', 'meta'));
} }
public function userworklist(Request $request){
$orders = AlarmOrder::selectRaw('
FROM_UNIXTIME(r.starttime) AS start_time,
FROM_UNIXTIME(r.endtime) AS end_time,
alarm_order.*,
r.devicenumber, r.concentration, r.location, r.policestatus, r.shutoff_status,
d.devicecoord, d.username,t.tname,
u.name, u.phone_number,
s.status_name
')
->leftjoin('reportpolice AS r', 'r.id', '=', 'alarm_order.reportpolice_id')
->leftjoin('device AS d', 'd.id', '=', 'alarm_order.device_id')
->leftjoin('users AS u', 'alarm_order.user_id', '=', 'u.id')
->leftjoin('status AS s', 's.id', '=', 'alarm_order.reportpolice_id')
->leftjoin('device_type AS t', 'r.policestatus', '=', 't.tid')
->whereIn('alarm_order.state',explode(',',$request->input('userstate')))
->where('u.id','=',Auth::id())
->get()->toArray();
return $this->jsonSuccessData($orders);
}
/** /**
* Store a newly created resource in storage. * Store a newly created resource in storage.
* *
...@@ -61,10 +116,18 @@ class AlarmOrderController extends Controller ...@@ -61,10 +116,18 @@ class AlarmOrderController extends Controller
DB::beginTransaction(); DB::beginTransaction();
try { try {
// 获取device_id
$device = DB::table('device')
->select('id')
->where('devicenum', $request->input('device_num'))
->first();
if(!$device) {
return $this->jsonErrorData(500, '设备编号不存在!');
}
$order = new AlarmOrder(); $order = new AlarmOrder();
$insertId = $order->insertGetId([ $insertId = $order->insertGetId([
'order_num' => $orderNum, 'order_num' => $orderNum,
'device_id' => $request->input('device_id'), 'device_id' => $device->id,
'user_id' => $request->input('user_id'), 'user_id' => $request->input('user_id'),
'reportpolice_id' => $reportpolice_id, 'reportpolice_id' => $reportpolice_id,
'created_at' => Carbon::now(), 'created_at' => Carbon::now(),
...@@ -79,13 +142,13 @@ class AlarmOrderController extends Controller ...@@ -79,13 +142,13 @@ class AlarmOrderController extends Controller
DB::commit(); DB::commit();
} catch (QueryException $exception) { } catch (QueryException $exception) {
DB::rollBack(); DB::rollBack();
return $this->jsonErrorData('工单创建失败'); return $this->jsonErrorData(500,'工单创建失败');
} }
if($insertId) { if($insertId) {
return $this->jsonSuccessData('已生成工单!'); return $this->jsonSuccessData('已生成工单!');
}else{ }else{
return $this->jsonErrorData('工单创建失败'); return $this->jsonErrorData(500, '工单创建失败');
} }
} }
...@@ -95,13 +158,35 @@ class AlarmOrderController extends Controller ...@@ -95,13 +158,35 @@ class AlarmOrderController extends Controller
* @param int $id * @param int $id
* @return \Illuminate\Http\Response * @return \Illuminate\Http\Response
*/ */
public function show($id) public function show(Request $request)
{ {
$order = AlarmOrder::select('*')
->join('reportpolice AS r', 'r.id', '=', 'alarm_order.reportpolice_id') $order = AlarmOrder::leftjoin('reportpolice AS r', 'r.id', '=', 'alarm_order.reportpolice_id')
->where('alarm_order.id', '=', $id) ->leftjoin('device AS d', 'd.id', '=', 'alarm_order.device_id')
->get(); ->leftjoin('users AS u', 'alarm_order.user_id', '=', 'u.id')
$this->jsonSuccessData($order); ->leftjoin('status AS s', 's.id', '=', 'alarm_order.reportpolice_id')
->leftjoin('device_type AS t', 'r.policestatus', '=', 't.tid')
->leftjoin('gas AS g', 'd.status', '=', 'g.id')
->leftjoin('danwei AS w', 'd.devicemonad', '=', 'w.id')
->where('alarm_order.id', '=', $request->input('id'))
->selectRaw('
FROM_UNIXTIME(r.starttime) AS start_time,
FROM_UNIXTIME(r.endtime) AS end_time,
alarm_order.*,
r.devicenumber, r.concentration, r.location, r.policestatus, r.shutoff_status,
d.devicecoord, d.username,t.tname,d.deviceinfo,g.gas,w.danwei,
u.name, u.phone_number,
s.status_name
')
->first();
// 工单进度
$order['step'] = AlarmOrderSchedule::where('alarm_order_id', '=', $request->input('id'))->get();
// 图片
$order['images'] = DB::table('userimage')
->select('path')
->where('alarm_order_id', $request->input('id'))
->get()->toArray();
return $this->jsonSuccessData($order);
} }
/** /**
...@@ -111,18 +196,17 @@ class AlarmOrderController extends Controller ...@@ -111,18 +196,17 @@ class AlarmOrderController extends Controller
* @param int $id * @param int $id
* @return \Illuminate\Http\Response * @return \Illuminate\Http\Response
*/ */
public function update(Request $request, $id) public function update(Request $request)
{ {
$data = $request->all(); $data = $request->all();
if(isset($data['schedule'])) { if(isset($data['schedule'])) {
DB::beginTransaction(); DB::beginTransaction();
try { try {
AlarmOrderSchedule::insert(array_merge( AlarmOrderSchedule::insert(array_merge(
$data['schedule'], json_decode($data['schedule'],true),
['created_at' => Carbon::now(), 'alarm_order_id' => $id])); ['created_at' => Carbon::now(), 'alarm_order_id' => $data['id']]));
unset($data['schedule']); unset($data['schedule']);
$order = AlarmOrder::where('id', $id) $order = AlarmOrder::where('id', $data['id'])
->update(array_merge($data, ['updated_at' => Carbon::now()])); ->update(array_merge($data, ['updated_at' => Carbon::now()]));
DB::commit(); DB::commit();
} catch (QueryException $exception) { } catch (QueryException $exception) {
...@@ -131,7 +215,7 @@ class AlarmOrderController extends Controller ...@@ -131,7 +215,7 @@ class AlarmOrderController extends Controller
} }
}else{ }else{
$order = AlarmOrder::where('id', $id) $order = AlarmOrder::where('id', $data['id'])
->update(array_merge($data, ['updated_at' => Carbon::now()])); ->update(array_merge($data, ['updated_at' => Carbon::now()]));
} }
if($order) { if($order) {
...@@ -156,4 +240,31 @@ class AlarmOrderController extends Controller ...@@ -156,4 +240,31 @@ class AlarmOrderController extends Controller
return $this->jsonErrorData(500, '删除工单失败!'); return $this->jsonErrorData(500, '删除工单失败!');
} }
} }
/**
* 获取派单用户
*/
public function getUserInfo()
{
if ($this->isadmin()) {
$users = DB::table('users')
->select('users.id', 'users.name', 'users.username', 'users.phone_number', 'ur.name AS role_name', 'ap.area_name AS province', 'aa.area_name AS area', 'ac.area_name AS city')
->leftJoin('user_roles AS ur', 'ur.id', '=', 'users.user_role_id')
->leftJoin('areachina AS ap', 'ap.areaid', '=', 'users.provinceid')
->leftJoin('areachina AS aa', 'aa.areaid', '=', 'users.areaid')
->leftJoin('areachina AS ac', 'ac.areaid', '=', 'users.cityid')
->where('users.user_role_id', '!=', 0)
->get()->toArray();
return $this->jsonSuccessData($users);
} else {
return $this->jsonErrorData(500, '没有权限, 请联系管理员!');
}
}
//获取当前订单为第几步
public function orderin(Request $request){
$orderid = $request->input('id');
$status = AlarmOrder::where('id','=',$orderid)->select('isorderone','id')->first();
return $this->jsonSuccessData($status);
}
} }
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 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);
// return $this->jsonSuccessData([$this->getPrc($isdata),$devicecrc]);
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 == "No equipment"){
return $totcp;
}
$totcpdata = $totcp['devicenum'] . $totcp['device_control'] . $devicechongqi . $devicezijian;
$crcdata = $this->getPrc($totcpdata);
return $totcpdata .$crcdata ;
}
} else {
return "Data format error";
}
}
//解出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']),'devicepolice'=>$data['status'] == 0 ? '1' : $data['status'],'update_time'=>time(),'shutoff_status'=>$data['famen']]);
$todata = DB::table('device')
->where('devicenum','=',$data['id'])
->select('devicenum','nd','device_control','devicepolice')
->first();
if ($todata){
return json_encode($todata);
}else{
return json_encode("No equipment");
}
}
}
}
\ 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 ...@@ -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,23 +21,42 @@ use Validator; ...@@ -21,23 +21,42 @@ use Validator;
class HomepageController extends Controller class HomepageController extends Controller
{ {
//返回用户数量 设备数量, 报警数量 , //返回用户数量 设备数量, 报警数量 ,
public function homepagecount() public function homepagecount(Request $request)
{ {
$type = $request->input('isuser');
if ($type == 'user') {
$usercount = Users::count(); $usercount = Users::count();
$devicecount = Device::count(); $devicecount = Device::where('uid','=',Auth::id())->count();
$devicepolice = Device::where('devicepolice', '>', '1')->count(); $devicepolice = Device::where('uid','=',Auth::id())->where('devicepolice', '>', '1')->count();
// 设备在线数量 // 设备在线数量
$device_online = Device::whereNotIn('devicepolice', [9, 15])->count(); $device_online = Device::where('uid','=',Auth::id())->whereNotIn('devicepolice', [9, 15])->count();
// 设备报警数量 // 设备报警数量
$device_alarm = Device::whereIn('devicepolice', [4, 5, 6, 16])->count(); $device_alarm = Device::where('uid','=',Auth::id())->whereIn('devicepolice', [4, 5, 6, 16])->count();
// 未报警设备数量 // 未报警设备数量
$device_normal = Device::where('devicepolice', 1)->count(); $device_normal = Device::where('uid','=',Auth::id())->where('devicepolice', 1)->count();
// 故障设备 // 故障设备
$device_offline = Device::whereNotIn('devicepolice', [1, 4, 5, 6, 16])->count(); $device_offline = Device::where('uid','=',Auth::id())->whereNotIn('devicepolice', [1, 4, 5, 6, 16])->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')->where('status', '=', '1')->whereBetween('starttime', [$start, $end])->count(); $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();
// 设备在线数量
$device_online = Device::whereNotIn('devicepolice', [9, 15])->count();
// 设备报警数量
$device_alarm = Device::whereIn('devicepolice', [4, 5, 6, 16])->count();
// 未报警设备数量
$device_normal = Device::where('devicepolice', 1)->count();
// 故障设备
$device_offline = Device::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();
}
return $this->jsonSuccessData([ return $this->jsonSuccessData([
'usercount' => $usercount, 'usercount' => $usercount,
'devicecount' => $devicecount, 'devicecount' => $devicecount,
...@@ -58,39 +77,62 @@ class HomepageController extends Controller ...@@ -58,39 +77,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();
...@@ -103,12 +145,12 @@ class HomepageController extends Controller ...@@ -103,12 +145,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')
...@@ -128,7 +170,7 @@ class HomepageController extends Controller ...@@ -128,7 +170,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
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddAlarmOrderIdToUserimageTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('userimage', function (Blueprint $table) {
$table->integer('alarm_order_id')->default(0)->comment('报警工单ID');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('userimage', function (Blueprint $table) {
$table->dropColumn('alarm_order_id');
});
}
}
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
{
"/js/app.js": "/js/app.js",
"/css/app.css": "/css/app.css",
"/js/manifest.js": "/js/manifest.js",
"/js/vendor.js": "/js/vendor.js"
}
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
import request from '@/utils/request';
// 列表
export function alarmOrderList(data) {
var params = Object.keys(data).map(function(key) {
return encodeURIComponent(key) + '=' + encodeURIComponent(data[key]);
}).join('&');
return request({
url: '/alarm_order?' + params,
method: 'get',
});
}
// 新增
export function alarmOrderStore(data) {
return request({
url: '/alarm_order',
method: 'post',
data: data,
});
}
// 更新
export function alarmOrderUpdate(data, id) {
return request({
url: '/alarm_order/order_ok?id=' + id,
method: 'post',
data,
});
}
// 删除
export function alarmOrderDestroy(id) {
return request({
url: '/alarm_order/' + id,
method: 'delete',
});
}
// 派单人员列表
export function alarmOrderUsers() {
return request({
url: '/alarm_order/user',
method: 'get',
});
}
// 工单详情
export function alarmOrderDetail(id) {
return request({
url: '/alarm_order/show?id=' + id,
method: 'get',
});
}
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 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
<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
...@@ -25,6 +25,7 @@ import usersRoutes from './modules/users'; ...@@ -25,6 +25,7 @@ import usersRoutes from './modules/users';
import historyRoutes from './modules/history.js'; import historyRoutes from './modules/history.js';
import monitorRoutes from './modules/monitor.js'; import monitorRoutes from './modules/monitor.js';
import userdeviceRoutes from './modules/userdevice'; import userdeviceRoutes from './modules/userdevice';
import alarmOrderRoutes from './modules/alarm-order';
/** /**
* Sub-menu only appear when children.length>=1 * Sub-menu only appear when children.length>=1
...@@ -155,6 +156,7 @@ export const asyncRoutes = [ ...@@ -155,6 +156,7 @@ export const asyncRoutes = [
usersRoutes, usersRoutes,
adminRoutes, adminRoutes,
userdeviceRoutes, userdeviceRoutes,
alarmOrderRoutes,
// { // {
// path: '/userdevice', // path: '/userdevice',
// component: Layout, // component: Layout,
......
File mode changed from 100644 to 100755
import Layout from '@/layout';
const alarmOrderRoutes = {
path: '/alarm-order',
component: Layout,
redirect: '/alarm-order/index',
name: 'users',
alwaysShow: true,
meta: {
title: '工单管理',
icon: 'nested',
permissions: ['view menu admin'],
},
children: [
{
path: 'index',
component: () => import('@/views/alarm-order/index'),
name: 'AlarmOrder',
meta: { title: '抢险工单', icon: 'nested', permissions: ['manage admin'] },
},
],
};
export default alarmOrderRoutes;
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
import Layout from '@/layout'; import Layout from '@/layout';
// //
const elementUiRoutes = { const elementUiRoutes = {
path: '/element-ui', path: '/element-ui',
component: Layout, component: Layout,
......
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 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">
<div class="filter-container">
<el-form :inline="true" :model="formSearch" class="demo-form-inline">
<el-form-item label="接单人员">
<el-select
v-model="formSearch.user_id"
style="margin-left: 20px;"
placeholder="请选择"
>
<el-option
v-for="(item, i) in alarmOrderUsersData"
:key="i + '1u'"
:label="item.name"
:value="item.id"
>
</el-option>
</el-select>
</el-form-item>
<el-form-item label="工单号">
<el-input v-model="formSearch.order_num" placeholder="输入工单号"></el-input>
</el-form-item>
<el-form-item label="设备编号">
<el-input v-model="formSearch.deviceNum" placeholder="输入完整设备编号"></el-input>
</el-form-item>
<el-form-item label="工单状态">
<el-select
v-model="formSearch.state"
style="margin-left: 20px;"
placeholder="请选择"
>
<el-option
v-for="(item,ind) in optionStatus"
:key="ind + '2s'"
:label="item.label"
:value="item.value"
>
</el-option>
</el-select>
</el-form-item>
<el-form-item label="时间">
<el-date-picker
v-model="formSearch.timeRange"
align="right"
type="datetimerange"
:picker-options="pickerOptions"
range-separator="至"
value-format="yyyy-MM-dd HH:mm:ss"
start-placeholder="开始日期"
end-placeholder="结束日期"
></el-date-picker>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="onSubmit">查询</el-button>
</el-form-item>
</el-form>
</div>
<el-pagination
:current-page="formSearch.page"
:page-sizes="[20, 80, 150, 300, 5]"
:page-size="formSearch.limit"
layout="total, sizes, prev, pager, next, jumper"
:total="formSearch.total"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
>
</el-pagination>
<el-table :key="tableKey" :data="alarmOrders" border fit highlight-current-rows>
<el-table-column label="工单号" width="209">
<template slot-scope="scope">
<span @click="handleCopy(scope.row.order_num,$event)">{{ scope.row.order_num }}</span>
</template>
</el-table-column>
<el-table-column label="设备编号" width="209">
<template slot-scope="scope">
<span @click="handleCopy(scope.row.devicenumber,$event)">{{ scope.row.devicenumber }}</span>
</template>
</el-table-column>
<el-table-column label="接单人" width="140">
<template slot-scope="scope">
<span>{{ scope.row.name }}</span>
</template>
</el-table-column>
<el-table-column label="设备名称" width="200">
<template slot-scope="scope">
<span>{{ scope.row.username }}</span>
</template>
</el-table-column>
<el-table-column label="位置" width="200">
<template slot-scope="scope">
<span>{{ scope.row.location }}</span>
</template>
</el-table-column>
<el-table-column label="报警类型" width="130">
<template slot-scope="scope">
<span>{{ scope.row.status_name }}</span>
</template>
</el-table-column>
<el-table-column label="工单状态" width="130">
<template slot-scope="scope">
<span>
<el-tag :type="orderStateFilter(scope.row.state, 'type')" effect="dark">{{ orderStateFilter(scope.row.state, 'content') }}</el-tag>
</span>
</template>
</el-table-column>
<el-table-column label="创建时间">
<template slot-scope="scope">
<span>{{ scope.row.created_at }}</span>
</template>
</el-table-column>
<el-table-column label="更新时间">
<template slot-scope="scope">
<span>{{ scope.row.updated_at }}</span>
</template>
</el-table-column>
<el-table-column label="--">
<template slot-scope="scope">
<el-button @click="alarmShow(scope.row)">详细信息</el-button>
</template>
</el-table-column>
</el-table>
<el-tooltip placement="top" content="tooltip">
<back-to-top :custom-style="myBackToTopStyle" :visibility-height="300" :back-position="50" transition-name="fade" />
</el-tooltip>
<el-dialog title="工单详细信息" :visible.sync="dialogTableVisible" width="70%">
<el-steps :active="order_content.isorderone" align-center style="margin-bottom: 40px;">
<el-step v-for="(item, oindex) in order_step" :key="oindex + '1o'" :title="stepFilter(item.schedule)" :description="item.created_at + item.content"></el-step>
</el-steps>
<el-row :gutter="20">
<el-col :span="8">
<div class="amap-page-container" style="height: 350px; width: 350px;">
<el-amap
ref="map"
vid="amapDemo"
:amap-manager="amapManager"
:zoom="zoom"
:center="center"
:events="events"
class="amap-demo"
:plugin="plugin"
>
<el-amap-circle-marker
:visible="true"
:center="marker.devicecoord | deviceLocationFilter(marker.devicecoord)"
:radius="13"
:fill-color="marker.devicepolice | deviceStatusFilter('color')"
:fill-opacity="1"
:stroke-color="'#ccc'"
:stroke-opacity="0.9"
></el-amap-circle-marker>
</el-amap>
</div>
</el-col>
<el-col :span="16">
<el-row>
<el-col :span="12">
<el-form size="mini">
<el-form-item label="设备编号">{{ order_content.devicenumber }}</el-form-item>
<el-form-item label="设备名称">{{ order_content.username }}</el-form-item>
<el-form-item label="类型">{{ order_content.tname }}</el-form-item>
<el-form-item label="检测介质">{{ order_content.gas }}</el-form-item>
<el-form-item label="位置">{{ order_content.deviceinfo }}</el-form-item>
<el-form-item label="坐标">{{ order_content.devicecoord }}</el-form-item>
<el-form-item label="检测值">{{ order_content.concentration + order_content.danwei }}</el-form-item>
<el-form-item label="报警类型">{{ order_content.status_name }}</el-form-item>
<el-form-item label="报警开始时间">{{ order_content.start_time }}</el-form-item>
<el-form-item label="报警结束时间">{{ order_content.end_time }}</el-form-item>
</el-form>
</el-col>
<el-col :span="12">
<el-form size="mini">
<el-form-item label="订单编号">{{ order_content.order_num }}</el-form-item>
<el-form-item label="订单创建时间">{{ order_content.created_at }}</el-form-item>
<el-form-item label="订单更新时间">{{ order_content.updated_at }}</el-form-item>
<el-form-item label="接单人">{{ order_content.name }}</el-form-item>
<el-form-item label="联系电话">{{ order_content.phone_number }}</el-form-item>
<el-form-item label="是否到达现场">{{ isLiveFilter(order_content.is_live) }}</el-form-item>
<el-form-item label="是否属实">{{ isVerifiedFilter(order_content.is_verified) }}</el-form-item>
<el-form-item label="进度">{{ isOrderOneFilter(order_content.isorderone) }}</el-form-item>
<el-form-item label="反馈内容">{{ order_content.content }}</el-form-item>
<el-form-item size="large">
<el-button type="primary" :disabled="order_content.isorderone < 4 || order_content.state === 2 ? true : false" @click="onSubmitDetail(order_content.id)">确认</el-button>
</el-form-item>
</el-form>
</el-col>
</el-row>
<div class="demo-image">
<el-image
v-for="(item, index) in order_content.images"
:key="index + '1m'"
style="width: 100px; height: 100px; margin-right: 10px;"
:src="item.path"
:preview-src-list="order_content.srcList"
>
</el-image>
</div>
</el-col>
</el-row>
</el-dialog>
</div>
</template>
<script>
import clip from '@/utils/clipboard';
import BackToTop from '@/components/BackToTop';
import { alarmOrderUsers, alarmOrderList, alarmOrderDetail, alarmOrderUpdate } from '@/api/alarmOrder';
import Vue from 'vue';
import VueAMap from 'vue-amap';
import { AMapManager } from 'vue-amap';
Vue.use(VueAMap);
// 初始化vue-amap
VueAMap.initAMapApiLoader({
// 高德的key
key: '95cc1b89d62f020ce5a21ec503daef6c',
// 插件集合
plugin: [
'AMap.Autocomplete',
'AMap.PlaceSearch',
'AMap.Scale',
'AMap.OverView',
'AMap.ToolBar',
'AMap.MapType',
'AMap.PolyEditor',
'AMap.CircleEditor',
],
// 高德 sdk 版本,默认为 1.4.4
v: '1.4.15',
uiVersion: '1.0.11',
});
export default {
components: { BackToTop },
filters: {
deviceLocationFilter(center) {
if (center === null) {
return '';
}
center = center.replace(/\s*/g, '');
return center.split(',');
},
deviceStatusFilter(status, cate) {
var statuses = [];
statuses[1] = { color: '#1c7a17', name: '正常' };
statuses[2] = { color: '#f6e032', name: '错误' };
statuses[3] = { color: '#f6e032', name: '传感器故障' };
statuses[4] = { color: '#f30016', name: '报警' };
statuses[5] = { color: '#f42f18', name: '低报' };
statuses[6] = { color: '#97000b', name: '高报' };
statuses[7] = { color: '#f6e032', name: '通信故障' };
statuses[8] = { color: '#f6e032', name: '超量程' };
statuses[9] = { color: '#747677', name: '离线' };
statuses[10] = { color: '#f6e032', name: '电量低' };
statuses[11] = { color: '#f6e032', name: '主电故障' };
statuses[12] = { color: '#f6e032', name: '备电故障' };
statuses[13] = { color: '#f6e032', name: '无此节点' };
statuses[14] = { color: '#f6e032', name: '低电压' };
statuses[15] = { color: '#f6e032', name: '故障' };
statuses[16] = { color: '#97000b', name: '报警联动' };
if (cate === 'color') {
return statuses[status].color;
} else if (cate === 'status') {
return statuses[status].name;
}
},
},
data() {
const _this = this;
return {
order_content: {},
order_step: [],
marker: {
devicecoord: '114.505208, 38.045474',
devicepolice: 5,
},
map: {},
amapManager: new AMapManager(),
zoom: 13,
center: [114.505208, 38.045474],
events: {
init: (o) => {
o.setMapStyle('amap://styles/normal');
// console.log(o.getCenter());
// console.log(this.$refs.map.$$getInstance());
o.getCity(result => {
// console.log(result);
});
},
'moveend': () => {
},
'zoomchange': () => {
_this.zoom = this.$refs.map.$$getInstance().getZoom();
},
'click': (e) => {
// alert('map clicked');
},
},
plugin: [{
pName: 'ToolBar',
position: 'LB',
}, {
pName: 'MapType',
defaultType: 0,
events: {
init(o) {
console.log(o);
},
},
}],
dialogTableVisible: false,
alarmOrders: [],
alarmOrderUsersData: [{
id: 0,
name: '全部',
}],
formSearch: {
order_num: '',
deviceNum: '',
state: 99,
timeRange: null,
page: 1,
limit: 20,
user_id: 0,
total: 0,
},
optionStatus: [{
value: 99,
label: '全部',
}, {
value: 0,
label: '未接单',
}, {
value: 1,
label: '进行中',
}, {
value: 2,
label: '完成',
}, {
value: 3,
label: '异常终止',
}],
equipment: [],
timer: null,
tableKey: 0,
value2: undefined,
pickerOptions: {
disabledDate(time) {
return time.getTime() > Date.now();
},
shortcuts: [{
text: '24小时内',
onClick(picker) {
const end = new Date();
const start = new Date();
start.setTime(start.getTime() - 3600 * 1000 * 24);
picker.$emit('pick', [start, end]);
},
},
],
},
myBackToTopStyle: {
right: '50px',
bottom: '50px',
width: '40px',
height: '40px',
'border-radius': '4px',
'line-height': '45px', // Please keep consistent with height to center vertically
background: '#e7eaf1', // The background color of the button
},
};
},
created() {
this.orderUsers();
this.alarmOrdersData();
},
methods: {
onSubmitDetail(id) {
const data = {
state: 2,
schedule: JSON.stringify({
'schedule': 1, 'content': '恭喜,你的工单完成啦!',
}),
};
alarmOrderUpdate(data, id).then(response => {
if (response.code === 200) {
this.$message.success('恭喜,你的工单完成啦!');
this.dialogTableVisible = false;
this.dataSearch();
}
}).catch(err => {
console.log(err);
});
},
isLiveFilter(id) {
const steps = [];
steps[1] = '到达现场';
steps[2] = '未到达现场';
return steps[id];
},
isVerifiedFilter(id) {
const steps = [];
steps[1] = '属实';
steps[2] = '不属实';
return steps[id];
},
isOrderOneFilter(id) {
const steps = [];
steps[1] = '开始';
steps[2] = '等待';
steps[3] = '检修';
steps[4] = '完成';
return steps[id];
},
stepFilter(step) {
const steps = [];
steps[1] = '待接单';
steps[2] = '已接单';
steps[3] = '进行中';
steps[4] = '已完成';
return steps[step];
},
alarmShow(data) {
this.marker.devicecoord = data.devicecoord;
this.marker.devicepolice = data.policestatus;
// 地图中心
this.center = data.devicecoord.replace(/\s*/g, '').split(',');
console.log(data);
this.orderDetail(data.id);
this.dialogTableVisible = true;
},
orderStateFilter(state, type) {
const status = [];
status[0] = { content: '未接单', type: 'danger' };
status[1] = { content: '进行中', type: 'warning' };
status[2] = { content: '完成', type: 'success' };
status[3] = { content: '异常终止', type: 'info' };
if (type === 'type') {
return status[state].type;
}
if (type === 'content') {
return status[state].content;
}
},
// 工单详情
orderDetail(id) {
alarmOrderDetail(id).then(response => {
const all_steps = [{
schedule: 1, content: '', created_at: '',
}, {
schedule: 2, content: '', created_at: '',
}, {
schedule: 3, content: '', created_at: '',
}, {
schedule: 4, content: '', created_at: '',
}];
if (response.code === 200) {
console.log(response.data);
this.order_content = response.data;
const srcList = [];
for (var key in response.data.images) {
srcList.push(response.data.images[key].path);
}
this.order_content.srcList = srcList;
const order_step = response.data.step;
for (var step in all_steps) {
if (order_step[step]) {
all_steps[step] = order_step[step];
}
}
this.order_step = all_steps;
console.log(this.order_step);
}
}).catch(err => {
console.log(err);
});
},
// 可以派单的人员
orderUsers(data) {
alarmOrderUsers().then(response => {
if (response.code === 200) {
this.alarmOrderUsersData = this.alarmOrderUsersData.concat(response.data);
}
}).catch(err => {
console.log(err);
});
},
// 工单列表
alarmOrdersData() {
console.log(this.formSearch);
alarmOrderList(this.formSearch).then(response => {
if (response.code === 200) {
console.log(response.data);
this.alarmOrders = response.data.orders;
this.formSearch.total = response.data.meta.count;
}
}).catch(err => {
console.log(err);
});
},
handleSizeChange(val) {
this.formSearch.limit = val;
this.dataSearch();
},
handleCurrentChange(val) {
this.formSearch.page = val;
this.dataSearch();
},
handleCopy(text, event) {
clip(text, event);
},
onSubmit() {
this.formSearch.page = 1;
this.dataSearch();
},
dataSearch() {
this.alarmOrdersData();
},
timers() {
// this.timer = setInterval(() => {
// this.equipmentlist();
// }, 10000);
},
destroyed() {
this.$once('hook:beforeDestroy', () => {
clearInterval(this.timer);
});
},
},
};
</script>
<style scoped lang="scss">
.placeholder-container {
ul {
li {
margin: 10px;
list-style-type: none;
}
}
}
</style>
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 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>
...@@ -47,25 +55,58 @@ ...@@ -47,25 +55,58 @@
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="操作"> <el-table-column label="操作">
<template> <template slot-scope="scope">
<el-button type="primary" effect="dark">生成工单</el-button> <el-button type="primary" effect="dark" @click="orderUsers(scope.row)">生成工单</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
<el-tooltip placement="top" content="tooltip"> <el-tooltip placement="top" content="tooltip">
<back-to-top :custom-style="myBackToTopStyle" :visibility-height="300" :back-position="50" transition-name="fade" /> <back-to-top :custom-style="myBackToTopStyle" :visibility-height="300" :back-position="50" transition-name="fade" />
</el-tooltip> </el-tooltip>
<el-dialog title="向谁派发工单?" :visible.sync="dialogFormVisible">
<el-table
ref="singleTable"
:data="alarmOrderUserData"
:highlight-current-row="true"
row-class-name="order-users-row"
style="width: 100%"
@row-click="handleCurrentChange"
>
<el-table-column
label="ID"
width="150"
>
<template slot-scope="scope">
<el-radio v-model="form.alarmOrderToUserId" :label="scope.row.id">{{ scope.row.id }}</el-radio>
</template>
</el-table-column>
<el-table-column property="name" label="用户名" width="150"></el-table-column>
<el-table-column property="username" label="账号" width="120"></el-table-column>
<el-table-column property="phone_number" label="手机号" width="120"></el-table-column>
<el-table-column property="role_name" label="角色"></el-table-column>
<el-table-column property="province" label="省"></el-table-column>
<el-table-column property="city" label="市"></el-table-column>
<el-table-column property="area" label="区域(县)"></el-table-column>
</el-table>
<div slot="footer" class="dialog-footer">
<el-button @click="dialogFormVisible = false"> </el-button>
<el-button type="primary" @click="createAlarmOrder()"> </el-button>
</div>
</el-dialog>
</div> </div>
</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';
import { alarmOrderStore, alarmOrderUsers } from '@/api/alarmOrder';
export default { export default {
components: { BackToTop }, components: { BackToTop },
data() { data() {
return { return {
dialogFormVisible: false,
alarmOrderUserData: [],
tableKey: 0, tableKey: 0,
reportpolice: [], reportpolice: [],
myBackToTopStyle: { myBackToTopStyle: {
...@@ -77,12 +118,65 @@ export default { ...@@ -77,12 +118,65 @@ 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
}, },
// 报警工单数据
form: {
alarmOrderToUserId: 0,
},
formDataOrder: {
device_num: '',
reportpolice_id: 0,
policestatus: 0,
shutoff_status: 0,
user_id: 0,
},
devicetime: '', // 时间
devicehtime: '', // 年月
device_type: '', // 搜索数据设备报警类型
device_quyu: '', // 设备区域
data_device_type: '', // 设备数据
data_device_quyu: '', // 设备区域
}; };
}, },
created() { created() {
this.police(); // 列表 this.police(); // 列表
this.historydevicetype(); // 设备搜索所需数据
}, },
methods: { methods: {
// 生成工单
handleCurrentChange(val) {
console.log(val);
this.form.alarmOrderToUserId = val.id;
this.formDataOrder.user_id = this.form.alarmOrderToUserId;
},
orderUsers(data) {
alarmOrderUsers().then(response => {
if (response.code === 200) {
this.alarmOrderUserData = response.data;
}
}).catch(err => {
console.log(err);
});
this.formDataOrder.device_num = data.devicenumber;
this.formDataOrder.reportpolice_id = data.id;
this.formDataOrder.policestatus = data.policestatus;
this.formDataOrder.shutoff_status = data.shutoff_status;
this.dialogFormVisible = true;
},
createAlarmOrder() {
if (this.formDataOrder.user_id === 0) {
this.$message.error('你的工单要派发给谁呢?');
return;
}
alarmOrderStore(this.formDataOrder).then(response => {
console.log(response);
if (response.code === 200) {
this.$message.success('你的工单派发成功了!');
this.dialogFormVisible = false;
}
}).catch(err => {
console.log(err);
});
},
shutoffStatus(id) { shutoffStatus(id) {
const shutoff = []; const shutoff = [];
shutoff[0] = '初始化'; shutoff[0] = '初始化';
...@@ -106,12 +200,32 @@ export default { ...@@ -106,12 +200,32 @@ 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>
<style> <style>
.order-users-row {
cursor: pointer;
}
</style> </style>
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
...@@ -270,17 +270,17 @@ export default { ...@@ -270,17 +270,17 @@ export default {
}, },
shutoffStatus(id) { shutoffStatus(id) {
const shutoff = []; const shutoff = [];
shutoff[0] = '初始化'; shutoff[2] = '初始化';
shutoff[1] = '开启'; shutoff[0] = '开启';
shutoff[2] = '关闭'; shutoff[1] = '关闭';
return shutoff[id]; return shutoff[id];
}, },
unshutoff_status(state) { unshutoff_status(state) {
return state === 1 ? '关闭' : '开启'; return state === 0 ? '关闭' : '开启';
}, },
// 修改切断装置状态 // 修改切断装置状态
changeShutoffStatus(id, shutoff_status, tid) { changeShutoffStatus(id, shutoff_status, tid) {
updedata({ deid: id, shutoff_status: shutoff_status !== 1 ? 1 : 2, tid: tid }) updedata({ deid: id, device_control: shutoff_status !== 1 ? 1 : 0, tid: tid })
.then(response => { .then(response => {
// this.devicelist(); // this.devicelist();
}) })
......
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
...@@ -88,6 +88,22 @@ ...@@ -88,6 +88,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>
...@@ -115,6 +131,9 @@ ...@@ -115,6 +131,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>
...@@ -154,13 +173,17 @@ export default { ...@@ -154,13 +173,17 @@ export default {
phone_number: undefined, phone_number: undefined,
user_role_id: undefined, user_role_id: undefined,
}, },
paper: undefined,
user_roles: [ user_roles: [
{ id: 1, name: '行业主管部门负责人' }, { id: 1, name: '行业主管部门负责人' },
{ id: 2, name: '燃气用户' }, { id: 2, name: '燃气用户' },
{ id: 3, name: '应急抢修人员' }, { id: 3, name: '应急抢修人员' },
{ id: 4, name: '村内“两员”' }, { id: 4, name: '村内“两员”' },
], ],
paper: undefined,
dialogImageUrl: '', // 图片地址
dialogVisible: false,
disabled: false,
userimgdisabled: false, // 用户上传图片
}; };
}, },
created() { created() {
...@@ -306,7 +329,6 @@ export default { ...@@ -306,7 +329,6 @@ export default {
type: 'warning', type: 'warning',
}); });
} else { } else {
console.log(response.data);
for (const key in this.upUserData) { for (const key in this.upUserData) {
for (const k in response.data) { for (const k in response.data) {
if (key === k) { if (key === k) {
...@@ -355,6 +377,18 @@ export default { ...@@ -355,6 +377,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,14 +51,18 @@ Route::group(['middleware' => 'auth:api'], function () { ...@@ -51,14 +51,18 @@ Route::group(['middleware' => 'auth:api'], function () {
// 报警工单 // 报警工单
Route::get('alarm_order', 'AlarmOrderController@index'); // 工单列表 Route::get('alarm_order', 'AlarmOrderController@index'); // 工单列表
Route::post('alarm_order', 'AlarmOrderController@store'); // 创建工单 Route::post('alarm_order', 'AlarmOrderController@store'); // 创建工单
Route::patch('alarm_order/{id}', 'AlarmOrderController@update'); // 修改工单 Route::post('alarm_order/order_ok', 'AlarmOrderController@update'); // 修改工单
Route::delete('alarm_order/{id}', 'AlarmOrderController@destroy'); // 删除工单 Route::delete('alarm_order/{id}', 'AlarmOrderController@destroy'); // 删除工单
Route::get('alarm_order/show/{id}', 'AlarmOrderController@show'); // 工单详情 Route::get('alarm_order/user', 'AlarmOrderController@getUserInfo'); // 获取派单人员
Route::get('alarm_order/show', 'AlarmOrderController@show'); // 工单详情
Route::get('alarm_order/order_in', 'AlarmOrderController@orderin'); // 获取当前订单为第几步
Route::get('alarm_order/userworklist', 'AlarmOrderController@userworklist'); // 获取当前订单为第几步
}); });
//上传图片路由 //上传图片路由
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');//更新图片信息,返回逻辑图片列表
...@@ -113,6 +117,8 @@ Route::group(['middleware'=>'auth:api'],function (){ ...@@ -113,6 +117,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('devices/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