准备验证
This commit is contained in:
371
src/views/stuwork/tuitionfreestu/apply.vue
Normal file
371
src/views/stuwork/tuitionfreestu/apply.vue
Normal file
@@ -0,0 +1,371 @@
|
||||
<template>
|
||||
<div class="layout-padding">
|
||||
<div class="layout-padding-auto layout-padding-view">
|
||||
<!-- 搜索表单 -->
|
||||
<el-row v-show="showSearch">
|
||||
<el-form :model="state.queryForm" ref="searchFormRef" :inline="true" @keyup.enter="getDataList">
|
||||
<el-form-item label="班级" prop="classCode">
|
||||
<el-select
|
||||
v-model="state.queryForm.classCode"
|
||||
placeholder="请选择班级"
|
||||
clearable
|
||||
filterable
|
||||
style="width: 200px">
|
||||
<el-option
|
||||
v-for="item in classList"
|
||||
:key="item.classCode"
|
||||
:label="item.classNo"
|
||||
:value="item.classCode">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" plain icon="Search" @click="getDataList">查询</el-button>
|
||||
<el-button icon="Refresh" @click="handleReset">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-row>
|
||||
|
||||
<!-- 操作按钮 -->
|
||||
<el-row>
|
||||
<div class="mb8" style="width: 100%">
|
||||
<el-button
|
||||
icon="Document"
|
||||
type="primary"
|
||||
class="ml10"
|
||||
:disabled="selectedRows.length === 0"
|
||||
@click="handleApply">
|
||||
申请免学费
|
||||
</el-button>
|
||||
<right-toolbar
|
||||
v-model:showSearch="showSearch"
|
||||
class="ml10 mr20"
|
||||
style="float: right;"
|
||||
@queryTable="getDataList">
|
||||
</right-toolbar>
|
||||
</div>
|
||||
</el-row>
|
||||
|
||||
<!-- 表格 -->
|
||||
<el-table
|
||||
:data="state.dataList"
|
||||
v-loading="state.loading"
|
||||
border
|
||||
:cell-style="tableStyle.cellStyle"
|
||||
:header-cell-style="tableStyle.headerCellStyle"
|
||||
@selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column type="index" label="序号" width="60" align="center" />
|
||||
<el-table-column prop="deptName" label="学院" show-overflow-tooltip align="center" min-width="150" />
|
||||
<el-table-column prop="classNo" label="班级" show-overflow-tooltip align="center" width="120" />
|
||||
<el-table-column prop="majorName" label="专业" show-overflow-tooltip align="center" min-width="150" />
|
||||
<el-table-column prop="stuNo" label="学号" show-overflow-tooltip align="center" width="120" />
|
||||
<el-table-column prop="realName" label="姓名" show-overflow-tooltip align="center" width="100" />
|
||||
<el-table-column prop="gender" label="性别" show-overflow-tooltip align="center" width="80">
|
||||
<template #default="scope">
|
||||
<span>{{ formatGender(scope.row.gender) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="idCard" label="身份证号" show-overflow-tooltip align="center" min-width="180" />
|
||||
<el-table-column prop="bankCard" label="中职卡号" show-overflow-tooltip align="center" width="150" />
|
||||
<el-table-column prop="phone" label="联系方式" show-overflow-tooltip align="center" width="120" />
|
||||
<el-table-column prop="education" label="生源" show-overflow-tooltip align="center" width="100">
|
||||
<template #default="scope">
|
||||
<span>{{ formatEducation(scope.row.education) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="majorLevel" label="层次" show-overflow-tooltip align="center" width="100">
|
||||
<template #default="scope">
|
||||
<span>{{ formatMajorLevel(scope.row.majorLevel) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="grade" label="入学年份" show-overflow-tooltip align="center" width="100" />
|
||||
<el-table-column prop="gradeCurr" label="当前年纪" show-overflow-tooltip align="center" width="100" />
|
||||
<el-table-column prop="temporaryyeYear" label="借读学年" show-overflow-tooltip align="center" width="120" />
|
||||
</el-table>
|
||||
|
||||
<!-- 分页 -->
|
||||
<pagination
|
||||
@size-change="sizeChangeHandle"
|
||||
@current-change="currentChangeHandle"
|
||||
v-bind="state.pagination" />
|
||||
</div>
|
||||
|
||||
<!-- 申请免学费弹窗 -->
|
||||
<el-dialog
|
||||
title="申请免学费"
|
||||
v-model="applyDialogVisible"
|
||||
:width="500"
|
||||
:close-on-click-modal="false"
|
||||
draggable>
|
||||
<el-form
|
||||
ref="applyFormRef"
|
||||
:model="applyForm"
|
||||
:rules="applyRules"
|
||||
label-width="120px">
|
||||
<el-form-item label="批次" prop="termId">
|
||||
<el-select
|
||||
v-model="applyForm.termId"
|
||||
placeholder="请选择批次"
|
||||
clearable
|
||||
filterable
|
||||
style="width: 100%">
|
||||
<el-option
|
||||
v-for="item in termList"
|
||||
:key="item.id"
|
||||
:label="item.title"
|
||||
:value="item.id">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<span class="dialog-footer">
|
||||
<el-button @click="applyDialogVisible = false">取 消</el-button>
|
||||
<el-button type="primary" @click="handleSubmit" :disabled="applyLoading">确 认</el-button>
|
||||
</span>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts" name="TuitionFreeStuApply">
|
||||
import { reactive, ref, onMounted } from 'vue'
|
||||
import { BasicTableProps, useTable } from "/@/hooks/table";
|
||||
import { fetchList, applyObj } from "/@/api/stuwork/tuitionfreestuapply";
|
||||
import { getClassListByRole } from "/@/api/basic/basicclass";
|
||||
import { getDicts } from "/@/api/admin/dict";
|
||||
import { useMessage, useMessageBox } from "/@/hooks/message";
|
||||
import request from '/@/utils/request'
|
||||
|
||||
// 定义变量内容
|
||||
const searchFormRef = ref()
|
||||
const applyFormRef = ref()
|
||||
const showSearch = ref(true)
|
||||
const classList = ref<any[]>([])
|
||||
const termList = ref<any[]>([])
|
||||
const genderList = ref<any[]>([])
|
||||
const educationList = ref<any[]>([])
|
||||
const majorLevelList = ref<any[]>([])
|
||||
const selectedRows = ref<any[]>([])
|
||||
const applyDialogVisible = ref(false)
|
||||
const applyLoading = ref(false)
|
||||
|
||||
// 表格样式
|
||||
const tableStyle = {
|
||||
cellStyle: { padding: '8px 0' },
|
||||
headerCellStyle: { background: '#f5f7fa', color: '#606266', fontWeight: 'bold' }
|
||||
}
|
||||
|
||||
// 申请表单
|
||||
const applyForm = reactive({
|
||||
termId: ''
|
||||
})
|
||||
|
||||
// 申请表单验证规则
|
||||
const applyRules = {
|
||||
termId: [
|
||||
{ required: true, message: '请选择批次', trigger: 'change' }
|
||||
]
|
||||
}
|
||||
|
||||
// 配置 useTable
|
||||
const state: BasicTableProps = reactive<BasicTableProps>({
|
||||
queryForm: {
|
||||
classCode: ''
|
||||
},
|
||||
pageList: fetchList,
|
||||
props: {
|
||||
item: 'records',
|
||||
totalCount: 'total'
|
||||
},
|
||||
createdIsNeed: true
|
||||
})
|
||||
|
||||
// table hook
|
||||
const {
|
||||
getDataList,
|
||||
currentChangeHandle,
|
||||
sizeChangeHandle,
|
||||
tableStyle: _tableStyle
|
||||
} = useTable(state)
|
||||
|
||||
// 格式化性别
|
||||
const formatGender = (value: string | number) => {
|
||||
if (value === null || value === undefined || value === '') {
|
||||
return '-'
|
||||
}
|
||||
const dictItem = genderList.value.find(item => item.value == value)
|
||||
return dictItem ? dictItem.label : value
|
||||
}
|
||||
|
||||
// 格式化生源
|
||||
const formatEducation = (value: string | number) => {
|
||||
if (value === null || value === undefined || value === '') {
|
||||
return '-'
|
||||
}
|
||||
const dictItem = educationList.value.find(item => item.value == value)
|
||||
return dictItem ? dictItem.label : value
|
||||
}
|
||||
|
||||
// 格式化层次
|
||||
const formatMajorLevel = (value: string | number) => {
|
||||
if (value === null || value === undefined || value === '') {
|
||||
return '-'
|
||||
}
|
||||
const dictItem = majorLevelList.value.find(item => item.value == value)
|
||||
return dictItem ? dictItem.label : value
|
||||
}
|
||||
|
||||
// 表格选择变化
|
||||
const handleSelectionChange = (selection: any[]) => {
|
||||
selectedRows.value = selection
|
||||
}
|
||||
|
||||
// 重置
|
||||
const handleReset = () => {
|
||||
searchFormRef.value?.resetFields()
|
||||
state.queryForm.classCode = ''
|
||||
getDataList()
|
||||
}
|
||||
|
||||
// 申请免学费
|
||||
const handleApply = () => {
|
||||
if (selectedRows.value.length === 0) {
|
||||
useMessage().warning('请至少选择一名学生')
|
||||
return
|
||||
}
|
||||
applyDialogVisible.value = true
|
||||
applyForm.termId = ''
|
||||
}
|
||||
|
||||
// 提交申请
|
||||
const handleSubmit = async () => {
|
||||
if (!applyFormRef.value) return
|
||||
|
||||
await applyFormRef.value.validate(async (valid: boolean) => {
|
||||
if (valid) {
|
||||
applyLoading.value = true
|
||||
try {
|
||||
const { confirm } = useMessageBox()
|
||||
await confirm(`确定要为选中的 ${selectedRows.value.length} 名学生申请免学费吗?`)
|
||||
|
||||
const studentIds = selectedRows.value.map((row: any) => row.id || row.stuNo)
|
||||
await applyObj({
|
||||
termId: applyForm.termId,
|
||||
studentIds: studentIds
|
||||
})
|
||||
useMessage().success('申请成功')
|
||||
applyDialogVisible.value = false
|
||||
selectedRows.value = []
|
||||
getDataList()
|
||||
} catch (err: any) {
|
||||
if (err !== 'cancel') {
|
||||
useMessage().error(err.msg || '申请失败')
|
||||
}
|
||||
} finally {
|
||||
applyLoading.value = false
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// 获取批次列表
|
||||
const getTermList = async () => {
|
||||
try {
|
||||
const res = await request({
|
||||
url: '/stuwork/tuitionfreeterm/list',
|
||||
method: 'get'
|
||||
})
|
||||
if (res.data && Array.isArray(res.data)) {
|
||||
termList.value = res.data
|
||||
} else {
|
||||
termList.value = []
|
||||
}
|
||||
} catch (err) {
|
||||
console.error('获取批次列表失败', err)
|
||||
termList.value = []
|
||||
}
|
||||
}
|
||||
|
||||
// 获取班级列表
|
||||
const getClassListData = async () => {
|
||||
try {
|
||||
const res = await getClassListByRole()
|
||||
if (res.data && Array.isArray(res.data)) {
|
||||
classList.value = res.data
|
||||
} else {
|
||||
classList.value = []
|
||||
}
|
||||
} catch (err) {
|
||||
console.error('获取班级列表失败', err)
|
||||
classList.value = []
|
||||
}
|
||||
}
|
||||
|
||||
// 获取性别字典
|
||||
const getGenderDict = async () => {
|
||||
try {
|
||||
const res = await getDicts('sexy')
|
||||
if (res.data && Array.isArray(res.data)) {
|
||||
genderList.value = res.data.map((item: any) => ({
|
||||
label: item.label || item.dictLabel || item.name,
|
||||
value: item.value || item.dictValue || item.code
|
||||
}))
|
||||
} else {
|
||||
genderList.value = []
|
||||
}
|
||||
} catch (err) {
|
||||
console.error('获取性别字典失败', err)
|
||||
genderList.value = []
|
||||
}
|
||||
}
|
||||
|
||||
// 获取生源字典
|
||||
const getEducationDict = async () => {
|
||||
try {
|
||||
const res = await getDicts('pre_school_education')
|
||||
if (res.data && Array.isArray(res.data)) {
|
||||
educationList.value = res.data.map((item: any) => ({
|
||||
label: item.label || item.dictLabel || item.name,
|
||||
value: item.value || item.dictValue || item.code
|
||||
}))
|
||||
} else {
|
||||
educationList.value = []
|
||||
}
|
||||
} catch (err) {
|
||||
console.error('获取生源字典失败', err)
|
||||
educationList.value = []
|
||||
}
|
||||
}
|
||||
|
||||
// 获取层次字典
|
||||
const getMajorLevelDict = async () => {
|
||||
try {
|
||||
const res = await getDicts('basic_major_level')
|
||||
if (res.data && Array.isArray(res.data)) {
|
||||
majorLevelList.value = res.data.map((item: any) => ({
|
||||
label: item.label || item.dictLabel || item.name,
|
||||
value: item.value || item.dictValue || item.code
|
||||
}))
|
||||
} else {
|
||||
majorLevelList.value = []
|
||||
}
|
||||
} catch (err) {
|
||||
console.error('获取层次字典失败', err)
|
||||
majorLevelList.value = []
|
||||
}
|
||||
}
|
||||
|
||||
// 初始化
|
||||
onMounted(() => {
|
||||
getTermList()
|
||||
getClassListData()
|
||||
getGenderDict()
|
||||
getEducationDict()
|
||||
getMajorLevelDict()
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
</style>
|
||||
306
src/views/stuwork/tuitionfreestu/approve.vue
Normal file
306
src/views/stuwork/tuitionfreestu/approve.vue
Normal file
@@ -0,0 +1,306 @@
|
||||
<template>
|
||||
<div class="layout-padding">
|
||||
<div class="layout-padding-auto layout-padding-view">
|
||||
<!-- 搜索表单 -->
|
||||
<el-row v-show="showSearch">
|
||||
<el-form :model="state.queryForm" ref="searchFormRef" :inline="true" @keyup.enter="getDataList">
|
||||
<el-form-item label="批次" prop="termId">
|
||||
<el-select
|
||||
v-model="state.queryForm.termId"
|
||||
placeholder="请选择批次"
|
||||
clearable
|
||||
filterable
|
||||
style="width: 200px">
|
||||
<el-option
|
||||
v-for="item in termList"
|
||||
:key="item.id"
|
||||
:label="item.title"
|
||||
:value="item.id">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="学院" prop="deptCode">
|
||||
<el-select
|
||||
v-model="state.queryForm.deptCode"
|
||||
placeholder="请选择学院"
|
||||
clearable
|
||||
filterable
|
||||
style="width: 200px">
|
||||
<el-option
|
||||
v-for="item in deptList"
|
||||
:key="item.deptCode"
|
||||
:label="item.deptName"
|
||||
:value="item.deptCode">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="班级" prop="classCode">
|
||||
<el-select
|
||||
v-model="state.queryForm.classCode"
|
||||
placeholder="请选择班级"
|
||||
clearable
|
||||
filterable
|
||||
style="width: 200px">
|
||||
<el-option
|
||||
v-for="item in classList"
|
||||
:key="item.classCode"
|
||||
:label="item.classNo"
|
||||
:value="item.classCode">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" plain icon="Search" @click="getDataList">查询</el-button>
|
||||
<el-button icon="Refresh" @click="handleReset">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-row>
|
||||
|
||||
<!-- Tab切换 -->
|
||||
<el-row>
|
||||
<div class="mb8" style="width: 100%">
|
||||
<el-tabs v-model="activeTab" @tab-change="handleTabChange">
|
||||
<el-tab-pane label="免学费审批" name="pending"></el-tab-pane>
|
||||
<el-tab-pane label="已审批" name="approved"></el-tab-pane>
|
||||
</el-tabs>
|
||||
<right-toolbar
|
||||
v-model:showSearch="showSearch"
|
||||
class="ml10 mr20"
|
||||
style="float: right;"
|
||||
@queryTable="getDataList">
|
||||
</right-toolbar>
|
||||
</div>
|
||||
</el-row>
|
||||
|
||||
<!-- 免学费审批表格 -->
|
||||
<el-table
|
||||
v-if="activeTab === 'pending'"
|
||||
:data="state.dataList"
|
||||
v-loading="state.loading"
|
||||
border
|
||||
:cell-style="tableStyle.cellStyle"
|
||||
:header-cell-style="tableStyle.headerCellStyle">
|
||||
<el-table-column type="index" label="序号" width="60" align="center" />
|
||||
<el-table-column prop="termTitle" label="免学费批次" show-overflow-tooltip align="center" min-width="150" />
|
||||
<el-table-column prop="deptName" label="学院" show-overflow-tooltip align="center" min-width="150" />
|
||||
<el-table-column prop="majorName" label="专业名称" show-overflow-tooltip align="center" min-width="150" />
|
||||
<el-table-column prop="classNo" label="班号" show-overflow-tooltip align="center" width="120" />
|
||||
<el-table-column prop="teacherName" label="班主任" show-overflow-tooltip align="center" width="100" />
|
||||
<el-table-column prop="num" label="人数" show-overflow-tooltip align="center" width="80">
|
||||
<template #default="scope">
|
||||
<span>{{ scope.row.num !== undefined && scope.row.num !== null ? scope.row.num : '-' }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" width="120" align="center" fixed="right">
|
||||
<template #default="scope">
|
||||
<el-button
|
||||
icon="View"
|
||||
text
|
||||
type="primary"
|
||||
@click="handleViewDetail(scope.row)">
|
||||
查看详情
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<!-- 已审批表格(带合计) -->
|
||||
<el-table
|
||||
v-if="activeTab === 'approved'"
|
||||
:data="state.dataList"
|
||||
v-loading="state.loading"
|
||||
border
|
||||
:cell-style="tableStyle.cellStyle"
|
||||
:header-cell-style="tableStyle.headerCellStyle"
|
||||
show-summary
|
||||
:summary-method="getSummaries">
|
||||
<el-table-column type="index" label="序号" width="60" align="center" />
|
||||
<el-table-column prop="termTitle" label="免学费批次" show-overflow-tooltip align="center" min-width="150" />
|
||||
<el-table-column prop="deptName" label="学院" show-overflow-tooltip align="center" min-width="150" />
|
||||
<el-table-column prop="classNum" label="申报班级数" show-overflow-tooltip align="center" width="120">
|
||||
<template #default="scope">
|
||||
<span>{{ scope.row.classNum !== undefined && scope.row.classNum !== null ? scope.row.classNum : '-' }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="stuNum" label="申报人数" show-overflow-tooltip align="center" width="120">
|
||||
<template #default="scope">
|
||||
<span>{{ scope.row.stuNum !== undefined && scope.row.stuNum !== null ? scope.row.stuNum : '-' }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" width="120" align="center" fixed="right">
|
||||
<template #default="scope">
|
||||
<el-button
|
||||
icon="View"
|
||||
text
|
||||
type="primary"
|
||||
@click="handleViewDetail(scope.row)">
|
||||
查看详情
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<!-- 分页 -->
|
||||
<pagination
|
||||
@size-change="sizeChangeHandle"
|
||||
@current-change="currentChangeHandle"
|
||||
v-bind="state.pagination" />
|
||||
</div>
|
||||
|
||||
<!-- 查看详情弹窗 -->
|
||||
<detail-dialog ref="detailDialogRef" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts" name="TuitionFreeStuApprove">
|
||||
import { reactive, ref, onMounted } from 'vue'
|
||||
import { BasicTableProps, useTable } from "/@/hooks/table";
|
||||
import { getApproveData, getApprovedData } from "/@/api/stuwork/tuitionfreestuapprove";
|
||||
import { getDeptList } from "/@/api/basic/basicclass";
|
||||
import { getClassListByRole } from "/@/api/basic/basicclass";
|
||||
import request from '/@/utils/request'
|
||||
import DetailDialog from './detail.vue'
|
||||
|
||||
// 定义变量内容
|
||||
const searchFormRef = ref()
|
||||
const detailDialogRef = ref()
|
||||
const showSearch = ref(true)
|
||||
const activeTab = ref('pending')
|
||||
const termList = ref<any[]>([])
|
||||
const deptList = ref<any[]>([])
|
||||
const classList = ref<any[]>([])
|
||||
|
||||
// 表格样式
|
||||
const tableStyle = {
|
||||
cellStyle: { padding: '8px 0' },
|
||||
headerCellStyle: { background: '#f5f7fa', color: '#606266', fontWeight: 'bold' }
|
||||
}
|
||||
|
||||
// 配置 useTable
|
||||
const state: BasicTableProps = reactive<BasicTableProps>({
|
||||
queryForm: {
|
||||
termId: '',
|
||||
deptCode: '',
|
||||
classCode: ''
|
||||
},
|
||||
pageList: getApproveData,
|
||||
props: {
|
||||
item: 'records',
|
||||
totalCount: 'total'
|
||||
},
|
||||
createdIsNeed: true
|
||||
})
|
||||
|
||||
// table hook
|
||||
const {
|
||||
getDataList,
|
||||
currentChangeHandle,
|
||||
sizeChangeHandle,
|
||||
tableStyle: _tableStyle
|
||||
} = useTable(state)
|
||||
|
||||
// Tab切换
|
||||
const handleTabChange = (tabName: string) => {
|
||||
if (tabName === 'pending') {
|
||||
state.pageList = getApproveData
|
||||
} else {
|
||||
state.pageList = getApprovedData
|
||||
}
|
||||
getDataList()
|
||||
}
|
||||
|
||||
// 合计方法(仅用于已审批表格)
|
||||
const getSummaries = (param: any) => {
|
||||
const { columns, data } = param
|
||||
const sums: any[] = []
|
||||
columns.forEach((column: any, index: number) => {
|
||||
if (index === 0) {
|
||||
sums[index] = '合计'
|
||||
return
|
||||
}
|
||||
if (column.property === 'classNum' || column.property === 'stuNum') {
|
||||
const values = data.map((item: any) => Number(item[column.property] || 0))
|
||||
const sum = values.reduce((prev: number, curr: number) => {
|
||||
return prev + curr
|
||||
}, 0)
|
||||
sums[index] = sum
|
||||
} else {
|
||||
sums[index] = ''
|
||||
}
|
||||
})
|
||||
return sums
|
||||
}
|
||||
|
||||
// 重置
|
||||
const handleReset = () => {
|
||||
searchFormRef.value?.resetFields()
|
||||
state.queryForm.termId = ''
|
||||
state.queryForm.deptCode = ''
|
||||
state.queryForm.classCode = ''
|
||||
getDataList()
|
||||
}
|
||||
|
||||
// 查看详情
|
||||
const handleViewDetail = (row: any) => {
|
||||
detailDialogRef.value?.openDialog(row)
|
||||
}
|
||||
|
||||
// 获取批次列表
|
||||
const getTermList = async () => {
|
||||
try {
|
||||
const res = await request({
|
||||
url: '/stuwork/tuitionfreeterm/list',
|
||||
method: 'get'
|
||||
})
|
||||
if (res.data && Array.isArray(res.data)) {
|
||||
termList.value = res.data
|
||||
} else {
|
||||
termList.value = []
|
||||
}
|
||||
} catch (err) {
|
||||
console.error('获取批次列表失败', err)
|
||||
termList.value = []
|
||||
}
|
||||
}
|
||||
|
||||
// 获取学院列表
|
||||
const getDeptListData = async () => {
|
||||
try {
|
||||
const res = await getDeptList()
|
||||
if (res.data && Array.isArray(res.data)) {
|
||||
deptList.value = res.data
|
||||
} else {
|
||||
deptList.value = []
|
||||
}
|
||||
} catch (err) {
|
||||
console.error('获取学院列表失败', err)
|
||||
deptList.value = []
|
||||
}
|
||||
}
|
||||
|
||||
// 获取班级列表
|
||||
const getClassListData = async () => {
|
||||
try {
|
||||
const res = await getClassListByRole()
|
||||
if (res.data && Array.isArray(res.data)) {
|
||||
classList.value = res.data
|
||||
} else {
|
||||
classList.value = []
|
||||
}
|
||||
} catch (err) {
|
||||
console.error('获取班级列表失败', err)
|
||||
classList.value = []
|
||||
}
|
||||
}
|
||||
|
||||
// 初始化
|
||||
onMounted(() => {
|
||||
getTermList()
|
||||
getDeptListData()
|
||||
getClassListData()
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
</style>
|
||||
|
||||
70
src/views/stuwork/tuitionfreestu/detail.vue
Normal file
70
src/views/stuwork/tuitionfreestu/detail.vue
Normal file
@@ -0,0 +1,70 @@
|
||||
<template>
|
||||
<el-dialog
|
||||
title="查看详情"
|
||||
v-model="visible"
|
||||
:close-on-click-modal="false"
|
||||
draggable
|
||||
width="800px">
|
||||
<div v-loading="loading" class="detail-container" v-if="detailData">
|
||||
<el-descriptions :column="2" border>
|
||||
<el-descriptions-item label="免学费批次" :span="2">
|
||||
{{ detailData.termTitle || '-' }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="学院">
|
||||
{{ detailData.deptName || '-' }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="专业名称">
|
||||
{{ detailData.majorName || '-' }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="班号">
|
||||
{{ detailData.classNo || '-' }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="班主任">
|
||||
{{ detailData.teacherName || '-' }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="人数" v-if="detailData.num !== undefined">
|
||||
{{ detailData.num !== null ? detailData.num : '-' }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="申报班级数" v-if="detailData.classNum !== undefined">
|
||||
{{ detailData.classNum !== null ? detailData.classNum : '-' }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="申报人数" v-if="detailData.stuNum !== undefined">
|
||||
{{ detailData.stuNum !== null ? detailData.stuNum : '-' }}
|
||||
</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
</div>
|
||||
<template #footer>
|
||||
<span class="dialog-footer">
|
||||
<el-button @click="visible = false">关 闭</el-button>
|
||||
</span>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts" name="TuitionFreeStuApproveDetailDialog">
|
||||
import { ref } from 'vue'
|
||||
|
||||
// 定义变量内容
|
||||
const visible = ref(false)
|
||||
const loading = ref(false)
|
||||
const detailData = ref<any>({})
|
||||
|
||||
// 打开弹窗
|
||||
const openDialog = async (row: any) => {
|
||||
visible.value = true
|
||||
loading.value = false
|
||||
detailData.value = row || {}
|
||||
}
|
||||
|
||||
// 暴露方法
|
||||
defineExpose({
|
||||
openDialog
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.detail-container {
|
||||
padding: 20px 0;
|
||||
}
|
||||
</style>
|
||||
|
||||
492
src/views/stuwork/tuitionfreestu/index.vue
Normal file
492
src/views/stuwork/tuitionfreestu/index.vue
Normal file
@@ -0,0 +1,492 @@
|
||||
<template>
|
||||
<div class="layout-padding">
|
||||
<div class="layout-padding-auto layout-padding-view">
|
||||
<!-- 搜索表单 -->
|
||||
<el-row v-show="showSearch">
|
||||
<el-form :model="state.queryForm" ref="searchFormRef" :inline="true" @keyup.enter="getDataList">
|
||||
<el-form-item label="批次" prop="termId">
|
||||
<el-select
|
||||
v-model="state.queryForm.termId"
|
||||
placeholder="请选择批次"
|
||||
clearable
|
||||
filterable
|
||||
style="width: 200px">
|
||||
<el-option
|
||||
v-for="item in termList"
|
||||
:key="item.id"
|
||||
:label="item.title"
|
||||
:value="item.id">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="学院" prop="deptCode">
|
||||
<el-select
|
||||
v-model="state.queryForm.deptCode"
|
||||
placeholder="请选择学院"
|
||||
clearable
|
||||
filterable
|
||||
style="width: 200px">
|
||||
<el-option
|
||||
v-for="item in deptList"
|
||||
:key="item.deptCode"
|
||||
:label="item.deptName"
|
||||
:value="item.deptCode">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="入学年份" prop="grade">
|
||||
<el-select
|
||||
v-model="state.queryForm.grade"
|
||||
placeholder="请选择入学年份"
|
||||
clearable
|
||||
filterable
|
||||
style="width: 200px">
|
||||
<el-option
|
||||
v-for="item in gradeList"
|
||||
:key="item.year"
|
||||
:label="item.year"
|
||||
:value="item.year">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="年纪" prop="gradeCurr">
|
||||
<el-input-number
|
||||
v-model="state.queryForm.gradeCurr"
|
||||
placeholder="请输入年纪"
|
||||
:min="1"
|
||||
:max="10"
|
||||
clearable
|
||||
style="width: 200px" />
|
||||
</el-form-item>
|
||||
<el-form-item label="班级" prop="classCode">
|
||||
<el-select
|
||||
v-model="state.queryForm.classCode"
|
||||
placeholder="请选择班级"
|
||||
clearable
|
||||
filterable
|
||||
style="width: 200px">
|
||||
<el-option
|
||||
v-for="item in classList"
|
||||
:key="item.classCode"
|
||||
:label="item.classNo"
|
||||
:value="item.classCode">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="审核状态" prop="checkStatus">
|
||||
<el-select
|
||||
v-model="state.queryForm.checkStatus"
|
||||
placeholder="请选择审核状态"
|
||||
clearable
|
||||
style="width: 200px">
|
||||
<el-option
|
||||
v-for="item in checkStatusList"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" plain icon="Search" @click="getDataList">查询</el-button>
|
||||
<el-button icon="Refresh" @click="handleReset">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-row>
|
||||
|
||||
<!-- 操作按钮 -->
|
||||
<el-row>
|
||||
<div class="mb8" style="width: 100%">
|
||||
<el-button
|
||||
icon="Plus"
|
||||
type="primary"
|
||||
class="ml10"
|
||||
@click="handleAdd">
|
||||
新增
|
||||
</el-button>
|
||||
<el-button
|
||||
icon="Download"
|
||||
type="primary"
|
||||
plain
|
||||
class="ml10"
|
||||
:loading="exportLoading"
|
||||
@click="handleExport">
|
||||
导出
|
||||
</el-button>
|
||||
<right-toolbar
|
||||
v-model:showSearch="showSearch"
|
||||
class="ml10 mr20"
|
||||
style="float: right;"
|
||||
@queryTable="getDataList">
|
||||
</right-toolbar>
|
||||
</div>
|
||||
</el-row>
|
||||
|
||||
<!-- 表格 -->
|
||||
<el-table
|
||||
:data="state.dataList"
|
||||
v-loading="state.loading"
|
||||
border
|
||||
:cell-style="tableStyle.cellStyle"
|
||||
:header-cell-style="tableStyle.headerCellStyle">
|
||||
<el-table-column type="index" label="序号" width="60" align="center" />
|
||||
<el-table-column prop="deptName" label="学院" show-overflow-tooltip align="center" min-width="150" />
|
||||
<el-table-column prop="majorName" label="专业" show-overflow-tooltip align="center" min-width="150" />
|
||||
<el-table-column prop="teacherName" label="班主任" show-overflow-tooltip align="center" width="100" />
|
||||
<el-table-column prop="grade" label="入学年份" show-overflow-tooltip align="center" width="100" />
|
||||
<el-table-column prop="gradeCurr" label="年级" show-overflow-tooltip align="center" width="80">
|
||||
<template #default="scope">
|
||||
<span>{{ scope.row.gradeCurr !== undefined && scope.row.gradeCurr !== null ? scope.row.gradeCurr : '-' }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="classNo" label="班级" show-overflow-tooltip align="center" width="120" />
|
||||
<el-table-column prop="stuNo" label="学号" show-overflow-tooltip align="center" width="120" />
|
||||
<el-table-column prop="realName" label="姓名" show-overflow-tooltip align="center" width="100" />
|
||||
<el-table-column prop="gender" label="性别" show-overflow-tooltip align="center" width="80">
|
||||
<template #default="scope">
|
||||
<span>{{ formatGender(scope.row.gender) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="education" label="生源" show-overflow-tooltip align="center" width="100">
|
||||
<template #default="scope">
|
||||
<span>{{ formatEducation(scope.row.education) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="majorLevel" label="层次" show-overflow-tooltip align="center" width="100">
|
||||
<template #default="scope">
|
||||
<span>{{ formatMajorLevel(scope.row.majorLevel) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="phone" label="联系电话" show-overflow-tooltip align="center" width="120" />
|
||||
<el-table-column prop="money" label="金额" show-overflow-tooltip align="center" width="100">
|
||||
<template #default="scope">
|
||||
<span>{{ scope.row.money !== undefined && scope.row.money !== null ? scope.row.money : '-' }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="checkStatus" label="审核状态" show-overflow-tooltip align="center" width="100">
|
||||
<template #default="scope">
|
||||
<span>{{ formatCheckStatus(scope.row.checkStatus) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" width="150" align="center" fixed="right">
|
||||
<template #default="scope">
|
||||
<el-button
|
||||
icon="Edit"
|
||||
text
|
||||
type="primary"
|
||||
@click="handleEdit(scope.row)">
|
||||
编辑
|
||||
</el-button>
|
||||
<el-button
|
||||
icon="Delete"
|
||||
text
|
||||
type="danger"
|
||||
@click="handleDelete(scope.row)">
|
||||
删除
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<!-- 分页 -->
|
||||
<pagination
|
||||
@size-change="sizeChangeHandle"
|
||||
@current-change="currentChangeHandle"
|
||||
v-bind="state.pagination" />
|
||||
</div>
|
||||
|
||||
<!-- 新增/编辑表单弹窗 -->
|
||||
<!-- <form-dialog ref="formDialogRef" @refresh="getDataList" /> -->
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts" name="TuitionFreeStu">
|
||||
import { reactive, ref, onMounted } from 'vue'
|
||||
import { BasicTableProps, useTable } from "/@/hooks/table";
|
||||
import { fetchList, exportExcel, delObj, getDetail } from "/@/api/stuwork/tuitionfreestu";
|
||||
import { getDeptList } from "/@/api/basic/basicclass";
|
||||
import { getClassListByRole } from "/@/api/basic/basicclass";
|
||||
import { getDicts } from "/@/api/admin/dict";
|
||||
import { queryAllSchoolYear } from "/@/api/basic/basicyear";
|
||||
import { useMessage, useMessageBox } from "/@/hooks/message";
|
||||
import request from '/@/utils/request'
|
||||
import axios from 'axios'
|
||||
|
||||
// 定义变量内容
|
||||
const searchFormRef = ref()
|
||||
const formDialogRef = ref()
|
||||
const showSearch = ref(true)
|
||||
const exportLoading = ref(false)
|
||||
const termList = ref<any[]>([])
|
||||
const deptList = ref<any[]>([])
|
||||
const classList = ref<any[]>([])
|
||||
const gradeList = ref<any[]>([])
|
||||
const genderList = ref<any[]>([])
|
||||
const educationList = ref<any[]>([])
|
||||
const majorLevelList = ref<any[]>([])
|
||||
const checkStatusList = ref<any[]>([
|
||||
{ label: '待审核', value: '0' },
|
||||
{ label: '审核通过', value: '1' }
|
||||
])
|
||||
|
||||
// 表格样式
|
||||
const tableStyle = {
|
||||
cellStyle: { padding: '8px 0' },
|
||||
headerCellStyle: { background: '#f5f7fa', color: '#606266', fontWeight: 'bold' }
|
||||
}
|
||||
|
||||
// 配置 useTable
|
||||
const state: BasicTableProps = reactive<BasicTableProps>({
|
||||
queryForm: {
|
||||
termId: '',
|
||||
deptCode: '',
|
||||
grade: '',
|
||||
gradeCurr: undefined,
|
||||
classCode: '',
|
||||
checkStatus: ''
|
||||
},
|
||||
pageList: fetchList,
|
||||
props: {
|
||||
item: 'records',
|
||||
totalCount: 'total'
|
||||
},
|
||||
createdIsNeed: true
|
||||
})
|
||||
|
||||
// table hook
|
||||
const {
|
||||
getDataList,
|
||||
currentChangeHandle,
|
||||
sizeChangeHandle,
|
||||
tableStyle: _tableStyle
|
||||
} = useTable(state)
|
||||
|
||||
// 格式化性别
|
||||
const formatGender = (value: string | number) => {
|
||||
if (value === null || value === undefined || value === '') {
|
||||
return '-'
|
||||
}
|
||||
const dictItem = genderList.value.find(item => item.value == value)
|
||||
return dictItem ? dictItem.label : value
|
||||
}
|
||||
|
||||
// 格式化生源
|
||||
const formatEducation = (value: string | number) => {
|
||||
if (value === null || value === undefined || value === '') {
|
||||
return '-'
|
||||
}
|
||||
const dictItem = educationList.value.find(item => item.value == value)
|
||||
return dictItem ? dictItem.label : value
|
||||
}
|
||||
|
||||
// 格式化层次
|
||||
const formatMajorLevel = (value: string | number) => {
|
||||
if (value === null || value === undefined || value === '') {
|
||||
return '-'
|
||||
}
|
||||
const dictItem = majorLevelList.value.find(item => item.value == value)
|
||||
return dictItem ? dictItem.label : value
|
||||
}
|
||||
|
||||
// 格式化审核状态
|
||||
const formatCheckStatus = (value: string | number) => {
|
||||
if (value === null || value === undefined || value === '') {
|
||||
return '-'
|
||||
}
|
||||
const dictItem = checkStatusList.value.find(item => item.value == value)
|
||||
return dictItem ? dictItem.label : value
|
||||
}
|
||||
|
||||
// 重置
|
||||
const handleReset = () => {
|
||||
searchFormRef.value?.resetFields()
|
||||
state.queryForm.termId = ''
|
||||
state.queryForm.deptCode = ''
|
||||
state.queryForm.grade = ''
|
||||
state.queryForm.gradeCurr = undefined
|
||||
state.queryForm.classCode = ''
|
||||
state.queryForm.checkStatus = ''
|
||||
getDataList()
|
||||
}
|
||||
|
||||
// 新增
|
||||
const handleAdd = () => {
|
||||
useMessage().info('新增功能待开发')
|
||||
// formDialogRef.value?.openDialog('add')
|
||||
}
|
||||
|
||||
// 编辑
|
||||
const handleEdit = (row: any) => {
|
||||
useMessage().info('编辑功能待开发')
|
||||
// formDialogRef.value?.openDialog('edit', row.id)
|
||||
}
|
||||
|
||||
// 删除
|
||||
const handleDelete = async (row: any) => {
|
||||
try {
|
||||
const { confirm } = useMessageBox()
|
||||
await confirm(`确定要删除学号为 ${row.stuNo} 的免学费记录吗?`)
|
||||
await delObj(row.id)
|
||||
useMessage().success('删除成功')
|
||||
getDataList()
|
||||
} catch (err: any) {
|
||||
if (err !== 'cancel') {
|
||||
useMessage().error(err.msg || '删除失败')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 导出
|
||||
const handleExport = async () => {
|
||||
try {
|
||||
exportLoading.value = true
|
||||
const res = await exportExcel(state.queryForm)
|
||||
const blob = new Blob([res.data as BlobPart])
|
||||
const fileName = `免学费查询_${new Date().getTime()}.xls`
|
||||
const elink = document.createElement('a')
|
||||
elink.download = fileName
|
||||
elink.style.display = 'none'
|
||||
elink.href = URL.createObjectURL(blob)
|
||||
document.body.appendChild(elink)
|
||||
elink.click()
|
||||
URL.revokeObjectURL(elink.href)
|
||||
document.body.removeChild(elink)
|
||||
useMessage().success('导出成功')
|
||||
} catch (err: any) {
|
||||
useMessage().error(err.msg || '导出失败')
|
||||
} finally {
|
||||
exportLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
// 获取批次列表
|
||||
const getTermList = async () => {
|
||||
try {
|
||||
const res = await request({
|
||||
url: '/stuwork/tuitionfreeterm/list',
|
||||
method: 'get'
|
||||
})
|
||||
if (res.data && Array.isArray(res.data)) {
|
||||
termList.value = res.data
|
||||
} else {
|
||||
termList.value = []
|
||||
}
|
||||
} catch (err) {
|
||||
console.error('获取批次列表失败', err)
|
||||
termList.value = []
|
||||
}
|
||||
}
|
||||
|
||||
// 获取学院列表
|
||||
const getDeptListData = async () => {
|
||||
try {
|
||||
const res = await getDeptList()
|
||||
if (res.data && Array.isArray(res.data)) {
|
||||
deptList.value = res.data
|
||||
} else {
|
||||
deptList.value = []
|
||||
}
|
||||
} catch (err) {
|
||||
console.error('获取学院列表失败', err)
|
||||
deptList.value = []
|
||||
}
|
||||
}
|
||||
|
||||
// 获取班级列表
|
||||
const getClassListData = async () => {
|
||||
try {
|
||||
const res = await getClassListByRole()
|
||||
if (res.data && Array.isArray(res.data)) {
|
||||
classList.value = res.data
|
||||
} else {
|
||||
classList.value = []
|
||||
}
|
||||
} catch (err) {
|
||||
console.error('获取班级列表失败', err)
|
||||
classList.value = []
|
||||
}
|
||||
}
|
||||
|
||||
// 获取入学年份列表
|
||||
const getGradeList = async () => {
|
||||
try {
|
||||
const res = await queryAllSchoolYear()
|
||||
if (res.data && Array.isArray(res.data)) {
|
||||
gradeList.value = res.data
|
||||
} else {
|
||||
gradeList.value = []
|
||||
}
|
||||
} catch (err) {
|
||||
console.error('获取入学年份列表失败', err)
|
||||
gradeList.value = []
|
||||
}
|
||||
}
|
||||
|
||||
// 获取性别字典
|
||||
const getGenderDict = async () => {
|
||||
try {
|
||||
const res = await getDicts('sexy')
|
||||
if (res.data && Array.isArray(res.data)) {
|
||||
genderList.value = res.data.map((item: any) => ({
|
||||
label: item.label || item.dictLabel || item.name,
|
||||
value: item.value || item.dictValue || item.code
|
||||
}))
|
||||
} else {
|
||||
genderList.value = []
|
||||
}
|
||||
} catch (err) {
|
||||
console.error('获取性别字典失败', err)
|
||||
genderList.value = []
|
||||
}
|
||||
}
|
||||
|
||||
// 获取生源字典
|
||||
const getEducationDict = async () => {
|
||||
try {
|
||||
const res = await getDicts('pre_school_education')
|
||||
if (res.data && Array.isArray(res.data)) {
|
||||
educationList.value = res.data.map((item: any) => ({
|
||||
label: item.label || item.dictLabel || item.name,
|
||||
value: item.value || item.dictValue || item.code
|
||||
}))
|
||||
} else {
|
||||
educationList.value = []
|
||||
}
|
||||
} catch (err) {
|
||||
console.error('获取生源字典失败', err)
|
||||
educationList.value = []
|
||||
}
|
||||
}
|
||||
|
||||
// 获取层次字典
|
||||
const getMajorLevelDict = async () => {
|
||||
try {
|
||||
const res = await getDicts('basic_major_level')
|
||||
if (res.data && Array.isArray(res.data)) {
|
||||
majorLevelList.value = res.data.map((item: any) => ({
|
||||
label: item.label || item.dictLabel || item.name,
|
||||
value: item.value || item.dictValue || item.code
|
||||
}))
|
||||
} else {
|
||||
majorLevelList.value = []
|
||||
}
|
||||
} catch (err) {
|
||||
console.error('获取层次字典失败', err)
|
||||
majorLevelList.value = []
|
||||
}
|
||||
}
|
||||
|
||||
// 初始化
|
||||
onMounted(() => {
|
||||
getTermList()
|
||||
getDeptListData()
|
||||
getClassListData()
|
||||
getGradeList()
|
||||
getGenderDict()
|
||||
getEducationDict()
|
||||
getMajorLevelDict()
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
</style>
|
||||
Reference in New Issue
Block a user