diff --git a/frontend/src/views/Inventory.vue b/frontend/src/views/Inventory.vue
index 4122023..3a3e363 100644
--- a/frontend/src/views/Inventory.vue
+++ b/frontend/src/views/Inventory.vue
@@ -56,15 +56,17 @@
-
-
+
+
+
+ 已匹配:{{ matchedTeacher.display_name }}
+
+
+ 未找到该老师,请确认名字是否正确
+
@@ -311,7 +313,16 @@ async function toggleOil(name) {
// Plan request
const showPlanRequest = ref(false)
const planHealthDesc = ref('')
-const planTeacherId = ref('')
+const planTeacherName = ref('')
+const matchedTeacher = ref(null)
+
+function matchTeacher() {
+ const name = planTeacherName.value.trim()
+ if (!name) { matchedTeacher.value = null; return }
+ matchedTeacher.value = plansStore.teachers.find(t =>
+ t.display_name === name || t.username === name
+ ) || null
+}
const shoppingTotal = computed(() =>
plansStore.shoppingList.filter(i => !i.in_inventory).reduce((s, i) => s + i.total_cost, 0).toFixed(2)
@@ -319,10 +330,11 @@ const shoppingTotal = computed(() =>
async function submitPlanRequest() {
try {
- await plansStore.createPlan(planHealthDesc.value, planTeacherId.value)
+ await plansStore.createPlan(planHealthDesc.value, matchedTeacher.value.id)
showPlanRequest.value = false
planHealthDesc.value = ''
- planTeacherId.value = ''
+ planTeacherName.value = ''
+ matchedTeacher.value = null
ui.showToast('已发送方案请求')
} catch {
ui.showToast('发送失败')
@@ -629,5 +641,6 @@ onMounted(async () => {
.overlay-header h3 { margin: 0; font-size: 16px; }
.form-label { display: block; font-size: 13px; color: #6b6375; margin-bottom: 4px; font-weight: 500; }
.form-textarea { width: 100%; border: 1.5px solid #e5e4e7; border-radius: 8px; padding: 8px; font-size: 13px; font-family: inherit; resize: vertical; box-sizing: border-box; }
-.form-select { width: 100%; border: 1.5px solid #e5e4e7; border-radius: 8px; padding: 8px; font-size: 13px; font-family: inherit; box-sizing: border-box; }
+.teacher-matched { color: #2e7d5a; font-size: 13px; margin-top: 4px; font-weight: 500; }
+.teacher-no-match { color: #c62828; font-size: 12px; margin-top: 4px; }