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
513b01b1
Commit
513b01b1
authored
May 16, 2022
by
lxm
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat:日期组件
parent
f72527c8
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
85 additions
and
9 deletions
+85
-9
DatePicker.vue
components/DatePicker/DatePicker.vue
+72
-6
index.vue
pages/index/index.vue
+13
-3
No files found.
components/DatePicker/DatePicker.vue
View file @
513b01b1
<
template
>
<view
class=
"timer"
>
<NormalTitle
:elementInfo=
"elementInfo"
></NormalTitle>
<uni-datetime-picker
:type=
"elementInfo.option.dateTime.showTime ? 'datetime' : 'date'"
v-model=
"elementInfo.option.dateTime.date"
/>
<view
class=
"date-wrap"
>
<u-icon
class=
"icon"
name=
"calendar-fill"
></u-icon>
<u-input
placeholder=
"请输入日期"
input-align=
"center"
v-model=
"elementInfo.option.dateTime.date"
type=
"select"
:select-open=
"pickerTime"
:border=
"true"
@
click=
"pickerTime = true"
:custom-style=
"
{color: '#fff'}"
>
</u-input>
</view>
<u-picker
mode=
"time"
v-model=
"pickerTime"
@
confirm=
"timeConfirm"
:default-time=
"elementInfo.option.dateTime.date ? elementInfo.option.dateTime.date : null"
:params=
"elementInfo.option.dateTime.showTime ? timeParams : dateParams"
></u-picker>
</view>
</
template
>
<
script
>
...
...
@@ -18,7 +34,23 @@
},
data
()
{
return
{
dateParams
:
{
year
:
true
,
month
:
true
,
day
:
true
,
hour
:
false
,
minute
:
false
,
second
:
false
},
timeParams
:
{
year
:
true
,
month
:
true
,
day
:
true
,
hour
:
true
,
minute
:
true
,
second
:
true
},
pickerTime
:
false
};
},
onReady
()
{
...
...
@@ -28,7 +60,19 @@
},
methods
:
{
timeConfirm
(
e
){
const
year
=
e
.
year
const
month
=
e
.
month
const
day
=
e
.
day
const
hour
=
e
.
hour
const
minute
=
e
.
minute
const
second
=
e
.
second
const
dateTime
=
`
${
year
}
-
${
month
}
-
${
day
}
${
hour
}
:
${
minute
}
:
${
second
}
`
this
.
$emit
(
'changeDateTime'
,
{
id
:
this
.
elementInfo
.
id
,
time
:
dateTime
})
},
}
}
</
script
>
...
...
@@ -40,5 +84,27 @@
justify-content
:
center
;
width
:
100%
;
color
:
#fff
;
.date-wrap
{
width
:
200px
;
position
:
relative
;
.icon
{
font-size
:
20px
;
position
:
absolute
;
top
:
5px
;
left
:
10px
;
}
.u-input__right-icon
.u-icon--right
.u-icon__icon
{
display
:
none
;
background
:
red
;
}
}
}
</
style
>
<
style
lang=
"scss"
>
/
deep
/
.u-input__right-icon
.u-icon--right
.u-icon__icon
{
display
:
none
;
background
:
red
!
important
;
}
</
style
>
pages/index/index.vue
View file @
513b01b1
...
...
@@ -14,7 +14,7 @@
zIndex: `${element.type == 'NormalTabs' ? 999999 : index + 1}`
}"
>
<DatePicker
v-if=
"element.type == 'DateTimePicker'"
:elementInfo=
"element"
></DatePicker>
<DatePicker
v-if=
"element.type == 'DateTimePicker'"
@
changeDateTime =
"changeDateTime"
:elementInfo=
"element"
></DatePicker>
<!-- 普通柱状图 -->
<NormalBar
v-if=
"element.type == 'NormalBar'"
:elementInfo=
"element"
></NormalBar>
<!-- 普通折线图 -->
...
...
@@ -61,7 +61,7 @@
export
default
{
data
()
{
return
{
reportInfo
:
{},
reportInfo
:
{
},
timename
:
null
,
pageScrollTop
:
0
}
...
...
@@ -141,6 +141,10 @@
clearInterval
(
this
.
timename
)
},
methods
:
{
changeDateTime
({
id
,
time
}){
const
obj
=
this
.
reportInfo
.
list
.
find
(
item
=>
item
.
id
===
id
)
obj
.
option
.
dateTime
.
date
=
time
},
// 日期时间格式化
dateTimeFormat
(
val
){
let
date
=
new
Date
(
val
)
...
...
@@ -210,7 +214,7 @@
async
getReportCharts
()
{
clearInterval
(
this
.
timename
)
const
that
=
this
let
res
=
await
that
.
$u
.
api
.
getReportCharts
({
id
:
'627
4f095460633568801a709
'
})
let
res
=
await
that
.
$u
.
api
.
getReportCharts
({
id
:
'627
87b674606332538b46322
'
})
uni
.
stopPullDownRefresh
()
const
{
Status
,
Result
:
{
info
,
list
}
}
=
res
.
data
if
(
Status
===
'true'
)
{
...
...
@@ -293,4 +297,10 @@
position
:
sticky
;
top
:
0
!
important
;
}
::v-deep
{
.u-input__right-icon--select
{
display
:
none
;
}
}
</
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