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
0604a0c4
Commit
0604a0c4
authored
Dec 11, 2020
by
Administrator
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'release/shutoff_device_user_roles'
parents
cd47bb4f
8c13fcc5
Pipeline
#175
failed with stage
Changes
11
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
354 additions
and
14 deletions
+354
-14
swooleMeTcp.php
app/Console/Commands/swooleMeTcp.php
+10
-6
HomepageController.php
app/Http/Controllers/HomepageController.php
+21
-2
UserController.php
app/Http/Controllers/UserController.php
+15
-2
2020_12_07_132116_add_shut_off_to_device_table.php
...ations/2020_12_07_132116_add_shut_off_to_device_table.php
+34
-0
2020_12_08_155345_create_user_roles_table.php
.../migrations/2020_12_08_155345_create_user_roles_table.php
+32
-0
2020_12_11_134805_add_phone_and_user_role_id_to_users_table.php
...2_11_134805_add_phone_and_user_role_id_to_users_table.php
+34
-0
UserRolesSeeder.php
database/seeds/UserRolesSeeder.php
+22
-0
index.vue
resources/js/views/dashboard/index.vue
+20
-1
index.vue
resources/js/views/map/index.vue
+74
-2
fire.vue
resources/js/views/monitor/fire.vue
+64
-0
index.vue
resources/js/views/user/index.vue
+28
-1
No files found.
app/Console/Commands/swooleMeTcp.php
View file @
0604a0c4
...
@@ -55,10 +55,14 @@ class swooleMeTcp extends Command
...
@@ -55,10 +55,14 @@ 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,SWOOLE_SOCK_TCP | SWOOLE_SSL);
$this
->
tcp
->
addlistener
(
'0.0.0.0'
,
9504
,
SWOOLE_SOCK_TCP
|
SWOOLE_SSL
);
// 添加 TCP端口监听
//// $this->tcp->addlistener('0.0.0.0', 9504, SWOOLE_SOCK_TCP | SWOOLE_SSL); // 添加 TCP端口监听
$this
->
tcp
->
addlistener
(
'0.0.0.0'
,
9505
,
SWOOLE_SOCK_TCP
|
SWOOLE_SSL
);
// 添加 TCP端口监听
//// $this->tcp->addlistener('0.0.0.0', 9505, SWOOLE_SOCK_TCP | SWOOLE_SSL); // 添加 TCP端口监听
$this
->
tcp
->
addlistener
(
'0.0.0.0'
,
9506
,
SWOOLE_SOCK_TCP
|
SWOOLE_SSL
);
// 添加 TCP端口监听
//// $this->tcp->addlistener('0.0.0.0', 9506, SWOOLE_SOCK_TCP | SWOOLE_SSL); // 添加 TCP端口监听
$this
->
tcp
=
new
\swoole_server
(
'0.0.0.0'
,
9503
,
SWOOLE_PROCESS
,
SWOOLE_SOCK_TCP
);
$this
->
tcp
->
addlistener
(
'0.0.0.0'
,
9504
,
SWOOLE_SOCK_TCP
);
// 添加 TCP端口监听
$this
->
tcp
->
addlistener
(
'0.0.0.0'
,
9505
,
SWOOLE_SOCK_TCP
);
// 添加 TCP端口监听
$this
->
tcp
->
addlistener
(
'0.0.0.0'
,
9506
,
SWOOLE_SOCK_TCP
);
// 添加 TCP端口监听
$this
->
tcp
->
set
([
$this
->
tcp
->
set
([
'worker_num'
=>
2
,
//设置启动的 Worker 进程数
'worker_num'
=>
2
,
//设置启动的 Worker 进程数
'max_request'
=>
30
,
//最大任务数
'max_request'
=>
30
,
//最大任务数
...
@@ -67,8 +71,8 @@ class swooleMeTcp extends Command
...
@@ -67,8 +71,8 @@ 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_cert_file' => base_path() . config('app.ssl_cert_file'),
'ssl_key_file'
=>
base_path
()
.
config
(
'app.ssl_key_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
)
{
...
...
app/Http/Controllers/HomepageController.php
View file @
0604a0c4
...
@@ -26,11 +26,30 @@ class HomepageController extends Controller
...
@@ -26,11 +26,30 @@ class HomepageController extends Controller
$usercount
=
Users
::
count
();
$usercount
=
Users
::
count
();
$devicecount
=
Device
::
count
();
$devicecount
=
Device
::
count
();
$devicepolice
=
Device
::
where
(
'devicepolice'
,
'>'
,
'1'
)
->
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
();
//当前时间
$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
();
return
$this
->
jsonSuccessData
([
'usercount'
=>
$usercount
,
'devicecount'
=>
$devicecount
,
'devicepolice'
=>
$devicepolice
,
'timedevicepolice'
=>
$timedevicepolice
]);
return
$this
->
jsonSuccessData
([
'usercount'
=>
$usercount
,
'devicecount'
=>
$devicecount
,
'devicepolice'
=>
$devicepolice
,
'timedevicepolice'
=>
$timedevicepolice
,
'device_online'
=>
$device_online
,
'device_alarm'
=>
$device_alarm
,
'device_normal'
=>
$device_normal
,
'device_offline'
=>
$device_offline
,
'percent_alarm'
=>
number_format
((
$device_alarm
/
$devicecount
)
*
100
,
'2'
),
'percent_online'
=>
number_format
((
$device_online
/
$devicecount
)
*
100
,
'2'
),
]);
}
}
public
function
gettimeline
()
public
function
gettimeline
()
...
@@ -159,4 +178,4 @@ class HomepageController extends Controller
...
@@ -159,4 +178,4 @@ class HomepageController extends Controller
return
$end_time
-
$start_time
;
return
$end_time
-
$start_time
;
}
}
}
}
\ No newline at end of file
app/Http/Controllers/UserController.php
View file @
0604a0c4
...
@@ -280,8 +280,21 @@ class UserController extends Controller
...
@@ -280,8 +280,21 @@ class UserController extends Controller
->
leftjoin
(
'areachina as p'
,
'b.provinceid'
,
'='
,
'p.areaid'
)
->
leftjoin
(
'areachina as p'
,
'b.provinceid'
,
'='
,
'p.areaid'
)
->
leftjoin
(
'areachina as c'
,
'b.cityid'
,
'='
,
'c.areaid'
)
->
leftjoin
(
'areachina as c'
,
'b.cityid'
,
'='
,
'c.areaid'
)
->
leftjoin
(
'areachina as a'
,
'b.areaid'
,
'='
,
'a.areaid'
)
->
leftjoin
(
'areachina as a'
,
'b.areaid'
,
'='
,
'a.areaid'
)
->
leftJoin
(
'user_roles AS ur'
,
'b.user_role_id'
,
'='
,
'ur.id'
)
->
orderBy
(
'b.id'
,
'desc'
)
->
orderBy
(
'b.id'
,
'desc'
)
->
select
(
'b.username'
,
'b.id'
,
'b.created_at'
,
'b.name'
,
'b.email'
,
'b.state'
,
'a.area_name as area'
,
'c.area_name as city'
,
'p.area_name as province'
)
->
select
(
'b.username'
,
'b.id'
,
'b.created_at'
,
'b.name'
,
'b.email'
,
'b.state'
,
'b.phone_number'
,
'ur.name AS role_name'
,
'a.area_name as area'
,
'c.area_name as city'
,
'p.area_name as province'
)
->
offset
(
$pagenNum
)
->
offset
(
$pagenNum
)
->
limit
(
$limit
)
->
limit
(
$limit
)
->
get
();
->
get
();
...
@@ -434,7 +447,7 @@ class UserController extends Controller
...
@@ -434,7 +447,7 @@ class UserController extends Controller
return
$this
->
jsonErrorData
(
105
,
'用户id不能为空'
);
return
$this
->
jsonErrorData
(
105
,
'用户id不能为空'
);
}
}
$userdata
=
Users
::
where
(
'id'
,
'='
,
$userid
)
$userdata
=
Users
::
where
(
'id'
,
'='
,
$userid
)
->
select
(
'username'
,
'name'
,
'email'
,
'title'
,
'company'
,
'mapcenter'
)
->
select
(
'username'
,
'name'
,
'email'
,
'title'
,
'company'
,
'mapcenter'
,
'phone_number'
,
'user_role_id'
)
->
first
();
->
first
();
if
(
$userdata
)
{
if
(
$userdata
)
{
return
$this
->
jsonSuccessData
(
$userdata
);
return
$this
->
jsonSuccessData
(
$userdata
);
...
...
database/migrations/2020_12_07_132116_add_shut_off_to_device_table.php
0 → 100644
View file @
0604a0c4
<?php
use
Illuminate\Database\Migrations\Migration
;
use
Illuminate\Database\Schema\Blueprint
;
use
Illuminate\Support\Facades\Schema
;
class
AddShutOffToDeviceTable
extends
Migration
{
/**
* Run the migrations.
*
* @return void
*/
public
function
up
()
{
Schema
::
table
(
'device'
,
function
(
Blueprint
$table
)
{
$table
->
integer
(
'shutoff_status'
)
->
default
(
0
)
->
comment
(
'切断装置状态,0初始化状态,1开启,2关闭'
);
$table
->
integer
(
'shutoff_type'
)
->
default
(
0
)
->
comment
(
'切断装置类型,0未绑定,1电磁阀,2机械手'
);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public
function
down
()
{
Schema
::
table
(
'device'
,
function
(
Blueprint
$table
)
{
$table
->
dropColumn
(
'shutoff_status'
);
$table
->
dropColumn
(
'shutoff_type'
);
});
}
}
database/migrations/2020_12_08_155345_create_user_roles_table.php
0 → 100644
View file @
0604a0c4
<?php
use
Illuminate\Database\Migrations\Migration
;
use
Illuminate\Database\Schema\Blueprint
;
use
Illuminate\Support\Facades\Schema
;
class
CreateUserRolesTable
extends
Migration
{
/**
* Run the migrations.
*
* @return void
*/
public
function
up
()
{
Schema
::
create
(
'user_roles'
,
function
(
Blueprint
$table
)
{
$table
->
id
();
$table
->
string
(
'name'
)
->
unique
();
$table
->
timestamps
();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public
function
down
()
{
Schema
::
dropIfExists
(
'user_roles'
);
}
}
database/migrations/2020_12_11_134805_add_phone_and_user_role_id_to_users_table.php
0 → 100644
View file @
0604a0c4
<?php
use
Illuminate\Database\Migrations\Migration
;
use
Illuminate\Database\Schema\Blueprint
;
use
Illuminate\Support\Facades\Schema
;
class
AddPhoneAndUserRoleIdToUsersTable
extends
Migration
{
/**
* Run the migrations.
*
* @return void
*/
public
function
up
()
{
Schema
::
table
(
'users'
,
function
(
Blueprint
$table
)
{
$table
->
string
(
'phone_number'
,
11
)
->
default
(
null
)
->
comment
(
'手机号码'
);
$table
->
integer
(
'user_role_id'
)
->
comment
(
'用户角色ID'
);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public
function
down
()
{
Schema
::
table
(
'users'
,
function
(
Blueprint
$table
)
{
$table
->
dropColumn
(
'phone_number'
);
$table
->
dropColumn
(
'user_role_id'
);
});
}
}
database/seeds/UserRolesSeeder.php
0 → 100644
View file @
0604a0c4
<?php
use
Illuminate\Database\Seeder
;
use
Illuminate\Support\Facades\DB
;
class
UserRolesSeeder
extends
Seeder
{
/**
* Run the database seeds.
*
* @return void
*/
public
function
run
()
{
Db
::
table
(
'user_roles'
)
->
insert
([
[
'name'
=>
'行业主管部门负责人'
,
'created_at'
=>
date
(
'Y-m-d H:i:s'
)],
[
'name'
=>
'燃气用户'
,
'created_at'
=>
date
(
'Y-m-d H:i:s'
)],
[
'name'
=>
'应急抢修人员'
,
'created_at'
=>
date
(
'Y-m-d H:i:s'
)],
[
'name'
=>
'村内“两员”'
,
'created_at'
=>
date
(
'Y-m-d H:i:s'
)]
]);
}
}
resources/js/views/dashboard/index.vue
View file @
0604a0c4
...
@@ -8,9 +8,28 @@
...
@@ -8,9 +8,28 @@
<el-row
:gutter=
"20"
>
<el-row
:gutter=
"20"
>
<el-col
:span=
"6"
><el-card
shadow=
"always"
>
用户数量
<span
style=
"margin-left: 12px;color: #606266;"
>
{{
synthesizecount
.
usercount
}}
</span>
个
</el-card></el-col>
<el-col
:span=
"6"
><el-card
shadow=
"always"
>
用户数量
<span
style=
"margin-left: 12px;color: #606266;"
>
{{
synthesizecount
.
usercount
}}
</span>
个
</el-card></el-col>
<el-col
:span=
"6"
><el-card
shadow=
"always"
>
设备数量
<span
style=
"margin-left: 12px;color: #409EFF;"
>
{{
synthesizecount
.
devicecount
}}
</span>
个
</el-card></el-col>
<el-col
:span=
"6"
><el-card
shadow=
"always"
>
设备数量
<span
style=
"margin-left: 12px;color: #409EFF;"
>
{{
synthesizecount
.
devicecount
}}
</span>
个
</el-card></el-col>
<el-col
:span=
"6"
><el-card
shadow=
"always"
>
报警数量
<span
style=
"margin-left: 12px;color: #E6A23C;"
>
{{
synthesizecount
.
devicepolice
}}
</span>
个
</el-card></el-col>
<el-col
:span=
"6"
><el-card
shadow=
"always"
>
在线设备
<span
style=
"margin-left: 12px;color: green;"
>
{{
synthesizecount
.
device_online
}}
</span>
个
</el-card></el-col>
<el-col
:span=
"6"
><el-card
shadow=
"always"
>
报警数量
<span
style=
"margin-left: 12px;color: #e50015;"
>
{{
synthesizecount
.
device_alarm
}}
</span>
个
</el-card></el-col>
<el-col
:span=
"6"
><el-card
shadow=
"always"
>
未报警数量
<span
style=
"margin-left: 12px;color: green;"
>
{{
synthesizecount
.
device_normal
}}
</span>
个
</el-card></el-col>
<el-col
:span=
"6"
><el-card
shadow=
"always"
>
设备故障
<span
style=
"margin-left: 12px;color: #5d5f5f;"
>
{{
synthesizecount
.
device_offline
}}
</span>
个
</el-card></el-col>
<el-col
:span=
"6"
><el-card
shadow=
"always"
>
今天报警次数
<span
style=
"margin-left: 12px;color: #F56C6C;"
>
{{
synthesizecount
.
timedevicepolice
}}
</span>
个
</el-card></el-col>
<el-col
:span=
"6"
><el-card
shadow=
"always"
>
今天报警次数
<span
style=
"margin-left: 12px;color: #F56C6C;"
>
{{
synthesizecount
.
timedevicepolice
}}
</span>
个
</el-card></el-col>
</el-row>
</el-row>
<el-row>
<el-card
class=
"box-card"
style=
"margin-top:12px;height: 200px;"
>
<div
style=
"display: inline-block;"
>
<el-progress
type=
"dashboard"
:percentage=
"synthesizecount.percent_alarm"
color=
"red"
></el-progress>
<el-tooltip
class=
"item"
effect=
"red"
:content=
"synthesizecount.percent_alarm + '%'"
placement=
"top-start"
>
<span
style=
"position: relative;left: -115px;top: 12px;"
>
当前报警率
</span>
</el-tooltip>
</div>
<div
style=
"display: inline-block;"
>
<el-progress
type=
"dashboard"
:percentage=
"synthesizecount.percent_online"
color=
"green"
></el-progress>
<el-tooltip
class=
"item"
effect=
"green"
:content=
"synthesizecount.percent_online + '%'"
placement=
"top-start"
>
<span
style=
"position: relative;left: -108px;top: 12px;"
>
设备在线率
</span>
</el-tooltip>
</div>
</el-card>
</el-row>
</div>
</div>
<!-- 混合统计 -->
<!-- 混合统计 -->
<el-card
class=
"box-card"
style=
"margin-top:12px;padding-bottom:24px"
>
<el-card
class=
"box-card"
style=
"margin-top:12px;padding-bottom:24px"
>
...
...
resources/js/views/map/index.vue
View file @
0604a0c4
...
@@ -54,7 +54,7 @@
...
@@ -54,7 +54,7 @@
<el-dialog
<el-dialog
:title=
"dialogTitle"
:title=
"dialogTitle"
:visible
.
sync=
"dialogTableVisible"
:visible
.
sync=
"dialogTableVisible"
width=
"
2
0%"
width=
"
4
0%"
:modal=
"false"
:modal=
"false"
custom-class=
"zero-dialog"
custom-class=
"zero-dialog"
>
>
...
@@ -70,7 +70,7 @@
...
@@ -70,7 +70,7 @@
<template
slot=
"title"
>
<template
slot=
"title"
>
设备列表 -
{{
leftDeviceName
}}
设备列表 -
{{
leftDeviceName
}}
</
template
>
</
template
>
<el-table
:data=
"markersDevice"
style=
"100%"
max-height=
"700"
>
<el-table
:data=
"markersDevice"
style=
"100%"
max-height=
"700"
@
row-click=
"openDeviceBox"
>
<el-table-column
property=
"devicenum"
label=
"设备编号"
width=
"200px"
></el-table-column>
<el-table-column
property=
"devicenum"
label=
"设备编号"
width=
"200px"
></el-table-column>
<el-table-column
property=
"deviceinfo"
label=
"位置"
width=
"200px"
></el-table-column>
<el-table-column
property=
"deviceinfo"
label=
"位置"
width=
"200px"
></el-table-column>
<el-table-column
property=
"nd"
label=
"值"
width=
"40px"
></el-table-column>
<el-table-column
property=
"nd"
label=
"值"
width=
"40px"
></el-table-column>
...
@@ -184,6 +184,7 @@ export default {
...
@@ -184,6 +184,7 @@ export default {
data
(){
data
(){
const
_this
=
this
;
const
_this
=
this
;
return
{
return
{
intervalId
:
null
,
map
:
{},
map
:
{},
amapManager
:
new
AMapManager
(),
amapManager
:
new
AMapManager
(),
zoom
:
6
,
zoom
:
6
,
...
@@ -247,10 +248,17 @@ export default {
...
@@ -247,10 +248,17 @@ export default {
.
then
(
res
=>
{
.
then
(
res
=>
{
this
.
markersDevice
=
res
.
data
;
this
.
markersDevice
=
res
.
data
;
});
});
this
.
dataRefresh
();
},
destroyed
(){
// 在页面销毁后,清除计时器
this
.
clearIntv
();
},
},
methods
:
{
methods
:
{
checkPermission
,
checkPermission
,
allDevices
()
{
allDevices
()
{
this
.
clearIntv
();
this
.
dataRefresh
();
devices
()
devices
()
.
then
(
res
=>
{
.
then
(
res
=>
{
this
.
leftDeviceName
=
'全部设备'
;
this
.
leftDeviceName
=
'全部设备'
;
...
@@ -290,10 +298,13 @@ export default {
...
@@ -290,10 +298,13 @@ export default {
},
},
// 获取单个用户下的设备
// 获取单个用户下的设备
getUserDeviceList
(
uid
)
{
getUserDeviceList
(
uid
)
{
// 停止定时器
this
.
clearIntv
();
devices
({
uid
:
uid
})
devices
({
uid
:
uid
})
.
then
(
res
=>
{
.
then
(
res
=>
{
this
.
markersDevice
=
res
.
data
;
this
.
markersDevice
=
res
.
data
;
});
});
this
.
dataRefresh
(
uid
);
},
},
// 获取设备详细信息
// 获取设备详细信息
getUserDeviceInfo
(
id
)
{
getUserDeviceInfo
(
id
)
{
...
@@ -322,6 +333,14 @@ export default {
...
@@ -322,6 +333,14 @@ export default {
title
:
'检测介质'
,
title
:
'检测介质'
,
content
:
deviceInfo
.
gas
,
content
:
deviceInfo
.
gas
,
},
},
{
title
:
'切断装置'
,
content
:
this
.
shutoffDevice
(
deviceInfo
.
shutoff_type
),
},
{
title
:
'切断装置状态'
,
content
:
this
.
shutoffStatus
(
deviceInfo
.
shutoff_status
),
},
{
{
title
:
'状态'
,
title
:
'状态'
,
content
:
deviceInfo
.
status_name
,
content
:
deviceInfo
.
status_name
,
...
@@ -341,6 +360,59 @@ export default {
...
@@ -341,6 +360,59 @@ export default {
];
];
});
});
},
},
// 切断装置
shutoffDevice
(
id
)
{
const
shutoff_types
=
[];
shutoff_types
[
0
]
=
'未绑定'
;
shutoff_types
[
1
]
=
'电磁阀'
;
shutoff_types
[
2
]
=
'机械手'
;
return
shutoff_types
[
id
];
},
shutoffStatus
(
id
)
{
const
shutoff
=
[];
shutoff
[
0
]
=
'初始化'
;
shutoff
[
1
]
=
'开启'
;
shutoff
[
2
]
=
'关闭'
;
return
shutoff
[
id
];
},
openDeviceBox
(
row
,
column
,
event
)
{
this
.
getUserDeviceInfo
(
row
.
id
);
},
// 定时刷新数据
dataRefresh
(
uid
=
null
)
{
// 计时器正在进行中,退出函数
if
(
this
.
intervalId
!=
null
)
{
return
;
}
// 计时器为空,操作
this
.
intervalId
=
setInterval
(()
=>
{
console
.
log
(
'刷新'
+
uid
+
'--'
+
new
Date
());
if
(
uid
>
0
)
{
users
({
uid
:
uid
})
.
then
(
res
=>
{
this
.
markers
=
res
.
data
;
});
devices
({
uid
:
uid
})
.
then
(
res
=>
{
this
.
markersDevice
=
res
.
data
;
});
}
else
{
users
()
.
then
(
res
=>
{
this
.
markers
=
res
.
data
;
});
devices
({})
.
then
(
res
=>
{
this
.
markersDevice
=
res
.
data
;
});
}
},
3000
);
},
// 停止定时器
clearIntv
()
{
clearInterval
(
this
.
intervalId
);
// 清除计时器
this
.
intervalId
=
null
;
// 设置为null
},
},
},
};
};
</
script
>
</
script
>
...
...
resources/js/views/monitor/fire.vue
View file @
0604a0c4
...
@@ -40,6 +40,11 @@
...
@@ -40,6 +40,11 @@
<el-form-item>
<el-form-item>
<el-button
type=
"primary"
@
click=
"onSubmit"
>
查询
</el-button>
<el-button
type=
"primary"
@
click=
"onSubmit"
>
查询
</el-button>
</el-form-item>
</el-form-item>
<el-form-item>
<el-button
v-if=
"device != '' "
v-waves
:loading=
"downloadLoading"
class=
"filter-item"
type=
"primary"
icon=
"el-icon-download"
@
click=
"handleDownload"
>
{{
$t
(
'table.export'
)
}}
</el-button>
</el-form-item>
</el-form>
</el-form>
<el-table
:key=
"tableKey"
v-loading=
"loading"
:data=
"device"
border
fit
highlight-current-rows
>
<el-table
:key=
"tableKey"
v-loading=
"loading"
:data=
"device"
border
fit
highlight-current-rows
>
<el-table-column
align=
"center"
label=
"ID"
width=
"80"
>
<el-table-column
align=
"center"
label=
"ID"
width=
"80"
>
...
@@ -72,6 +77,11 @@
...
@@ -72,6 +77,11 @@
<span>
{{
scope
.
row
.
gas
}}
</span>
<span>
{{
scope
.
row
.
gas
}}
</span>
</
template
>
</
template
>
</el-table-column>
</el-table-column>
<el-table-column
align=
"center"
label=
"切断装置"
width=
"170"
>
<
template
slot-scope=
"scope"
>
<span>
{{
shutoffDevice
(
scope
.
row
.
shutoff_type
)
}}
</span>
</
template
>
</el-table-column>
<el-table-column
align=
"center"
label=
"检测值"
width=
"100"
>
<el-table-column
align=
"center"
label=
"检测值"
width=
"100"
>
<
template
slot-scope=
"scope"
>
<
template
slot-scope=
"scope"
>
<span>
{{
scope
.
row
.
nd
}}
</span>
<span>
{{
scope
.
row
.
nd
}}
</span>
...
@@ -82,6 +92,13 @@
...
@@ -82,6 +92,13 @@
<span>
{{
scope
.
row
.
danwei
}}
</span>
<span>
{{
scope
.
row
.
danwei
}}
</span>
</
template
>
</
template
>
</el-table-column>
</el-table-column>
<el-table-column
align=
"center"
label=
"切断装置状态"
width=
"120"
>
<
template
slot-scope=
"scope"
>
<span>
<el-tag
:type=
" scope.row.shutoff_status==1 ? 'success' : 'warning' "
effect=
"dark"
>
{{
shutoffStatus
(
scope
.
row
.
shutoff_status
)
}}
</el-tag>
</span>
</
template
>
</el-table-column>
<el-table-column
align=
"center"
label=
"实时状态"
width=
"120"
>
<el-table-column
align=
"center"
label=
"实时状态"
width=
"120"
>
<
template
slot-scope=
"scope"
>
<
template
slot-scope=
"scope"
>
<span>
<span>
...
@@ -117,11 +134,15 @@ import { control } from '@/api/device';
...
@@ -117,11 +134,15 @@ import { control } from '@/api/device';
import
Pagination
from
'@/components/Pagination'
;
// 分页
import
Pagination
from
'@/components/Pagination'
;
// 分页
import
websocketurl
from
'@/api/configurl'
;
import
websocketurl
from
'@/api/configurl'
;
import
clip
from
'@/utils/clipboard'
;
import
clip
from
'@/utils/clipboard'
;
import
waves
from
'@/directive/waves'
;
// 水波纹效果
import
{
parseTime
}
from
'@/utils'
;
export
default
{
export
default
{
name
:
'Devicetype'
,
name
:
'Devicetype'
,
directives
:
{
waves
}
,
components
:
{
Pagination
}
,
components
:
{
Pagination
}
,
data
()
{
data
()
{
return
{
return
{
downloadLoading
:
false
,
tableKey
:
0
,
tableKey
:
0
,
loading
:
true
,
loading
:
true
,
device
:
[],
device
:
[],
...
@@ -223,6 +244,21 @@ export default {
...
@@ -223,6 +244,21 @@ export default {
}
,
}
,
methods
:
{
methods
:
{
// 切断装置
shutoffDevice
(
id
)
{
const
shutoff_types
=
[];
shutoff_types
[
0
]
=
'未绑定'
;
shutoff_types
[
1
]
=
'电磁阀'
;
shutoff_types
[
2
]
=
'机械手'
;
return
shutoff_types
[
id
];
}
,
shutoffStatus
(
id
)
{
const
shutoff
=
[];
shutoff
[
0
]
=
'初始化'
;
shutoff
[
1
]
=
'开启'
;
shutoff
[
2
]
=
'关闭'
;
return
shutoff
[
id
];
}
,
onSubmit
()
{
onSubmit
()
{
this
.
formSearch
.
page
=
1
;
this
.
formSearch
.
page
=
1
;
this
.
devicelist
();
this
.
devicelist
();
...
@@ -294,6 +330,34 @@ export default {
...
@@ -294,6 +330,34 @@ export default {
handleCopyphone
(
text
,
event
){
handleCopyphone
(
text
,
event
){
clip
(
text
,
event
);
clip
(
text
,
event
);
}
,
}
,
// 导出到excel
handleDownload
()
{
this
.
downloadLoading
=
true
;
import
(
'@/vendor/Export2Excel'
).
then
(
excel
=>
{
const
tHeader
=
[
'ID'
,
'设备编号'
,
'设备名称'
,
'设备详情'
,
'设备类型'
,
'检测介质'
,
'切断装置'
,
'单位'
,
'切断装置状态'
,
'实时状态'
,
'最后更新时间'
];
const
filterVal
=
[
'id'
,
'devicenum'
,
'username'
,
'deviceinfo'
,
'tname'
,
'gas'
,
'shutoff_type'
,
'danwei'
,
'shutoff_status'
,
'status_name'
,
'update_time'
];
const
data
=
this
.
formatJson
(
filterVal
,
this
.
device
);
excel
.
export_json_to_excel
({
header
:
tHeader
,
data
,
filename
:
'消防监测'
,
}
);
this
.
downloadLoading
=
false
;
}
);
}
,
formatJson
(
filterVal
,
jsonData
)
{
return
jsonData
.
map
(
v
=>
filterVal
.
map
(
j
=>
{
if
(
j
===
'shutoff_type'
)
{
return
this
.
shutoffDevice
(
v
[
j
]);
}
else
if
(
j
===
'shutoff_status'
)
{
return
this
.
shutoffStatus
(
v
[
j
]);
}
else
if
(
j
===
'update_time'
)
{
return
parseTime
(
v
[
j
]);
}
else
{
return
v
[
j
];
}
}
));
}
,
}
,
}
,
}
;
}
;
<
/script
>
<
/script
>
...
...
resources/js/views/user/index.vue
View file @
0604a0c4
...
@@ -47,7 +47,17 @@
...
@@ -47,7 +47,17 @@
</el-table-column>
</el-table-column>
<el-table-column
align=
"center"
label=
"用户地址"
width=
"340"
>
<el-table-column
align=
"center"
label=
"用户地址"
width=
"340"
>
<
template
slot-scope=
"scope"
>
<
template
slot-scope=
"scope"
>
<span>
{{
scope
.
row
.
province
}}
-
{{
scope
.
row
.
area
}}
-
{{
scope
.
row
.
city
}}
</span>
<span>
{{
scope
.
row
.
province
}}
<br>
{{
scope
.
row
.
area
}}
<br>
{{
scope
.
row
.
city
}}
</span>
</
template
>
</el-table-column>
<el-table-column
align=
"center"
label=
"手机号"
>
<
template
slot-scope=
"scope"
>
<span>
{{
scope
.
row
.
phone_number
}}
</span>
</
template
>
</el-table-column>
<el-table-column
align=
"center"
label=
"角色"
>
<
template
slot-scope=
"scope"
>
<span>
{{
scope
.
row
.
role_name
}}
</span>
</
template
>
</
template
>
</el-table-column>
</el-table-column>
<el-table-column
align=
"center"
label=
"创建时间"
width=
"170"
>
<el-table-column
align=
"center"
label=
"创建时间"
width=
"170"
>
...
@@ -87,6 +97,14 @@
...
@@ -87,6 +97,14 @@
<
el
-
form
-
item
label
=
"邮箱"
prop
=
"email"
>
<
el
-
form
-
item
label
=
"邮箱"
prop
=
"email"
>
<
el
-
input
v
-
model
.
number
=
"upUserData.email"
><
/el-input
>
<
el
-
input
v
-
model
.
number
=
"upUserData.email"
><
/el-input
>
<
/el-form-item
>
<
/el-form-item
>
<
el
-
form
-
item
label
=
"手机号"
prop
=
"phone_number"
>
<
el
-
input
v
-
model
.
number
=
"upUserData.phone_number"
><
/el-input
>
<
/el-form-item
>
<
el
-
form
-
item
label
=
"角色"
prop
=
"user_role"
>
<
el
-
select
v
-
model
=
"upUserData.user_role_id"
clearable
class
=
"filter-item"
@
change
=
"selectOne"
>
<
el
-
option
v
-
for
=
"item in user_roles"
:
key
=
"item.id"
:
label
=
"item.name"
:
value
=
"item.id"
/>
<
/el-select
>
<
/el-form-item
>
<
el
-
form
-
item
label
=
"自定义标题"
prop
=
"title"
>
<
el
-
form
-
item
label
=
"自定义标题"
prop
=
"title"
>
<
el
-
input
v
-
model
.
number
=
"upUserData.title"
><
/el-input
>
<
el
-
input
v
-
model
.
number
=
"upUserData.title"
><
/el-input
>
<
/el-form-item
>
<
/el-form-item
>
...
@@ -133,8 +151,16 @@ export default {
...
@@ -133,8 +151,16 @@ export default {
email
:
undefined
,
email
:
undefined
,
company
:
undefined
,
company
:
undefined
,
userid
:
undefined
,
userid
:
undefined
,
phone_number
:
undefined
,
user_role_id
:
undefined
,
}
,
}
,
paper
:
undefined
,
paper
:
undefined
,
user_roles
:
[
{
id
:
1
,
name
:
'行业主管部门负责人'
}
,
{
id
:
2
,
name
:
'燃气用户'
}
,
{
id
:
3
,
name
:
'应急抢修人员'
}
,
{
id
:
4
,
name
:
'村内“两员”'
}
,
],
}
;
}
;
}
,
}
,
created
()
{
created
()
{
...
@@ -280,6 +306,7 @@ export default {
...
@@ -280,6 +306,7 @@ 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
)
{
...
...
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