班主任跟踪情况
This commit is contained in:
73
src/api/stuwork/classmastertracking.ts
Normal file
73
src/api/stuwork/classmastertracking.ts
Normal file
@@ -0,0 +1,73 @@
|
||||
import request from '/@/utils/request';
|
||||
|
||||
/**
|
||||
* 分页查询班主任跟踪情况列表
|
||||
* @param query 查询参数
|
||||
*/
|
||||
export const fetchList = (query?: any) => {
|
||||
return request({
|
||||
url: '/stuwork/classmastertracking/page',
|
||||
method: 'get',
|
||||
params: query
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* 通过id查询详情
|
||||
* @param id 主键ID
|
||||
*/
|
||||
export const getDetail = (id: string) => {
|
||||
return request({
|
||||
url: '/stuwork/classmastertracking/detail',
|
||||
method: 'get',
|
||||
params: { id }
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* 新增班主任跟踪情况
|
||||
* @param data 数据对象
|
||||
*/
|
||||
export const addObj = (data: any) => {
|
||||
return request({
|
||||
url: '/stuwork/classmastertracking',
|
||||
method: 'post',
|
||||
data
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* 修改班主任跟踪情况
|
||||
* @param data 数据对象
|
||||
*/
|
||||
export const editObj = (data: any) => {
|
||||
return request({
|
||||
url: '/stuwork/classmastertracking/edit',
|
||||
method: 'post',
|
||||
data
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* 处理跟踪情况
|
||||
* @param data 处理信息
|
||||
*/
|
||||
export const dealTracking = (data: any) => {
|
||||
return request({
|
||||
url: '/stuwork/classmastertracking/deal',
|
||||
method: 'post',
|
||||
data
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* 删除班主任跟踪情况
|
||||
* @param ids ID数组
|
||||
*/
|
||||
export const delObj = (ids: string[]) => {
|
||||
return request({
|
||||
url: '/stuwork/classmastertracking/delete',
|
||||
method: 'post',
|
||||
data: ids
|
||||
});
|
||||
};
|
||||
71
src/api/stuwork/stupunlishlevelconfig.ts
Normal file
71
src/api/stuwork/stupunlishlevelconfig.ts
Normal file
@@ -0,0 +1,71 @@
|
||||
import request from '/@/utils/request';
|
||||
|
||||
/**
|
||||
* 分页查询处分等级配置列表
|
||||
* @param query
|
||||
*/
|
||||
export const fetchList = (query?: any) => {
|
||||
return request({
|
||||
url: '/stuwork/stupunlishlevelconfig/page',
|
||||
method: 'get',
|
||||
params: query
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* 获取所有启用的处分等级配置
|
||||
*/
|
||||
export const getAllActiveConfigs = () => {
|
||||
return request({
|
||||
url: '/stuwork/stupunlishlevelconfig/getAllActiveConfigs',
|
||||
method: 'get'
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* 新增处分等级配置
|
||||
* @param data
|
||||
*/
|
||||
export const addObj = (data: any) => {
|
||||
return request({
|
||||
url: '/stuwork/stupunlishlevelconfig',
|
||||
method: 'post',
|
||||
data
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* 获取详情
|
||||
* @param id
|
||||
*/
|
||||
export const getDetail = (id: string) => {
|
||||
return request({
|
||||
url: '/stuwork/stupunlishlevelconfig/detail',
|
||||
method: 'get',
|
||||
params: { id }
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* 编辑处分等级配置
|
||||
* @param data
|
||||
*/
|
||||
export const editObj = (data: any) => {
|
||||
return request({
|
||||
url: '/stuwork/stupunlishlevelconfig/edit',
|
||||
method: 'post',
|
||||
data
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* 删除处分等级配置
|
||||
* @param ids
|
||||
*/
|
||||
export const delObj = (ids: string[]) => {
|
||||
return request({
|
||||
url: '/stuwork/stupunlishlevelconfig/delete',
|
||||
method: 'post',
|
||||
data: ids
|
||||
});
|
||||
};
|
||||
483
src/views/stuwork/classmastertracking/index.vue
Normal file
483
src/views/stuwork/classmastertracking/index.vue
Normal file
@@ -0,0 +1,483 @@
|
||||
<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="stuName">
|
||||
<el-input
|
||||
v-model="searchForm.stuName"
|
||||
placeholder="请输入学生姓名"
|
||||
clearable
|
||||
style="width: 180px" />
|
||||
</el-form-item>
|
||||
<el-form-item label="学号" prop="stuNo">
|
||||
<el-input
|
||||
v-model="searchForm.stuNo"
|
||||
placeholder="请输入学号"
|
||||
clearable
|
||||
style="width: 180px" />
|
||||
</el-form-item>
|
||||
<el-form-item label="班号" prop="classNo">
|
||||
<el-input
|
||||
v-model="searchForm.classNo"
|
||||
placeholder="请输入班号"
|
||||
clearable
|
||||
style="width: 180px" />
|
||||
</el-form-item>
|
||||
<el-form-item label="处理状态" prop="dealStatus">
|
||||
<el-select
|
||||
v-model="searchForm.dealStatus"
|
||||
placeholder="请选择处理状态"
|
||||
clearable
|
||||
style="width: 150px">
|
||||
<el-option label="待处理" value="0" />
|
||||
<el-option label="已处理" value="1" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="考勤类型" prop="attendanceType">
|
||||
<el-select
|
||||
v-model="searchForm.attendanceType"
|
||||
placeholder="请选择考勤类型"
|
||||
clearable
|
||||
style="width: 150px">
|
||||
<el-option label="旷课" value="5" />
|
||||
<el-option label="失联" value="6" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="点名类型" prop="orderType">
|
||||
<el-select
|
||||
v-model="searchForm.orderType"
|
||||
placeholder="请选择点名类型"
|
||||
clearable
|
||||
style="width: 150px">
|
||||
<el-option label="早自习" value="1" />
|
||||
<el-option label="晚自习" value="2" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" 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
|
||||
v-model:showSearch="showSearch"
|
||||
class="ml10"
|
||||
@queryTable="getDataList">
|
||||
<TableColumnControl
|
||||
ref="columnControlRef"
|
||||
:columns="tableColumns"
|
||||
v-model="visibleColumns"
|
||||
trigger-type="default"
|
||||
trigger-circle
|
||||
@change="handleColumnChange"
|
||||
@order-change="handleColumnOrderChange"
|
||||
>
|
||||
<template #trigger>
|
||||
<el-tooltip class="item" effect="dark" content="列设置" placement="top">
|
||||
<el-button circle style="margin-left: 0;">
|
||||
<el-icon><Menu /></el-icon>
|
||||
</el-button>
|
||||
</el-tooltip>
|
||||
</template>
|
||||
</TableColumnControl>
|
||||
</right-toolbar>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<!-- 表格 -->
|
||||
<el-table
|
||||
:data="dataList"
|
||||
v-loading="loading"
|
||||
stripe
|
||||
:cell-style="tableStyle.cellStyle"
|
||||
:header-cell-style="tableStyle.headerCellStyle"
|
||||
class="modern-table">
|
||||
<el-table-column type="index" label="序号" width="70" align="center">
|
||||
<template #header>
|
||||
<el-icon><List /></el-icon>
|
||||
</template>
|
||||
<template #default="{ $index }">
|
||||
{{ (page.currentPage - 1) * page.pageSize + $index + 1 }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<template v-for="col in visibleColumnsSorted" :key="col.prop || col.label">
|
||||
<el-table-column
|
||||
v-if="checkColumnVisible(col.prop || '') && col.prop !== '操作'"
|
||||
:prop="col.prop"
|
||||
:label="col.label"
|
||||
:width="col.width"
|
||||
:min-width="col.minWidth"
|
||||
:show-overflow-tooltip="col.showOverflowTooltip !== false"
|
||||
:align="col.align || 'center'">
|
||||
<template #header>
|
||||
<el-icon v-if="col.icon"><component :is="col.icon" /></el-icon>
|
||||
<span :style="{ marginLeft: col.icon ? '4px' : '0' }">{{ col.label }}</span>
|
||||
</template>
|
||||
<!-- 处理状态列特殊模板 -->
|
||||
<template v-if="col.prop === 'dealStatus'" #default="scope">
|
||||
<el-tag
|
||||
:type="scope.row.dealStatus === '1' ? 'success' : 'warning'"
|
||||
size="small"
|
||||
round>
|
||||
{{ scope.row.dealStatusName || (scope.row.dealStatus === '1' ? '已处理' : '待处理') }}
|
||||
</el-tag>
|
||||
</template>
|
||||
<!-- 考勤类型列特殊模板 -->
|
||||
<template v-else-if="col.prop === 'attendanceType'" #default="scope">
|
||||
<el-tag
|
||||
:type="scope.row.attendanceType === '6' ? 'danger' : 'warning'"
|
||||
size="small"
|
||||
round>
|
||||
{{ scope.row.attendanceTypeName || (scope.row.attendanceType === '6' ? '失联' : '旷课') }}
|
||||
</el-tag>
|
||||
</template>
|
||||
<!-- 点名类型列特殊模板 -->
|
||||
<template v-else-if="col.prop === 'orderType'" #default="scope">
|
||||
<el-tag type="info" size="small" round>
|
||||
{{ scope.row.orderTypeName || (scope.row.orderType === '1' ? '早自习' : '晚自习') }}
|
||||
</el-tag>
|
||||
</template>
|
||||
<!-- 最晚处理时间列特殊模板 -->
|
||||
<template v-else-if="col.prop === 'dealDeadline'" #default="scope">
|
||||
<span :class="{ 'text-danger': isOverdue(scope.row.dealDeadline) && scope.row.dealStatus === '0' }">
|
||||
{{ formatDateTime(scope.row.dealDeadline) }}
|
||||
</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</template>
|
||||
<el-table-column label="操作" width="150" align="center" fixed="right">
|
||||
<template #header>
|
||||
<el-icon><Setting /></el-icon>
|
||||
<span style="margin-left: 4px">操作</span>
|
||||
</template>
|
||||
<template #default="scope">
|
||||
<el-button
|
||||
v-if="scope.row.dealStatus === '0'"
|
||||
icon="Check"
|
||||
link
|
||||
type="primary"
|
||||
@click="handleDeal(scope.row)">
|
||||
处理
|
||||
</el-button>
|
||||
<el-button
|
||||
icon="View"
|
||||
link
|
||||
type="primary"
|
||||
@click="handleView(scope.row)">
|
||||
详情
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<template #empty>
|
||||
<el-empty description="暂无数据" :image-size="120" />
|
||||
</template>
|
||||
</el-table>
|
||||
|
||||
<!-- 分页 -->
|
||||
<el-pagination
|
||||
v-model:current-page="page.currentPage"
|
||||
v-model:page-size="page.pageSize"
|
||||
:page-sizes="[10, 20, 50, 100]"
|
||||
:total="page.total"
|
||||
layout="total, sizes, prev, pager, next, jumper"
|
||||
class="pagination"
|
||||
@size-change="handleSizeChange"
|
||||
@current-change="handleCurrentChange" />
|
||||
</el-card>
|
||||
</div>
|
||||
|
||||
<!-- 处理弹窗 -->
|
||||
<el-dialog
|
||||
v-model="dealDialogVisible"
|
||||
title="处理跟踪情况"
|
||||
width="500px"
|
||||
:close-on-click-modal="false">
|
||||
<el-form :model="dealForm" ref="dealFormRef" label-width="100px">
|
||||
<el-form-item label="学生姓名">
|
||||
<span>{{ currentRow.stuName }}</span>
|
||||
</el-form-item>
|
||||
<el-form-item label="学号">
|
||||
<span>{{ currentRow.stuNo }}</span>
|
||||
</el-form-item>
|
||||
<el-form-item label="考勤类型">
|
||||
<el-tag :type="currentRow.attendanceType === '6' ? 'danger' : 'warning'" size="small">
|
||||
{{ currentRow.attendanceTypeName || (currentRow.attendanceType === '6' ? '失联' : '旷课') }}
|
||||
</el-tag>
|
||||
</el-form-item>
|
||||
<el-form-item label="考勤日期">
|
||||
<span>{{ currentRow.attendanceDay }}</span>
|
||||
</el-form-item>
|
||||
<el-form-item label="处理说明" prop="dealContent" :rules="[{ required: true, message: '请输入处理说明', trigger: 'blur' }]">
|
||||
<el-input
|
||||
v-model="dealForm.dealContent"
|
||||
type="textarea"
|
||||
:rows="4"
|
||||
placeholder="请输入处理说明" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<el-button @click="dealDialogVisible = false">取消</el-button>
|
||||
<el-button type="primary" @click="submitDeal" :loading="dealLoading">确定</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
|
||||
<!-- 详情弹窗 -->
|
||||
<el-dialog
|
||||
v-model="detailDialogVisible"
|
||||
title="跟踪情况详情"
|
||||
width="600px">
|
||||
<el-descriptions :column="2" border>
|
||||
<el-descriptions-item label="学生姓名">{{ currentRow.stuName }}</el-descriptions-item>
|
||||
<el-descriptions-item label="学号">{{ currentRow.stuNo }}</el-descriptions-item>
|
||||
<el-descriptions-item label="班主任姓名">{{ currentRow.teacherName }}</el-descriptions-item>
|
||||
<el-descriptions-item label="班主任工号">{{ currentRow.teacherNo }}</el-descriptions-item>
|
||||
<el-descriptions-item label="学院">{{ currentRow.deptName }}</el-descriptions-item>
|
||||
<el-descriptions-item label="班号">{{ currentRow.classNo }}</el-descriptions-item>
|
||||
<el-descriptions-item label="考勤类型">
|
||||
<el-tag :type="currentRow.attendanceType === '6' ? 'danger' : 'warning'" size="small">
|
||||
{{ currentRow.attendanceTypeName || (currentRow.attendanceType === '6' ? '失联' : '旷课') }}
|
||||
</el-tag>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="点名类型">
|
||||
<el-tag type="info" size="small">
|
||||
{{ currentRow.orderTypeName || (currentRow.orderType === '1' ? '早自习' : '晚自习') }}
|
||||
</el-tag>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="考勤日期">{{ currentRow.attendanceDay }}</el-descriptions-item>
|
||||
<el-descriptions-item label="处理状态">
|
||||
<el-tag :type="currentRow.dealStatus === '1' ? 'success' : 'warning'" size="small">
|
||||
{{ currentRow.dealStatusName || (currentRow.dealStatus === '1' ? '已处理' : '待处理') }}
|
||||
</el-tag>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="最晚处理时间">{{ formatDateTime(currentRow.dealDeadline) }}</el-descriptions-item>
|
||||
<el-descriptions-item label="处理时间">{{ formatDateTime(currentRow.dealTime) }}</el-descriptions-item>
|
||||
<el-descriptions-item label="处理说明" :span="2">{{ currentRow.dealContent || '-' }}</el-descriptions-item>
|
||||
<el-descriptions-item label="创建时间" :span="2">{{ formatDateTime(currentRow.createTime) }}</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
<template #footer>
|
||||
<el-button type="primary" @click="detailDialogVisible = false">关闭</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts" name="ClassMasterTracking">
|
||||
import { reactive, ref, onMounted } from 'vue'
|
||||
import { fetchList, dealTracking } from '/@/api/stuwork/classmastertracking'
|
||||
import { useMessage } from '/@/hooks/message'
|
||||
import TableColumnControl from '/@/components/TableColumnControl/index.vue'
|
||||
import { List, CreditCard, Avatar, User, Timer, Calendar, Clock, Document, Setting, Menu, Search, Check, View } from '@element-plus/icons-vue'
|
||||
import { useTableColumnControl } from '/@/hooks/tableColumn'
|
||||
|
||||
// 定义变量内容
|
||||
const searchFormRef = ref()
|
||||
const dealFormRef = ref()
|
||||
const columnControlRef = ref()
|
||||
const showSearch = ref(true)
|
||||
const loading = ref(false)
|
||||
const dealLoading = ref(false)
|
||||
const dataList = ref<any[]>([])
|
||||
const dealDialogVisible = ref(false)
|
||||
const detailDialogVisible = ref(false)
|
||||
const currentRow = ref<any>({})
|
||||
const dealForm = reactive({
|
||||
id: '',
|
||||
dealContent: ''
|
||||
})
|
||||
|
||||
// 分页
|
||||
const page = reactive({
|
||||
currentPage: 1,
|
||||
pageSize: 20,
|
||||
total: 0
|
||||
})
|
||||
|
||||
// 表格列配置
|
||||
const tableColumns = [
|
||||
{ prop: 'stuNo', label: '学号', icon: CreditCard, minWidth: 120 },
|
||||
{ prop: 'stuName', label: '学生姓名', icon: Avatar, minWidth: 100 },
|
||||
{ prop: 'classNo', label: '班号', icon: Document, minWidth: 120 },
|
||||
{ prop: 'teacherName', label: '班主任', icon: User, minWidth: 100 },
|
||||
{ prop: 'deptName', label: '学院', icon: Document, minWidth: 150 },
|
||||
{ prop: 'attendanceType', label: '考勤类型', icon: Document, minWidth: 100 },
|
||||
{ prop: 'orderType', label: '点名类型', icon: Clock, minWidth: 100 },
|
||||
{ prop: 'attendanceDay', label: '考勤日期', icon: Calendar, minWidth: 120 },
|
||||
{ prop: 'dealStatus', label: '处理状态', icon: Check, minWidth: 100 },
|
||||
{ prop: 'dealDeadline', label: '最晚处理时间', icon: Timer, minWidth: 160 },
|
||||
{ prop: 'dealTime', label: '处理时间', icon: Timer, minWidth: 160 },
|
||||
{ prop: 'dealContent', label: '处理说明', icon: Document, minWidth: 200 }
|
||||
]
|
||||
|
||||
// 使用表格列控制 Hook
|
||||
const {
|
||||
visibleColumns,
|
||||
visibleColumnsSorted,
|
||||
checkColumnVisible,
|
||||
handleColumnChange,
|
||||
handleColumnOrderChange
|
||||
} = useTableColumnControl(tableColumns)
|
||||
|
||||
// 搜索表单
|
||||
const searchForm = reactive({
|
||||
stuNo: '',
|
||||
stuName: '',
|
||||
classNo: '',
|
||||
dealStatus: '',
|
||||
attendanceType: '',
|
||||
orderType: ''
|
||||
})
|
||||
|
||||
// 表格样式
|
||||
const tableStyle = {
|
||||
cellStyle: { textAlign: 'center' },
|
||||
headerCellStyle: {
|
||||
textAlign: 'center',
|
||||
background: 'var(--el-table-row-hover-bg-color)',
|
||||
color: 'var(--el-text-color-primary)'
|
||||
}
|
||||
}
|
||||
|
||||
// 格式化日期时间
|
||||
const formatDateTime = (dateTime: string) => {
|
||||
if (!dateTime) return '-'
|
||||
return dateTime.replace('T', ' ').substring(0, 19)
|
||||
}
|
||||
|
||||
// 判断是否超期
|
||||
const isOverdue = (deadline: string) => {
|
||||
if (!deadline) return false
|
||||
return new Date(deadline) < new Date()
|
||||
}
|
||||
|
||||
// 查询
|
||||
const handleSearch = () => {
|
||||
page.currentPage = 1
|
||||
getDataList()
|
||||
}
|
||||
|
||||
// 重置
|
||||
const handleReset = () => {
|
||||
searchFormRef.value?.resetFields()
|
||||
Object.assign(searchForm, {
|
||||
stuNo: '',
|
||||
stuName: '',
|
||||
classNo: '',
|
||||
dealStatus: '',
|
||||
attendanceType: '',
|
||||
orderType: ''
|
||||
})
|
||||
handleSearch()
|
||||
}
|
||||
|
||||
// 分页大小改变
|
||||
const handleSizeChange = (val: number) => {
|
||||
page.pageSize = val
|
||||
getDataList()
|
||||
}
|
||||
|
||||
// 当前页改变
|
||||
const handleCurrentChange = (val: number) => {
|
||||
page.currentPage = val
|
||||
getDataList()
|
||||
}
|
||||
|
||||
// 获取数据列表
|
||||
const getDataList = async () => {
|
||||
loading.value = true
|
||||
try {
|
||||
const params: any = {
|
||||
current: page.currentPage,
|
||||
size: page.pageSize,
|
||||
...searchForm
|
||||
}
|
||||
|
||||
const res = await fetchList(params)
|
||||
if (res.data && res.data.records) {
|
||||
dataList.value = res.data.records
|
||||
page.total = res.data.total
|
||||
} else {
|
||||
dataList.value = []
|
||||
page.total = 0
|
||||
}
|
||||
} catch (err: any) {
|
||||
useMessage().error(err.msg || '获取数据列表失败')
|
||||
dataList.value = []
|
||||
page.total = 0
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
// 处理
|
||||
const handleDeal = (row: any) => {
|
||||
currentRow.value = row
|
||||
dealForm.id = row.id
|
||||
dealForm.dealContent = ''
|
||||
dealDialogVisible.value = true
|
||||
}
|
||||
|
||||
// 提交处理
|
||||
const submitDeal = async () => {
|
||||
if (!dealForm.dealContent) {
|
||||
useMessage().warning('请输入处理说明')
|
||||
return
|
||||
}
|
||||
dealLoading.value = true
|
||||
try {
|
||||
await dealTracking(dealForm)
|
||||
useMessage().success('处理成功')
|
||||
dealDialogVisible.value = false
|
||||
getDataList()
|
||||
} catch (err: any) {
|
||||
useMessage().error(err.msg || '处理失败')
|
||||
} finally {
|
||||
dealLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
// 查看详情
|
||||
const handleView = (row: any) => {
|
||||
currentRow.value = row
|
||||
detailDialogVisible.value = true
|
||||
}
|
||||
|
||||
// 初始化
|
||||
onMounted(() => {
|
||||
getDataList()
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
@import '/@/assets/styles/modern-page.scss';
|
||||
|
||||
.text-danger {
|
||||
color: var(--el-color-danger);
|
||||
font-weight: bold;
|
||||
}
|
||||
</style>
|
||||
280
src/views/stuwork/stupunlishlevelconfig/form.vue
Normal file
280
src/views/stuwork/stupunlishlevelconfig/form.vue
Normal file
@@ -0,0 +1,280 @@
|
||||
<template>
|
||||
<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="120px"
|
||||
v-loading="loading">
|
||||
<el-row :gutter="24">
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-select
|
||||
v-model="form.levelCode"
|
||||
filterable
|
||||
clearable
|
||||
placeholder="请选择处分等级">
|
||||
<el-option
|
||||
v-for="item in punlish_level"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-col>
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="处分等级名称" prop="levelName">
|
||||
<el-input
|
||||
v-model="form.levelName"
|
||||
placeholder="请输入处分等级名称"
|
||||
clearable
|
||||
style="width: 100%" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="处分期(月)" prop="punishDuration">
|
||||
<el-input-number
|
||||
v-model="form.punishDuration"
|
||||
:min="0"
|
||||
:max="999"
|
||||
placeholder="请输入处分期"
|
||||
style="width: 100%" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="是否需要思想汇报" prop="needReport">
|
||||
<el-radio-group v-model="form.needReport">
|
||||
<el-radio label="1">是</el-radio>
|
||||
<el-radio label="0">否</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12" class="mb20" v-if="form.needReport === '1'">
|
||||
<el-form-item label="思想汇报次数" prop="reportTimes">
|
||||
<el-input-number
|
||||
v-model="form.reportTimes"
|
||||
:min="0"
|
||||
:max="999"
|
||||
placeholder="请输入思想汇报次数"
|
||||
style="width: 100%" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12" class="mb20" v-if="form.needReport === '1'">
|
||||
<el-form-item label="汇报频率(月)" prop="reportFrequency">
|
||||
<el-input-number
|
||||
v-model="form.reportFrequency"
|
||||
:min="0"
|
||||
:max="999"
|
||||
placeholder="请输入汇报频率"
|
||||
style="width: 100%" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="到期提醒天数" prop="remindDays">
|
||||
<el-input-number
|
||||
v-model="form.remindDays"
|
||||
:min="0"
|
||||
:max="999"
|
||||
placeholder="请输入到期提醒天数"
|
||||
style="width: 100%" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="排序" prop="sort">
|
||||
<el-input-number
|
||||
v-model="form.sort"
|
||||
:min="0"
|
||||
:max="999"
|
||||
placeholder="请输入排序"
|
||||
style="width: 100%" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="状态" prop="status">
|
||||
<el-radio-group v-model="form.status">
|
||||
<el-radio label="1">启用</el-radio>
|
||||
<el-radio label="0">禁用</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="24" class="mb20">
|
||||
<el-form-item label="备注" prop="remarks">
|
||||
<el-input
|
||||
v-model="form.remarks"
|
||||
type="textarea"
|
||||
:rows="3"
|
||||
placeholder="请输入备注"
|
||||
maxlength="250"
|
||||
show-word-limit
|
||||
style="width: 100%" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<span class="dialog-footer">
|
||||
<el-button @click="visible = false">取 消</el-button>
|
||||
<el-button type="primary" @click="onSubmit" :disabled="loading">确 认</el-button>
|
||||
</span>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts" name="StuPunlishLevelConfigFormDialog">
|
||||
import { ref, reactive, nextTick } from 'vue'
|
||||
import { useMessage } from '/@/hooks/message'
|
||||
import { addObj, editObj, getDetail } from '/@/api/stuwork/stupunlishlevelconfig'
|
||||
import {useDict} from "/@/hooks/dict";
|
||||
|
||||
const emit = defineEmits(['refresh'])
|
||||
|
||||
// 定义变量内容
|
||||
const dataFormRef = ref()
|
||||
const visible = ref(false)
|
||||
const loading = ref(false)
|
||||
const operType = ref('add')
|
||||
const { punlish_level } = useDict('punlish_level');
|
||||
// 提交表单数据
|
||||
const form = reactive({
|
||||
id: '',
|
||||
levelCode: '',
|
||||
levelName: '',
|
||||
punishDuration: 0,
|
||||
needReport: '0',
|
||||
reportTimes: 0,
|
||||
reportFrequency: 0,
|
||||
remindDays: 0,
|
||||
sort: 0,
|
||||
status: '1',
|
||||
remarks: ''
|
||||
})
|
||||
|
||||
// 定义校验规则
|
||||
const dataRules = {
|
||||
levelCode: [
|
||||
{ required: true, message: '请输入处分等级代码', trigger: 'blur' }
|
||||
],
|
||||
levelName: [
|
||||
{ required: true, message: '请输入处分等级名称', trigger: 'blur' }
|
||||
],
|
||||
needReport: [
|
||||
{ required: true, message: '请选择是否需要思想汇报', trigger: 'change' }
|
||||
],
|
||||
status: [
|
||||
{ required: true, message: '请选择状态', trigger: 'change' }
|
||||
]
|
||||
}
|
||||
|
||||
// 打开弹窗
|
||||
const openDialog = async (type: string = 'add', row?: any) => {
|
||||
visible.value = true
|
||||
operType.value = type
|
||||
|
||||
// 重置表单数据
|
||||
nextTick(() => {
|
||||
dataFormRef.value?.resetFields()
|
||||
form.id = ''
|
||||
form.levelCode = ''
|
||||
form.levelName = ''
|
||||
form.punishDuration = 0
|
||||
form.needReport = '0'
|
||||
form.reportTimes = 0
|
||||
form.reportFrequency = 0
|
||||
form.remindDays = 0
|
||||
form.sort = 0
|
||||
form.status = '1'
|
||||
form.remarks = ''
|
||||
|
||||
// 编辑时填充数据
|
||||
if (type === 'edit' && row) {
|
||||
form.id = row.id
|
||||
form.levelCode = row.levelCode || ''
|
||||
form.levelName = row.levelName || ''
|
||||
form.punishDuration = row.punishDuration || 0
|
||||
form.needReport = row.needReport || '0'
|
||||
form.reportTimes = row.reportTimes || 0
|
||||
form.reportFrequency = row.reportFrequency || 0
|
||||
form.remindDays = row.remindDays || 0
|
||||
form.sort = row.sort || 0
|
||||
form.status = row.status || '1'
|
||||
form.remarks = row.remarks || ''
|
||||
|
||||
// 如果需要获取详情
|
||||
if (row.id && (!row.levelCode || !row.levelName)) {
|
||||
loading.value = true
|
||||
getDetail(row.id).then((res: any) => {
|
||||
if (res.data) {
|
||||
form.levelCode = res.data.levelCode || ''
|
||||
form.levelName = res.data.levelName || ''
|
||||
form.punishDuration = res.data.punishDuration || 0
|
||||
form.needReport = res.data.needReport || '0'
|
||||
form.reportTimes = res.data.reportTimes || 0
|
||||
form.reportFrequency = res.data.reportFrequency || 0
|
||||
form.remindDays = res.data.remindDays || 0
|
||||
form.sort = res.data.sort || 0
|
||||
form.status = res.data.status || '1'
|
||||
form.remarks = res.data.remarks || ''
|
||||
}
|
||||
}).catch(() => {
|
||||
}).finally(() => {
|
||||
loading.value = false
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// 提交表单
|
||||
const onSubmit = async () => {
|
||||
if (!dataFormRef.value) return
|
||||
|
||||
await dataFormRef.value.validate(async (valid: boolean) => {
|
||||
if (!valid) return
|
||||
|
||||
loading.value = true
|
||||
try {
|
||||
const submitData = {
|
||||
levelCode: form.levelCode,
|
||||
levelName: form.levelName,
|
||||
punishDuration: form.punishDuration,
|
||||
needReport: form.needReport,
|
||||
reportTimes: form.needReport === '1' ? form.reportTimes : 0,
|
||||
reportFrequency: form.needReport === '1' ? form.reportFrequency : 0,
|
||||
remindDays: form.remindDays,
|
||||
sort: form.sort,
|
||||
status: form.status,
|
||||
remarks: form.remarks
|
||||
}
|
||||
|
||||
if (operType.value === 'add') {
|
||||
await addObj(submitData)
|
||||
useMessage().success('新增成功')
|
||||
} else {
|
||||
await editObj({
|
||||
id: form.id,
|
||||
...submitData
|
||||
})
|
||||
useMessage().success('编辑成功')
|
||||
}
|
||||
visible.value = false
|
||||
emit('refresh')
|
||||
} catch (err: any) {
|
||||
useMessage().error(err.msg || (operType.value === 'add' ? '新增失败' : '编辑失败'))
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// 暴露方法
|
||||
defineExpose({
|
||||
openDialog
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
</style>
|
||||
276
src/views/stuwork/stupunlishlevelconfig/index.vue
Normal file
276
src/views/stuwork/stupunlishlevelconfig/index.vue
Normal file
@@ -0,0 +1,276 @@
|
||||
<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="levelName">
|
||||
<el-select
|
||||
v-model="state.queryForm.levelCode"
|
||||
filterable
|
||||
clearable
|
||||
placeholder="请选择处分等级">
|
||||
<el-option
|
||||
v-for="item in punlish_level"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="状态" prop="status">
|
||||
<el-select
|
||||
v-model="state.queryForm.status"
|
||||
placeholder="请选择状态"
|
||||
clearable
|
||||
style="width: 200px">
|
||||
<el-option label="启用" value="1" />
|
||||
<el-option label="禁用" value="0" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" 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"
|
||||
class="ml10"
|
||||
@queryTable="getDataList">
|
||||
<TableColumnControl
|
||||
ref="columnControlRef"
|
||||
:columns="tableColumns"
|
||||
v-model="visibleColumns"
|
||||
trigger-type="default"
|
||||
trigger-circle
|
||||
@change="handleColumnChange"
|
||||
@order-change="handleColumnOrderChange"
|
||||
>
|
||||
<template #trigger>
|
||||
<el-tooltip class="item" effect="dark" content="列设置" placement="top">
|
||||
<el-button circle style="margin-left: 0;">
|
||||
<el-icon><Menu /></el-icon>
|
||||
</el-button>
|
||||
</el-tooltip>
|
||||
</template>
|
||||
</TableColumnControl>
|
||||
</right-toolbar>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<!-- 表格 -->
|
||||
<el-table
|
||||
:data="state.dataList"
|
||||
v-loading="state.loading"
|
||||
stripe
|
||||
:cell-style="tableStyle.cellStyle"
|
||||
:header-cell-style="tableStyle.headerCellStyle"
|
||||
class="modern-table">
|
||||
<el-table-column type="index" label="序号" width="70" align="center">
|
||||
<template #header>
|
||||
<el-icon><List /></el-icon>
|
||||
</template>
|
||||
<template #default="{ $index }">
|
||||
{{ $index + 1 + ((state.pagination?.current || 1) - 1) * (state.pagination?.size || 10) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<template v-for="col in visibleColumnsSorted" :key="col.prop || col.label">
|
||||
<el-table-column
|
||||
v-if="checkColumnVisible(col.prop || '') && col.prop !== '操作'"
|
||||
:prop="col.prop"
|
||||
:label="col.label"
|
||||
:width="col.width"
|
||||
:min-width="col.minWidth"
|
||||
:show-overflow-tooltip="col.showOverflowTooltip !== false"
|
||||
:align="col.align || 'center'">
|
||||
<template #header>
|
||||
<el-icon v-if="col.icon"><component :is="col.icon" /></el-icon>
|
||||
<span :style="{ marginLeft: col.icon ? '4px' : '0' }">{{ col.label }}</span>
|
||||
</template>
|
||||
<!-- 是否需要思想汇报 -->
|
||||
<template v-if="col.prop === 'needReport'" #default="scope">
|
||||
<el-tag size="small" :type="scope.row.needReport === '1' ? 'success' : 'info'" effect="plain">
|
||||
{{ scope.row.needReport === '1' ? '是' : '否' }}
|
||||
</el-tag>
|
||||
</template>
|
||||
<!-- 状态列 -->
|
||||
<template v-else-if="col.prop === 'status'" #default="scope">
|
||||
<el-tag size="small" :type="scope.row.status === '1' ? 'success' : 'danger'" effect="plain">
|
||||
{{ scope.row.status === '1' ? '启用' : '禁用' }}
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</template>
|
||||
<el-table-column label="操作" width="180" align="center" fixed="right">
|
||||
<template #header>
|
||||
<el-icon><Setting /></el-icon>
|
||||
<span style="margin-left: 4px">操作</span>
|
||||
</template>
|
||||
<template #default="scope">
|
||||
<el-button
|
||||
icon="EditPen"
|
||||
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>
|
||||
<template #empty>
|
||||
<el-empty description="暂无数据" :image-size="120">
|
||||
<el-button type="primary" icon="Plus" @click="formDialogRef.openDialog()">新增配置</el-button>
|
||||
</el-empty>
|
||||
</template>
|
||||
</el-table>
|
||||
|
||||
<!-- 分页 -->
|
||||
<div class="pagination-wrapper">
|
||||
<pagination
|
||||
@size-change="sizeChangeHandle"
|
||||
@current-change="currentChangeHandle"
|
||||
v-bind="state.pagination" />
|
||||
</div>
|
||||
</el-card>
|
||||
</div>
|
||||
|
||||
<!-- 新增/编辑表单弹窗 -->
|
||||
<form-dialog ref="formDialogRef" @refresh="getDataList" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts" name="StuPunlishLevelConfig">
|
||||
import { reactive, ref } from 'vue'
|
||||
import { BasicTableProps, useTable } from "/@/hooks/table";
|
||||
import { fetchList, delObj } from "/@/api/stuwork/stupunlishlevelconfig";
|
||||
import { useMessage, useMessageBox } from "/@/hooks/message";
|
||||
import TableColumnControl from '/@/components/TableColumnControl/index.vue'
|
||||
import FormDialog from './form.vue'
|
||||
import { List, Document, Collection, EditPen, Setting, Menu, Search, Warning, Clock, Bell, Sort, CircleCheck } from '@element-plus/icons-vue'
|
||||
import { useTableColumnControl } from '/@/hooks/tableColumn'
|
||||
import {useDict} from "/@/hooks/dict";
|
||||
|
||||
// 定义变量内容
|
||||
const formDialogRef = ref()
|
||||
const searchFormRef = ref()
|
||||
const columnControlRef = ref()
|
||||
const showSearch = ref(true)
|
||||
const { punlish_level } = useDict('punlish_level');
|
||||
// 表格列配置
|
||||
const tableColumns = [
|
||||
{ prop: 'levelCode', label: '处分等级代码', icon: Collection, width: 140 },
|
||||
{ prop: 'levelName', label: '处分等级名称', icon: Warning, minWidth: 120 },
|
||||
{ prop: 'punishDuration', label: '处分期(月)', icon: Clock, width: 100 },
|
||||
{ prop: 'needReport', label: '是否需要思想汇报', icon: Document, width: 140 },
|
||||
{ prop: 'reportTimes', label: '思想汇报次数', icon: EditPen, width: 120 },
|
||||
{ prop: 'reportFrequency', label: '汇报频率(月)', icon: Clock, width: 120 },
|
||||
{ prop: 'remindDays', label: '到期提醒天数', icon: Bell, width: 120 },
|
||||
{ prop: 'sort', label: '排序', icon: Sort, width: 80 },
|
||||
{ prop: 'status', label: '状态', icon: CircleCheck, width: 80 }
|
||||
]
|
||||
|
||||
// 使用表格列控制 Hook
|
||||
const {
|
||||
visibleColumns,
|
||||
visibleColumnsSorted,
|
||||
checkColumnVisible,
|
||||
handleColumnChange,
|
||||
handleColumnOrderChange
|
||||
} = useTableColumnControl(tableColumns)
|
||||
|
||||
// 表格样式
|
||||
const tableStyle = {
|
||||
cellStyle: { padding: '8px 0' },
|
||||
headerCellStyle: { background: '#f5f7fa', color: '#606266', fontWeight: 'bold' }
|
||||
}
|
||||
|
||||
// 配置 useTable
|
||||
const state: BasicTableProps = reactive<BasicTableProps>({
|
||||
queryForm: {
|
||||
levelName: '',
|
||||
status: ''
|
||||
},
|
||||
pageList: fetchList,
|
||||
props: {
|
||||
item: 'records',
|
||||
totalCount: 'total'
|
||||
},
|
||||
createdIsNeed: true
|
||||
})
|
||||
|
||||
// table hook
|
||||
const {
|
||||
getDataList,
|
||||
currentChangeHandle,
|
||||
sizeChangeHandle
|
||||
} = useTable(state)
|
||||
|
||||
// 重置
|
||||
const handleReset = () => {
|
||||
searchFormRef.value?.resetFields()
|
||||
state.queryForm.levelCode = ''
|
||||
state.queryForm.status = ''
|
||||
getDataList()
|
||||
}
|
||||
|
||||
// 编辑
|
||||
const handleEdit = (row: any) => {
|
||||
formDialogRef.value?.openDialog('edit', row)
|
||||
}
|
||||
|
||||
// 删除
|
||||
const handleDelete = async (row: any) => {
|
||||
const { confirm } = useMessageBox()
|
||||
try {
|
||||
await confirm('确定要删除该处分等级配置吗?')
|
||||
await delObj([row.id])
|
||||
useMessage().success('删除成功')
|
||||
getDataList()
|
||||
} catch (err: any) {
|
||||
if (err !== 'cancel') {
|
||||
useMessage().error(err.msg || '删除失败')
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
@import '/@/assets/styles/modern-page.scss';
|
||||
</style>
|
||||
Reference in New Issue
Block a user