|
@@ -166,7 +166,7 @@ export default defineComponent({
|
|
|
onSelectDay(obj: any) {
|
|
|
const result = obj || []
|
|
|
let list = [...this.selectCourseList] as any
|
|
|
- // console.log(obj, list)
|
|
|
+
|
|
|
result.forEach((item: any) => {
|
|
|
const isExist = list.some(
|
|
|
(course: any) => course.startTime === item.startTime
|
|
@@ -174,23 +174,21 @@ export default defineComponent({
|
|
|
!isExist && list.push({ ...item })
|
|
|
})
|
|
|
// 去掉不在
|
|
|
+ let tempList: any[] = []
|
|
|
list.forEach((item: any) => {
|
|
|
const isExist = result.some(
|
|
|
(course: any) => course.startTime === item.startTime
|
|
|
)
|
|
|
- const index = result.findIndex(
|
|
|
- (course: any) => course.startTime === item.startTime
|
|
|
- )
|
|
|
- !isExist && list.splice(index, 1)
|
|
|
+ isExist && tempList.push(item)
|
|
|
})
|
|
|
// 对数组进行排序
|
|
|
- list.sort((first: any, second: any) => {
|
|
|
+ tempList.sort((first: any, second: any) => {
|
|
|
if (first.startTime > second.startTime) return 1
|
|
|
if (first.startTime < second.startTime) return -1
|
|
|
return 0
|
|
|
})
|
|
|
- // console.log(list, 'list')
|
|
|
- this.selectCourseList = [...list] as any
|
|
|
+ console.log(tempList, 'list')
|
|
|
+ this.selectCourseList = [...tempList] as any
|
|
|
},
|
|
|
onCloseTag(item: any) {
|
|
|
Dialog.confirm({
|