Просмотр исходного кода

看课统计添加默认条件

wangxy 1 неделя назад
Родитель
Сommit
461224f5b0
1 измененных файлов с 13 добавлено и 1 удалено
  1. 13 1
      src/views/his/statistics/courseReport.vue

+ 13 - 1
src/views/his/statistics/courseReport.vue

@@ -209,7 +209,7 @@ export default {
         source: null,
         trainingCampId: null,
         periodId: null,
-        dimension: 'company'
+        dimension: 'camp'
       },
       // 表单参数
       form: {},
@@ -218,6 +218,18 @@ export default {
     };
   },
   created() {
+    // 设置默认时间为前一天
+    const yesterday = new Date();
+    yesterday.setDate(yesterday.getDate() - 1);
+    const formatDate = (date) => {
+      const year = date.getFullYear();
+      const month = String(date.getMonth() + 1).padStart(2, '0');
+      const day = String(date.getDate()).padStart(2, '0');
+      return `${year}-${month}-${day}`;
+    };
+    this.createTime = [formatDate(yesterday), formatDate(yesterday)];
+    this.queryParams.sTime = this.createTime[0];
+    this.queryParams.eTime = this.createTime[1];
     getCampList().then(response => {
       this.camps = response.data.list
       if (this.camps != null && this.camps.length > 0) {