This commit is contained in:
sundongyu 2024-04-11 16:08:13 +08:00
commit e9aed32e8b
20 changed files with 566 additions and 222 deletions

View File

@ -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);
} return {
} code: 200,
else if (req.body.name !== '') { message: '更新成功',
return student.list.filter(item => item.name.includes(req.body.name)) data: existingStudent
} };
else if (req.body.gender !== '') { } else {
return student.list.filter(item => item.gender.includes(req.body.gender)) return {
} code: 404,
else if (req.body.department !== '') { message: '未找到具有该ID的学生'
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,
} }
} }
}, },

View File

@ -16,6 +16,7 @@
"file-saver": "^2.0.5", "file-saver": "^2.0.5",
"less": "^4.2.0", "less": "^4.2.0",
"mockjs": "^1.1.0", "mockjs": "^1.1.0",
"pdfmake": "^0.2.10",
"pinia": "^2.1.7", "pinia": "^2.1.7",
"pinia-plugin-persistedstate": "^3.2.1", "pinia-plugin-persistedstate": "^3.2.1",
"tdesign-vue-next": "^1.9.3", "tdesign-vue-next": "^1.9.3",
@ -26,6 +27,7 @@
"devDependencies": { "devDependencies": {
"@vitejs/plugin-vue": "^5.0.4", "@vitejs/plugin-vue": "^5.0.4",
"@vitejs/plugin-vue-jsx": "^3.1.0", "@vitejs/plugin-vue-jsx": "^3.1.0",
"gulp": "^5.0.0",
"sass": "^1.74.1", "sass": "^1.74.1",
"vite": "^5.1.6" "vite": "^5.1.6"
} }

View File

@ -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);

View File

@ -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);

View File

@ -34,6 +34,9 @@
<t-menu-item value="2-7" to="/Bill/DetailReport"> <t-menu-item value="2-7" to="/Bill/DetailReport">
<span>报表明细</span> <span>报表明细</span>
</t-menu-item> </t-menu-item>
<t-menu-item value="2-8" to="/Bill/BillDraw">
<span>票据列表</span>
</t-menu-item>
</t-submenu> </t-submenu>
<t-submenu value="3" title="应收款管理"> <t-submenu value="3" title="应收款管理">
<template #icon> <template #icon>

View File

@ -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>

View File

@ -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>
@ -465,3 +465,4 @@ onMounted(() => {
justify-content: space-between; justify-content: space-between;
} }
</style> </style>
@/pages/finance-bill-manage/billCancel

View File

@ -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>

View File

@ -0,0 +1,343 @@
<template>
<div class="back-color">
<t-layout style="height: 90%; background-color: #f5f7fb">
<t-header class="scarch-box">
<t-form
ref="form"
:data="formData"
label-width="calc(2em + 40px)"
layout="inline"
scroll-to-first-error="smooth"
class="scarch-from"
@reset="resetting"
@submit="headerQuery"
>
<div style="margin-left: 1rem">
<t-form-item label="票据编号:" name="billserial">
<t-input v-model="formData.billserial" maxlength="10"></t-input>
</t-form-item>
<t-form-item label="入库日期:" name="stockDate">
<t-date-picker v-model="formData.stockDate" clearable />
</t-form-item>
<t-form-item
label="票据类型:"
name="billType"
style="margin-bottom: 0.3rem"
>
<t-select
v-model="formData.billType"
placeholder="请选择票据类型"
clearable
>
<t-option
v-for="item in billType"
:key="item.value"
:value="item.value"
:label="item.label"
></t-option>
</t-select>
</t-form-item>
</div>
<t-form-item style="margin-right: 1rem">
<t-button theme="primary" type="submit">查询</t-button>
<t-button theme="primary" type="reset">重置</t-button>
</t-form-item>
</t-form>
</t-header>
<t-content class="table-box">
<div class="table-header">
<div>
<h4 style="font-size: 110%">票据列表</h4>
</div>
<div>
<t-button
shape="circle"
theme="primary"
@click="refresh"
style="margin-left: 0.8rem"
>
<template #icon><load-icon /></template>
</t-button>
</div>
</div>
<t-base-table
hover
row-key="index"
:loading="loading"
:data="tableData"
:columns="columns"
:pagination="pagination"
class="table"
:max-height="550"
>
<template #stockNum="{ row }">
{{ `${row.stockNum}` }}
</template>
<template #billType="{ row }">
<div v-for="item in billType" :key="item">
<span v-if="row.billType === item.value">{{ item.label }}</span>
</div>
</template>
<template #status="slotProps">
<t-button
theme="default"
variant="text"
size="small"
@click="exportPdf(slotProps)"
>导出pdf</t-button
>
</template>
</t-base-table>
</t-content>
</t-layout>
</div>
</template>
<script setup>
import { ref, onMounted } from "vue";
import { MessagePlugin } from "tdesign-vue-next";
import { LoadIcon } from "tdesign-icons-vue-next";
import { useStock } from "@/stores/billStock";
import { exportToPDF } from "@/utils/pdf";
//
const loading = ref(false);
const stockList = useStock();
const tableData = ref();
const data = ref();
//
const columns = ref([
{
colKey: "serial-number",
title: "序号",
width: 50,
},
{
colKey: "billserial",
title: "票据编号",
align: "center",
width: "100",
},
{
colKey: "billType",
title: "票据类型",
align: "center",
width: "100",
},
{
colKey: "stockNum",
title: "入库数量",
align: "center",
width: "100",
},
{
colKey: "stockDate",
title: "入库日期",
align: "center",
width: "100",
},
{
colKey: "operator",
title: "操作员",
align: "center",
width: "100",
},
{
colKey: "remark",
title: "备注",
align: "center",
width: "100",
},
{
colKey: "status",
title: "操作",
width: 120,
align: "center",
fixed: "right",
},
]);
//
const billType = ref([
{ label: "票据类型1", value: 0 },
{ label: "票据类型2", value: 1 },
{ label: "票据类型3", value: 2 },
{ label: "票据类型4", value: 3 },
{ label: "票据类型5", value: 4 },
]);
//
const tableList = async () => {
loading.value = true;
tableData.value = await stockList.getStockList();
data.value = await stockList.getStockList();
pagination.value.total = tableData.value.length;
const timerId = setTimeout(() => {
loading.value = false;
clearInterval(timerId);
}, 300);
};
//
const refresh = () => {
tableList();
};
//
const formData = ref({
billserial: "",
billType: "",
stockDate: "",
});
//
const pagination = ref({
defaultCurrent: 1,
defaultPageSize: 10,
total: 50,
});
//
const resetting = () => {
formData.value = {
billserial: "",
billType: "",
stockDate: "",
};
getNewTable();
};
//
const headerQuery = () => {
tableData.value = data.value;
if (
formData.value.billserial === "" &&
(formData.value.billType === undefined || formData.value.billType === "") &&
formData.value.stockDate === ""
) {
getNewTable();
} else {
const list = tableData.value.filter((item) => {
let arrList;
if (formData.value.billserial === item.billserial) {
arrList = item;
}
if (formData.value.billType === item.billType) {
arrList = item;
}
if (formData.value.stockDate === item.stockDate) {
arrList = item;
}
if (
formData.value.billserial === "" &&
formData.value.billType === "" &&
formData.value.stockDate === ""
) {
arrList = item;
}
return arrList;
});
tableData.value = list;
pagination.value.total = list.length;
}
};
// menuManagement
const getNewTable = () => {
let arr = JSON.parse(localStorage.getItem("menuManagement"));
if (arr) {
tableData.value = arr.stockList;
data.value = arr.stockList;
pagination.value.total = tableData.value.length;
} else {
tableList();
}
};
// pdf
const exportPdf = (slotProps) => {
// const content = slotProps.row;
const content = [
//
{
text: "票据标题",
style: "header",
alignment: "center",
margin: [0, 0, 0, 0],
},
//
{
columns: [
{ text: "发票编号:", style: "label", alignment: "right" },
{ text: "1234567890", style: "value" },
{ text: "日期:", style: "label", alignment: "right" },
{ text: "2023-04-05", style: "value" },
],
margin: [0, 20, 0, 0],
},
//
{
table: {
widths: ["*", "auto", "*"],
body: [
[
{ text: "商品名称", style: "tableHeader" },
{ text: "数量", style: "tableHeader" },
{ text: "单价", style: "tableHeader" },
],
["商品A", "10件", "$10.00"],
["商品B", "5件", "$20.00"],
// [{ text: "", colSpan: 2, alignment: "right" }, "$150.00"],
],
},
layout: "noBorders",
margin: [0, 20, 0, 0],
},
//
{
text: "本票据一式两份,甲乙双方各执一份,具有同等法律效力。",
style: "footer",
alignment: "center",
margin: [0, 0, 0, 30],
},
];
exportToPDF(content);
};
onMounted(() => {
getNewTable();
});
</script>
<style scoped lang="less">
.scarch-box {
width: 100%;
background-color: @base-white-color;
margin-bottom: 2rem;
.scarch-from {
height: 60px;
display: flex;
justify-content: space-between;
align-items: center;
}
}
.table-box {
height: 42rem;
background-color: @base-white-color;
padding: 1rem;
padding-top: 0;
.table-header {
height: 3rem;
display: flex;
justify-content: space-between;
align-items: center;
}
}
:deep(.t-form__controls-content) {
justify-content: space-between;
}
</style>

View File

@ -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>

View File

@ -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>
@ -392,12 +392,13 @@ const refresh = () => {
getTableData(); getTableData();
}; };
// menuManagement // menuManagement
const getPersonName = () => { const getPersonName = async () => {
let arr = JSON.parse(localStorage.getItem("ReceiptList")); let arr = JSON.parse(localStorage.getItem("ReceiptList"));
if (arr) { if (arr) {
personName.value = arr.personName; personName.value = arr.personName;
} else { } else {
personList(); await personList();
getTableData();
} }
}; };
// menuManagement // menuManagement
@ -429,8 +430,8 @@ const getTableData = async () => {
}; };
onMounted(async () => { onMounted(async () => {
getPersonName(); await getPersonName();
getTableData(); await getTableData();
}); });
</script> </script>

View File

@ -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>

View File

@ -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>

View File

@ -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 { MessagePlugin.error("登录失败");
const firstError = validateResult?.errors[0]?.message || "未知错误";
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() {

View File

@ -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;
} }

View File

@ -5,24 +5,26 @@
<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"
variant="base" variant="base"
@ -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>

View File

@ -6,6 +6,7 @@ import BillQuitneckURL from "@/pages/finance-bill-manage/billQuitneck.vue";
import BillBreakagekURL from "@/pages/finance-bill-manage/billBreakage.vue"; import BillBreakagekURL from "@/pages/finance-bill-manage/billBreakage.vue";
import BillDestroyURL from "@/pages/finance-bill-manage/billDestroy.vue"; import BillDestroyURL from "@/pages/finance-bill-manage/billDestroy.vue";
import DetailReportURL from "@/pages/finance-bill-manage/detailReport.vue"; import DetailReportURL from "@/pages/finance-bill-manage/detailReport.vue";
import BillDrawURL from "@/pages/finance-bill-manage/billDraw.vue";
const financeBillManage = [ const financeBillManage = [
{ {
@ -70,6 +71,14 @@ const financeBillManage = [
title: "报表明细", title: "报表明细",
}, },
}, },
{
path: "BillDraw",
name: "billDraw",
component: BillDrawURL,
meta: {
title: "报表明细",
},
},
], ],
}, },
]; ];

View File

@ -16,11 +16,11 @@ export const useReceiptList = defineStore("ReceiptList", {
async getPersonNameList() { async getPersonNameList() {
const { data } = await reqPersonName(); const { data } = await reqPersonName();
this.personName = data; this.personName = data;
console.log(this.personName);
return this.personName; return this.personName;
}, },
async getReceiptList(obj) { async getReceiptList(obj) {
console.log("222");
const { data } = await reqReceiptList(obj); const { data } = await reqReceiptList(obj);
this.receiptList = data; this.receiptList = data;
return this.receiptList; return this.receiptList;

20
src/utils/pdf.js Normal file
View File

@ -0,0 +1,20 @@
import pdfMake from "pdfmake/build/pdfmake";
import pdfFonts from "pdfmake/build/vfs_fonts";
pdfMake.vfs = pdfFonts.pdfMake.vfs;
export const exportToPDF = (content) => {
const docDefinition = {
pageSize: "A4",
pageMargins: [40, 70, 40, 90],
content: content,
styles: {
header: { fontSize: 16, bold: true },
label: { fontSize: 12, bold: true },
value: { fontSize: 12 },
tableHeader: { fontSize: 12, bold: true, color: "#666" },
footer: { fontSize: 10, italics: true },
},
};
pdfMake.createPdf(docDefinition).download("output.pdf");
};

View File

@ -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,
}, },
}, },