Browse Source

排除今天

wolyshaw 4 years ago
parent
commit
57e2ae2a80
1 changed files with 9 additions and 5 deletions
  1. 9 5
      src/views/main/baseinfo/index.vue

+ 9 - 5
src/views/main/baseinfo/index.vue

@@ -69,7 +69,8 @@ import { descs } from '../constant'
 const getInitDate = () => {
   const end = new Date();
   const start = new Date();
-  start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
+  end.setTime(end.getTime() - 3600 * 1000 * 24 * 1);
+  start.setTime(start.getTime() - 3600 * 1000 * 24 * 8);
   return [start, end]
 }
 export default {
@@ -86,14 +87,15 @@ export default {
       pickerOptions: {
         disabledDate: a => {
           const { dayjs } = this.$helpers
-          return dayjs(a).isAfter(dayjs())
+          return dayjs(a).isAfter(dayjs().subtract(1, 'day'))
         },
         shortcuts: [{
           text: '最近一周',
           onClick(picker) {
             const end = new Date();
             const start = new Date();
-            start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
+            end.setTime(end.getTime() - 3600 * 1000 * 24 * 1);
+            start.setTime(start.getTime() - 3600 * 1000 * 24 * 8);
             picker.$emit('pick', [start, end]);
           }
         }, {
@@ -101,7 +103,8 @@ export default {
           onClick(picker) {
             const end = new Date();
             const start = new Date();
-            start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
+            end.setTime(end.getTime() - 3600 * 1000 * 24 * 1);
+            start.setTime(start.getTime() - 3600 * 1000 * 24 * 31);
             picker.$emit('pick', [start, end]);
           }
         }, {
@@ -109,7 +112,8 @@ export default {
           onClick(picker) {
             const end = new Date();
             const start = new Date();
-            start.setTime(start.getTime() - 3600 * 1000 * 24 * 90);
+            end.setTime(end.getTime() - 3600 * 1000 * 24 * 1);
+            start.setTime(start.getTime() - 3600 * 1000 * 24 * 91);
             picker.$emit('pick', [start, end]);
           }
         }]