feat: 新增很多页面
This commit is contained in:
406
src/views/stuwork/classroomhygienemonthly/index.vue
Normal file
406
src/views/stuwork/classroomhygienemonthly/index.vue
Normal file
@@ -0,0 +1,406 @@
|
||||
<template>
|
||||
<div class="layout-padding">
|
||||
<div class="layout-padding-auto layout-padding-view">
|
||||
<!-- 搜索表单 -->
|
||||
<el-row v-show="showSearch">
|
||||
<el-form :model="searchForm" ref="searchFormRef" :inline="true" @keyup.enter="handleSearch">
|
||||
<el-form-item label="学年" prop="schoolYear">
|
||||
<el-select
|
||||
v-model="searchForm.schoolYear"
|
||||
placeholder="请选择学年"
|
||||
clearable
|
||||
filterable
|
||||
style="width: 200px">
|
||||
<el-option
|
||||
v-for="item in schoolYearList"
|
||||
:key="item.year"
|
||||
:label="item.year"
|
||||
:value="item.year">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="学期" prop="schoolTerm">
|
||||
<el-input
|
||||
v-model="searchForm.schoolTerm"
|
||||
placeholder="请输入学期"
|
||||
clearable
|
||||
style="width: 200px" />
|
||||
</el-form-item>
|
||||
<el-form-item label="月份" prop="month">
|
||||
<el-date-picker
|
||||
v-model="searchForm.month"
|
||||
type="month"
|
||||
placeholder="请选择月份"
|
||||
format="YYYY-MM"
|
||||
value-format="YYYY-MM"
|
||||
clearable
|
||||
style="width: 200px" />
|
||||
</el-form-item>
|
||||
<el-form-item label="学院" prop="deptCode">
|
||||
<el-select
|
||||
v-model="searchForm.deptCode"
|
||||
placeholder="请选择学院"
|
||||
clearable
|
||||
filterable
|
||||
style="width: 200px">
|
||||
<el-option
|
||||
v-for="item in deptList"
|
||||
:key="item.deptCode"
|
||||
:label="item.deptName"
|
||||
:value="item.deptCode">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="班号" prop="classCode">
|
||||
<el-select
|
||||
v-model="searchForm.classCode"
|
||||
placeholder="请选择班号"
|
||||
clearable
|
||||
filterable
|
||||
style="width: 200px">
|
||||
<el-option
|
||||
v-for="item in filteredClassList"
|
||||
:key="item.classCode"
|
||||
:label="item.classNo"
|
||||
:value="item.classCode">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" plain icon="Search" @click="handleSearch">查询</el-button>
|
||||
<el-button icon="Refresh" @click="handleReset">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-row>
|
||||
|
||||
<!-- 操作按钮 -->
|
||||
<el-row>
|
||||
<div class="mb8" style="width: 100%">
|
||||
<el-button
|
||||
icon="Upload"
|
||||
type="primary"
|
||||
class="ml10"
|
||||
@click="handleImport">
|
||||
导入
|
||||
</el-button>
|
||||
<el-button
|
||||
icon="DocumentChecked"
|
||||
type="success"
|
||||
class="ml10"
|
||||
@click="handleCheck">
|
||||
考核
|
||||
</el-button>
|
||||
<right-toolbar
|
||||
v-model:showSearch="showSearch"
|
||||
class="ml10 mr20"
|
||||
style="float: right;"
|
||||
@queryTable="getDataList">
|
||||
</right-toolbar>
|
||||
</div>
|
||||
</el-row>
|
||||
|
||||
<!-- 表格 -->
|
||||
<el-table
|
||||
:data="state.dataList"
|
||||
v-loading="state.loading"
|
||||
border
|
||||
:cell-style="tableStyle.cellStyle"
|
||||
:header-cell-style="tableStyle.headerCellStyle"
|
||||
@sort-change="sortChangeHandle">
|
||||
<el-table-column type="index" label="序号" width="60" align="center" />
|
||||
<el-table-column prop="schoolYear" label="学年" show-overflow-tooltip />
|
||||
<el-table-column prop="schoolTerm" label="学期" show-overflow-tooltip />
|
||||
<el-table-column prop="deptName" label="学院" show-overflow-tooltip />
|
||||
<el-table-column prop="classNo" label="班号" show-overflow-tooltip />
|
||||
<el-table-column prop="classMasterName" label="班主任" show-overflow-tooltip />
|
||||
<el-table-column prop="buildingNo" label="教学楼号" show-overflow-tooltip />
|
||||
<el-table-column prop="position" label="教室号" show-overflow-tooltip />
|
||||
<el-table-column prop="score" label="评分" show-overflow-tooltip />
|
||||
<el-table-column prop="note" label="检查记录" show-overflow-tooltip />
|
||||
<el-table-column prop="month" label="月份" show-overflow-tooltip />
|
||||
<el-table-column label="操作" width="150" align="center" fixed="right">
|
||||
<template #default="scope">
|
||||
<el-button
|
||||
icon="Delete"
|
||||
text
|
||||
type="danger"
|
||||
@click="handleDelete([scope.row.id])">
|
||||
删除
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<!-- 分页 -->
|
||||
<pagination
|
||||
@size-change="sizeChangeHandle"
|
||||
@current-change="currentChangeHandle"
|
||||
v-bind="state.pagination" />
|
||||
</div>
|
||||
|
||||
<!-- 导入对话框 -->
|
||||
<upload-excel
|
||||
ref="uploadExcelRef"
|
||||
:title="'导入教室月卫生'"
|
||||
:url="'/stuwork/classroomhygienemonthly/importData'"
|
||||
:temp-url="templateUrl"
|
||||
@refreshDataList="getDataList" />
|
||||
|
||||
<!-- 考核对话框 -->
|
||||
<el-dialog
|
||||
v-model="checkDialogVisible"
|
||||
title="教室卫生考核"
|
||||
:close-on-click-modal="false"
|
||||
draggable
|
||||
width="500px">
|
||||
<el-form
|
||||
ref="checkFormRef"
|
||||
:model="checkForm"
|
||||
label-width="100px">
|
||||
<el-form-item label="学年" prop="schoolYear">
|
||||
<el-select
|
||||
v-model="checkForm.schoolYear"
|
||||
placeholder="请选择学年"
|
||||
clearable
|
||||
filterable
|
||||
style="width: 100%">
|
||||
<el-option
|
||||
v-for="item in schoolYearList"
|
||||
:key="item.year"
|
||||
:label="item.year"
|
||||
:value="item.year">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="学期" prop="schoolTerm">
|
||||
<el-input
|
||||
v-model="checkForm.schoolTerm"
|
||||
placeholder="请输入学期"
|
||||
clearable />
|
||||
</el-form-item>
|
||||
<el-form-item label="月份" prop="month">
|
||||
<el-date-picker
|
||||
v-model="checkForm.month"
|
||||
type="month"
|
||||
placeholder="请选择月份"
|
||||
format="YYYY-MM"
|
||||
value-format="YYYY-MM"
|
||||
clearable
|
||||
style="width: 100%" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<span class="dialog-footer">
|
||||
<el-button @click="checkDialogVisible = false">取 消</el-button>
|
||||
<el-button type="primary" @click="confirmCheck">确 认</el-button>
|
||||
</span>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts" name="ClassRoomHygieneMonthly">
|
||||
import { ref, reactive, defineAsyncComponent, computed, onMounted } from 'vue'
|
||||
import { BasicTableProps, useTable } from "/@/hooks/table";
|
||||
import { fetchList, delObjs, checkClassRoomHygieneMonthly } from "/@/api/stuwork/classroomhygienemonthly";
|
||||
import { useMessage, useMessageBox } from "/@/hooks/message";
|
||||
import { queryAllSchoolYear } from '/@/api/basic/basicyear'
|
||||
import { getDeptList } from '/@/api/basic/basicclass'
|
||||
import { getClassListByRole } from '/@/api/basic/basicclass'
|
||||
|
||||
// 引入组件
|
||||
const UploadExcel = defineAsyncComponent(() => import('/@/components/Upload/Excel.vue'));
|
||||
|
||||
// 定义变量内容
|
||||
const searchFormRef = ref()
|
||||
const uploadExcelRef = ref()
|
||||
const checkFormRef = ref()
|
||||
// 搜索变量
|
||||
const showSearch = ref(true)
|
||||
const schoolYearList = ref<any[]>([])
|
||||
const deptList = ref<any[]>([])
|
||||
const classList = ref<any[]>([])
|
||||
const checkDialogVisible = ref(false)
|
||||
// 模板文件URL
|
||||
const templateUrl = ref('assets/file/教室月卫生导入模板.xlsx')
|
||||
|
||||
// 考核表单
|
||||
const checkForm = reactive({
|
||||
schoolYear: '',
|
||||
schoolTerm: '',
|
||||
month: ''
|
||||
})
|
||||
|
||||
// 搜索表单
|
||||
const searchForm = reactive({
|
||||
schoolYear: '',
|
||||
schoolTerm: '',
|
||||
month: '',
|
||||
deptCode: '',
|
||||
classCode: ''
|
||||
})
|
||||
|
||||
// 根据学院筛选班级列表
|
||||
const filteredClassList = computed(() => {
|
||||
if (!searchForm.deptCode) {
|
||||
return classList.value
|
||||
}
|
||||
return classList.value.filter((item: any) => item.deptCode === searchForm.deptCode)
|
||||
})
|
||||
|
||||
// 配置 useTable
|
||||
const state: BasicTableProps = reactive<BasicTableProps>({
|
||||
queryForm: searchForm,
|
||||
pageList: fetchList,
|
||||
props: {
|
||||
item: 'records',
|
||||
totalCount: 'total'
|
||||
}
|
||||
})
|
||||
|
||||
// table hook
|
||||
const {
|
||||
getDataList,
|
||||
currentChangeHandle,
|
||||
sizeChangeHandle,
|
||||
sortChangeHandle,
|
||||
tableStyle
|
||||
} = useTable(state)
|
||||
|
||||
// 查询
|
||||
const handleSearch = () => {
|
||||
getDataList()
|
||||
}
|
||||
|
||||
// 重置
|
||||
const handleReset = () => {
|
||||
searchFormRef.value?.resetFields()
|
||||
searchForm.schoolYear = ''
|
||||
searchForm.schoolTerm = ''
|
||||
searchForm.month = ''
|
||||
searchForm.deptCode = ''
|
||||
searchForm.classCode = ''
|
||||
getDataList()
|
||||
}
|
||||
|
||||
// 导入
|
||||
const handleImport = () => {
|
||||
(uploadExcelRef.value as any)?.show()
|
||||
}
|
||||
|
||||
// 考核
|
||||
const handleCheck = () => {
|
||||
checkDialogVisible.value = true
|
||||
Object.assign(checkForm, {
|
||||
schoolYear: '',
|
||||
schoolTerm: '',
|
||||
month: ''
|
||||
})
|
||||
}
|
||||
|
||||
// 确认考核
|
||||
const confirmCheck = async () => {
|
||||
if (!checkForm.schoolYear || !checkForm.schoolTerm || !checkForm.month) {
|
||||
useMessage().warning('请填写完整的考核信息')
|
||||
return
|
||||
}
|
||||
|
||||
// 格式化月份显示(如:2026-01)
|
||||
const monthDisplay = checkForm.month
|
||||
|
||||
try {
|
||||
await useMessageBox().confirm(
|
||||
`是否确认对${monthDisplay}月进行考核?\n1:如果当前指定年月份已经有考核数据,则会做覆盖处理;\n2:考核对象为所有有评分的班级`,
|
||||
'提示',
|
||||
{
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning',
|
||||
dangerouslyUseHTMLString: false
|
||||
}
|
||||
)
|
||||
} catch {
|
||||
return
|
||||
}
|
||||
|
||||
try {
|
||||
await checkClassRoomHygieneMonthly({
|
||||
schoolYear: checkForm.schoolYear,
|
||||
schoolTerm: checkForm.schoolTerm,
|
||||
month: checkForm.month
|
||||
})
|
||||
useMessage().success('考核成功')
|
||||
checkDialogVisible.value = false
|
||||
getDataList()
|
||||
} catch (err: any) {
|
||||
useMessage().error(err.msg || '考核失败')
|
||||
}
|
||||
}
|
||||
|
||||
// 删除操作
|
||||
const handleDelete = async (ids: string[]) => {
|
||||
try {
|
||||
await useMessageBox().confirm('此操作将永久删除', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
})
|
||||
} catch {
|
||||
return
|
||||
}
|
||||
|
||||
try {
|
||||
await delObjs(ids)
|
||||
getDataList()
|
||||
useMessage().success('删除成功')
|
||||
} catch (err: any) {
|
||||
useMessage().error(err.msg || '删除失败')
|
||||
}
|
||||
}
|
||||
|
||||
// 获取学年列表
|
||||
const getSchoolYearList = async () => {
|
||||
try {
|
||||
const res = await queryAllSchoolYear()
|
||||
if (res.data) {
|
||||
schoolYearList.value = Array.isArray(res.data) ? res.data : []
|
||||
}
|
||||
} catch (err) {
|
||||
console.error('获取学年列表失败', err)
|
||||
schoolYearList.value = []
|
||||
}
|
||||
}
|
||||
|
||||
// 获取学院列表
|
||||
const getDeptListData = async () => {
|
||||
try {
|
||||
const res = await getDeptList()
|
||||
if (res.data) {
|
||||
deptList.value = Array.isArray(res.data) ? res.data : []
|
||||
}
|
||||
} catch (err) {
|
||||
console.error('获取学院列表失败', err)
|
||||
deptList.value = []
|
||||
}
|
||||
}
|
||||
|
||||
// 获取班号列表
|
||||
const getClassListData = async () => {
|
||||
try {
|
||||
const res = await getClassListByRole()
|
||||
if (res.data) {
|
||||
classList.value = Array.isArray(res.data) ? res.data : []
|
||||
}
|
||||
} catch (err) {
|
||||
console.error('获取班号列表失败', err)
|
||||
classList.value = []
|
||||
}
|
||||
}
|
||||
|
||||
// 初始化
|
||||
onMounted(() => {
|
||||
getSchoolYearList()
|
||||
getDeptListData()
|
||||
getClassListData()
|
||||
})
|
||||
</script>
|
||||
Reference in New Issue
Block a user