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
ed02aecf
Commit
ed02aecf
authored
Dec 08, 2020
by
Administrator
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
首页统计
parent
0ebd3b5a
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
41 additions
and
3 deletions
+41
-3
HomepageController.php
app/Http/Controllers/HomepageController.php
+21
-2
index.vue
resources/js/views/dashboard/index.vue
+20
-1
No files found.
app/Http/Controllers/HomepageController.php
View file @
ed02aecf
...
@@ -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
()
...
...
resources/js/views/dashboard/index.vue
View file @
ed02aecf
...
@@ -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"
>
...
...
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