|
|
@ -181,13 +181,13 @@ const formsSuccess = async (formType, data) => { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
const year = data.year; |
|
|
|
const month = data.month; |
|
|
|
const day = data.day; |
|
|
|
const hour = data.hour; |
|
|
|
const minute = data.minute; |
|
|
|
if (!/^\d+$/.test(year)) { |
|
|
|
message.error('账期年值为大于等于0的整数') |
|
|
|
const year = data.year |
|
|
|
const month = data.month |
|
|
|
const day = data.day |
|
|
|
const hour = data.hour |
|
|
|
const minute = data.minute |
|
|
|
if (!/^\d+$/.test(year) && year <= 2147483647) { |
|
|
|
message.error('账期年值为大于等于0且小于2147483647的整数') |
|
|
|
return |
|
|
|
} |
|
|
|
if (!/^(1[0-2]|[1-9])$/.test(month)) { |
|
|
@ -200,15 +200,15 @@ const formsSuccess = async (formType, data) => { |
|
|
|
} |
|
|
|
|
|
|
|
// 创建一个Date对象,注意月份是从0开始的,所以需要减1 |
|
|
|
const date = new Date(year, month - 1, day); |
|
|
|
const date = new Date(year, month - 1, day) |
|
|
|
|
|
|
|
// 获取该月的总天数 |
|
|
|
const totalDaysInMonth = new Date(year, month, 0).getDate(); |
|
|
|
const totalDaysInMonth = new Date(year, month, 0).getDate() |
|
|
|
|
|
|
|
// 检查年月是否正确 |
|
|
|
const isCorrectMonth = date.getMonth() === (month - 1); |
|
|
|
const isCorrectMonth = date.getMonth() === month - 1 |
|
|
|
// 检查天数是否在有效范围内 |
|
|
|
const isDayInRange = day >= 1 && day <= totalDaysInMonth; |
|
|
|
const isDayInRange = day >= 1 && day <= totalDaysInMonth |
|
|
|
if (!isCorrectMonth || !isDayInRange) { |
|
|
|
message.error('账期日期不在当前月的范围内') |
|
|
|
return |
|
|
|