UNPKG

@pisell/pisellos

Version:

一个可扩展的前端模块化SDK框架,支持插件系统

200 lines (199 loc) 4.8 kB
import dayjs from 'dayjs'; export interface ScheduleState { scheduleList: ScheduleItem[]; /** 日程 Map 缓存(以 id key,加速查询) */ map: Map<number, ScheduleItem>; availabilityDateList: ScheduleAvailabilityDateItem[]; otherProductsIds: number[]; } export type ScheduleAvailabilityDateItem = { date: string; schedule_id: number[]; product_ids: number[]; }; /** * 加载日程可用日期参数接口 */ export interface LoadScheduleAvailableDateParams { /** 开始日期 */ startDate: string; /** 结束日期 */ endDate: string; /** 自定义页面ID */ custom_page_id?: number; /** 渠道 */ channel?: string; } export interface ScheduleModuleAPI { } export type ScheduleItem = { /** 颜色 */ color: string; /** 创建时间 */ created_at: string; /** 更新时间 */ updated_at: string; /** 开始时间 */ start_time: string; /** 结束时间 */ end_time: string; /** 日程名称 */ name: string; /** 关联订单 */ order_count: number; /** 关联项目数据*/ relation_count: number; repeat_rule: { end: { /** 截止类型 */ type: 'date' | 'never'; /** 结束时间 */ end_date: string | null; occurrence: any | null; }; frequency: number; excluded_date: ExcIncDate[]; included_date: ExcIncDate[]; frequency_date: number[]; }; repeat_type: 'daily' | 'none' | 'weekly'; /** 日程类型 * standard: 标准日程 * time-slots: 时间段日程 * designation: 指定日期日程 * */ type: 'standard' | 'time-slots' | 'designation'; conflict?: boolean; time_slot: { start_time: string; end_time: string; id: number; }[]; id: number; /** 指定的开始时间结束时间 */ designation: { start_date: string; end_date: string; start_time: string; end_time: string; } | { start_date: string; end_date: string; start_time: string; end_time: string; }[]; /** 是否全天 */ is_all: 1 | 0; [key: string]: any; relation?: { id: number; item_id: number; item_type: string; relation_table_type: string; schedule_id: number; }[]; }; export type ScheduleFormOtherValue = { /** 截止模式 * 1: 永不截止 * 2: 按日期截止 * */ endRadio: 1 | 2; /** 是否为全天 */ isAllDay: boolean; /** 是否开启排除日期 */ excludedStatus: boolean; /** 是否包含排除日期 */ includeStatus: boolean; type: 'standard' | 'time-slots' | 'designation'; }; export type ExcIncDate = { start: string; end: string; }; export type ScheduleFormData = { /** 颜色 */ color: string; /** 日程名称 */ name: { en: string; 'zh-CN': string; 'zh-HK': string; original: string; } | string; /** 重复模式 * 0:不重复 * 1:按天重复 * 2:按周重复 */ repeat_type: '0' | '1' | '2'; /** 备注 */ note: string; /** 指定的开始时间结束时间 */ designation: { start_date: string; end_date: string; start_time: string; end_time: string; } | { start_date: string; end_date: string; start_time: string; end_time: string; }[]; time_slot: { start_time: string; end_time: string; id: number; }[]; /** 重复频率 */ frequency: number; /** 按周重复时选择的周数据 */ frequency_date: number[]; /** 截止日期 */ end_date: string; /** 排除的日期范围 */ excluded_date: ExcIncDate[]; /** 包含的日期范围 */ included_date: ExcIncDate[]; /** 多时间段的开始时间 */ start_time: any; end_time: any; }; export type CalendarDataItem = { date: string; color: string[]; isExcluded: boolean; schedule_ids?: number[]; [key: string]: any; }; export type RequestData<Data> = { data: Data; status: boolean; message: string; code: number; }; export type ResponseListData<Data> = { status: boolean; message: string; code: number; data: { list: Data; count: number; size: number; skip: number; }; }; export type ScheduleAllMap = Record<string, { minTime: dayjs.Dayjs | null; maxTime: dayjs.Dayjs | null; minTimeStr: string | null; maxTimeStr: string | null; dateRange: { start: string; end: string; }[]; dateRangeFormat: { start: string; end: string; }[]; }>;