提交 59cf7995 authored 作者: lidongxu's avatar lidongxu

fix(plan和task): 修复了今日快捷方式选择日期无数据问题

时间要从 0 点到 24 点的时分秒格式都设置上
上级 07e3d292
......@@ -7,13 +7,21 @@ export const useDatePickerOptions = (type = -1) => {
const last30Date = [new Date().setDate((new Date().getDate() - (30 - 1))), new Date().setDate((new Date().getDate() + type))]
const last7Date = [new Date().setDate((new Date().getDate() - (7 - 1))), new Date().setDate((new Date().getDate() + type))]
const lastDate = [new Date().setDate((new Date().getDate() + type)), new Date().setDate((new Date().getDate() + type))]
const todayDate = [new Date(), new Date()]
// 今日 0 点到 24 点
const today = new Date();
today.setHours(0, 0, 0, 0);
const tomorrow = new Date();
tomorrow.setDate(tomorrow.getDate());
tomorrow.setHours(23, 59, 59, 59);
const todayDate = [today, tomorrow]
// 今年的 1.1 号到 12.31号
const thisYearDate = [new Date(new Date().getFullYear(), 0, 1), new Date(new Date().getFullYear(), 11, 31)]
const recentPickerOptions = ref([// 日期选项配置
{
text: '今天',
value: todayDate
value() {
return todayDate
}
},
{
text: '最近一周',
......
......@@ -928,19 +928,19 @@ const addOrEditPlanFormRules = reactive({
const disabledDateFn = (time) => {
// 判断日期不在某个区间的就禁用
// 职能角色今日到次月最后一天
if (store.state.value.user.userInfo.privilegeId === 2) {
// if (store.state.value.user.userInfo.privilegeId === 2) {
const now = new Date();
const start = new Date(now.getFullYear(), now.getMonth(), now.getDate());
const end = new Date(now.getFullYear(), now.getMonth() + 2, 0);
return time.getTime() < start.getTime() || time.getTime() > end.getTime();
} else {
// 城市经理只能是次月第一天到最后一天
const now = new Date();
const nextMonth = now.getMonth() + 1;
const start = new Date(now.getFullYear(), nextMonth, 1);
const end = new Date(now.getFullYear(), nextMonth + 1, 0);
return time.getTime() < start.getTime() || time.getTime() > end.getTime();
}
// } else {
// // 城市经理只能是次月第一天到最后一天
// const now = new Date();
// const nextMonth = now.getMonth() + 1;
// const start = new Date(now.getFullYear(), nextMonth, 1);
// const end = new Date(now.getFullYear(), nextMonth + 1, 0);
// return time.getTime() < start.getTime() || time.getTime() > end.getTime();
// }
}
const handleAdd = () => {
resetAddOrEditPlanForm()
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论