mo 2 years ago
parent
commit
5b2bb985bc

+ 65 - 15
src/views/main/baseinfo/modals/searchDayHeader.vue

@@ -58,7 +58,66 @@ export default {
   watch: {
     dates(val) {
       this.date = val;
-    },
+      this.timer = ''
+        if( this.$helpers
+            .dayjs(new Date())
+            .set("date", 1)
+            .format("YYYY-MM-DD")==this.date[0] && this.$helpers
+            .dayjs(new Date())
+            .subtract(1, "day")
+            .format("YYYY-MM-DD")==this.date[1] || this.date[0] == this.$helpers
+            .dayjs()
+            .add(-1, "month")
+            .startOf("month")
+            .format("YYYY-MM-DD") && this.$helpers
+            .dayjs(new Date())
+            .subtract(1, "day")
+            .format("YYYY-MM-DD")== this.date[1]){
+              this.timer = 'month'
+            }
+
+    if(this.$helpers
+          .dayjs(new Date())
+          .format("YYYY-MM-DD")==this.date[0]&&this.date[1]==this.$helpers
+              .dayjs(new Date())
+              .format("YYYY-MM-DD")){
+      this.timer = 'day'
+    }
+
+    if(this.$helpers.dayjs(new Date()).get("date") ==1 &&this.$helpers.dayjs(new Date()).get("month") + 1 ==1&&this.date[0]==this.$helpers
+            .dayjs(new Date())
+            .add(-1, "year")
+            .set("month", 0)
+            .set("date", 1)
+            .format("YYYY-MM-DD")&&this.date[1]==this.$helpers
+            .dayjs(new Date())
+            .subtract(1, "day")
+            .format("YYYY-MM-DD") || this.date[0]==this.$helpers
+            .dayjs(new Date())
+            .set("month", 0)
+            .set("date", 1)
+            .format("YYYY-MM-DD")&& this.date[1] == this.$helpers
+                .dayjs(new Date())
+                .subtract(1, "day")
+                .format("YYYY-MM-DD")){
+      this.timer = 'year'
+    }
+
+    if(this.date[0]==this.$helpers
+          .dayjs(new Date())
+          .subtract(1, "year")
+          .set("month", 0)
+          .set("date", 1)
+          .format("YYYY-MM-DD")&&this.date[1]==this.$helpers
+          .dayjs()
+          .subtract(1, "year")
+          .endOf("year")
+          .format("YYYY-MM-DD")){
+            this.timer = 'lastYear'
+          }
+        }
+
+
   },
 
   methods: {
@@ -70,6 +129,7 @@ export default {
       this.timer = "";
       this.date = val;
       this.submitDate(this.date);
+
     },
     changeQuick(val) {
       let startDate;
@@ -98,16 +158,6 @@ export default {
             .subtract(1, "day")
             .format("YYYY-MM-DD");
         }
-        // startDate = this.$helpers
-        //   .dayjs(new Date())
-        //   .set("date", 1)
-        //   .format("YYYY-MM-DD");
-        // this.endDate
-        //   ? (endDate = this.endDate)
-        //   : (endDate = this.$helpers
-        //       .dayjs(new Date())
-        //       .subtract(1, "day")
-        //       .format("YYYY-MM-DD"));
         this.date = [startDate, endDate];
         this.submitDate(this.date);
       } else if (val == "day") {
@@ -143,12 +193,12 @@ export default {
             .set("month", 0)
             .set("date", 1)
             .format("YYYY-MM-DD");
-          this.endDate
-            ? (endDate = this.endDate)
-            : (endDate = this.$helpers
+
+            endDate = this.$helpers
                 .dayjs(new Date())
                 .subtract(1, "day")
-                .format("YYYY-MM-DD"));
+                .format("YYYY-MM-DD");
+
         }
 
         this.date = [startDate, endDate];

+ 59 - 3
src/views/main/baseinfo/modals/searchHeader.vue

@@ -57,6 +57,63 @@ export default {
   watch: {
     dates(val) {
       this.date = val;
+      this.timer = ''
+        if( this.$helpers
+            .dayjs(new Date())
+            .set("date", 1)
+            .format("YYYY-MM-DD")==this.date[0] && this.$helpers
+            .dayjs(new Date())
+            .subtract(1, "day")
+            .format("YYYY-MM-DD")==this.date[1] || this.date[0] == this.$helpers
+            .dayjs()
+            .add(-1, "month")
+            .startOf("month")
+            .format("YYYY-MM-DD") && this.$helpers
+            .dayjs(new Date())
+            .subtract(1, "day")
+            .format("YYYY-MM-DD")== this.date[1]){
+              this.timer = 'month'
+            }
+
+    if(this.$helpers
+          .dayjs(new Date())
+          .format("YYYY-MM-DD")==this.date[0]&&this.date[1]==this.$helpers
+              .dayjs(new Date())
+              .format("YYYY-MM-DD")){
+      this.timer = 'day'
+    }
+
+    if(this.$helpers.dayjs(new Date()).get("date") ==1 &&this.$helpers.dayjs(new Date()).get("month") + 1 ==1&&this.date[0]==this.$helpers
+            .dayjs(new Date())
+            .add(-1, "year")
+            .set("month", 0)
+            .set("date", 1)
+            .format("YYYY-MM-DD")&&this.date[1]==this.$helpers
+            .dayjs(new Date())
+            .subtract(1, "day")
+            .format("YYYY-MM-DD") || this.date[0]==this.$helpers
+            .dayjs(new Date())
+            .set("month", 0)
+            .set("date", 1)
+            .format("YYYY-MM-DD")&& this.date[1] == this.$helpers
+                .dayjs(new Date())
+                .subtract(1, "day")
+                .format("YYYY-MM-DD")){
+      this.timer = 'year'
+    }
+
+    if(this.date[0]==this.$helpers
+          .dayjs(new Date())
+          .subtract(1, "year")
+          .set("month", 0)
+          .set("date", 1)
+          .format("YYYY-MM-DD")&&this.date[1]==this.$helpers
+          .dayjs()
+          .subtract(1, "year")
+          .endOf("year")
+          .format("YYYY-MM-DD")){
+            this.timer = 'lastYear'
+          }
     },
   },
 
@@ -119,9 +176,8 @@ export default {
             .set("month", 0)
             .set("date", 1)
             .format("YYYY-MM-DD");
-          this.endDate
-            ? (endDate = this.endDate)
-            : (endDate = this.$helpers
+
+             (endDate = this.$helpers
                 .dayjs(new Date())
                 .subtract(1, "day")
                 .format("YYYY-MM-DD"));

+ 59 - 3
src/views/smallStudentManager/components/searchHeader.vue

@@ -62,6 +62,64 @@ export default {
   watch: {
     dates(val) {
       this.date = val;
+      this.timer = ''
+        if( this.$helpers
+            .dayjs(new Date())
+            .set("date", 1)
+            .format("YYYY-MM-DD")==this.date[0] && this.$helpers
+            .dayjs(new Date())
+            .subtract(1, "day")
+            .format("YYYY-MM-DD")==this.date[1] || this.date[0] == this.$helpers
+            .dayjs()
+            .add(-1, "month")
+            .startOf("month")
+            .format("YYYY-MM-DD") && this.$helpers
+            .dayjs(new Date())
+            .subtract(1, "day")
+            .format("YYYY-MM-DD")== this.date[1]){
+              this.timer = 'month'
+            }
+
+    if(this.$helpers
+          .dayjs(new Date())
+          .format("YYYY-MM-DD")==this.date[0]&&this.date[1]==this.$helpers
+              .dayjs(new Date())
+              .format("YYYY-MM-DD")){
+      this.timer = 'day'
+    }
+
+    if(this.$helpers.dayjs(new Date()).get("date") ==1 &&this.$helpers.dayjs(new Date()).get("month") + 1 ==1&&this.date[0]==this.$helpers
+            .dayjs(new Date())
+            .add(-1, "year")
+            .set("month", 0)
+            .set("date", 1)
+            .format("YYYY-MM-DD")&&this.date[1]==this.$helpers
+            .dayjs(new Date())
+            .subtract(1, "day")
+            .format("YYYY-MM-DD") || this.date[0]==this.$helpers
+            .dayjs(new Date())
+            .set("month", 0)
+            .set("date", 1)
+            .format("YYYY-MM-DD")&& this.date[1] == this.$helpers
+                .dayjs(new Date())
+                .subtract(1, "day")
+                .format("YYYY-MM-DD")){
+      this.timer = 'year'
+    }
+
+    if(this.date[0]==this.$helpers
+          .dayjs(new Date())
+          .subtract(1, "year")
+          .set("month", 0)
+          .set("date", 1)
+          .format("YYYY-MM-DD")&&this.date[1]==this.$helpers
+          .dayjs()
+          .subtract(1, "year")
+          .endOf("year")
+          .format("YYYY-MM-DD")){
+            this.timer = 'lastYear'
+          }
+
     },
   },
 
@@ -114,9 +172,7 @@ export default {
             .set("month", 0)
             .set("date", 1)
             .format("YYYY-MM-DD");
-          this.endDate
-            ? (endDate = this.endDate)
-            : (endDate = this.$helpers
+        (endDate = this.$helpers
                 .dayjs(new Date())
                 .subtract(1, "day")
                 .format("YYYY-MM-DD"));