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
36278252
Commit
36278252
authored
Jul 30, 2020
by
Administrator
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
实时监测
parent
d58ff614
Pipeline
#106
failed with stages
Changes
8
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
452 additions
and
62 deletions
+452
-62
SwooleCommandController.php
app/Http/Controllers/Auth/SwooleCommandController.php
+84
-20
DevicesController.php
app/Http/Controllers/DevicesController.php
+27
-8
DeviceSeeder.php
database/seeds/DeviceSeeder.php
+42
-0
device.js
resources/js/api/device.js
+2
-2
clipboard.js
resources/js/utils/clipboard.js
+2
-2
chemicals.vue
resources/js/views/monitor/chemicals.vue
+139
-14
fire.vue
resources/js/views/monitor/fire.vue
+152
-15
List.vue
resources/js/views/users/List.vue
+4
-1
No files found.
app/Http/Controllers/Auth/SwooleCommandController.php
View file @
36278252
...
...
@@ -26,73 +26,137 @@ class SwooleCommandController extends Controller
return
$this
->
jsonSuccessData
(
$countdata
);
}
public
function
chemicals
(
$id
)
/**
* 危化监测
* @param $data
* @return false|string
*/
public
function
chemicals
(
$data
)
{
$searchData
=
json_decode
(
$data
,
true
);
$id
=
$searchData
[
'userId'
];
$uid
=
$this
->
parseAbilityAndArgumentsadmin
(
$id
);
$databadevice
=
DB
::
table
(
'device'
);
$where
=
[];
$whereIn
=
[
1
,
5
,
10
];
if
(
!
empty
(
$searchData
[
'deviceNum'
]))
{
$where
[]
=
[
'devicenum'
,
'like'
,
"%
{
$searchData
[
'deviceNum'
]
}
%"
];
}
if
(
!
empty
(
$searchData
[
'deviceName'
]))
{
$where
[]
=
[
'username'
,
'like'
,
"%
{
$searchData
[
'deviceName'
]
}
%"
];
}
if
(
$searchData
[
'deviceType'
]
!=
0
)
{
$whereIn
=
[
$searchData
[
'deviceType'
]];
}
if
(
$searchData
[
'deviceStatus'
]
!=
0
)
{
$where
[]
=
[
'device.devicepolice'
,
'='
,
$searchData
[
'deviceStatus'
]];
}
$limit
=
$searchData
[
'limit'
];
$pagenNum
=
$limit
*
(
$searchData
[
'page'
]
-
1
);
//页数
if
(
$uid
==
1
){
$devicelist
=
$databadevice
->
whereIn
(
'dtype'
,
[
1
,
5
,
10
]
)
$devicelist
=
DB
::
table
(
'device'
)
->
whereIn
(
'dtype'
,
$whereIn
)
->
leftjoin
(
'device_type as dy'
,
"device.dtype"
,
'='
,
'dy.tid'
)
->
leftjoin
(
'gas as g'
,
"device.status"
,
'='
,
'g.id'
)
->
leftjoin
(
'status as p'
,
"device.devicepolice"
,
'='
,
'p.id'
)
->
leftjoin
(
'danwei as dw'
,
'device.devicemonad'
,
'='
,
'dw.id'
)
->
select
(
'dy.tname'
,
'g.gas'
,
'device.*'
,
'p.status_name'
,
'dw.danwei'
)
->
where
(
$where
)
->
offset
(
$pagenNum
)
->
limit
(
$limit
)
->
orderBy
(
'device.id'
,
'desc'
)
->
get
()
->
toArray
();
$count
=
$databadevice
->
whereIn
(
'dtype'
,
[
1
,
5
,
10
])
$count
=
DB
::
table
(
'device'
)
->
whereIn
(
'dtype'
,
$whereIn
)
->
where
(
$where
)
->
count
();
}
else
{
$devicelist
=
$databadevice
->
whereIn
(
'dtype'
,
[
1
,
5
,
10
]
)
$devicelist
=
DB
::
table
(
'device'
)
->
whereIn
(
'dtype'
,
$whereIn
)
->
leftjoin
(
'device_type as dy'
,
"device.dtype"
,
'='
,
'dy.tid'
)
->
leftjoin
(
'gas as g'
,
"device.status"
,
'='
,
'g.id'
)
->
leftjoin
(
'status as p'
,
"device.devicepolice"
,
'='
,
'p.id'
)
->
leftjoin
(
'danwei as dw'
,
'device.devicemonad'
,
'='
,
'dw.id'
)
->
where
(
'device.uid'
,
'='
,
$id
)
->
where
(
$where
)
->
select
(
'dy.tname'
,
'g.gas'
,
'device.*'
,
'p.status_name'
,
'dw.danwei'
)
->
offset
(
$pagenNum
)
->
limit
(
$limit
)
->
orderBy
(
'device.id'
,
'desc'
)
->
get
()
->
toArray
();
$count
=
$databadevice
$count
=
DB
::
table
(
'device'
)
->
where
(
'device.uid'
,
'='
,
$id
)
->
whereIn
(
'dtype'
,
[
1
,
5
,
10
])
->
whereIn
(
'dtype'
,
$whereIn
)
->
where
(
$where
)
->
count
();
}
return
$this
->
jsonSuccessData
([
'devicelist'
=>
$devicelist
,
'count'
=>
$count
]);
}
public
function
fire
(
$id
)
/**
* 消防监测
* @param $data
* @return false|string
*/
public
function
fire
(
$data
)
{
$searchData
=
json_decode
(
$data
,
true
);
$id
=
$searchData
[
'userId'
];
$uid
=
$this
->
parseAbilityAndArgumentsadmin
(
$id
);
$databadevice
=
DB
::
table
(
'device'
);
$where
=
[];
$whereIn
=
[
2
,
4
,
6
,
7
,
8
,
9
,
11
];
if
(
!
empty
(
$searchData
[
'deviceNum'
]))
{
$where
[]
=
[
'devicenum'
,
'like'
,
"%
{
$searchData
[
'deviceNum'
]
}
%"
];
}
if
(
!
empty
(
$searchData
[
'deviceName'
]))
{
$where
[]
=
[
'username'
,
'like'
,
"%
{
$searchData
[
'deviceName'
]
}
%"
];
}
if
(
$searchData
[
'deviceType'
]
!=
0
)
{
$whereIn
=
[
$searchData
[
'deviceType'
]];
}
if
(
$searchData
[
'deviceStatus'
]
!=
0
)
{
$where
[]
=
[
'device.devicepolice'
,
'='
,
$searchData
[
'deviceStatus'
]];
}
$limit
=
$searchData
[
'limit'
];
$pagenNum
=
$limit
*
(
$searchData
[
'page'
]
-
1
);
//页数
if
(
$uid
==
1
){
$devicelist
=
$databadevice
->
whereIn
(
'dtype'
,
[
2
,
4
,
6
,
7
,
8
,
9
,
11
]
)
$devicelist
=
DB
::
table
(
'device'
)
->
whereIn
(
'dtype'
,
$whereIn
)
->
leftjoin
(
'device_type as dy'
,
"device.dtype"
,
'='
,
'dy.tid'
)
->
leftjoin
(
'gas as g'
,
"device.status"
,
'='
,
'g.id'
)
->
leftjoin
(
'status as p'
,
"device.devicepolice"
,
'='
,
'p.id'
)
->
leftjoin
(
'danwei as dw'
,
'device.devicemonad'
,
'='
,
'dw.id'
)
->
select
(
'dy.tname'
,
'g.gas'
,
'device.*'
,
'p.status_name'
,
'dw.danwei'
)
->
where
(
$where
)
->
offset
(
$pagenNum
)
->
limit
(
$limit
)
->
orderBy
(
'device.id'
,
'desc'
)
->
get
()
->
toArray
();
$count
=
$databadevice
->
whereIn
(
'dtype'
,
[
2
,
4
,
6
,
7
,
8
,
9
,
11
])
$count
=
DB
::
table
(
'device'
)
->
whereIn
(
'dtype'
,
$whereIn
)
->
where
(
$where
)
->
count
();
}
else
{
$devicelist
=
$databadevice
->
whereIn
(
'dtype'
,
[
2
,
4
,
6
,
7
,
8
,
9
,
11
]
)
$devicelist
=
DB
::
table
(
'device'
)
->
whereIn
(
'dtype'
,
$whereIn
)
->
leftjoin
(
'device_type as dy'
,
"device.dtype"
,
'='
,
'dy.tid'
)
->
leftjoin
(
'gas as g'
,
"device.status"
,
'='
,
'g.id'
)
->
leftjoin
(
'status as p'
,
"device.devicepolice"
,
'='
,
'p.id'
)
->
leftjoin
(
'danwei as dw'
,
'device.devicemonad'
,
'='
,
'dw.id'
)
->
where
(
'device.uid'
,
'='
,
$id
)
->
where
(
$where
)
->
select
(
'dy.tname'
,
'g.gas'
,
'device.*'
,
'p.status_name'
,
'dw.danwei'
)
->
offset
(
$pagenNum
)
->
limit
(
$limit
)
->
orderBy
(
'device.id'
,
'desc'
)
->
get
()
->
toArray
();
$count
=
$databadevice
$count
=
DB
::
table
(
'device'
)
->
where
(
'device.uid'
,
'='
,
$id
)
->
whereIn
(
'dtype'
,
[
2
,
4
,
6
,
7
,
8
,
9
,
11
])
->
whereIn
(
'dtype'
,
$whereIn
)
->
where
(
$where
)
->
count
();
}
return
$this
->
jsonSuccessData
([
'devicelist'
=>
$devicelist
,
'count'
=>
$count
]);
...
...
app/Http/Controllers/DevicesController.php
View file @
36278252
...
...
@@ -482,8 +482,9 @@ class DevicesController extends Controller
//返回消防监测
public
function
control
(
Request
$request
)
{
$pagenNum
=
$request
->
input
(
'page'
)
-
1
;
//页数
$pagenNum
=
$request
->
input
(
'page'
);
//页数
$limit
=
$request
->
input
(
'limit'
);
$offset
=
$limit
*
(
$pagenNum
-
1
);
$type
=
$request
->
input
(
'type'
);
if
(
$pagenNum
===
''
||
$limit
==
''
||
$type
===
''
)
{
return
$this
->
jsonErrorData
(
105
,
'页数或limit不能为空'
);
...
...
@@ -494,24 +495,40 @@ class DevicesController extends Controller
//返回危化
$wherein
=
[
1
,
5
,
10
];
}
$databadevice
=
DB
::
table
(
'device'
);
$search
=
json_decode
(
$request
->
input
(
'search'
),
true
);
$where
=
[];
if
(
!
empty
(
$search
[
'deviceNum'
]))
{
$where
[]
=
[
'devicenum'
,
'like'
,
"%
{
$search
[
'deviceNum'
]
}
%"
];
}
if
(
!
empty
(
$search
[
'deviceName'
]))
{
$where
[]
=
[
'username'
,
'like'
,
"%
{
$search
[
'deviceName'
]
}
%"
];
}
if
(
$search
[
'deviceType'
]
!=
0
)
{
$wherein
=
[
$search
[
'deviceType'
]];
}
if
(
$search
[
'deviceStatus'
]
!=
0
)
{
$where
[]
=
[
'device.devicepolice'
,
'='
,
$search
[
'deviceStatus'
]];
}
if
(
!
is_null
(
$this
->
isadmin
()))
{
$devicelist
=
$databadevice
$devicelist
=
DB
::
table
(
'device'
)
->
whereIn
(
'dtype'
,
$wherein
)
->
leftjoin
(
'device_type as dy'
,
"device.dtype"
,
'='
,
'dy.tid'
)
->
leftjoin
(
'gas as g'
,
"device.status"
,
'='
,
'g.id'
)
->
leftjoin
(
'status as p'
,
"device.devicepolice"
,
'='
,
'p.id'
)
->
leftjoin
(
'danwei as dw'
,
'device.devicemonad'
,
'='
,
'dw.id'
)
->
select
(
'dy.tname'
,
'g.gas'
,
'device.*'
,
'p.status_name'
,
'dw.danwei'
)
->
where
(
$where
)
->
orderBy
(
'device.id'
,
'desc'
)
->
offset
(
$
pagenNum
)
->
offset
(
$
offset
)
->
limit
(
$limit
)
->
get
()
->
toArray
();
$count
=
$databadevice
$count
=
DB
::
table
(
'device'
)
->
whereIn
(
'dtype'
,
$wherein
)
->
where
(
$where
)
->
count
();
}
else
{
$devicelist
=
$databadevice
$devicelist
=
DB
::
table
(
'device'
)
->
whereIn
(
'dtype'
,
$wherein
)
->
leftjoin
(
'device_type as dy'
,
"device.dtype"
,
'='
,
'dy.tid'
)
->
leftjoin
(
'gas as g'
,
"device.status"
,
'='
,
'g.id'
)
...
...
@@ -519,13 +536,15 @@ class DevicesController extends Controller
->
leftjoin
(
'danwei as dw'
,
'device.devicemonad'
,
'='
,
'dw.id'
)
->
where
(
'device.uid'
,
'='
,
Auth
::
id
())
->
select
(
'dy.tname'
,
'g.gas'
,
'device.*'
,
'p.status_name'
,
'dw.danwei'
)
->
where
(
$where
)
->
orderBy
(
'device.id'
,
'desc'
)
->
offset
(
$
pagenNum
)
->
offset
(
$
offset
)
->
limit
(
$limit
)
->
get
()
->
toArray
();
$count
=
$databadevice
$count
=
DB
::
table
(
'device'
)
->
whereIn
(
'dtype'
,
$wherein
)
->
where
(
'uid'
,
'='
,
Auth
::
id
())
->
where
(
$where
)
->
count
();
}
return
$this
->
jsonSuccessData
([
'devicelist'
=>
$devicelist
,
'count'
=>
$count
]);
...
...
database/seeds/DeviceSeeder.php
0 → 100644
View file @
36278252
<?php
use
Illuminate\Database\Seeder
;
use
Illuminate\Support\Facades\DB
;
use
Illuminate\Support\Facades\Hash
;
use
Illuminate\Support\Str
;
use
Ramsey\Uuid\Uuid
;
class
DeviceSeeder
extends
Seeder
{
/**
* Run the database seeds.
*
* @return void
*/
public
function
run
()
{
for
(
$i
=
0
;
$i
<
100
;
$i
++
)
{
$dtype
=
random_int
(
1
,
11
);
if
(
$dtype
===
3
)
$dtype
=
2
;
DB
::
table
(
'device'
)
->
insert
([
'uid'
=>
1
,
'contactsid'
=>
random_int
(
1
,
7
),
'devicenum'
=>
Str
::
random
(
22
),
'dtype'
=>
$dtype
,
'status'
=>
1
,
'devicemonad'
=>
random_int
(
1
,
8
),
'devicepolice'
=>
random_int
(
1
,
8
),
'deviceuuid'
=>
Uuid
::
uuid1
()
->
toString
(),
'username'
=>
"河北泽宏"
.
random_int
(
1
,
1000
)
.
"号测试设备"
,
'nd'
=>
random_int
(
0
,
1000
),
'deviceremark'
=>
'河北泽宏'
.
$i
,
'devicelinkman'
=>
Str
::
random
(
10
),
'devicephone'
=>
'1883011'
.
random_int
(
1000
,
9999
),
'deviceinfo'
=>
Str
::
random
(
10
),
'devicecoord'
=>
'114.'
.
random_int
(
100000
,
999999
)
.
',38.'
.
random_int
(
100000
,
999999
),
'deviceaddtime'
=>
time
(),
'update_time'
=>
time
(),
]);
}
}
}
resources/js/api/device.js
View file @
36278252
...
...
@@ -107,9 +107,9 @@ export function addUserDevice() {
});
}
export
function
control
(
page
,
limit
,
type
)
{
export
function
control
(
page
,
limit
,
type
,
formData
)
{
return
request
({
url
:
'devices/control?page='
+
page
+
'&limit='
+
limit
+
'&type='
+
type
,
url
:
'devices/control?page='
+
page
+
'&limit='
+
limit
+
'&type='
+
type
+
'&search='
+
JSON
.
stringify
(
formData
)
,
method
:
'get'
,
});
}
...
...
resources/js/utils/clipboard.js
View file @
36278252
...
...
@@ -3,7 +3,7 @@ import Clipboard from 'clipboard';
function
clipboardSuccess
()
{
Vue
.
prototype
.
$message
({
message
:
'
Copy successfully
'
,
message
:
'
复制成功
'
,
type
:
'success'
,
duration
:
1500
,
});
...
...
@@ -11,7 +11,7 @@ function clipboardSuccess() {
function
clipboardError
()
{
Vue
.
prototype
.
$message
({
message
:
'
Copy failed
'
,
message
:
'
复制失败
'
,
type
:
'error'
,
});
}
...
...
resources/js/views/monitor/chemicals.vue
View file @
36278252
<
template
>
<div
class=
"app-container"
>
<el-form
:inline=
"true"
:model=
"formSearch"
class=
"demo-form-inline"
>
<el-form-item
label=
"设备编号"
>
<el-input
v-model=
"formSearch.deviceNum"
placeholder=
"输入完整设备编号"
></el-input>
</el-form-item>
<el-form-item
label=
"设备名称"
>
<el-input
v-model=
"formSearch.deviceName"
placeholder=
"设备名称"
></el-input>
</el-form-item>
<el-form-item
label=
"设备类型"
>
<el-select
v-model=
"formSearch.deviceType"
style=
"margin-left: 20px;"
placeholder=
"请选择"
>
<el-option
v-for=
"item in optionTypes"
:key=
"item.value"
:label=
"item.label"
:value=
"item.value"
>
</el-option>
</el-select>
</el-form-item>
<el-form-item
label=
"状态"
>
<el-select
v-model=
"formSearch.deviceStatus"
style=
"margin-left: 20px;"
placeholder=
"请选择"
>
<el-option
v-for=
"item in optionStatus"
:key=
"item.value"
:label=
"item.label"
:value=
"item.value"
>
</el-option>
</el-select>
</el-form-item>
<el-form-item>
<el-button
type=
"primary"
@
click=
"onSubmit"
>
查询
</el-button>
</el-form-item>
</el-form>
<el-table
:key=
"tableKey"
v-loading=
"loading"
:data=
"device"
border
fit
highlight-current-rows
>
<el-table-column
align=
"center"
label=
"ID"
width=
"80"
>
<template
slot-scope=
"scope"
>
...
...
@@ -11,7 +52,7 @@
<span
@
click=
"handleCopy(scope.row.devicenum,$event)"
>
{{
scope
.
row
.
devicenum
}}
</span>
</
template
>
</el-table-column>
<el-table-column
align=
"center"
label=
"设备名称"
width=
"
17
0"
>
<el-table-column
align=
"center"
label=
"设备名称"
width=
"
20
0"
>
<
template
slot-scope=
"scope"
>
<span>
{{
scope
.
row
.
username
}}
</span>
</
template
>
...
...
@@ -31,7 +72,7 @@
<span>
{{
scope
.
row
.
gas
}}
</span>
</
template
>
</el-table-column>
<el-table-column
align=
"center"
label=
"检测值"
width=
"1
7
0"
>
<el-table-column
align=
"center"
label=
"检测值"
width=
"1
0
0"
>
<
template
slot-scope=
"scope"
>
<span>
{{
scope
.
row
.
nd
}}
</span>
</
template
>
...
...
@@ -41,26 +82,33 @@
<span>
{{
scope
.
row
.
danwei
}}
</span>
</
template
>
</el-table-column>
<el-table-column
align=
"center"
label=
"
设备实时状态"
width=
"17
0"
>
<el-table-column
align=
"center"
label=
"
实时状态"
width=
"12
0"
>
<
template
slot-scope=
"scope"
>
<span>
<el-tag
:type=
" scope.row.status_name=='正常' ? 'success' : 'warning' "
effect=
"dark"
>
{{
scope
.
row
.
status_name
}}
</el-tag>
</span>
</
template
>
</el-table-column>
<el-table-column
align=
"center"
label=
"状态"
width=
"
1
70"
>
<el-table-column
align=
"center"
label=
"状态"
width=
"70"
>
<
template
slot-scope=
"scope"
>
<span
v-if=
"scope.row.status_name=='正常' "
:style=
"
{color:( scope.row.devicestatus==1 ? '#67C23A' : '#F56C6C' )}">
{{
scope
.
row
.
devicestatus
==
1
?
'正常'
:
'
设备
错误'
}}
</span>
<span
v-if=
"scope.row.status_name!='正常' "
:style=
"
{color:( scope.row.status_name=='正常' ? '#67C23A' : '#F56C6C' )}">
{{
scope
.
row
.
status_name
==
'正常'
?
'正常'
:
'
设备
异常'
}}
</span>
<span
v-if=
"scope.row.status_name=='正常' "
:style=
"
{color:( scope.row.devicestatus==1 ? '#67C23A' : '#F56C6C' )}">
{{
scope
.
row
.
devicestatus
==
1
?
'正常'
:
'错误'
}}
</span>
<span
v-if=
"scope.row.status_name!='正常' "
:style=
"
{color:( scope.row.status_name=='正常' ? '#67C23A' : '#F56C6C' )}">
{{
scope
.
row
.
status_name
==
'正常'
?
'正常'
:
'异常'
}}
</span>
</
template
>
</el-table-column>
<el-table-column
align=
"center"
label=
"最后更新时间"
width=
"170"
>
<
template
slot-scope=
"scope"
>
<span
>
{{
scope
.
row
.
update_time
|
parseTime
(
'{y
}
-{m
}
-{d
}
{h
}
:{i
}
'
)
}}
<
/span
>
<span
v-if=
"scope.row.update_time > 0"
>
{{
scope
.
row
.
update_time
|
parseTime
(
'{y
}
-{m
}
-{d
}
{h
}
:{i
}
:{s
}
'
)
}}
<
/span
>
<
/template
>
<
/el-table-column
>
<
/el-table
>
<
pagination
v
-
show
=
"total>0"
:
total
=
"total"
:
page
.
sync
=
"page"
:
limit
.
sync
=
"limit"
@
pagination
=
"devicelist"
/>
<
pagination
v
-
show
=
"total>0"
:
total
=
"total"
:
page
.
sync
=
"formSearch.page"
:
limit
.
sync
=
"formSearch.limit"
:
page
-
sizes
=
"[10,30,80]"
@
pagination
=
"devicelist"
/>
<
/div
>
<
/template
>
...
...
@@ -77,12 +125,84 @@ export default {
tableKey
:
0
,
loading
:
true
,
device
:
[],
page
:
1
,
limit
:
10
,
type
:
2
,
total
:
0
,
paper
:
undefined
,
timer
:
''
,
formSearch
:
{
deviceNum
:
''
,
deviceName
:
''
,
deviceType
:
0
,
deviceStatus
:
0
,
userId
:
0
,
page
:
1
,
limit
:
10
,
}
,
optionStatus
:
[{
value
:
0
,
label
:
'全部'
,
}
,
{
value
:
1
,
label
:
'正常'
,
}
,
{
value
:
2
,
label
:
'错误'
,
}
,
{
value
:
3
,
label
:
'传感器故障'
,
}
,
{
value
:
4
,
label
:
'报警'
,
}
,
{
value
:
5
,
label
:
'低报'
,
}
,
{
value
:
6
,
label
:
'高报'
,
}
,
{
value
:
7
,
label
:
'通信故障'
,
}
,
{
value
:
8
,
label
:
'超量程'
,
}
,
{
value
:
9
,
label
:
'离线'
,
}
,
{
value
:
10
,
label
:
'电量低'
,
}
,
{
value
:
11
,
label
:
'主电故障'
,
}
,
{
value
:
12
,
label
:
'备电故障'
,
}
,
{
value
:
13
,
label
:
'无此节点'
,
}
,
{
value
:
14
,
label
:
'低电压'
,
}
,
{
value
:
15
,
label
:
'故障'
,
}
,
{
value
:
16
,
label
:
'报警联动'
,
}
],
optionTypes
:
[{
value
:
0
,
label
:
'全部'
,
}
,
{
value
:
1
,
label
:
'工业探测器'
,
}
,
{
value
:
5
,
label
:
'压力监测设备'
,
}
,
{
value
:
10
,
label
:
'温度变送器'
,
}
],
}
;
}
,
created
()
{
...
...
@@ -91,11 +211,15 @@ export default {
}
,
methods
:
{
onSubmit
()
{
this
.
formSearch
.
page
=
1
;
this
.
devicelist
();
}
,
devicelist
()
{
const
limit
=
this
.
limit
;
const
page
=
this
.
page
;
const
limit
=
this
.
formSearch
.
limit
;
const
page
=
this
.
formSearch
.
page
;
this
.
loading
=
true
;
control
(
page
,
limit
,
this
.
type
)
control
(
page
,
limit
,
this
.
type
,
this
.
formSearch
)
.
then
(
response
=>
{
var
devicetype
=
response
.
data
[
'devicelist'
];
this
.
device
=
devicetype
;
...
...
@@ -136,7 +260,8 @@ export default {
this
.
total
=
redata
.
data
.
count
;
}
,
websocketsend
(){
// 数据发送
this
.
websock
.
send
(
localStorage
.
getItem
(
'userinfoid'
));
this
.
formSearch
.
userId
=
localStorage
.
getItem
(
'userinfoid'
);
this
.
websock
.
send
(
JSON
.
stringify
(
this
.
formSearch
));
}
,
websocketclose
(
e
){
// 关闭
console
.
log
(
'断开连接'
,
e
);
...
...
resources/js/views/monitor/fire.vue
View file @
36278252
<
template
>
<div
class=
"app-container"
>
<el-form
:inline=
"true"
:model=
"formSearch"
class=
"demo-form-inline"
>
<el-form-item
label=
"设备编号"
>
<el-input
v-model=
"formSearch.deviceNum"
placeholder=
"输入完整设备编号"
></el-input>
</el-form-item>
<el-form-item
label=
"设备名称"
>
<el-input
v-model=
"formSearch.deviceName"
placeholder=
"设备名称"
></el-input>
</el-form-item>
<el-form-item
label=
"设备类型"
>
<el-select
v-model=
"formSearch.deviceType"
style=
"margin-left: 20px;"
placeholder=
"请选择"
>
<el-option
v-for=
"item in optionTypes"
:key=
"item.value"
:label=
"item.label"
:value=
"item.value"
>
</el-option>
</el-select>
</el-form-item>
<el-form-item
label=
"状态"
>
<el-select
v-model=
"formSearch.deviceStatus"
style=
"margin-left: 20px;"
placeholder=
"请选择"
>
<el-option
v-for=
"item in optionStatus"
:key=
"item.value"
:label=
"item.label"
:value=
"item.value"
>
</el-option>
</el-select>
</el-form-item>
<el-form-item>
<el-button
type=
"primary"
@
click=
"onSubmit"
>
查询
</el-button>
</el-form-item>
</el-form>
<el-table
:key=
"tableKey"
v-loading=
"loading"
:data=
"device"
border
fit
highlight-current-rows
>
<el-table-column
align=
"center"
label=
"ID"
width=
"80"
>
<template
slot-scope=
"scope"
>
...
...
@@ -11,7 +52,7 @@
<span
@
click=
"handleCopy(scope.row.devicenum,$event)"
>
{{
scope
.
row
.
devicenum
}}
</span>
</
template
>
</el-table-column>
<el-table-column
align=
"center"
label=
"设备名称"
width=
"
17
0"
>
<el-table-column
align=
"center"
label=
"设备名称"
width=
"
20
0"
>
<
template
slot-scope=
"scope"
>
<span>
{{
scope
.
row
.
username
}}
</span>
</
template
>
...
...
@@ -31,7 +72,7 @@
<span>
{{
scope
.
row
.
gas
}}
</span>
</
template
>
</el-table-column>
<el-table-column
align=
"center"
label=
"检测值"
width=
"1
7
0"
>
<el-table-column
align=
"center"
label=
"检测值"
width=
"1
0
0"
>
<
template
slot-scope=
"scope"
>
<span>
{{
scope
.
row
.
nd
}}
</span>
</
template
>
...
...
@@ -41,26 +82,33 @@
<span>
{{
scope
.
row
.
danwei
}}
</span>
</
template
>
</el-table-column>
<el-table-column
align=
"center"
label=
"
设备实时状态"
width=
"17
0"
>
<el-table-column
align=
"center"
label=
"
实时状态"
width=
"12
0"
>
<
template
slot-scope=
"scope"
>
<span>
<el-tag
:type=
" scope.row.status_name=='正常' ? 'success' : 'warning' "
effect=
"dark"
>
{{
scope
.
row
.
status_name
}}
</el-tag>
</span>
</
template
>
</el-table-column>
<el-table-column
align=
"center"
label=
"状态"
width=
"
1
70"
>
<el-table-column
align=
"center"
label=
"状态"
width=
"70"
>
<
template
slot-scope=
"scope"
>
<span
v-if=
"scope.row.status_name=='正常' "
:style=
"
{color:( scope.row.devicestatus==1 ? '#67C23A' : '#F56C6C' )}">
{{
scope
.
row
.
devicestatus
==
1
?
'正常'
:
'
设备
错误'
}}
</span>
<span
v-if=
"scope.row.status_name!='正常' "
:style=
"
{color:( scope.row.status_name=='正常' ? '#67C23A' : '#F56C6C' )}">
{{
scope
.
row
.
status_name
==
'正常'
?
'正常'
:
'
设备
异常'
}}
</span>
<span
v-if=
"scope.row.status_name=='正常' "
:style=
"
{color:( scope.row.devicestatus==1 ? '#67C23A' : '#F56C6C' )}">
{{
scope
.
row
.
devicestatus
==
1
?
'正常'
:
'错误'
}}
</span>
<span
v-if=
"scope.row.status_name!='正常' "
:style=
"
{color:( scope.row.status_name=='正常' ? '#67C23A' : '#F56C6C' )}">
{{
scope
.
row
.
status_name
==
'正常'
?
'正常'
:
'异常'
}}
</span>
</
template
>
</el-table-column>
<el-table-column
align=
"center"
label=
"最后更新时间"
width=
"170"
>
<
template
slot-scope=
"scope"
>
<span
>
{{
scope
.
row
.
update_time
|
parseTime
(
'{y
}
-{m
}
-{d
}
{h
}
:{i
}
'
)
}}
<
/span
>
<span
v-if=
"scope.row.update_time > 0"
>
{{
scope
.
row
.
update_time
|
parseTime
(
'{y
}
-{m
}
-{d
}
{h
}
:{i
}
:{s
}
'
)
}}
<
/span
>
<
/template
>
<
/el-table-column
>
<
/el-table
>
<
pagination
v
-
show
=
"total>0"
:
total
=
"total"
:
page
.
sync
=
"page"
:
limit
.
sync
=
"limit"
@
pagination
=
"devicelist"
/>
<
pagination
v
-
show
=
"total>0"
:
total
=
"total"
:
page
.
sync
=
"formSearch.page"
:
limit
.
sync
=
"formSearch.limit"
:
page
-
sizes
=
"[10,30,80]"
@
pagination
=
"devicelist"
/>
<
/div
>
<
/template
>
...
...
@@ -77,12 +125,96 @@ export default {
tableKey
:
0
,
loading
:
true
,
device
:
[],
page
:
1
,
limit
:
10
,
type
:
1
,
total
:
0
,
paper
:
undefined
,
timer
:
''
,
formSearch
:
{
deviceNum
:
''
,
deviceName
:
''
,
deviceType
:
0
,
deviceStatus
:
0
,
userId
:
0
,
page
:
1
,
limit
:
10
,
}
,
optionStatus
:
[{
value
:
0
,
label
:
'全部'
,
}
,
{
value
:
1
,
label
:
'正常'
,
}
,
{
value
:
2
,
label
:
'错误'
,
}
,
{
value
:
3
,
label
:
'传感器故障'
,
}
,
{
value
:
4
,
label
:
'报警'
,
}
,
{
value
:
5
,
label
:
'低报'
,
}
,
{
value
:
6
,
label
:
'高报'
,
}
,
{
value
:
7
,
label
:
'通信故障'
,
}
,
{
value
:
8
,
label
:
'超量程'
,
}
,
{
value
:
9
,
label
:
'离线'
,
}
,
{
value
:
10
,
label
:
'电量低'
,
}
,
{
value
:
11
,
label
:
'主电故障'
,
}
,
{
value
:
12
,
label
:
'备电故障'
,
}
,
{
value
:
13
,
label
:
'无此节点'
,
}
,
{
value
:
14
,
label
:
'低电压'
,
}
,
{
value
:
15
,
label
:
'故障'
,
}
,
{
value
:
16
,
label
:
'报警联动'
,
}
],
optionTypes
:
[{
value
:
0
,
label
:
'全部'
,
}
,
{
value
:
2
,
label
:
'家用报警器'
,
}
,
{
value
:
4
,
label
:
'家用报警器(IOT)'
,
}
,
{
value
:
6
,
label
:
'烟雾感应设备'
,
}
,
{
value
:
7
,
label
:
'烟雾感应设备(联通)'
,
}
,
{
value
:
8
,
label
:
'家用报警器(RTU)'
,
}
,
{
value
:
9
,
label
:
'液位探测器'
,
}
,
{
value
:
11
,
label
:
'消防报警及联动设备'
,
}
],
}
;
}
,
created
()
{
...
...
@@ -91,11 +223,15 @@ export default {
}
,
methods
:
{
onSubmit
()
{
this
.
formSearch
.
page
=
1
;
this
.
devicelist
();
}
,
devicelist
()
{
const
limit
=
this
.
limit
;
const
page
=
this
.
page
;
const
limit
=
this
.
formSearch
.
limit
;
const
page
=
this
.
formSearch
.
page
;
this
.
loading
=
true
;
control
(
page
,
limit
,
this
.
type
)
control
(
page
,
limit
,
this
.
type
,
this
.
formSearch
)
.
then
(
response
=>
{
var
devicetype
=
response
.
data
[
'devicelist'
];
this
.
device
=
devicetype
;
...
...
@@ -136,13 +272,14 @@ export default {
this
.
total
=
redata
.
data
.
count
;
}
,
websocketsend
(){
// 数据发送
this
.
websock
.
send
(
localStorage
.
getItem
(
'userinfoid'
));
this
.
formSearch
.
userId
=
localStorage
.
getItem
(
'userinfoid'
);
this
.
websock
.
send
(
JSON
.
stringify
(
this
.
formSearch
));
}
,
websocketclose
(
e
){
// 关闭
console
.
log
(
'断开连接'
,
e
);
this
.
$notify
({
title
:
'警告'
,
message
:
'
消防
监测长连接已断开'
,
message
:
'
危化
监测长连接已断开'
,
type
:
'warning'
,
}
);
clearInterval
(
this
.
timer
);
...
...
resources/js/views/users/List.vue
View file @
36278252
...
...
@@ -89,7 +89,7 @@
</div>
</div>
</el-dialog>
<el-drawer
title=
"添加用户"
:visible
.
sync=
"drawer"
:direction=
"direction"
:before-close=
"handleClose"
>
<el-drawer
title=
"添加用户"
:visible
.
sync=
"drawer"
:direction=
"direction"
:before-close=
"handleClose"
custom-class=
"zl-drawer"
>
<el-card
class=
"box-card"
style=
"height: 20000px;"
>
<div
v-loading=
"userCreating"
class=
"form-container"
>
<el-form
ref=
"userForm"
:rules=
"rules"
:model=
"newUser"
label-position=
"left"
label-width=
"150px"
style=
"max-width: 500px;"
>
...
...
@@ -565,5 +565,8 @@ export default {
.clear-left
{
clear
:
left
;
}
.zl-drawer
.el-drawer__body
{
overflow-y
:
auto
!
important
;
}
}
</
style
>
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