|
@@ -18,7 +18,7 @@
|
|
|
<el-date-picker v-model="formData.activityStartDate" :disabledDate="disabledDates" value-format="x" type="date" placeholder="请选择活动开始时间" class="!w-240px" />
|
|
|
</el-form-item>
|
|
|
<el-form-item label="结束时间" prop="activityEndDate">
|
|
|
- <el-date-picker v-model="formData.activityEndDate" :disabledDate="disabledDates" value-format="x" type="date" placeholder="请选择活动结束时间" class="!w-240px" />
|
|
|
+ <el-date-picker v-model="formData.activityEndDate" :disabledDate="disabledEndDates" value-format="x" type="date" placeholder="请选择活动结束时间" class="!w-240px" />
|
|
|
</el-form-item>
|
|
|
<el-form-item label="投票频率" prop="votingRule.dateType">
|
|
|
<el-radio-group v-model="formData.votingRule.dateType">
|
|
@@ -99,6 +99,23 @@ const disabledDates = (date) => {
|
|
|
return date.getTime() < currentDate.getTime()
|
|
|
}
|
|
|
|
|
|
+// 根据选择的开始时间,结束时间不可选
|
|
|
+const disabledEndDates = (date) => {
|
|
|
+ const currentDate = new Date()
|
|
|
+ currentDate.setDate(currentDate.getDate() - 1)
|
|
|
+
|
|
|
+ const activityStartDate = formData.value.activityStartDate
|
|
|
+ // 没有选择开始时间时默认过去的时间不可选
|
|
|
+ if (!activityStartDate) {
|
|
|
+ return date.getTime() < currentDate.getTime()
|
|
|
+ }
|
|
|
+
|
|
|
+ // 有开始时间则根据开始时间设置不可选范围
|
|
|
+ const startDate = new Date(activityStartDate)
|
|
|
+ startDate.setDate(startDate.getDate() + 1)
|
|
|
+ return date.getTime() < startDate.getTime()
|
|
|
+}
|
|
|
+
|
|
|
/** 打开弹窗 */
|
|
|
const open = async (type: string, id?: number) => {
|
|
|
dialogVisible.value = true
|