mo 2 年之前
父節點
當前提交
56cc666e08

+ 2 - 1
src/views/businessManager/resetList/index.vue

@@ -76,10 +76,11 @@
             v-model.trim="searchForm.resetDate"
             type="daterange"
             value-format="yyyy-MM-dd"
+            :picker-options="{ firstDayOfWeek: 1 }"
             range-separator="至"
             start-placeholder="销售开始日期"
             end-placeholder="销售结束日期"
-            :picker-options="{ firstDayOfWeek: 1 }"
+
           >
           </el-date-picker>
         </el-form-item>

+ 37 - 0
src/views/main/cloudDate/exerciseDuration.vue

@@ -9,7 +9,11 @@
     >
       <el-form-item prop="dates">
         <el-date-picker
+        @change="changeWeek"
+        :closeable ="false"
           v-model="searchForm.dates"
+          value-format="yyyy-MM-dd"
+            :picker-options="{ firstDayOfWeek: 1 }"
           type="daterange"
           style="width: 405px"
           range-separator="至"
@@ -189,7 +193,15 @@
 import saveform from "@/components/save-form";
 import dayjs from "dayjs";
 import histogram from "v-charts/lib/histogram.common";
+import { getNowDateAndMonday, getNowDateAndSunday } from "@/utils/utils";
 import { cloudTeacherNum } from "../api";
+let nowTime = new Date()
+    nowTime =
+  nowTime.getFullYear() +
+  "-" +
+  (nowTime.getMonth() + 1) +
+  "-" +
+  nowTime.getDate();
 export const getTimes = (times, keys = []) => {
   if (times && times.length) {
     return {
@@ -212,6 +224,9 @@ export default {
     };
   },
   async mounted() {
+
+    this.searchForm.dates.push(getNowDateAndMonday(nowTime));
+    this.searchForm.dates.push(getNowDateAndSunday(nowTime));
     this.getList();
   },
   methods: {
@@ -230,8 +245,30 @@ export default {
         page: 1,
       };
       this.$refs.searchForm.resetFields();
+      this.searchForm.dates.push(getNowDateAndMonday(nowTime));
+    this.searchForm.dates.push(getNowDateAndSunday(nowTime));
       this.getList();
     },
+    getDefaultTime() {
+      const dayjs = this.$helpers.dayjs;
+      let nowDate = dayjs(new Date()).format("YYYY-MM-DD");
+      let lastWeek = dayjs(nowDate).subtract(1, "week").format("YYYY-MM-DD");
+      this.searchForm.dates = [
+        getNowDateAndMonday(lastWeek),
+        getNowDateAndSunday(nowDate),
+      ];
+
+    },
+    changeWeek(val) {
+      if (val) {
+        this.searchForm.dates  =  [
+          getNowDateAndMonday(val[0]),
+          getNowDateAndSunday(val[1]),
+        ]
+      } else {
+        this.getDefaultTime();
+      }
+    },
     async getList() {
       // cloudTeacherNum
       try {

+ 0 - 0
src/views/main/cloudDate/exerciseDurationDetail.vue