diff --git a/web-admin/src/api/duty.ts b/web-admin/src/api/duty.ts index 31657d720..1d9ae3130 100644 --- a/web-admin/src/api/duty.ts +++ b/web-admin/src/api/duty.ts @@ -1,6 +1,7 @@ import request from '@/utils/http' -export type ShiftType = 'morning' | 'evening' | 'duty' +/** 预置 morning|evening|duty,亦可为自定义 dict_value */ +export type ShiftType = string export type LinkStatus = 'open' | 'closed' export interface DutyAssignmentItem { @@ -16,8 +17,14 @@ export interface DutySlotItem { shiftLabel?: string capacity: number taken?: number - /** 班次工作安排 */ + workPlans?: string[] + workPlanLabels?: string[] + /** 备注(与工作安排分离) */ remark?: string | null + startTime?: string | null + endTime?: string | null + crossDay?: boolean + timeLabel?: string | null assignments: DutyAssignmentItem[] } @@ -49,7 +56,11 @@ export function saveDutyDay(data: { slots: Array<{ shiftType: ShiftType capacity: number + workPlans?: string[] remark?: string | null + startTime?: string | null + endTime?: string | null + crossDay?: boolean assignments: DutyAssignmentItem[] }> linkStatus?: LinkStatus @@ -78,3 +89,13 @@ export function fetchDutyUserOptions() { url: '/web/admin/duty/users/options' }) } + +export function ensureDutyDict(data: { + dictType: 'duty_shift_type' | 'duty_work_plan' + label: string +}) { + return request.post<{ label: string; value: string }>({ + url: '/web/admin/duty/dict/ensure', + data + }) +} diff --git a/web-admin/src/api/public-duty.ts b/web-admin/src/api/public-duty.ts index 2f1fe4376..bece7eec2 100644 --- a/web-admin/src/api/public-duty.ts +++ b/web-admin/src/api/public-duty.ts @@ -1,5 +1,4 @@ import { publicPlGet, publicPlPost } from '@/utils/http/public-pl' -import type { ShiftType } from '@/api/duty' export interface PublicDutyUserOption { id: string @@ -8,11 +7,17 @@ export interface PublicDutyUserOption { export interface PublicDutySlot { id?: string - shiftType: ShiftType + shiftType: string shiftLabel?: string capacity: number taken: number + workPlans?: string[] + workPlanLabels?: string[] remark?: string | null + startTime?: string | null + endTime?: string | null + crossDay?: boolean + timeLabel?: string | null assignments: Array<{ id?: string; source: string; personName: string; userId?: string }> } @@ -26,7 +31,7 @@ export interface PublicDutyPage { export interface PublicDutyGrabResult { dutyDate: string - shiftType: ShiftType + shiftType: string shiftLabel: string personName: string userId?: string