|
@@ -64,42 +64,74 @@ export default defineComponent({
|
|
|
})
|
|
|
return hour
|
|
|
}
|
|
|
+ // else if (type === 'minute') {
|
|
|
+ // console.log(type, option, '121212', state.useTimerFormat)
|
|
|
+ // const minute: any = []
|
|
|
+ // option.forEach((o: any) => {
|
|
|
+ // state.useTimerFormat.forEach((time: any) => {
|
|
|
+ // if (
|
|
|
+ // o.value >= time.startMinute &&
|
|
|
+ // o.value <= (time.endMinute ? time.endMinute : 59) &&
|
|
|
+ // o.value != minute[minute.length - 1]?.value
|
|
|
+ // ) {
|
|
|
+ // minute.push(o)
|
|
|
+ // }
|
|
|
+ // })
|
|
|
+ // })
|
|
|
+ // return minute
|
|
|
+ // }
|
|
|
return option
|
|
|
}
|
|
|
|
|
|
// 时间切换时
|
|
|
// [6:30, 12:00] [15:00, 18:00]
|
|
|
const onChange = (val: any) => {
|
|
|
+ // console.log(val, 'val')
|
|
|
// 判断是否选择小时
|
|
|
- if (val.columnIndex === 1) return
|
|
|
-
|
|
|
+ // if (val.columnIndex === 1) return
|
|
|
// 选择时间
|
|
|
- const selectHour = Number(val.selectedValues[0])
|
|
|
-
|
|
|
- let minute = 0 // 获取开始的分钟数
|
|
|
- state.useTimerFormat.forEach((item: any) => {
|
|
|
- if (selectHour === item.startHour) {
|
|
|
- minute = item.startMinute
|
|
|
- } else if (selectHour === item.endHour) {
|
|
|
- minute = item.endMinute
|
|
|
- }
|
|
|
- })
|
|
|
-
|
|
|
- state.minMinute = minute
|
|
|
- state.maxMinute = 59
|
|
|
+ // const selectHour = Number(val.selectedValues[0])
|
|
|
+ // let minute = 0 // 获取开始的分钟数
|
|
|
+ // let endMinute = 0
|
|
|
+ // state.useTimerFormat.forEach((item: any) => {
|
|
|
+ // if (selectHour === item.startHour) {
|
|
|
+ // // minute = item.startMinute
|
|
|
+ // minute = minute >= item.startMinute ? minute : item.startMinute
|
|
|
+ // } else if (selectHour === item.endHour) {
|
|
|
+ // const tempMin = item.endMinute ? item.endMinute : 59
|
|
|
+ // endMinute = endMinute >= tempMin ? endMinute : tempMin
|
|
|
+ // }
|
|
|
+ // })
|
|
|
+ // state.minMinute = minute
|
|
|
+ // state.maxMinute = endMinute
|
|
|
}
|
|
|
|
|
|
//
|
|
|
const onFormatTimer = (val: Array<any>) => {
|
|
|
const format: any = []
|
|
|
+ const temp = {
|
|
|
+ startHour: 0,
|
|
|
+ endHour: 0,
|
|
|
+ startMinute: 0,
|
|
|
+ endMinute: 0
|
|
|
+ }
|
|
|
val.forEach((item: any) => {
|
|
|
- format.push({
|
|
|
- startHour: Number(dayjs(item.startTime).format('HH')),
|
|
|
- startMinute: Number(dayjs(item.startTime).format('mm')),
|
|
|
- endHour: Number(dayjs(item.endTime).format('HH')),
|
|
|
- endMinute: Number(dayjs(item.endTime).format('mm'))
|
|
|
- })
|
|
|
+ const sh = Number(dayjs(item.startTime).format('HH'))
|
|
|
+ const eh = Number(dayjs(item.endTime).format('HH')) || 23
|
|
|
+ const sm = Number(dayjs(item.startTime).format('mm'))
|
|
|
+ const em = Number(dayjs(item.endTime).format('mm')) || 59
|
|
|
+ temp.startHour = temp.startHour !== 0 && temp.startHour <= sh ? temp.startHour : sh
|
|
|
+ temp.endHour = temp.endHour !== 0 && temp.endHour >= eh ? temp.endHour : eh
|
|
|
+ temp.startMinute = temp.startMinute !== 0 && temp.startMinute <= sm ? temp.startMinute : sm
|
|
|
+ temp.endMinute = temp.endMinute !== 0 && temp.endMinute >= em ? temp.endMinute : em
|
|
|
+ // format.push({
|
|
|
+ // startHour: Number(dayjs(item.startTime).format('HH')),
|
|
|
+ // startMinute: Number(dayjs(item.startTime).format('mm')),
|
|
|
+ // endHour: Number(dayjs(item.endTime).format('HH')),
|
|
|
+ // endMinute: Number(dayjs(item.endTime).format('mm'))
|
|
|
+ // })
|
|
|
})
|
|
|
+ format.push(temp)
|
|
|
return format
|
|
|
}
|
|
|
|
|
@@ -111,22 +143,11 @@ export default defineComponent({
|
|
|
.hour(selectedValues[0])
|
|
|
.minute(selectedValues[1])
|
|
|
.second(0)
|
|
|
- // console.log(dayjs(tempDate).format('YYYY-MM-DD HH:mm:ss'), 'first', dayjs(tempDate).minute())
|
|
|
// 时间加上每节课的时间,
|
|
|
const lastDate = dayjs(tempDate).minute(props.times + dayjs(tempDate).minute())
|
|
|
- // console.log(dayjs(lastDate).format('YYYY-MM-DD HH:mm:ss'), 'second')
|
|
|
- // console.log(
|
|
|
- // dayjs(tempDate).format('YYYY-MM-DD HH:mm:ss'),
|
|
|
- // tempDate.toDate(),
|
|
|
- // 'second tempDate',
|
|
|
- // state.useTimer
|
|
|
- // )
|
|
|
|
|
|
let isActive = false
|
|
|
state.useTimer.forEach((item: any) => {
|
|
|
- // if (dayjs(lastDate).isBetween(item.startTime, item.endTime, null, '[]')) {
|
|
|
- // isActive = true
|
|
|
- // }
|
|
|
// 判断课程的时间范围在不在可排课时间范围内
|
|
|
if (
|
|
|
dayjs(tempDate).valueOf() >= dayjs(item.startTime).valueOf() &&
|
|
@@ -136,7 +157,6 @@ export default defineComponent({
|
|
|
}
|
|
|
})
|
|
|
|
|
|
- // console.log(isActive, 'isActive')
|
|
|
if (!isActive) {
|
|
|
showToast('您选择的时间超过可排课时间范围')
|
|
|
return
|
|
@@ -154,7 +174,6 @@ export default defineComponent({
|
|
|
)
|
|
|
|
|
|
const init = () => {
|
|
|
- console.log(props.timerList, 'timerList')
|
|
|
state.calendarDate = props.timerList?.calendarDate
|
|
|
const timeDetailList = props.timerList?.timeDetailList || []
|
|
|
|
|
@@ -173,15 +192,13 @@ export default defineComponent({
|
|
|
const useFormat = onFormatTimer(useTimer)
|
|
|
state.useTimerFormat = useFormat
|
|
|
state.usedTimer = [...usedTimer]
|
|
|
- console.log(onFormatTimer(useTimer), 'onFormatTimer')
|
|
|
- console.log(state.useTimer, state.usedTimer, 'onUseTimer')
|
|
|
|
|
|
// 判断有可排课数据
|
|
|
- if (useFormat.length > 0) {
|
|
|
- const temp = useFormat[0]
|
|
|
- state.minMinute = temp.startMinute
|
|
|
- state.maxMinute = 59
|
|
|
- }
|
|
|
+ // if (useFormat.length > 0) {
|
|
|
+ // const temp = useFormat[0]
|
|
|
+ // state.minMinute = temp.startMinute
|
|
|
+ // state.maxMinute = 59
|
|
|
+ // }
|
|
|
}
|
|
|
|
|
|
onMounted(() => {
|
|
@@ -276,8 +293,8 @@ export default defineComponent({
|
|
|
class={'popupBottomSearch'}
|
|
|
>
|
|
|
<TimePicker
|
|
|
- minMinute={state.minMinute}
|
|
|
- maxMinute={state.maxMinute}
|
|
|
+ // minMinute={state.minMinute}
|
|
|
+ // maxMinute={state.maxMinute}
|
|
|
formatter={onFormatter}
|
|
|
filter={onFilter}
|
|
|
onChange={onChange}
|