Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
E
ec-report-refactor
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
lihuizhen
ec-report-refactor
Commits
8f9fff5e
Commit
8f9fff5e
authored
Feb 17, 2022
by
leon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: real time add data format
parent
f2b97eca
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
69 additions
and
52 deletions
+69
-52
RealTime.vue
components/RealTime/RealTime.vue
+69
-52
No files found.
components/RealTime/RealTime.vue
View file @
8f9fff5e
<
template
>
<
template
>
<view>
<view>
<div
class=
"timer"
>
<div
class=
"timer"
>
<NormalTitle
:elementInfo=
"elementInfo"
></NormalTitle>
<NormalTitle
:elementInfo=
"elementInfo"
></NormalTitle>
<div
<div
:style=
"
{
:style=
"
{
'font-size':`${elementInfo.option.time.textStyle.fontSize}px`,
'font-size':`${elementInfo.option.time.textStyle.fontSize}px`,
'color': elementInfo.option.time.textStyle.color,
'color': elementInfo.option.time.textStyle.color,
'font-weight': elementInfo.option.time.textStyle.fontWeight,
'font-weight': elementInfo.option.time.textStyle.fontWeight,
'text-align': elementInfo.option.time.left,
'text-align': elementInfo.option.time.left,
}">
}"
{{
realTime
}}
>
</div>
{{
realTime
}}
</div>
</div>
</view>
</div>
</
template
>
</view>
</
template
>
<
script
>
import
echartElementData
from
'@/mixins/echartElementData.js'
<
script
>
import
echartElementData
from
'@/mixins/echartElementData.js'
export
default
{
name
:
"BasicText"
,
export
default
{
mixins
:
[
echartElementData
],
name
:
"BasicText"
,
data
()
{
mixins
:
[
echartElementData
],
return
{
data
()
{
realTime
:
''
,
return
{
timer
:
null
realTime
:
''
,
};
timer
:
null
},
};
},
onUnLoad
()
{
clearInterval
(
this
.
timer
)
onUnLoad
()
{
},
clearInterval
(
this
.
timer
)
methods
:
{
},
initChart
()
{
methods
:
{
this
.
timer
=
setInterval
(()
=>
{
initChart
()
{
const
timestamp
=
new
Date
().
getTime
()
this
.
timer
=
setInterval
(()
=>
{
this
.
realTime
=
this
.
$u
.
timeFormat
(
timestamp
,
this
.
getDateFormat
())
this
.
realTime
=
this
.
$u
.
common
.
dateFormat
()
},
1000
)
},
1000
)
},
}
}
// 大屏报表时间格式和uniapp的不一致,需要转换
}
getDateFormat
()
{
</
script
>
const
dateFormat
=
this
.
elementInfo
.
option
.
time
.
dateFormat
if
(
dateFormat
===
"YYYY-MM-DD"
)
{
<
style
lang=
"scss"
scoped
>
return
"yyyy-mm-dd"
.timer
{
}
display
:
flex
;
if
(
dateFormat
===
"YYYY-MM-DD HH:mm"
)
{
flex-flow
:
column
;
return
"yyyy-mm-dd hh:MM"
justify-content
:
center
;
}
width
:
100%
;
if
(
dateFormat
===
"HH:mm"
)
{
color
:
#fff
;
return
"hh:MM"
}
}
if
(
dateFormat
===
"HH:mm:ss"
)
{
return
"hh:MM:ss"
}
return
"yyyy-mm-dd hh:MM:ss"
}
}
}
</
script
>
<
style
lang=
"scss"
scoped
>
.timer
{
display
:
flex
;
flex-flow
:
column
;
justify-content
:
center
;
width
:
100%
;
color
:
#fff
;
}
</
style
>
</
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