|
@@ -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 {
|