PrinceLee 5 سال پیش
والد
کامیت
0063fa7450
2فایلهای تغییر یافته به همراه27 افزوده شده و 11 حذف شده
  1. 22 10
      src/components/picker/SelDatePicker.vue
  2. 5 1
      src/views/projectManage/projectList/component/modifySchedule.vue

+ 22 - 10
src/components/picker/SelDatePicker.vue

@@ -72,9 +72,6 @@ export default {
     this.getHolidayDayInfo(startTime, endTime)
   },
   methods: {
-    confirmDate(e) {
-      this.$emit('getRangeDate', this.nowDates)
-    },
     panelChange(value, mode) { // 日历面板发生变化时的回调
       // console.log(value, mode)
     },
@@ -83,27 +80,36 @@ export default {
       if (res.code === 200) {
         this.holiday = res.data
       }
-      console.log(this.holiday)
     },
     async getSeprateDayInfo(dataArr) { // 获取选中时间中的工作日时间
       const res = await getSeprateDayInfo(dataArr)
       if (res.code === 200) {
         this.finally = res.data
       }
-      console.log('Seprate', this.finally)
+      this.change()
     },
     changeRange(dates) { // 获取开始结束日期
       this.nowDates = []
       const [start, end] = dates
+      this.nowDates = this.setHoliday('holiday', start, end)
+    },
+    setHoliday(type, start, end) {
+      const NewArr = []
       let nextDate = _.cloneDeep(start)
       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')
       }
-      this.getSeprateDayInfo(this.nowDates)
-      console.log(this.nowDates)
+      return NewArr
     },
     setSelect(current) { // 选择详细日期
       const isExist = this.nowDates.find(item => item === current.format('YYYY.MM.DD'))
@@ -112,7 +118,13 @@ export default {
       } else {
         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)
     }
   }
 }

+ 5 - 1
src/views/projectManage/projectList/component/modifySchedule.vue

@@ -10,7 +10,7 @@
         <search-people :value.sync="form.peoples" :multiple="true" @change="changePeoples" />
       </el-form-item>
       <el-form-item label="排期" prop="date_start">
-        <sel-date-picker :start-end="form.date_start" />
+        <sel-date-picker :start-end.sync="form.date_start" @getDetailDay="getDetailDay" />
       </el-form-item>
       <el-form-item label="问题描述">
         <el-input v-model="form.desc" autocomplete="off" placeholder="请输入问题描述内容..." />
@@ -106,6 +106,10 @@ export default {
       console.log('e', e)
       console.log('this.form.peoples', this.form.peoples)
     },
+    getDetailDay(e) { // 获取详细排期日期
+      console.log('e', e)
+      console.log('this.form.date_start', this.form.date_start)
+    },
     confirmForm() {
       this.cancel()
     },