2024-11-06 20:14:22 +08:00
|
|
|
import { DatePickerView } from './compose/DatePickerView'
|
|
|
|
|
import { ToolsHelper } from './ToolsHelper'
|
|
|
|
|
|
|
|
|
|
export interface DateDialogOptions {
|
2024-11-06 20:19:55 +08:00
|
|
|
// 'YYYY-MM-DD'年月日对应的标识,随意组合,默认YYYY-MM-DD
|
2024-11-06 20:14:22 +08:00
|
|
|
type?: string
|
2024-11-06 20:19:55 +08:00
|
|
|
// 可选择的开始日期,默认1970-1-1
|
2024-11-06 20:14:22 +08:00
|
|
|
startDate?: string
|
2024-11-06 20:19:55 +08:00
|
|
|
// 可选择的结束日期,默认当前月最后一天
|
2024-11-06 20:14:22 +08:00
|
|
|
endDate?: string
|
2024-11-06 20:19:55 +08:00
|
|
|
// 当前选中的日期,默认当前日期
|
2024-11-06 20:14:22 +08:00
|
|
|
currentDate?: string
|
2024-11-06 20:19:55 +08:00
|
|
|
// 选择器确定按钮点击事件
|
2024-11-06 20:14:22 +08:00
|
|
|
onConfirm: (date: string) => void
|
2024-11-06 20:19:55 +08:00
|
|
|
// 选择器取消按钮点击事件
|
2024-11-06 20:14:22 +08:00
|
|
|
onCancel?: () => void
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Builder
|
|
|
|
|
function dateDialogBuilder(option: DateDialogOptions, dialogTag: string) {
|
|
|
|
|
|
|
|
|
|
DatePickerView({
|
|
|
|
|
option: option,
|
|
|
|
|
dialogTag: dialogTag,
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
export class PickerDateTimeHelper {
|
|
|
|
|
private constructor() {
|
|
|
|
|
}
|
|
|
|
|
|
2024-11-06 20:19:55 +08:00
|
|
|
/**
|
|
|
|
|
* 显示日期选择器
|
|
|
|
|
* @param options
|
|
|
|
|
* @param p 调用页面直接this
|
|
|
|
|
*/
|
2024-11-06 20:14:22 +08:00
|
|
|
static showDateDialog(options: DateDialogOptions, p: object) {
|
|
|
|
|
const dialogTag = ToolsHelper.getUuid()
|
|
|
|
|
ToolsHelper.showCustomDialog(dialogTag, dateDialogBuilder.bind(p, options, dialogTag),
|
|
|
|
|
DialogAlignment.Bottom)
|
|
|
|
|
}
|
|
|
|
|
}
|