Przeglądaj źródła

调班修改为今天之前的日期不可调整

zhonghuizhen 9 miesięcy temu
rodzic
commit
8e2a452068

+ 24 - 7
src/views/business/​scheduleManage/components/adjust-edit.vue

@@ -631,6 +631,9 @@ export default {
                 schedule.startDate,
                 self.currentShift
               )
+              self.beforeDateList = self.filterTodayList(
+                self.beforeDateList,
+              )
               const filterid = self.$store.getters.userId || ''
               if (
                 self.beforeDateList.length > 0 &&
@@ -941,6 +944,16 @@ export default {
       })
       return result
     },
+    /*过滤今天之前的日期不可选 */
+    filterTodayList(dateList) {
+       // 将日期在今天之前的排班也锁定
+       dateList.forEach((el) => {
+           if (this.equalDate(el.value)) {
+               el.disabled = true
+           }
+      })
+      return dateList
+    },
     /**
      * 过滤锁定班次,返回被过滤后的排班van数据
      * @param bList  锁定班次数组
@@ -951,12 +964,7 @@ export default {
       // 根据锁定数据,过滤当前列表
       const filterBList = bList[filterid] || []
       const { startDate } = this.scheduleInfo
-      // 将日期在今天之前的排班也锁定
-      // dateList.forEach((el) => {
-      //     if (this.equalDate(el.value)) {
-      //         el.disabled = true
-      //     }
-      // })
+     
       filterBList.forEach((el) => {
         const index = this.getDays(startDate, el.value)
         if (
@@ -1152,6 +1160,9 @@ export default {
         this.scheduleInfo.startDate,
         this.targetShift
       ) // 转换目标人能选择的日期
+      this.afterDateList = this.filterTodayList(
+                this.afterDateList,
+      )
       this.formData.adjustList[index]['afterDate'] = '' // 更换目标人时刷新目标日期
       const filterid = val || ''
       if (
@@ -1497,6 +1508,9 @@ export default {
           )
         }
       }
+      this.beforeDateList = this.filterTodayList(
+          this.beforeDateList,
+      )
       // 刷新当前用户的过滤数据
       const filterid = this.$store.getters.userId || ''
       if (
@@ -1522,6 +1536,9 @@ export default {
           'del'
         )
       }
+      this.beforeDateList = this.filterTodayList(
+          this.beforeDateList,
+      )
       // 刷新当前用户的过滤数据
       const filterid = this.$store.getters.userId || ''
       if (
@@ -1585,7 +1602,7 @@ export default {
         dateStr.split('-')[2]
       )
       // 进行比较
-      if (dateObj >= today) {
+      if (dateObj > today) {
         return false
       } else {
         return true