feat(M08-B): 补保洁员资料管理
This commit is contained in:
@@ -4,10 +4,13 @@ import type {
|
||||
CleaningStatistics,
|
||||
CleaningTask,
|
||||
CleaningTaskMember,
|
||||
ManagedUser,
|
||||
PageResult,
|
||||
StaffRole,
|
||||
SettlementStatus,
|
||||
TaskStatus,
|
||||
TransferMode,
|
||||
UserStatus,
|
||||
WechatTransferPreflight
|
||||
} from './types';
|
||||
|
||||
@@ -76,6 +79,62 @@ export function getCleaningStatistics(
|
||||
return request<CleaningStatistics>(session, `/cleaning/statistics${query ? `?${query}` : ''}`);
|
||||
}
|
||||
|
||||
export function listStaffUsers(
|
||||
session: ApiSession,
|
||||
input: {
|
||||
page: number;
|
||||
pageSize: number;
|
||||
role?: StaffRole;
|
||||
status?: UserStatus;
|
||||
search?: string;
|
||||
}
|
||||
) {
|
||||
const params = new URLSearchParams({
|
||||
page: String(input.page),
|
||||
pageSize: String(input.pageSize)
|
||||
});
|
||||
if (input.role) params.set('role', input.role);
|
||||
if (input.status) params.set('status', input.status);
|
||||
if (input.search) params.set('search', input.search);
|
||||
return request<{ items: ManagedUser[]; total: number }>(session, `/users?${params}`);
|
||||
}
|
||||
|
||||
export function createStaffUser(
|
||||
session: ApiSession,
|
||||
input: { nickname: string; phone: string; note?: string; roles: StaffRole[]; storeIds: string[] }
|
||||
) {
|
||||
return request<{ userId: string }>(session, '/staff', {
|
||||
method: 'POST',
|
||||
body: JSON.stringify(input)
|
||||
});
|
||||
}
|
||||
|
||||
export function updateStaffUser(
|
||||
session: ApiSession,
|
||||
userId: string,
|
||||
input: Partial<{
|
||||
nickname: string;
|
||||
phone: string;
|
||||
note: string;
|
||||
status: UserStatus;
|
||||
roles: StaffRole[];
|
||||
storeIds: string[];
|
||||
}>
|
||||
) {
|
||||
return request<{ userId: string }>(session, `/users/${encodeURIComponent(userId)}`, {
|
||||
method: 'PATCH',
|
||||
body: JSON.stringify(input)
|
||||
});
|
||||
}
|
||||
|
||||
export function resetStaffSessions(session: ApiSession, userId: string) {
|
||||
return request<{ userId: string; revokedSessions: number }>(
|
||||
session,
|
||||
`/users/${encodeURIComponent(userId)}/reset-sessions`,
|
||||
{ method: 'POST' }
|
||||
);
|
||||
}
|
||||
|
||||
export function assignCleaningTask(
|
||||
session: ApiSession,
|
||||
taskId: string,
|
||||
|
||||
Reference in New Issue
Block a user