Merge branch 'dev' of https://gitea.dykj.co/sundongyu/dykj-college-back-office-management-system into dev
This commit is contained in:
commit
3a3e268f69
|
@ -29,41 +29,29 @@ export default [
|
||||||
{
|
{
|
||||||
url: '/api-updateStudent',
|
url: '/api-updateStudent',
|
||||||
method: 'post',
|
method: 'post',
|
||||||
response: (req) => {
|
response(req) {
|
||||||
if (req.body.name !== '') {
|
// 假设req.body的结构是{Id: '唯一标识', ...其他字段}
|
||||||
return student.list.filter(item => item.name.includes(req.body.name))
|
const requestBody = req.body;
|
||||||
}
|
const studentId = requestBody.Id;
|
||||||
else if (req.body.studentId !== '') {
|
|
||||||
const studentId = Number(req.body.studentId)
|
// 模拟检查数据库中是否存在该id
|
||||||
if (!isNaN(studentId)) {
|
// 在真实环境中,这一步应当由后端服务完成
|
||||||
return student.list.filter(item => item.studentId === studentId)
|
const students = getMockStudents(); // 假设这是存储模拟学生数据的地方
|
||||||
} else {
|
const existingStudent = students.find(student => student.id === studentId);
|
||||||
return {
|
|
||||||
code: 400,
|
if (existingStudent) {
|
||||||
message: 'Invalid student number format'
|
// 更新数据库中的学生信息(在模拟中,我们直接修改内存中的数据)
|
||||||
}
|
Object.assign(existingStudent, requestBody);
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (req.body.name !== '') {
|
|
||||||
return student.list.filter(item => item.name.includes(req.body.name))
|
|
||||||
}
|
|
||||||
else if (req.body.gender !== '') {
|
|
||||||
return student.list.filter(item => item.gender.includes(req.body.gender))
|
|
||||||
}
|
|
||||||
else if (req.body.department !== '') {
|
|
||||||
return student.list.filter(item => item.grade.includes(req.body.department))
|
|
||||||
}
|
|
||||||
else if (req.body.major !== '') {
|
|
||||||
return student.list.filter(item => item.major.includes(req.body.major))
|
|
||||||
}
|
|
||||||
else if (req.body.classes !== '') {
|
|
||||||
return student.list.filter(item => item.classes.includes(req.body.classes))
|
|
||||||
}
|
|
||||||
else if (req.body.status !== '') {
|
|
||||||
return student.list.filter(item => item.major.includes(req.body.status))
|
|
||||||
}
|
|
||||||
return {
|
return {
|
||||||
code: 200,
|
code: 200,
|
||||||
|
message: '更新成功',
|
||||||
|
data: existingStudent
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
return {
|
||||||
|
code: 404,
|
||||||
|
message: '未找到具有该ID的学生'
|
||||||
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
@ -4,5 +4,5 @@ const API = {
|
||||||
LOGIN_URL: "/api/login",
|
LOGIN_URL: "/api/login",
|
||||||
};
|
};
|
||||||
|
|
||||||
export const reqUser = () => request.post(API.LOGIN_URL);
|
export const reqUser = (data) => request.post(API.LOGIN_URL,data);
|
||||||
// export const reqUserone = (data) => request.post(API.LOGIN_URL, data);
|
// export const reqUserone = (data) => request.post(API.LOGIN_URL, data);
|
|
@ -10,3 +10,9 @@ export function getStudents(studentData) {
|
||||||
export function updateStudent(updateStudent) {
|
export function updateStudent(updateStudent) {
|
||||||
return request.post('/api-updateStudent', updateStudent)
|
return request.post('/api-updateStudent', updateStudent)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// const API = {
|
||||||
|
// STUDENT_URL: "/api/user",
|
||||||
|
// };
|
||||||
|
|
||||||
|
// export const reqStudent = () => request.get(API.STUDENT_URL);
|
|
@ -59,7 +59,7 @@
|
||||||
</div>
|
</div>
|
||||||
<t-form-item style="margin-right: 1rem">
|
<t-form-item style="margin-right: 1rem">
|
||||||
<t-button theme="primary" type="submit">查询</t-button>
|
<t-button theme="primary" type="submit">查询</t-button>
|
||||||
<t-button theme="primary" type="reset">重置</t-button>
|
<t-button theme="default" type="reset">重置</t-button>
|
||||||
</t-form-item>
|
</t-form-item>
|
||||||
</t-form>
|
</t-form>
|
||||||
</t-header>
|
</t-header>
|
||||||
|
|
|
@ -59,7 +59,7 @@
|
||||||
</div>
|
</div>
|
||||||
<t-form-item style="margin-right: 1rem">
|
<t-form-item style="margin-right: 1rem">
|
||||||
<t-button theme="primary" type="submit">查询</t-button>
|
<t-button theme="primary" type="submit">查询</t-button>
|
||||||
<t-button theme="primary" type="reset">重置</t-button>
|
<t-button theme="default" type="reset">重置</t-button>
|
||||||
</t-form-item>
|
</t-form-item>
|
||||||
</t-form>
|
</t-form>
|
||||||
</t-header>
|
</t-header>
|
||||||
|
|
|
@ -41,7 +41,7 @@
|
||||||
</div>
|
</div>
|
||||||
<t-form-item style="margin-right: 1rem">
|
<t-form-item style="margin-right: 1rem">
|
||||||
<t-button theme="primary" type="submit">查询</t-button>
|
<t-button theme="primary" type="submit">查询</t-button>
|
||||||
<t-button theme="primary" type="reset">重置</t-button>
|
<t-button theme="default" type="reset">重置</t-button>
|
||||||
</t-form-item>
|
</t-form-item>
|
||||||
</t-form>
|
</t-form>
|
||||||
</t-header>
|
</t-header>
|
||||||
|
|
|
@ -63,7 +63,7 @@
|
||||||
</div>
|
</div>
|
||||||
<t-form-item style="margin-right: 1rem">
|
<t-form-item style="margin-right: 1rem">
|
||||||
<t-button theme="primary" type="submit">查询</t-button>
|
<t-button theme="primary" type="submit">查询</t-button>
|
||||||
<t-button theme="primary" type="reset">重置</t-button>
|
<t-button theme="default" type="reset">重置</t-button>
|
||||||
</t-form-item>
|
</t-form-item>
|
||||||
</t-form>
|
</t-form>
|
||||||
</t-header>
|
</t-header>
|
||||||
|
|
|
@ -60,7 +60,7 @@
|
||||||
</div>
|
</div>
|
||||||
<t-form-item style="margin-right: 1rem">
|
<t-form-item style="margin-right: 1rem">
|
||||||
<t-button theme="primary" type="submit">查询</t-button>
|
<t-button theme="primary" type="submit">查询</t-button>
|
||||||
<t-button theme="primary" type="reset">重置</t-button>
|
<t-button theme="default" type="reset">重置</t-button>
|
||||||
</t-form-item>
|
</t-form-item>
|
||||||
</t-form>
|
</t-form>
|
||||||
</t-header>
|
</t-header>
|
||||||
|
|
|
@ -41,7 +41,7 @@
|
||||||
</div>
|
</div>
|
||||||
<t-form-item style="margin-right: 1rem">
|
<t-form-item style="margin-right: 1rem">
|
||||||
<t-button theme="primary" type="submit">查询</t-button>
|
<t-button theme="primary" type="submit">查询</t-button>
|
||||||
<t-button theme="primary" type="reset">重置</t-button>
|
<t-button theme="default" type="reset">重置</t-button>
|
||||||
</t-form-item>
|
</t-form-item>
|
||||||
</t-form>
|
</t-form>
|
||||||
</t-header>
|
</t-header>
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
</div>
|
</div>
|
||||||
<t-form-item style="margin-right: 1rem">
|
<t-form-item style="margin-right: 1rem">
|
||||||
<t-button theme="primary" type="submit">查询</t-button>
|
<t-button theme="primary" type="submit">查询</t-button>
|
||||||
<t-button theme="primary" type="reset">重置</t-button>
|
<t-button theme="default" type="reset">重置</t-button>
|
||||||
</t-form-item>
|
</t-form-item>
|
||||||
</t-form>
|
</t-form>
|
||||||
</t-header>
|
</t-header>
|
||||||
|
|
|
@ -82,45 +82,53 @@ const rules = reactive({
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
password: [
|
password: [
|
||||||
{
|
// {
|
||||||
required: true,
|
// required: false,
|
||||||
message: "密码必填",
|
// message: "密码必填",
|
||||||
},
|
// },
|
||||||
{
|
// {
|
||||||
len: 8,
|
// len: 8,
|
||||||
message: "请输入 8 位密码",
|
// message: "请输入 8 位密码",
|
||||||
},
|
// },
|
||||||
{
|
// {
|
||||||
pattern: /^(?=.*[A-Z])(?=.*\d)[A-Za-z\d]{8,}$/u,
|
// message: "密码必须包含至少一个大写字母,并由字母和数字组成",
|
||||||
message: "密码必须包含至少一个大写字母,并由字母和数字组成",
|
// },
|
||||||
},
|
|
||||||
],
|
],
|
||||||
});
|
});
|
||||||
|
|
||||||
onMounted(() => {
|
|
||||||
reqUser();
|
|
||||||
});
|
|
||||||
|
|
||||||
const onSubmit = async () => {
|
const onSubmit = async () => {
|
||||||
try {
|
const data1 = {
|
||||||
if (!form || !form.value) {
|
username: formData.account,
|
||||||
console.warn("form 或 form.value 不存在,无法进行表单验证");
|
password: formData.password,
|
||||||
return;
|
};
|
||||||
}
|
const { data } = await reqUser(data1);
|
||||||
const validateResult = await form.value?.validate();
|
|
||||||
if (validateResult?.result) {
|
if (data === true) {
|
||||||
await reqUser(formData.account, formData.password);
|
MessagePlugin.success("登录成功");
|
||||||
MessagePlugin.success("提交成功");
|
router.push("/");
|
||||||
await router.push("/");
|
|
||||||
} else {
|
} else {
|
||||||
const firstError = validateResult?.errors[0]?.message || "未知错误";
|
MessagePlugin.error("登录失败");
|
||||||
console.log("Errors: ", validateResult.errors);
|
|
||||||
MessagePlugin.warning(firstError);
|
|
||||||
}
|
|
||||||
} catch (error) {
|
|
||||||
console.error("请求失败:", error);
|
|
||||||
MessagePlugin.error("提交失败");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// try {
|
||||||
|
// if (!form || !form.value) {
|
||||||
|
// console.warn("form 或 form.value 不存在,无法进行表单验证");
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
// const validateResult = await form.value?.validate();
|
||||||
|
// if (validateResult?.result) {
|
||||||
|
|
||||||
|
// MessagePlugin.success("提交成功");
|
||||||
|
// await router.push("/");
|
||||||
|
// } else {
|
||||||
|
// const firstError = validateResult?.errors[0]?.message || "未知错误";
|
||||||
|
// console.log("Errors: ", validateResult.errors);
|
||||||
|
// MessagePlugin.warning(firstError);
|
||||||
|
// }
|
||||||
|
// } catch (error) {
|
||||||
|
// console.error("请求失败:", error);
|
||||||
|
// MessagePlugin.error("提交失败");
|
||||||
|
// }
|
||||||
};
|
};
|
||||||
|
|
||||||
function handleForgotPasswordClick() {
|
function handleForgotPasswordClick() {
|
||||||
|
|
|
@ -153,7 +153,7 @@ const onValidate = ({ validateResult, firstError }) => {
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
height: 100vh;
|
height: 100vh;
|
||||||
background-image: url(../../assets/bg1.jpg);
|
background-image: url(../../assets/bg.jpg);
|
||||||
background-size: cover;
|
background-size: cover;
|
||||||
padding: 2rem;
|
padding: 2rem;
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,23 +5,25 @@
|
||||||
<t-form
|
<t-form
|
||||||
ref="form"
|
ref="form"
|
||||||
:data="studentData"
|
:data="studentData"
|
||||||
reset-type="initial"
|
label-width="calc(2em + 40px)"
|
||||||
|
layout="inline"
|
||||||
|
class="scarch-from"
|
||||||
colon
|
colon
|
||||||
@reset="onReset"
|
@reset="onReset"
|
||||||
@submit="onSubmit"
|
@submit="onSubmit"
|
||||||
>
|
>
|
||||||
<t-row class="scarch-from">
|
<div style="margin-left: 0.5rem">
|
||||||
<t-col :span="3">
|
|
||||||
<t-form-item label="姓名" name="name">
|
<t-form-item label="姓名" name="name">
|
||||||
<t-input v-model="studentData.name"></t-input>
|
<t-input v-model="studentData.name"></t-input>
|
||||||
</t-form-item>
|
</t-form-item>
|
||||||
</t-col>
|
|
||||||
<t-col :span="3">
|
|
||||||
<t-form-item label="学号" name="studentId">
|
<t-form-item label="学号" name="studentId">
|
||||||
<t-input v-model="studentData.studentId"></t-input>
|
<t-input v-model="studentData.studentId"></t-input>
|
||||||
</t-form-item>
|
</t-form-item>
|
||||||
</t-col>
|
</div>
|
||||||
<t-col :push="2" :span="4">
|
<t-form-item style="margin-right: 1rem">
|
||||||
|
|
||||||
<t-button theme="primary" type="submit">查询</t-button>
|
<t-button theme="primary" type="submit">查询</t-button>
|
||||||
<t-button
|
<t-button
|
||||||
theme="default"
|
theme="default"
|
||||||
|
@ -30,8 +32,7 @@
|
||||||
style="margin-left: 1rem"
|
style="margin-left: 1rem"
|
||||||
>重置</t-button
|
>重置</t-button
|
||||||
>
|
>
|
||||||
</t-col>
|
</t-form-item>
|
||||||
</t-row>
|
|
||||||
</t-form>
|
</t-form>
|
||||||
</t-header>
|
</t-header>
|
||||||
<t-content class="table-box">
|
<t-content class="table-box">
|
||||||
|
@ -40,29 +41,32 @@
|
||||||
<h4 style="font-size: 110%">学生列表</h4>
|
<h4 style="font-size: 110%">学生列表</h4>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<t-button theme="primary" size="small" style="margin-right:2.5rem" @click="onAddSubmit">
|
<t-button theme="primary" size="small" style="margin-right:0rem" @click="onAddSubmit">
|
||||||
<template #icon><add-icon /></template>
|
<template #icon><add-icon /></template>
|
||||||
增加学员信息
|
增加学员信息
|
||||||
</t-button>
|
</t-button>
|
||||||
|
<t-button
|
||||||
|
shape="circle"
|
||||||
|
theme="primary"
|
||||||
|
@click="refresh"
|
||||||
|
style="margin-left: 0.8rem"
|
||||||
|
>
|
||||||
|
<template #icon><load-icon /></template>
|
||||||
|
</t-button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<t-table
|
<t-base-table
|
||||||
rowKey="Id"
|
rowKey="Id"
|
||||||
:data="studentList"
|
:data="studentList"
|
||||||
:columns="studentColumns"
|
:columns="studentColumns"
|
||||||
:stripe="stripe"
|
|
||||||
:bordered="bordered"
|
|
||||||
:hover="true"
|
:hover="true"
|
||||||
:size="size"
|
|
||||||
:table-layout="tableLayout ? 'auto' : 'fixed'"
|
|
||||||
:pagination="pagination"
|
:pagination="pagination"
|
||||||
:showHeader="true"
|
|
||||||
cellEmptyContent="-"
|
cellEmptyContent="-"
|
||||||
resizable
|
|
||||||
lazy-load
|
lazy-load
|
||||||
@row-click="handleRowClick"
|
@row-click="handleRowClick"
|
||||||
@page-change="onPageChange"
|
@page-change="onPageChange"
|
||||||
:loading="loading"
|
:loading="loading"
|
||||||
|
max-height="550"
|
||||||
>
|
>
|
||||||
<template #operation="{ row }">
|
<template #operation="{ row }">
|
||||||
<t-button
|
<t-button
|
||||||
|
@ -78,13 +82,13 @@
|
||||||
>
|
>
|
||||||
</t-popconfirm>
|
</t-popconfirm>
|
||||||
</template>
|
</template>
|
||||||
</t-table>
|
</t-base-table>
|
||||||
</t-content>
|
</t-content>
|
||||||
</t-layout>
|
</t-layout>
|
||||||
|
|
||||||
<t-space>
|
<t-space>
|
||||||
<t-dialog
|
<t-dialog
|
||||||
v-model="visible"
|
v-model:visible="visible"
|
||||||
header="学生变动处理"
|
header="学生变动处理"
|
||||||
width="40%"
|
width="40%"
|
||||||
:confirm-on-enter="true"
|
:confirm-on-enter="true"
|
||||||
|
@ -147,85 +151,21 @@
|
||||||
</t-space>
|
</t-space>
|
||||||
</t-dialog>
|
</t-dialog>
|
||||||
</t-space>
|
</t-space>
|
||||||
|
|
||||||
<!-- <t-space>
|
|
||||||
<t-dialog
|
|
||||||
v-model:visible="visible"
|
|
||||||
header="新增学生信息"
|
|
||||||
width="40%"
|
|
||||||
:confirm-on-enter="true"
|
|
||||||
:on-cancel="onCancel"
|
|
||||||
:on-esc-keydown="onEscKeydown"
|
|
||||||
:on-close-btn-click="onCloseBtnClick"
|
|
||||||
:on-overlay-click="onOverlayClick"
|
|
||||||
:on-close="close"
|
|
||||||
:on-confirm="onConfirmAnother"
|
|
||||||
ref="postForm"
|
|
||||||
>
|
|
||||||
<t-space direction="vertical" style="width: 100%">
|
|
||||||
<div>
|
|
||||||
<t-form
|
|
||||||
ref="form"
|
|
||||||
:data="AddDialogData"
|
|
||||||
reset-type="initial"
|
|
||||||
colon
|
|
||||||
@reset="onReset"
|
|
||||||
>
|
|
||||||
<t-form-item label="姓名" name="name">
|
|
||||||
<t-input v-model="AddDialogData.name"></t-input>
|
|
||||||
</t-form-item>
|
|
||||||
<t-form-item label="性别" name="gender">
|
|
||||||
<t-input v-model="AddDialogData.gender"></t-input>
|
|
||||||
</t-form-item>
|
|
||||||
<t-form-item label="学号" name="studentId">
|
|
||||||
<t-input v-model="AddDialogData.studentId"></t-input>
|
|
||||||
</t-form-item>
|
|
||||||
<t-form-item label="系院" name="department">
|
|
||||||
<t-input v-model="AddDialogData.department"></t-input>
|
|
||||||
</t-form-item>
|
|
||||||
<t-form-item label="专业" name="major">
|
|
||||||
<t-input v-model="AddDialogData.major"></t-input>
|
|
||||||
</t-form-item>
|
|
||||||
<t-form-item label="班级" name="classes">
|
|
||||||
<t-input v-model="AddDialogData.classes"></t-input>
|
|
||||||
</t-form-item>
|
|
||||||
<t-form-item
|
|
||||||
label="状态"
|
|
||||||
name="status"
|
|
||||||
:span="12"
|
|
||||||
style="width: 16rem; margin-bottom: 0.5rem"
|
|
||||||
>
|
|
||||||
<t-select
|
|
||||||
v-model="AddDialogData.status"
|
|
||||||
clearable
|
|
||||||
placeholder="请选择状态"
|
|
||||||
>
|
|
||||||
<t-option
|
|
||||||
v-for="item in status"
|
|
||||||
:key="item.value"
|
|
||||||
:label="item.label"
|
|
||||||
:value="item.value"
|
|
||||||
/>
|
|
||||||
</t-select>
|
|
||||||
</t-form-item>
|
|
||||||
</t-form>
|
|
||||||
</div>
|
|
||||||
</t-space>
|
|
||||||
</t-dialog>
|
|
||||||
</t-space> -->
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref, reactive, computed, onMounted } from "vue";
|
import { ref, computed, onMounted } from "vue";
|
||||||
import { getList, getStudents, updateStudent } from "@/api/students";
|
import { getList, getStudents, updateStudent } from "@/api/students";
|
||||||
|
// import {reqStudent} from "@/api/students";
|
||||||
import { MessagePlugin } from "tdesign-vue-next";
|
import { MessagePlugin } from "tdesign-vue-next";
|
||||||
import { useRouter } from "vue-router";
|
import { useRouter } from "vue-router";
|
||||||
|
import { AddIcon, LoadIcon } from "tdesign-icons-vue-next";
|
||||||
// import { reqStudent } from "@/api/students";
|
// import { reqStudent } from "@/api/students";
|
||||||
|
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
|
||||||
const studentData = reactive({
|
const studentData = ref({
|
||||||
Id: "",
|
Id: "",
|
||||||
name: "",
|
name: "",
|
||||||
gender: "",
|
gender: "",
|
||||||
|
@ -247,16 +187,6 @@ const dialogData = ref({
|
||||||
status: "",
|
status: "",
|
||||||
});
|
});
|
||||||
|
|
||||||
// const AddDialogData = ref({
|
|
||||||
// name: "",
|
|
||||||
// gender: "",
|
|
||||||
// studentId: "",
|
|
||||||
// department: "",
|
|
||||||
// major: "",
|
|
||||||
// classes: "",
|
|
||||||
// status: "",
|
|
||||||
// });
|
|
||||||
|
|
||||||
const visible = ref(false);
|
const visible = ref(false);
|
||||||
const studentList = ref([]);
|
const studentList = ref([]);
|
||||||
|
|
||||||
|
@ -264,43 +194,60 @@ const studentColumns = ref([
|
||||||
{
|
{
|
||||||
colKey: "Id",
|
colKey: "Id",
|
||||||
title: "序号",
|
title: "序号",
|
||||||
|
width: "100",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
colKey: "name",
|
colKey: "name",
|
||||||
title: "姓名",
|
title: "姓名",
|
||||||
|
align: "center",
|
||||||
|
width: "100",
|
||||||
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
colKey: "gender",
|
colKey: "gender",
|
||||||
title: "性别",
|
title: "性别",
|
||||||
|
align: "center",
|
||||||
|
width: "100",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
colKey: "studentId",
|
colKey: "studentId",
|
||||||
title: "学号",
|
title: "学号",
|
||||||
|
align: "center",
|
||||||
|
width: "150",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
colKey: "department",
|
colKey: "department",
|
||||||
title: "系院",
|
title: "系院",
|
||||||
|
align: "center",
|
||||||
|
width: "150",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
colKey: "major",
|
colKey: "major",
|
||||||
title: "专业",
|
title: "专业",
|
||||||
|
align: "center",
|
||||||
|
width: "150",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
colKey: "classes",
|
colKey: "classes",
|
||||||
title: "班级",
|
title: "班级",
|
||||||
|
align: "center",
|
||||||
|
width: "150",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
colKey: "status",
|
colKey: "status",
|
||||||
title: "状态",
|
title: "状态",
|
||||||
|
align: "center",
|
||||||
|
width: "150",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
colKey: "operation",
|
colKey: "operation",
|
||||||
title: "操作",
|
title: "操作",
|
||||||
align: "center",
|
align: "center",
|
||||||
|
width: "150",
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const pagination = reactive({
|
const pagination = ref({
|
||||||
defaultCurrent: 1,
|
defaultCurrent: 1,
|
||||||
defaultPageSize: 10,
|
defaultPageSize: 10,
|
||||||
total: 0,
|
total: 0,
|
||||||
|
@ -343,7 +290,7 @@ 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.value.total = res.data.list.length;
|
||||||
};
|
};
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
|
@ -355,47 +302,64 @@ const Modify = (row) => {
|
||||||
console.log("点击了确认按钮,弹出弹窗", row);
|
console.log("点击了确认按钮,弹出弹窗", row);
|
||||||
visible.value = true;
|
visible.value = true;
|
||||||
dialogData.value = {
|
dialogData.value = {
|
||||||
name: row.name,
|
...row
|
||||||
gender: row.gender,
|
|
||||||
studentId: row.studentId,
|
|
||||||
department: row.department,
|
|
||||||
major: row.major,
|
|
||||||
classes: row.classes,
|
|
||||||
status: row.status,
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const onAddSubmit = async ({ validateResult, firstError }) => {
|
||||||
|
if (validateResult === true) {
|
||||||
|
await TableData.addStockList(dialogData.value);
|
||||||
|
getNewTable();
|
||||||
|
MessagePlugin.success("提交成功");
|
||||||
|
visible.value = false;
|
||||||
|
} else {
|
||||||
|
console.log("Validate Errors: ", firstError, validateResult);
|
||||||
|
}
|
||||||
|
};
|
||||||
// const onConfirmAnother = async () => {
|
// const onConfirmAnother = async () => {
|
||||||
// console.log("点击了确认按钮", );
|
// console.log("点击了确认按钮", );
|
||||||
// visible.value = false;
|
// visible.value = false;
|
||||||
// await updateStudent(dialogData.value)
|
// await updateStudent(dialogData.value)
|
||||||
|
|
||||||
// };
|
// };
|
||||||
const onConfirmAnother = async () => {
|
|
||||||
console.log("点击了确认按钮");
|
|
||||||
// 准备要更新的数据
|
|
||||||
const studentId = dialogData.value.studentId;
|
|
||||||
// 调用更新学生信息的接口
|
|
||||||
try {
|
|
||||||
const response = await updateStudent({ ...dialogData.value, studentId });
|
|
||||||
// 检查接口返回结果是否成功
|
|
||||||
if (response.success) {
|
|
||||||
// 同步更新表格数据(这部分逻辑已在之前的解答中给出)
|
|
||||||
const index = studentList.value.findIndex(
|
|
||||||
(stu) => stu.studentId === studentId
|
|
||||||
);
|
|
||||||
if (index !== -1) {
|
|
||||||
studentList.value.splice(index, 1, dialogData.value);
|
|
||||||
}
|
|
||||||
|
|
||||||
MessagePlugin.success("学生信息更新成功");
|
const onConfirmAnother = async () => {
|
||||||
} else {
|
// const index = studentList.value.findIndex((item)=> item.Id === .Id)
|
||||||
MessagePlugin.error(response.message || "学生信息更新失败");
|
// await aaa(dialogData.value)
|
||||||
}
|
// TableData()
|
||||||
} catch (error) {
|
// if (index !== -1) {
|
||||||
console.error("更新学生信息时发生错误", error);
|
// studentList.value.splice(index,dialogData.value)
|
||||||
MessagePlugin.error("学生信息更新失败");
|
|
||||||
}
|
// }else{
|
||||||
|
// console.log(11111);
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// console.log("点击了确认按钮" ,studentId);
|
||||||
|
// // 准备要更新的数据
|
||||||
|
// const studentId = dialogData.value.studentId;
|
||||||
|
// // 调用更新学生信息的接口
|
||||||
|
// try {
|
||||||
|
// const response = await updateStudent({ ...dialogData.value, studentId });
|
||||||
|
// // 检查接口返回结果是否成功
|
||||||
|
// if (response) {
|
||||||
|
// // 同步更新表格数据(这部分逻辑已在之前的解答中给出)
|
||||||
|
// const index = studentList.value.findIndex(
|
||||||
|
// (stu) => stu.studentId === studentId
|
||||||
|
// );
|
||||||
|
// if (index !== -1) {
|
||||||
|
// studentList.value.splice(index, 1, dialogData.value);
|
||||||
|
// }
|
||||||
|
|
||||||
|
// MessagePlugin.success("学生信息更新成功");
|
||||||
|
// } else {
|
||||||
|
// MessagePlugin.error(response.message || "学生信息更新失败");
|
||||||
|
// }
|
||||||
|
// } catch (error) {
|
||||||
|
// console.error("更新学生信息时发生错误", error);
|
||||||
|
// MessagePlugin.error("学生信息更新失败");
|
||||||
|
// }
|
||||||
// 关闭对话框
|
// 关闭对话框
|
||||||
visible.value = false;
|
visible.value = false;
|
||||||
};
|
};
|
||||||
|
@ -426,10 +390,6 @@ const Delete = async (row) => {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const onAddSubmit = () =>{
|
|
||||||
console.log("点击新增");
|
|
||||||
visible.value = true;
|
|
||||||
}
|
|
||||||
const close = (context) => {
|
const close = (context) => {
|
||||||
console.log("关闭弹窗,点击关闭按钮、按下ESC、点击蒙层等触发", context);
|
console.log("关闭弹窗,点击关闭按钮、按下ESC、点击蒙层等触发", context);
|
||||||
};
|
};
|
||||||
|
@ -453,7 +413,7 @@ const onOverlayClick = (context) => {
|
||||||
background-color: @base-white-color;
|
background-color: @base-white-color;
|
||||||
margin-bottom: 2rem;
|
margin-bottom: 2rem;
|
||||||
.scarch-from {
|
.scarch-from {
|
||||||
height: 3.75rem;
|
height: 60px;
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
@ -472,4 +432,7 @@ const onOverlayClick = (context) => {
|
||||||
align-items: center;
|
align-items: center;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
:deep(.t-form__controls-content) {
|
||||||
|
justify-content: space-between;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -11,7 +11,7 @@ export default defineConfig({
|
||||||
server: {
|
server: {
|
||||||
proxy: {
|
proxy: {
|
||||||
"/api": {
|
"/api": {
|
||||||
target: "http://192.168.1.10:8080",
|
target: "http://192.168.1.2:8080",
|
||||||
changeOrigin: true,
|
changeOrigin: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue
Block a user