diff --git a/mock/modules/lcz.js b/mock/modules/lcz.js index f981a3a..d5b0fd0 100644 --- a/mock/modules/lcz.js +++ b/mock/modules/lcz.js @@ -29,41 +29,29 @@ export default [ { url: '/api-updateStudent', method: 'post', - response: (req) => { - if (req.body.name !== '') { - return student.list.filter(item => item.name.includes(req.body.name)) - } - else if (req.body.studentId !== '') { - const studentId = Number(req.body.studentId) - if (!isNaN(studentId)) { - return student.list.filter(item => item.studentId === studentId) - } else { - return { - code: 400, - message: 'Invalid student number format' - } - } - } - 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 { - code: 200, + response(req) { + // 假设req.body的结构是{Id: '唯一标识', ...其他字段} + const requestBody = req.body; + const studentId = requestBody.Id; + + // 模拟检查数据库中是否存在该id + // 在真实环境中,这一步应当由后端服务完成 + const students = getMockStudents(); // 假设这是存储模拟学生数据的地方 + const existingStudent = students.find(student => student.id === studentId); + + if (existingStudent) { + // 更新数据库中的学生信息(在模拟中,我们直接修改内存中的数据) + Object.assign(existingStudent, requestBody); + return { + code: 200, + message: '更新成功', + data: existingStudent + }; + } else { + return { + code: 404, + message: '未找到具有该ID的学生' + }; } } }, diff --git a/package.json b/package.json index beb66d2..cfb60b4 100644 --- a/package.json +++ b/package.json @@ -16,6 +16,7 @@ "file-saver": "^2.0.5", "less": "^4.2.0", "mockjs": "^1.1.0", + "pdfmake": "^0.2.10", "pinia": "^2.1.7", "pinia-plugin-persistedstate": "^3.2.1", "tdesign-vue-next": "^1.9.3", @@ -26,6 +27,7 @@ "devDependencies": { "@vitejs/plugin-vue": "^5.0.4", "@vitejs/plugin-vue-jsx": "^3.1.0", + "gulp": "^5.0.0", "sass": "^1.74.1", "vite": "^5.1.6" } diff --git a/src/api/login.js b/src/api/login.js index 3bde586..0af5169 100644 --- a/src/api/login.js +++ b/src/api/login.js @@ -4,5 +4,5 @@ const API = { 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); \ No newline at end of file diff --git a/src/api/students.js b/src/api/students.js index 10f9583..d4ba5d1 100644 --- a/src/api/students.js +++ b/src/api/students.js @@ -9,4 +9,10 @@ export function getStudents(studentData) { export function updateStudent(updateStudent) { return request.post('/api-updateStudent', updateStudent) -} \ No newline at end of file +} + +// const API = { +// STUDENT_URL: "/api/user", +// }; + +// export const reqStudent = () => request.get(API.STUDENT_URL); \ No newline at end of file diff --git a/src/layout/components/LayoutAside.vue b/src/layout/components/LayoutAside.vue index c3eb3b1..8f15e23 100644 --- a/src/layout/components/LayoutAside.vue +++ b/src/layout/components/LayoutAside.vue @@ -34,6 +34,9 @@ 报表明细 + + 票据列表 + diff --git a/src/pages/finance-bill-manage/billBreakage.vue b/src/pages/finance-bill-manage/billBreakage.vue index 1a1771e..8fa54cb 100644 --- a/src/pages/finance-bill-manage/billBreakage.vue +++ b/src/pages/finance-bill-manage/billBreakage.vue @@ -59,7 +59,7 @@ 查询 - 重置 + 重置 diff --git a/src/pages/finance-bill-manage/billCancel.vue b/src/pages/finance-bill-manage/billCancel.vue index 4c1281c..48c6284 100644 --- a/src/pages/finance-bill-manage/billCancel.vue +++ b/src/pages/finance-bill-manage/billCancel.vue @@ -59,7 +59,7 @@ 查询 - 重置 + 重置 @@ -465,3 +465,4 @@ onMounted(() => { justify-content: space-between; } +@/pages/finance-bill-manage/billCancel diff --git a/src/pages/finance-bill-manage/billDestroy.vue b/src/pages/finance-bill-manage/billDestroy.vue index 018893e..097beb9 100644 --- a/src/pages/finance-bill-manage/billDestroy.vue +++ b/src/pages/finance-bill-manage/billDestroy.vue @@ -41,7 +41,7 @@ 查询 - 重置 + 重置 diff --git a/src/pages/finance-bill-manage/billDraw.vue b/src/pages/finance-bill-manage/billDraw.vue new file mode 100644 index 0000000..0c4da3e --- /dev/null +++ b/src/pages/finance-bill-manage/billDraw.vue @@ -0,0 +1,343 @@ + + + + + + + + + + + + + + + + + + + + + 查询 + 重置 + + + + + + + 票据列表 + + + + + + + + + + {{ `${row.stockNum}张` }} + + + + {{ item.label }} + + + + 导出pdf + + + + + + + + + + diff --git a/src/pages/finance-bill-manage/billQuitneck.vue b/src/pages/finance-bill-manage/billQuitneck.vue index 99f44df..c37b493 100644 --- a/src/pages/finance-bill-manage/billQuitneck.vue +++ b/src/pages/finance-bill-manage/billQuitneck.vue @@ -63,7 +63,7 @@ 查询 - 重置 + 重置 diff --git a/src/pages/finance-bill-manage/billReceipt.vue b/src/pages/finance-bill-manage/billReceipt.vue index 6f95f8d..02ccf3c 100644 --- a/src/pages/finance-bill-manage/billReceipt.vue +++ b/src/pages/finance-bill-manage/billReceipt.vue @@ -60,7 +60,7 @@ 查询 - 重置 + 重置 @@ -392,12 +392,13 @@ const refresh = () => { getTableData(); }; // 判断menuManagement里面是否存在数据 -const getPersonName = () => { +const getPersonName = async () => { let arr = JSON.parse(localStorage.getItem("ReceiptList")); if (arr) { personName.value = arr.personName; } else { - personList(); + await personList(); + getTableData(); } }; // 判断menuManagement里面是否存在数据 @@ -429,8 +430,8 @@ const getTableData = async () => { }; onMounted(async () => { - getPersonName(); - getTableData(); + await getPersonName(); + await getTableData(); }); diff --git a/src/pages/finance-bill-manage/billStock.vue b/src/pages/finance-bill-manage/billStock.vue index 9b86ff4..3c8fe02 100644 --- a/src/pages/finance-bill-manage/billStock.vue +++ b/src/pages/finance-bill-manage/billStock.vue @@ -41,7 +41,7 @@ 查询 - 重置 + 重置 diff --git a/src/pages/finance-bill-manage/detailReport.vue b/src/pages/finance-bill-manage/detailReport.vue index 578b0b7..adbfc13 100644 --- a/src/pages/finance-bill-manage/detailReport.vue +++ b/src/pages/finance-bill-manage/detailReport.vue @@ -19,7 +19,7 @@ 查询 - 重置 + 重置 diff --git a/src/pages/login/index.vue b/src/pages/login/index.vue index a987da9..ff66705 100644 --- a/src/pages/login/index.vue +++ b/src/pages/login/index.vue @@ -82,45 +82,53 @@ const rules = reactive({ }, ], password: [ - { - required: true, - message: "密码必填", - }, - { - len: 8, - message: "请输入 8 位密码", - }, - { - pattern: /^(?=.*[A-Z])(?=.*\d)[A-Za-z\d]{8,}$/u, - message: "密码必须包含至少一个大写字母,并由字母和数字组成", - }, + // { + // required: false, + // message: "密码必填", + // }, + // { + // len: 8, + // message: "请输入 8 位密码", + // }, + // { + // message: "密码必须包含至少一个大写字母,并由字母和数字组成", + // }, ], }); -onMounted(() => { - reqUser(); -}); - const onSubmit = async () => { - try { - if (!form || !form.value) { - console.warn("form 或 form.value 不存在,无法进行表单验证"); - return; - } - const validateResult = await form.value?.validate(); - if (validateResult?.result) { - await reqUser(formData.account, formData.password); - 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("提交失败"); + const data1 = { + username: formData.account, + password: formData.password, + }; + const { data } = await reqUser(data1); + + if (data === true) { + MessagePlugin.success("登录成功"); + router.push("/"); + } else { + 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() { diff --git a/src/pages/password/index.vue b/src/pages/password/index.vue index cc769b8..a403841 100644 --- a/src/pages/password/index.vue +++ b/src/pages/password/index.vue @@ -153,7 +153,7 @@ const onValidate = ({ validateResult, firstError }) => { justify-content: center; align-items: center; height: 100vh; - background-image: url(../../assets/bg1.jpg); + background-image: url(../../assets/bg.jpg); background-size: cover; padding: 2rem; } diff --git a/src/pages/students/student.vue b/src/pages/students/student.vue index d428936..0c4c2e2 100644 --- a/src/pages/students/student.vue +++ b/src/pages/students/student.vue @@ -5,24 +5,26 @@ - - + + - - + - - - 查询 + + + + 查询 重置 - - + @@ -40,29 +41,32 @@ 学生列表 - + 增加学员信息 + + + - - + - -