This commit is contained in:
吕才卓 2024-04-09 18:05:19 +08:00
parent fba8df4041
commit a2b2a66c31

View File

@ -151,7 +151,7 @@ const formData = ref({
classes: "", classes: "",
status: "", status: "",
}) })
const visible = ref(false) const visible = ref(true)
const studentList = ref([]); const studentList = ref([]);
const studentColumns = ref([ const studentColumns = ref([
@ -213,7 +213,7 @@ const onSubmit = async () => {
studentData.status studentData.status
) { ) {
const res = await getStudents(studentData); const res = await getStudents(studentData);
console.log(res); // console.log(res);
studentList.value = Array.from(res); studentList.value = Array.from(res);
pagination.total = res.length; pagination.total = res.length;
} else { } else {
@ -229,10 +229,11 @@ const onReset = () => {
// //
const TableData = async () => { const TableData = async () => {
const res = await getList() const res = await getList()
console.log(res); // console.log(res);
studentList.value = res.data.list studentList.value = res.data.list
pagination.total = res.data.list.length pagination.total = res.data.list.length
} }
console.log(TableData.name);
onMounted(() => { onMounted(() => {
TableData() TableData()
@ -240,11 +241,30 @@ onMounted(() => {
// //
const Modify = row => { const Modify = row => {
visible.value = true conlose.log(1)
visible.value = true;
formData.value = { 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 {
// APIupdateStudent
await updateStudent(formData.value);
//
visible.value = false;
TableData();
} catch (error) {
console.error('更新学生信息失败:', error);
} }
} };
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>