Merge branch 'dev' of https://gitea.dykj.co/sundongyu/dykj-college-back-office-management-system into dev
This commit is contained in:
commit
e9aed32e8b
|
@ -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))
|
||||
}
|
||||
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的学生'
|
||||
};
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
|
@ -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"
|
||||
}
|
||||
|
|
|
@ -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);
|
|
@ -10,3 +10,9 @@ export function getStudents(studentData) {
|
|||
export function updateStudent(updateStudent) {
|
||||
return request.post('/api-updateStudent', updateStudent)
|
||||
}
|
||||
|
||||
// const API = {
|
||||
// STUDENT_URL: "/api/user",
|
||||
// };
|
||||
|
||||
// export const reqStudent = () => request.get(API.STUDENT_URL);
|
|
@ -34,6 +34,9 @@
|
|||
<t-menu-item value="2-7" to="/Bill/DetailReport">
|
||||
<span>报表明细</span>
|
||||
</t-menu-item>
|
||||
<t-menu-item value="2-8" to="/Bill/BillDraw">
|
||||
<span>票据列表</span>
|
||||
</t-menu-item>
|
||||
</t-submenu>
|
||||
<t-submenu value="3" title="应收款管理">
|
||||
<template #icon>
|
||||
|
|
|
@ -59,7 +59,7 @@
|
|||
</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-button theme="default" type="reset">重置</t-button>
|
||||
</t-form-item>
|
||||
</t-form>
|
||||
</t-header>
|
||||
|
|
|
@ -59,7 +59,7 @@
|
|||
</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-button theme="default" type="reset">重置</t-button>
|
||||
</t-form-item>
|
||||
</t-form>
|
||||
</t-header>
|
||||
|
@ -465,3 +465,4 @@ onMounted(() => {
|
|||
justify-content: space-between;
|
||||
}
|
||||
</style>
|
||||
@/pages/finance-bill-manage/billCancel
|
||||
|
|
|
@ -41,7 +41,7 @@
|
|||
</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-button theme="default" type="reset">重置</t-button>
|
||||
</t-form-item>
|
||||
</t-form>
|
||||
</t-header>
|
||||
|
|
343
src/pages/finance-bill-manage/billDraw.vue
Normal file
343
src/pages/finance-bill-manage/billDraw.vue
Normal 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>
|
|
@ -63,7 +63,7 @@
|
|||
</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-button theme="default" type="reset">重置</t-button>
|
||||
</t-form-item>
|
||||
</t-form>
|
||||
</t-header>
|
||||
|
|
|
@ -60,7 +60,7 @@
|
|||
</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-button theme="default" type="reset">重置</t-button>
|
||||
</t-form-item>
|
||||
</t-form>
|
||||
</t-header>
|
||||
|
@ -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();
|
||||
});
|
||||
</script>
|
||||
|
||||
|
|
|
@ -41,7 +41,7 @@
|
|||
</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-button theme="default" type="reset">重置</t-button>
|
||||
</t-form-item>
|
||||
</t-form>
|
||||
</t-header>
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
</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-button theme="default" type="reset">重置</t-button>
|
||||
</t-form-item>
|
||||
</t-form>
|
||||
</t-header>
|
||||
|
|
|
@ -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("/");
|
||||
const data1 = {
|
||||
username: formData.account,
|
||||
password: formData.password,
|
||||
};
|
||||
const { data } = await reqUser(data1);
|
||||
|
||||
if (data === true) {
|
||||
MessagePlugin.success("登录成功");
|
||||
router.push("/");
|
||||
} else {
|
||||
const firstError = validateResult?.errors[0]?.message || "未知错误";
|
||||
console.log("Errors: ", validateResult.errors);
|
||||
MessagePlugin.warning(firstError);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("请求失败:", error);
|
||||
MessagePlugin.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() {
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -5,23 +5,25 @@
|
|||
<t-form
|
||||
ref="form"
|
||||
:data="studentData"
|
||||
reset-type="initial"
|
||||
label-width="calc(2em + 40px)"
|
||||
layout="inline"
|
||||
class="scarch-from"
|
||||
colon
|
||||
@reset="onReset"
|
||||
@submit="onSubmit"
|
||||
>
|
||||
<t-row class="scarch-from">
|
||||
<t-col :span="3">
|
||||
<div style="margin-left: 0.5rem">
|
||||
|
||||
<t-form-item label="姓名" name="name">
|
||||
<t-input v-model="studentData.name"></t-input>
|
||||
</t-form-item>
|
||||
</t-col>
|
||||
<t-col :span="3">
|
||||
|
||||
<t-form-item label="学号" name="studentId">
|
||||
<t-input v-model="studentData.studentId"></t-input>
|
||||
</t-form-item>
|
||||
</t-col>
|
||||
<t-col :push="2" :span="4">
|
||||
</div>
|
||||
<t-form-item style="margin-right: 1rem">
|
||||
|
||||
<t-button theme="primary" type="submit">查询</t-button>
|
||||
<t-button
|
||||
theme="default"
|
||||
|
@ -30,8 +32,7 @@
|
|||
style="margin-left: 1rem"
|
||||
>重置</t-button
|
||||
>
|
||||
</t-col>
|
||||
</t-row>
|
||||
</t-form-item>
|
||||
</t-form>
|
||||
</t-header>
|
||||
<t-content class="table-box">
|
||||
|
@ -40,29 +41,32 @@
|
|||
<h4 style="font-size: 110%">学生列表</h4>
|
||||
</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>
|
||||
增加学员信息
|
||||
</t-button>
|
||||
<t-button
|
||||
shape="circle"
|
||||
theme="primary"
|
||||
@click="refresh"
|
||||
style="margin-left: 0.8rem"
|
||||
>
|
||||
<template #icon><load-icon /></template>
|
||||
</t-button>
|
||||
</div>
|
||||
</div>
|
||||
<t-table
|
||||
<t-base-table
|
||||
rowKey="Id"
|
||||
:data="studentList"
|
||||
:columns="studentColumns"
|
||||
:stripe="stripe"
|
||||
:bordered="bordered"
|
||||
:hover="true"
|
||||
:size="size"
|
||||
:table-layout="tableLayout ? 'auto' : 'fixed'"
|
||||
:pagination="pagination"
|
||||
:showHeader="true"
|
||||
cellEmptyContent="-"
|
||||
resizable
|
||||
lazy-load
|
||||
@row-click="handleRowClick"
|
||||
@page-change="onPageChange"
|
||||
:loading="loading"
|
||||
max-height="550"
|
||||
>
|
||||
<template #operation="{ row }">
|
||||
<t-button
|
||||
|
@ -78,13 +82,13 @@
|
|||
>
|
||||
</t-popconfirm>
|
||||
</template>
|
||||
</t-table>
|
||||
</t-base-table>
|
||||
</t-content>
|
||||
</t-layout>
|
||||
|
||||
<t-space>
|
||||
<t-dialog
|
||||
v-model="visible"
|
||||
v-model:visible="visible"
|
||||
header="学生变动处理"
|
||||
width="40%"
|
||||
:confirm-on-enter="true"
|
||||
|
@ -147,85 +151,21 @@
|
|||
</t-space>
|
||||
</t-dialog>
|
||||
</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>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, reactive, computed, onMounted } from "vue";
|
||||
import { ref, computed, onMounted } from "vue";
|
||||
import { getList, getStudents, updateStudent } from "@/api/students";
|
||||
// import {reqStudent} from "@/api/students";
|
||||
import { MessagePlugin } from "tdesign-vue-next";
|
||||
import { useRouter } from "vue-router";
|
||||
import { AddIcon, LoadIcon } from "tdesign-icons-vue-next";
|
||||
// import { reqStudent } from "@/api/students";
|
||||
|
||||
const router = useRouter();
|
||||
|
||||
const studentData = reactive({
|
||||
const studentData = ref({
|
||||
Id: "",
|
||||
name: "",
|
||||
gender: "",
|
||||
|
@ -247,16 +187,6 @@ const dialogData = ref({
|
|||
status: "",
|
||||
});
|
||||
|
||||
// const AddDialogData = ref({
|
||||
// name: "",
|
||||
// gender: "",
|
||||
// studentId: "",
|
||||
// department: "",
|
||||
// major: "",
|
||||
// classes: "",
|
||||
// status: "",
|
||||
// });
|
||||
|
||||
const visible = ref(false);
|
||||
const studentList = ref([]);
|
||||
|
||||
|
@ -264,43 +194,60 @@ const studentColumns = ref([
|
|||
{
|
||||
colKey: "Id",
|
||||
title: "序号",
|
||||
width: "100",
|
||||
},
|
||||
{
|
||||
colKey: "name",
|
||||
title: "姓名",
|
||||
align: "center",
|
||||
width: "100",
|
||||
|
||||
},
|
||||
{
|
||||
colKey: "gender",
|
||||
title: "性别",
|
||||
align: "center",
|
||||
width: "100",
|
||||
},
|
||||
{
|
||||
colKey: "studentId",
|
||||
title: "学号",
|
||||
align: "center",
|
||||
width: "150",
|
||||
},
|
||||
{
|
||||
colKey: "department",
|
||||
title: "系院",
|
||||
align: "center",
|
||||
width: "150",
|
||||
},
|
||||
{
|
||||
colKey: "major",
|
||||
title: "专业",
|
||||
align: "center",
|
||||
width: "150",
|
||||
},
|
||||
{
|
||||
colKey: "classes",
|
||||
title: "班级",
|
||||
align: "center",
|
||||
width: "150",
|
||||
},
|
||||
{
|
||||
colKey: "status",
|
||||
title: "状态",
|
||||
align: "center",
|
||||
width: "150",
|
||||
},
|
||||
{
|
||||
colKey: "operation",
|
||||
title: "操作",
|
||||
align: "center",
|
||||
width: "150",
|
||||
},
|
||||
]);
|
||||
|
||||
const pagination = reactive({
|
||||
const pagination = ref({
|
||||
defaultCurrent: 1,
|
||||
defaultPageSize: 10,
|
||||
total: 0,
|
||||
|
@ -343,7 +290,7 @@ const TableData = async () => {
|
|||
const res = await getList();
|
||||
// console.log(res);
|
||||
studentList.value = res.data.list;
|
||||
pagination.total = res.data.list.length;
|
||||
pagination.value.total = res.data.list.length;
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
|
@ -355,47 +302,64 @@ const Modify = (row) => {
|
|||
console.log("点击了确认按钮,弹出弹窗", row);
|
||||
visible.value = true;
|
||||
dialogData.value = {
|
||||
name: row.name,
|
||||
gender: row.gender,
|
||||
studentId: row.studentId,
|
||||
department: row.department,
|
||||
major: row.major,
|
||||
classes: row.classes,
|
||||
status: row.status,
|
||||
...row
|
||||
};
|
||||
};
|
||||
|
||||
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 () => {
|
||||
// console.log("点击了确认按钮", );
|
||||
// visible.value = false;
|
||||
// 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("学生信息更新成功");
|
||||
} else {
|
||||
MessagePlugin.error(response.message || "学生信息更新失败");
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("更新学生信息时发生错误", error);
|
||||
MessagePlugin.error("学生信息更新失败");
|
||||
}
|
||||
const onConfirmAnother = async () => {
|
||||
// const index = studentList.value.findIndex((item)=> item.Id === .Id)
|
||||
// await aaa(dialogData.value)
|
||||
// TableData()
|
||||
// if (index !== -1) {
|
||||
// studentList.value.splice(index,dialogData.value)
|
||||
|
||||
// }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;
|
||||
};
|
||||
|
@ -426,10 +390,6 @@ const Delete = async (row) => {
|
|||
}
|
||||
};
|
||||
|
||||
const onAddSubmit = () =>{
|
||||
console.log("点击新增");
|
||||
visible.value = true;
|
||||
}
|
||||
const close = (context) => {
|
||||
console.log("关闭弹窗,点击关闭按钮、按下ESC、点击蒙层等触发", context);
|
||||
};
|
||||
|
@ -453,7 +413,7 @@ const onOverlayClick = (context) => {
|
|||
background-color: @base-white-color;
|
||||
margin-bottom: 2rem;
|
||||
.scarch-from {
|
||||
height: 3.75rem;
|
||||
height: 60px;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
|
@ -472,4 +432,7 @@ const onOverlayClick = (context) => {
|
|||
align-items: center;
|
||||
}
|
||||
}
|
||||
:deep(.t-form__controls-content) {
|
||||
justify-content: space-between;
|
||||
}
|
||||
</style>
|
||||
|
|
|
@ -6,6 +6,7 @@ import BillQuitneckURL from "@/pages/finance-bill-manage/billQuitneck.vue";
|
|||
import BillBreakagekURL from "@/pages/finance-bill-manage/billBreakage.vue";
|
||||
import BillDestroyURL from "@/pages/finance-bill-manage/billDestroy.vue";
|
||||
import DetailReportURL from "@/pages/finance-bill-manage/detailReport.vue";
|
||||
import BillDrawURL from "@/pages/finance-bill-manage/billDraw.vue";
|
||||
|
||||
const financeBillManage = [
|
||||
{
|
||||
|
@ -70,6 +71,14 @@ const financeBillManage = [
|
|||
title: "报表明细",
|
||||
},
|
||||
},
|
||||
{
|
||||
path: "BillDraw",
|
||||
name: "billDraw",
|
||||
component: BillDrawURL,
|
||||
meta: {
|
||||
title: "报表明细",
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
];
|
||||
|
|
|
@ -16,11 +16,11 @@ export const useReceiptList = defineStore("ReceiptList", {
|
|||
async getPersonNameList() {
|
||||
const { data } = await reqPersonName();
|
||||
this.personName = data;
|
||||
console.log(this.personName);
|
||||
return this.personName;
|
||||
},
|
||||
|
||||
async getReceiptList(obj) {
|
||||
console.log("222");
|
||||
const { data } = await reqReceiptList(obj);
|
||||
this.receiptList = data;
|
||||
return this.receiptList;
|
||||
|
|
20
src/utils/pdf.js
Normal file
20
src/utils/pdf.js
Normal 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");
|
||||
};
|
|
@ -11,7 +11,7 @@ export default defineConfig({
|
|||
server: {
|
||||
proxy: {
|
||||
"/api": {
|
||||
target: "http://192.168.1.10:8080",
|
||||
target: "http://192.168.1.2:8080",
|
||||
changeOrigin: true,
|
||||
},
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue
Block a user