lex 2 years ago
parent
commit
806602303b

+ 6 - 1
src/school/approval-manage/course-adjust.tsx

@@ -217,7 +217,11 @@ export default defineComponent({
                 forms.startTime = ''
               }}
               onDestory={() => {
-                getList()
+                if (forms.classDate) {
+                  getList(forms.classDate)
+                } else {
+                  getList()
+                }
               }}
               v-model:calendarDate={state.calendarDate}
             />
@@ -247,6 +251,7 @@ export default defineComponent({
           <OPopup v-model:modelValue={state.showPopoverTeacher} position="bottom">
             <TeacherList
               courseType={courseDetail.value.type}
+              removeTeacherId={forms.teacherId}
               onClose={() => (state.showPopoverTeacher = false)}
               onSelect={(val: any) => {
                 // 换老师之后重置数据

+ 3 - 3
src/school/orchestra/modal/teacher-list.module.less

@@ -16,15 +16,15 @@
   }
 
   .class {
-    padding-top: 3px;
     font-size: 12px;
     color: #777777;
     line-height: 17px;
   }
 
   :global {
-    .van-tag + .van-tag {
-      margin-left: 8px;
+    .van-tag {
+      margin-top: 3px;
+      margin-right: 8px;
     }
   }
 }

+ 6 - 4
src/school/orchestra/modal/teacher-list.tsx

@@ -1,10 +1,8 @@
 import OHeader from '@/components/o-header'
-import OPopup from '@/components/o-popup'
 import OSticky from '@/components/o-sticky'
 import { state } from '@/state'
 import { Button, Cell, CellGroup, Field, List, Image, Tag } from 'vant'
 import { defineComponent, onMounted, PropType, reactive, watch } from 'vue'
-import TeacherList from '../modal/teacher-list'
 import styles from './teacher-list.module.less'
 import iconTeacher from '@common/images/icon_teacher.png'
 import OEmpty from '@/components/o-empty'
@@ -27,6 +25,10 @@ export default defineComponent({
       type: String,
       default: ''
     },
+    removeTeacherId: {
+      type: String,
+      default: ''
+    },
     subjectIdList: {
       type: Array,
       default: () => []
@@ -60,7 +62,8 @@ export default defineComponent({
           data: {
             ...forms.params,
             schoolId: state.user.data.school.id,
-            delFlag: false
+            removeTeacherId: props.removeTeacherId, // 移除的老师id
+            delFlag: false // 绑定解绑 false:绑定 true:解绑
           }
         })
         forms.listState.loading = false
@@ -105,7 +108,6 @@ export default defineComponent({
     watch(
       () => props.courseType,
       () => {
-        console.log(props.courseType, 'course')
         forms.params.courseType = props.courseType
         onSearch()
       }

+ 5 - 1
src/school/train-planning/component/standard/index.tsx

@@ -291,7 +291,11 @@ export default defineComponent({
               })
             }}
             onDestory={() => {
-              getList()
+              if (forms.trainStartDate) {
+                getList(forms.trainStartDate)
+              } else {
+                getList()
+              }
             }}
             v-model:calendarDate={forms.calendarDate}
           />

+ 9 - 18
src/school/train-planning/modal/calendar/index.tsx

@@ -5,8 +5,10 @@ import styles from './index.module.less'
 import IconArrow from '../../images/icon_arrow.png'
 import IconArrowDefault from '../../images/icon_arrow_default.png'
 import isToday from 'dayjs/plugin/isToday'
+import isSameOrBefore from 'dayjs/plugin/isSameOrBefore'
 import OHeader from '@/components/o-header'
 dayjs.extend(isToday)
+dayjs.extend(isSameOrBefore)
 
 export default defineComponent({
   name: 'calendar',
@@ -60,7 +62,7 @@ export default defineComponent({
     return {
       minDate: new Date(),
       maxDate: new Date(),
-      currentDate: dayjs().add(1, 'day').toDate(), // 当前日历日期
+      currentDate: dayjs().toDate(), // 当前日历日期
       subtitle: '',
       dayList: [],
       selectDays: [] as any
@@ -69,33 +71,20 @@ export default defineComponent({
   computed: {
     arrowStatus() {
       // 上月箭头状态
-      return !dayjs().add(1, 'day').isBefore(dayjs(this.currentDate), 'month')
+      return !dayjs().isBefore(dayjs(this.currentDate), 'month')
     },
     selectDayTitle() {
       // 选中日期标题
       return dayjs(this.currentDate).format('YYYY-MM-DD')
-    },
-    isPrevDay() {
-      // 是否可以点击上一天
-      return dayjs(this.currentDate).subtract(1, 'day').isBefore(dayjs(this.minDate), 'day')
-    },
-    isNextDay() {
-      // 是否可以点击下一天
-      return dayjs(this.currentDate).add(1, 'day').isAfter(dayjs(this.maxDate), 'day')
     }
   },
   mounted() {
     // 初始化标题和最大显示日期
-    this.subtitle = dayjs(this.calendarDate || new Date())
-      // .add(1, 'day')
-      .format('YYYY年MM月')
+    this.subtitle = dayjs(this.calendarDate || new Date()).format('YYYY年MM月')
     this.maxDate = dayjs(this.calendarDate || new Date())
-      // .add(1, 'day')
       .endOf('month')
       .toDate()
-    this.minDate = dayjs(this.calendarDate || new Date())
-      // .add(1, 'day')
-      .toDate()
+    this.minDate = dayjs(this.calendarDate || new Date()).toDate()
 
     console.log(this.list, 'this.list')
     console.log(this.calendarDate, 'calendarDate')
@@ -105,12 +94,14 @@ export default defineComponent({
       const dateStr = dayjs(date.date).format('YYYY-MM-DD')
       let isActive = false // 是否可选
       this.list.forEach((item: any) => {
+        // console.log(dateStr, item.calendarDate)
         if (item.calendarDate === dateStr) {
           isActive = true
         }
       })
       // 判断是否有课程 并且 时间在当前时间之后
-      if (isActive && dayjs().isBefore(dayjs(date.date))) {
+      // console.log(dayjs().isSameOrBefore(dayjs(date.date)), date.date)
+      if (isActive && dayjs(dayjs().format('YYYY-MM-DD')).isSameOrBefore(dayjs(date.date))) {
         date.bottomInfo = '可选'
         if (dayjs(dateStr).isSame(this.calendarDate)) {
           date.type = 'selected'