R41: 完成员工批量导入
这个提交包含在:
@@ -23,6 +23,55 @@ export type UserListResponse = {
|
||||
items: UserSummary[];
|
||||
};
|
||||
|
||||
export type UserImportRowError = {
|
||||
field: string;
|
||||
message: string;
|
||||
};
|
||||
|
||||
export type UserImportPreviewRow = {
|
||||
rowNumber: number;
|
||||
employeeNo: string;
|
||||
name: string;
|
||||
normalized: {
|
||||
employeeNo: string;
|
||||
name: string;
|
||||
phone: string;
|
||||
email: string;
|
||||
departmentName: string;
|
||||
title: string;
|
||||
directManagerEmployeeNo: string;
|
||||
roles: string[];
|
||||
hireDate: string;
|
||||
};
|
||||
errors: UserImportRowError[];
|
||||
};
|
||||
|
||||
export type UserImportDryRunResult = {
|
||||
sourceFilename: string;
|
||||
summary: {
|
||||
totalRows: number;
|
||||
validRows: number;
|
||||
invalidRows: number;
|
||||
};
|
||||
rows: UserImportPreviewRow[];
|
||||
};
|
||||
|
||||
export type UserImportApplyResult = {
|
||||
sourceFilename: string;
|
||||
summary: {
|
||||
totalRows: number;
|
||||
validRows: number;
|
||||
invalidRows: number;
|
||||
};
|
||||
imported: Array<{
|
||||
employeeId: string;
|
||||
employeeNo: string;
|
||||
name: string;
|
||||
email: string;
|
||||
oneTimePassword: string;
|
||||
}>;
|
||||
};
|
||||
|
||||
export async function fetchUsers(params: {
|
||||
page: number;
|
||||
pageSize: number;
|
||||
@@ -82,3 +131,21 @@ export async function setUserRoles(userId: string, roles: string[]) {
|
||||
body: JSON.stringify({ roles }),
|
||||
});
|
||||
}
|
||||
|
||||
export async function dryRunUserImport(file: File) {
|
||||
const formData = new FormData();
|
||||
formData.append("file", file);
|
||||
return apiRequestData<UserImportDryRunResult>("/api/users/import/dry-run", {
|
||||
method: "POST",
|
||||
body: formData,
|
||||
});
|
||||
}
|
||||
|
||||
export async function applyUserImport(file: File) {
|
||||
const formData = new FormData();
|
||||
formData.append("file", file);
|
||||
return apiRequestData<UserImportApplyResult>("/api/users/import/apply", {
|
||||
method: "POST",
|
||||
body: formData,
|
||||
});
|
||||
}
|
||||
|
||||
在新工单中引用
屏蔽一个用户