From f218db64a3fb52294e78fbcf0a7967c37bb45063 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=94=A1=E6=B4=81=E5=BD=B1?= Date: Sat, 8 Mar 2025 15:25:03 +0800 Subject: [PATCH] =?UTF-8?q?=E6=88=90=E7=BB=A9=E7=AE=A1=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/views/GradeManager/GradeLMangerList.vue | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/TeacherHomeWork-vite/src/views/GradeManager/GradeLMangerList.vue b/TeacherHomeWork-vite/src/views/GradeManager/GradeLMangerList.vue index 78a29ec..5c5a9ba 100644 --- a/TeacherHomeWork-vite/src/views/GradeManager/GradeLMangerList.vue +++ b/TeacherHomeWork-vite/src/views/GradeManager/GradeLMangerList.vue @@ -35,10 +35,10 @@ - + - + @@ -132,7 +132,8 @@ const filteredTableData = computed(() => { const handleEdit = (student) => { dialogVisible.value = true; - console.log('编辑学生:', student.username); + Object.assign(form.value, student); // 将选中学生的数据复制到表单中 + //console.log('编辑学生:', student.username); }; const handleDelete = (username) => { @@ -158,6 +159,14 @@ const getTagText = (totalScore) => { if (totalScore >= 60) return '及格'; return '不及格'; }; + +const save = () => { + const index = tableData.value.findIndex(student => student.username === form.value.username); + if (index !== -1) { + tableData.value[index] = { ...form.value }; // 更新学生数据 + } + dialogVisible.value = false; // 关闭弹窗 +};