|
@@ -10,9 +10,10 @@ type Props = {
|
|
|
editFu: (val: string[], num: number) => void
|
|
|
baseTime: string
|
|
|
num: number
|
|
|
+ noList: string
|
|
|
}
|
|
|
|
|
|
-function C1NoTime({ baseTime, closeFu, editFu, num }: Props) {
|
|
|
+function C1NoTime({ baseTime, closeFu, editFu, num, noList }: Props) {
|
|
|
const baseTimeArr = baseTime
|
|
|
? JSON.parse(baseTime).openDate.map((v: any) =>
|
|
|
v.replaceAll('年', '-').replaceAll('月', '-').replaceAll('日', '')
|
|
@@ -26,6 +27,18 @@ function C1NoTime({ baseTime, closeFu, editFu, num }: Props) {
|
|
|
(date: any, dateString: string[] | string) => {
|
|
|
if (dateString.length) {
|
|
|
let arr = dateString as string[]
|
|
|
+ // 新增过滤逻辑:排除已在noList中的日期
|
|
|
+ const invalidDates = arr.filter(v =>
|
|
|
+ noList.includes(v.replaceAll('年', '-').replaceAll('月', '-').replaceAll('日', ''))
|
|
|
+ )
|
|
|
+ if (invalidDates.length > 0) {
|
|
|
+ MessageFu.warning(`日期${invalidDates.join(',')}已设置为不可预约日期`)
|
|
|
+ arr = arr.filter(
|
|
|
+ v =>
|
|
|
+ !noList.includes(v.replaceAll('年', '-').replaceAll('月', '-').replaceAll('日', ''))
|
|
|
+ )
|
|
|
+ }
|
|
|
+ // 保留原有数量限制逻辑
|
|
|
if (arr.length > num) {
|
|
|
arr = arr.filter((c, i) => i < num)
|
|
|
MessageFu.warning(`最多${num}个日期,已过滤超出日期`)
|
|
@@ -33,7 +46,7 @@ function C1NoTime({ baseTime, closeFu, editFu, num }: Props) {
|
|
|
setValue(arr.map(v => v.replaceAll('年', '-').replaceAll('月', '-').replaceAll('日', '')))
|
|
|
} else setValue([])
|
|
|
},
|
|
|
- [num]
|
|
|
+ [num, noList] // 添加noList到依赖数组
|
|
|
)
|
|
|
|
|
|
return (
|
|
@@ -56,7 +69,7 @@ function C1NoTime({ baseTime, closeFu, editFu, num }: Props) {
|
|
|
/>
|
|
|
|
|
|
<div className='allowCount'>
|
|
|
- <div className='title'>节假日可预约人数</div>
|
|
|
+ <div className='title'>节假日时间段可预约人数</div>
|
|
|
<InputNumber
|
|
|
style={{ width: 120 }}
|
|
|
defaultValue={500}
|