|
@@ -72,9 +72,6 @@ export default {
|
|
this.getHolidayDayInfo(startTime, endTime)
|
|
this.getHolidayDayInfo(startTime, endTime)
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
- confirmDate(e) {
|
|
|
|
- this.$emit('getRangeDate', this.nowDates)
|
|
|
|
- },
|
|
|
|
panelChange(value, mode) { // 日历面板发生变化时的回调
|
|
panelChange(value, mode) { // 日历面板发生变化时的回调
|
|
// console.log(value, mode)
|
|
// console.log(value, mode)
|
|
},
|
|
},
|
|
@@ -83,27 +80,36 @@ export default {
|
|
if (res.code === 200) {
|
|
if (res.code === 200) {
|
|
this.holiday = res.data
|
|
this.holiday = res.data
|
|
}
|
|
}
|
|
- console.log(this.holiday)
|
|
|
|
},
|
|
},
|
|
async getSeprateDayInfo(dataArr) { // 获取选中时间中的工作日时间
|
|
async getSeprateDayInfo(dataArr) { // 获取选中时间中的工作日时间
|
|
const res = await getSeprateDayInfo(dataArr)
|
|
const res = await getSeprateDayInfo(dataArr)
|
|
if (res.code === 200) {
|
|
if (res.code === 200) {
|
|
this.finally = res.data
|
|
this.finally = res.data
|
|
}
|
|
}
|
|
- console.log('Seprate', this.finally)
|
|
|
|
|
|
+ this.change()
|
|
},
|
|
},
|
|
changeRange(dates) { // 获取开始结束日期
|
|
changeRange(dates) { // 获取开始结束日期
|
|
this.nowDates = []
|
|
this.nowDates = []
|
|
const [start, end] = dates
|
|
const [start, end] = dates
|
|
|
|
+ this.nowDates = this.setHoliday('holiday', start, end)
|
|
|
|
+ },
|
|
|
|
+ setHoliday(type, start, end) {
|
|
|
|
+ const NewArr = []
|
|
let nextDate = _.cloneDeep(start)
|
|
let nextDate = _.cloneDeep(start)
|
|
while (nextDate && nextDate.isBefore(end)) {
|
|
while (nextDate && nextDate.isBefore(end)) {
|
|
- if (nextDate.weekday() < 5) { // 默认周六,末不在已选数组中
|
|
|
|
- this.nowDates.push(nextDate.format('YYYY.MM.DD'))
|
|
|
|
|
|
+ if (type === 'holiday') {
|
|
|
|
+ const isEx = this.holiday.find(item => item === nextDate.format('YYYY.MM.DD'))
|
|
|
|
+ if (!isEx) {
|
|
|
|
+ NewArr.push(nextDate.format('YYYY.MM.DD'))
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ if (nextDate.weekday() < 6 && nextDate.weekday() > 0) { // 默认周六,末不在已选数组中
|
|
|
|
+ NewArr.push(nextDate.format('YYYY.MM.DD'))
|
|
|
|
+ }
|
|
}
|
|
}
|
|
nextDate = nextDate.add(1, 'day')
|
|
nextDate = nextDate.add(1, 'day')
|
|
}
|
|
}
|
|
- this.getSeprateDayInfo(this.nowDates)
|
|
|
|
- console.log(this.nowDates)
|
|
|
|
|
|
+ return NewArr
|
|
},
|
|
},
|
|
setSelect(current) { // 选择详细日期
|
|
setSelect(current) { // 选择详细日期
|
|
const isExist = this.nowDates.find(item => item === current.format('YYYY.MM.DD'))
|
|
const isExist = this.nowDates.find(item => item === current.format('YYYY.MM.DD'))
|
|
@@ -112,7 +118,13 @@ export default {
|
|
} else {
|
|
} else {
|
|
this.nowDates.push(current.format('YYYY.MM.DD'))
|
|
this.nowDates.push(current.format('YYYY.MM.DD'))
|
|
}
|
|
}
|
|
- console.log(this.nowDates)
|
|
|
|
|
|
+ },
|
|
|
|
+ confirmDate(e) {
|
|
|
|
+ this.getSeprateDayInfo(this.nowDates)
|
|
|
|
+ },
|
|
|
|
+ change() {
|
|
|
|
+ this.$emit('update:startEnd', this.momentDate)
|
|
|
|
+ this.$emit('getDetailDay', this.finally)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|