Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
L
laravelzh
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
冯超鹏
laravelzh
Commits
39e053e5
Commit
39e053e5
authored
May 14, 2020
by
冯超鹏
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
记记录模块
parent
203bdf7b
Pipeline
#49
failed with stages
Changes
11
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
671 additions
and
323 deletions
+671
-323
SwooleCommandMeTcpController.php
app/Http/Controllers/Auth/SwooleCommandMeTcpController.php
+33
-7
DevicesController.php
app/Http/Controllers/DevicesController.php
+250
-148
dump.rdb
dump.rdb
+0
-0
devicelistdata.text
public/device/2020-05-14/devicelistdata.text
+3
-0
device.js
resources/js/api/device.js
+22
-0
index.js
resources/js/router/index.js
+112
-116
element-ui.js
resources/js/router/modules/element-ui.js
+1
-1
index.vue
resources/js/views/documentation/index.vue
+0
-47
alarms.vue
resources/js/views/history/alarms.vue
+92
-1
index.vue
resources/js/views/history/index.vue
+157
-3
api.php
routes/api.php
+1
-0
No files found.
app/Http/Controllers/Auth/SwooleCommandMeTcpController.php
View file @
39e053e5
...
@@ -16,12 +16,29 @@ class SwooleCommandMeTcpController extends Controller
...
@@ -16,12 +16,29 @@ class SwooleCommandMeTcpController extends Controller
{
{
if
(
$data
!=
''
)
{
if
(
$data
!=
''
)
{
$datadevice
=
$this
->
stringdata
(
$data
);
$datadevice
=
$this
->
stringdata
(
$data
);
Redis
::
set
(
'dbtype'
,
0
);
if
(
Redis
::
get
(
'sbjc:'
.
$datadevice
[
0
])
==
''
){
Redis
::
set
(
'sbjc:'
.
$datadevice
[
0
],
$data
);
Redis
::
set
(
'sbjc:'
.
$datadevice
[
0
],
$data
);
$this
->
dbdevice
(
$this
->
stringdata
(
$data
));
$this
->
dbdevice
(
$this
->
stringdata
(
$data
));
}
else
if
(
Redis
::
get
(
'sbjc:'
.
$datadevice
[
0
])
!=
$data
){
$this
->
dbdevice
(
$this
->
stringdata
(
$data
));
Redis
::
set
(
'sbjc:'
.
$datadevice
[
0
],
$data
);
}
Redis
::
lpush
(
'police'
,
$data
);
Redis
::
lpush
(
'police'
,
$data
);
$this
->
police
();
$this
->
police
();
}
}
$dalen
=
Redis
::
llen
(
'Devicesdata'
);
//返回队列长度
if
(
$dalen
>
5000
)
{
//当队列值达到巅峰以后切换数据库
Redis
::
select
(
1
);
//使用备用数据库//释放主数据库
Redis
::
set
(
'dbtype'
,
1
);
$this
->
deleteDbRedis
();
}
if
(
$dalen
>
5000
&&
Redis
::
get
(
'dbtype'
)
==
1
){
Redis
::
select
(
0
);
Redis
::
set
(
'dbtype'
,
0
);
$this
->
deleteDb
();
}
}
}
//分割字符串
//分割字符串
...
@@ -44,6 +61,18 @@ class SwooleCommandMeTcpController extends Controller
...
@@ -44,6 +61,18 @@ class SwooleCommandMeTcpController extends Controller
}
}
return
$arrdata
;
return
$arrdata
;
}
}
//清楚指定数据库 redis
private
function
deleteDbRedis
(){
Redis
::
select
(
0
);
Redis
::
flushdb
();
Redis
::
select
(
1
);
}
private
function
deleteDb
(){
Redis
::
select
(
1
);
Redis
::
flushdb
();
Redis
::
select
(
0
);
}
//查询出返回值
//查询出返回值
private
function
dbdevice
(
$data
=
[])
private
function
dbdevice
(
$data
=
[])
...
@@ -58,12 +87,9 @@ class SwooleCommandMeTcpController extends Controller
...
@@ -58,12 +87,9 @@ class SwooleCommandMeTcpController extends Controller
->
leftjoin
(
'status as s'
,
's.id'
,
'='
,
'd.devicepolice'
)
->
leftjoin
(
'status as s'
,
's.id'
,
'='
,
'd.devicepolice'
)
->
select
(
'd.devicenum'
,
'd.username'
,
'd.deviceremark'
,
'd.devicelinkman'
,
'd.devicephone'
,
'd.deviceinfo'
,
't.tname'
,
'g.gas'
,
'c.danwei'
,
's.status_name'
)
->
select
(
'd.devicenum'
,
'd.username'
,
'd.deviceremark'
,
'd.devicelinkman'
,
'd.devicephone'
,
'd.deviceinfo'
,
't.tname'
,
'g.gas'
,
'c.danwei'
,
's.status_name'
)
->
first
();
->
first
();
if
(
$devicedata
!=
''
){
Redis
::
lPush
(
'Devicesdata'
,
serialize
(
$devicedata
));
//进入队列进行
Redis
::
lPush
(
'Devicesdata'
,
serialize
(
$devicedata
));
//进入队列进行
$dalen
=
Redis
::
llen
(
'Devicesdata'
);
//返回队列长度
if
(
$dalen
==
2
)
{
$Devices
->
equipment
();
//推送前台
}
}
}
}
}
}
...
...
app/Http/Controllers/DevicesController.php
View file @
39e053e5
...
@@ -15,6 +15,7 @@ use Illuminate\Support\Facades\DB;
...
@@ -15,6 +15,7 @@ use Illuminate\Support\Facades\DB;
use
Illuminate\Support\Facades\Hash
;
use
Illuminate\Support\Facades\Hash
;
use
Illuminate\Support\Facades\Redis
;
use
Illuminate\Support\Facades\Redis
;
use
Validator
;
use
Validator
;
class
DevicesController
extends
Controller
class
DevicesController
extends
Controller
{
{
//设备列表
//设备列表
...
@@ -23,14 +24,15 @@ class DevicesController extends Controller
...
@@ -23,14 +24,15 @@ class DevicesController extends Controller
* type 不传默认是第一个
* type 不传默认是第一个
* @type 设备类型id
* @type 设备类型id
* */
* */
public
function
devicelist
(
Request
$request
){
public
function
devicelist
(
Request
$request
)
{
$type
=
$request
->
input
(
'type'
);
//设备类型id
$type
=
$request
->
input
(
'type'
);
//设备类型id
$pagenNum
=
$request
->
input
(
'page'
)
-
1
;
//页数
$pagenNum
=
$request
->
input
(
'page'
)
-
1
;
//页数
$limit
=
$request
->
input
(
'limit'
);
$limit
=
$request
->
input
(
'limit'
);
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
));
}
}
//用户设备列表
//用户设备列表
...
@@ -39,73 +41,77 @@ class DevicesController extends Controller
...
@@ -39,73 +41,77 @@ class DevicesController extends Controller
* type 不传默认是第一个
* type 不传默认是第一个
* @type 设备类型id
* @type 设备类型id
* */
* */
public
function
userdevicelist
(
Request
$request
){
public
function
userdevicelist
(
Request
$request
)
{
$type
=
$request
->
input
(
'type'
);
//设备类型id
$type
=
$request
->
input
(
'type'
);
//设备类型id
$pagenNum
=
$request
->
input
(
'page'
)
-
1
;
//页数
$pagenNum
=
$request
->
input
(
'page'
)
-
1
;
//页数
$limit
=
$request
->
input
(
'limit'
);
$limit
=
$request
->
input
(
'limit'
);
if
(
$pagenNum
===
''
||
$limit
==
''
)
{
if
(
$pagenNum
===
''
||
$limit
==
''
)
{
return
$this
->
jsonErrorData
(
105
,
'页数或limit不能为空'
);
return
$this
->
jsonErrorData
(
105
,
'页数或limit不能为空'
);
}
}
return
$this
->
jsonSuccessData
(
$this
->
userdevice
(
$type
==
''
?
'1'
:
$type
,
$pagenNum
,
$limit
));
return
$this
->
jsonSuccessData
(
$this
->
userdevice
(
$type
==
''
?
'1'
:
$type
,
$pagenNum
,
$limit
));
}
}
/*
/*
* 删除设备
* 删除设备
* type 1==逻辑删除
* type 1==逻辑删除
* type 2== 物理删除
* type 2== 物理删除
* */
* */
public
function
deletedecice
(
Request
$request
){
public
function
deletedecice
(
Request
$request
)
{
$type
=
(
int
)
$request
->
input
(
'type'
);
$type
=
(
int
)
$request
->
input
(
'type'
);
$deviceid
=
(
int
)
$request
->
input
(
'deviceid'
);
//设备id
$deviceid
=
(
int
)
$request
->
input
(
'deviceid'
);
//设备id
if
(
$type
==
''
||
$deviceid
==
''
){
if
(
$type
==
''
||
$deviceid
==
''
)
{
return
$this
->
jsonErrorData
(
105
,
'参数不能为空'
);
return
$this
->
jsonErrorData
(
105
,
'参数不能为空'
);
}
}
if
(
$type
==
1
){
//逻辑删除
if
(
$type
==
1
)
{
//逻辑删除
$dete
=
Device
::
where
(
'id'
,
'='
,
$deviceid
)
$dete
=
Device
::
where
(
'id'
,
'='
,
$deviceid
)
->
value
(
'delete'
);
->
value
(
'delete'
);
if
(
$dete
!=
1
){
if
(
$dete
!=
1
)
{
$update
=
Device
::
where
(
'id'
,
'='
,
$deviceid
)
$update
=
Device
::
where
(
'id'
,
'='
,
$deviceid
)
->
update
([
'delete'
=>
1
]);
->
update
([
'delete'
=>
1
]);
return
$this
->
jsonSuccessData
(
$update
);
return
$this
->
jsonSuccessData
(
$update
);
}
else
{
}
else
{
return
$this
->
jsonErrorData
(
105
,
'数据异常'
);
return
$this
->
jsonErrorData
(
105
,
'数据异常'
);
}
}
}
else
if
(
$type
==
2
)
{
//物理删除
}
else
if
(
$type
==
2
)
{
//物理删除
$dete
=
Device
::
where
(
'id'
,
'='
,
$deviceid
)
$dete
=
Device
::
where
(
'id'
,
'='
,
$deviceid
)
->
value
(
'delete'
);
->
value
(
'delete'
);
if
(
$dete
!=
2
){
if
(
$dete
!=
2
)
{
$delete
=
Device
::
where
(
'id'
,
'='
,
$deviceid
)
$delete
=
Device
::
where
(
'id'
,
'='
,
$deviceid
)
->
delete
();
->
delete
();
return
$this
->
jsonSuccessData
(
$delete
);
return
$this
->
jsonSuccessData
(
$delete
);
}
else
{
}
else
{
return
$this
->
jsonErrorData
(
105
,
'数据异常'
);
return
$this
->
jsonErrorData
(
105
,
'数据异常'
);
}
}
}
}
}
}
//返回逻辑删除的设备和修复设备
//返回逻辑删除的设备和修复设备
public
function
physicsdelete
(
Request
$request
){
public
function
physicsdelete
(
Request
$request
)
{
$deviceid
=
$request
->
input
(
'deviceid'
);
$deviceid
=
$request
->
input
(
'deviceid'
);
$databadevice
=
DB
::
table
(
'device'
);
$databadevice
=
DB
::
table
(
'device'
);
if
(
$_POST
)
{
if
(
$_POST
)
{
$up
=
$databadevice
$up
=
$databadevice
->
where
(
'id'
,
'='
,
$deviceid
)
->
where
(
'id'
,
'='
,
$deviceid
)
->
update
([
'delete'
=>
2
]);
->
update
([
'delete'
=>
2
]);
return
$this
->
jsonSuccessData
(
$up
);
return
$this
->
jsonSuccessData
(
$up
);
}
else
{
}
else
{
//返回物理删除设备列表
//返回物理删除设备列表
$type
=
(
int
)
$request
->
input
(
'type'
);
//设备类型
$type
=
(
int
)
$request
->
input
(
'type'
);
//设备类型
$pagenNum
=
$request
->
input
(
'page'
)
-
1
;
//页数
$pagenNum
=
$request
->
input
(
'page'
)
-
1
;
//页数
$limit
=
$request
->
input
(
'limit'
);
//条数
$limit
=
$request
->
input
(
'limit'
);
//条数
if
(
$pagenNum
===
''
||
$limit
==
''
)
{
if
(
$pagenNum
===
''
||
$limit
==
''
)
{
return
$this
->
jsonErrorData
(
105
,
'页数或limit不能为空'
);
return
$this
->
jsonErrorData
(
105
,
'页数或limit不能为空'
);
}
}
$devicelist
=
$databadevice
$devicelist
=
$databadevice
->
where
(
'dtype'
,
'='
,
$type
==
''
?
'1'
:
$type
)
->
where
(
'dtype'
,
'='
,
$type
==
''
?
'1'
:
$type
)
->
where
(
'delete'
,
'='
,
'1'
)
//设备逻辑删除状态
->
where
(
'delete'
,
'='
,
'1'
)
//设备逻辑删除状态
->
join
(
'device_type as dy'
,
"device.dtype"
,
'='
,
'dy.tid'
)
->
join
(
'device_type as dy'
,
"device.dtype"
,
'='
,
'dy.tid'
)
->
join
(
'gas as g'
,
"device.status"
,
'='
,
'g.id'
)
->
join
(
'gas as g'
,
"device.status"
,
'='
,
'g.id'
)
->
select
(
'dy.tname'
,
'g.gas'
,
'device.*'
)
->
select
(
'dy.tname'
,
'g.gas'
,
'device.*'
)
->
orderBy
(
'device.id'
,
'desc'
)
->
orderBy
(
'device.id'
,
'desc'
)
->
offset
(
$pagenNum
)
->
offset
(
$pagenNum
)
->
limit
(
$limit
)
->
limit
(
$limit
)
...
@@ -116,7 +122,8 @@ class DevicesController extends Controller
...
@@ -116,7 +122,8 @@ class DevicesController extends Controller
}
}
//添加设备
//添加设备
public
function
adddevice
(
Request
$request
){
public
function
adddevice
(
Request
$request
)
{
//验证用户提交表单
//验证用户提交表单
$validator
=
Validator
::
make
(
$request
->
all
(),
$this
->
getValidationRulesdevice
(
false
));
$validator
=
Validator
::
make
(
$request
->
all
(),
$this
->
getValidationRulesdevice
(
false
));
if
(
$validator
->
fails
())
{
if
(
$validator
->
fails
())
{
...
@@ -128,191 +135,240 @@ class DevicesController extends Controller
...
@@ -128,191 +135,240 @@ class DevicesController extends Controller
//编辑设备
//编辑设备
public
function
updatedevice
(
Request
$request
){
public
function
updatedevice
(
Request
$request
)
{
$deid
=
$request
->
input
(
'deid'
);
$deid
=
$request
->
input
(
'deid'
);
$data
=
$request
->
all
();
$data
=
$request
->
all
();
if
(
is_null
(
$deid
))
{
if
(
is_null
(
$deid
))
{
return
$this
->
jsonErrorData
(
105
,
'设备ID不能为空'
);
return
$this
->
jsonErrorData
(
105
,
'设备ID不能为空'
);
}
}
if
(
$_POST
){
if
(
$_POST
)
{
$validator
=
Validator
::
make
(
$request
->
all
(),
$this
->
getValidationRulesupdevice
(
false
));
$validator
=
Validator
::
make
(
$request
->
all
(),
$this
->
getValidationRulesupdevice
(
false
));
if
(
$validator
->
fails
())
{
if
(
$validator
->
fails
())
{
return
response
()
->
json
([
'errors'
=>
$validator
->
errors
()],
403
);
return
response
()
->
json
([
'errors'
=>
$validator
->
errors
()],
403
);
}
}
foreach
(
$data
as
$k
=>
$v
)
{
foreach
(
$data
as
$k
=>
$v
)
{
if
(
$k
==
'deid'
)
{
if
(
$k
==
'deid'
)
{
unset
(
$data
[
$k
]);
unset
(
$data
[
$k
]);
}
}
}
}
return
$this
->
jsonSuccessData
(
Device
::
where
(
'id'
,
'='
,
$deid
)
->
update
(
$data
));
return
$this
->
jsonSuccessData
(
Device
::
where
(
'id'
,
'='
,
$deid
)
->
update
(
$data
));
}
else
{
}
else
{
$devi
=
DB
::
table
(
'device as de'
)
$devi
=
DB
::
table
(
'device as de'
)
->
where
(
'de.id'
,
'='
,
$deid
)
->
where
(
'de.id'
,
'='
,
$deid
)
->
leftjoin
(
'device_type as dt'
,
'de.dtype'
,
'='
,
'dt.tid'
)
->
leftjoin
(
'device_type as dt'
,
'de.dtype'
,
'='
,
'dt.tid'
)
->
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'
)
->
select
(
'dt.*'
,
'gas.*'
,
'da.*'
,
'de.*'
)
->
select
(
'dt.*'
,
'gas.*'
,
'da.*'
,
'de.*'
)
->
first
();
->
first
();
return
$this
->
jsonSuccessData
(
$devi
);
return
$this
->
jsonSuccessData
(
$devi
);
}
}
}
}
//返回设备类型和单位和介质
//返回设备类型和单位和介质
public
function
devicetype
(){
public
function
devicetype
()
{
$gas
=
DB
::
table
(
'gas'
)
->
get
();
$gas
=
DB
::
table
(
'gas'
)
->
get
();
$danwei
=
DB
::
table
(
'danwei'
)
->
get
();
$danwei
=
DB
::
table
(
'danwei'
)
->
get
();
$devicetypecount
=
DB
::
table
(
'device_type as t'
)
$devicetypecount
=
DB
::
table
(
'device_type as t'
)
->
leftjoin
(
'device as d'
,
'd.dtype'
,
'='
,
't.tid'
)
->
leftjoin
(
'device as d'
,
'd.dtype'
,
'='
,
't.tid'
)
->
selectRaw
(
't.*,count(d.id) as counnum'
)
->
selectRaw
(
't.*,count(d.id) as counnum'
)
->
groupBy
(
't.tid'
)
->
groupBy
(
't.tid'
)
->
get
();
->
get
();
return
$this
->
jsonSuccessData
([
'devicetype'
=>
$devicetypecount
,
'gas'
=>
$gas
,
'danwei'
=>
$danwei
]);
return
$this
->
jsonSuccessData
([
'devicetype'
=>
$devicetypecount
,
'gas'
=>
$gas
,
'danwei'
=>
$danwei
]);
}
}
//返回设备列表
//返回设备列表
private
function
whertype
(
$type
,
$pagenNum
,
$limit
)
:
array
{
private
function
whertype
(
$type
,
$pagenNum
,
$limit
)
:
array
{
$databadevice
=
DB
::
table
(
'device'
);
$databadevice
=
DB
::
table
(
'device'
);
$devicelist
=
$databadevice
$devicelist
=
$databadevice
->
where
(
'dtype'
,
'='
,
$type
)
->
where
(
'dtype'
,
'='
,
$type
)
//->where('delete','=','2')//设备不是删除状态
//->where('delete','=','2')//设备不是删除状态
//->where('devicestatus','=','1')//
//->where('devicestatus','=','1')//
->
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'
)
->
select
(
'dy.tname'
,
'g.gas'
,
'device.*'
,
'p.status_name'
)
->
select
(
'dy.tname'
,
'g.gas'
,
'device.*'
,
'p.status_name'
)
->
orderBy
(
'device.id'
,
'desc'
)
->
orderBy
(
'device.id'
,
'desc'
)
->
offset
(
$pagenNum
)
->
offset
(
$pagenNum
)
->
limit
(
$limit
)
->
limit
(
$limit
)
->
get
()
->
toArray
();
->
get
()
->
toArray
();
$count
=
$databadevice
$count
=
$databadevice
->
where
(
'dtype'
,
'='
,
$type
)
->
where
(
'dtype'
,
'='
,
$type
)
//->where('delete','=','2')//设备不是删除状态
//->where('delete','=','2')//设备不是删除状态
//->where('devicestatus','=','1')//
//->where('devicestatus','=','1')//
->
count
();
->
count
();
return
[
'devicelist'
=>
$devicelist
,
'count'
=>
$count
];
return
[
'devicelist'
=>
$devicelist
,
'count'
=>
$count
];
}
}
//返回用户设备列表
//返回用户设备列表
private
function
userdevice
(
$type
,
$pagenNum
,
$limit
)
:
array
{
private
function
userdevice
(
$type
,
$pagenNum
,
$limit
)
:
array
{
$databadevice
=
DB
::
table
(
'device'
);
$databadevice
=
DB
::
table
(
'device'
);
$devicelist
=
$databadevice
$devicelist
=
$databadevice
->
where
(
'dtype'
,
'='
,
$type
)
->
where
(
'dtype'
,
'='
,
$type
)
->
where
(
'uid'
,
'='
,
Auth
::
id
())
->
where
(
'uid'
,
'='
,
Auth
::
id
())
//->where('delete','=','2')//设备不是删除状态
//->where('delete','=','2')//设备不是删除状态
//->where('devicestatus','=','1')//
//->where('devicestatus','=','1')//
->
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'
)
->
select
(
'dy.tname'
,
'g.gas'
,
'device.*'
,
'p.status_name'
)
->
select
(
'dy.tname'
,
'g.gas'
,
'device.*'
,
'p.status_name'
)
->
orderBy
(
'device.id'
,
'desc'
)
->
orderBy
(
'device.id'
,
'desc'
)
->
offset
(
$pagenNum
)
->
offset
(
$pagenNum
)
->
limit
(
$limit
)
->
limit
(
$limit
)
->
get
()
->
toArray
();
->
get
()
->
toArray
();
$count
=
$databadevice
$count
=
$databadevice
->
where
(
'dtype'
,
'='
,
$type
)
->
where
(
'dtype'
,
'='
,
$type
)
->
where
(
'uid'
,
'='
,
Auth
::
id
())
->
where
(
'uid'
,
'='
,
Auth
::
id
())
// ->where('delete','=','2')//设备不是删除状态
// ->where('delete','=','2')//设备不是删除状态
//->where('devicestatus','=','1')//
//->where('devicestatus','=','1')//
->
count
();
->
count
();
return
[
'devicelist'
=>
$devicelist
,
'count'
=>
$count
];
return
[
'devicelist'
=>
$devicelist
,
'count'
=>
$count
];
}
}
private
function
deviceDataSearchData
(
$devicenum
,
$pagenNum
,
$limit
)
:
array
{
private
function
deviceDataSearchData
(
$devicenum
,
$pagenNum
,
$limit
)
:
array
{
$databadevice
=
DB
::
table
(
'device'
);
$databadevice
=
DB
::
table
(
'device'
);
$devicelist
=
$databadevice
$devicelist
=
$databadevice
->
where
(
'devicenum'
,
'='
,
$devicenum
)
->
where
(
'devicenum'
,
'='
,
$devicenum
)
//->where('delete','=','2')//设备不是删除状态
//->where('delete','=','2')//设备不是删除状态
//->where('devicestatus','=','1')//
//->where('devicestatus','=','1')//
->
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'
)
->
select
(
'dy.tname'
,
'g.gas'
,
'device.*'
,
'p.status_name'
)
->
select
(
'dy.tname'
,
'g.gas'
,
'device.*'
,
'p.status_name'
)
->
orderBy
(
'device.id'
,
'desc'
)
->
orderBy
(
'device.id'
,
'desc'
)
->
offset
(
$pagenNum
)
->
offset
(
$pagenNum
)
->
limit
(
$limit
)
->
limit
(
$limit
)
->
get
()
->
toArray
();
->
get
()
->
toArray
();
$count
=
$databadevice
$count
=
$databadevice
->
where
(
'dtype'
,
'='
,
$devicenum
)
->
where
(
'dtype'
,
'='
,
$devicenum
)
//->where('delete','=','2')//设备不是删除状态
//->where('delete','=','2')//设备不是删除状态
//->where('devicestatus','=','1')//
//->where('devicestatus','=','1')//
->
count
();
->
count
();
return
[
'devicelist'
=>
$devicelist
,
'count'
=>
$count
];
return
[
'devicelist'
=>
$devicelist
,
'count'
=>
$count
];
}
}
//批量上传设备
//批量上传设备
public
function
batchdevice
(){
public
function
batchdevice
()
{
}
}
//获取设备详情信息
//获取设备详情信息
public
function
deviceDataInfo
(
$id
){
public
function
deviceDataInfo
(
$id
)
$devicedata
=
Device
::
where
(
'device.id'
,
'='
,
$id
)
{
->
leftjoin
(
'contactsuser as c'
,
'c.contactsid'
,
'='
,
'device.contactsid'
)
$devicedata
=
Device
::
where
(
'device.id'
,
'='
,
$id
)
->
select
(
'c.*'
,
'device.deviceuuid'
,
'device.devicelinkman'
,
'device.devicephone'
,
'device.devicecoord'
)
->
leftjoin
(
'contactsuser as c'
,
'c.contactsid'
,
'='
,
'device.contactsid'
)
->
select
(
'c.*'
,
'device.deviceuuid'
,
'device.devicelinkman'
,
'device.devicephone'
,
'device.devicecoord'
)
->
get
();
->
get
();
$devicedatainfo
=
Device
::
where
(
'id'
,
'='
,
$id
)
$devicedatainfo
=
Device
::
where
(
'id'
,
'='
,
$id
)
->
select
(
'deviceuuid'
,
'devicelinkman'
,
'devicephone'
,
'devicecoord'
)
->
select
(
'deviceuuid'
,
'devicelinkman'
,
'devicephone'
,
'devicecoord'
)
->
get
();
->
get
();
return
$this
->
jsonSuccessData
([
'devicedata'
=>
$devicedata
,
'devicedatainfo'
=>
$devicedatainfo
]);
return
$this
->
jsonSuccessData
([
'devicedata'
=>
$devicedata
,
'devicedatainfo'
=>
$devicedatainfo
]);
}
}
//搜索设备账号
//搜索设备账号
public
function
deviceDataSearch
(
Request
$request
){
public
function
deviceDataSearch
(
Request
$request
)
{
$data
=
$request
->
input
(
'deviceName'
);
$data
=
$request
->
input
(
'deviceName'
);
$pagenNum
=
$request
->
input
(
'page'
)
-
1
;
//页数
$pagenNum
=
$request
->
input
(
'page'
)
-
1
;
//页数
$limit
=
$request
->
input
(
'limit'
);
$limit
=
$request
->
input
(
'limit'
);
if
(
$pagenNum
===
''
||
$limit
==
''
||
$data
==
''
)
{
if
(
$pagenNum
===
''
||
$limit
==
''
||
$data
==
''
)
{
return
$this
->
jsonErrorData
(
105
,
'请求参数不能为空'
);
return
$this
->
jsonErrorData
(
105
,
'请求参数不能为空'
);
}
}
return
$this
->
jsonSuccessData
(
$this
->
deviceDataSearchData
(
$data
,
$pagenNum
,
$limit
));
return
$this
->
jsonSuccessData
(
$this
->
deviceDataSearchData
(
$data
,
$pagenNum
,
$limit
));
}
}
//推送获取数据监测数据
//推送获取数据监测数据
public
function
equipment
(){
public
function
equipment
()
{
$dalen
=
Redis
::
llen
(
'Devicesdata'
);
//返回队列长度
$dalen
=
Redis
::
llen
(
'Devicesdata'
);
//返回队列长度
if
(
$dalen
>
0
){
// $num = round($dalen / 2);
return
$this
->
jsonSuccessData
(
unserialize
(
Redis
::
lpop
(
'Devicesdata'
)));
$data
=
[];
if
(
$dalen
>
0
)
{
for
(
$i
=
0
;
$i
<
$dalen
;
$i
++
)
{
array_push
(
$data
,
unserialize
(
Redis
::
lpop
(
'Devicesdata'
)));
}
}
if
(
$data
!=
[])
{
$this
->
devicemkdir
(
$data
);
//写入文件
}
$devicelistopen
=
$this
->
devicelistopen
();
if
(
$devicelistopen
!=
105
){
return
$this
->
jsonSuccessData
(
$devicelistopen
);
}
else
{
return
$this
->
jsonErrorData
(
105
,
'暂无数据'
);
}
}
//历史数据查询
public
function
detedevice
(
Request
$request
){
$dete
=
$request
->
input
(
'dete'
);
$devicetime
=
$this
->
devicetime
(
$dete
);
if
(
$devicetime
!=
105
){
return
$this
->
jsonSuccessData
(
$devicetime
);
}
else
{
}
else
{
return
$this
->
jsonErrorData
(
105
,
'暂无数据'
);
return
$this
->
jsonErrorData
(
105
,
'暂无数据'
);
}
}
}
}
//返回设备当前报警
//返回设备当前报警
public
function
police
(){
public
function
police
()
return
DB
::
table
(
'reportpolice as r'
)
{
->
where
(
'r.status'
,
'='
,
'1'
)
$data
=
DB
::
table
(
'reportpolice as r'
)
->
join
(
'status as s'
,
'r.policestatus'
,
'='
,
's.id'
)
//->where('r.status', '=', '1')
->
select
(
'r.*'
,
's.status_name'
)
->
join
(
'status as s'
,
'r.policestatus'
,
'='
,
's.id'
)
->
get
()
->
toArray
();
->
select
(
'r.*'
,
's.status_name'
)
->
get
();
return
$this
->
jsonSuccessData
(
$data
);
}
}
//返回设备废纸篓数量
//返回设备废纸篓数量
public
function
deviceBasket
(){
public
function
deviceBasket
()
return
$this
->
jsonSuccessData
(
DB
::
table
(
'device'
)
->
where
(
'delete'
,
'='
,
'1'
)
->
count
());
{
return
$this
->
jsonSuccessData
(
DB
::
table
(
'device'
)
->
where
(
'delete'
,
'='
,
'1'
)
->
count
());
}
}
//返回设备废纸篓和禁用设备
//返回设备废纸篓和禁用设备
public
function
deviceBasketList
(){
public
function
deviceBasketList
()
$paper
=
DB
::
table
(
'device'
)
->
where
(
'delete'
,
'='
,
'1'
)
->
get
()
->
toArray
();
{
$paper
=
DB
::
table
(
'device'
)
->
where
(
'delete'
,
'='
,
'1'
)
->
get
()
->
toArray
();
return
$this
->
jsonSuccessData
(
$paper
);
return
$this
->
jsonSuccessData
(
$paper
);
}
}
public
function
deviceDelete
(
Request
$request
){
public
function
deviceDelete
(
Request
$request
)
{
$id
=
$request
->
input
(
'id'
);
$id
=
$request
->
input
(
'id'
);
$type
=
$request
->
input
(
'type'
);
$type
=
$request
->
input
(
'type'
);
if
(
$type
==
1
){
//丢弃废纸篓
if
(
$type
==
1
)
{
//丢弃废纸篓
return
$this
->
jsonSuccessData
(
DB
::
table
(
'device'
)
->
where
(
'id'
,
'='
,
$id
)
->
update
([
'delete'
=>
1
,
'devicestatus'
=>
6
]));
return
$this
->
jsonSuccessData
(
DB
::
table
(
'device'
)
->
where
(
'id'
,
'='
,
$id
)
->
update
([
'delete'
=>
1
,
'devicestatus'
=>
6
]));
}
else
{
}
else
{
return
$this
->
jsonSuccessData
(
DB
::
table
(
'device'
)
->
where
(
'id'
,
'='
,
$id
)
->
update
([
'devicestatus'
=>
6
]));
return
$this
->
jsonSuccessData
(
DB
::
table
(
'device'
)
->
where
(
'id'
,
'='
,
$id
)
->
update
([
'devicestatus'
=>
6
]));
}
}
}
}
public
function
UpPaperBasket
(
$id
){
public
function
UpPaperBasket
(
$id
)
return
$this
->
jsonSuccessData
(
DB
::
table
(
'device'
)
->
where
(
'id'
,
'='
,
$id
)
->
update
([
'delete'
=>
2
,
'devicestatus'
=>
1
]));
{
return
$this
->
jsonSuccessData
(
DB
::
table
(
'device'
)
->
where
(
'id'
,
'='
,
$id
)
->
update
([
'delete'
=>
2
,
'devicestatus'
=>
1
]));
}
}
public
function
addClassify
(
$data
){
public
function
addClassify
(
$data
)
{
//添加分类
//添加分类
return
$this
->
jsonSuccessData
(
DB
::
table
(
'device_type'
)
->
insertGetId
([
'tname'
=>
$data
]));
return
$this
->
jsonSuccessData
(
DB
::
table
(
'device_type'
)
->
insertGetId
([
'tname'
=>
$data
]));
}
}
public
function
delteClassify
(
$id
){
public
function
delteClassify
(
$id
)
{
//删除分类
//删除分类
return
$this
->
jsonSuccessData
(
DB
::
table
(
'device_type'
)
->
where
(
'tid'
,
'='
,
$id
)
->
delete
());
return
$this
->
jsonSuccessData
(
DB
::
table
(
'device_type'
)
->
where
(
'tid'
,
'='
,
$id
)
->
delete
());
}
}
/**
/**
* @param bool $isNew
* @param bool $isNew
* @return array
* @return array
...
@@ -321,36 +377,82 @@ class DevicesController extends Controller
...
@@ -321,36 +377,82 @@ class DevicesController extends Controller
private
function
getValidationRulesdevice
(
$isNew
=
true
)
private
function
getValidationRulesdevice
(
$isNew
=
true
)
{
{
return
[
return
[
'devicenum'
=>
'required|between:2,25|unique:device,devicenum'
,
//设备编号
'devicenum'
=>
'required|between:2,25|unique:device,devicenum'
,
//设备编号
'username'
=>
'required|unique:device,username|max:40'
,
//设备名称
'username'
=>
'required|unique:device,username|max:40'
,
//设备名称
'devicephone'
=>
'sometimes|required|regex:/^1[3465789]\d{9}$/|max:11'
,
//联系人手机号
'devicephone'
=>
'sometimes|required|regex:/^1[3465789]\d{9}$/|max:11'
,
//联系人手机号
'devicelinkman'
=>
'sometimes|required|max:15'
,
'devicelinkman'
=>
'sometimes|required|max:15'
,
'dtype'
=>
'required'
,
'dtype'
=>
'required'
,
'status'
=>
'required'
,
'status'
=>
'required'
,
'devicemonad'
=>
'required'
,
'devicemonad'
=>
'required'
,
'deviceremark'
=>
'sometimes|required|max:15'
,
'deviceremark'
=>
'sometimes|required|max:15'
,
'devicecoord'
=>
'sometimes|required'
,
'devicecoord'
=>
'sometimes|required'
,
'contactsid'
=>
'sometimes|required'
,
//绑定联系人id
'contactsid'
=>
'sometimes|required'
,
//绑定联系人id
'deviceinfo'
=>
'sometimes|required'
,
'deviceinfo'
=>
'sometimes|required'
,
'devicenumber'
=>
'required|unique:device,devicenumber|max:40'
'devicenumber'
=>
'required|unique:device,devicenumber|max:40'
];
];
}
}
//更新设备列表
//更新设备列表
private
function
getValidationRulesupdevice
(
$isNew
=
true
)
private
function
getValidationRulesupdevice
(
$isNew
=
true
)
{
{
return
[
return
[
'username'
=>
'sometimes|required|unique:device,username|max:40'
,
//设备名称
'username'
=>
'sometimes|required|unique:device,username|max:40'
,
//设备名称
'devicephone'
=>
'sometimes|required|regex:/^1[3465789]\d{9}$/|max:11'
,
//联系人手机号
'devicephone'
=>
'sometimes|required|regex:/^1[3465789]\d{9}$/|max:11'
,
//联系人手机号
'devicelinkman'
=>
'sometimes|required|max:15'
,
'devicelinkman'
=>
'sometimes|required|max:15'
,
'dtype'
=>
'sometimes|required'
,
'dtype'
=>
'sometimes|required'
,
'status'
=>
'sometimes|required'
,
'status'
=>
'sometimes|required'
,
'devicemonad'
=>
'sometimes|required'
,
'devicemonad'
=>
'sometimes|required'
,
'deviceremark'
=>
'sometimes|required|max:15'
,
//备注
'deviceremark'
=>
'sometimes|required|max:15'
,
//备注
'devicecoord'
=>
'sometimes|required'
,
'devicecoord'
=>
'sometimes|required'
,
'contactsid'
=>
'sometimes|required'
,
//绑定联系人id
'contactsid'
=>
'sometimes|required'
,
//绑定联系人id
'deviceinfo'
=>
'sometimes|required'
,
'deviceinfo'
=>
'sometimes|required'
,
'devicenumber'
=>
'sometimes|required|unique:device,devicenumber|max:40'
'devicenumber'
=>
'sometimes|required|unique:device,devicenumber|max:40'
];
];
}
}
private
function
devicemkdir
(
$data
)
{
$path
=
public_path
()
.
'/device/'
.
date
(
'Y-m-d'
.
'/'
);
if
(
!
is_dir
(
$path
)){
mkdir
(
$path
);
}
file_put_contents
(
$path
.
"devicelistdata.text"
,
json_encode
(
$data
)
.
PHP_EOL
,
FILE_APPEND
);
$this
->
devicelistopen
(
$path
);
}
private
function
devicelistopen
()
:
array
{
$path
=
public_path
()
.
'/device/'
.
date
(
'Y-m-d'
.
'/'
);
if
(
is_file
(
$path
.
'devicelistdata.text'
))
{
$myfile
=
file_get_contents
(
$path
.
'devicelistdata.text'
);
$exp
=
explode
(
"
\n
"
,
$myfile
);
$datadevice
=
[];
foreach
(
array_filter
(
$exp
)
as
$key
=>
$vel
)
{
$newstring
=
str_replace
(
'['
,
''
,
$vel
);
$newstring1
=
str_replace
(
']'
,
''
,
$newstring
);
array_push
(
$datadevice
,
json_decode
(
$newstring1
,
true
));
}
return
$datadevice
;
}
else
{
return
105
;
}
}
private
function
devicetime
(
$dete
)
{
$path
=
public_path
()
.
'/device/'
.
$dete
.
'/'
;
if
(
is_file
(
$path
.
'devicelistdata.text'
))
{
$myfile
=
file_get_contents
(
$path
.
'devicelistdata.text'
);
$exp
=
explode
(
"
\n
"
,
$myfile
);
$datadevice
=
[];
foreach
(
array_filter
(
$exp
)
as
$key
=>
$vel
)
{
$newstring
=
str_replace
(
'['
,
''
,
$vel
);
$newstring1
=
str_replace
(
']'
,
''
,
$newstring
);
array_push
(
$datadevice
,
json_decode
(
$newstring1
,
true
));
}
return
$datadevice
;
}
else
{
return
105
;
}
}
}
}
\ No newline at end of file
dump.rdb
View file @
39e053e5
No preview for this file type
public/device/2020-05-14/devicelistdata.text
0 → 100644
View file @
39e053e5
[{"devicenum":"ZHGAS000131031","username":"123214","deviceremark":null,"devicelinkman":"1","devicephone":"16631150870","deviceinfo":null,"tname":"\u5bb6\u7528\u62a5\u8b66\u5668(IOT)","gas":"\u7532\u70f7","danwei":"%LEL","status_name":"\u62a5\u8b66"}]
[{"devicenum":"ZHGAS000131031","username":"123214","deviceremark":null,"devicelinkman":"1","devicephone":"16631150870","deviceinfo":null,"tname":"\u5bb6\u7528\u62a5\u8b66\u5668(IOT)","gas":"\u7532\u70f7","danwei":"%LEL","status_name":"\u4f20\u611f\u5668\u6545\u969c"}]
[{"devicenum":"ZHGAS000131031","username":"123214","deviceremark":null,"devicelinkman":"1","devicephone":"16631150870","deviceinfo":null,"tname":"\u5bb6\u7528\u62a5\u8b66\u5668(IOT)","gas":"\u7532\u70f7","danwei":"%LEL","status_name":"\u9ad8\u62a5"}]
resources/js/api/device.js
View file @
39e053e5
...
@@ -70,3 +70,25 @@ export function delteClassify(id) {
...
@@ -70,3 +70,25 @@ export function delteClassify(id) {
method
:
'get'
,
method
:
'get'
,
});
});
}
}
export
function
equipment
()
{
return
request
({
url
:
'/devices/equipment'
,
method
:
'get'
,
});
}
export
function
detedevice
(
dete
)
{
return
request
({
url
:
'/devices/detedevice?dete='
+
dete
,
method
:
'get'
,
});
}
export
function
police
(
dete
)
{
return
request
({
url
:
'/devices/police'
,
method
:
'get'
,
});
}
resources/js/router/index.js
View file @
39e053e5
...
@@ -13,17 +13,15 @@ Vue.use(Router);
...
@@ -13,17 +13,15 @@ Vue.use(Router);
import
Layout
from
'@/layout'
;
import
Layout
from
'@/layout'
;
/* Router for modules */
/* Router for modules */
import
elementUiRoutes
from
'./modules/element-ui'
;
// import componentRoutes from './modules/components';
import
componentRoutes
from
'./modules/components'
;
// import chartsRoutes from './modules/charts';
import
chartsRoutes
from
'./modules/charts'
;
// import tableRoutes from './modules/table';
import
tableRoutes
from
'./modules/table'
;
import
adminRoutes
from
'./modules/admin'
;
import
adminRoutes
from
'./modules/admin'
;
import
deviceRoutes
from
'./modules/device'
;
import
deviceRoutes
from
'./modules/device'
;
import
usersRoutes
from
'./modules/users'
;
import
usersRoutes
from
'./modules/users'
;
import
nestedRoutes
from
'./modules/nested'
;
// import nestedRoutes from './modules/nested';
import
errorRoutes
from
'./modules/error'
;
// import errorRoutes from './modules/error';
import
excelRoutes
from
'./modules/excel'
;
// import permissionRoutes from './modules/permission';
import
permissionRoutes
from
'./modules/permission'
;
import
historyRoutes
from
'./modules/history.js'
;
import
historyRoutes
from
'./modules/history.js'
;
import
monitorRoutes
from
'./modules/monitor.js'
;
import
monitorRoutes
from
'./modules/monitor.js'
;
...
@@ -119,117 +117,115 @@ export const constantRoutes = [
...
@@ -119,117 +117,115 @@ export const constantRoutes = [
deviceRoutes
,
deviceRoutes
,
usersRoutes
,
usersRoutes
,
adminRoutes
,
adminRoutes
,
{
// {
path
:
'/documentation'
,
// path: '/documentation',
component
:
Layout
,
// component: Layout,
redirect
:
'/documentation/index'
,
// redirect: '/documentation/index',
children
:
[
// children: [
{
// {
path
:
'index'
,
// path: 'index',
component
:
()
=>
import
(
'@/views/documentation/index'
),
// component: () => import('@/views/documentation/index'),
name
:
'Documentation'
,
// name: 'Documentation',
meta
:
{
title
:
'documentation'
,
icon
:
'documentation'
,
noCache
:
true
},
// meta: { title: 'documentation', icon: 'documentation', noCache: true },
},
// },
],
// ],
},
// },
{
// {
path
:
'/guide'
,
// path: '/guide',
component
:
Layout
,
// component: Layout,
redirect
:
'/guide/index'
,
// redirect: '/guide/index',
children
:
[
// children: [
{
// {
path
:
'index'
,
// path: 'index',
component
:
()
=>
import
(
'@/views/guide/index'
),
// component: () => import('@/views/guide/index'),
name
:
'Guide'
,
// name: 'Guide',
meta
:
{
title
:
'guide'
,
icon
:
'guide'
,
noCache
:
true
},
// meta: { title: 'guide', icon: 'guide', noCache: true },
},
// },
],
// ],
},
// },
elementUiRoutes
,
];
];
export
const
asyncRoutes
=
[
export
const
asyncRoutes
=
[
permissionRoutes
,
// permissionRoutes,
componentRoutes
,
// componentRoutes,
chartsRoutes
,
// chartsRoutes,
nestedRoutes
,
// nestedRoutes,
tableRoutes
,
// tableRoutes,
{
// {
path
:
'/theme'
,
// path: '/theme',
component
:
Layout
,
// component: Layout,
redirect
:
'noredirect'
,
// redirect: 'noredirect',
children
:
[
// children: [
{
// {
path
:
'index'
,
// path: 'index',
component
:
()
=>
import
(
'@/views/theme/index'
),
// component: () => import('@/views/theme/index'),
name
:
'Theme'
,
// name: 'Theme',
meta
:
{
title
:
'theme'
,
icon
:
'theme'
},
// meta: { title: 'theme', icon: 'theme' },
},
// },
],
// ],
},
// },
{
// {
path
:
'/clipboard'
,
// path: '/clipboard',
component
:
Layout
,
// component: Layout,
redirect
:
'noredirect'
,
// redirect: 'noredirect',
meta
:
{
permissions
:
[
'view menu clipboard'
]
},
// meta: { permissions: ['view menu clipboard'] },
children
:
[
// children: [
{
// {
path
:
'index'
,
// path: 'index',
component
:
()
=>
import
(
'@/views/clipboard/index'
),
// component: () => import('@/views/clipboard/index'),
name
:
'ClipboardDemo'
,
// name: 'ClipboardDemo',
meta
:
{
title
:
'clipboardDemo'
,
icon
:
'clipboard'
,
roles
:
[
'admin'
,
'manager'
,
'editor'
,
'user'
]
},
// meta: { title: 'clipboardDemo', icon: 'clipboard', roles: ['admin', 'manager', 'editor', 'user'] },
},
// },
],
// ],
},
// },
errorRoutes
,
// errorRoutes,
excelRoutes
,
// {
{
// path: '/zip',
path
:
'/zip'
,
// component: Layout,
component
:
Layout
,
// redirect: '/zip/download',
redirect
:
'/zip/download'
,
// alwaysShow: true,
alwaysShow
:
true
,
// meta: { title: 'zip', icon: 'zip', permissions: ['view menu zip'] },
meta
:
{
title
:
'zip'
,
icon
:
'zip'
,
permissions
:
[
'view menu zip'
]
},
// children: [
children
:
[
// {
{
// path: 'download',
path
:
'download'
,
// component: () => import('@/views/zip'),
component
:
()
=>
import
(
'@/views/zip'
),
// name: 'ExportZip',
name
:
'ExportZip'
,
// meta: { title: 'exportZip' },
meta
:
{
title
:
'exportZip'
},
// },
},
// ],
],
// },
},
// {
{
// path: '/pdf',
path
:
'/pdf'
,
// component: Layout,
component
:
Layout
,
// redirect: '/pdf/index',
redirect
:
'/pdf/index'
,
// meta: { title: 'pdf', icon: 'pdf', permissions: ['view menu pdf'] },
meta
:
{
title
:
'pdf'
,
icon
:
'pdf'
,
permissions
:
[
'view menu pdf'
]
},
// children: [
children
:
[
// {
{
// path: 'index',
path
:
'index'
,
// component: () => import('@/views/pdf'),
component
:
()
=>
import
(
'@/views/pdf'
),
// name: 'Pdf',
name
:
'Pdf'
,
// meta: { title: 'pdf' },
meta
:
{
title
:
'pdf'
},
// },
},
// ],
],
// },
},
// {
{
// path: '/pdf/download',
path
:
'/pdf/download'
,
// component: () => import('@/views/pdf/Download'),
component
:
()
=>
import
(
'@/views/pdf/Download'
),
// hidden: true,
hidden
:
true
,
// },
},
// {
{
// path: '/i18n',
path
:
'/i18n'
,
// component: Layout,
component
:
Layout
,
// meta: { permissions: ['view menu i18n'] },
meta
:
{
permissions
:
[
'view menu i18n'
]
},
// children: [
children
:
[
// {
{
// path: 'index',
path
:
'index'
,
// component: () => import('@/views/i18n'),
component
:
()
=>
import
(
'@/views/i18n'
),
// name: 'I18n',
name
:
'I18n'
,
// meta: { title: 'i18n', icon: 'international' },
meta
:
{
title
:
'i18n'
,
icon
:
'international'
},
// },
},
// ],
],
// },
},
{
path
:
'*'
,
redirect
:
'/404'
,
hidden
:
true
},
{
path
:
'*'
,
redirect
:
'/404'
,
hidden
:
true
},
];
];
...
...
resources/js/router/modules/element-ui.js
View file @
39e053e5
import
Layout
from
'@/layout'
;
import
Layout
from
'@/layout'
;
//
const
elementUiRoutes
=
{
const
elementUiRoutes
=
{
path
:
'/element-ui'
,
path
:
'/element-ui'
,
component
:
Layout
,
component
:
Layout
,
...
...
resources/js/views/documentation/index.vue
deleted
100644 → 0
View file @
203bdf7b
<
template
>
<div
class=
"app-container documentation-container"
>
<a
class=
"document-btn"
target=
"_blank"
href=
"https://laravel.com/docs/5.8"
>
{{
$t
(
'documentation.laravel'
)
}}
</a>
<a
class=
"document-btn"
target=
"_blank"
href=
"https://vuejs.org/"
>
VueJS
</a>
<a
class=
"document-btn"
target=
"_blank"
href=
"https://github.com/tuandm/laravue/"
>
{{
$t
(
'documentation.github'
)
}}
</a>
<dropdown-menu
:items=
"articleList"
style=
"float:left;margin-left:50px;"
title=
"Components"
/>
</div>
</
template
>
<
script
>
import
DropdownMenu
from
'@/components/Share/DropdownMenu'
;
export
default
{
name
:
'Documentation'
,
components
:
{
DropdownMenu
},
data
()
{
return
{
articleList
:
[
{
title
:
'Laravel Envoy'
,
href
:
'https://laravel.com/docs/5.8/envoy'
},
{
title
:
'Vuex'
,
href
:
'https://vuex.vuejs.org/'
},
{
title
:
'Vue Router'
,
href
:
'https://router.vuejs.org/'
},
{
title
:
'laravue-core'
,
href
:
'https://github.com/tuandm/laravue-core'
},
{
title
:
'vue-admin-template'
,
href
:
'https://github.com/PanJiaChen/vue-admin-template'
},
{
title
:
'Axios'
,
href
:
'https://github.com/axios/axios'
},
],
};
},
};
</
script
>
<
style
rel=
"stylesheet/scss"
lang=
"scss"
scoped
>
.documentation-container
{
margin
:
50px
;
.document-btn
{
float
:
left
;
margin-left
:
50px
;
display
:
block
;
cursor
:
pointer
;
background
:
black
;
color
:
white
;
height
:
60px
;
width
:
200px
;
line-height
:
60px
;
font-size
:
20px
;
text-align
:
center
;
}
}
</
style
>
resources/js/views/history/alarms.vue
View file @
39e053e5
<
template
>
<
template
>
<div>
报警记录
</div>
<div
class=
"app-container"
>
<el-table
:key=
"tableKey"
:data=
"reportpolice"
border
fit
highlight-current-rows
>
<el-table-column
label=
"设备编号"
width=
"150"
>
<template
slot-scope=
"scope"
>
<span
@
click=
"handleCopy(scope.row.devicenumber,$event)"
>
{{
scope
.
row
.
devicenumber
}}
</span>
</
template
>
</el-table-column>
<el-table-column
label=
"设备报警开始时间"
width=
"150"
>
<
template
slot-scope=
"scope"
>
<span>
{{
scope
.
row
.
starttime
|
parseTime
(
'{y
}
-{m
}
-{d
}
{h
}
:{i
}
'
)
}}
<
/span
>
<
/template
>
<
/el-table-column
>
<
el
-
table
-
column
label
=
"设备结束报警时间"
width
=
"150"
>
<
template
slot
-
scope
=
"scope"
>
<
span
>
{{
scope
.
row
.
endtime
==
'0-0-0 0:0'
?
''
:
scope
.
row
.
endtime
|
parseTime
(
'{y
}
-{m
}
-{d
}
{h
}
:{i
}
'
)
}}
<
/span
>
<
/template
>
<
/el-table-column
>
<
el
-
table
-
column
label
=
"报警浓度"
width
=
"150"
>
<
template
slot
-
scope
=
"scope"
>
<
span
@
click
=
"handleCopy(scope.row.concentration,$event)"
>
{{
scope
.
row
.
concentration
}}
<
/span
>
<
/template
>
<
/el-table-column
>
<
el
-
table
-
column
label
=
"报警位置"
width
=
"150"
>
<
template
slot
-
scope
=
"scope"
>
<
span
@
click
=
"handleCopy(scope.row.location,$event)"
>
{{
scope
.
row
.
location
}}
<
/span
>
<
/template
>
<
/el-table-column
>
<
el
-
table
-
column
label
=
"报警类型"
width
=
"150"
>
<
template
slot
-
scope
=
"scope"
>
<
span
>
{{
scope
.
row
.
status_name
}}
<
/span
>
<
/template
>
<
/el-table-column
>
<
el
-
table
-
column
label
=
"设备状态"
width
=
"155"
>
<
template
slot
-
scope
=
"scope"
>
<
el
-
tag
:
type
=
"scope.row.status==1 ? 'danger' : 'success' "
effect
=
"dark"
>
{{
scope
.
row
.
status
==
1
?
'报警'
:
'正常'
}}
<
/el-tag
>
<
/template
>
<
/el-table-column
>
<
el
-
table
-
column
label
=
"设备是否当前报警"
width
=
"150"
>
<
template
slot
-
scope
=
"scope"
>
<
el
-
tag
:
type
=
"scope.row.status==1 ? 'danger' : 'success' "
effect
=
"dark"
>
{{
scope
.
row
.
status
==
1
?
'当前正在报警'
:
'已结束报警'
}}
<
/el-tag
>
<
/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
>
<
/div
>
<
/template
>
<
/template
>
<
script
>
<
script
>
import
{
police
}
from
'@/api/device'
;
import
clip
from
'@/utils/clipboard'
;
import
BackToTop
from
'@/components/BackToTop'
;
export
default
{
components
:
{
BackToTop
}
,
data
()
{
return
{
tableKey
:
0
,
reportpolice
:
[],
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
.
police
();
// 列表
}
,
methods
:
{
police
()
{
police
()
.
then
(
response
=>
{
if
(
response
.
code
===
200
)
{
this
.
reportpolice
=
response
.
data
;
}
else
if
(
response
.
code
===
105
)
{
this
.
$message
({
message
:
response
.
msg
,
type
:
'warning'
,
}
);
}
}
)
.
catch
(
err
=>
{
console
.
log
(
err
);
}
);
}
,
handleCopy
(
text
,
event
)
{
clip
(
text
,
event
);
}
,
}
,
}
;
<
/script
>
<
/script
>
<
style
>
<
style
>
...
...
resources/js/views/history/index.vue
View file @
39e053e5
<
template
>
<
template
>
<div>
设备记录
</div>
<div
class=
"app-container"
>
<div
class=
"filter-container"
>
<el-date-picker
v-model=
"value2"
align=
"right"
type=
"date"
placeholder=
"选择日期"
:picker-options=
"pickerOptions"
value-format=
"yyyy-MM-dd"
@
change=
"dataSearch"
></el-date-picker>
</div>
<el-table
:key=
"tableKey"
:data=
"equipment"
border
fit
highlight-current-rows
>
<el-table-column
label=
"设备编号"
width=
"130"
>
<template
slot-scope=
"scope"
>
<span
@
click=
"handleCopy(scope.row.devicenum,$event)"
>
{{
scope
.
row
.
devicenum
}}
</span>
</
template
>
</el-table-column>
<el-table-column
label=
"用户姓名"
width=
"130"
>
<
template
slot-scope=
"scope"
>
<span>
{{
scope
.
row
.
username
}}
</span>
</
template
>
</el-table-column>
<el-table-column
label=
"设备备注"
width=
"130"
>
<
template
slot-scope=
"scope"
>
<span>
{{
scope
.
row
.
deviceremark
}}
</span>
</
template
>
</el-table-column>
<el-table-column
label=
"设备联系人"
width=
"130"
>
<
template
slot-scope=
"scope"
>
<span>
{{
scope
.
row
.
devicelinkman
}}
</span>
</
template
>
</el-table-column>
<el-table-column
label=
"设备手机号"
width=
"130"
>
<
template
slot-scope=
"scope"
>
<span
@
click=
"handleCopy(scope.row.devicephone,$event)"
>
{{
scope
.
row
.
devicephone
}}
</span>
</
template
>
</el-table-column>
<el-table-column
label=
"设备详情"
width=
"130"
>
<
template
slot-scope=
"scope"
>
<span>
{{
scope
.
row
.
deviceinfo
}}
</span>
</
template
>
</el-table-column>
<el-table-column
label=
"设备分类"
width=
"130"
>
<
template
slot-scope=
"scope"
>
<span>
{{
scope
.
row
.
tname
}}
</span>
</
template
>
</el-table-column>
<el-table-column
label=
"设备介质"
width=
"130"
>
<
template
slot-scope=
"scope"
>
<span>
{{
scope
.
row
.
gas
}}
</span>
</
template
>
</el-table-column>
<el-table-column
label=
"设备单位"
width=
"130"
>
<
template
slot-scope=
"scope"
>
<span>
{{
scope
.
row
.
danwei
}}
</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>
<el-tooltip
placement=
"top"
content=
"tooltip"
>
<back-to-top
:custom-style=
"myBackToTopStyle"
:visibility-height=
"300"
:back-position=
"50"
transition-name=
"fade"
/>
</el-tooltip>
</div>
</template>
</template>
<
script
>
<
script
>
import
{
equipment
,
detedevice
}
from
'@/api/device'
;
import
clip
from
'@/utils/clipboard'
;
import
BackToTop
from
'@/components/BackToTop'
;
export
default
{
components
:
{
BackToTop
},
data
()
{
return
{
equipment
:
[],
tableKey
:
0
,
value2
:
undefined
,
pickerOptions
:
{
disabledDate
(
time
)
{
return
time
.
getTime
()
>
Date
.
now
();
},
shortcuts
:
[{
text
:
'今天'
,
onClick
(
picker
)
{
picker
.
$emit
(
'pick'
,
new
Date
());
},
},
{
text
:
'昨天'
,
onClick
(
picker
)
{
const
date
=
new
Date
();
date
.
setTime
(
date
.
getTime
()
-
3600
*
1000
*
24
);
picker
.
$emit
(
'pick'
,
date
);
},
},
{
text
:
'一周前'
,
onClick
(
picker
)
{
const
date
=
new
Date
();
date
.
setTime
(
date
.
getTime
()
-
3600
*
1000
*
24
*
7
);
picker
.
$emit
(
'pick'
,
date
);
},
}],
},
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
.
equipmentlist
();
// 列表
},
methods
:
{
equipmentlist
()
{
equipment
()
.
then
(
response
=>
{
if
(
response
.
code
===
200
)
{
this
.
equipment
=
response
.
data
;
}
else
if
(
response
.
code
===
105
)
{
this
.
$message
({
message
:
response
.
msg
,
type
:
'warning'
,
});
}
})
.
catch
(
err
=>
{
console
.
log
(
err
);
});
},
handleCopy
(
text
,
event
)
{
clip
(
text
,
event
);
},
dataSearch
()
{
detedevice
(
this
.
value2
)
.
then
(
response
=>
{
if
(
response
.
code
===
200
)
{
this
.
equipment
=
response
.
data
;
}
else
if
(
response
.
code
===
105
)
{
this
.
$message
({
message
:
response
.
msg
,
type
:
'warning'
,
});
this
.
equipment
=
response
.
data
;
}
})
.
catch
(
err
=>
{
console
.
log
(
err
);
});
},
},
};
</
script
>
</
script
>
<
style
scoped
lang=
"scss"
>
<
style
>
.placeholder-container
{
ul
{
li
{
margin
:
10px
;
list-style-type
:
none
;
}
}
}
</
style
>
</
style
>
routes/api.php
View file @
39e053e5
...
@@ -80,6 +80,7 @@ Route::group(['middleware'=>'auth:api'],function (){
...
@@ -80,6 +80,7 @@ Route::group(['middleware'=>'auth:api'],function (){
Route
::
get
(
'devices/deviceBasketList'
,
'DevicesController@deviceBasketList'
);
//返回禁用设备和废纸篓设备
Route
::
get
(
'devices/deviceBasketList'
,
'DevicesController@deviceBasketList'
);
//返回禁用设备和废纸篓设备
Route
::
get
(
'devices/addClassify/{data}'
,
'DevicesController@addClassify'
);
//添加分类
Route
::
get
(
'devices/addClassify/{data}'
,
'DevicesController@addClassify'
);
//添加分类
Route
::
get
(
'devices/delteClassify/{id}'
,
'DevicesController@delteClassify'
);
//删除分类
Route
::
get
(
'devices/delteClassify/{id}'
,
'DevicesController@delteClassify'
);
//删除分类
Route
::
get
(
'devices/detedevice'
,
'DevicesController@detedevice'
);
//查看历史数据
});
});
//装维中心
//装维中心
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment