fix(aihr): expose enabled scenarios to supervisors
This commit is contained in:
@@ -118,7 +118,7 @@
|
||||
暂不派发
|
||||
</button>
|
||||
<button
|
||||
v-for="item in supervisorScenarioOptions"
|
||||
v-for="item in scenarioOptions"
|
||||
:key="item.id"
|
||||
class="chip scenario-chip"
|
||||
:class="{ active: nextScenarioId === item.id }"
|
||||
@@ -165,7 +165,7 @@ import type { ReviewDetail, ReviewDialogue } from '@/types/api';
|
||||
import { authenticatedFileUrl, releaseAuthenticatedFileUrl } from '@/services/api';
|
||||
import { clearAuth, isLoggedIn, rememberLoginRedirect } from '@/services/auth';
|
||||
import { resetPageScroll } from '@/services/navigation';
|
||||
import { getPracticeReviewDetail, markPracticeReviewed } from '@/services/practice';
|
||||
import { getPracticeReviewDetail, getPracticeScenarios, markPracticeReviewed } from '@/services/practice';
|
||||
import SupervisorTabBar from '@/components/SupervisorTabBar.vue';
|
||||
import {
|
||||
createAsyncGenerationGuard,
|
||||
@@ -173,6 +173,7 @@ import {
|
||||
isSupervisorAccessDenied,
|
||||
reviewCompletionAction,
|
||||
supervisorScenarioOptions,
|
||||
type SupervisorScenarioOption,
|
||||
type SupervisorScenarioId
|
||||
} from '@/services/supervisor-view';
|
||||
|
||||
@@ -182,6 +183,7 @@ const detail = ref<ReviewDetail | null>(null);
|
||||
const advice = ref('');
|
||||
const incentivePoint = ref('');
|
||||
const nextScenarioId = ref<SupervisorScenarioId | ''>('');
|
||||
const scenarioOptions = ref<SupervisorScenarioOption[]>([...supervisorScenarioOptions]);
|
||||
const nextReason = ref('');
|
||||
const loggedIn = ref(false);
|
||||
const accessDenied = ref(false);
|
||||
@@ -309,9 +311,23 @@ const loadDetail = async () => {
|
||||
}
|
||||
};
|
||||
|
||||
const loadScenarioOptions = async () => {
|
||||
try {
|
||||
const rows = await getPracticeScenarios('生活顾问');
|
||||
const nextOptions = rows
|
||||
.filter((item) => item.enabled !== false && item.id && item.name)
|
||||
.map((item) => ({ id: item.id, name: item.name }));
|
||||
if (nextOptions.length) {
|
||||
scenarioOptions.value = nextOptions;
|
||||
}
|
||||
} catch {
|
||||
scenarioOptions.value = [...supervisorScenarioOptions];
|
||||
}
|
||||
};
|
||||
|
||||
const selectNextScenario = (scenarioId: SupervisorScenarioId) => {
|
||||
nextScenarioId.value = scenarioId;
|
||||
const scenario = supervisorScenarioOptions.find((item) => item.id === scenarioId);
|
||||
const scenario = scenarioOptions.value.find((item) => item.id === scenarioId);
|
||||
nextReason.value = `复盘后建议补练${scenario?.name || '专项训练'}`;
|
||||
};
|
||||
|
||||
@@ -402,6 +418,7 @@ onShow(() => {
|
||||
clearDetail();
|
||||
return;
|
||||
}
|
||||
void loadScenarioOptions();
|
||||
if (!detail.value && !loading.value) void loadDetail();
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user