fix(aihr): align supervisor scenario options

This commit is contained in:
2026-07-14 14:04:35 +08:00
parent c7ebe6d31c
commit 750e546e47
5 changed files with 13 additions and 8 deletions
@@ -45,9 +45,9 @@
/>
<text class="field-label section-label">训练场景</text>
<view class="scenario-row">
<view v-if="scenarioOptions.length" class="scenario-row">
<button
v-for="item in supervisorScenarioOptions"
v-for="item in scenarioOptions"
:key="item.id"
class="chip scenario-chip"
:class="{ active: assignmentScenarioId === item.id }"
@@ -57,6 +57,7 @@
{{ item.name }}
</button>
</view>
<text v-else class="muted block">暂无可派发的已启用场景</text>
<text class="field-label section-label">指派原因</text>
<textarea
@@ -65,7 +66,7 @@
maxlength="180"
placeholder="填写本次专项训练原因"
/>
<button class="primary-button submit-button" :disabled="assigning || historyLoading" @click="assignPractice">
<button class="primary-button submit-button" :disabled="assigning || historyLoading || !scenarioOptions.length" @click="assignPractice">
{{ assigning ? '指派中' : '确认指派' }}
</button>
</view>
@@ -255,10 +256,8 @@ const loadScenarioOptions = async () => {
}
return;
}
scenarioOptions.value = [...supervisorScenarioOptions];
if (!isScenarioId(assignmentScenarioId.value)) {
assignmentScenarioId.value = supervisorScenarioOptions[0].id;
}
scenarioOptions.value = [];
assignmentScenarioId.value = '';
} catch {
scenarioOptions.value = [...supervisorScenarioOptions];
if (!isScenarioId(assignmentScenarioId.value)) {
@@ -319,6 +319,8 @@ const loadScenarioOptions = async () => {
.map((item) => ({ id: item.id, name: item.name }));
if (nextOptions.length) {
scenarioOptions.value = nextOptions;
} else {
scenarioOptions.value = [];
}
} catch {
scenarioOptions.value = [...supervisorScenarioOptions];
+3 -1
View File
@@ -159,8 +159,10 @@ test('主管页面共享三个业务场景及文本推荐规则', () => {
'repair-elevator-delay'
]);
assert.match(practiceServiceSource, /getPracticeScenarios/);
assert.match(assignPageSource, /scenarioOptions/);
assert.match(assignPageSource, /v-for="item in scenarioOptions"/);
assert.match(assignPageSource, /暂无可派发的已启用场景/);
assert.match(reviewPageSource, /scenarioOptions/);
assert.match(reviewPageSource, /scenarioOptions\.value = \[\]/);
assert.equal(inferSupervisorScenarioId('电梯故障沟通低分'), 'repair-elevator-delay');
assert.equal(inferSupervisorScenarioId('投诉接待需要补练'), 'complaint-water');
assert.equal(inferSupervisorScenarioId('催缴物业费'), 'fee-parking');