fix(加班申请、工作报告、我的绩效): 重构页面样式、修复一系列bug、对不合理的地方进行调整。
This commit is contained in:
@@ -15,6 +15,7 @@ interface BackendUserInfoDTO {
|
||||
userId: string | number;
|
||||
userName?: string | null;
|
||||
nickname?: string | null;
|
||||
deptId?: string | number | null;
|
||||
roles?: string[] | null;
|
||||
buttons?: string[] | null;
|
||||
}
|
||||
@@ -61,6 +62,7 @@ function mapUserInfo(data: BackendUserInfoDTO): Api.Auth.UserInfo {
|
||||
userId: String(data.userId ?? ''),
|
||||
userName: data.userName ?? '',
|
||||
nickname: data.nickname ?? '',
|
||||
deptId: safeStringId(data.deptId),
|
||||
roles: data.roles ?? [],
|
||||
buttons: data.buttons ?? []
|
||||
};
|
||||
|
||||
@@ -34,7 +34,26 @@ type OvertimeApplicationApprovalRecordResponse = Omit<
|
||||
auditorUserId: StringIdResponse;
|
||||
};
|
||||
|
||||
type TeamOvertimeSummaryResponse = Api.OvertimeApplication.TeamOvertimeSummary;
|
||||
type TeamOvertimeSummaryResponse = Omit<
|
||||
Api.OvertimeApplication.TeamOvertimeSummary,
|
||||
'overtimeDateStart' | 'overtimeDateEnd'
|
||||
> & {
|
||||
overtimeDateStart?: unknown;
|
||||
overtimeDateEnd?: unknown;
|
||||
};
|
||||
|
||||
function normalizeDateText(value: unknown) {
|
||||
if (value === null || value === undefined) return undefined;
|
||||
const text = String(value).trim();
|
||||
const commaDateMatch = text.match(/^(\d{4}),(\d{1,2}),(\d{1,2})$/);
|
||||
|
||||
if (commaDateMatch) {
|
||||
const [, year, month, day] = commaDateMatch;
|
||||
return `${year}-${month.padStart(2, '0')}-${day.padStart(2, '0')}`;
|
||||
}
|
||||
|
||||
return text || undefined;
|
||||
}
|
||||
|
||||
function normalizeBooleanFlag(value: boolean | number | string | null | undefined) {
|
||||
if (typeof value === 'boolean') {
|
||||
@@ -309,7 +328,14 @@ export async function fetchGetTeamOvertimeSummary(params: Api.OvertimeApplicatio
|
||||
params
|
||||
});
|
||||
|
||||
return mapServiceResult(result as ServiceRequestResult<TeamOvertimeSummaryResponse>, data => data);
|
||||
return mapServiceResult(result as ServiceRequestResult<TeamOvertimeSummaryResponse>, data => {
|
||||
if (!data) return data;
|
||||
return {
|
||||
...data,
|
||||
overtimeDateStart: normalizeDateText(data.overtimeDateStart) || '',
|
||||
overtimeDateEnd: normalizeDateText(data.overtimeDateEnd) || ''
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
export function fetchExportOvertimeApplications(params: Api.OvertimeApplication.OvertimeApplicationSearchParams = {}) {
|
||||
|
||||
@@ -324,6 +324,18 @@ export function fetchGetDeptSimpleList() {
|
||||
});
|
||||
}
|
||||
|
||||
/** 获取部门自身及全部子部门 */
|
||||
export async function fetchGetDeptSelfAndChildren(id: string) {
|
||||
const result = await request<Api.SystemManage.DeptSelfAndChildrenList>({
|
||||
...safeJsonRequestConfig,
|
||||
url: `${DEPT_PREFIX}/list-self-and-children`,
|
||||
method: 'get',
|
||||
params: { id }
|
||||
});
|
||||
|
||||
return mapServiceResult(result as ServiceRequestResult<Api.SystemManage.DeptSelfAndChildrenList>, data => data);
|
||||
}
|
||||
|
||||
/** 创建部门 */
|
||||
export function fetchCreateDept(data: Api.SystemManage.SaveDeptParams) {
|
||||
return request<number>({
|
||||
@@ -736,6 +748,18 @@ export async function fetchGetMySubordinateTree() {
|
||||
);
|
||||
}
|
||||
|
||||
/** 获取某用户当前生效的直属下级列表 */
|
||||
export async function fetchGetDirectSubordinates(userId: string) {
|
||||
const result = await request<UserSimpleResponse[]>({
|
||||
...safeJsonRequestConfig,
|
||||
url: `${USER_MANAGEMENT_RELATION_PREFIX}/direct-subordinates`,
|
||||
method: 'get',
|
||||
params: { userId }
|
||||
});
|
||||
|
||||
return mapServiceResult(result as ServiceRequestResult<UserSimpleResponse[]>, data => data.map(normalizeUserSimple));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户管理链路详情
|
||||
*
|
||||
|
||||
@@ -103,8 +103,13 @@ type TeamReportPendingUserResponse = Omit<Api.WorkReport.Common.TeamReportPendin
|
||||
userId: StringIdResponse;
|
||||
};
|
||||
|
||||
type TeamReportSummaryResponse = Omit<Api.WorkReport.Common.TeamReportSummary, 'unsubmittedUsers'> & {
|
||||
type TeamReportSummaryResponse = Omit<
|
||||
Api.WorkReport.Common.TeamReportSummary,
|
||||
'unsubmittedUsers' | 'periodStartDate' | 'periodEndDate'
|
||||
> & {
|
||||
unsubmittedUsers?: TeamReportPendingUserResponse[] | null;
|
||||
periodStartDate?: unknown;
|
||||
periodEndDate?: unknown;
|
||||
};
|
||||
|
||||
function normalizeBooleanFlag(value: boolean | number | string | null | undefined) {
|
||||
@@ -368,6 +373,8 @@ function normalizeProjectOption(
|
||||
function normalizeTeamReportSummary(response: TeamReportSummaryResponse): Api.WorkReport.Common.TeamReportSummary {
|
||||
return {
|
||||
...response,
|
||||
periodStartDate: normalizeDateText(response.periodStartDate) ?? undefined,
|
||||
periodEndDate: normalizeDateText(response.periodEndDate) ?? undefined,
|
||||
unsubmittedUsers:
|
||||
response.unsubmittedUsers?.map(item => ({
|
||||
...item,
|
||||
|
||||
Reference in New Issue
Block a user