🦄 refactor:

This commit is contained in:
ycy 2024-04-09 10:05:42 +08:00
parent 9041591d98
commit 610ba20dab
13 changed files with 99 additions and 1400 deletions

View File

@ -1,8 +1,6 @@
import sdy from './modules/sdy' import sdy from './modules/sdy'
import ycy from './modules/ycy' import ycy from './modules/ycy'
import lcz from './modules/lcz'
export default [ export default [
...sdy, ...sdy,
...ycy, ...ycy
...lcz,
] ]

View File

@ -1,40 +0,0 @@
import Mock from "mockjs";
function randomGender() {
return ['男', '女'][Math.floor(Math.random() * 2)];
}
const student = Mock.mock({
"list|100": [
{
id: '@id',
name: '@cname',
gender: randomGender(),
studentId: '@id',
department: function () {
return ['计算机科学系', '数学系', '物理系', '化学系'][this.random(0, 3)];
},
major: function () {
return ['计算机科学与技术', '数学', '物理学', '化学', '生物学', '经济学'][this.random(0, 5)];
},
classes: function () {
return ['一班', '二班', '三班', '四班', '五班'][this.random(0, 4)];
},
status: function () {
return ['休学', '退学', '复学'][this.random(0, 2)];
}
}
]
})
export default [
{
url: '/api/student',
method: 'post',
response: (config) => {
return {
code: 200,
data: student.list
};
}
}
];

View File

@ -13,22 +13,7 @@ const data = Mock.mock({
} }
] ]
}) })
const loans = Mock.mock({
"list|45": [
{
"id|+1": 1,
'proposer': '@cname',
'student': '@integer(100000000,999999999)',
'allowance': '@integer(10000,50000)',
'department': '@pick(["机电工程系","护理分院","建筑系","材料科学与工程系","环境科学与工程系"])',
'cation': '@pick(["2021-2022学年度","2022-2023学年度"])',
'loanTerm': '@pick(["已放款","未放款"])',
'timeofapplication': '@date("yyyy-MM-dd")',
}
]
})
export default [ export default [
// 应收管理
{ {
url: '/get-sdy-managment-list', url: '/get-sdy-managment-list',
method: 'get', method: 'get',
@ -39,7 +24,6 @@ export default [
} }
} }
}, },
// 查找应收管理
{ {
url: '/post-sdy-managment-find', url: '/post-sdy-managment-find',
method: 'post', method: 'post',
@ -74,38 +58,5 @@ export default [
code: 200, code: 200,
} }
} }
},
// 借款管理
{
url: '/get-sdy-loan-list',
method: 'get',
response: () => {
return {
code: 200,
data: loans
} }
}
},
// 添加借款人
{
url: '/post-sdy-loan-add',
method: 'post',
response: (req) => {
const newLoan = {
id: loans.list.length + 1,
proposer: req.body.proposer,
student: req.body.student,
allowance: req.body.allowance,
department: req.body.department,
cation: req.body.cation,
loanTerm: req.body.loanTerm,
timeofapplication: req.body.timeofapplication,
}
loans.list.push(newLoan)
return {
code: 200,
data: newLoan
}
}
},
] ]

908
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -11,7 +11,6 @@
"dependencies": { "dependencies": {
"axios": "^1.6.8", "axios": "^1.6.8",
"dayjs": "^1.11.10", "dayjs": "^1.11.10",
"exceljs": "^4.4.0",
"less": "^4.2.0", "less": "^4.2.0",
"mockjs": "^1.1.0", "mockjs": "^1.1.0",
"pinia": "^2.1.7", "pinia": "^2.1.7",

View File

@ -1,17 +1,8 @@
import request from '@/utils/request' import request from '@/utils/request'
// 收款管理
export function APIReceivablesList() { export function APIReceivablesList() {
return request.get('/get-sdy-managment-list') return request.get('/get-sdy-managment-list')
} }
//查询收款
export function APIReceivablesAdd(data) { export function APIReceivablesAdd(data) {
return request.post('/post-sdy-managment-find', data) return request.post('/post-sdy-managment-find', data)
} }
//贷款管理
export function APILoansList() {
return request.get('/get-sdy-loan-list')
}
//查询贷款
export function APILoansAdd(data) {
return request.post('/post-sdy-loan-add', data)
}

View File

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

View File

@ -42,9 +42,6 @@
<t-menu-item value="3-2" to="/billCollected"> <t-menu-item value="3-2" to="/billCollected">
<span>学生收款</span> <span>学生收款</span>
</t-menu-item> </t-menu-item>
<t-menu-item value="3-3" to="/student-loan">
<span>助学贷款</span>
</t-menu-item>
</t-submenu> </t-submenu>
<t-submenu value="4" title="学生管理"> <t-submenu value="4" title="学生管理">
<template #icon> <template #icon>

View File

@ -180,7 +180,7 @@ const InvoiceData = ref({
}) })
</script> </script>
<style lang="less" scoped> <style lang="scss" scoped>
.headeRight { .headeRight {
width: 240px; width: 240px;
height: 100%; height: 100%;

View File

@ -199,7 +199,6 @@ const columns = ref([
{ colKey: 'major', title: '专业' }, { colKey: 'major', title: '专业' },
{ colKey: 'grade', title: '班级' }, { colKey: 'grade', title: '班级' },
{ colKey: 'tuition', title: '是否缴费' }, { colKey: 'tuition', title: '是否缴费' },
{ colKey: 'tuition', title: '学贷款缴费' },
{ colKey: 'action', title: '操作', align: 'center' } { colKey: 'action', title: '操作', align: 'center' }
]) ])
// //

View File

@ -1,202 +0,0 @@
<template>
<div class="back-color">
<!-- 表单 -->
<div class="search-form">
<t-form
ref="form"
:data="formData"
reset-type="initial"
colon
@reset="onReset"
@submit="onSubmit"
>
<t-row>
<t-col :span="3">
<t-form-item label="学生姓名" name="name">
<t-input v-model="formData.name"></t-input>
</t-form-item>
</t-col>
<t-col :span="3">
<t-form-item label="学号" name="studentnumber">
<t-input v-model="formData.studentnumber"></t-input>
</t-form-item>
</t-col>
<t-col :push="4" :span="2">
<t-button type="submit" class="button" style="margin-left: -0.5rem"
>搜索</t-button
>
<t-button type="reset" style="margin-left: 1.5rem">重置</t-button>
</t-col>
</t-row>
</t-form>
</div>
<!-- 表格 -->
<div>
<div>
<t-row>
<t-col :span="3" :offset="10" style="margin-bottom: 0.5rem">
<t-button theme="default" variant="text" @click="onClick"
>申请助学贷款</t-button
>
</t-col>
</t-row>
</div>
<t-table
row-key="id"
:data="data"
:columns="columns"
table-layout="fixed"
size="medium"
:pagination="pagination"
:show-header="true"
cell-empty-content="-"
resizable
lazy-load
:loading="loading"
@row-click="handleRowClick"
@page-change="onPageChange"
>
</t-table>
</div>
<!-- 弹出框 -->
<div>
<t-space>
<t-dialog
v-model:visible="visible"
header="申请贷款"
width="20%"
:on-cancel="onCancel"
:on-close-btn-click="onCloseBtnClick"
:on-confirm="onConfirmAnother"
:close-on-overlay-click="false"
>
<t-space direction="vertical" style="width: 100%">
<t-space direction="vertical" size="large">
<t-form
ref="form"
:data="formData"
reset-type="initial"
colon
@reset="onReset"
>
<t-form-item label="申请人" name="name">
<t-input v-model="addData.proposer"></t-input>
</t-form-item>
<t-form-item label="学号" name="RoutingAddress">
<t-input v-model="addData.student"></t-input>
</t-form-item>
<t-form-item label="所在部门" name="RoutingAddress">
<t-input v-model="addData.department"></t-input>
</t-form-item>
<t-form-item label="助学金额" name="RoutingAddress">
<t-input v-model="addData.allowance"></t-input>
</t-form-item>
<t-form-item label="是否下款" name="RoutingAddress">
<t-input v-model="addData.loanTerm"></t-input>
</t-form-item>
<t-form-item label="申请时间" name="RoutingAddress">
<t-input v-model="addData.timeofapplication"></t-input>
</t-form-item>
</t-form>
</t-space>
</t-space>
</t-dialog>
</t-space>
</div>
</div>
</template>
<script setup>
import { ref, onMounted } from 'vue'
import {
APILoansList,
APILoansAdd
} from '@/api/receivables-management/management'
const data = ref([])
//
const formData = ref({
name: '',
studentnumber: ''
})
//
const loading = ref(false)
//
const columns = ref([
{ colKey: 'proposer', title: '申请人', width: '100' },
{ colKey: 'student', title: '学号', width: '100' },
{ colKey: 'department', title: '所在部门', width: '100' },
{ colKey: 'allowance', title: '助学金额', width: '100' },
{ colKey: 'loanTerm', title: '是否下款', width: '100' },
{ colKey: 'timeofapplication', title: '申请时间', width: '100' },
{ colKey: 'status', title: '操作', width: '100' }
])
//
const pagination = ref({
defaultCurrent: 1,
defaultPageSize: 10,
total: 30
})
//
const visible = ref(false)
//
const addData = ref({
proposer: '',
student: '',
department: '',
allowance: '',
loanTerm: '',
timeofapplication: ''
})
const handleRowClick = e => {
console.log(e)
}
//
const onPageChange = () => {
loading.value = true
const timerId = setTimeout(() => {
loading.value = false
clearInterval(timerId)
}, 300)
}
//
const LoansList = async () => {
const res = await APILoansList()
data.value = res.data.list
pagination.value.total = res.data.list.length
}
//
const onReset = () => {
LoansList()
}
//
const onSubmit = async () => {}
//
const onClick = context => {
console.log('点击了确认按钮,弹出弹窗', context)
visible.value = true
}
const onConfirmAnother = async context => {
console.log('点击了确认按钮', context)
await APILoansAdd(addData.value)
visible.value = false
}
const onCancel = context => {
console.log('点击了取消按钮', context)
}
const onCloseBtnClick = context => {
console.log('点击了关闭按钮', context)
}
onMounted(() => {
LoansList()
})
</script>
<style lang="less" scoped>
.search-form {
margin-bottom: 1.5rem;
background-color: #fff;
height: 4rem;
padding-top: 1rem;
}
</style>

View File

@ -1,44 +1,28 @@
<template> <template>
<div class="back-color"> <t-space direction="vertical">
<t-layout style="height: 90%; background-color: #f5f7fb"> <t-form ref="searchForm" @reset="onReset">
<t-header class="scarch-box">
<t-modal
v-model="isModalVisible"
@confirm="onSave"
@cancel="onModalCancel"
title="修改学生信息"
>
<t-form ref="searchForm" @reset="onReset" class="scarch-from">
<div style="margin-left: 1rem">
<t-form-item label="姓名" name="name"> <t-form-item label="姓名" name="name">
<t-input <t-input v-model="searchCriteria.name" placeholder="请输入姓名"></t-input>
v-model="searchCriteria.name"
placeholder="请输入姓名"
></t-input>
</t-form-item> </t-form-item>
</div>
<div style="margin-left: 1rem">
<t-form-item label="学号" name="studentId"> <t-form-item label="学号" name="studentId">
<t-input <t-input v-model="searchCriteria.studentId" placeholder="请输入学号"></t-input>
v-model="searchCriteria.studentId"
placeholder="请输入学号"
></t-input>
</t-form-item> </t-form-item>
</div> <t-form-item>
<t-form-item style="margin-right: 1rem">
<t-space size="10px"> <t-space size="10px">
<t-button theme="primary" type="submit" @click="onSearch" <t-button theme="primary" type="submit" @click="onSearch">查询</t-button>
>查询</t-button <t-button theme="default" variant="base" type="reset">重置</t-button>
>
<t-button theme="default" variant="base" type="reset"
>重置</t-button
>
</t-space> </t-space>
</t-form-item> </t-form-item>
</t-form> </t-form>
</t-modal>
</t-header> <t-space>
<t-content class="table-box"> <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>
<t-table <t-table
rowKey="studentId" rowKey="studentId"
:data="studentList" :data="studentList"
@ -52,142 +36,94 @@
:showHeader="showHeader" :showHeader="showHeader"
cellEmptyContent="-" cellEmptyContent="-"
resizable resizable
> ></t-table>
<template #operation="slotProps"> </t-space>
<t-button <!-- 动态操作列 -->
theme="default" <!-- <t-table-column label="操作">
variant="text" <template #default="{ row }">
size="small" <t-button-group>
@click="showEditModal(slotProps)" <t-button @click="handleLeave(row)">休学</t-button>
>修改</t-button <t-button @click="handleWithdraw(row)">退学</t-button>
> <t-button @click="handleReturn(row)">复学</t-button>
</t-button-group>
</template> </template>
</t-table> </t-table-column> -->
</t-content>
</t-layout>
</div>
</template> </template>
<script setup> <script setup>
import { ref, reactive, computed } from "vue"; import { ref, reactive, computed } from 'vue';
import { MessagePlugin } from "tdesign-vue-next"; import { MessagePlugin } from "tdesign-vue-next";
import { useRouter } from "vue-router"; import { useRouter } from "vue-router";
// import { reqStudent } from "@/api/students"; import { reqStudent } from "@/api/students";
import { APIStudent } from "@/api/students";
const isModalVisible = ref(false);
const editStudent = ref({});
//
const showEditModal = (student) => {
isModalVisible.value = true;
editStudent.value = Object.assign({}, student);
};
//
const onSave = () => {
// API updateStudent
updateStudent(editStudent.value).then(() => {
//
isModalVisible.value = false;
// studentList
});
};
//
const onModalCancel = () => {
isModalVisible.value = false;
editStudent.value = {};
};
const router = useRouter(); const router = useRouter();
const searchForm = ref(null); const searchForm = ref(null);
const initialStudentData = []; const initialStudentData = [];
const total = 28; const total = 28;
for (let i = 0; i < total; i++) { for (let i = 0; i < total; i++) {
let statusValue = ["休学", "退学", "复学"][i % 3];
initialStudentData.push({ initialStudentData.push({
Id: `${i + 1}`, studentId: `${'S'}${i + 1}`,
name: ["贾明", "张三", "王芳"][i % 3], name: ['贾明', '张三', '王芳'][i % 3],
gender: ["男", "女"][i % 2], gender: ['男', '女'][i % 2],
studentId: i + 1000000000, departmentCode: 'D' + (i % 4 + 1),
department: ["计算机科学系", "数学系", "物理系", "化学系"][i % 4], department: ['计算机科学系', '数学系', '物理系', '化学系'][i % 4],
major: ["计算机科学与技术", "数学", "物理学", "化学", "生物学", "经济学"][ className: 'C' + (i % 5 + 1),
i % 6 majorCode: 'M' + (i % 6 + 1),
], major: ['计算机科学与技术', '数学', '物理学', '化学', '生物学', '经济学'][i % 6],
classes: ["一班", "二班", "三班", "四班", "五班"][i % 5], classCode: 'C' + (i % 5 + 1),
status: statusValue, classes: ['一班', '二班', '三班', '四班', '五班'][i % 5],
}); });
} }
// //
const searchCriteria = reactive({ name: "", studentId: "" }); const searchCriteria = reactive({ name: '', studentId: '' });
// //
const studentList = computed(() => { const studentList = computed(() => {
return initialStudentData.filter( return initialStudentData.filter(student =>
(student) =>
(!searchCriteria.name || student.name.includes(searchCriteria.name)) && (!searchCriteria.name || student.name.includes(searchCriteria.name)) &&
(!searchCriteria.studentId || (!searchCriteria.studentId || student.studentId === searchCriteria.studentId)
student.studentId === searchCriteria.studentId)
); );
}); });
// //
const studentColumns = ref([ const studentColumns = ref([
{ {
colKey: "Id", colKey: 'studentId',
title: "序号", title: '学号',
}, },
{ {
colKey: "name", colKey: 'name',
title: "姓名", title: '姓名',
}, },
{ {
colKey: "gender", colKey: 'gender',
title: "性别", title: '性别',
}, },
{ {
colKey: "studentId", colKey: 'department',
title: "学号", title: '系院',
}, },
{ {
colKey: "department", colKey: 'major',
title: "系院", title: '专业',
}, },
{ {
colKey: "major", colKey: 'classes',
title: "专业", title: '班级',
},
{
colKey: "classes",
title: "班级",
},
{
colKey: "status",
title: "状态",
formatter: (value) => {
switch (value) {
case "休学":
return "休学";
case "退学":
return "退学";
case "复学":
return "复学";
default:
return "-";
}
},
},
{
colKey: "operation",
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({ const pagination = reactive({
defaultCurrent: 1, defaultCurrent: 1,
defaultPageSize: 10, defaultPageSize: 5,
total: initialStudentData.length, total: initialStudentData.length,
}); });
@ -197,36 +133,14 @@ const onSearch = () => {
}; };
const onReset = () => { const onReset = () => {
searchCriteria.name = ""; searchCriteria.name = '';
searchCriteria.studentId = ""; searchCriteria.studentId = '';
pagination.defaultCurrent = 1; pagination.defaultCurrent = 1;
MessagePlugin.success("重置成功"); MessagePlugin.success("重置成功");
}; };
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>
.scarch-box {
width: 100%;
background-color: @base-white-color;
margin-bottom: 2rem;
.scarch-from {
height: 3.75rem;
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;
}
}
</style> </style>

View File

@ -25,12 +25,6 @@ const ReceivablesManagement = [
name: "BillBill", name: "BillBill",
component: () => import("@/pages/receivables-management/Bill.vue"), component: () => import("@/pages/receivables-management/Bill.vue"),
meta: { title: "票据", hidden: false }, meta: { title: "票据", hidden: false },
},
{
path: "/student-loan",
name: "StudentLoan",
component: () => import("@/pages/receivables-management/studentLoan.vue"),
meta: { title: "助学贷款", },
} }
], ],
}, },