活动记录和操行考核学期预警
This commit is contained in:
@@ -60,3 +60,16 @@ export const delObj = (ids: string[]) => {
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* 按学年学期统计各班级举办活动次数
|
||||
* @param schoolYear 学年
|
||||
* @param schoolTerm 学期
|
||||
*/
|
||||
export const statisticsByYearTerm = (schoolYear?: string, schoolTerm?: string) => {
|
||||
return request({
|
||||
url: '/stuwork/classactivity/statistics',
|
||||
method: 'get',
|
||||
params: { schoolYear, schoolTerm }
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
@@ -113,3 +113,16 @@ export const getStuConductYear = (query?: any) => {
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* 发送学期操行考核预警
|
||||
* @param schoolYear 学年
|
||||
* @param schoolTerm 学期
|
||||
*/
|
||||
export const sendConductWarning = (schoolYear: string, schoolTerm: string) => {
|
||||
return request({
|
||||
url: '/stuwork/stuconduct/sendWarning',
|
||||
method: 'post',
|
||||
params: { schoolYear, schoolTerm }
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
@@ -77,9 +77,15 @@
|
||||
班级活动列表
|
||||
</span>
|
||||
<div class="header-actions">
|
||||
<el-button
|
||||
icon="Plus"
|
||||
type="primary"
|
||||
<el-button
|
||||
icon="DataAnalysis"
|
||||
type="success"
|
||||
@click="handleStatistics">
|
||||
活动统计
|
||||
</el-button>
|
||||
<el-button
|
||||
icon="Plus"
|
||||
type="primary"
|
||||
@click="formDialogRef.openDialog()">
|
||||
新增
|
||||
</el-button>
|
||||
@@ -225,20 +231,94 @@
|
||||
|
||||
<!-- 新增/编辑表单弹窗 -->
|
||||
<form-dialog ref="formDialogRef" @refresh="getDataList" />
|
||||
|
||||
<!-- 统计对话框 -->
|
||||
<el-dialog
|
||||
v-model="statisticsDialogVisible"
|
||||
title="班级活动统计"
|
||||
width="800px"
|
||||
destroy-on-close>
|
||||
<!-- 搜索条件 -->
|
||||
<el-form :inline="true" class="statistics-form">
|
||||
<el-form-item label="学年">
|
||||
<el-select
|
||||
v-model="statisticsQuery.schoolYear"
|
||||
placeholder="请选择学年"
|
||||
clearable
|
||||
filterable
|
||||
style="width: 180px">
|
||||
<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="学期">
|
||||
<el-select
|
||||
v-model="statisticsQuery.schoolTerm"
|
||||
placeholder="请选择学期"
|
||||
clearable
|
||||
style="width: 180px">
|
||||
<el-option
|
||||
v-for="item in schoolTermList"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="Search" @click="getStatisticsData">查询</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<!-- 统计表格 -->
|
||||
<el-table
|
||||
:data="statisticsData"
|
||||
v-loading="statisticsLoading"
|
||||
stripe
|
||||
max-height="400px"
|
||||
:cell-style="tableStyle.cellStyle"
|
||||
:header-cell-style="tableStyle.headerCellStyle">
|
||||
<el-table-column type="index" label="序号" width="70" align="center" />
|
||||
<el-table-column prop="classNo" label="班号" align="center" />
|
||||
<el-table-column prop="schoolYear" label="学年" align="center" />
|
||||
<el-table-column prop="schoolTerm" label="学期" align="center">
|
||||
<template #default="{ row }">
|
||||
<el-tag size="small" type="primary" effect="plain" round>
|
||||
{{ formatSchoolTerm(row.schoolTerm) }}
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="activityCount" label="活动次数" align="center">
|
||||
<template #default="{ row }">
|
||||
<el-tag size="small" type="success" effect="plain" round>
|
||||
{{ row.activityCount }} 次
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<template #footer>
|
||||
<el-button @click="statisticsDialogVisible = false">关闭</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts" name="ClassActivity">
|
||||
import { reactive, ref, onMounted } from 'vue'
|
||||
import { BasicTableProps, useTable } from "/@/hooks/table";
|
||||
import { fetchList, delObj } from "/@/api/stuwork/classactivity";
|
||||
import { fetchList, delObj, statisticsByYearTerm } from "/@/api/stuwork/classactivity";
|
||||
import { getClassListByRole } from "/@/api/basic/basicclass";
|
||||
import { queryAllSchoolYear } from "/@/api/basic/basicyear";
|
||||
import { getDicts } from "/@/api/admin/dict";
|
||||
import { useMessage, useMessageBox } from "/@/hooks/message";
|
||||
import TableColumnControl from '/@/components/TableColumnControl/index.vue'
|
||||
import FormDialog from './form.vue'
|
||||
import { List, Calendar, Clock, Grid, Trophy, User, Location, UserFilled, Setting, Menu, Search, Document, EditPen, Picture } from '@element-plus/icons-vue'
|
||||
import { List, Calendar, Clock, Grid, Trophy, User, Location, UserFilled, Setting, Menu, Search, Document, EditPen, Picture, DataAnalysis } from '@element-plus/icons-vue'
|
||||
import { useTableColumnControl } from '/@/hooks/tableColumn'
|
||||
|
||||
// 定义变量内容
|
||||
@@ -250,6 +330,15 @@ const schoolYearList = ref<any[]>([])
|
||||
const schoolTermList = ref<any[]>([])
|
||||
const classList = ref<any[]>([])
|
||||
|
||||
// 统计相关变量
|
||||
const statisticsDialogVisible = ref(false)
|
||||
const statisticsLoading = ref(false)
|
||||
const statisticsData = ref<any[]>([])
|
||||
const statisticsQuery = reactive({
|
||||
schoolYear: '',
|
||||
schoolTerm: ''
|
||||
})
|
||||
|
||||
// 表格列配置
|
||||
const tableColumns = [
|
||||
{ prop: 'schoolYear', label: '学年', icon: Calendar },
|
||||
@@ -397,6 +486,40 @@ const getClassListData = async () => {
|
||||
}
|
||||
}
|
||||
|
||||
// 打开统计对话框
|
||||
const handleStatistics = () => {
|
||||
// 使用当前搜索条件的学年和学期
|
||||
statisticsQuery.schoolYear = state.queryForm.schoolYear || ''
|
||||
statisticsQuery.schoolTerm = state.queryForm.schoolTerm || ''
|
||||
statisticsData.value = []
|
||||
statisticsDialogVisible.value = true
|
||||
}
|
||||
|
||||
// 获取统计数据
|
||||
const getStatisticsData = async () => {
|
||||
// 必须选择学年或学期才能查询
|
||||
if (!statisticsQuery.schoolYear && !statisticsQuery.schoolTerm) {
|
||||
useMessage().warning('请选择学年或学期进行查询')
|
||||
return
|
||||
}
|
||||
statisticsLoading.value = true
|
||||
try {
|
||||
const res = await statisticsByYearTerm(
|
||||
statisticsQuery.schoolYear || undefined,
|
||||
statisticsQuery.schoolTerm || undefined
|
||||
)
|
||||
if (res.data && Array.isArray(res.data)) {
|
||||
statisticsData.value = res.data
|
||||
} else {
|
||||
statisticsData.value = []
|
||||
}
|
||||
} catch (err) {
|
||||
statisticsData.value = []
|
||||
} finally {
|
||||
statisticsLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
// 初始化
|
||||
onMounted(() => {
|
||||
getSchoolYearList()
|
||||
|
||||
@@ -51,6 +51,7 @@
|
||||
<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="warning" icon="Bell" @click="handleSendWarning" :loading="warningLoading">发送预警</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-row>
|
||||
@@ -159,11 +160,11 @@
|
||||
|
||||
<script setup lang="ts" name="StuConductTerm">
|
||||
import { reactive, ref, onMounted, computed } from 'vue'
|
||||
import { getStuConductTerm, queryDataByStuNo } from "/@/api/stuwork/stuconduct";
|
||||
import { getStuConductTerm, queryDataByStuNo, sendConductWarning } from "/@/api/stuwork/stuconduct";
|
||||
import { getClassListByRole } from "/@/api/basic/basicclass";
|
||||
import { queryAllSchoolYear } from "/@/api/basic/basicyear";
|
||||
import { getDicts } from "/@/api/admin/dict";
|
||||
import { useMessage } from "/@/hooks/message";
|
||||
import { useMessage, useMessageBox } from "/@/hooks/message";
|
||||
|
||||
// 表格样式 - 在组件内部定义,不从外部导入
|
||||
const tableStyle = {
|
||||
@@ -175,6 +176,7 @@ const tableStyle = {
|
||||
const searchFormRef = ref()
|
||||
const showSearch = ref(true)
|
||||
const loading = ref(false)
|
||||
const warningLoading = ref(false)
|
||||
const schoolYearList = ref<any[]>([])
|
||||
const schoolTermList = ref<any[]>([])
|
||||
const classList = ref<any[]>([])
|
||||
@@ -365,6 +367,29 @@ const handleView = async (row: any) => {
|
||||
}
|
||||
}
|
||||
|
||||
// 发送学期操行考核预警
|
||||
const handleSendWarning = async () => {
|
||||
if (!queryForm.schoolYear || !queryForm.schoolTerm) {
|
||||
useMessage().warning('请先选择学年 and 学期')
|
||||
return
|
||||
}
|
||||
|
||||
const { confirm } = useMessageBox()
|
||||
try {
|
||||
await confirm(`确定要发送${queryForm.schoolYear}学年第${queryForm.schoolTerm === '1' ? '一' : '二'}学期操行考核预警吗?将向班主任推送不及格学生(低于60分)的预警通知。`)
|
||||
|
||||
warningLoading.value = true
|
||||
const res = await sendConductWarning(queryForm.schoolYear, queryForm.schoolTerm)
|
||||
useMessage().success(res.msg || '预警通知发送成功')
|
||||
} catch (err: any) {
|
||||
if (err !== 'cancel') {
|
||||
useMessage().error(err.msg || '预警通知发送失败')
|
||||
}
|
||||
} finally {
|
||||
warningLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
// 获取学年列表
|
||||
const getSchoolYearList = async () => {
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user