修复文件问题 修改bug

This commit is contained in:
2026-02-06 00:04:33 +08:00
parent 779b779910
commit de2d64210f
18 changed files with 1712 additions and 894 deletions

View File

@@ -262,13 +262,25 @@
<template #default="scope" v-if="col.prop === 'gender'">
<GenderTag :gender="scope.row.gender" />
</template>
<template #default="scope" v-else-if="col.prop === 'education'">
<el-tag v-if="getEducationLabel(scope.row.education)" size="small" type="info" effect="plain">
{{ getEducationLabel(scope.row.education) }}
</el-tag>
<span v-else>-</span>
</template>
<template #default="scope" v-else-if="col.prop === 'isDorm'">
<el-tag v-if="scope.row.isDorm === 1 || scope.row.isDorm === '1'" size="small" type="success" effect="plain"></el-tag>
<el-tag v-else-if="scope.row.isDorm === 0 || scope.row.isDorm === '0'" size="small" type="info" effect="plain"></el-tag>
<span v-else>-</span>
</template>
<template #default="scope" v-else-if="col.prop === 'enrollStatus'">
<el-tag v-if="scope.row.enrollStatus" size="small" type="info" effect="plain">{{ scope.row.enrollStatus }}</el-tag>
<el-tag
v-if="getEnrollStatusLabel(scope.row.enrollStatus)"
size="small"
type="info"
effect="plain">
{{ getEnrollStatusLabel(scope.row.enrollStatus) }}
</el-tag>
<span v-else>-</span>
</template>
<template #default="scope" v-else-if="col.prop === 'stuStatus'">
@@ -427,7 +439,6 @@ import {
editIsleader,
updateInout,
updateStuSimpleInfo,
getStuStatus,
prePrint
} from "/@/api/basic/basicstudent";
import { getDeptList, getClassListByRole } from "/@/api/basic/basicclass";
@@ -456,6 +467,7 @@ const deptList = ref<any[]>([])
const classList = ref<any[]>([])
const statusList = ref<any[]>([])
const stuStatusList = ref<any[]>([])
const educationList = ref<any[]>([])
const selectedRows = ref<any[]>([])
const importCertificateDialogVisible = ref(false)
const uploadLoading = ref(false)
@@ -781,9 +793,17 @@ const getClassListData = async () => {
// 获取学籍状态列表
const getStatusListData = async () => {
try {
const res = await getStuStatus()
const res = await getDicts('enroll_status')
if (res.data) {
statusList.value = Array.isArray(res.data) ? res.data : []
if (Array.isArray(res.data)) {
// 确保数据格式统一为 {label, value}
statusList.value = res.data.map((item: any) => ({
label: item.label || item.name || item.dictLabel || item.text || '',
value: String(item.value || item.code || item.dictValue || item.id || '')
})).filter((item: any) => item.label && item.value !== undefined && item.value !== null && item.value !== '')
} else {
statusList.value = []
}
}
} catch (err) {
console.error('获取学籍状态列表失败', err)
@@ -791,6 +811,24 @@ const getStatusListData = async () => {
}
}
// 获取文化程度字典
const getEducationListData = 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 getStuStatusListData = async () => {
try {
@@ -813,6 +851,20 @@ const getStuStatusListData = async () => {
}
}
// 根据学籍状态值获取标签
const getEnrollStatusLabel = (value: any) => {
if (value === undefined || value === null || value === '') return ''
const status = statusList.value.find(item => String(item.value) === String(value))
return status ? status.label : ''
}
// 根据文化程度值获取标签
const getEducationLabel = (value: any) => {
if (value === undefined || value === null || value === '') return ''
const item = educationList.value.find(i => String(i.value) === String(value))
return item ? item.label : ''
}
// 根据学生状态值获取标签
const getStuStatusLabel = (value: any) => {
if (value === undefined || value === null || value === '') return ''
@@ -833,6 +885,7 @@ onMounted(() => {
getDeptListData()
getClassListData()
getStatusListData()
getEducationListData()
getStuStatusListData()
})
</script>

File diff suppressed because it is too large Load Diff

View File

@@ -102,7 +102,7 @@
<el-icon><List /></el-icon>
</template>
</el-table-column>
<el-table-column prop="code" label="申请单编号" min-width="140" show-overflow-tooltip>
<el-table-column prop="purchaseNo" label="申请单编号" min-width="140" show-overflow-tooltip>
<template #header>
<el-icon><DocumentCopy /></el-icon>
<span style="margin-left: 4px">申请单编号</span>
@@ -197,7 +197,7 @@
icon="View"
link
type="primary"
@click="formDialogRef.openDialog('view', scope.row)">
@click="handleView(scope.row)">
查看
</el-button>
<el-button
@@ -205,7 +205,7 @@
icon="Edit"
link
type="primary"
@click="formDialogRef.openDialog('edit', scope.row)">
@click="handleEdit(scope.row)">
编辑
</el-button>
<el-button
@@ -226,7 +226,8 @@
:total="state.pagination.total"
:current="state.pagination.current"
:size="state.pagination.size"
@pagination="getDataList"
@sizeChange="sizeChangeHandle"
@currentChange="currentChangeHandle"
/>
</el-card>
</div>
@@ -312,7 +313,7 @@ const state: BasicTableProps = reactive<BasicTableProps>({
/**
* 使用 useTable 定义表格相关操作
*/
const { getDataList, tableStyle } = useTable(state);
const { getDataList, tableStyle, sizeChangeHandle, currentChangeHandle } = useTable(state);
/**
* 重置搜索表单
@@ -361,6 +362,22 @@ const handleIframeMessage = (event: MessageEvent) => {
}
};
/**
* 打开查看对话框
* @param row - 当前行数据
*/
const handleView = (row: any) => {
formDialogRef.value?.openDialog('view', row);
};
/**
* 打开编辑对话框
* @param row - 当前行数据
*/
const handleEdit = (row: any) => {
formDialogRef.value?.openDialog('edit', row);
};
/**
* 删除当前行
* @param row - 当前行数据

View File

@@ -17,7 +17,19 @@
</el-select>
</el-form-item>
<el-form-item label="宿舍号" prop="roomNo">
<el-input v-model="form.roomNo" placeholder="请输入宿舍号" />
<el-select
v-model="form.roomNo"
placeholder="请选择宿舍号"
clearable
filterable
style="width: 100%">
<el-option
v-for="item in roomList"
:key="item.roomNo"
:label="item.roomNo"
:value="item.roomNo">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="记录日期" prop="recordDate">
<el-date-picker
@@ -50,6 +62,7 @@ import { ref, reactive, nextTick, onMounted } from 'vue'
import { useMessage } from '/@/hooks/message'
import { addObj, putObj, getObj } from '/@/api/stuwork/dormhygienedaily'
import { getBuildingList } from '/@/api/stuwork/dormbuilding'
import { getRoomList } from '/@/api/stuwork/dormroom'
const emit = defineEmits(['refresh'])
@@ -59,6 +72,7 @@ const visible = ref(false)
const loading = ref(false)
const operType = ref('add') // add 或 edit
const buildingList = ref<any[]>([])
const roomList = ref<any[]>([])
// 提交表单数据
const form = reactive({
@@ -75,7 +89,7 @@ const dataRules = {
{ required: true, message: '请选择楼号', trigger: 'change' }
],
roomNo: [
{ required: true, message: '请输入宿舍号', trigger: 'blur' }
{ required: true, message: '请选择宿舍号', trigger: 'change' }
],
recordDate: [
{ required: true, message: '请选择记录日期', trigger: 'change' }
@@ -159,9 +173,22 @@ const getBuildingListData = async () => {
}
}
// 获取宿舍号列表
const getRoomListData = async () => {
try {
const res = await getRoomList()
if (res.data) {
roomList.value = Array.isArray(res.data) ? res.data : []
}
} catch (err) {
roomList.value = []
}
}
// 初始化
onMounted(() => {
getBuildingListData()
getRoomListData()
})
// 暴露方法给父组件

View File

@@ -2,7 +2,19 @@
<el-dialog :title="form.id ? '编辑' : '新增'" v-model="visible" :width="600" :close-on-click-modal="false" draggable>
<el-form ref="dataFormRef" :model="form" :rules="dataRules" label-width="100px" v-loading="loading">
<el-form-item label="房间号" prop="roomNo">
<el-input v-model="form.roomNo" placeholder="请输入房间号" />
<el-select
v-model="form.roomNo"
placeholder="请选择房间号"
clearable
filterable
style="width: 100%">
<el-option
v-for="item in roomList"
:key="item.roomNo"
:label="item.roomNo"
:value="item.roomNo">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="整改时间" prop="reformDate">
<el-date-picker
@@ -31,9 +43,10 @@
</template>
<script setup lang="ts" name="DormReformFormDialog">
import { ref, reactive, nextTick } from 'vue'
import { ref, reactive, nextTick, onMounted } from 'vue'
import { useMessage } from '/@/hooks/message'
import { addObj, putObj } from '/@/api/stuwork/dormreform'
import { getRoomList } from '/@/api/stuwork/dormroom'
const emit = defineEmits(['refresh'])
@@ -42,6 +55,7 @@ const dataFormRef = ref()
const visible = ref(false)
const loading = ref(false)
const operType = ref('add') // add 或 edit
const roomList = ref<any[]>([])
// 提交表单数据
const form = reactive({
@@ -54,7 +68,7 @@ const form = reactive({
// 定义校验规则
const dataRules = {
roomNo: [
{ required: true, message: '请输入房间号', trigger: 'blur' }
{ required: true, message: '请选择房间号', trigger: 'change' }
],
reformDate: [
{ required: true, message: '请选择整改时间', trigger: 'change' }
@@ -90,6 +104,23 @@ const openDialog = (type: string = 'add', row?: any) => {
})
}
// 获取房间号列表
const getRoomListData = async () => {
try {
const res = await getRoomList()
if (res.data) {
roomList.value = Array.isArray(res.data) ? res.data : []
}
} catch (err) {
roomList.value = []
}
}
// 初始化
onMounted(() => {
getRoomListData()
})
// 提交表单
const onSubmit = async () => {
if (!dataFormRef.value) return

View File

@@ -193,7 +193,8 @@ const onSubmit = async () => {
visible.value = false
emit('refresh')
} catch (err: any) {
useMessage().error(err.msg || '转宿失败')
// 统一交给全局拦截器处理错误提示,避免在这里重复弹出一次
console.error('转宿失败', err)
} finally {
loading.value = false
}

View File

@@ -1,21 +1,21 @@
<template>
<div class="modern-page-container">
<div class="page-wrapper">
<!-- ?????? -->
<!-- 查询条件 -->
<el-card v-show="showSearch" class="search-card" shadow="never">
<template #header>
<div class="card-header">
<span class="card-title">
<el-icon class="title-icon"><Search /></el-icon>
????
查询条件
</span>
</div>
</template>
<el-form :model="state.queryForm" ref="searchFormRef" :inline="true" @keyup.enter="getDataList" class="search-form">
<el-form-item label="??" prop="schoolYear">
<el-form-item label="学年" prop="schoolYear">
<el-select
v-model="state.queryForm.schoolYear"
placeholder="?????"
placeholder="请选择学年"
clearable
filterable
style="width: 200px">
@@ -27,10 +27,10 @@
</el-option>
</el-select>
</el-form-item>
<el-form-item label="??" prop="schoolTerm">
<el-form-item label="学期" prop="schoolTerm">
<el-select
v-model="state.queryForm.schoolTerm"
placeholder="?????"
placeholder="请选择学期"
clearable
style="width: 200px">
<el-option
@@ -41,48 +41,48 @@
</el-option>
</el-select>
</el-form-item>
<el-form-item label="???" prop="roomNo">
<el-form-item label="宿舍号" prop="roomNo">
<el-input
v-model="state.queryForm.roomNo"
placeholder="??????"
placeholder="请输入宿舍号"
clearable
style="width: 200px" />
</el-form-item>
<el-form-item label="????" prop="ruleName">
<el-form-item label="奖项名称" prop="ruleName">
<el-input
v-model="state.queryForm.ruleName"
placeholder="???????"
placeholder="请输入奖项名称"
clearable
style="width: 200px" />
</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-button type="primary" plain icon="Search" @click="getDataList">查询</el-button>
<el-button icon="Refresh" @click="handleReset">重置</el-button>
</el-form-item>
</el-form>
</el-card>
<!-- ???? -->
<!-- 数据列表 -->
<el-card class="content-card" shadow="never">
<template #header>
<div class="card-header">
<span class="card-title">
<el-icon class="title-icon"><Document /></el-icon>
????????
文明宿舍列表
</span>
<div class="header-actions">
<el-button
icon="Plus"
type="primary"
@click="formDialogRef.openDialog()">
??
新增
</el-button>
<el-button
icon="Upload"
type="success"
class="ml10"
@click="handleImport">
??
导入
</el-button>
<right-toolbar
v-model:showSearch="showSearch"
@@ -98,7 +98,7 @@
@order-change="handleColumnOrderChange"
>
<template #trigger>
<el-tooltip class="item" effect="dark" content="???" placement="top">
<el-tooltip class="item" effect="dark" content="列设置" placement="top">
<el-button circle style="margin-left: 0;">
<el-icon><Menu /></el-icon>
</el-button>
@@ -110,7 +110,7 @@
</div>
</template>
<!-- ?? -->
<!-- 表格 -->
<el-table
:data="state.dataList"
v-loading="state.loading"
@@ -118,7 +118,7 @@
:cell-style="tableStyle.cellStyle"
:header-cell-style="tableStyle.headerCellStyle"
class="modern-table">
<el-table-column type="index" label="??" width="70" align="center">
<el-table-column type="index" label="序号" width="70" align="center">
<template #header>
<el-icon><List /></el-icon>
</template>
@@ -128,7 +128,7 @@
</el-table-column>
<template v-for="col in visibleColumnsSorted" :key="col.prop || col.label">
<el-table-column
v-if="checkColumnVisible(col.prop || '') && col.prop !== '??'"
v-if="checkColumnVisible(col.prop || '') && col.prop !== '序号'"
:prop="col.prop"
:label="col.label"
:width="col.width"
@@ -152,10 +152,10 @@
</template>
</el-table-column>
</template>
<el-table-column label="??" width="150" align="center" fixed="right">
<el-table-column label="操作" width="150" align="center" fixed="right">
<template #header>
<el-icon><Setting /></el-icon>
<span style="margin-left: 4px">??</span>
<span style="margin-left: 4px">操作</span>
</template>
<template #default="scope">
<el-button
@@ -163,20 +163,20 @@
link
type="primary"
@click="handleEdit(scope.row)">
??
编辑
</el-button>
<el-button
icon="Delete"
link
type="danger"
@click="handleDelete(scope.row)">
??
删除
</el-button>
</template>
</el-table-column>
</el-table>
<!-- ?? -->
<!-- 分页 -->
<div class="pagination-wrapper">
<pagination
@size-change="sizeChangeHandle"
@@ -186,12 +186,12 @@
</el-card>
</div>
<!-- ??/?????? -->
<!-- 新增/编辑对话框 -->
<form-dialog ref="formDialogRef" @refresh="getDataList" />
<!-- ???? -->
<!-- 导入对话框 -->
<el-dialog
title="??????"
title="导入数据"
v-model="importDialogVisible"
:width="500"
:close-on-click-modal="false"
@@ -201,7 +201,7 @@
icon="Download"
type="success"
@click="handleDownloadTemplate">
????
下载模板
</el-button>
</div>
<el-upload
@@ -213,18 +213,18 @@
drag>
<el-icon class="el-icon--upload"><upload-filled /></el-icon>
<div class="el-upload__text">
????????<em>????</em>
将文件拖到此处<em>点击上传</em>
</div>
<template #tip>
<div class="el-upload__tip">
???? xlsx/xls ??
只能上传 xlsx/xls 文件
</div>
</template>
</el-upload>
<template #footer>
<span class="dialog-footer">
<el-button @click="importDialogVisible = false">??</el-button>
<el-button type="primary" @click="handleImportSubmit" :disabled="!importFile || importLoading">??</el-button>
<el-button @click="importDialogVisible = false">取消</el-button>
<el-button type="primary" @click="handleImportSubmit" :disabled="!importFile || importLoading">确认</el-button>
</span>
</template>
</el-dialog>
@@ -245,7 +245,7 @@ import { useTableColumnControl } from '/@/hooks/tableColumn'
import FormDialog from './form.vue'
// ????
// 定义变量
const route = useRoute()
const formDialogRef = ref()
const uploadRef = ref()
@@ -258,31 +258,31 @@ const importDialogVisible = ref(false)
const importFile = ref<File | null>(null)
const importLoading = ref(false)
// ?????
// 表格列配置
const tableColumns = [
{ prop: 'schoolYear', label: '??', icon: Calendar },
{ prop: 'schoolTerm', label: '??', icon: Clock },
{ prop: 'roomNo', label: '???', icon: House },
{ prop: 'ruleName', label: '????', icon: Trophy, minWidth: 150 },
{ prop: 'remarks', label: '??', icon: EditPen, minWidth: 200 }
{ prop: 'schoolYear', label: '学年', icon: Calendar },
{ prop: 'schoolTerm', label: '学期', icon: Clock },
{ prop: 'roomNo', label: '宿舍号', icon: House },
{ prop: 'ruleName', label: '奖项名称', icon: Trophy, minWidth: 150 },
{ prop: 'remarks', label: '备注', icon: EditPen, minWidth: 200 }
]
// ??????? hook
// 表格列控制 hook
const {
visibleColumns,
visibleColumnsSorted,
checkColumnVisible,
handleColumnChange,
handleColumnOrderChange
} = useTableColumnControl(tableColumns, route.path)
} = useTableColumnControl(tableColumns)
// ????
// 表格样式
const tableStyle = {
cellStyle: { padding: '8px 0' },
headerCellStyle: { background: '#f5f7fa', color: '#606266', fontWeight: 'bold' }
}
// ?? useTable
// 使用 useTable
const state: BasicTableProps = reactive<BasicTableProps>({
queryForm: {
schoolYear: '',
@@ -295,7 +295,7 @@ const state: BasicTableProps = reactive<BasicTableProps>({
item: 'records',
totalCount: 'total'
},
createdIsNeed: true // ?????????
createdIsNeed: true // 创建时是否需要请求数据
})
// table hook
@@ -306,7 +306,7 @@ const {
tableStyle: _tableStyle
} = useTable(state)
// ?????
// 格式化学期
const formatSchoolTerm = (value: string | number) => {
if (value === null || value === undefined || value === '') {
return '-'
@@ -315,7 +315,7 @@ const formatSchoolTerm = (value: string | number) => {
return dictItem ? dictItem.label : value
}
// ??
// 重置
const handleReset = () => {
searchFormRef.value?.resetFields()
state.queryForm.schoolYear = ''
@@ -325,22 +325,22 @@ const handleReset = () => {
getDataList()
}
// ????
// 导入
const handleImport = () => {
importDialogVisible.value = true
importFile.value = null
uploadRef.value?.clearFiles()
}
// ????
// 下载模板
const handleDownloadTemplate = async () => {
try {
const fileName = '????????.xlsx'
// ?????? views/stuwork/rewarddorm ? assets/file ?
const fileName = '文明宿舍导入模板.xlsx'
// 模板文件位于 views/stuwork/rewarddorm 下的 assets/file 目录
const fileUrl = new URL(`../../../assets/file/${fileName}`, import.meta.url).href
const response = await fetch(fileUrl)
if (!response.ok) {
throw new Error('??????')
throw new Error('下载失败')
}
const blob = await response.blob()
const url = window.URL.createObjectURL(blob)
@@ -351,60 +351,60 @@ const handleDownloadTemplate = async () => {
link.click()
window.URL.revokeObjectURL(url)
document.body.removeChild(link)
useMessage().success('??????')
useMessage().success('下载成功')
} catch (error) {
useMessage().error('??????')
useMessage().error('下载失败')
}
}
// ????
// 文件变化
const handleFileChange = (file: any) => {
importFile.value = file.raw
}
// ????
// 提交导入
const handleImportSubmit = async () => {
if (!importFile.value) {
useMessage().warning('?????????')
useMessage().warning('请先选择要上传的文件')
return
}
importLoading.value = true
try {
await importExcel(importFile.value)
useMessage().success('????')
useMessage().success('导入成功')
importDialogVisible.value = false
importFile.value = null
uploadRef.value?.clearFiles()
getDataList()
} catch (err: any) {
useMessage().error(err.msg || '????')
useMessage().error(err.msg || '导入失败')
} finally {
importLoading.value = false
}
}
// ??
// 编辑
const handleEdit = (row: any) => {
formDialogRef.value?.openDialog('edit', row)
}
// ??
// 删除
const handleDelete = async (row: any) => {
const { confirm } = useMessageBox()
try {
await confirm('???????????')
await confirm('确定要删除该记录吗?')
await delObj([row.id])
useMessage().success('????')
useMessage().success('删除成功')
getDataList()
} catch (err: any) {
if (err !== 'cancel') {
useMessage().error(err.msg || '????')
useMessage().error(err.msg || '删除失败')
}
}
}
// ??????
// 获取学年列表
const getSchoolYearList = async () => {
try {
const res = await queryAllSchoolYear()
@@ -418,7 +418,7 @@ const getSchoolYearList = async () => {
}
}
// ??????
// 获取学期字典
const getSchoolTermDict = async () => {
try {
const res = await getDicts('school_term')
@@ -435,7 +435,7 @@ const getSchoolTermDict = async () => {
}
}
// ???
// 初始化
onMounted(() => {
getSchoolYearList()
getSchoolTermDict()

View File

@@ -1,21 +1,21 @@
<template>
<div class="modern-page-container">
<div class="page-wrapper">
<!-- ???? -->
<!-- 查询条件 -->
<el-card v-show="showSearch" class="search-card" shadow="never">
<template #header>
<div class="card-header">
<span class="card-title">
<el-icon class="title-icon"><Search /></el-icon>
????
查询条件
</span>
</div>
</template>
<el-form :model="state.queryForm" ref="searchFormRef" :inline="true" @keyup.enter="getDataList" class="search-form">
<el-form-item label="????" prop="ruleType">
<el-form-item label="奖项类型" prop="ruleType">
<el-select
v-model="state.queryForm.ruleType"
placeholder="请输入奖项名称"
placeholder="请选择奖项类型"
clearable
style="width: 200px">
<el-option
@@ -27,26 +27,26 @@
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" plain icon="Search" @click="getDataList">??</el-button>
<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-card>
<!-- ???? -->
<!-- 数据列表 -->
<el-card class="content-card" shadow="never">
<template #header>
<div class="card-header">
<span class="card-title">
<el-icon class="title-icon"><Document /></el-icon>
????????
评优评先奖项列表
</span>
<div class="header-actions">
<el-button
icon="Plus"
type="primary"
@click="formDialogRef.openDialog()">
??
新增
</el-button>
<right-toolbar
v-model:showSearch="showSearch"
@@ -92,7 +92,7 @@
</el-table-column>
<template v-for="col in visibleColumnsSorted" :key="col.prop || col.label">
<el-table-column
v-if="checkColumnVisible(col.prop || '') && col.prop !== '操作'"
v-if="checkColumnVisible(col.prop || '') && col.prop !== '序号'"
:prop="col.prop"
:label="col.label"
:width="col.width"
@@ -150,7 +150,7 @@
</el-card>
</div>
<!-- ??/?????? -->
<!-- 新增/编辑对话框 -->
<form-dialog ref="formDialogRef" @refresh="getDataList" />
</div>
</template>
@@ -168,7 +168,7 @@ import { List, Trophy, Collection, EditPen, Setting, Menu, Search, Document } fr
import { useTableColumnControl } from '/@/hooks/tableColumn'
// ??
// 定义变量
const route = useRoute()
const formDialogRef = ref()
const searchFormRef = ref()
@@ -176,29 +176,29 @@ const columnControlRef = ref()
const showSearch = ref(true)
const ruleTypeList = ref<any[]>([])
// ?????
// 表格列配置
const tableColumns = [
{ prop: 'ruleName', label: '????', icon: Trophy, minWidth: 200 },
{ prop: 'ruleType', label: '????', icon: Collection },
{ prop: 'remarks', label: '??', icon: EditPen, minWidth: 200 }
{ prop: 'ruleName', label: '奖项名称', icon: Trophy, minWidth: 200 },
{ prop: 'ruleType', label: '奖项类型', icon: Collection },
{ prop: 'remarks', label: '备注', icon: EditPen, minWidth: 200 }
]
// ??????? hook
// 表格列控制 hook
const {
visibleColumns,
visibleColumnsSorted,
checkColumnVisible,
handleColumnChange,
handleColumnOrderChange
} = useTableColumnControl(tableColumns, route.path)
} = useTableColumnControl(tableColumns)
// ????
// 表格样式
const tableStyle = {
cellStyle: { padding: '8px 0' },
headerCellStyle: { background: '#f5f7fa', color: '#606266', fontWeight: 'bold' }
}
// ?? useTable
// 使用 useTable
const state: BasicTableProps = reactive<BasicTableProps>({
queryForm: {
ruleType: ''
@@ -208,7 +208,7 @@ const state: BasicTableProps = reactive<BasicTableProps>({
item: 'records',
totalCount: 'total'
},
createdIsNeed: true // ???????????
createdIsNeed: true // 创建时是否需要请求数据
})
// table hook
@@ -219,7 +219,7 @@ const {
tableStyle: _tableStyle
} = useTable(state)
// ???????
// 格式化规则类型
const formatRuleType = (value: string | number) => {
if (value === null || value === undefined || value === '') {
return '-'
@@ -228,34 +228,34 @@ const formatRuleType = (value: string | number) => {
return dictItem ? dictItem.label : value
}
// ??
// 重置
const handleReset = () => {
searchFormRef.value?.resetFields()
state.queryForm.ruleType = ''
getDataList()
}
// ??
// 编辑
const handleEdit = (row: any) => {
formDialogRef.value?.openDialog('edit', row)
}
// ??
// 删除
const handleDelete = async (row: any) => {
const { confirm } = useMessageBox()
try {
await confirm('??????????????')
await confirm('确定要删除该记录吗?')
await delObj([row.id])
useMessage().success('????')
useMessage().success('删除成功')
getDataList()
} catch (err: any) {
if (err !== 'cancel') {
useMessage().error(err.msg || '????')
useMessage().error(err.msg || '删除失败')
}
}
}
// ????????
// 获取规则类型字典
const getRuleTypeDict = async () => {
try {
const res = await getDicts('rule_type')
@@ -272,7 +272,7 @@ const getRuleTypeDict = async () => {
}
}
// ???
// 初始化
onMounted(() => {
getRuleTypeDict()
})

View File

@@ -1,21 +1,21 @@
<template>
<div class="modern-page-container">
<div class="page-wrapper">
<!-- ?????? -->
<!-- 查询条件 -->
<el-card v-show="showSearch" class="search-card" shadow="never">
<template #header>
<div class="card-header">
<span class="card-title">
<el-icon class="title-icon"><Search /></el-icon>
????
查询条件
</span>
</div>
</template>
<el-form :model="queryForm" ref="searchFormRef" :inline="true" @keyup.enter="getDataList" class="search-form">
<el-form-item label="??" prop="deptCode">
<el-form-item label="学院" prop="deptCode">
<el-select
v-model="queryForm.deptCode"
placeholder="?????"
placeholder="请选择学院"
clearable
filterable
style="width: 200px">
@@ -27,10 +27,10 @@
</el-option>
</el-select>
</el-form-item>
<el-form-item label="??" prop="classCode">
<el-form-item label="班级" prop="classCode">
<el-select
v-model="queryForm.classCode"
placeholder="?????"
placeholder="请选择班级"
clearable
filterable
style="width: 200px">
@@ -42,10 +42,10 @@
</el-option>
</el-select>
</el-form-item>
<el-form-item label="??" prop="schoolYear">
<el-form-item label="学年" prop="schoolYear">
<el-select
v-model="queryForm.schoolYear"
placeholder="?????"
placeholder="请选择学年"
clearable
filterable
style="width: 200px">
@@ -57,10 +57,10 @@
</el-option>
</el-select>
</el-form-item>
<el-form-item label="??" prop="schoolTerm">
<el-form-item label="学期" prop="schoolTerm">
<el-select
v-model="queryForm.schoolTerm"
placeholder="?????"
placeholder="请选择学期"
clearable
style="width: 200px">
<el-option
@@ -72,19 +72,19 @@
</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-button type="primary" plain icon="Search" @click="getDataList">查询</el-button>
<el-button icon="Refresh" @click="handleReset">重置</el-button>
</el-form-item>
</el-form>
</el-card>
<!-- ???? -->
<!-- 数据列表 -->
<el-card class="content-card" shadow="never">
<template #header>
<div class="card-header">
<span class="card-title">
<el-icon class="title-icon"><Document /></el-icon>
????
奖励学生列表
</span>
<div class="header-actions">
<el-button
@@ -92,7 +92,7 @@
type="success"
class="ml10"
@click="handleExport">
??
导出
</el-button>
<right-toolbar
v-model:showSearch="showSearch"
@@ -108,7 +108,7 @@
@order-change="handleColumnOrderChange"
>
<template #trigger>
<el-tooltip class="item" effect="dark" content="???" placement="top">
<el-tooltip class="item" effect="dark" content="列设置" placement="top">
<el-button circle style="margin-left: 0;">
<el-icon><Menu /></el-icon>
</el-button>
@@ -120,7 +120,7 @@
</div>
</template>
<!-- ?? -->
<!-- 表格 -->
<el-table
:data="dataList"
v-loading="loading"
@@ -128,7 +128,7 @@
:cell-style="tableStyle.cellStyle"
:header-cell-style="tableStyle.headerCellStyle"
class="modern-table">
<el-table-column type="index" label="??" width="70" align="center">
<el-table-column type="index" label="序号" width="70" align="center">
<template #header>
<el-icon><List /></el-icon>
</template>
@@ -138,7 +138,7 @@
</el-table-column>
<template v-for="col in visibleColumnsSorted" :key="col.prop || col.label">
<el-table-column
v-if="checkColumnVisible(col.prop || '') && col.prop !== '??'"
v-if="checkColumnVisible(col.prop || '') && col.prop !== '序号'"
:prop="col.prop"
:label="col.label"
show-overflow-tooltip
@@ -149,28 +149,28 @@
<el-icon><component :is="columnConfigMap[col.prop]?.icon || OfficeBuilding" /></el-icon>
<span style="margin-left: 4px">{{ col.label }}</span>
</template>
<!-- ?????????? -->
<!-- 平均操行分格式化 -->
<template v-if="col.prop === 'averageConduct'" #default="scope">
<el-tag v-if="scope.row.averageConduct !== null && scope.row.averageConduct !== undefined" size="small" type="success" effect="plain">
{{ scope.row.averageConduct.toFixed(2) }}
</el-tag>
<span v-else>-</span>
</template>
<!-- ???????????? -->
<!-- 平均学习成绩格式化 -->
<template v-else-if="col.prop === 'averageScore'" #default="scope">
<el-tag v-if="scope.row.averageScore !== null && scope.row.averageScore !== undefined" size="small" type="primary" effect="plain">
{{ scope.row.averageScore.toFixed(2) }}
</el-tag>
<span v-else>-</span>
</template>
<!-- ????????? -->
<!-- 规则名称格式化 -->
<template v-else-if="col.prop === 'ruleName'" #default="scope">
<el-tag v-if="scope.row.ruleName && Array.isArray(scope.row.ruleName) && scope.row.ruleName.length > 0" size="small" type="warning" effect="light">
{{ scope.row.ruleName.join('?') }}
{{ scope.row.ruleName.join('') }}
</el-tag>
<span v-else>-</span>
</template>
<!-- ????????? -->
<!-- 更新时间格式化 -->
<template v-else-if="col.prop === 'upDateTime'" #default="scope">
<span>{{ parseTime(scope.row.upDateTime, dateTimeFormat) }}</span>
</template>
@@ -198,7 +198,7 @@ import { useTableColumnControl } from '/@/hooks/tableColumn'
const dateTimeFormat = '{y}-{m}-{d} {h}:{i}:{s}'
// ????
// 定义变量
const route = useRoute()
const searchFormRef = ref()
const columnControlRef = ref<any>()
@@ -210,20 +210,20 @@ const schoolTermList = ref<any[]>([])
const deptList = ref<any[]>([])
const classList = ref<any[]>([])
// ?????
// 表格列配置
const tableColumns = [
{ prop: 'departName', label: '????' },
{ prop: 'classNo', label: '??' },
{ prop: 'stuNo', label: '??' },
{ prop: 'realName', label: '??' },
{ prop: 'averageConduct', label: '?????' },
{ prop: 'averageScore', label: '???????' },
{ prop: 'violation', label: '????', minWidth: 150 },
{ prop: 'ruleName', label: '????', minWidth: 200 },
{ prop: 'upDateTime', label: '????', width: 180 }
{ prop: 'departName', label: '学院名称' },
{ prop: 'classNo', label: '班级' },
{ prop: 'stuNo', label: '学号' },
{ prop: 'realName', label: '姓名' },
{ prop: 'averageConduct', label: '平均操行分' },
{ prop: 'averageScore', label: '平均学习成绩' },
{ prop: 'violation', label: '违规情况', minWidth: 150 },
{ prop: 'ruleName', label: '奖励规则', minWidth: 200 },
{ prop: 'upDateTime', label: '更新时间', width: 180 }
]
// ?????????????
// 列配置映射
const columnConfigMap: Record<string, { icon: any }> = {
departName: { icon: OfficeBuilding },
classNo: { icon: Grid },
@@ -236,7 +236,7 @@ const columnConfigMap: Record<string, { icon: any }> = {
upDateTime: { icon: Clock }
}
// ???????hook
// 表格列控制hook
const {
visibleColumns,
visibleColumnsSorted,
@@ -245,7 +245,7 @@ const {
handleColumnOrderChange
} = useTableColumnControl(tableColumns, route.path)
// ????
// 查询表单
const queryForm = reactive({
deptCode: '',
classCode: '',
@@ -253,13 +253,13 @@ const queryForm = reactive({
schoolTerm: ''
})
// ????
// 表格样式
const tableStyle = {
cellStyle: { padding: '8px 0' },
headerCellStyle: { background: '#f5f7fa', color: '#606266', fontWeight: 'bold' }
}
// ?????
// 格式化学期
const formatSchoolTerm = (value: string | number) => {
if (value === null || value === undefined || value === '') {
return '-'
@@ -268,7 +268,7 @@ const formatSchoolTerm = (value: string | number) => {
return dictItem ? dictItem.label : value
}
// ????
// 获取数据列表
const getDataList = async () => {
loading.value = true
try {
@@ -279,14 +279,14 @@ const getDataList = async () => {
dataList.value = []
}
} catch (err: any) {
useMessage().error(err.msg || '??????')
useMessage().error(err.msg || '查询失败')
dataList.value = []
} finally {
loading.value = false
}
}
// ??
// 重置
const handleReset = () => {
searchFormRef.value?.resetFields()
queryForm.deptCode = ''
@@ -296,43 +296,43 @@ const handleReset = () => {
getDataList()
}
// ??
// 导出
const handleExport = async () => {
try {
loading.value = true
const res = await exportExcel(queryForm)
// ?? blob
// 创建 blob
const blob = new Blob([res], {
type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
})
// ??????
// 创建下载链接
const url = window.URL.createObjectURL(blob)
const link = document.createElement('a')
link.href = url
// ???
const fileName = `??????_${new Date().getTime()}.xlsx`
// 设置文件名
const fileName = `奖励学生_${new Date().getTime()}.xlsx`
link.setAttribute('download', fileName)
// ????
// 触发下载
document.body.appendChild(link)
link.click()
// ??
// 清理
document.body.removeChild(link)
window.URL.revokeObjectURL(url)
useMessage().success('????')
useMessage().success('导出成功')
} catch (err: any) {
useMessage().error(err.msg || '????')
useMessage().error(err.msg || '导出失败')
} finally {
loading.value = false
}
}
// ??????
// 获取学年列表
const getSchoolYearList = async () => {
try {
const res = await queryAllSchoolYear()
@@ -346,7 +346,7 @@ const getSchoolYearList = async () => {
}
}
// ??????
// 获取学期字典
const getSchoolTermDict = async () => {
try {
const res = await getDicts('school_term')
@@ -363,7 +363,7 @@ const getSchoolTermDict = async () => {
}
}
// ??????
// 获取学院列表
const getDeptListData = async () => {
try {
const res = await getDeptList()
@@ -377,7 +377,7 @@ const getDeptListData = async () => {
}
}
// ??????
// 获取班级列表
const getClassListData = async () => {
try {
const res = await getClassListByRole()
@@ -391,7 +391,7 @@ const getClassListData = async () => {
}
}
// ????
// 初始化
onMounted(() => {
getSchoolYearList()
getSchoolTermDict()
@@ -400,7 +400,6 @@ onMounted(() => {
getDataList()
nextTick(() => {
if (visibleColumns.value.length === 0) {
loadSavedConfig()
}
})
})

View File

@@ -1,21 +1,21 @@
<template>
<div class="modern-page-container">
<div class="page-wrapper">
<!-- ?????? -->
<!-- 查询条件 -->
<el-card v-show="showSearch" class="search-card" shadow="never">
<template #header>
<div class="card-header">
<span class="card-title">
<el-icon class="title-icon"><Search /></el-icon>
????
查询条件
</span>
</div>
</template>
<el-form :model="state.queryForm" ref="searchFormRef" :inline="true" @keyup.enter="getDataList" class="search-form">
<el-form-item label="??" prop="schoolYear">
<el-form-item label="学年" prop="schoolYear">
<el-select
v-model="state.queryForm.schoolYear"
placeholder="?????"
placeholder="请选择学年"
clearable
filterable
style="width: 200px">
@@ -27,10 +27,10 @@
</el-option>
</el-select>
</el-form-item>
<el-form-item label="??" prop="schoolTerm">
<el-form-item label="学期" prop="schoolTerm">
<el-select
v-model="state.queryForm.schoolTerm"
placeholder="?????"
placeholder="请选择学期"
clearable
style="width: 200px">
<el-option
@@ -41,10 +41,10 @@
</el-option>
</el-select>
</el-form-item>
<el-form-item label="??" prop="deptCode">
<el-form-item label="学院" prop="deptCode">
<el-select
v-model="state.queryForm.deptCode"
placeholder="?????"
placeholder="请选择学院"
clearable
filterable
style="width: 200px">
@@ -56,10 +56,10 @@
</el-option>
</el-select>
</el-form-item>
<el-form-item label="??" prop="classCode">
<el-form-item label="班级" prop="classCode">
<el-select
v-model="state.queryForm.classCode"
placeholder="?????"
placeholder="请选择班级"
clearable
filterable
style="width: 200px">
@@ -71,41 +71,41 @@
</el-option>
</el-select>
</el-form-item>
<el-form-item label="??" prop="realName">
<el-form-item label="姓名" prop="realName">
<el-input
v-model="state.queryForm.realName"
placeholder="?????"
placeholder="请输入姓名"
clearable
style="width: 200px" />
</el-form-item>
<el-form-item label="??" prop="stuNo">
<el-form-item label="学号" prop="stuNo">
<el-input
v-model="state.queryForm.stuNo"
placeholder="?????"
placeholder="请输入学号"
clearable
style="width: 200px" />
</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-button type="primary" plain icon="Search" @click="getDataList">查询</el-button>
<el-button icon="Refresh" @click="handleReset">重置</el-button>
</el-form-item>
</el-form>
</el-card>
<!-- ???? -->
<!-- 数据列表 -->
<el-card class="content-card" shadow="never">
<template #header>
<div class="card-header">
<span class="card-title">
<el-icon class="title-icon"><Document /></el-icon>
????????
学生关怀记录列表
</span>
<div class="header-actions">
<el-button
icon="Plus"
type="primary"
@click="formDialogRef.openDialog()">
??
新增
</el-button>
<right-toolbar
v-model:showSearch="showSearch"
@@ -121,7 +121,7 @@
@order-change="handleColumnOrderChange"
>
<template #trigger>
<el-tooltip class="item" effect="dark" content="???" placement="top">
<el-tooltip class="item" effect="dark" content="列设置" placement="top">
<el-button circle style="margin-left: 0;">
<el-icon><Menu /></el-icon>
</el-button>
@@ -133,7 +133,7 @@
</div>
</template>
<!-- ?? -->
<!-- 表格 -->
<el-table
:data="state.dataList"
v-loading="state.loading"
@@ -141,7 +141,7 @@
:cell-style="tableStyle.cellStyle"
:header-cell-style="tableStyle.headerCellStyle"
class="modern-table">
<el-table-column type="index" label="??" width="70" align="center">
<el-table-column type="index" label="序号" width="70" align="center">
<template #header>
<el-icon><List /></el-icon>
</template>
@@ -151,7 +151,7 @@
</el-table-column>
<template v-for="col in visibleColumnsSorted" :key="col.prop || col.label">
<el-table-column
v-if="checkColumnVisible(col.prop || '') && col.prop !== '??'"
v-if="checkColumnVisible(col.prop || '') && col.prop !== '序号'"
:prop="col.prop"
:label="col.label"
show-overflow-tooltip
@@ -162,32 +162,32 @@
<el-icon><component :is="columnConfigMap[col.prop]?.icon || Calendar" /></el-icon>
<span style="margin-left: 4px">{{ col.label }}</span>
</template>
<!-- ??????? -->
<!-- 学期格式化 -->
<template v-if="col.prop === 'schoolTerm'" #default="scope">
<el-tag size="small" type="primary" effect="plain">
{{ formatSchoolTerm(scope.row.schoolTerm) }}
</el-tag>
</template>
<!-- ?????????? -->
<!-- 关怀类型格式化 -->
<template v-else-if="col.prop === 'careType'" #default="scope">
<el-tag size="small" type="danger" effect="plain">
{{ formatCareType(scope.row.careType) }}
</el-tag>
</template>
<!-- ????????? -->
<!-- 记录日期格式化 -->
<template v-else-if="col.prop === 'recordDate'" #default="scope">
<span>{{ scope.row.recordDate || '-' }}</span>
</template>
<!-- ????????? -->
<!-- 处理结果格式化 -->
<template v-else-if="col.prop === 'result'" #default="scope">
<span>{{ scope.row.result || '-' }}</span>
</template>
</el-table-column>
</template>
<el-table-column label="??" width="250" align="center" fixed="right">
<el-table-column label="操作" width="250" align="center" fixed="right">
<template #header>
<el-icon><Setting /></el-icon>
<span style="margin-left: 4px">??</span>
<span style="margin-left: 4px">操作</span>
</template>
<template #default="scope">
<el-button
@@ -195,27 +195,27 @@
link
type="primary"
@click="handleEdit(scope.row)">
??
编辑
</el-button>
<el-button
icon="Document"
link
type="success"
@click="handleResult(scope.row)">
????
处理结果
</el-button>
<el-button
icon="Delete"
link
type="danger"
@click="handleDelete(scope.row)">
??
删除
</el-button>
</template>
</el-table-column>
</el-table>
<!-- ?? -->
<!-- 分页 -->
<div class="pagination-wrapper">
<pagination
@size-change="sizeChangeHandle"
@@ -225,10 +225,10 @@
</el-card>
</div>
<!-- ??/?????? -->
<!-- 新增/编辑对话框 -->
<form-dialog ref="formDialogRef" @refresh="getDataList" />
<!-- ?????? -->
<!-- 处理结果对话框 -->
<result-dialog ref="resultDialogRef" @refresh="getDataList" />
</div>
</template>
@@ -250,7 +250,7 @@ import { List, Calendar, Clock, OfficeBuilding, Grid, Avatar, UserFilled, Phone,
import { useTableColumnControl } from '/@/hooks/tableColumn'
// ??????
// 定义变量
const route = useRoute()
const formDialogRef = ref()
const resultDialogRef = ref()
@@ -263,22 +263,22 @@ const deptList = ref<any[]>([])
const classList = ref<any[]>([])
const careTypeList = ref<any[]>([])
// ?????
// 表格列配置
const tableColumns = [
{ prop: 'schoolYear', label: '??' },
{ prop: 'schoolTerm', label: '??' },
{ prop: 'deptName', label: '??' },
{ prop: 'classNo', label: '??' },
{ prop: 'realName', label: '??' },
{ prop: 'teacherRealName', label: '?????' },
{ prop: 'teacherTel', label: '?????' },
{ prop: 'careType', label: '?????' },
{ prop: 'present', label: '????', minWidth: 150 },
{ prop: 'recordDate', label: '????', width: 120 },
{ prop: 'result', label: '????', minWidth: 150 }
{ prop: 'schoolYear', label: '学年' },
{ prop: 'schoolTerm', label: '学期' },
{ prop: 'deptName', label: '学院' },
{ prop: 'classNo', label: '班级' },
{ prop: 'realName', label: '姓名' },
{ prop: 'teacherRealName', label: '班主任姓名' },
{ prop: 'teacherTel', label: '班主任电话' },
{ prop: 'careType', label: '关怀类型' },
{ prop: 'present', label: '现状描述', minWidth: 150 },
{ prop: 'recordDate', label: '记录日期', width: 120 },
{ prop: 'result', label: '处理结果', minWidth: 150 }
]
// ?????????????
// 列配置映射
const columnConfigMap: Record<string, { icon: any }> = {
schoolYear: { icon: Calendar },
schoolTerm: { icon: Clock },
@@ -293,7 +293,7 @@ const columnConfigMap: Record<string, { icon: any }> = {
result: { icon: CircleCheck }
}
// ???????hook
// 表格列控制hook
const {
visibleColumns,
visibleColumnsSorted,
@@ -302,7 +302,7 @@ const {
handleColumnOrderChange
} = useTableColumnControl(tableColumns, route.path)
// ?? useTable
// 使用 useTable
const state: BasicTableProps = reactive<BasicTableProps>({
queryForm: {
schoolYear: '',
@@ -328,7 +328,7 @@ const {
tableStyle
} = useTable(state)
// ?????
// 格式化学期
const formatSchoolTerm = (value: string | number) => {
if (value === null || value === undefined || value === '') {
return '-'
@@ -337,14 +337,14 @@ const formatSchoolTerm = (value: string | number) => {
return dictItem ? dictItem.label : value
}
// ????????
// 格式化关怀类型
const formatCareType = (value: string) => {
if (!value) return '-'
const item = careTypeList.value.find((item: any) => item.value === value)
return item ? item.label : value
}
// ??
// 重置
const handleReset = () => {
searchFormRef.value?.resetFields()
state.queryForm.schoolYear = ''
@@ -356,32 +356,32 @@ const handleReset = () => {
getDataList()
}
// ??
// 编辑
const handleEdit = (row: any) => {
formDialogRef.value?.openDialog('edit', row)
}
// ????
// 处理结果
const handleResult = (row: any) => {
resultDialogRef.value?.openDialog(row)
}
// ??
// 删除
const handleDelete = async (row: any) => {
const { confirm } = useMessageBox()
try {
await confirm('??????????????')
await confirm('确定要删除该记录吗?')
await delObj([row.id])
useMessage().success('????')
useMessage().success('删除成功')
getDataList()
} catch (err: any) {
if (err !== 'cancel') {
useMessage().error(err.msg || '????')
useMessage().error(err.msg || '删除失败')
}
}
}
// ??????
// 获取学年列表
const getSchoolYearList = async () => {
try {
const res = await queryAllSchoolYear()
@@ -395,7 +395,7 @@ const getSchoolYearList = async () => {
}
}
// ??????
// 获取学期字典
const getSchoolTermDict = async () => {
try {
const res = await getDicts('school_term')
@@ -412,7 +412,7 @@ const getSchoolTermDict = async () => {
}
}
// ??????
// 获取学院列表
const getDeptListData = async () => {
try {
const res = await getDeptList()
@@ -426,7 +426,7 @@ const getDeptListData = async () => {
}
}
// ??????
// 获取班级列表
const getClassListData = async () => {
try {
const res = await getClassListByRole()
@@ -440,7 +440,7 @@ const getClassListData = async () => {
}
}
// ?????????
// 获取关怀类型字典
const getCareTypeDict = async () => {
try {
const res = await getDicts('stu_care_type')
@@ -457,7 +457,7 @@ const getCareTypeDict = async () => {
}
}
// ???
// 初始化
onMounted(() => {
getSchoolYearList()
getSchoolTermDict()

View File

@@ -1,21 +1,21 @@
<template>
<div class="modern-page-container">
<div class="page-wrapper">
<!-- ?????? -->
<!-- 查询条件 -->
<el-card v-show="showSearch" class="search-card" shadow="never">
<template #header>
<div class="card-header">
<span class="card-title">
<el-icon class="title-icon"><Search /></el-icon>
????
查询条件
</span>
</div>
</template>
<el-form :model="state.queryForm" ref="searchFormRef" :inline="true" @keyup.enter="getDataList" class="search-form">
<el-form-item label="??" prop="schoolYear">
<el-form-item label="学年" prop="schoolYear">
<el-select
v-model="state.queryForm.schoolYear"
placeholder="?????"
placeholder="请选择学年"
clearable
filterable
style="width: 200px">
@@ -27,10 +27,10 @@
</el-option>
</el-select>
</el-form-item>
<el-form-item label="??" prop="schoolTerm">
<el-form-item label="学期" prop="schoolTerm">
<el-select
v-model="state.queryForm.schoolTerm"
placeholder="?????"
placeholder="请选择学期"
clearable
style="width: 200px">
<el-option
@@ -41,10 +41,10 @@
</el-option>
</el-select>
</el-form-item>
<el-form-item label="??" prop="deptCode">
<el-form-item label="学院" prop="deptCode">
<el-select
v-model="state.queryForm.deptCode"
placeholder="?????"
placeholder="请选择学院"
clearable
filterable
style="width: 200px"
@@ -57,10 +57,10 @@
</el-option>
</el-select>
</el-form-item>
<el-form-item label="??" prop="classCode">
<el-form-item label="班级" prop="classCode">
<el-select
v-model="state.queryForm.classCode"
placeholder="?????"
placeholder="请选择班级"
clearable
filterable
style="width: 200px">
@@ -72,17 +72,17 @@
</el-option>
</el-select>
</el-form-item>
<el-form-item label="??" prop="realName">
<el-form-item label="姓名" prop="realName">
<el-input
v-model="state.queryForm.realName"
placeholder="?????"
placeholder="请输入姓名"
clearable
style="width: 200px" />
</el-form-item>
<el-form-item label="??" prop="conductType">
<el-form-item label="类型" prop="conductType">
<el-select
v-model="state.queryForm.conductType"
placeholder="?????"
placeholder="请选择类型"
clearable
style="width: 200px">
<el-option
@@ -94,33 +94,33 @@
</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-button type="primary" plain icon="Search" @click="getDataList">查询</el-button>
<el-button icon="Refresh" @click="handleReset">重置</el-button>
</el-form-item>
</el-form>
</el-card>
<!-- ???? -->
<!-- 数据列表 -->
<el-card class="content-card" shadow="never">
<template #header>
<div class="card-header">
<span class="card-title">
<el-icon class="title-icon"><Document /></el-icon>
????????
学生行为记录列表
</span>
<div class="header-actions">
<el-button
icon="Plus"
type="primary"
@click="formDialogRef.openDialog()">
??
新增
</el-button>
<el-button
icon="Upload"
type="success"
class="ml10"
@click="handleImport">
??
导入
</el-button>
<right-toolbar
v-model:showSearch="showSearch"
@@ -136,7 +136,7 @@
@order-change="handleColumnOrderChange"
>
<template #trigger>
<el-tooltip class="item" effect="dark" content="???" placement="top">
<el-tooltip class="item" effect="dark" content="列设置" placement="top">
<el-button circle style="margin-left: 0;">
<el-icon><Menu /></el-icon>
</el-button>
@@ -148,7 +148,7 @@
</div>
</template>
<!-- ?? -->
<!-- 表格 -->
<el-table
:data="state.dataList"
v-loading="state.loading"
@@ -156,7 +156,7 @@
:cell-style="tableStyle.cellStyle"
:header-cell-style="tableStyle.headerCellStyle"
class="modern-table">
<el-table-column type="index" label="??" width="70" align="center">
<el-table-column type="index" label="序号" width="70" align="center">
<template #header>
<el-icon><List /></el-icon>
</template>
@@ -166,7 +166,7 @@
</el-table-column>
<template v-for="col in visibleColumnsSorted" :key="col.prop || col.label">
<el-table-column
v-if="checkColumnVisible(col.prop || '') && col.prop !== '??'"
v-if="checkColumnVisible(col.prop || '') && col.prop !== '序号'"
:prop="col.prop"
:label="col.label"
show-overflow-tooltip
@@ -177,23 +177,23 @@
<el-icon><component :is="columnConfigMap[col.prop]?.icon || Calendar" /></el-icon>
<span style="margin-left: 4px">{{ col.label }}</span>
</template>
<!-- ??????? -->
<!-- 学期格式化 -->
<template v-if="col.prop === 'schoolTerm'" #default="scope">
<el-tag size="small" type="primary" effect="plain">
{{ formatSchoolTerm(scope.row.schoolTerm) }}
</el-tag>
</template>
<!-- ??????? -->
<!-- 类型格式化 -->
<template v-else-if="col.prop === 'conductType'" #default="scope">
<el-tag size="small" type="warning" effect="plain">
{{ formatType(scope.row.conductType) }}
</el-tag>
</template>
<!-- ????????? -->
<!-- 记录日期格式化 -->
<template v-else-if="col.prop === 'recordDate'" #default="scope">
<span>{{ scope.row.recordDate || '-' }}</span>
</template>
<!-- ??????? -->
<!-- 附件格式化 -->
<template v-else-if="col.prop === 'attachment'" #default="scope">
<el-button
v-if="scope.row.attachment"
@@ -202,16 +202,16 @@
type="primary"
size="small"
@click="handleViewAttachment(scope.row)">
??
查看
</el-button>
<span v-else>-</span>
</template>
</el-table-column>
</template>
<el-table-column label="??" width="150" align="center" fixed="right">
<el-table-column label="操作" width="150" align="center" fixed="right">
<template #header>
<el-icon><Setting /></el-icon>
<span style="margin-left: 4px">??</span>
<span style="margin-left: 4px">操作</span>
</template>
<template #default="scope">
<el-button
@@ -219,20 +219,20 @@
link
type="primary"
@click="handleEdit(scope.row)">
??
编辑
</el-button>
<el-button
icon="Delete"
link
type="danger"
@click="handleDelete(scope.row)">
??
删除
</el-button>
</template>
</el-table-column>
</el-table>
<!-- ?? -->
<!-- 分页 -->
<div class="pagination-wrapper">
<pagination
@size-change="sizeChangeHandle"
@@ -242,12 +242,12 @@
</el-card>
</div>
<!-- ??/?????? -->
<!-- 新增/编辑对话框 -->
<form-dialog ref="formDialogRef" @refresh="getDataList" />
<!-- ???? -->
<!-- 导入对话框 -->
<el-dialog
title="??????"
title="导入数据"
v-model="importDialogVisible"
:width="500"
:close-on-click-modal="false"
@@ -261,18 +261,18 @@
drag>
<el-icon class="el-icon--upload"><upload-filled /></el-icon>
<div class="el-upload__text">
????????<em>????</em>
将文件拖到此处<em>点击上传</em>
</div>
<template #tip>
<div class="el-upload__tip">
???? xlsx/xls ??
只能上传 xlsx/xls 文件
</div>
</template>
</el-upload>
<template #footer>
<span class="dialog-footer">
<el-button @click="importDialogVisible = false">??</el-button>
<el-button type="primary" @click="handleImportSubmit" :disabled="!importFile || importLoading">??</el-button>
<el-button @click="importDialogVisible = false">取消</el-button>
<el-button type="primary" @click="handleImportSubmit" :disabled="!importFile || importLoading">确认</el-button>
</span>
</template>
</el-dialog>
@@ -295,7 +295,7 @@ import { useTableColumnControl } from '/@/hooks/tableColumn'
import FormDialog from './form.vue'
// ??????
// 定义变量
const route = useRoute()
const formDialogRef = ref()
const columnControlRef = ref<any>()
@@ -311,21 +311,21 @@ const importDialogVisible = ref(false)
const importFile = ref<File | null>(null)
const importLoading = ref(false)
// ?????
// 表格列配置
const tableColumns = [
{ prop: 'stuNo', label: '??' },
{ prop: 'schoolYear', label: '??' },
{ prop: 'schoolTerm', label: '??' },
{ prop: 'deptName', label: '??' },
{ prop: 'classNo', label: '??' },
{ prop: 'realName', label: '??' },
{ prop: 'conductType', label: '??' },
{ prop: 'recordDate', label: '????', width: 120 },
{ prop: 'description', label: '????', minWidth: 150 },
{ prop: 'attachment', label: '??', width: 100 }
{ prop: 'stuNo', label: '学号' },
{ prop: 'schoolYear', label: '学年' },
{ prop: 'schoolTerm', label: '学期' },
{ prop: 'deptName', label: '学院' },
{ prop: 'classNo', label: '班级' },
{ prop: 'realName', label: '姓名' },
{ prop: 'conductType', label: '类型' },
{ prop: 'recordDate', label: '记录日期', width: 120 },
{ prop: 'description', label: '描述说明', minWidth: 150 },
{ prop: 'attachment', label: '附件', width: 100 }
]
// ????????????
// 列配置映射
const columnConfigMap: Record<string, { icon: any }> = {
stuNo: { icon: CreditCard },
schoolYear: { icon: Calendar },
@@ -339,7 +339,7 @@ const columnConfigMap: Record<string, { icon: any }> = {
attachment: { icon: Document }
}
// ???????hook
// 表格列控制hook
const {
visibleColumns,
visibleColumnsSorted,
@@ -348,7 +348,7 @@ const {
handleColumnOrderChange
} = useTableColumnControl(tableColumns, route.path)
// ?? useTable
// 使用 useTable
const state: BasicTableProps = reactive<BasicTableProps>({
queryForm: {
schoolYear: '',
@@ -374,7 +374,7 @@ const {
tableStyle
} = useTable(state)
// ?????
// 格式化学期
const formatSchoolTerm = (value: string | number) => {
if (value === null || value === undefined || value === '') {
return '-'
@@ -383,19 +383,19 @@ const formatSchoolTerm = (value: string | number) => {
return dictItem ? dictItem.label : value
}
// ?????
// 格式化类型
const formatType = (value: string) => {
if (!value) return '-'
const item = typeList.value.find((item: any) => item.value === value)
return item ? item.label : value
}
// ????
// 学院变化
const handleDeptChange = () => {
// ??????????????????
// 学院变化时清空班级选择
}
// ??
// 重置
const handleReset = () => {
searchFormRef.value?.resetFields()
state.queryForm.schoolYear = ''
@@ -407,7 +407,7 @@ const handleReset = () => {
getDataList()
}
// ????
// 查看附件
const handleViewAttachment = (row: any) => {
if (row.attachment) {
const urls = typeof row.attachment === 'string' ? row.attachment.split(',') : [row.attachment]
@@ -419,61 +419,61 @@ const handleViewAttachment = (row: any) => {
}
}
// ??
// 导入
const handleImport = () => {
importDialogVisible.value = true
importFile.value = null
uploadRef.value?.clearFiles()
}
// ????
// 文件变化
const handleFileChange = (file: any) => {
importFile.value = file.raw
}
// ????
// 提交导入
const handleImportSubmit = async () => {
if (!importFile.value) {
useMessage().warning('?????????')
useMessage().warning('请先选择要上传的文件')
return
}
importLoading.value = true
try {
await importExcel(importFile.value)
useMessage().success('????')
useMessage().success('导入成功')
importDialogVisible.value = false
importFile.value = null
uploadRef.value?.clearFiles()
getDataList()
} catch (err: any) {
useMessage().error(err.msg || '????')
useMessage().error(err.msg || '导入失败')
} finally {
importLoading.value = false
}
}
// ??
// 编辑
const handleEdit = (row: any) => {
formDialogRef.value?.openDialog('edit', row)
}
// ??
// 删除
const handleDelete = async (row: any) => {
const { confirm } = useMessageBox()
try {
await confirm('??????????????')
await confirm('确定要删除该记录吗?')
await delObj([row.id])
useMessage().success('????')
useMessage().success('删除成功')
getDataList()
} catch (err: any) {
if (err !== 'cancel') {
useMessage().error(err.msg || '????')
useMessage().error(err.msg || '删除失败')
}
}
}
// ??????
// 获取学年列表
const getSchoolYearList = async () => {
try {
const res = await queryAllSchoolYear()
@@ -487,7 +487,7 @@ const getSchoolYearList = async () => {
}
}
// ??????
// 获取学期字典
const getSchoolTermDict = async () => {
try {
const res = await getDicts('school_term')
@@ -504,7 +504,7 @@ const getSchoolTermDict = async () => {
}
}
// ??????
// 获取学院列表
const getDeptListData = async () => {
try {
const res = await getDeptList()
@@ -518,7 +518,7 @@ const getDeptListData = async () => {
}
}
// ??????
// 获取班级列表
const getClassListData = async () => {
try {
const res = await getClassListByRole()
@@ -532,7 +532,7 @@ const getClassListData = async () => {
}
}
// ??????
// 获取类型字典
const getTypeDict = async () => {
try {
const res = await getDicts('conduct_type')
@@ -549,7 +549,7 @@ const getTypeDict = async () => {
}
}
// ???
// 初始化
onMounted(() => {
getSchoolYearList()
getSchoolTermDict()

View File

@@ -1,21 +1,21 @@
<template>
<div class="modern-page-container">
<div class="page-wrapper">
<!-- ???? -->
<!-- 查询条件 -->
<el-card v-show="showSearch" class="search-card" shadow="never">
<template #header>
<div class="card-header">
<span class="card-title">
<el-icon class="title-icon"><Search /></el-icon>
????
查询条件
</span>
</div>
</template>
<el-form :model="searchForm" ref="searchFormRef" :inline="true" @keyup.enter="handleSearch" class="search-form">
<el-form-item label="??" prop="schoolYear">
<el-form-item label="学年" prop="schoolYear">
<el-select
v-model="searchForm.schoolYear"
placeholder="?????"
placeholder="请选择学年"
clearable
filterable
style="width: 200px">
@@ -27,10 +27,10 @@
</el-option>
</el-select>
</el-form-item>
<el-form-item label="??" prop="schoolTerm">
<el-form-item label="学期" prop="schoolTerm">
<el-select
v-model="searchForm.schoolTerm"
placeholder="?????"
placeholder="请选择学期"
clearable
style="width: 200px">
<el-option
@@ -41,10 +41,10 @@
</el-option>
</el-select>
</el-form-item>
<el-form-item label="??" prop="deptCode">
<el-form-item label="学院" prop="deptCode">
<el-select
v-model="searchForm.deptCode"
placeholder="?????"
placeholder="请选择学院"
clearable
filterable
style="width: 200px">
@@ -56,10 +56,10 @@
</el-option>
</el-select>
</el-form-item>
<el-form-item label="??" prop="classCode">
<el-form-item label="班级" prop="classCode">
<el-select
v-model="searchForm.classCode"
placeholder="?????"
placeholder="请选择班级"
clearable
filterable
style="width: 200px">
@@ -71,34 +71,34 @@
</el-option>
</el-select>
</el-form-item>
<el-form-item label="??" prop="realName">
<el-form-item label="姓名" prop="realName">
<el-input
v-model="searchForm.realName"
placeholder="?????"
placeholder="请输入姓名"
clearable
style="width: 200px" />
</el-form-item>
<el-form-item label="??" prop="stuNo">
<el-form-item label="学号" prop="stuNo">
<el-input
v-model="searchForm.stuNo"
placeholder="?????"
placeholder="请输入学号"
clearable
style="width: 200px" />
</el-form-item>
<el-form-item label="????" prop="punlishMonth">
<el-form-item label="处分月份" prop="punlishMonth">
<el-date-picker
v-model="searchForm.punlishMonth"
type="month"
placeholder="??????"
placeholder="请选择处分月份"
format="YYYY-MM"
value-format="YYYY-MM"
clearable
style="width: 200px" />
</el-form-item>
<el-form-item label="????" prop="punlishLevel">
<el-form-item label="处分等级" prop="punlishLevel">
<el-select
v-model="searchForm.punlishLevel"
placeholder="???????"
placeholder="请选择处分等级"
clearable
style="width: 200px">
<el-option
@@ -110,33 +110,33 @@
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" plain icon="Search" @click="handleSearch">??</el-button>
<el-button icon="Refresh" @click="handleReset">??</el-button>
<el-button type="primary" plain icon="Search" @click="handleSearch">查询</el-button>
<el-button icon="Refresh" @click="handleReset">重置</el-button>
</el-form-item>
</el-form>
</el-card>
<!-- ???? -->
<!-- 数据列表 -->
<el-card class="content-card" shadow="never">
<template #header>
<div class="card-header">
<span class="card-title">
<el-icon class="title-icon"><Document /></el-icon>
??????
学生处分列表
</span>
<div class="header-actions">
<el-button
icon="FolderAdd"
type="primary"
@click="formDialogRef.openDialog()">
??
新增
</el-button>
<el-button
icon="Download"
type="success"
class="ml10"
@click="handleExport">
??
导出
</el-button>
<right-toolbar
v-model:showSearch="showSearch"
@@ -152,7 +152,7 @@
@order-change="handleColumnOrderChange"
>
<template #trigger>
<el-tooltip class="item" effect="dark" content="???" placement="top">
<el-tooltip class="item" effect="dark" content="列设置" placement="top">
<el-button circle style="margin-left: 0;">
<el-icon><Menu /></el-icon>
</el-button>
@@ -164,7 +164,7 @@
</div>
</template>
<!-- ?? -->
<!-- 表格 -->
<el-table
:data="state.dataList"
v-loading="state.loading"
@@ -172,7 +172,7 @@
:cell-style="tableStyle.cellStyle"
:header-cell-style="tableStyle.headerCellStyle"
class="modern-table">
<el-table-column type="index" label="??" width="70" align="center">
<el-table-column type="index" label="序号" width="70" align="center">
<template #header>
<el-icon><List /></el-icon>
</template>
@@ -182,7 +182,7 @@
</el-table-column>
<template v-for="col in visibleColumnsSorted" :key="col.prop || col.label">
<el-table-column
v-if="checkColumnVisible(col.prop || '') && col.prop !== '??'"
v-if="checkColumnVisible(col.prop || '') && col.prop !== '序号'"
:prop="col.prop"
:label="col.label"
show-overflow-tooltip
@@ -193,40 +193,40 @@
<el-icon><component :is="columnConfigMap[col.prop]?.icon || Calendar" /></el-icon>
<span style="margin-left: 4px">{{ col.label }}</span>
</template>
<!-- ???? -->
<!-- 学期 -->
<template v-if="col.prop === 'schoolTerm'" #default="scope">
<el-tag size="small" type="primary" effect="plain">
{{ formatSchoolTerm(scope.row.schoolTerm) }}
</el-tag>
</template>
<!-- ?????? -->
<!-- 处分开始日期 -->
<template v-else-if="col.prop === 'punlishStartDate'" #default="scope">
<span>{{ scope.row.punlishStartDate ? formatDate(scope.row.punlishStartDate) : '-' }}</span>
</template>
<!-- ?????? -->
<!-- 处分结束日期 -->
<template v-else-if="col.prop === 'punlishEndDate'" #default="scope">
<span>{{ scope.row.punlishEndDate ? formatDate(scope.row.punlishEndDate) : '-' }}</span>
</template>
<!-- ?????? -->
<!-- 处分等级 -->
<template v-else-if="col.prop === 'punlishLevel'" #default="scope">
<el-tag size="small" type="danger" effect="plain">
{{ formatPunlishLevel(scope.row.punlishLevel) }}
</el-tag>
</template>
<!-- ???? -->
<!-- 状态 -->
<template v-else-if="col.prop === 'publishStatus'" #default="scope">
<StatusTag
:value="scope.row.publishStatus"
:options="[{ label: '??', value: '1' }, { label: '???', value: '2' }, { label: '???', value: '3' }]"
:options="[{ label: '已发布', value: '1' }, { label: '已撤销', value: '2' }, { label: '已取消', value: '3' }]"
:type-map="{ '1': { type: 'danger', effect: 'light' }, '2': { type: 'success', effect: 'light' }, '3': { type: 'info', effect: 'light' } }"
/>
</template>
</el-table-column>
</template>
<el-table-column label="??" width="250" align="center" fixed="right">
<el-table-column label="操作" width="250" align="center" fixed="right">
<template #header>
<el-icon><Setting /></el-icon>
<span style="margin-left: 4px">??</span>
<span style="margin-left: 4px">操作</span>
</template>
<template #default="scope">
<el-button
@@ -234,34 +234,34 @@
link
type="primary"
@click="handleReport(scope.row)">
????
处分报告
</el-button>
<el-button
icon="CircleClose"
link
type="warning"
@click="handleCancel(scope.row)">
????
撤销处分
</el-button>
<el-button
icon="Edit"
link
type="primary"
@click="handleEdit(scope.row)">
??
编辑
</el-button>
<el-button
icon="Delete"
link
type="danger"
@click="handleDelete(scope.row)">
??
删除
</el-button>
</template>
</el-table-column>
</el-table>
<!-- ?? -->
<!-- 分页 -->
<div class="pagination-wrapper">
<pagination
@size-change="sizeChangeHandle"
@@ -271,7 +271,7 @@
</el-card>
</div>
<!-- ??/???? -->
<!-- 新增/编辑 -->
<form-dialog ref="formDialogRef" @refresh="getDataList" />
</div>
</template>
@@ -294,7 +294,7 @@ import { useTableColumnControl } from '/@/hooks/tableColumn'
import { defineAsyncComponent } from 'vue'
const StatusTag = defineAsyncComponent(() => import('/@/components/StatusTag/index.vue'))
// ???
// 定义变量
const route = useRoute()
const searchFormRef = ref()
const columnControlRef = ref<any>()
@@ -307,22 +307,22 @@ const punlishLevelList = ref<any[]>([])
const publishStatusList = ref<any[]>([])
const formDialogRef = ref()
// ???
// 表格列配置
const tableColumns = [
{ prop: 'schoolYear', label: '??' },
{ prop: 'schoolTerm', label: '??' },
{ prop: 'deptName', label: '??' },
{ prop: 'classNo', label: '??' },
{ prop: 'stuRealName', label: '??' },
{ prop: 'stuNo', label: '??' },
{ prop: 'punlishStartDate', label: '??????', width: 180 },
{ prop: 'punlishEndDate', label: '???', width: 180 },
{ prop: 'punlishLevel', label: '????' },
{ prop: 'punlishContent', label: '????', minWidth: 150 },
{ prop: 'publishStatus', label: '????' }
{ prop: 'schoolYear', label: '学年' },
{ prop: 'schoolTerm', label: '学期' },
{ prop: 'deptName', label: '学院' },
{ prop: 'classNo', label: '班级' },
{ prop: 'stuRealName', label: '姓名' },
{ prop: 'stuNo', label: '学号' },
{ prop: 'punlishStartDate', label: '处分开始日期', width: 180 },
{ prop: 'punlishEndDate', label: '结束日期', width: 180 },
{ prop: 'punlishLevel', label: '处分等级' },
{ prop: 'punlishContent', label: '处分内容', minWidth: 150 },
{ prop: 'publishStatus', label: '发布状态' }
]
// ?????
// 列配置映射
const columnConfigMap: Record<string, { icon: any }> = {
schoolYear: { icon: Calendar },
schoolTerm: { icon: Clock },
@@ -337,16 +337,16 @@ const columnConfigMap: Record<string, { icon: any }> = {
publishStatus: { icon: CircleCheck }
}
// ????? hook
// 表格列控制 hook
const {
visibleColumns,
visibleColumnsSorted,
checkColumnVisible,
handleColumnChange,
handleColumnOrderChange
} = useTableColumnControl(tableColumns, route.path)
} = useTableColumnControl(tableColumns)
// ????
// 搜索表单
const searchForm = reactive({
schoolYear: '',
schoolTerm: '',
@@ -359,11 +359,11 @@ const searchForm = reactive({
punlishMonthArray: [] as string[]
})
// ?? useTable
// 使用 useTable
const state: BasicTableProps = reactive<BasicTableProps>({
queryForm: searchForm,
pageList: async (params: any) => {
// ???????? API
// 处理处分月份参数 API
const queryParams = { ...params }
if (queryParams.punlishMonth) {
queryParams.punlishMonth = [queryParams.punlishMonth]
@@ -388,7 +388,7 @@ const {
tableStyle
} = useTable(state)
// ?????
// 格式化学期
const formatSchoolTerm = (value: string | number) => {
if (value === null || value === undefined || value === '') {
return '-'
@@ -397,36 +397,36 @@ const formatSchoolTerm = (value: string | number) => {
return dictItem ? dictItem.label : value
}
// ?????
// 格式化日期
const formatDate = (dateStr: string) => {
if (!dateStr) return '-'
// ??????????
// 处理日期时间格式
if (dateStr.includes(' ')) {
return dateStr.split(' ')[0]
}
return dateStr
}
// ???????
// 格式化处分等级
const formatPunlishLevel = (value: string) => {
if (!value) return '-'
const item = punlishLevelList.value.find((item: any) => item.value === value)
return item ? item.label : value
}
// ???????
// 格式化发布状态
const formatPublishStatus = (value: string) => {
if (!value) return '-'
const item = publishStatusList.value.find((item: any) => item.value === value)
return item ? item.label : value
}
// ??
// 查询
const handleSearch = () => {
getDataList()
}
// ??
// 重置
const handleReset = () => {
searchFormRef.value?.resetFields()
searchForm.schoolYear = ''
@@ -440,65 +440,65 @@ const handleReset = () => {
getDataList()
}
// ??
// 编辑
const handleEdit = (row: any) => {
formDialogRef.value?.openDialog('edit', row)
}
// ??
// 删除
const handleDelete = async (row: any) => {
try {
await useMessageBox().confirm('???????????')
await useMessageBox().confirm('确定要删除该记录吗?')
await delObj([row.id])
useMessage().success('????')
useMessage().success('删除成功')
getDataList()
} catch (err: any) {
if (err !== 'cancel') {
useMessage().error(err.msg || '????')
useMessage().error(err.msg || '删除失败')
}
}
}
// ????
// 处分报告
const handleReport = (row: any) => {
useMessage().info('?????????')
// TODO: ??????
useMessage().info('功能开发中')
// TODO: 实现处分报告
}
// ????
// 撤销处分
const handleCancel = async (row: any) => {
const { confirm } = useMessageBox()
try {
await confirm('??????????')
await confirm('确定要撤销该处分吗?')
// ??????
// 获取详情数据
const res = await getDetail(row.id)
if (!res.data) {
useMessage().error('????????')
useMessage().error('获取数据失败')
return
}
// ? publishStatus ?? "0" ????
// publishStatus 设置为 "0" 表示撤销
const updateData = {
...res.data,
publishStatus: '0'
}
await revokePunishment(updateData)
useMessage().success('??????')
useMessage().success('撤销成功')
getDataList()
} catch (err: any) {
if (err !== 'cancel') {
useMessage().error(err.msg || '??????')
useMessage().error(err.msg || '撤销失败')
}
}
}
// ??
// 导出
const handleExport = async () => {
try {
const params: any = { ...searchForm }
// ???????? API
// 处理处分月份参数 API
if (params.punlishMonth) {
params.punlishMonth = [params.punlishMonth]
} else {
@@ -506,23 +506,23 @@ const handleExport = async () => {
}
delete params.punlishMonthArray
const res = await exportData(params)
// ????
// 下载文件
const blob = new Blob([res.data])
const elink = document.createElement('a')
elink.download = '????.xlsx'
elink.download = '学生处分.xlsx'
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('????')
useMessage().success('导出成功')
} catch (err: any) {
useMessage().error(err.msg || '????')
useMessage().error(err.msg || '导出失败')
}
}
// ??????
// 获取学年列表
const getSchoolYearList = async () => {
try {
const res = await queryAllSchoolYear()
@@ -534,7 +534,7 @@ const getSchoolYearList = async () => {
}
}
// ??????
// 获取学期字典
const getSchoolTermDict = async () => {
try {
const res = await getDicts('school_term')
@@ -549,7 +549,7 @@ const getSchoolTermDict = async () => {
}
}
// ??????
// 获取学院列表
const getDeptListData = async () => {
try {
const res = await getDeptListByLevelTwo()
@@ -561,7 +561,7 @@ const getDeptListData = async () => {
}
}
// ??????
// 获取班级列表
const getClassListData = async () => {
try {
const res = await getClassListByRole()
@@ -573,7 +573,7 @@ const getClassListData = async () => {
}
}
// ????????
// 获取处分等级字典
const getPunlishLevelDict = async () => {
try {
const res = await getDicts('punlish_level')
@@ -588,7 +588,7 @@ const getPunlishLevelDict = async () => {
}
}
// ????????
// 获取发布状态字典
const getPublishStatusDict = async () => {
try {
const res = await getDicts('publish_status')

View File

@@ -1,13 +1,13 @@
<template>
<div class="modern-page-container">
<div class="page-wrapper">
<!-- ?????? -->
<!-- 查询条件 -->
<el-card v-show="showSearch" class="search-card" shadow="never">
<template #header>
<div class="card-header">
<span class="card-title">
<el-icon class="title-icon"><Search /></el-icon>
????
查询条件
</span>
</div>
</template>
@@ -15,7 +15,7 @@
<el-form-item label="班级" prop="classCode">
<el-select
v-model="state.queryForm.classCode"
placeholder="请选择学年"
placeholder="请选择班级"
clearable
filterable
style="width: 200px">
@@ -27,10 +27,10 @@
</el-option>
</el-select>
</el-form-item>
<el-form-item label="??" prop="classNo">
<el-form-item label="班级编号" prop="classNo">
<el-input
v-model="state.queryForm.classNo"
placeholder="请输入姓名"
placeholder="请输入班级编号"
clearable
style="width: 200px" />
</el-form-item>
@@ -41,17 +41,17 @@
clearable
style="width: 200px" />
</el-form-item>
<el-form-item label="????" prop="serNo">
<el-form-item label="序列号" prop="serNo">
<el-input
v-model="state.queryForm.serNo"
placeholder="请输入奖项名称"
placeholder="请输入序列号"
clearable
style="width: 200px" />
</el-form-item>
<el-form-item label="入学年份" prop="grade">
<el-select
v-model="state.queryForm.grade"
placeholder="请输入奖项名称"
placeholder="请选择入学年份"
clearable
style="width: 200px">
<el-option
@@ -63,40 +63,40 @@
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" plain icon="Search" @click="getDataList">??</el-button>
<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-card>
<!-- ???? -->
<!-- 数据列表 -->
<el-card class="content-card" shadow="never">
<template #header>
<div class="card-header">
<span class="card-title">
<el-icon class="title-icon"><Document /></el-icon>
??????
学生团组织列表
</span>
<div class="header-actions">
<el-button
icon="Plus"
type="primary"
@click="formDialogRef.openDialog()">
??
新增
</el-button>
<el-button
icon="Upload"
type="success"
class="ml10"
@click="handleImport">
??
导入
</el-button>
<el-button
icon="Download"
type="warning"
class="ml10"
@click="handleExport">
??
导出
</el-button>
<right-toolbar
v-model:showSearch="showSearch"
@@ -153,11 +153,11 @@
<el-icon><component :is="columnConfigMap[col.prop]?.icon || Calendar" /></el-icon>
<span style="margin-left: 4px">{{ col.label }}</span>
</template>
<!-- ????????? -->
<!-- 入团时间格式化 -->
<template v-if="col.prop === 'enterTime'" #default="scope">
<span>{{ parseTime(scope.row.enterTime, '{y}-{m}-{d}') }}</span>
</template>
<!-- ????????? -->
<!-- 职务格式化 -->
<template v-else-if="col.prop === 'position'" #default="scope">
<el-tag v-if="scope.row.position" size="small" type="primary" effect="plain">
{{ scope.row.position }}
@@ -200,12 +200,12 @@
</el-card>
</div>
<!-- ??/?????? -->
<!-- 新增/编辑对话框 -->
<form-dialog ref="formDialogRef" @refresh="getDataList" />
<!-- ???? -->
<!-- 导入对话框 -->
<el-dialog
title="????"
title="导入数据"
v-model="importDialogVisible"
:close-on-click-modal="false"
width="500px">
@@ -220,18 +220,18 @@
drag>
<el-icon class="el-icon--upload"><upload-filled /></el-icon>
<div class="el-upload__text">
????????<em>????</em>
将文件拖到此处<em>点击上传</em>
</div>
<template #tip>
<div class="el-upload__tip">
???? xlsx/xls ??
只能上传 xlsx/xls 文件
</div>
</template>
</el-upload>
<template #footer>
<span class="dialog-footer">
<el-button @click="importDialogVisible = false">取消</el-button>
<el-button type="primary" @click="handleImportSubmit" :loading="importLoading">??</el-button>
<el-button type="primary" @click="handleImportSubmit" :loading="importLoading">确认</el-button>
</span>
</template>
</el-dialog>
@@ -254,7 +254,7 @@ import { useTableColumnControl } from '/@/hooks/tableColumn'
import type { UploadFile, UploadFiles } from 'element-plus';
import FormDialog from './form.vue'
// ??????
// 定义变量
const route = useRoute()
const formDialogRef = ref()
const columnControlRef = ref<any>()
@@ -267,19 +267,19 @@ const importDialogVisible = ref(false)
const importLoading = ref(false)
const fileList = ref<UploadFile[]>([])
// ?????
// 表格列配置
const tableColumns = [
{ prop: 'deptName', label: '????', minWidth: 150 },
{ prop: 'classNo', label: '??', width: 120 },
{ prop: 'stuNo', label: '??', width: 120 },
{ prop: 'realName', label: '??', width: 100 },
{ prop: 'phone', label: '???', width: 120 },
{ prop: 'enterTime', label: '????', width: 120 },
{ prop: 'serNo', label: '????', width: 120 },
{ prop: 'position', label: '????', width: 120 }
{ prop: 'deptName', label: '学院名称', minWidth: 150 },
{ prop: 'classNo', label: '班级', width: 120 },
{ prop: 'stuNo', label: '学号', width: 120 },
{ prop: 'realName', label: '姓名', width: 100 },
{ prop: 'phone', label: '手机号', width: 120 },
{ prop: 'enterTime', label: '入团时间', width: 120 },
{ prop: 'serNo', label: '序列号', width: 120 },
{ prop: 'position', label: '职务名称', width: 120 }
]
// ?????????????
// 列配置映射
const columnConfigMap: Record<string, { icon: any }> = {
deptName: { icon: OfficeBuilding },
classNo: { icon: Grid },
@@ -291,22 +291,22 @@ const columnConfigMap: Record<string, { icon: any }> = {
position: { icon: Briefcase }
}
// ???????hook
// 表格列控制hook
const {
visibleColumns,
visibleColumnsSorted,
checkColumnVisible,
handleColumnChange,
handleColumnOrderChange
} = useTableColumnControl(tableColumns, route.path)
} = useTableColumnControl(tableColumns)
// ????
// 表格样式
const tableStyle = {
cellStyle: { padding: '8px 0' },
headerCellStyle: { background: '#f5f7fa', color: '#606266', fontWeight: 'bold' }
}
// ?? useTable
// 使用 useTable
const state: BasicTableProps = reactive<BasicTableProps>({
queryForm: {
classCode: '',
@@ -331,7 +331,7 @@ const {
tableStyle: _tableStyle
} = useTable(state)
// ??
// 重置
const handleReset = () => {
searchFormRef.value?.resetFields()
state.queryForm.classCode = ''
@@ -342,70 +342,70 @@ const handleReset = () => {
getDataList()
}
// ??
// 编辑
const handleEdit = (row: any) => {
formDialogRef.value?.openDialog('edit', row)
}
// ??
// 删除
const handleDelete = async (row: any) => {
const { confirm } = useMessageBox()
try {
await confirm('???????????')
await confirm('确定要删除该记录吗?')
await delObj([row.id])
useMessage().success('????')
useMessage().success('删除成功')
getDataList()
} catch (err: any) {
if (err !== 'cancel') {
useMessage().error(err.msg || '????')
useMessage().error(err.msg || '删除失败')
}
}
}
// ??
// 导入
const handleImport = () => {
importDialogVisible.value = true
fileList.value = []
}
// ????
// 文件变化
const handleFileChange = (file: UploadFile, files: UploadFiles) => {
fileList.value = [file]
}
// ??????
// 文件超出限制
const handleExceed = () => {
useMessage().warning('????????')
useMessage().warning('文件数量超出限制')
}
// ????
// 提交导入
const handleImportSubmit = async () => {
if (fileList.value.length === 0) {
useMessage().warning('?????????')
useMessage().warning('请先选择要上传的文件')
return
}
const file = fileList.value[0].raw
if (!file) {
useMessage().warning('?????')
useMessage().warning('文件无效')
return
}
importLoading.value = true
try {
await importExcel(file as File)
useMessage().success('????')
useMessage().success('导入成功')
importDialogVisible.value = false
fileList.value = []
getDataList()
} catch (err: any) {
useMessage().error(err.msg || '????')
useMessage().error(err.msg || '导入失败')
} finally {
importLoading.value = false
}
}
// ??
// 导出
const handleExport = async () => {
try {
const res = await exportExcel(state.queryForm)
@@ -413,18 +413,18 @@ const handleExport = async () => {
const url = window.URL.createObjectURL(blob)
const link = document.createElement('a')
link.href = url
link.download = `??_${parseTime(new Date(), '{y}{m}{d}{h}{i}{s}')}.xlsx`
link.download = `学生团组织_${parseTime(new Date(), '{y}{m}{d}{h}{i}{s}')}.xlsx`
document.body.appendChild(link)
link.click()
document.body.removeChild(link)
window.URL.revokeObjectURL(url)
useMessage().success('????')
useMessage().success('导出成功')
} catch (err: any) {
useMessage().error(err.msg || '????')
useMessage().error(err.msg || '导出失败')
}
}
// ??????
// 获取班级列表
const getClassListData = async () => {
try {
const res = await getClassListByRole()
@@ -438,7 +438,7 @@ const getClassListData = async () => {
}
}
// ????????
// 获取入学年份列表
const getGradeListData = async () => {
try {
const res = await getGradeList()

View File

@@ -1,21 +1,21 @@
<template>
<div class="modern-page-container">
<div class="page-wrapper">
<!-- ?????? -->
<!-- 查询条件 -->
<el-card v-show="showSearch" class="search-card" shadow="never">
<template #header>
<div class="card-header">
<span class="card-title">
<el-icon class="title-icon"><Search /></el-icon>
?????
查询条件
</span>
</div>
</template>
<el-form :model="state.queryForm" ref="searchFormRef" :inline="true" @keyup.enter="getDataList" class="search-form">
<el-form-item label="??" prop="termId">
<el-form-item label="学期" prop="termId">
<el-select
v-model="state.queryForm.termId"
placeholder="?????"
placeholder="请选择学期"
clearable
filterable
style="width: 200px">
@@ -27,10 +27,10 @@
</el-option>
</el-select>
</el-form-item>
<el-form-item label="??" prop="deptCode">
<el-form-item label="学院" prop="deptCode">
<el-select
v-model="state.queryForm.deptCode"
placeholder="?????"
placeholder="请选择学院"
clearable
filterable
style="width: 200px">
@@ -42,10 +42,10 @@
</el-option>
</el-select>
</el-form-item>
<el-form-item label="????" prop="grade">
<el-form-item label="入学年份" prop="grade">
<el-select
v-model="state.queryForm.grade"
placeholder="???????"
placeholder="请选择入学年份"
clearable
filterable
style="width: 200px">
@@ -57,19 +57,19 @@
</el-option>
</el-select>
</el-form-item>
<el-form-item label="??" prop="gradeCurr">
<el-form-item label="年级" prop="gradeCurr">
<el-input-number
v-model="state.queryForm.gradeCurr"
placeholder="?????"
placeholder="请输入年级"
:min="1"
:max="10"
clearable
style="width: 200px" />
</el-form-item>
<el-form-item label="??" prop="classCode">
<el-form-item label="班级" prop="classCode">
<el-select
v-model="state.queryForm.classCode"
placeholder="?????"
placeholder="请选择班级"
clearable
filterable
style="width: 200px">
@@ -81,10 +81,10 @@
</el-option>
</el-select>
</el-form-item>
<el-form-item label="????" prop="checkStatus">
<el-form-item label="审核状态" prop="checkStatus">
<el-select
v-model="state.queryForm.checkStatus"
placeholder="???????"
placeholder="请选择审核状态"
clearable
style="width: 200px">
<el-option
@@ -96,26 +96,26 @@
</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-button type="primary" plain icon="Search" @click="getDataList">查询</el-button>
<el-button icon="Refresh" @click="handleReset">重置</el-button>
</el-form-item>
</el-form>
</el-card>
<!-- ???? -->
<!-- 数据列表 -->
<el-card class="content-card" shadow="never">
<template #header>
<div class="card-header">
<span class="card-title">
<el-icon class="title-icon"><Document /></el-icon>
????????
免学费学生列表
</span>
<div class="header-actions">
<el-button
icon="Plus"
type="primary"
@click="handleAdd">
??
新增
</el-button>
<el-button
icon="Download"
@@ -123,7 +123,7 @@
class="ml10"
:loading="exportLoading"
@click="handleExport">
??
导出
</el-button>
<right-toolbar
v-model:showSearch="showSearch"
@@ -139,7 +139,7 @@
@order-change="handleColumnOrderChange"
>
<template #trigger>
<el-tooltip class="item" effect="dark" content="???" placement="top">
<el-tooltip class="item" effect="dark" content="列设置" placement="top">
<el-button circle style="margin-left: 0;">
<el-icon><Menu /></el-icon>
</el-button>
@@ -151,7 +151,7 @@
</div>
</template>
<!-- ?? -->
<!-- 表格 -->
<el-table
:data="state.dataList"
v-loading="state.loading"
@@ -159,7 +159,7 @@
:cell-style="tableStyle.cellStyle"
:header-cell-style="tableStyle.headerCellStyle"
class="modern-table">
<el-table-column type="index" label="??" width="70" align="center">
<el-table-column type="index" label="序号" width="70" align="center">
<template #header>
<el-icon><List /></el-icon>
</template>
@@ -169,7 +169,7 @@
</el-table-column>
<template v-for="col in visibleColumnsSorted" :key="col.prop || col.label">
<el-table-column
v-if="checkColumnVisible(col.prop || '') && col.prop !== '??'"
v-if="checkColumnVisible(col.prop || '') && col.prop !== '序号'"
:prop="col.prop"
:label="col.label"
show-overflow-tooltip
@@ -180,39 +180,39 @@
<el-icon><component :is="columnConfigMap[col.prop]?.icon || Calendar" /></el-icon>
<span style="margin-left: 4px">{{ col.label }}</span>
</template>
<!-- ????????-->
<!-- 年级格式化-->
<template v-if="col.prop === 'gradeCurr'" #default="scope">
<el-tag v-if="scope.row.gradeCurr !== undefined && scope.row.gradeCurr !== null" size="small" type="primary" effect="plain">
{{ scope.row.gradeCurr }}
</el-tag>
<span v-else>-</span>
</template>
<!-- ????????-->
<!-- 性别格式化-->
<template v-else-if="col.prop === 'gender'" #default="scope">
<GenderTag :sex="scope.row.gender" />
</template>
<!-- ????????-->
<!-- 学历格式化-->
<template v-else-if="col.prop === 'education'" #default="scope">
<el-tag v-if="scope.row.education" size="small" type="info" effect="plain">
{{ formatEducation(scope.row.education) }}
</el-tag>
<span v-else>-</span>
</template>
<!-- ????????-->
<!-- 专业层次格式化-->
<template v-else-if="col.prop === 'majorLevel'" #default="scope">
<el-tag v-if="scope.row.majorLevel" size="small" type="warning" effect="plain">
{{ formatMajorLevel(scope.row.majorLevel) }}
</el-tag>
<span v-else>-</span>
</template>
<!-- ????????-->
<!-- 金额格式化-->
<template v-else-if="col.prop === 'money'" #default="scope">
<el-tag v-if="scope.row.money !== undefined && scope.row.money !== null" size="small" type="success" effect="plain">
?{{ scope.row.money }}
¥{{ scope.row.money }}
</el-tag>
<span v-else>-</span>
</template>
<!-- ????????? -->
<!-- 审核状态格式化 -->
<template v-else-if="col.prop === 'checkStatus'" #default="scope">
<StatusTag
:value="scope.row.checkStatus"
@@ -222,10 +222,10 @@
</template>
</el-table-column>
</template>
<el-table-column label="??" width="150" align="center" fixed="right">
<el-table-column label="操作" width="150" align="center" fixed="right">
<template #header>
<el-icon><Setting /></el-icon>
<span style="margin-left: 4px">??</span>
<span style="margin-left: 4px">操作</span>
</template>
<template #default="scope">
<el-button
@@ -233,20 +233,20 @@
link
type="primary"
@click="handleEdit(scope.row)">
??
编辑
</el-button>
<el-button
icon="Delete"
link
type="danger"
@click="handleDelete(scope.row)">
??
删除
</el-button>
</template>
</el-table-column>
</el-table>
<!-- ?? -->
<!-- 分页 -->
<div class="pagination-wrapper">
<pagination
@size-change="sizeChangeHandle"
@@ -256,7 +256,7 @@
</el-card>
</div>
<!-- ??/?????? -->
<!-- 新增/编辑对话框 -->
<!-- <form-dialog ref="formDialogRef" @refresh="getDataList" /> -->
</div>
</template>
@@ -282,11 +282,11 @@ import {
import { useTableColumnControl } from '/@/hooks/tableColumn'
// ????
// 异步组件
const GenderTag = defineAsyncComponent(() => import('/@/components/GenderTag/index.vue'))
const StatusTag = defineAsyncComponent(() => import('/@/components/StatusTag/index.vue'))
// ??????
// 定义变量
const route = useRoute()
const searchFormRef = ref()
const columnControlRef = ref<any>()
@@ -301,29 +301,29 @@ const genderList = ref<any[]>([])
const educationList = ref<any[]>([])
const majorLevelList = ref<any[]>([])
const checkStatusList = ref<any[]>([
{ label: '???', value: '0' },
{ label: '????', value: '1' }
{ label: '未审核', value: '0' },
{ label: '已审核', value: '1' }
])
// ??????
// 表格列配置
const tableColumns = [
{ prop: 'deptName', label: '??', minWidth: 150 },
{ prop: 'majorName', label: '??', minWidth: 150 },
{ prop: 'teacherName', label: '???', width: 100 },
{ prop: 'grade', label: '????', width: 100 },
{ prop: 'gradeCurr', label: '??', width: 80 },
{ prop: 'classNo', label: '??', width: 120 },
{ prop: 'stuNo', label: '??', width: 120 },
{ prop: 'realName', label: '??', width: 100 },
{ prop: 'gender', label: '??', width: 80 },
{ prop: 'education', label: '??', width: 100 },
{ prop: 'majorLevel', label: '??', width: 100 },
{ prop: 'phone', label: '????', width: 120 },
{ prop: 'money', label: '??', width: 100 },
{ prop: 'checkStatus', label: '????', width: 100 }
{ prop: 'deptName', label: '学院', minWidth: 150 },
{ prop: 'majorName', label: '专业', minWidth: 150 },
{ prop: 'teacherName', label: '班主任', width: 100 },
{ prop: 'grade', label: '入学年份', width: 100 },
{ prop: 'gradeCurr', label: '年级', width: 80 },
{ prop: 'classNo', label: '班级', width: 120 },
{ prop: 'stuNo', label: '学号', width: 120 },
{ prop: 'realName', label: '姓名', width: 100 },
{ prop: 'gender', label: '性别', width: 80 },
{ prop: 'education', label: '学历', width: 100 },
{ prop: 'majorLevel', label: '层次', width: 100 },
{ prop: 'phone', label: '联系电话', width: 120 },
{ prop: 'money', label: '金额', width: 100 },
{ prop: 'checkStatus', label: '审核状态', width: 100 }
]
// ????????????
// 列配置映射
const columnConfigMap: Record<string, { icon: any }> = {
deptName: { icon: OfficeBuilding },
majorName: { icon: Reading },
@@ -341,22 +341,22 @@ const columnConfigMap: Record<string, { icon: any }> = {
checkStatus: { icon: CircleCheck }
}
// ???????hook
// 表格列控制hook
const {
visibleColumns,
visibleColumnsSorted,
checkColumnVisible,
handleColumnChange,
handleColumnOrderChange
} = useTableColumnControl(tableColumns, route.path)
} = useTableColumnControl(tableColumns)
// ????
// 表格样式
const tableStyle = {
cellStyle: { padding: '8px 0' },
headerCellStyle: { background: '#f5f7fa', color: '#606266', fontWeight: 'bold' }
}
// ?? useTable
// 使用 useTable
const state: BasicTableProps = reactive<BasicTableProps>({
queryForm: {
termId: '',
@@ -382,7 +382,7 @@ const {
tableStyle: _tableStyle
} = useTable(state)
// ?????
// 格式化性别
const formatGender = (value: string | number) => {
if (value === null || value === undefined || value === '') {
return '-'
@@ -391,7 +391,7 @@ const formatGender = (value: string | number) => {
return dictItem ? dictItem.label : value
}
// ??????
// 格式化学历
const formatEducation = (value: string | number) => {
if (value === null || value === undefined || value === '') {
return '-'
@@ -400,7 +400,7 @@ const formatEducation = (value: string | number) => {
return dictItem ? dictItem.label : value
}
// ??????
// 格式化层次
const formatMajorLevel = (value: string | number) => {
if (value === null || value === undefined || value === '') {
return '-'
@@ -409,7 +409,7 @@ const formatMajorLevel = (value: string | number) => {
return dictItem ? dictItem.label : value
}
// ????????
// 格式化审核状态
const formatCheckStatus = (value: string | number) => {
if (value === null || value === undefined || value === '') {
return '-'
@@ -418,7 +418,7 @@ const formatCheckStatus = (value: string | number) => {
return dictItem ? dictItem.label : value
}
// ??
// 重置
const handleReset = () => {
searchFormRef.value?.resetFields()
state.queryForm.termId = ''
@@ -430,40 +430,40 @@ const handleReset = () => {
getDataList()
}
// ??
// 新增
const handleAdd = () => {
useMessage().info('?????')
useMessage().info('功能开发中')
// formDialogRef.value?.openDialog('add')
}
// ??
// 编辑
const handleEdit = (row: any) => {
useMessage().info('?????')
useMessage().info('功能开发中')
// formDialogRef.value?.openDialog('edit', row.id)
}
// ??
// 删除
const handleDelete = async (row: any) => {
try {
const { confirm } = useMessageBox()
await confirm(`???????? ${row.stuNo} ????????`)
await confirm(`确定要删除学号为 ${row.stuNo} 的学生记录吗?`)
await delObj(row.id)
useMessage().success('????')
useMessage().success('删除成功')
getDataList()
} catch (err: any) {
if (err !== 'cancel') {
useMessage().error(err.msg || '????')
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 fileName = `免学费学生_${new Date().getTime()}.xls`
const elink = document.createElement('a')
elink.download = fileName
elink.style.display = 'none'
@@ -472,15 +472,15 @@ const handleExport = async () => {
elink.click()
URL.revokeObjectURL(elink.href)
document.body.removeChild(elink)
useMessage().success('????')
useMessage().success('导出成功')
} catch (err: any) {
useMessage().error(err.msg || '????')
useMessage().error(err.msg || '导出失败')
} finally {
exportLoading.value = false
}
}
// ??????
// 获取学期列表
const getTermList = async () => {
try {
const res = await request({
@@ -497,7 +497,7 @@ const getTermList = async () => {
}
}
// ??????
// 获取学院列表
const getDeptListData = async () => {
try {
const res = await getDeptList()
@@ -511,7 +511,7 @@ const getDeptListData = async () => {
}
}
// ??????
// 获取班级列表
const getClassListData = async () => {
try {
const res = await getClassListByRole()
@@ -525,7 +525,7 @@ const getClassListData = async () => {
}
}
// ????????
// 获取入学年份列表
const getGradeList = async () => {
try {
const res = await queryAllSchoolYear()
@@ -539,7 +539,7 @@ const getGradeList = async () => {
}
}
// ??????
// 获取性别字典
const getGenderDict = async () => {
try {
const res = await getDicts('sexy')
@@ -556,7 +556,7 @@ const getGenderDict = async () => {
}
}
// ??????
// 获取学历字典
const getEducationDict = async () => {
try {
const res = await getDicts('pre_school_education')
@@ -573,7 +573,7 @@ const getEducationDict = async () => {
}
}
// ??????
// 获取层次字典
const getMajorLevelDict = async () => {
try {
const res = await getDicts('basic_major_level')
@@ -590,7 +590,7 @@ const getMajorLevelDict = async () => {
}
}
// ????
// 初始化
onMounted(() => {
getTermList()
getDeptListData()

View File

@@ -1,40 +1,40 @@
<template>
<div class="modern-page-container">
<div class="page-wrapper">
<!-- ?????? -->
<!-- 查询条件 -->
<el-card v-show="showSearch" class="search-card" shadow="never">
<template #header>
<div class="card-header">
<span class="card-title">
<el-icon class="title-icon"><Search /></el-icon>
?????
查询条件
</span>
</div>
</template>
<el-form :model="searchForm" ref="searchFormRef" :inline="true" @keyup.enter="handleSearch" class="search-form">
<el-form-item label="????" prop="effectiveMoney">
<el-form-item label="有效金额" prop="effectiveMoney">
<el-input-number
v-model="searchForm.effectiveMoney"
placeholder="???????"
placeholder="请输入有效金额"
:precision="2"
:min="0"
clearable
style="width: 200px" />
</el-form-item>
<el-form-item label="????" prop="isLiveNum">
<el-form-item label="是否住人" prop="isLiveNum">
<el-select
v-model="searchForm.isLiveNum"
placeholder="?????"
placeholder="请选择"
clearable
style="width: 200px">
<el-option label="??0" :value="true" />
<el-option label="??0" :value="false" />
<el-option label="等于0" :value="true" />
<el-option label="不等于0" :value="false" />
</el-select>
</el-form-item>
<el-form-item label="??" prop="buildNo">
<el-form-item label="楼号" prop="buildNo">
<el-select
v-model="searchForm.buildNo"
placeholder="?????"
placeholder="请选择楼号"
clearable
filterable
style="width: 200px">
@@ -46,48 +46,48 @@
</el-option>
</el-select>
</el-form-item>
<el-form-item label="???" prop="roomNo">
<el-form-item label="房间号" prop="roomNo">
<el-input
v-model="searchForm.roomNo"
placeholder="??????"
placeholder="请输入房间号"
clearable
style="width: 200px" />
</el-form-item>
<el-form-item>
<el-button type="primary" plain icon="Search" @click="handleSearch">??</el-button>
<el-button icon="Refresh" @click="handleReset">??</el-button>
<el-button type="primary" plain icon="Search" @click="handleSearch">查询</el-button>
<el-button icon="Refresh" @click="handleReset">重置</el-button>
</el-form-item>
</el-form>
</el-card>
<!-- ???? -->
<!-- 数据列表 -->
<el-card class="content-card" shadow="never">
<template #header>
<div class="card-header">
<span class="card-title">
<el-icon class="title-icon"><Document /></el-icon>
??????
水费明细列表
</span>
<div class="header-actions">
<el-button
icon="FolderAdd"
type="primary"
@click="formDialogRef.openDialog()">
????
新增明细
</el-button>
<el-button
icon="Download"
type="success"
class="ml10"
@click="handleExport">
????
导出数据
</el-button>
<el-button
icon="Setting"
type="warning"
class="ml10"
@click="handleInitWaterOrder">
??????????
批量初始化订单
</el-button>
<right-toolbar
v-model:showSearch="showSearch"
@@ -103,7 +103,7 @@
@order-change="handleColumnOrderChange"
>
<template #trigger>
<el-tooltip class="item" effect="dark" content="???" placement="top">
<el-tooltip class="item" effect="dark" content="列设置" placement="top">
<el-button circle style="margin-left: 0;">
<el-icon><Menu /></el-icon>
</el-button>
@@ -115,7 +115,7 @@
</div>
</template>
<!-- ?? -->
<!-- 表格 -->
<el-table
:data="state.dataList"
v-loading="state.loading"
@@ -124,7 +124,7 @@
:header-cell-style="tableStyle.headerCellStyle"
class="modern-table"
@sort-change="sortChangeHandle">
<el-table-column type="index" label="??" width="70" align="center">
<el-table-column type="index" label="序号" width="70" align="center">
<template #header>
<el-icon><List /></el-icon>
</template>
@@ -134,7 +134,7 @@
</el-table-column>
<template v-for="col in visibleColumnsSorted" :key="col.prop || col.label">
<el-table-column
v-if="checkColumnVisible(col.prop || '') && col.prop !== '??'"
v-if="checkColumnVisible(col.prop || '') && col.prop !== '序号'"
:prop="col.prop"
:label="col.label"
show-overflow-tooltip
@@ -145,53 +145,53 @@
<el-icon><component :is="columnConfigMap[col.prop]?.icon || Money" /></el-icon>
<span style="margin-left: 4px">{{ col.label }}</span>
</template>
<!-- ???????? -->
<!-- 床位号格式化 -->
<template v-if="col.prop === 'bedNum'" #default="scope">
<el-tag v-if="scope.row.bedNum" size="small" type="info" effect="plain">
{{ scope.row.bedNum }}??
{{ scope.row.bedNum }}号床
</el-tag>
<span v-else>-</span>
</template>
<!-- ??????????-->
<!-- 住人数量格式化-->
<template v-else-if="col.prop === 'liveNum'" #default="scope">
<el-tag v-if="scope.row.liveNum !== undefined && scope.row.liveNum !== null" size="small" type="success" effect="plain">
{{ scope.row.liveNum }}
</el-tag>
<span v-else>-</span>
</template>
<!-- ??????????-->
<!-- 期初余额格式化-->
<template v-else-if="col.prop === 'oddbMoney'" #default="scope">
<el-tag v-if="scope.row.oddbMoney" size="small" type="success" effect="plain">
?{{ Number(scope.row.oddbMoney).toFixed(2) }}
¥{{ Number(scope.row.oddbMoney).toFixed(2) }}
</el-tag>
<span v-else>?0.00</span>
<span v-else>¥0.00</span>
</template>
<!-- ????????? -->
<!-- 充值金额格式化 -->
<template v-else-if="col.prop === 'rechargeMoney'" #default="scope">
<el-tag v-if="scope.row.rechargeMoney" size="small" type="primary" effect="plain">
?{{ Number(scope.row.rechargeMoney).toFixed(2) }}
¥{{ Number(scope.row.rechargeMoney).toFixed(2) }}
</el-tag>
<span v-else>?0.00</span>
<span v-else>¥0.00</span>
</template>
<!-- ??????????-->
<!-- 消费金额格式化-->
<template v-else-if="col.prop === 'costMoney'" #default="scope">
<el-tag v-if="scope.row.costMoney" size="small" type="warning" effect="plain">
?{{ Number(scope.row.costMoney).toFixed(2) }}
¥{{ Number(scope.row.costMoney).toFixed(2) }}
</el-tag>
<span v-else>?0.00</span>
<span v-else>¥0.00</span>
</template>
<!-- ??????????-->
<!-- 有效金额格式化-->
<template v-else-if="col.prop === 'effectiveMoney'" #default="scope">
<el-tag size="small" :type="Number(scope.row.effectiveMoney) < 0 ? 'danger' : 'success'" effect="plain">
?{{ scope.row.effectiveMoney ? Number(scope.row.effectiveMoney).toFixed(2) : '0.00' }}
¥{{ scope.row.effectiveMoney ? Number(scope.row.effectiveMoney).toFixed(2) : '0.00' }}
</el-tag>
</template>
</el-table-column>
</template>
<el-table-column label="??" width="200" align="center" fixed="right">
<el-table-column label="操作" width="200" align="center" fixed="right">
<template #header>
<el-icon><Setting /></el-icon>
<span style="margin-left: 4px">??</span>
<span style="margin-left: 4px">操作</span>
</template>
<template #default="scope">
<el-button
@@ -199,27 +199,27 @@
link
type="primary"
@click="handleEdit(scope.row)">
??
编辑
</el-button>
<el-button
icon="View"
link
type="info"
@click="handleViewDetail(scope.row)">
??
详情
</el-button>
<el-button
icon="Delete"
link
type="danger"
@click="handleDelete(scope.row)">
??
删除
</el-button>
</template>
</el-table-column>
</el-table>
<!-- ?? -->
<!-- 分页 -->
<div class="pagination-wrapper">
<pagination
@size-change="sizeChangeHandle"
@@ -229,28 +229,28 @@
</el-card>
</div>
<!-- ???? -->
<!-- 新增/编辑对话框 -->
<FormDialog ref="formDialogRef" @refresh="getDataList()" />
<!-- ???? -->
<!-- 详情对话框 -->
<DetailDialog ref="detailDialogRef" />
<!-- ??????????-->
<el-dialog v-model="initDialogVisible" title="???????" :width="500" :close-on-click-modal="false" draggable>
<!-- 批量初始化对话框-->
<el-dialog v-model="initDialogVisible" title="批量初始化订单" :width="500" :close-on-click-modal="false" draggable>
<el-form ref="initFormRef" :model="initForm" :rules="initRules" label-width="120px">
<el-form-item label="????" prop="costMoney">
<el-form-item label="消费金额" prop="costMoney">
<el-input-number
v-model="initForm.costMoney"
:precision="2"
:min="0"
placeholder="???????"
placeholder="请输入消费金额"
style="width: 100%" />
</el-form-item>
</el-form>
<template #footer>
<span class="dialog-footer">
<el-button @click="initDialogVisible = false">??</el-button>
<el-button type="primary" @click="confirmInit" :loading="initLoading">??</el-button>
<el-button @click="initDialogVisible = false">取消</el-button>
<el-button type="primary" @click="confirmInit" :loading="initLoading">确认</el-button>
</span>
</template>
</el-dialog>
@@ -271,7 +271,7 @@ import { List, OfficeBuilding, House, UserFilled, Money, Setting, Menu, Search,
import { useTableColumnControl } from '/@/hooks/tableColumn'
// ??????
// 定义变量
const route = useRoute()
const searchFormRef = ref()
const columnControlRef = ref<any>()
@@ -283,19 +283,19 @@ const buildingList = ref<any[]>([])
const initDialogVisible = ref(false)
const initLoading = ref(false)
// ??????
// 表格列配置
const tableColumns = [
{ prop: 'buildNo', label: '??' },
{ prop: 'roomNo', label: '???' },
{ prop: 'bedNum', label: '???' },
{ prop: 'liveNum', label: '????' },
{ prop: 'oddbMoney', label: '????' },
{ prop: 'rechargeMoney', label: '????' },
{ prop: 'costMoney', label: '????' },
{ prop: 'effectiveMoney', label: '????' }
{ prop: 'buildNo', label: '楼号' },
{ prop: 'roomNo', label: '房间号' },
{ prop: 'bedNum', label: '床位号' },
{ prop: 'liveNum', label: '住人数量' },
{ prop: 'oddbMoney', label: '期初余额' },
{ prop: 'rechargeMoney', label: '充值金额' },
{ prop: 'costMoney', label: '消费金额' },
{ prop: 'effectiveMoney', label: '有效金额' }
]
// ????????????
// 列配置映射
const columnConfigMap: Record<string, { icon: any }> = {
buildNo: { icon: OfficeBuilding },
roomNo: { icon: House },
@@ -307,16 +307,16 @@ const columnConfigMap: Record<string, { icon: any }> = {
effectiveMoney: { icon: Money }
}
// ???????hook
// 表格列控制hook
const {
visibleColumns,
visibleColumnsSorted,
checkColumnVisible,
handleColumnChange,
handleColumnOrderChange
} = useTableColumnControl(tableColumns, route.path)
} = useTableColumnControl(tableColumns)
// ????
// 搜索表单
const searchForm = reactive({
effectiveMoney: undefined as number | undefined,
isLiveNum: undefined as boolean | undefined,
@@ -324,20 +324,20 @@ const searchForm = reactive({
roomNo: ''
})
// ??????
// 初始化表单
const initForm = reactive({
costMoney: 0
})
// ??????????
// 初始化表单规则
const initRules = {
costMoney: [
{ required: true, message: '???????', trigger: 'blur' },
{ type: 'number', min: 0, message: '??????????0', trigger: 'blur' }
{ required: true, message: '请输入消费金额', trigger: 'blur' },
{ type: 'number', min: 0, message: '消费金额必须大于等于0', trigger: 'blur' }
]
}
// ?? useTable
// 使用 useTable
const state: BasicTableProps = reactive<BasicTableProps>({
queryForm: searchForm,
pageList: fetchList,
@@ -357,12 +357,12 @@ const {
tableStyle
} = useTable(state)
// ??
// 查询
const handleSearch = () => {
getDataList()
}
// ??
// 重置
const handleReset = () => {
searchFormRef.value?.formRef?.resetFields()
searchForm.effectiveMoney = undefined
@@ -372,43 +372,43 @@ const handleReset = () => {
getDataList()
}
// ??
// 编辑
const handleEdit = (row: any) => {
formDialogRef.value.openDialog('edit', row)
}
// ????
// 查看详情
const handleViewDetail = (row: any) => {
detailDialogRef.value.openDialog(row.roomNo)
}
// ??
// 删除
const handleDelete = async (row: any) => {
try {
await useMessageBox().confirm('???????????')
await useMessageBox().confirm('确定要删除该记录吗?')
await delObjs([row.id])
useMessage().success('????')
useMessage().success('删除成功')
getDataList()
} catch (err: any) {
if (err !== 'cancel') {
useMessage().error(err.msg || '????')
useMessage().error(err.msg || '删除失败')
}
}
}
// ??
// 导出
const handleExport = () => {
// TODO: ????
useMessage().warning('???????')
// TODO: 实现导出
useMessage().warning('功能开发中')
}
// ??????????
// 批量初始化订单
const handleInitWaterOrder = () => {
initDialogVisible.value = true
initForm.costMoney = 0
}
// ??????
// 确认初始化
const confirmInit = async () => {
if (!initFormRef.value) return
@@ -418,18 +418,18 @@ const confirmInit = async () => {
initLoading.value = true
try {
await initWaterOrder({ costMoney: initForm.costMoney })
useMessage().success('?????')
useMessage().success('初始化成功')
initDialogVisible.value = false
getDataList()
} catch (err: any) {
useMessage().error(err.msg || '?????')
useMessage().error(err.msg || '初始化失败')
} finally {
initLoading.value = false
}
})
}
// ??????
// 获取楼号列表
const getBuildingListData = async () => {
try {
const res = await getBuildingList()
@@ -441,7 +441,7 @@ const getBuildingListData = async () => {
}
}
// ????
// 初始化
onMounted(() => {
getBuildingListData()
nextTick(() => {
@@ -454,4 +454,3 @@ onMounted(() => {
<style scoped lang="scss">
@import '/@/assets/styles/modern-page.scss';
</style>

View File

@@ -1,28 +1,28 @@
<template>
<div class="modern-page-container">
<div class="page-wrapper">
<!-- ?????? -->
<!-- 查询条件 -->
<el-card v-show="showSearch" class="search-card" shadow="never">
<template #header>
<div class="card-header">
<span class="card-title">
<el-icon class="title-icon"><Search /></el-icon>
?????
查询条件
</span>
</div>
</template>
<el-form :model="searchForm" ref="searchFormRef" :inline="true" @keyup.enter="handleSearch" class="search-form">
<el-form-item label="???" prop="roomNo">
<el-form-item label="宿舍号" prop="roomNo">
<el-input
v-model="searchForm.roomNo"
placeholder="??????"
placeholder="请输入宿舍号"
clearable
style="width: 200px" />
</el-form-item>
<el-form-item label="??" prop="year">
<el-form-item label="学年" prop="year">
<el-select
v-model="searchForm.year"
placeholder="?????"
placeholder="请选择学年"
clearable
filterable
style="width: 200px">
@@ -34,10 +34,10 @@
</el-option>
</el-select>
</el-form-item>
<el-form-item label="??" prop="period">
<el-form-item label="学期" prop="period">
<el-select
v-model="searchForm.period"
placeholder="?????"
placeholder="请选择学期"
clearable
style="width: 200px">
<el-option
@@ -49,26 +49,26 @@
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" plain icon="Search" @click="handleSearch">??</el-button>
<el-button icon="Refresh" @click="handleReset">??</el-button>
<el-button type="primary" plain icon="Search" @click="handleSearch">查询</el-button>
<el-button icon="Refresh" @click="handleReset">重置</el-button>
</el-form-item>
</el-form>
</el-card>
<!-- ???? -->
<!-- 数据列表 -->
<el-card class="content-card" shadow="never">
<template #header>
<div class="card-header">
<span class="card-title">
<el-icon class="title-icon"><Document /></el-icon>
??????
水费订单列表
</span>
<div class="header-actions">
<el-button
icon="FolderAdd"
type="primary"
@click="formDialogRef.openDialog()">
????
新增订单
</el-button>
<right-toolbar
v-model:showSearch="showSearch"
@@ -84,7 +84,7 @@
@order-change="handleColumnOrderChange"
>
<template #trigger>
<el-tooltip class="item" effect="dark" content="???" placement="top">
<el-tooltip class="item" effect="dark" content="列设置" placement="top">
<el-button circle style="margin-left: 0;">
<el-icon><Menu /></el-icon>
</el-button>
@@ -96,7 +96,7 @@
</div>
</template>
<!-- ?? -->
<!-- 表格 -->
<el-table
:data="state.dataList"
v-loading="state.loading"
@@ -105,7 +105,7 @@
:header-cell-style="tableStyle.headerCellStyle"
class="modern-table"
@sort-change="sortChangeHandle">
<el-table-column type="index" label="??" width="70" align="center">
<el-table-column type="index" label="序号" width="70" align="center">
<template #header>
<el-icon><List /></el-icon>
</template>
@@ -115,7 +115,7 @@
</el-table-column>
<template v-for="col in visibleColumnsSorted" :key="col.prop || col.label">
<el-table-column
v-if="checkColumnVisible(col.prop || '') && col.prop !== '??'"
v-if="checkColumnVisible(col.prop || '') && col.prop !== '序号'"
:prop="col.prop"
:label="col.label"
show-overflow-tooltip
@@ -124,40 +124,40 @@
<el-icon><component :is="columnConfigMap[col.prop]?.icon || Calendar" /></el-icon>
<span style="margin-left: 4px">{{ col.label }}</span>
</template>
<!-- ????????-->
<!-- 学期格式化-->
<template v-if="col.prop === 'period'" #default="scope">
<el-tag size="small" type="primary" effect="plain">
{{ formatSchoolTerm(scope.row.period) }}
</el-tag>
</template>
<!-- ????????-->
<!-- 类型格式化-->
<template v-else-if="col.prop === 'type'" #default="scope">
<el-tag size="small" type="info" effect="plain">
{{ formatType(scope.row.type) }}
</el-tag>
</template>
<!-- ????????? -->
<!-- 支付方式格式化 -->
<template v-else-if="col.prop === 'paymentCode'" #default="scope">
<el-tag size="small" type="warning" effect="plain">
{{ formatPaymentType(scope.row.paymentCode) }}
</el-tag>
</template>
<!-- ????????-->
<!-- 金额格式化-->
<template v-else-if="col.prop === 'money'" #default="scope">
<el-tag v-if="scope.row.money" size="small" type="success" effect="plain">
?{{ scope.row.money }}
¥{{ scope.row.money }}
</el-tag>
<span v-else>-</span>
</template>
<!-- ????????? -->
<!-- 充值状态格式化 -->
<template v-else-if="col.prop === 'chargeState'" #default="scope">
<StatusTag
:value="scope.row.chargeState"
:options="[{ label: '??', value: '1' }, { label: '??', value: '0' }]"
:options="[{ label: '已充值', value: '1' }, { label: '未充值', value: '0' }]"
:type-map="{ '1': { type: 'success', effect: 'light' }, '0': { type: 'danger', effect: 'light' } }"
/>
</template>
<!-- ??????? -->
<!-- 订单状态 -->
<template v-else-if="col.prop === 'state'" #default="scope">
<el-tag size="small" type="info" effect="plain">
{{ formatState(scope.row.state) }}
@@ -165,10 +165,10 @@
</template>
</el-table-column>
</template>
<el-table-column label="??" width="150" align="center" fixed="right">
<el-table-column label="操作" width="150" align="center" fixed="right">
<template #header>
<el-icon><Setting /></el-icon>
<span style="margin-left: 4px">??</span>
<span style="margin-left: 4px">操作</span>
</template>
<template #default="scope">
<el-button
@@ -176,20 +176,20 @@
link
type="primary"
@click="handleEdit(scope.row)">
??
编辑
</el-button>
<el-button
icon="Delete"
link
type="danger"
@click="handleDelete(scope.row)">
??
删除
</el-button>
</template>
</el-table-column>
</el-table>
<!-- ?? -->
<!-- 分页 -->
<div class="pagination-wrapper">
<pagination
@size-change="sizeChangeHandle"
@@ -199,7 +199,7 @@
</el-card>
</div>
<!-- ???? -->
<!-- 新增/编辑对话框 -->
<FormDialog ref="formDialogRef" @refresh="getDataList()" />
</div>
</template>
@@ -220,7 +220,7 @@ import { useTableColumnControl } from '/@/hooks/tableColumn'
import { defineAsyncComponent } from 'vue'
const StatusTag = defineAsyncComponent(() => import('/@/components/StatusTag/index.vue'))
// ??????
// 定义变量
const route = useRoute()
const searchFormRef = ref()
const columnControlRef = ref<any>()
@@ -233,22 +233,22 @@ const paymentTypeList = ref<any[]>([])
const chargeStateList = ref<any[]>([])
const stateList = ref<any[]>([])
// ??????
// 表格列配置
const tableColumns = [
{ prop: 'roomNo', label: '???' },
{ prop: 'year', label: '??' },
{ prop: 'period', label: '??' },
{ prop: 'orderNum', label: '???' },
{ prop: 'type', label: '??' },
{ prop: 'paymentCode', label: '????' },
{ prop: 'money', label: '??' },
{ prop: 'chargeAccount', label: '??????' },
{ prop: 'chargeRealname', label: '????????' },
{ prop: 'chargeState', label: '????' },
{ prop: 'state', label: '??' }
{ prop: 'roomNo', label: '宿舍号' },
{ prop: 'year', label: '学年' },
{ prop: 'period', label: '学期' },
{ prop: 'orderNum', label: '订单号' },
{ prop: 'type', label: '类型' },
{ prop: 'paymentCode', label: '支付方式' },
{ prop: 'money', label: '金额' },
{ prop: 'chargeAccount', label: '充值账号' },
{ prop: 'chargeRealname', label: '充值人姓名' },
{ prop: 'chargeState', label: '充值状态' },
{ prop: 'state', label: '状态' }
]
// ????????????
// 列配置映射
const columnConfigMap: Record<string, { icon: any }> = {
roomNo: { icon: House },
year: { icon: Calendar },
@@ -263,23 +263,23 @@ const columnConfigMap: Record<string, { icon: any }> = {
state: { icon: CircleCheck }
}
// ???????hook
// 表格列控制hook
const {
visibleColumns,
visibleColumnsSorted,
checkColumnVisible,
handleColumnChange,
handleColumnOrderChange
} = useTableColumnControl(tableColumns, route.path)
} = useTableColumnControl(tableColumns)
// ????
// 搜索表单
const searchForm = reactive({
roomNo: '',
year: '',
period: ''
})
// ?? useTable
// 使用 useTable
const state: BasicTableProps = reactive<BasicTableProps>({
queryForm: searchForm,
pageList: fetchList,
@@ -299,12 +299,12 @@ const {
tableStyle
} = useTable(state)
// ??
// 查询
const handleSearch = () => {
getDataList()
}
// ??
// 重置
const handleReset = () => {
searchFormRef.value?.formRef?.resetFields()
searchForm.roomNo = ''
@@ -313,27 +313,27 @@ const handleReset = () => {
getDataList()
}
// ??
// 编辑
const handleEdit = (row: any) => {
formDialogRef.value.openDialog('edit', row)
}
// ??
// 删除
const handleDelete = async (row: any) => {
try {
await useMessageBox().confirm('??????????')
await useMessageBox().confirm('确定要删除该订单吗?')
const { delObjs } = await import("/@/api/stuwork/waterorder")
await delObjs([row.id])
useMessage().success('????')
useMessage().success('删除成功')
getDataList()
} catch (err: any) {
if (err !== 'cancel') {
useMessage().error(err.msg || '????')
useMessage().error(err.msg || '删除失败')
}
}
}
// ??????
// 格式化学期
const formatSchoolTerm = (value: string | number) => {
if (value === null || value === undefined || value === '') {
return '-'
@@ -342,7 +342,7 @@ const formatSchoolTerm = (value: string | number) => {
return dictItem ? dictItem.label : value
}
// ??????
// 格式化类型
const formatType = (value: string | number) => {
if (value === null || value === undefined || value === '') {
return '-'
@@ -351,7 +351,7 @@ const formatType = (value: string | number) => {
return dictItem ? dictItem.label : value
}
// ????????
// 格式化支付方式
const formatPaymentType = (value: string | number) => {
if (value === null || value === undefined || value === '') {
return '-'
@@ -360,7 +360,7 @@ const formatPaymentType = (value: string | number) => {
return dictItem ? dictItem.label : value
}
// ????????
// 格式化充值状态
const formatChargeState = (value: string | number) => {
if (value === null || value === undefined || value === '') {
return '-'
@@ -369,7 +369,7 @@ const formatChargeState = (value: string | number) => {
return dictItem ? dictItem.label : value
}
// ??????
// 格式化状态
const formatState = (value: string | number) => {
if (value === null || value === undefined || value === '') {
return '-'
@@ -378,7 +378,7 @@ const formatState = (value: string | number) => {
return dictItem ? dictItem.label : value
}
// ??????
// 获取学年列表
const getSchoolYearList = async () => {
try {
const res = await queryAllSchoolYear()
@@ -390,7 +390,7 @@ const getSchoolYearList = async () => {
}
}
// ??????
// 获取学期字典
const getSchoolTermDict = async () => {
try {
const res = await getDicts('school_term')
@@ -405,7 +405,7 @@ const getSchoolTermDict = async () => {
}
}
// ??????
// 获取类型字典
const getTypeDict = async () => {
try {
const res = await getDicts('dorm_water_source_type')
@@ -420,7 +420,7 @@ const getTypeDict = async () => {
}
}
// ?????????
// 获取支付方式字典
const getPaymentTypeDict = async () => {
try {
const res = await getDicts('dorm_water_payment_type')
@@ -435,7 +435,7 @@ const getPaymentTypeDict = async () => {
}
}
// ?????????
// 获取充值状态字典
const getChargeStateDict = async () => {
try {
const res = await getDicts('dorm_water_charge_state')
@@ -450,7 +450,7 @@ const getChargeStateDict = async () => {
}
}
// ???????
// 获取状态字典
const getStateDict = async () => {
try {
const res = await getDicts('dorm_water_state')
@@ -465,7 +465,7 @@ const getStateDict = async () => {
}
}
// ????
// 初始化
onMounted(() => {
getSchoolYearList()
getSchoolTermDict()

View File

@@ -1,21 +1,21 @@
<template>
<div class="modern-page-container">
<div class="page-wrapper">
<!-- ?????? -->
<!-- 查询条件 -->
<el-card v-show="showSearch" class="search-card" shadow="never">
<template #header>
<div class="card-header">
<span class="card-title">
<el-icon class="title-icon"><Search /></el-icon>
????
查询条件
</span>
</div>
</template>
<el-form :model="searchForm" ref="searchFormRef" :inline="true" @keyup.enter="handleSearch" class="search-form">
<el-form-item label="??" prop="deptCode">
<el-form-item label="学院" prop="deptCode">
<el-select
v-model="searchForm.deptCode"
placeholder="?????"
placeholder="请选择学院"
clearable
filterable
style="width: 200px"
@@ -28,10 +28,10 @@
</el-option>
</el-select>
</el-form-item>
<el-form-item label="??" prop="classCode">
<el-form-item label="班级" prop="classCode">
<el-select
v-model="searchForm.classCode"
placeholder="?????"
placeholder="请选择班级"
clearable
filterable
style="width: 200px">
@@ -43,31 +43,31 @@
</el-option>
</el-select>
</el-form-item>
<el-form-item label="??" prop="source">
<el-form-item label="来源" prop="source">
<el-select
v-model="searchForm.source"
placeholder="?????"
placeholder="请选择来源"
clearable
style="width: 200px"
@change="handleSourceChange">
<el-option label="????" value="history" />
<el-option label="??" value="attendance" />
<el-option label="历史记录" value="history" />
<el-option label="考勤" value="attendance" />
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" plain icon="Search" @click="handleSearch">??</el-button>
<el-button icon="Refresh" @click="handleReset">??</el-button>
<el-button type="primary" plain icon="Search" @click="handleSearch">查询</el-button>
<el-button icon="Refresh" @click="handleReset">重置</el-button>
</el-form-item>
</el-form>
</el-card>
<!-- ???? -->
<!-- 数据列表 -->
<el-card class="content-card" shadow="never">
<template #header>
<div class="card-header">
<span class="card-title">
<el-icon class="title-icon"><Document /></el-icon>
????????
工学交替考勤列表
</span>
<div class="header-actions">
<right-toolbar
@@ -84,7 +84,7 @@
@order-change="handleColumnOrderChange"
>
<template #trigger>
<el-tooltip class="item" effect="dark" content="???" placement="top">
<el-tooltip class="item" effect="dark" content="列设置" placement="top">
<el-button circle style="margin-left: 0;">
<el-icon><Menu /></el-icon>
</el-button>
@@ -96,7 +96,7 @@
</div>
</template>
<!-- ?? -->
<!-- 表格 -->
<el-table
:data="state.dataList"
v-loading="state.loading"
@@ -104,7 +104,7 @@
:cell-style="tableStyle.cellStyle"
:header-cell-style="tableStyle.headerCellStyle"
class="modern-table">
<el-table-column type="index" label="??" width="70" align="center">
<el-table-column type="index" label="序号" width="70" align="center">
<template #header>
<el-icon><List /></el-icon>
</template>
@@ -114,7 +114,7 @@
</el-table-column>
<template v-for="col in visibleColumnsSorted" :key="col.prop || col.label">
<el-table-column
v-if="checkColumnVisible(col.prop || '') && col.prop !== '??'"
v-if="checkColumnVisible(col.prop || '') && col.prop !== '序号'"
:prop="col.prop"
:label="col.label"
show-overflow-tooltip
@@ -125,28 +125,28 @@
<el-icon><component :is="columnConfigMap[col.prop]?.icon || Calendar" /></el-icon>
<span style="margin-left: 4px">{{ col.label }}</span>
</template>
<!-- ??????? -->
<!-- 学期格式化 -->
<template v-if="col.prop === 'schoolTerm'" #default="scope">
<el-tag size="small" type="primary" effect="plain">
{{ formatSchoolTerm(scope.row.schoolTerm) }}
</el-tag>
</template>
<!-- ????????? -->
<!-- 考勤类型格式化 -->
<template v-else-if="col.prop === 'attendanceType'" #default="scope">
<el-tag size="small" type="warning" effect="plain">
{{ formatAttendanceType(scope.row.attendanceType) }}
</el-tag>
</template>
<!-- ????????? -->
<!-- 备注格式化 -->
<template v-else-if="col.prop === 'remarks'" #default="scope">
<span>{{ scope.row.remarks || '-' }}</span>
</template>
</el-table-column>
</template>
<el-table-column label="??" width="150" align="center" fixed="right">
<el-table-column label="操作" width="150" align="center" fixed="right">
<template #header>
<el-icon><Setting /></el-icon>
<span style="margin-left: 4px">??</span>
<span style="margin-left: 4px">操作</span>
</template>
<template #default="scope">
<el-button
@@ -154,13 +154,13 @@
link
type="primary"
@click="handleView(scope.row)">
????
查看详情
</el-button>
</template>
</el-table-column>
</el-table>
<!-- ?? -->
<!-- 分页 -->
<div class="pagination-wrapper">
<pagination
@size-change="sizeChangeHandle"
@@ -185,30 +185,30 @@ import { List, Calendar, Clock, OfficeBuilding, Grid, Document, CreditCard, Avat
import { useTableColumnControl } from '/@/hooks/tableColumn'
// ??????
// 定义变量
const route = useRoute()
const searchFormRef = ref()
const columnControlRef = ref<any>()
const showSearch = ref(true)
const deptList = ref<any[]>([])
const classList = ref<any[]>([])
const showRemarks = ref(false) // ??????????
const showRemarks = ref(false) // 是否显示备注列
// ?????
// 表格列配置
const tableColumns = [
{ prop: 'schoolYear', label: '??' },
{ prop: 'schoolTerm', label: '??' },
{ prop: 'deptName', label: '????' },
{ prop: 'classCode', label: '????' },
{ prop: 'classNo', label: '????' },
{ prop: 'classProName', label: '??????', minWidth: 200 },
{ prop: 'stuNo', label: '??' },
{ prop: 'realName', label: '??' },
{ prop: 'attendanceType', label: '????' },
{ prop: 'remarks', label: '????', minWidth: 150 }
{ prop: 'schoolYear', label: '学年' },
{ prop: 'schoolTerm', label: '学期' },
{ prop: 'deptName', label: '学院名称' },
{ prop: 'classCode', label: '班级编码' },
{ prop: 'classNo', label: '班级编号' },
{ prop: 'classProName', label: '班级项目名称', minWidth: 200 },
{ prop: 'stuNo', label: '学号' },
{ prop: 'realName', label: '姓名' },
{ prop: 'attendanceType', label: '考勤类型' },
{ prop: 'remarks', label: '备注说明', minWidth: 150 }
]
// ?????????????
// 列配置映射
const columnConfigMap: Record<string, { icon: any }> = {
schoolYear: { icon: Calendar },
schoolTerm: { icon: Clock },
@@ -222,23 +222,23 @@ const columnConfigMap: Record<string, { icon: any }> = {
remarks: { icon: Document }
}
// ??????? hook
// 表格列控制 hook
const {
visibleColumns,
visibleColumnsSorted,
checkColumnVisible,
handleColumnChange,
handleColumnOrderChange
} = useTableColumnControl(tableColumns, route.path)
} = useTableColumnControl(tableColumns)
// ????
// 搜索表单
const searchForm = reactive({
deptCode: '',
classCode: '',
source: '' // ????????????
source: '' // 数据来源history-历史记录attendance-考勤记录
})
// ?? useTable
// 使用 useTable
const state: BasicTableProps = reactive<BasicTableProps>({
queryForm: searchForm,
pageList: fetchList,
@@ -257,26 +257,26 @@ const {
tableStyle
} = useTable(state)
// ???????
// 格式化考勤类型
const formatAttendanceType = (value: string | number) => {
if (value === '1' || value === 1) return '??'
if (value === '2' || value === 2) return '???'
if (value === '3' || value === 3) return '??'
if (value === '1' || value === 1) return '正常'
if (value === '2' || value === 2) return '迟到/早退'
if (value === '3' || value === 3) return '缺勤'
return '-'
}
// ???????????
// 学院变化处理
const handleDeptChange = () => {
searchForm.classCode = ''
getClassListData()
}
// ??????
// 来源变化处理
const handleSourceChange = async (value: string) => {
if (value === 'history') {
// ???????????????
// 选择历史记录时显示备注列
showRemarks.value = true
// ??????????????????
// 查询历史记录数据
try {
state.loading = true
const params: any = {}
@@ -299,7 +299,7 @@ const handleSourceChange = async (value: string) => {
}
}
} catch (err: any) {
useMessage().error(err.msg || '????????')
useMessage().error(err.msg || '查询失败')
state.dataList = []
if (state.pagination) {
state.pagination.total = 0
@@ -308,17 +308,17 @@ const handleSourceChange = async (value: string) => {
state.loading = false
}
} else if (value === 'attendance') {
// ???????????????????????
// 选择考勤记录时隐藏备注列并刷新数据
showRemarks.value = false
getDataList()
} else {
// ??????????????
// 清空选择时隐藏备注列
showRemarks.value = false
getDataList()
}
}
// ??
// 查询
const handleSearch = () => {
if (searchForm.source === 'history') {
handleSourceChange('history')
@@ -328,7 +328,7 @@ const handleSearch = () => {
}
}
// ??
// 重置
const handleReset = () => {
searchFormRef.value?.resetFields()
searchForm.deptCode = ''
@@ -338,12 +338,12 @@ const handleReset = () => {
getDataList()
}
// ????
// 查看详情
const handleView = (row: any) => {
useMessage().warning('?????????')
useMessage().warning('功能开发中')
}
// ??????
// 获取学院列表
const getDeptListData = async () => {
try {
const res = await getDeptList()
@@ -355,13 +355,13 @@ const getDeptListData = async () => {
}
}
// ??????
// 获取班级列表
const getClassListData = async () => {
try {
const res = await getClassListByRole()
if (res.data) {
let list = Array.isArray(res.data) ? res.data : []
// ??????????????
// 根据选择的学院筛选班级
if (searchForm.deptCode) {
list = list.filter((item: any) => item.deptCode === searchForm.deptCode)
}