From a2b2a66c315a0ef75b1c651353988d851b350b3d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=95=E6=89=8D=E5=8D=93?= <2284808383@qq.com> Date: Tue, 9 Apr 2024 18:05:19 +0800 Subject: [PATCH] stu --- src/pages/students/student.vue | 32 ++++++++++++++++++++++++++------ 1 file changed, 26 insertions(+), 6 deletions(-) diff --git a/src/pages/students/student.vue b/src/pages/students/student.vue index 96d80dd..af3d510 100644 --- a/src/pages/students/student.vue +++ b/src/pages/students/student.vue @@ -151,7 +151,7 @@ const formData = ref({ classes: "", status: "", }) -const visible = ref(false) +const visible = ref(true) const studentList = ref([]); const studentColumns = ref([ @@ -213,7 +213,7 @@ const onSubmit = async () => { studentData.status ) { const res = await getStudents(studentData); - console.log(res); + // console.log(res); studentList.value = Array.from(res); pagination.total = res.length; } else { @@ -229,10 +229,11 @@ const onReset = () => { //获取表格数据 const TableData = async () => { const res = await getList() - console.log(res); + // console.log(res); studentList.value = res.data.list pagination.total = res.data.list.length } +console.log(TableData.name); onMounted(() => { TableData() @@ -240,11 +241,30 @@ onMounted(() => { // 修改学生状态 const Modify = row => { - visible.value = true + conlose.log(1) + visible.value = true; formData.value = { - name: row.label, + name: row.name, + gender: row.gender, + studentId: row.studentId, + department: row.department, + major: row.major, + classes: row.classes, + status: row.status, + }; +}; + +const onConfirmAnother = async () => { + try { + // 这里假设存在一个更新学生信息的API方法,例如updateStudent + await updateStudent(formData.value); + // 更新成功后,关闭弹窗并重新加载表格数据 + visible.value = false; + TableData(); + } catch (error) { + console.error('更新学生信息失败:', error); } -} +};