|
@@ -19,11 +19,8 @@ const CustomerAdditions = () => {
|
|
|
chart: {},
|
|
chart: {},
|
|
|
type: 'month'
|
|
type: 'month'
|
|
|
})
|
|
})
|
|
|
-
|
|
|
|
|
- const [type, setType] = useState('month')
|
|
|
|
|
const [dates, setDates] = useState([])
|
|
const [dates, setDates] = useState([])
|
|
|
const [hackValue, setHackValue] = useState()
|
|
const [hackValue, setHackValue] = useState()
|
|
|
- const [value, setValue] = useState()
|
|
|
|
|
const tRef = useRef(null)
|
|
const tRef = useRef(null)
|
|
|
const handleOptionChange = (type, ids) =>
|
|
const handleOptionChange = (type, ids) =>
|
|
|
setState({ ...state, params: { ...state.params, optionType: type, dataIds: ids } })
|
|
setState({ ...state, params: { ...state.params, optionType: type, dataIds: ids } })
|
|
@@ -31,9 +28,22 @@ const CustomerAdditions = () => {
|
|
|
if (!dates || dates.length === 0) {
|
|
if (!dates || dates.length === 0) {
|
|
|
return false
|
|
return false
|
|
|
}
|
|
}
|
|
|
- const tooLate = dates[0] && current.diff(dates[0], 'month') > 10
|
|
|
|
|
- const tooEarly = dates[1] && dates[1].diff(current, 'month') > 10
|
|
|
|
|
- return tooEarly || tooLate
|
|
|
|
|
|
|
+ if (state.type === 'month') {
|
|
|
|
|
+ const tooLate = dates[0] && current.diff(dates[0], 'month') > 10
|
|
|
|
|
+ const tooEarly = dates[1] && dates[1].diff(current, 'month') > 10
|
|
|
|
|
+ return tooEarly || tooLate
|
|
|
|
|
+ }
|
|
|
|
|
+ if (state.type === 'week') {
|
|
|
|
|
+ const tooLate = dates[0] && current.diff(dates[0], 'weeks') > 11
|
|
|
|
|
+ const tooEarly = dates[1] && dates[1].diff(current, 'weeks') > 11
|
|
|
|
|
+ return tooEarly || tooLate
|
|
|
|
|
+ }
|
|
|
|
|
+ if (state.type === 'date') {
|
|
|
|
|
+ const tooLate = dates[0] && current.diff(dates[0], 'days') > 29
|
|
|
|
|
+ const tooEarly = dates[1] && dates[1].diff(current, 'days') > 29
|
|
|
|
|
+ return tooEarly || tooLate
|
|
|
|
|
+ }
|
|
|
|
|
+ // return tooEarly || tooLate
|
|
|
}
|
|
}
|
|
|
const onOpenChange = open => {
|
|
const onOpenChange = open => {
|
|
|
if (open) {
|
|
if (open) {
|
|
@@ -103,7 +113,7 @@ const CustomerAdditions = () => {
|
|
|
<Option value="date">日</Option>
|
|
<Option value="date">日</Option>
|
|
|
</Select>
|
|
</Select>
|
|
|
<RangePicker
|
|
<RangePicker
|
|
|
- picker={type}
|
|
|
|
|
|
|
+ picker={state.type}
|
|
|
disabledDate={disabledDate}
|
|
disabledDate={disabledDate}
|
|
|
onCalendarChange={val => setDates(val)}
|
|
onCalendarChange={val => setDates(val)}
|
|
|
onOpenChange={onOpenChange}
|
|
onOpenChange={onOpenChange}
|