This commit is contained in:
sundongyu 2024-04-08 13:01:36 +08:00
commit 735135a86b
18 changed files with 816 additions and 180 deletions

View File

@ -21,7 +21,7 @@ const ReceiptList = Mock.mock([
billserial: "@integer(100000000,199999999)1",
proposer: "孙东宇",
billType: "@integer(0,4)",
receiptNum: "@integer(1,10)",
receiptNum: "@integer(1,10)",
receiptDate: "@date",
useInfo: "@csentence",
},
@ -34,7 +34,7 @@ const ReceiptList = Mock.mock([
billserial: "@integer(100000000,199999999)1",
proposer: "杨春宇",
billType: "@integer(0,4)",
receiptNum: "@integer(1,10)",
receiptNum: "@integer(1,10)",
receiptDate: "@date",
useInfo: "@csentence",
},
@ -47,7 +47,7 @@ const ReceiptList = Mock.mock([
billserial: "@integer(100000000,199999999)1",
proposer: "吕才卓",
billType: "@integer(0,4)",
receiptNum: "@integer(1,10)",
receiptNum: "@integer(1,10)",
receiptDate: "@date",
useInfo: "@csentence",
},
@ -60,7 +60,7 @@ const ReceiptList = Mock.mock([
billserial: "@integer(100000000,199999999)1",
proposer: "刘欣宇",
billType: "@integer(0,4)",
receiptNum: "@integer(1,10)",
receiptNum: "@integer(1,10)",
receiptDate: "@date",
useInfo: "@csentence",
},

2
package-lock.json generated
View File

@ -1607,7 +1607,7 @@
},
"node_modules/pinia-plugin-persistedstate": {
"version": "3.2.1",
"resolved": "https://registry.npmmirror.com/pinia-plugin-persistedstate/-/pinia-plugin-persistedstate-3.2.1.tgz",
"resolved": "https://registry.npmjs.org/pinia-plugin-persistedstate/-/pinia-plugin-persistedstate-3.2.1.tgz",
"integrity": "sha512-MK++8LRUsGF7r45PjBFES82ISnPzyO6IZx3CH5vyPseFLZCk1g2kgx6l/nW8pEBKxxd4do0P6bJw+mUSZIEZUQ==",
"peerDependencies": {
"pinia": "^2.0.0"

7
src/api/password.js Normal file
View File

@ -0,0 +1,7 @@
import request from "@/utils/request";
// 统一管理接口
const API = {
PASSWORD_URL: "/api/password",
};
export const reqPassword = () => request.post(API.PASSWORD_URL);

7
src/api/students.js Normal file
View File

@ -0,0 +1,7 @@
import request from "@/utils/request";
// 统一管理接口
const API = {
STUDENT_URL: "/api/student",
};
export const reqStudent = () => request.post(API.STUDENT_URL);

View File

@ -1,39 +1,50 @@
<template>
<div style="height: 100%">
<t-menu>
<t-submenu value="3" title="首页">
<t-submenu value="1" title="首页">
<template #icon>
<t-icon name="home" />
</template>
<t-menu-item value="3-1" to="/home">
<t-menu-item value="1-1" to="/home">
<span>首页</span>
</t-menu-item>
</t-submenu>
<t-submenu value="1" title="财务票据管理">
<t-submenu value="2" title="财务票据管理">
<template #icon>
<t-icon name="application" />
</template>
<t-menu-item value="1-1" to="/Bill/BillStock">
<t-menu-item value="2-1" to="/Bill/BillStock">
<span>票据入库管理</span>
</t-menu-item>
<t-menu-item value="1-2" to="/Bill/BillCancel">
<t-menu-item value="2-2" to="/Bill/BillCancel">
<span>票据退库管理</span>
</t-menu-item>
<t-menu-item value="1-3" to="/Bill/BillReceipt">
<t-menu-item value="2-3" to="/Bill/BillReceipt">
<span>票据领用管理</span>
</t-menu-item>
<t-menu-item value="2-4" to="/Bill/BillQuitneck">
<span>票据退领管理</span>
</t-menu-item>
</t-submenu>
<t-submenu value="2" title="应收款管理">
<t-submenu value="3" title="应收款管理">
<template #icon>
<t-icon name="application" />
</template>
<t-menu-item value="2-1" to="/accounts">
<t-menu-item value="3-1" to="/accounts">
<span>应收款管理</span>
</t-menu-item>
<t-menu-item value="2-2" to="/billCollected">
<t-menu-item value="3-2" to="/billCollected">
<span>学生收款</span>
</t-menu-item>
</t-submenu>
<t-submenu value="4" title="学生管理">
<template #icon>
<t-icon name="application" />
</template>
<t-menu-item value="4-1" to="/Students">
<span>学生管理</span>
</t-menu-item>
</t-submenu>
</t-menu>
</div>
</template>

View File

@ -66,7 +66,7 @@
<t-content class="table-box">
<div class="table-header">
<div>
<h4 style="font-size: 110%">票据列表</h4>
<h4 style="font-size: 110%">票据退库列表</h4>
</div>
<div>
<t-button
@ -87,7 +87,7 @@
:columns="columns"
:pagination="pagination"
class="table"
:max-height="650"
:max-height="550"
>
<template #billType="{ row }">
<div v-for="item in billType" :key="item">
@ -294,10 +294,12 @@ const columns = ref([
fixed: "right",
},
]);
//
const FORM_RULES = {
approver: [{ required: true, message: "请输入审批人", trigger: "blur" }],
approvalDate: [
{ required: true, message: "请选择入库日期", trigger: ["blur", "change"] },
{ required: true, message: "请选择入库日期", trigger: "change" },
],
approvalReason: [
{ required: true, message: "请输入审批原因", trigger: "blur" },

View File

@ -0,0 +1,389 @@
<template>
<div class="back-color" style="overflow-y: hidden">
<t-layout style="height: 100%; background-color: #f5f7fb">
<t-aside class="asideTree">
<t-space direction="vertical">
<t-tree
:data="personName"
hover
transition
activable
expandAll
:expand-mutex="mutex"
expand-on-click-node="true"
@click="onClick"
/>
</t-space>
</t-aside>
<t-content>
<t-layout style="height: 100%; background-color: #f5f7fb">
<t-header class="scarch-box">
<t-form
ref="form"
:data="scarchData"
label-width="calc(2em + 40px)"
layout="inline"
scroll-to-first-error="smooth"
class="scarch-from"
@reset="resetting"
@submit="headerQuery"
>
<div style="margin-left: 1rem; margin-top: 1px">
<t-form-item label="票据编号:" name="billserial">
<t-input
v-model="scarchData.billserial"
maxlength="10"
></t-input>
</t-form-item>
<t-form-item label="退领时间:" name="receiptDate">
<t-date-picker v-model="scarchData.receiptDate" clearable />
</t-form-item>
<t-form-item
label="票据类型:"
name="billType"
style="margin-bottom: 0.3rem"
>
<t-select
v-model="scarchData.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 #billType="{ row }">
<div v-for="item in billType" :key="item">
<span v-if="row.billType === item.value">{{
item.label
}}</span>
</div>
</template>
<template #receiptNum="{ row }">
{{ `${row.receiptNum}` }}
</template>
</t-base-table>
</t-content>
</t-layout>
</t-content>
</t-layout>
</div>
</template>
<script setup>
import { ref, onMounted, nextTick } from "vue";
import { MessagePlugin } from "tdesign-vue-next";
import { LoadIcon } from "tdesign-icons-vue-next";
import { useReceiptList } from "@/stores/billReceipt";
const receiptList = useReceiptList();
const personName = ref([]);
const tableData = ref([]);
const data = ref([]);
const loading = ref(false);
const visiblePost = ref(false);
const columns = ref([
{
colKey: "serial-number",
title: "序号",
width: 50,
},
{
colKey: "billserial",
title: "票据编号",
align: "center",
width: 100,
},
{
colKey: "proposer",
title: "申请人",
align: "center",
width: 100,
},
{
colKey: "billType",
title: "票据类型",
align: "center",
width: 100,
},
{
colKey: "quitneckNum",
title: "退领数量",
align: "center",
width: 100,
},
{
colKey: "quitneckDate",
title: "退领时间",
align: "center",
width: 100,
},
{
colKey: "quitneckInfo",
title: "退领原来",
ellipsis: true,
align: "center",
width: 200,
},
]);
//
const billType = ref([
{ label: "票据类型1", value: 0 },
{ label: "票据类型2", value: 1 },
{ label: "票据类型3", value: 2 },
{ label: "票据类型4", value: 3 },
{ label: "票据类型5", value: 4 },
]);
const dialogData = ref({
quitneckDate: "",
quitneckReason: "",
quitneckNum: "",
});
//
const scarchData = ref({
billserial: "",
});
//
const pagination = ref({
defaultCurrent: 1,
defaultPageSize: 10,
total: 50,
});
//
const personList = async () => {
personName.value = await receiptList.getPersonNameList();
};
//
const FORM_RULES = {
quitneckNum: [{ required: true, message: "请输入退领张数", trigger: "blur" }],
quitneckDate: [
{ required: true, message: "请选择退领日期", trigger: "change" },
],
quitneckReason: [
{ required: true, message: "请输入退领原因", trigger: "blur" },
],
};
//
const headerQuery = () => {
tableData.value = data.value;
console.log(
scarchData.value.billserial,
scarchData.value.billType,
scarchData.value.receiptDate
);
if (
scarchData.value.billserial === "" &&
(scarchData.value.billType === undefined ||
scarchData.value.billType === "") &&
(scarchData.value.receiptDate === undefined ||
scarchData.value.receiptDate === "")
) {
getNewTable();
} else {
const list = tableData.value.filter((item) => {
let arrList;
if (scarchData.value.billserial === item.billserial) {
arrList = item;
}
if (scarchData.value.billType === item.billType) {
arrList = item;
}
if (scarchData.value.receiptDate === item.receiptDate) {
arrList = item;
}
if (
scarchData.value.billserial === "" &&
scarchData.value.billType === "" &&
scarchData.value.receiptDate === ""
) {
arrList = item;
}
return arrList;
});
tableData.value = list;
pagination.value.total = list.length;
}
};
//
const resetting = () => {
scarchData.value = {
billserial: "",
billType: "",
receiptDate: "",
};
getNewTable();
};
const rowItem = ref({});
const Quitneck = (value) => {
dialogData.value = {
quitneckDate: "",
quitneckReason: "",
quitneckNum: "",
};
visiblePost.value = true;
rowItem.value = value;
};
//
const quitneckAdd = async ({ validateResult, firstError }) => {
if (validateResult === true) {
if (rowItem.value.row.receiptNum - dialogData.value.quitneckNum < 0) {
return MessagePlugin.error("退领数量不能大于领用数量");
}
dialogData.value.quitneckNum =
rowItem.value.row.receiptNum - dialogData.value.quitneckNum;
dialogData.value.id = rowItem.value.row.id;
await receiptList.getquitneckNum(dialogData.value);
getTableData();
MessagePlugin.success("提交成功");
visiblePost.value = false;
} else {
console.log("Validate Errors: ", firstError, validateResult);
}
};
const onClick = async (context) => {
//
if (context.node.value === "t1") {
return;
}
loading.value = true;
//
tableData.value = await receiptList.getReceiptList({
name: context.node.label,
});
data.value = await receiptList.getReceiptList({
name: context.node.label,
});
pagination.value.total = tableData.value.length;
const timerId = setTimeout(() => {
loading.value = false;
clearInterval(timerId);
}, 300);
};
//
const refresh = () => {
getTableData();
};
// menuManagement
const getPersonName = () => {
let arr = JSON.parse(localStorage.getItem("ReceiptList"));
if (arr) {
personName.value = arr.personName;
} else {
personList();
}
};
// menuManagement
const getTableData = async () => {
let arr = JSON.parse(localStorage.getItem("ReceiptList"));
if (arr.receiptList.length > 0) {
loading.value = true;
tableData.value = arr.receiptList;
pagination.value.total = tableData.value.length;
const timerId = setTimeout(() => {
loading.value = false;
clearInterval(timerId);
}, 300);
} else {
await nextTick();
//
const firstNodeWithChildren = personName.value.find(
(node) => Array.isArray(node.children) && node.children.length > 0
);
if (firstNodeWithChildren) {
const simulatedContext = {
node: {
label: "孙东宇",
},
};
onClick(simulatedContext);
}
}
};
onMounted(async () => {
getPersonName();
getTableData();
// personName
});
</script>
<style scoped lang="less">
.asideTree {
margin-right: 2rem;
display: flex;
justify-content: center;
padding: 1rem;
}
.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: 41rem;
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-tree--transition .t-tree__label) {
width: 10rem;
}
:deep(.t-form__controls-content) {
justify-content: space-between;
}
</style>

View File

@ -1,5 +1,5 @@
<template>
<div class="back-color">
<div class="back-color" style="overflow-y: hidden">
<t-layout style="height: 100%; background-color: #f5f7fb">
<t-aside class="asideTree">
<t-space direction="vertical">
@ -67,7 +67,7 @@
<t-content class="table-box">
<div class="table-header">
<div>
<h4 style="font-size: 110%">票据列表</h4>
<h4 style="font-size: 110%">票据领用列表</h4>
</div>
<div>
<t-button
@ -88,7 +88,7 @@
:columns="columns"
:pagination="pagination"
class="table"
:max-height="650"
:max-height="550"
>
<template #billType="{ row }">
<div v-for="item in billType" :key="item">
@ -97,11 +97,90 @@
}}</span>
</div>
</template>
<template #receiptNum="{ row }">
{{ `${row.receiptNum}` }}
</template>
<template #status="slotProps">
<t-button
theme="default"
variant="text"
size="small"
@click="Quitneck(slotProps)"
:disabled="slotProps.row.receiptNum === 0"
>退领</t-button
>
</template>
</t-base-table>
</t-content>
</t-layout>
</t-content>
</t-layout>
<t-space>
<t-dialog
ref="postForm"
v-model:visible="visiblePost"
header="退领"
width="40%"
:confirm-on-enter="true"
:on-close="closePost"
:confirm-btn="null"
:cancel-btn="null"
>
<t-space direction="vertical">
<div>
<t-form
ref="formDialog"
scroll-to-first-error="smooth"
label-align="left"
:rules="FORM_RULES"
:data="dialogData"
:colon="true"
@submit="quitneckAdd"
label-width="calc(2em + 55px)"
@reset="onReset"
>
<t-form-item
label="退领张数"
name="quitneckNum"
style="margin-bottom: 1.5rem; width: 35rem"
>
<t-input
v-model="dialogData.quitneckNum"
type="number"
placeholder="请输入退领张数"
></t-input>
</t-form-item>
<t-form-item
label="退领时间"
name="quitneckDate"
style="margin-bottom: 1.5rem; width: 35rem"
>
<t-date-picker
v-model="dialogData.quitneckDate"
placeholder="请选择退领时间"
clearable
style="width: 35rem"
/>
</t-form-item>
<t-form-item label="退领原因" name="quitneckReason">
<t-textarea
v-model="dialogData.quitneckReason"
placeholder="请输入退领原因"
></t-textarea>
</t-form-item>
<t-form-item>
<t-space size="small">
<t-button theme="primary" type="submit">提交</t-button>
<t-button theme="default" variant="base" type="reset"
>重置</t-button
>
</t-space>
</t-form-item>
</t-form>
</div>
</t-space>
</t-dialog>
</t-space>
</div>
</template>
@ -115,6 +194,8 @@ const receiptList = useReceiptList();
const personName = ref([]);
const tableData = ref([]);
const data = ref([]);
const loading = ref(false);
const visiblePost = ref(false);
const columns = ref([
{
colKey: "serial-number",
@ -158,6 +239,13 @@ const columns = ref([
align: "center",
width: 200,
},
{
colKey: "status",
title: "操作",
width: 120,
align: "center",
fixed: "right",
},
]);
//
const billType = ref([
@ -167,6 +255,11 @@ const billType = ref([
{ label: "票据类型4", value: 3 },
{ label: "票据类型5", value: 4 },
]);
const dialogData = ref({
quitneckDate: "",
quitneckReason: "",
quitneckNum: "",
});
//
const scarchData = ref({
@ -185,6 +278,17 @@ const personList = async () => {
personName.value = await receiptList.getPersonNameList();
};
//
const FORM_RULES = {
quitneckNum: [{ required: true, message: "请输入退领张数", trigger: "blur" }],
quitneckDate: [
{ required: true, message: "请选择退领日期", trigger: "change" },
],
quitneckReason: [
{ required: true, message: "请输入退领原因", trigger: "blur" },
],
};
//
const headerQuery = () => {
tableData.value = data.value;
@ -235,12 +339,39 @@ const resetting = () => {
};
getNewTable();
};
const rowItem = ref({});
const Quitneck = (value) => {
dialogData.value = {
quitneckDate: "",
quitneckReason: "",
quitneckNum: "",
};
visiblePost.value = true;
rowItem.value = value;
};
//
const quitneckAdd = async ({ validateResult, firstError }) => {
if (validateResult === true) {
if (rowItem.value.row.receiptNum - dialogData.value.quitneckNum < 0) {
return MessagePlugin.error("退领数量不能大于领用数量");
}
dialogData.value.quitneckNum =
rowItem.value.row.receiptNum - dialogData.value.quitneckNum;
dialogData.value.id = rowItem.value.row.id;
await receiptList.getquitneckNum(dialogData.value);
getTableData();
MessagePlugin.success("提交成功");
visiblePost.value = false;
} else {
console.log("Validate Errors: ", firstError, validateResult);
}
};
const onClick = async (context) => {
//
if (context.node.value === "t1") {
return;
}
loading.value = true;
//
tableData.value = await receiptList.getReceiptList({
name: context.node.label,
@ -249,6 +380,10 @@ const onClick = async (context) => {
name: context.node.label,
});
pagination.value.total = tableData.value.length;
const timerId = setTimeout(() => {
loading.value = false;
clearInterval(timerId);
}, 300);
};
//
const refresh = () => {
@ -267,7 +402,13 @@ const getPersonName = () => {
const getTableData = async () => {
let arr = JSON.parse(localStorage.getItem("ReceiptList"));
if (arr.receiptList.length > 0) {
loading.value = true;
tableData.value = arr.receiptList;
pagination.value.total = tableData.value.length;
const timerId = setTimeout(() => {
loading.value = false;
clearInterval(timerId);
}, 300);
} else {
await nextTick();
//

View File

@ -48,7 +48,7 @@
<t-content class="table-box">
<div class="table-header">
<div>
<h4 style="font-size: 110%">票据列表</h4>
<h4 style="font-size: 110%">票据入库列表</h4>
</div>
<div>
<t-button theme="primary" size="small" @click="addStock">
@ -73,7 +73,7 @@
:columns="columns"
:pagination="pagination"
class="table"
:max-height="650"
:max-height="550"
>
<template #billType="{ row }">
<div v-for="item in billType" :key="item">
@ -407,14 +407,10 @@ const closePost = () => {
//
const FORM_RULES = {
billserial: [{ required: true, message: "请输入票据编号", trigger: "blur" }],
billType: [
{ required: true, message: "请选择票据类型", trigger: ["blur", "change"] },
],
billType: [{ required: true, message: "请选择票据类型", trigger: "change" }],
stockNum: [{ required: true, message: "请输入库存数量", trigger: "blur" }],
unit: [{ required: true, message: "请输入单位", trigger: "blur" }],
stockDate: [
{ required: true, message: "请选择入库日期", trigger: ["blur", "change"] },
],
stockDate: [{ required: true, message: "请选择入库日期", trigger: "change" }],
operator: [{ required: true, message: "请输入操作员", trigger: "blur" }],
};

View File

@ -54,7 +54,8 @@
import { MessagePlugin } from "tdesign-vue-next";
import { reactive, ref, onMounted } from "vue";
import { reqUser } from "@/api/login";
import router from "@/router";
import { useRouter } from "vue-router";
import axios from 'axios';
// import { TForm, TFormItem, TInput, TButton } from "tdesign-vue-next";
// import { DesktopIcon, LockOnIcon } from "tdesign-icons-vue";
@ -62,7 +63,9 @@ const INITIAL_DATA = {
account: "",
password: "",
};
const from = ref();
const from = ref(null);
const router = useRouter();
const formData = reactive({
...INITIAL_DATA,
});
@ -74,12 +77,8 @@ const rules = reactive({
message: "必须填写",
},
{
min: 10,
message: "输入不正确",
},
{
max: 10,
message: "输入不正确",
pattern: /^\d{10}$/, // 10
message: "学号必须是10位数字",
},
],
password: [
@ -92,40 +91,25 @@ const rules = reactive({
message: "请输入 8 位密码",
},
{
pattern: /[A-Z]+/,
message: "密码必须包含大写字母",
pattern: /^(?=.*[A-Z])(?=.*\d)[A-Za-z\d]{8,}$/u,
message: "密码必须包含至少一个大写字母,并由字母和数字组成",
},
],
});
const onReset = () => {
//
formData.account = "";
formData.password = "";
MessagePlugin.success("重置成功");
};
// const onSubmit = () => {
// this.$refs.form.validateResult((valid,errors) => {
// console.log(valid);
// if (valid) {
// MessagePlugin.success("");
// } else {
// MessagePlugin.error("");
// console.log("Errors: ", errors);
// return false;
// }
// });
// };
onMounted(() => {
reqUser();
});
const onSubmit = async () => {
try {
const validateResult = await this.$refs.form.validate();
if (validateResult.result) {
await reqUser();
const validateResult = await from.value?.validate();
if (validateResult?.result) {
await reqUser(formData.account, formData.password);
MessagePlugin.success("提交成功");
await router.push("/");
} else {
const firstError = validateResult.errors[0]?.message || "未知错误";
const firstError = validateResult?.errors[0]?.message || "未知错误";
console.log("Errors: ", validateResult.errors);
MessagePlugin.warning(firstError);
}
@ -135,18 +119,9 @@ const onSubmit = async () => {
}
};
// const Login = async () => {
// await reqUser();
// };
onMounted(() => {
reqUser();
});
function handleForgotPasswordClick() {
router.push("/password-reset")
router.push("/password-reset");
}
</script>
<style lang="less" scoped>

View File

@ -46,6 +46,7 @@
import { MessagePlugin } from "tdesign-vue-next";
import { reactive } from "vue";
import router from "@/router";
import {reqPassword} from "@/api/password"
const INITIAL_DATA = {
account: "",
@ -57,6 +58,14 @@ const formData = reactive({
...INITIAL_DATA,
});
const rePassword = (val) =>
new Promise((resolve) => {
const timer = setTimeout(() => {
resolve(formData.password === val);
clearTimeout(timer);
});
});
const rules = reactive({
account: [
{
@ -65,12 +74,8 @@ const rules = reactive({
type: "error",
},
{
min: 10,
message: "输入不正确",
},
{
max: 10,
message: "输入不正确",
pattern: /^\d{10}$/, // 10
message: "学号必须是10位数字",
},
],
password: [
@ -84,8 +89,8 @@ const rules = reactive({
message: "请输入 8 位密码",
},
{
pattern: /[A-Z]+/,
message: "密码必须包含大写字母",
pattern: /^(?=.*[A-Z])(?=.*\d)[A-Za-z\d]{8,}$/u,
message: "密码必须包含至少一个大写字母,并由字母和数字组成",
},
],
rePassword: [
@ -102,6 +107,11 @@ const rules = reactive({
pattern: /[A-Z]+/,
message: "密码必须包含大写字母",
},
{
validator: rePassword,
trigger: ["blur", "change"],
message: "两次密码不一致",
},
],
});
@ -109,69 +119,32 @@ const onReset = () => {
MessagePlugin.success("重置成功");
};
const onSubmit = ({ validateResult, firstError }) => {
if (validateResult === true) {
MessagePlugin.success("提交成功");
} else {
console.log("Errors: ", validateResult);
MessagePlugin.warning(firstError);
const onSubmit = async () => {
try {
const validateResult = await from.value?.validate();
if (validateResult?.result) {
await reqPassword(formData.account, formData.password, formData.rePassword);
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 onValidate = ({ validateResult, firstError }) => {
if (validateResult === true) {
onSubmit();
console.log("Validate Success");
} else {
console.log("Validate Errors: ", firstError, validateResult);
}
};
// 使 resolve
const userNameValidator = (val) =>
new Promise((resolve) => {
const timer = setTimeout(() => {
if (["Zhang", "Li", "Wang"].includes(val)) {
resolve({
result: true,
});
} else {
resolve({
result: false,
message: "用户名不存在",
type: "error",
});
}
clearTimeout(timer);
}, 10);
});
//
const passwordValidator = (val) => {
if (val.length > 0 && val.length <= 2) {
return {
result: false,
message: "太简单了!再开动一下你的小脑筋吧!",
type: "error",
};
}
if (val.length > 2 && val.length < 4) {
return {
result: false,
message: "还差一点点,就是一个完美的密码了!",
type: "warning",
};
}
return {
result: true,
message: "太强了,你确定自己记得住吗!",
type: "success",
};
};
//
const rePassword = (val) =>
new Promise((resolve) => {
const timer = setTimeout(() => {
resolve(formData.password === val);
clearTimeout(timer);
});
});
</script>
<style lang="less" scoped>

View File

@ -1,46 +1,146 @@
<template>
<div>
students
<t-space direction="vertical">
<!-- 按钮操作区域 -->
<div>
<t-radio-group v-model="size" variant="default-filled">
<t-radio-button value="small">小尺寸</t-radio-button>
<t-radio-button value="medium">中尺寸</t-radio-button>
<t-radio-button value="large">大尺寸</t-radio-button>
</t-radio-group>
</div>
<t-space>
<t-checkbox v-model="stripe">显示斑马纹</t-checkbox>
<t-checkbox v-model="bordered">显示表格边框</t-checkbox>
<t-checkbox v-model="hover">显示悬浮效果</t-checkbox>
<t-checkbox v-model="tableLayout">宽度自适应</t-checkbox>
<t-checkbox v-model="showHeader">显示表头</t-checkbox>
<t-space direction="vertical">
<t-form ref="searchForm" @reset="onReset">
<t-form-item label="姓名" name="name">
<t-input v-model="searchCriteria.name" placeholder="请输入姓名"></t-input>
</t-form-item>
<t-form-item label="学号" name="studentId">
<t-input v-model="searchCriteria.studentId" placeholder="请输入学号"></t-input>
</t-form-item>
<t-form-item>
<t-space size="10px">
<t-button theme="primary" type="submit" @click="onSearch">查询</t-button>
<t-button theme="default" variant="base" type="reset">重置</t-button>
</t-space>
</t-form-item>
</t-form>
<!-- 当数据为空需要占位时会显示 cellEmptyContent -->
<t-table
rowKey="index"
:data="data"
:columns="columns"
:stripe="stripe"
:bordered="bordered"
:hover="hover"
:size="size"
:table-layout="tableLayout ? 'auto' : 'fixed'"
:pagination="pagination"
:showHeader="showHeader"
cellEmptyContent="-"
resizable
></t-table>
<t-space>
<t-checkbox v-model="stripe">显示斑马纹</t-checkbox>
<t-checkbox v-model="bordered">显示表格边框</t-checkbox>
<t-checkbox v-model="hover">显示悬浮效果</t-checkbox>
<t-checkbox v-model="tableLayout">宽度自适应</t-checkbox>
<t-checkbox v-model="showHeader">显示表头</t-checkbox>
</t-space>
</div>
<t-table
rowKey="studentId"
:data="studentList"
:columns="studentColumns"
:stripe="stripe"
:bordered="bordered"
:hover="hover"
:size="size"
:table-layout="tableLayout ? 'auto' : 'fixed'"
:pagination="pagination"
:showHeader="showHeader"
cellEmptyContent="-"
resizable
></t-table>
</t-space>
<!-- 动态操作列 -->
<!-- <t-table-column label="操作">
<template #default="{ row }">
<t-button-group>
<t-button @click="handleLeave(row)">休学</t-button>
<t-button @click="handleWithdraw(row)">退学</t-button>
<t-button @click="handleReturn(row)">复学</t-button>
</t-button-group>
</template>
</t-table-column> -->
</template>
<script setup>
import { ref, reactive, computed } from 'vue';
import { MessagePlugin } from "tdesign-vue-next";
import { ref } from "vue";
import { useRouter } from "vue-router";
import { reqStudent } from "@/api/students";
const router = useRouter();
const searchForm = ref(null);
const initialStudentData = [];
const total = 28;
for (let i = 0; i < total; i++) {
initialStudentData.push({
studentId: `${'S'}${i + 1}`,
name: ['贾明', '张三', '王芳'][i % 3],
gender: ['男', '女'][i % 2],
departmentCode: 'D' + (i % 4 + 1),
department: ['计算机科学系', '数学系', '物理系', '化学系'][i % 4],
className: 'C' + (i % 5 + 1),
majorCode: 'M' + (i % 6 + 1),
major: ['计算机科学与技术', '数学', '物理学', '化学', '生物学', '经济学'][i % 6],
classCode: 'C' + (i % 5 + 1),
classes: ['一班', '二班', '三班', '四班', '五班'][i % 5],
});
}
//
const searchCriteria = reactive({ name: '', studentId: '' });
//
const studentList = computed(() => {
return initialStudentData.filter(student =>
(!searchCriteria.name || student.name.includes(searchCriteria.name)) &&
(!searchCriteria.studentId || student.studentId === searchCriteria.studentId)
);
});
//
const studentColumns = ref([
{
colKey: 'studentId',
title: '学号',
},
{
colKey: 'name',
title: '姓名',
},
{
colKey: 'gender',
title: '性别',
},
{
colKey: 'department',
title: '系院',
},
{
colKey: 'major',
title: '专业',
},
{
colKey: 'classes',
title: '班级',
},
]);
const size = ref('medium');
const tableLayout = ref(false);
const stripe = ref(false);
const bordered = ref(false);
const hover = ref(true);
const showHeader = ref(true);
const pagination = reactive({
defaultCurrent: 1,
defaultPageSize: 5,
total: initialStudentData.length,
});
//
const onSearch = () => {
pagination.defaultCurrent = 1;
};
const onReset = () => {
searchCriteria.name = '';
searchCriteria.studentId = '';
pagination.defaultCurrent = 1;
MessagePlugin.success("重置成功");
};
</script>
<style lang="less" scoped></style>
<style lang="less" scoped>
</style>

View File

@ -1,9 +1,9 @@
import { createRouter, createWebHistory } from "vue-router";
import FinanceBillManage from "./modules/financeBillManage";
import ReceivablesManagement from "./modules/receivablesManagement";
import StudentManage from "./modules/studentManage";
import Login from "@/pages/login/index.vue";
import Password from "@/pages/password/index.vue";
import Student from "@/pages/students/student.vue";
import Layout from "@/layout/index.vue";
const router = createRouter({
@ -35,14 +35,10 @@ const router = createRouter({
name: "password",
component: Password,
},
{
path: "/student",
name: "student",
component: Student,
},
...FinanceBillManage,
...ReceivablesManagement
]
...ReceivablesManagement,
...StudentManage,
],
});
export default router;

View File

@ -2,6 +2,7 @@ import Layout from "@/layout/index.vue";
import BillStockURL from "@/pages/finance-bill-manage/billStock.vue";
import BillCancelURL from "@/pages/finance-bill-manage/billCancel.vue";
import BillReceiptURL from "@/pages/finance-bill-manage/billReceipt.vue";
import BillQuitneckURL from "@/pages/finance-bill-manage/billQuitneck.vue";
const financeBillManage = [
{
@ -34,6 +35,14 @@ const financeBillManage = [
title: "票据领用",
},
},
{
path: "BillQuitneck",
name: "billQuitneck",
component: BillQuitneckURL,
meta: {
title: "票据退领",
},
},
],
},
];

View File

@ -0,0 +1,24 @@
import Layout from "@/layout/index.vue";
// import studentURL from "@/pages/students/student";
import studentURL from "@/pages/students/student.vue";
const financeBillManage = [
{
path: "/Student",
name: "student",
component: Layout,
meta: { title: "学生", name: "resource" },
children: [
{
path: "/Students",
name: "students",
component: studentURL,
meta: {
title: "学生管理",
},
},
],
},
];
export default financeBillManage;

View File

@ -24,6 +24,14 @@ export const useReceiptList = defineStore("ReceiptList", {
this.receiptList = data;
return this.receiptList;
},
async getquitneckNum(obj) {
console.log(obj);
const index = this.receiptList.findIndex((item) => item.id === obj.id);
if (index !== -1) {
this.receiptList[index].receiptNum = obj.quitneckNum;
}
console.log(this.receiptList);
},
},
persist: true,
});

View File

@ -15,10 +15,8 @@ export const useStock = defineStore("menuManagement", {
},
addStockList(arr) {
const index = this.stockList.findIndex((item) => item.id === arr.id);
console.log(arr);
if (index !== -1) {
this.stockList[index] = arr;
console.log(this.stockList, "222");
} else {
arr.id = new Date().getTime();
this.stockList.unshift(arr);

View File

@ -11,7 +11,7 @@ export default defineConfig({
server: {
proxy: {
"/api": {
target: "http://192.168.1.10:8000",
target: "http://192.168.1.10:8080",
changeOrigin: true,
},
},