af-mobile-client-vue3 1.4.86 → 1.4.87

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "af-mobile-client-vue3",
3
3
  "type": "module",
4
- "version": "1.4.86",
4
+ "version": "1.4.87",
5
5
  "packageManager": "pnpm@10.13.1",
6
6
  "description": "Vue + Vite component lib",
7
7
  "engines": {
@@ -120,7 +120,7 @@ const datePickerMaxDate = computed(() => {
120
120
  })
121
121
 
122
122
  // 根据 attr.dateRangeOption 限制时间选择器的列选项
123
- // 如果 type 为 'afterToday',则小时列从当前小时+1开始
123
+ // 如果 type 为 'afterToday',则根据选择的日期决定小时起始值
124
124
  const timePickerColumns = computed(() => {
125
125
  const opt = (props.attr as any).dateRangeOption
126
126
  if (!opt || opt.type !== 'afterToday' || props.mode === '查询')
@@ -129,11 +129,32 @@ const timePickerColumns = computed(() => {
129
129
  const columns: any[] = []
130
130
  const pad = (n: number) => n.toString().padStart(2, '0')
131
131
  const now = dayjs()
132
- const start = now.hour() + 1
133
132
 
134
- // 小时列从当前小时+1开始到23
133
+ // 获取用户选择的日期
134
+ const selectedDate = dateTimePickerValue.value.date
135
+ let startHour = 0 // 默认从00:00开始
136
+
137
+ // 如果选择的日期是今天,才限制从当前小时+1开始
138
+ if (selectedDate && selectedDate.length >= 3) {
139
+ const selectedYear = parseInt(selectedDate[0])
140
+ const selectedMonth = parseInt(selectedDate[1])
141
+ const selectedDay = parseInt(selectedDate[2] || '1')
142
+
143
+ const selectedDateTime = dayjs().year(selectedYear).month(selectedMonth - 1).date(selectedDay).startOf('day')
144
+ const today = now.startOf('day')
145
+
146
+ // 如果选择的是今天,才从当前小时+1开始
147
+ if (selectedDateTime.isSame(today, 'day')) {
148
+ startHour = now.hour() + 1
149
+ }
150
+ } else {
151
+ // 如果没有选择日期,默认为今天,限制时间
152
+ startHour = now.hour() + 1
153
+ }
154
+
155
+ // 小时列从计算出的起始小时开始到23
135
156
  const hourOptions = []
136
- for (let h = start; h < 24; h++) {
157
+ for (let h = startHour; h < 24; h++) {
137
158
  hourOptions.push({ text: pad(h), value: pad(h) })
138
159
  }
139
160
  // 如果没有可选小时(例如当前为23),允许选择23