xiongxing 1 Minggu lalu
induk
melakukan
92168dc6a1

+ 5 - 7
src/views/elderly/nursing/room-Inspection-project-log/index.vue

@@ -74,6 +74,7 @@ import Detail from './Detail.vue'
 import { ElderlyItemsRoundLogColumns } from '../column'
 import { useUserStore } from '@/store/modules/user'
 import { ROLE_SUBMIT_LABEL, getRoleSubmitLabel } from './roleSubmitLabel'
+import dayjs from 'dayjs'
 
 const userStore = useUserStore()
 
@@ -84,14 +85,11 @@ const roleSubmitOptions = Object.entries(ROLE_SUBMIT_LABEL).map(([enumKey, label
 
 defineOptions({ name: 'RoomInspectionProjectLog' })
 
-/** 默认巡房时间:当前自然月 [月初, 月末] */
+/** 默认巡房时间:[今天, 今天起往后一个月](按日历月加一个月) */
 function createDefaultRoundTimeRange(): string[] {
-  const now = new Date()
-  const start = new Date(now.getFullYear(), now.getMonth(), 1)
-  const end = new Date(now.getFullYear(), now.getMonth() + 1, 0)
-  const pad = (n: number) => String(n).padStart(2, '0')
-  const fmt = (d: Date) => `${d.getFullYear()}-${pad(d.getMonth() + 1)}-${pad(d.getDate())}`
-  return [fmt(start), fmt(end)]
+  const start = dayjs().startOf('day')
+  const end = start.add(1, 'month')
+  return [start.format('YYYY-MM-DD'), end.format('YYYY-MM-DD')]
 }
 
 const queryParams = reactive({