소스 검색

fix(automation): the date picker of the task dialog is not linked to refresh

daigang 2 년 전
부모
커밋
f8adca479e
1개의 변경된 파일13개의 추가작업 그리고 3개의 파일을 삭제
  1. 13 3
      src/views/ad/automation/task/components/AssetTaskDialog.vue

+ 13 - 3
src/views/ad/automation/task/components/AssetTaskDialog.vue

@@ -16,6 +16,7 @@
               type="daterange"
               range-separator="至"
               value-format="yyyy-MM-dd"
+              :picker-options="pickerOptions"
               :editable="false"
               :clearable="false"
             />
@@ -85,6 +86,7 @@
 
 <script>
 import {
+  ONE_DAY,
   AssetType,
   TaskFromType,
   SCREEN_TIME_KEY,
@@ -110,10 +112,11 @@ export default {
           { value: TimeType.POINT, label: '时间点' }
         ]
       },
-      taskData: null,
+      taskDate: null,
       taskTime: {},
       taskCount: 100,
-      taskDuration: 5
+      taskDuration: 5,
+      taskData: null
     }
   },
   computed: {
@@ -150,19 +153,26 @@ export default {
     },
     disableTaskDuration () {
       return this.taskData?.type === AssetType.VIDEO
+    },
+    pickerOptions () {
+      return {
+        disabledDate: this.isDisableDate
+      }
     }
   },
   methods: {
     show (active) {
       this.active = active
       const date = parseTime(new Date(), '{y}-{m}-{d}')
-      this.taskData = null
       this.taskDate = [date, date]
       this.taskTime = parseTaskTime()
       this.taskCount = 100
       this.taskDuration = 5
       this.$refs.taskDialog.show()
     },
+    isDisableDate (date) {
+      return date <= Date.now() - ONE_DAY
+    },
     onRefreshTable () {
       this.$refs.table?.pageTo(1)
     },