fix(aihr): close Figma UI regression gaps

This commit is contained in:
2026-07-17 04:17:14 +08:00
parent a822b22116
commit e93421ca1e
35 changed files with 1452 additions and 107 deletions
+85 -1
View File
@@ -21,13 +21,18 @@ const {
actionablePracticeAlerts,
buildSupervisorMetrics,
buildTeamProfiles,
buildTrainingTrend,
createAsyncGenerationGuard,
filterReviewRecords,
filterTeamProfiles,
inferSupervisorScenarioId,
isReviewEditable,
isSupervisorAccessDenied,
paginateTeamProfiles,
reviewCompletionAction,
supervisorScenarioOptions
} = supervisorView;
const { maskPhone } = await vite.ssrLoadModule('/src/services/auth.ts');
const assignPageSource = await readFile(
new URL('../src/pages/supervisor/assign/index.vue', import.meta.url),
@@ -152,6 +157,20 @@ test('低于 80 分为高风险,有待复盘为中风险,其余为低风险'
assert.equal(profiles.find((item) => item.extPartyId === 'low')?.risk, 'low');
});
test('待复盘列表支持全部、低分和待处理筛选', () => {
const rows = [
review({ id: 1, score: 68, status: '待复盘' }),
review({ id: 2, score: 88, status: '待复盘' }),
review({ id: 3, score: 92, status: '已复盘' })
];
assert.equal(filterReviewRecords(rows, 'all').length, 3);
assert.deepEqual(filterReviewRecords(rows, 'low').map((item) => item.id), [1]);
assert.deepEqual(filterReviewRecords(rows, 'pending').map((item) => item.id), [1, 2]);
assert.match(reviewsPageSource, /reviewFilters/);
assert.match(reviewsPageSource, /visibleReviews/);
});
test('主管页面共享三个业务场景及文本推荐规则', () => {
assert.deepEqual(supervisorScenarioOptions.map((item) => item.id), [
'fee-parking',
@@ -159,7 +178,8 @@ test('主管页面共享三个业务场景及文本推荐规则', () => {
'repair-elevator-delay'
]);
assert.match(practiceServiceSource, /getPracticeScenarios/);
assert.match(assignPageSource, /v-for="item in scenarioOptions"/);
assert.match(assignPageSource, /v-for="item in filteredScenarioOptions"/);
assert.match(assignPageSource, /scenarioSearch/);
assert.match(assignPageSource, /暂无可派发的已启用场景/);
assert.match(reviewPageSource, /scenarioOptions/);
assert.match(reviewPageSource, /scenarioOptions\.value = \[\]/);
@@ -185,6 +205,20 @@ test('stable 提示不计入团队预警指标', () => {
]).find((item) => item.key === 'alerts')?.value, 0);
});
test('主管工作台展示真实训练趋势并压缩预警首屏密度', () => {
const trend = buildTrainingTrend([
review({ id: 1, time: '2026-07-15 09:00:00', score: 70 }),
review({ id: 2, time: '2026-07-16 09:00:00', score: 82 }),
review({ id: 3, time: '2026-07-17 09:00:00', score: 91 })
]);
assert.deepEqual(trend.map((item) => item.value), [70, 82, 91]);
assert.match(dashboardPageSource, /class="panel training-trend-panel"/);
assert.match(dashboardPageSource, /trainingTrend/);
assert.match(dashboardPageSource, /visibleAlerts/);
assert.doesNotMatch(dashboardPageSource, /<text class="metric-desc"/);
});
test('画像按时间显示最新训练,但任一未复盘低分仍保持高风险', () => {
const profiles = buildTeamProfiles([
review({
@@ -223,6 +257,38 @@ test('组织快照中的稳定成员即使没有训练记录也保留在画像
assert.equal(profiles[0].risk, 'low');
});
test('团队画像搜索和分页不把 2316 名成员一次性渲染', () => {
const profiles = Array.from({ length: 2316 }, (_, index) => ({
key: `member-${index}`,
extPartyId: `employee-${index}`,
displayName: `员工 ${index}`
}));
assert.equal(paginateTeamProfiles(profiles, 1, 20).items.length, 20);
assert.equal(paginateTeamProfiles(profiles, 1, 20).pageCount, 116);
assert.deepEqual(
filterTeamProfiles(profiles, '员工 2315').map((item) => item.key),
['member-2315']
);
assert.match(teamPageSource, /v-for="member in visibleTeamProfiles"/);
assert.match(teamPageSource, /v-if="selectedMember" class="panel member-detail-panel"/);
assert.match(teamPageSource, /<template v-else>[\s\S]*class="panel team-panel"/);
});
test('员工和主管个人页只展示脱敏手机号', async () => {
const [employeeProfile, supervisorProfile] = await Promise.all([
readFile(new URL('../src/pages/user/profile/index.vue', import.meta.url), 'utf8'),
readFile(new URL('../src/pages/supervisor/profile/index.vue', import.meta.url), 'utf8')
]);
assert.equal(maskPhone('181368856126'), '181****6126');
assert.equal(maskPhone('invalid'), 'invalid');
assert.match(employeeProfile, /displayPhone/);
assert.match(supervisorProfile, /displayPhone/);
assert.doesNotMatch(employeeProfile, /\{\{ phone \|\|/);
assert.doesNotMatch(supervisorProfile, /\{\{ phone \|\|/);
});
test('组织快照姓名不可读时用稳定身份标识展示', () => {
const profiles = buildTeamProfiles([], [], [
{ extPartyId: '13900001111', name: '???????' },
@@ -275,6 +341,10 @@ test('复盘详情只允许待复盘提交并保留未保存草稿', () => {
assert.match(reviewPageSource, /v-else class="panel review-complete"/);
assert.match(reviewPageSource, /if \(!editable\.value\)[\s\S]*该记录已完成复盘/);
assert.match(reviewPageSource, /onShow\(\(\) => \{[\s\S]*refreshAuthState\(\);[\s\S]*if \(!loggedIn\.value\) \{[\s\S]*accessDenied\.value = false;[\s\S]*clearDetail\(\);\s*return;\s*\}[\s\S]*if \(!detail\.value && !loading\.value\)[\s\S]*loadDetail\(\)/);
assert.match(reviewPageSource, /训练摘要/);
assert.match(reviewPageSource, /录音与逐句复盘/);
assert.match(reviewPageSource, /SOP 依据与改进建议/);
assert.match(reviewPageSource, /下一步行动/);
});
test('复盘详情登录和完成导航不堆叠页面', () => {
@@ -339,6 +409,20 @@ test('指派页通过团队快照在进入时校验主管权限', () => {
assert.doesNotMatch(assignPageSource, /getPracticeAssignments/);
});
test('指派表单和派发进度使用同页分段视图避免堆成长页', () => {
assert.match(assignPageSource, /assignView/);
assert.match(assignPageSource, /v-if="assignView === 'create'" class="panel assignment-form"/);
assert.match(assignPageSource, /v-if="assignView === 'progress'" class="panel history-panel"/);
assert.match(assignPageSource, /class="assign-tabs"/);
assert.match(assignPageSource, /memberSuggestions/);
assert.match(assignPageSource, /selectTarget/);
assert.match(assignPageSource, /class="target-suggestions"/);
assert.match(assignPageSource, /assignmentDueTime/);
assert.match(assignPageSource, /assignmentGoal/);
assert.match(assignPageSource, /assignmentRequirements/);
assert.match(assignPageSource, /item\.dueTime/);
});
test('指派页保留 H5 查询参数二次解码', () => {
assert.match(assignPageSource, /decodeURIComponent\(value\)\.trim\(\)/);
});