feat(duty): update frontend API types for dict and time fields

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
zlwuandCursor committed 2026-08-20 21:15:20 +08:00
1 parent cd0491e601
commit a98ec0443a
2 files changed
+31 -5

No files matched your search

+23 -2
View File
@@ -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
})
}
+8 -3
View File
@@ -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