feat: 完成 R13/R14/R15/R16 小团队管理核心能力
这个提交包含在:
@@ -0,0 +1,67 @@
|
||||
import { apiRequestData } from "./http";
|
||||
|
||||
export type PresenceStatus = "office" | "remote" | "out" | "travel" | "leave";
|
||||
export type PresenceTimeRange = "full_day" | "morning" | "afternoon";
|
||||
export type PresenceSource = "manual" | "leave_sync";
|
||||
|
||||
export type PresenceItem = {
|
||||
id: string;
|
||||
employeeId: string;
|
||||
date: string;
|
||||
status: PresenceStatus;
|
||||
timeRange: PresenceTimeRange;
|
||||
note: string | null;
|
||||
source: PresenceSource;
|
||||
updatedAt: string | null;
|
||||
};
|
||||
|
||||
export type PresenceEmployee = {
|
||||
id: string;
|
||||
employeeNo: string;
|
||||
name: string;
|
||||
title: string;
|
||||
employmentStatus: string;
|
||||
department: { id: string; name: string } | null;
|
||||
};
|
||||
|
||||
export type TeamPresenceItem = {
|
||||
employee: PresenceEmployee;
|
||||
presence: PresenceItem | null;
|
||||
};
|
||||
|
||||
export type PresenceSummary = {
|
||||
office: number;
|
||||
remote: number;
|
||||
out: number;
|
||||
travel: number;
|
||||
leave: number;
|
||||
unspecified: number;
|
||||
total: number;
|
||||
};
|
||||
|
||||
export async function fetchMyPresence(date?: string) {
|
||||
const suffix = date ? `?date=${encodeURIComponent(date)}` : "";
|
||||
return apiRequestData<{ item: PresenceItem | null; date: string }>(`/api/presence/me${suffix}`);
|
||||
}
|
||||
|
||||
export async function upsertMyPresence(payload: {
|
||||
date?: string;
|
||||
status: Extract<PresenceStatus, "office" | "remote" | "out" | "travel">;
|
||||
timeRange?: PresenceTimeRange;
|
||||
note?: string | null;
|
||||
}) {
|
||||
return apiRequestData<{ item: PresenceItem }>("/api/presence/me", {
|
||||
method: "PUT",
|
||||
body: JSON.stringify(payload),
|
||||
});
|
||||
}
|
||||
|
||||
export async function fetchTeamPresence(date?: string) {
|
||||
const suffix = date ? `?date=${encodeURIComponent(date)}` : "";
|
||||
return apiRequestData<{ date: string; summary: PresenceSummary; items: TeamPresenceItem[] }>(`/api/presence/team${suffix}`);
|
||||
}
|
||||
|
||||
export async function fetchPresenceSummary(date?: string) {
|
||||
const suffix = date ? `?date=${encodeURIComponent(date)}` : "";
|
||||
return apiRequestData<{ date: string; summary: PresenceSummary }>(`/api/presence/summary${suffix}`);
|
||||
}
|
||||
在新工单中引用
屏蔽一个用户