Lijy 1 miesiąc temu
rodzic
commit
d6f7e0b709

+ 21 - 7
fhKeeper/formulahousekeeper/customerBuler-crm/src/pages/biReport/cusTotalAnalysis/api.ts

@@ -64,13 +64,27 @@ export const dateCollections = [
     end_time: dayjs().add(-1, 'month').endOf('month').format('YYYY-MM-DD HH:mm:ss')
   },
   {
-    name: '本季度',
-    start_time: dayjs().month(0).format('YYYY-MM-DD HH:mm:ss'),
-    end_time: dayjs().month(2).endOf('month').format('YYYY-MM-DD HH:mm:ss')
+    name: "本季度",
+    start_time: dayjs()
+      .month(Math.floor(dayjs().month() / 3) * 3) // 当前季度的起始月份
+      .startOf("month")
+      .format("YYYY-MM-DD HH:mm:ss"),
+    end_time: dayjs()
+      .month(Math.floor(dayjs().month() / 3) * 3 + 2) // 当前季度的结束月份
+      .endOf("month")
+      .format("YYYY-MM-DD HH:mm:ss"),
   },
   {
-    name: '上季度',
-    start_time: dayjs().add(-1, 'year').month(9).format('YYYY-MM-DD HH:mm:ss'),
-    end_time: dayjs().add(-1, 'year').month(11).endOf('month').format('YYYY-MM-DD HH:mm:ss')
-  }
+    name: "上季度",
+    start_time: dayjs()
+      .subtract(1, "quarter")
+      .month(Math.floor(dayjs().subtract(1, "quarter").month() / 3) * 3)
+      .startOf("month")
+      .format("YYYY-MM-DD HH:mm:ss"),
+    end_time: dayjs()
+      .subtract(1, "quarter")
+      .month(Math.floor(dayjs().subtract(1, "quarter").month() / 3) * 3 + 2)
+      .endOf("month")
+      .format("YYYY-MM-DD HH:mm:ss"),
+  },
 ];