Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
mes-ui
Project
Project
Details
Activity
Releases
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
周远喜
mes-ui
Commits
a54ffcbe
Commit
a54ffcbe
authored
Oct 29, 2020
by
renjintao
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'product' of git.mes123.com:zhouyx/mes-ui into product-rjt
parents
f16103cc
3508cd25
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
43 deletions
+16
-43
dateRange.vue
components/page/dateRange.vue
+16
-43
No files found.
components/page/dateRange.vue
View file @
a54ffcbe
<
template
>
<div
class=
"time-view"
v-if=
"startDate && endDate"
>
<div>
{{
startDate
}}
</div>
<div
class=
"jian-tou"
>
<div>
{{
jg
}}
{{
unit
}}
</div>
</div>
<div>
{{
endDate
}}
</div>
<span>
{{
startDate
}}
</span>
<span
class=
"jian-tou"
>
{{
jg
}}
{{
unit
}}
</span>
<span>
{{
endDate
}}
</span>
</div>
</
template
>
<
script
>
import
dayjs
from
"dayjs"
;
export
default
{
name
:
""
,
data
()
{
return
{
startDate
:
null
,
endDate
:
null
,
unit
:
"
h
"
,
unit
:
"
天
"
,
jg
:
0
,
};
},
...
...
@@ -48,36 +47,12 @@ export default {
methods
:
{
init
(
v
)
{
if
(
v
)
{
this
.
startDate
=
v
[
this
.
start
];
this
.
endDate
=
v
[
this
.
end
];
var
start
=
dayjs
(
v
[
this
.
start
]);
var
end
=
dayjs
(
v
[
this
.
end
]);
this
.
startDate
=
start
.
format
(
"YYYY-MM-DD"
);
this
.
endDate
=
end
.
format
(
"YYYY-MM-DD"
);
this
.
jg
=
end
.
diff
(
start
,
'day'
);
}
this
.
unit
=
this
.
mode
;
var
date1
=
new
Date
(
this
.
startDate
).
getTime
();
//开始时间,时间戳
var
date2
=
new
Date
(
this
.
endDate
).
getTime
();
//结束时间,时间戳
this
.
jg
=
date2
-
date1
;
var
result
=
""
;
var
minute
=
1000
*
60
;
var
hour
=
minute
*
60
;
var
day
=
hour
*
24
;
var
month
=
day
*
30
;
if
(
this
.
jg
<
0
)
return
;
var
monthC
=
this
.
jg
/
month
;
var
weekC
=
this
.
jg
/
(
7
*
day
);
var
dayC
=
this
.
jg
/
day
;
var
hourC
=
this
.
jg
/
hour
;
var
minC
=
this
.
jg
/
minute
;
if
(
this
.
unit
==
"m"
)
{
result
=
""
+
parseInt
(
monthC
);
}
else
if
(
this
.
unit
==
"w"
)
{
result
=
""
+
parseInt
(
weekC
);
}
else
if
(
this
.
unit
==
"d"
)
{
result
=
""
+
parseInt
(
dayC
);
}
else
if
(
this
.
unit
==
"h"
)
{
result
=
""
+
parseInt
(
hourC
);
}
this
.
jg
=
result
;
},
},
watch
:
{
...
...
@@ -92,21 +67,19 @@ export default {
</
script
>
<
style
lang=
"less"
>
.time-view {
// width: 600px;
display: -webkit-flex;
display: flex;
display: inline-block;
.jian-tou {
min-width: 55px;
text-align: center;
margin:
5px;
padding: 0 5px 2px
5px;
background-image: url("../../assets/imgicon/range.png");
background-size: 100%;
background-repeat: no-repeat;
margin-top: 7px
;
div {
margin-top: -13
px;
}
background-position: bottom right
;
// border-bottom: #eee 2px solid;
size: 12
px;
font-weight: bold;
}
}
</
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