feat(aihr): complete uni-app role workflows
This commit is contained in:
@@ -0,0 +1,231 @@
|
||||
import request from '@/utils/request';
|
||||
|
||||
type ApiResult<T> = {
|
||||
code: number;
|
||||
msg: string;
|
||||
data: T;
|
||||
};
|
||||
|
||||
export type ReviewRecord = {
|
||||
id: number;
|
||||
sessionId: string;
|
||||
time: string;
|
||||
trainee: string;
|
||||
scene: string;
|
||||
score: number;
|
||||
status: string;
|
||||
summary: string;
|
||||
extPartyId: string;
|
||||
};
|
||||
|
||||
export type ReviewDetail = ReviewRecord & {
|
||||
mentorRewrite: string;
|
||||
aiComment: string;
|
||||
reviewAdvice: string;
|
||||
incentivePoint: number;
|
||||
scoreItems: Array<{ label: string; value: number | string; note: string }>;
|
||||
dialogue: Array<{ role: string; label: string; text: string; audioUrl?: string }>;
|
||||
annotations: Array<{ turnIndex: number; sourceText: string; issue: string; rewrite: string; sopPoint: string }>;
|
||||
};
|
||||
|
||||
export type ReviewAdviceRequest = {
|
||||
reviewer?: string;
|
||||
advice?: string;
|
||||
incentivePoint?: number;
|
||||
nextScenarioId?: string;
|
||||
nextReason?: string;
|
||||
};
|
||||
|
||||
export type CompetencyProfile = {
|
||||
score: number;
|
||||
completed: number;
|
||||
pendingReview: number;
|
||||
trainingMinutes: number;
|
||||
contribution: number;
|
||||
assessmentScore: number;
|
||||
aiLevel: string;
|
||||
dimensions: Array<{ label: string; value: number | string; note: string }>;
|
||||
growthPath: Array<{ level: string; progress: number; status: string; evidence: string }>;
|
||||
};
|
||||
|
||||
export type PracticeAlert = {
|
||||
type: string;
|
||||
title: string;
|
||||
desc: string;
|
||||
severity: string;
|
||||
extPartyId: string;
|
||||
};
|
||||
|
||||
export type PracticeAssignment = {
|
||||
id: number;
|
||||
extPartyId: string;
|
||||
traineeName: string;
|
||||
scenarioId: string;
|
||||
scenarioName: string;
|
||||
source: string;
|
||||
reason: string;
|
||||
status: string;
|
||||
createTime: string;
|
||||
question?: string;
|
||||
referenceAnswer?: string;
|
||||
userAnswer?: string;
|
||||
feedback?: string;
|
||||
correct?: boolean;
|
||||
};
|
||||
|
||||
export type PracticeAssignmentRequest = {
|
||||
extPartyId: string;
|
||||
traineeName?: string;
|
||||
scenarioId: string;
|
||||
scenarioName?: string;
|
||||
source: string;
|
||||
reason: string;
|
||||
};
|
||||
|
||||
export type PromotionEvidence = {
|
||||
extPartyId: string;
|
||||
currentLevel: string;
|
||||
assessmentScore: number;
|
||||
trainingMinutes: number;
|
||||
contribution: number;
|
||||
completed: number;
|
||||
pendingReview: number;
|
||||
dimensions: Array<{ label: string; value: number | string; note: string }>;
|
||||
latestRecords: ReviewRecord[];
|
||||
assignments: PracticeAssignment[];
|
||||
evidenceItems: string[];
|
||||
};
|
||||
|
||||
export type OrgSyncRequest = {
|
||||
dryRun?: boolean;
|
||||
replaceExisting?: boolean;
|
||||
pageSize?: number;
|
||||
maxPages?: number;
|
||||
};
|
||||
|
||||
export type OrgSyncResponse = {
|
||||
dryRun: boolean;
|
||||
replaceExisting: boolean;
|
||||
source: string;
|
||||
companyCount: number;
|
||||
departmentCount: number;
|
||||
employeeCount: number;
|
||||
syncedCount: number;
|
||||
skippedCount: number;
|
||||
warnings: string[];
|
||||
};
|
||||
|
||||
export type OrgProjectOption = {
|
||||
projectCode: string;
|
||||
projectName: string;
|
||||
};
|
||||
|
||||
export type OrgPersonRow = {
|
||||
id: number;
|
||||
projectCode: string;
|
||||
projectName: string;
|
||||
deptName: string;
|
||||
extPartyId: string;
|
||||
personName: string;
|
||||
positionName: string;
|
||||
positionLevel: string;
|
||||
employmentStatus: string;
|
||||
snapshotDate: string;
|
||||
};
|
||||
|
||||
export type OrgSnapshotParams = {
|
||||
keyword?: string;
|
||||
projectCode?: string;
|
||||
positionLevel?: string;
|
||||
status?: string;
|
||||
limit?: number;
|
||||
};
|
||||
|
||||
export type OrgSnapshotResponse = {
|
||||
total: number;
|
||||
active: number;
|
||||
departed: number;
|
||||
projects: OrgProjectOption[];
|
||||
levels: string[];
|
||||
rows: OrgPersonRow[];
|
||||
};
|
||||
|
||||
export function listPracticeReviews(): Promise<ApiResult<ReviewRecord[]>> {
|
||||
return request({
|
||||
url: '/api/aihr/mobile/practice/reviews',
|
||||
method: 'get'
|
||||
});
|
||||
}
|
||||
|
||||
export function getPracticeReview(id: number): Promise<ApiResult<ReviewDetail>> {
|
||||
return request({
|
||||
url: `/api/aihr/mobile/practice/reviews/${id}`,
|
||||
method: 'get'
|
||||
});
|
||||
}
|
||||
|
||||
export function markPracticeReviewed(id: number, data: ReviewAdviceRequest): Promise<ApiResult<null>> {
|
||||
return request({
|
||||
url: `/api/aihr/mobile/practice/reviews/${id}/reviewed`,
|
||||
method: 'post',
|
||||
data,
|
||||
headers: { repeatSubmit: false }
|
||||
});
|
||||
}
|
||||
|
||||
export function getCompetencyProfile(extPartyId?: string): Promise<ApiResult<CompetencyProfile>> {
|
||||
return request({
|
||||
url: '/api/aihr/mobile/profile',
|
||||
method: 'get',
|
||||
params: { extPartyId }
|
||||
});
|
||||
}
|
||||
|
||||
export function getPromotionEvidence(extPartyId?: string): Promise<ApiResult<PromotionEvidence>> {
|
||||
return request({
|
||||
url: '/api/aihr/mobile/profile/promotion-evidence',
|
||||
method: 'get',
|
||||
params: { extPartyId }
|
||||
});
|
||||
}
|
||||
|
||||
export function listPracticeAlerts(): Promise<ApiResult<PracticeAlert[]>> {
|
||||
return request({
|
||||
url: '/api/aihr/mobile/practice/alerts',
|
||||
method: 'get'
|
||||
});
|
||||
}
|
||||
|
||||
export function listPracticeAssignments(extPartyId?: string): Promise<ApiResult<PracticeAssignment[]>> {
|
||||
return request({
|
||||
url: '/api/aihr/mobile/practice/assignments',
|
||||
method: 'get',
|
||||
params: { extPartyId }
|
||||
});
|
||||
}
|
||||
|
||||
export function createPracticeAssignment(data: PracticeAssignmentRequest): Promise<ApiResult<PracticeAssignment>> {
|
||||
return request({
|
||||
url: '/api/aihr/mobile/practice/assignments',
|
||||
method: 'post',
|
||||
data,
|
||||
headers: { repeatSubmit: false }
|
||||
});
|
||||
}
|
||||
|
||||
export function syncOrgSnapshot(data: OrgSyncRequest): Promise<ApiResult<OrgSyncResponse>> {
|
||||
return request({
|
||||
url: '/api/aihr/org/sync',
|
||||
method: 'post',
|
||||
data,
|
||||
headers: { repeatSubmit: false }
|
||||
});
|
||||
}
|
||||
|
||||
export function getOrgSnapshot(params: OrgSnapshotParams): Promise<ApiResult<OrgSnapshotResponse>> {
|
||||
return request({
|
||||
url: '/api/aihr/org/snapshot',
|
||||
method: 'get',
|
||||
params
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user