Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
shareConfig
Overview
Overview
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
gic-web
shareConfig
Commits
572db25b
Commit
572db25b
authored
May 12, 2021
by
黑潮
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update: 调整活动时间有效期
parent
770a160f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
82 additions
and
14 deletions
+82
-14
base-config.vue
src/components/active-config/base-config.vue
+82
-14
No files found.
src/components/active-config/base-config.vue
View file @
572db25b
...
...
@@ -63,8 +63,9 @@ import baseConfig from '@/components/active-config/base-config.vue';
<el-form-item
label=
"活动有效期:"
prop=
"dateRange"
required
>
<el-date-picker
<
!--
<
el-date-picker
class=
"m-l-10"
prefix-icon=
"el-icon-time"
:disabled=
"$route.query.editFlag"
...
...
@@ -80,6 +81,33 @@ import baseConfig from '@/components/active-config/base-config.vue';
range-separator=
"至"
start-placeholder=
"开始日期"
end-placeholder=
"结束日期"
>
</el-date-picker>
-->
<el-date-picker
class=
"m-l-10"
:disabled=
"$route.query.editFlag || startDateDisabled"
prefix-icon=
"el-icon-time"
v-model=
"activeInfoData.startDate"
:editable=
"false"
:value-format=
"'yyyy-MM-dd'"
type=
"date"
align=
"right"
placeholder=
"开始日期"
:picker-options=
"pickerOptionsStart"
@
change=
"changeDate($event, true)"
>
</el-date-picker>
<span
style=
"margin:0 5px;color:#c0c4cc"
>
-
</span>
<el-date-picker
class=
"m-l-10"
:disabled=
"$route.query.editFlag || endDateDisabled"
prefix-icon=
"el-icon-time"
v-model=
"activeInfoData.endDate"
:editable=
"false"
:value-format=
"'yyyy-MM-dd'"
type=
"date"
align=
"right"
placeholder=
"结束日期"
:picker-options=
"pickerOptionsEnd"
@
change=
"changeDate($event, false)"
>
</el-date-picker>
</el-form-item>
<el-form-item
class=
"m-t-50"
>
...
...
@@ -110,13 +138,22 @@ export default {
},
data
()
{
const
checkDate
=
(
rule
,
value
,
callback
)
=>
{
console
.
log
(
value
[
0
].
split
(
' '
)[
0
]
,
timeFormat
.
timeStampToYmd
(
new
Date
().
getTime
()));
if
(
!
value
||
!
value
.
length
)
{
// console.log(value[0].split(' ')[0] ,timeFormat.timeStampToYmd(new Date().getTime()));
// if (!value || !value.length) {
// callback(new Error('请选择活动有效期'));
// } else if (value[0].split(' ')[0] == timeFormat.timeStampToYmd(new Date().getTime()) && value[0].split(' ')[0] == value[1].split(' ')[0]) {
// callback(new Error('不能选择今天'));
// }else if (this.editDate && !!this.$route.query.activityId && (value[0].split(' ')[0] != timeFormat.timeStampToYmd(new Date().getTime()) || timeFormat.timeStampToYmd(new Date().getTime()) == value[1].split(' ')[0])) {
// callback(new Error('开始时间无法改到当前时间之后,结束时间无法改到当前时间之前'));
// } else {
// callback();
// }
if
(
!
value
||
!
value
.
length
||
(
!
value
[
0
]
&&
!
value
[
1
]))
{
callback
(
new
Error
(
'请选择活动有效期'
));
}
else
if
(
value
[
0
].
split
(
' '
)[
0
]
==
timeFormat
.
timeStampToYmd
(
new
Date
().
getTime
())
&&
value
[
0
].
split
(
' '
)[
0
]
==
value
[
1
].
split
(
' '
)
[
0
])
{
callback
(
new
Error
(
'
不能选择今天
'
));
}
else
if
(
this
.
editDate
&&
!!
this
.
$route
.
query
.
activityId
&&
(
value
[
0
].
split
(
' '
)[
0
]
!=
timeFormat
.
timeStampToYmd
(
new
Date
().
getTime
())
||
timeFormat
.
timeStampToYmd
(
new
Date
().
getTime
())
==
value
[
1
].
split
(
' '
)[
0
])
)
{
callback
(
new
Error
(
'
开始时间无法改到当前时间之后,结束时间无法改到当前时间之前
'
));
}
else
if
(
!
value
[
0
])
{
callback
(
new
Error
(
'
请选择开始日期
'
));
}
else
if
(
!
value
[
1
]
)
{
callback
(
new
Error
(
'
请选择结束日期
'
));
}
else
{
callback
();
}
...
...
@@ -139,10 +176,14 @@ export default {
activityName
:
''
,
dateRange
:
[],
editDate
:
false
,
startDate
:
''
,
endDate
:
''
,
startDateDisabled
:
false
,
endDateDisabled
:
false
},
rules
:
{
activityName
:
[{
required
:
true
,
message
:
'请输入活动名称'
,
trigger
:
'blur'
}],
dateRange
:
[{
validator
:
checkDate
,
trigger
:
'
blur
'
}]
dateRange
:
[{
validator
:
checkDate
,
trigger
:
'
change
'
}]
},
choiceDateCopy
:
[],
pickerOptions
:
{
...
...
@@ -161,20 +202,45 @@ export default {
}
return
time
.
getTime
()
<
Date
.
now
()
-
8.64e7
;
}
}
},
pickerOptionsStart
:
{
disabledDate
:
time
=>
{
let
disabled
=
time
.
getTime
()
<
Date
.
now
()
-
8.64e7
;
// if(this.activeInfoData.endDate) {
// disabled = disabled || (time.getTime() > new Date(this.activeInfoData.endDate).getTime());
// }
return
disabled
;
}
},
pickerOptionsEnd
:
{
disabledDate
:
time
=>
{
let
disabled
=
time
.
getTime
()
<
Date
.
now
()
-
8.64e7
;
if
(
this
.
activeInfoData
.
startDate
)
{
disabled
=
disabled
||
(
time
.
getTime
()
<
new
Date
(
this
.
activeInfoData
.
startDate
).
getTime
());
}
if
(
!
this
.
activeInfoData
.
startDate
||
(
new
Date
(
this
.
activeInfoData
.
startDate
).
toDateString
()
===
new
Date
().
toDateString
()))
{
disabled
=
disabled
||
(
time
.
getTime
()
<=
new
Date
().
setHours
(
0
,
0
,
0
));
}
return
disabled
;
}
},
};
},
methods
:
{
/**
* 日期
*/
changeDate
(
e
)
{
changeDate
(
e
,
isStartDate
)
{
const
that
=
this
;
that
.
editDate
=
true
;
if
(
!
e
)
{
that
.
choiceDateCopy
=
[];
that
.
activeInfoData
.
dateRange
=
[];
}
// if (!e) {
// that.choiceDateCopy = [];
// that.activeInfoData.dateRange = [];
// }
isStartDate
&&
(
this
.
activeInfoData
.
endDate
=
''
);
this
.
activeInfoData
.
startDate
&&
(
this
.
activeInfoData
.
startDate
=
timeFormat
.
timeToDateTime
(
new
Date
(
this
.
activeInfoData
.
startDate
).
setHours
(
0
,
0
,
0
,
0
)));
this
.
activeInfoData
.
endDate
&&
(
this
.
activeInfoData
.
endDate
=
timeFormat
.
timeToDateTime
(
new
Date
(
this
.
activeInfoData
.
endDate
).
setHours
(
23
,
59
,
59
,
999
)));
this
.
activeInfoData
.
dateRange
=
[
this
.
activeInfoData
.
startDate
||
''
,
this
.
activeInfoData
.
endDate
||
''
]
},
/**
* 返回
...
...
@@ -260,6 +326,8 @@ export default {
resData
.
result
.
router
.
sort
(
function
(
a
,
b
){
return
(
a
.
transId
-
b
.
transId
);
})
this
.
startDateDisabled
=
Date
.
now
()
>
resData
.
result
.
startDate
;
this
.
endDateDisabled
=
Date
.
now
()
>
resData
.
result
.
endDate
resData
.
result
.
startDate
=
timeFormat
.
timeToDateTime
(
resData
.
result
.
startDate
);
resData
.
result
.
endDate
=
timeFormat
.
timeToDateTime
(
resData
.
result
.
endDate
);
resData
.
result
.
dateRange
=
[
resData
.
result
.
startDate
,
resData
.
result
.
endDate
];
...
...
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