Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
account-book
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
刘文虎
account-book
Commits
ee1b64c3
Commit
ee1b64c3
authored
Apr 25, 2023
by
Facius
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 记工多选日期
parent
86433421
Pipeline
#5486
canceled with stages
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
142 additions
and
28 deletions
+142
-28
calendar-popup.vue
components/calendar-popup/calendar-popup.vue
+31
-3
create.vue
pages/workpoint/workpoint-create/create.vue
+34
-7
lunc-calendar.vue
.../lunc-calendar/components/lunc-calendar/lunc-calendar.vue
+77
-18
No files found.
components/calendar-popup/calendar-popup.vue
View file @
ee1b64c3
...
...
@@ -3,6 +3,7 @@
<view
class=
"calendar-popup"
>
<view
class=
"calendar-popup-top"
>
<text
class=
"calendar-popup-top-left"
@
click=
"close"
>
取消
</text>
<text
class=
"calendar-popup-top-middle"
v-if=
"isDateRange"
>
选择日期(已选
{{
this
.
defaultDate
.
length
}}
天)
</text>
<text
class=
"calendar-popup-top-right"
@
click=
"confirm"
>
确定
</text>
</view>
<lunc-calendar
...
...
@@ -12,6 +13,7 @@
:shouChangeBtn=
"true"
firstDayOfWeek=
"sunday"
:weekend=
"true"
:type=
"type"
@
dayChange=
"dayChange"
></lunc-calendar>
</view>
...
...
@@ -28,14 +30,24 @@ export default {
default
:
()
=>
{
return
parseTime
(
new
Date
(),
'{y}-{m}-{d}'
);
}
},
// date 单选;daterange 多选
type
:
{
type
:
String
,
default
:
'date'
}
},
data
()
{
return
{
show
:
false
,
defaultDate
:
parseTime
(
new
Date
(),
'{y}-{m}-{d}'
)
defaultDate
:
[
parseTime
(
new
Date
(),
'{y}-{m}-{d}'
)],
};
},
computed
:
{
isDateRange
()
{
return
this
.
type
==
'daterange'
}
},
mounted
()
{
// this.defaultDate=this.date
// this.$refs['lunc-calendar'].init(this.date);
...
...
@@ -51,12 +63,20 @@ export default {
this
.
show
=
false
;
},
confirm
()
{
this
.
$emit
(
'confirm'
,
this
.
defaultDate
);
this
.
$emit
(
'confirm'
,
this
.
isDateRange
?
this
.
defaultDate
:
this
.
defaultDate
[
0
]
);
this
.
close
();
},
dayChange
(
e
)
{
console
.
log
(
'dayChange'
,
e
);
this
.
defaultDate
=
e
.
date
;
if
(
this
.
isDateRange
)
{
var
array
=
[]
for
(
var
item
of
e
)
{
array
.
push
(
item
.
date
)
}
this
.
defaultDate
=
array
;
}
else
{
this
.
defaultDate
=
[
e
.
date
];
}
}
}
};
...
...
@@ -73,11 +93,19 @@ export default {
justify-content
:
space-between
;
&
-left
{
color
:
rgb
(
96
,
98
,
102
);
flex-shrink
:
0
;
}
&
-middle
{
flex
:
1
;
color
:
#333333
;
font-weight
:
bold
;
text-align
:
center
;
}
&
-right
{
color
:
rgb
(
41
,
121
,
255
);
&
:active
{
opacity
:
0
.7
;
flex-shrink
:
0
;
}
}
}
...
...
pages/workpoint/workpoint-create/create.vue
View file @
ee1b64c3
...
...
@@ -12,7 +12,7 @@
</view>
</view>
</u-form-item>
<u-form-item
label=
"日期"
prop=
"happenTime"
required
>
<u-form-item
label=
"日期"
v-if=
"!isDateRange"
prop=
"happenTime"
required
>
<view
class=
"right-view"
>
<view
class=
"date-view"
hover-class=
"u-hover-class"
@
click=
"handleClickShowDateRange"
>
<view
class=
"date-text"
v-if=
"form.happenTime"
>
{{
resetHappenTime
(
form
.
happenTime
)
}}
</view>
...
...
@@ -21,7 +21,15 @@
</view>
</view>
</u-form-item>
<u-form-item
label=
"日期(可多选)"
v-else
prop=
"dateRange"
required
>
<view
class=
"right-view"
>
<view
class=
"date-view"
hover-class=
"u-hover-class"
@
click=
"handleClickShowDateRange"
>
<view
class=
"date-text"
v-if=
"form.dateRange.length"
>
{{
form
.
dateRange
.
length
>
1
?
`已选${form.dateRange.length
}
天`
:
resetHappenTime
(
form
.
dateRange
[
0
])
}}
<
/view
>
<
view
class
=
"placeholder"
v
-
else
>
选择服务日期
<
/view
>
<
view
class
=
"image-view"
><
image
:
src
=
"dateImage"
><
/image></
view
>
<
/view
>
<
/view
>
<
/u-form-item
>
<
u
-
form
-
item
label
=
"成员"
:
border
-
bottom
=
"false"
prop
=
"memberId"
required
>
<
view
class
=
"right-view"
v
-
if
=
"recordId"
>
<
text
class
=
"placeholder"
>
{{
form
.
memberName
}}
<
/text
>
...
...
@@ -242,7 +250,7 @@
<
view
class
=
"loading-view"
v
-
if
=
"loading"
><
u
-
loading
mode
=
"flower"
><
/u-loading></
view
>
<
u
-
toast
ref
=
"uToast"
/>
<!--
日历
-->
<calendar-popup
:
date=
"form.happenTime
"
ref=
"calendar-popup"
@
confirm=
"calendarChange"
></calendar-popup>
<
calendar
-
popup
:
type
=
"dateType"
:
date
=
"selectedDates
"
ref
=
"calendar-popup"
@
confirm
=
"calendarChange"
><
/calendar-popup
>
<
unit
-
popup
ref
=
"unit-popup"
:
options
=
"unitOptions"
:
unit
=
"form.unit"
@
change
=
"handleChangeUnit"
><
/unit-popup
>
<
u
-
select
v
-
if
=
"selectShow"
...
...
@@ -341,6 +349,7 @@ export default {
form
:
{
projectId
:
''
,
projectName
:
''
,
dateRange
:
[
this
.
resetHappenTime
(
new
Date
())],
happenTime
:
this
.
resetHappenTime
(
new
Date
()),
memberId
:
[],
remark
:
''
,
...
...
@@ -464,7 +473,8 @@ export default {
path
:
'workpoint'
,
notification
:
'workpoint-create-remark'
,
memberId
:
''
,
memberPopupTitle
:
'未设置工价'
memberPopupTitle
:
'未设置工价'
,
dateType
:
'date'
}
;
}
,
computed
:
{
...
...
@@ -527,6 +537,12 @@ export default {
width
:
'200rpx'
}
;
return
this
.
recordId
?
cancelStyle
:
againStyle
;
}
,
isDateRange
()
{
return
this
.
dateType
==
'daterange'
}
,
selectedDates
()
{
return
this
.
isDateRange
?
this
.
form
.
dateRange
.
join
(
','
)
:
this
.
form
.
happenTime
}
}
,
onLoad
(
options
)
{
...
...
@@ -553,7 +569,10 @@ export default {
}
if
(
options
&&
options
.
recordId
)
{
this
.
recordId
=
options
.
recordId
;
this
.
dateType
=
'date'
this
.
getBillInfo
();
}
else
{
this
.
dateType
=
this
.
form
.
type
==
'TIME'
?
'daterange'
:
'date'
}
}
,
onReady
()
{
...
...
@@ -578,12 +597,11 @@ export default {
async
getBillInfo
()
{
try
{
let
{
data
}
=
await
getBillInfo
({
projectId
:
this
.
projectId
,
recordId
:
this
.
recordId
}
);
let
{
happenTime
,
memberId
,
memberName
,
type
,
remark
,
attach
}
=
data
;
let
{
dateRange
,
happenTime
,
memberId
,
memberName
,
type
,
remark
,
attach
}
=
data
;
let
{
normalNumber
,
normalText
,
normalType
,
overNumber
,
overText
,
overType
,
number
,
unit
,
unitPrice
,
amount
,
rewardAmount
}
=
data
.
data
;
let
form
=
{
...
this
.
form
,
happenTime
,
memberName
,
type
:
type
.
code
,
remark
,
...
...
@@ -943,6 +961,11 @@ export default {
}
);
return
;
}
if
(
this
.
isDateRange
)
{
this
.
form
.
happenTime
=
''
}
else
{
this
.
form
.
dateRange
=
[]
}
this
.
$refs
.
uForm
.
validate
(
valid
=>
{
if
(
valid
)
{
console
.
log
(
'验证通过'
);
...
...
@@ -1143,7 +1166,11 @@ export default {
}
,
// 日历
calendarChange
(
e
)
{
this
.
form
.
happenTime
=
e
;
if
(
this
.
isDateRange
)
{
this
.
form
.
dateRange
=
e
}
else
{
this
.
form
.
happenTime
=
e
;
}
}
,
resetHappenTime
(
time
)
{
return
this
.
parseTime
(
time
,
'{y
}
-{m
}
-{d
}
'
);
...
...
uni_modules/lunc-calendar/components/lunc-calendar/lunc-calendar.vue
View file @
ee1b64c3
...
...
@@ -32,7 +32,7 @@
<view
class=
"day"
v-for=
"(d, j) in item"
:key=
"j"
@
click=
"clickDay(d, true)"
>
<view
class=
"day-info"
:class=
"[
d.dayClass,
selectDate.year === d.sYear && selectDate.month === d.sMonth && selectDate.day === d.day
? 'is-sel' : '',
checkDay(d)
? 'is-sel' : '',
today.year === d.sYear && today.month === d.sMonth && today.day === d.day ? 'be-today' : ''
]"
>
<text
class=
"day-solar"
...
...
@@ -117,6 +117,11 @@
isShrink
:
{
type
:
Boolean
,
default
:
false
},
// date 单选;daterange 多选
type
:
{
type
:
String
,
default
:
'date'
}
},
data
()
{
...
...
@@ -125,7 +130,8 @@
allDataArr
:
[],
//轮播数组
tranIndex
:
1
,
//轮播所在位置
selDate
:
{},
//当前轮播日期信息 -> year, month, day, week
selectDate
:
{},
//当前选中的日期信息
// selectDate: {}, //当前选中的日期信息
selectDate
:
[],
today
:
{},
//今天日期 -> year, month, day, week
tranDuration
:
500
,
//轮播时间(单位毫秒)
showToday
:
false
,
//显示回到今天(非当月才显示)
...
...
@@ -133,6 +139,11 @@
date
:
''
// picker中的日期
};
},
computed
:
{
isDateRange
()
{
return
this
.
type
==
'daterange'
}
},
created
()
{
let
{
platform
...
...
@@ -140,6 +151,7 @@
this
.
isIOS
=
platform
===
'ios'
;
let
nd
=
new
Date
();
this
.
today
=
{
date
:
this
.
$u
.
timeFormat
(
nd
,
'yyyy-mm-dd'
),
year
:
nd
.
getFullYear
(),
month
:
nd
.
getMonth
()
+
1
,
day
:
nd
.
getDate
()
...
...
@@ -147,21 +159,34 @@
if
(
this
.
firstDayOfWeek
==
'sunday'
)
this
.
weekArr
=
[
'日'
,
'一'
,
'二'
,
'三'
,
'四'
,
'五'
,
'六'
];
else
this
.
weekArr
=
[
'一'
,
'二'
,
'三'
,
'四'
,
'五'
,
'六'
,
'日'
];
this
.
initDateTime
(
this
.
today
);
this
.
selectDate
=
JSON
.
parse
(
JSON
.
stringify
(
this
.
today
))
;
this
.
selectDate
=
[
JSON
.
parse
(
JSON
.
stringify
(
this
.
today
))]
;
},
methods
:
{
init
(
date
)
{
let
nd
=
new
Date
();
if
(
date
)
{
nd
=
new
Date
(
date
);
console
.
log
(
'-------date---------'
,
date
)
var
dateArray
=
date
.
split
(
','
)
if
(
dateArray
.
length
==
0
)
{
dateArray
.
push
(
new
Date
())
}
let
dates
=
{
year
:
nd
.
getFullYear
(),
month
:
nd
.
getMonth
()
+
1
,
day
:
nd
.
getDate
()
};
this
.
initDateTime
(
dates
);
this
.
selectDate
=
JSON
.
parse
(
JSON
.
stringify
(
dates
));
var
array
=
[]
var
i
=
0
for
(
var
item
of
dateArray
)
{
console
.
log
(
'-----item-------'
,
item
)
let
nd
=
new
Date
(
item
);
let
dates
=
{
date
:
this
.
$u
.
timeFormat
(
nd
,
'yyyy-mm-dd'
),
year
:
nd
.
getFullYear
(),
month
:
nd
.
getMonth
()
+
1
,
day
:
nd
.
getDate
()
};
if
(
i
==
dateArray
.
length
-
1
)
{
this
.
initDateTime
(
dates
);
}
array
.
push
(
JSON
.
parse
(
JSON
.
stringify
(
dates
)))
i
++
}
this
.
selectDate
=
array
},
initSign
()
{
this
.
allDataArr
.
map
(
item2
=>
{
...
...
@@ -459,6 +484,7 @@
},
//点击日期
clickDay
(
dayInfo
,
flag
)
{
console
.
log
(
'--------clickDay---------'
,
this
.
type
,
dayInfo
,
flag
)
if
(
this
.
selDate
.
day
==
dayInfo
.
day
&&
this
.
selDate
.
month
==
dayInfo
.
month
&&
this
.
selDate
.
year
==
dayInfo
.
year
)
return
;
this
.
selDate
.
day
=
dayInfo
.
day
;
...
...
@@ -498,10 +524,42 @@
if
(
this
.
showLunar
)
returnData
[
'lunar'
]
=
lunar
;
// 仅点击天数时返回日期
if
(
flag
)
{
this
.
$emit
(
'dayChange'
,
returnData
);
this
.
selectDate
=
returnData
;
console
.
log
(
'-----------returnData------------'
,
returnData
)
if
(
this
.
isDateRange
)
{
var
hasNo
=
true
var
array
=
this
.
selectDate
.
filter
((
item
)
=>
{
var
has
=
item
.
year
!=
returnData
.
year
||
item
.
month
!=
returnData
.
month
||
item
.
day
!=
returnData
.
day
console
.
log
(
item
,
has
)
if
(
!
has
)
{
hasNo
=
false
}
return
has
})
if
(
array
.
length
>
0
)
{
this
.
selectDate
=
array
}
console
.
log
(
'-----------hasNo------------'
,
hasNo
)
if
(
hasNo
)
{
this
.
selectDate
.
push
(
returnData
)
}
console
.
log
(
'---------selectDate-------'
,
this
.
isDateRange
?
this
.
selectDate
:
returnData
)
this
.
$emit
(
'dayChange'
,
this
.
selectDate
);
}
else
{
this
.
selectDate
=
[
returnData
];
this
.
$emit
(
'dayChange'
,
returnData
);
}
// this.selectDate = returnData;
}
this
.
setPickValue
();
},
checkDay
(
d
)
{
for
(
var
item
of
this
.
selectDate
)
{
if
(
item
.
year
===
d
.
sYear
&&
item
.
month
===
d
.
sMonth
&&
item
.
day
===
d
.
day
)
{
return
true
}
}
return
false
}
}
};
...
...
@@ -608,11 +666,12 @@
height
:
96rpx
;
color
:
#000
;
box-sizing
:
border-box
;
align-items
:
center
;
justify-content
:
center
;
// overflow: hidden;
.day-info
{
height
:
96
rpx
;
width
:
96
rpx
;
height
:
88
rpx
;
width
:
88
rpx
;
overflow
:
hidden
;
display
:
flex
;
flex-direction
:
column
;
...
...
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