每周计划日卫生月卫生新增统计

This commit is contained in:
yaojian
2026-03-12 18:32:54 +08:00
parent ff2023709b
commit d9f7f85422
6 changed files with 340 additions and 23 deletions

View File

@@ -96,3 +96,16 @@ export function validateExist(rule: any, value: any, callback: any, isEdit: bool
}
});
}
/**
* 获取日卫生学年学期统计
* @param {Object} [query] - 查询参数schoolYear, schoolTerm
* @returns {Promise} 请求的 Promise 对象。
*/
export function summary(query?: Object) {
return request({
url: '/stuwork/classRoomHygieneDaily/summary',
method: 'get',
params: query,
});
}

View File

@@ -57,3 +57,16 @@ export const importData = (data: FormData) => {
},
});
};
/**
* 获取月卫生学年学期统计
* @param {Object} [query] - 查询参数schoolYear, schoolTerm
* @returns {Promise} 请求的 Promise 对象。
*/
export const monthlySummaryByYearTerm = (query?: Object) => {
return request({
url: '/stuwork/classroomhygienemonthly/monthlySummaryByYearTerm',
method: 'get',
params: query,
});
};

View File

@@ -96,3 +96,16 @@ export function validateExist(rule: any, value: any, callback: any, isEdit: bool
}
});
}
/**
* 获取班级班主任查看状况统计
* @param {Object} [query] - 查询参数schoolYear, schoolTerm
* @returns {Promise} 请求的 Promise 对象。
*/
export function readStatistics(query?: Object) {
return request({
url: '/stuwork/weekPlan/readStatistics',
method: 'get',
params: query,
});
}

View File

@@ -59,6 +59,7 @@
</span>
<div class="header-actions">
<el-button icon="FolderAdd" type="primary" @click="formDialogRef.openDialog()"> 新增 </el-button>
<el-button icon="DataAnalysis" type="info" class="ml10" @click="handleOpenSummary"> 学期统计 </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
@@ -166,19 +167,56 @@
:temp-url="templateUrl"
@refreshDataList="getDataList"
/>
<!-- 学期统计弹出框 -->
<el-dialog v-model="summaryVisible" title="日卫生学年学期统计" width="900px" destroy-on-close>
<el-form :model="summaryForm" :inline="true" class="mb10">
<el-form-item label="学年">
<el-select v-model="summaryForm.schoolYear" placeholder="请选择学年" clearable filterable style="width: 180px">
<el-option v-for="item in schoolYearList" :key="item.year" :label="item.year" :value="item.year" />
</el-select>
</el-form-item>
<el-form-item label="学期">
<el-select v-model="summaryForm.schoolTerm" placeholder="请选择学期" clearable style="width: 180px">
<el-option v-for="item in schoolTermList" :key="item.value" :label="item.label" :value="item.value" />
</el-select>
</el-form-item>
<el-form-item label="学院">
<el-select v-model="summaryForm.deptCode" placeholder="请选择学院" clearable filterable style="width: 180px">
<el-option v-for="item in deptList" :key="item.deptCode" :label="item.deptName" :value="item.deptCode" />
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="Search" @click="handleQuerySummary">查询</el-button>
</el-form-item>
</el-form>
<el-table :data="summaryData" v-loading="summaryLoading" stripe max-height="400" :cell-style="{ padding: '8px 0', textAlign: 'center' }" :header-cell-style="{ background: '#f5f7fa', color: '#606266', fontWeight: 'bold', textAlign: 'center' }">
<el-table-column type="index" label="序号" width="60" align="center" />
<el-table-column prop="deptName" label="学院" min-width="120" align="center" show-overflow-tooltip />
<el-table-column prop="className" label="班级" min-width="120" align="center" show-overflow-tooltip />
<el-table-column prop="totalScore" label="总分" min-width="100" align="center" />
<el-table-column prop="plusScore" label="加分" min-width="100" align="center" />
<el-table-column prop="minusScore" label="扣分" min-width="100" align="center" />
</el-table>
<template v-if="summaryData.length === 0 && !summaryLoading">
<el-empty description="暂无统计数据" :image-size="80" />
</template>
</el-dialog>
</div>
</template>
<script setup lang="ts" name="ClassRoomHygieneDaily">
import { ref, reactive, defineAsyncComponent, onMounted } from 'vue';
import { BasicTableProps, useTable } from '/@/hooks/table';
import { fetchList, delObjs } from '/@/api/stuwork/classroomhygienedaily';
import { fetchList, delObjs, summary } from '/@/api/stuwork/classroomhygienedaily';
import { downloadClassRoomHygieneDailyTemplate, makeExportClassRoomHygieneDailyTask, downloadBlobFile } from '/@/api/stuwork/file';
import { useMessage, useMessageBox } from '/@/hooks/message';
import { getDeptList } from '/@/api/basic/basicclass';
import { getClassListByRole } from '/@/api/basic/basicclass';
import { queryAllSchoolYear } from '/@/api/basic/basicyear';
import { getDicts } from '/@/api/admin/dict';
import TableColumnControl from '/@/components/TableColumnControl/index.vue';
import { List, OfficeBuilding, Grid, Calendar, Minus, Document, Setting, Menu, Search, EditPen } from '@element-plus/icons-vue';
import { List, OfficeBuilding, Grid, Calendar, Minus, Document, Setting, Menu, Search, EditPen, DataAnalysis } from '@element-plus/icons-vue';
import { useTableColumnControl } from '/@/hooks/tableColumn';
// 引入组件
@@ -197,6 +235,18 @@ const classList = ref<any[]>([]);
// 模板文件URL
const templateUrl = ref('/stuwork/classRoomHygieneDaily/import/template');
// 统计相关变量
const summaryVisible = ref(false);
const summaryLoading = ref(false);
const summaryData = ref<any[]>([]);
const schoolYearList = ref<any[]>([]);
const schoolTermList = ref<any[]>([]);
const summaryForm = reactive({
schoolYear: '',
schoolTerm: '',
deptCode: ''
});
// 表格列配置
const tableColumns = [
{ prop: 'deptName', label: '学院', icon: OfficeBuilding },
@@ -313,10 +363,72 @@ const handleDelete = async (ids: string[]) => {
}
};
// 打开统计弹窗
const handleOpenSummary = () => {
summaryVisible.value = true;
summaryForm.schoolYear = '';
summaryForm.schoolTerm = '';
summaryForm.deptCode = '';
summaryData.value = [];
};
// 查询统计数据
const handleQuerySummary = async () => {
if (!summaryForm.schoolYear || !summaryForm.schoolTerm) {
useMessage().warning('请选择学年和学期');
return;
}
summaryLoading.value = true;
try {
const res = await summary({
schoolYear: summaryForm.schoolYear,
schoolTerm: summaryForm.schoolTerm,
deptCode: summaryForm.deptCode
});
summaryData.value = Array.isArray(res.data) ? res.data : [];
} catch (err: any) {
useMessage().error(err.msg || '获取统计数据失败');
summaryData.value = [];
} finally {
summaryLoading.value = false;
}
};
// 获取学年列表
const getSchoolYearListData = async () => {
try {
const res = await queryAllSchoolYear();
if (res.data) {
schoolYearList.value = Array.isArray(res.data) ? res.data : [];
}
} catch (err) {
schoolYearList.value = [];
}
};
// 获取学期字典
const getSchoolTermDict = async () => {
try {
const res = await getDicts('school_term');
if (res.data) {
schoolTermList.value = Array.isArray(res.data)
? res.data.map((item: any) => ({
label: item.label || item.dictLabel || item.name,
value: item.value || item.dictValue || item.code,
}))
: [];
}
} catch (err) {
schoolTermList.value = [];
}
};
// 初始化
onMounted(() => {
getDeptListData();
getClassListData();
getSchoolYearListData();
getSchoolTermDict();
});
</script>

View File

@@ -59,6 +59,7 @@
<div class="header-actions">
<el-button icon="Upload" type="primary" @click="handleImport"> 导入 </el-button>
<el-button icon="Download" type="warning" class="ml10" @click="handleExport"> 导出 </el-button>
<el-button icon="DataAnalysis" type="info" class="ml10" @click="handleOpenSummary"> 学期统计 </el-button>
<el-button icon="DocumentChecked" type="success" class="ml10" @click="handleCheck"> 考核 </el-button>
<right-toolbar v-model:showSearch="showSearch" class="ml10" @queryTable="getDataList">
<TableColumnControl
@@ -192,6 +193,40 @@
</span>
</template>
</el-dialog>
<!-- 学期统计弹出框 -->
<el-dialog v-model="summaryVisible" title="月卫生学年学期统计" width="900px" destroy-on-close>
<el-form :model="summaryForm" :inline="true" class="mb10">
<el-form-item label="学年">
<el-select v-model="summaryForm.schoolYear" placeholder="请选择学年" clearable filterable style="width: 180px">
<el-option v-for="item in schoolYearList" :key="item.year" :label="item.year" :value="item.year" />
</el-select>
</el-form-item>
<el-form-item label="学期">
<el-select v-model="summaryForm.schoolTerm" placeholder="请选择学期" clearable style="width: 180px">
<el-option v-for="item in schoolTermList" :key="item.value" :label="item.label" :value="item.value" />
</el-select>
</el-form-item>
<el-form-item label="学院">
<el-select v-model="summaryForm.deptCode" placeholder="请选择学院" clearable filterable style="width: 180px">
<el-option v-for="item in deptList" :key="item.deptCode" :label="item.deptName" :value="item.deptCode" />
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="Search" @click="handleQuerySummary">查询</el-button>
</el-form-item>
</el-form>
<el-table :data="summaryData" v-loading="summaryLoading" stripe max-height="400" :cell-style="{ padding: '8px 0', textAlign: 'center' }" :header-cell-style="{ background: '#f5f7fa', color: '#606266', fontWeight: 'bold', textAlign: 'center' }">
<el-table-column type="index" label="序号" width="60" align="center" />
<el-table-column prop="deptName" label="学院" min-width="120" align="center" show-overflow-tooltip />
<el-table-column prop="className" label="班级" min-width="120" align="center" show-overflow-tooltip />
<el-table-column prop="avgScore" label="平均分" min-width="100" align="center" />
<el-table-column prop="recordCount" label="考核月数" min-width="100" align="center" />
</el-table>
<template v-if="summaryData.length === 0 && !summaryLoading">
<el-empty description="暂无统计数据" :image-size="80" />
</template>
</el-dialog>
</div>
</template>
@@ -199,7 +234,7 @@
import { ref, reactive, defineAsyncComponent, computed, onMounted } from 'vue';
import { useRoute } from 'vue-router';
import { BasicTableProps, useTable } from '/@/hooks/table';
import { fetchList, delObjs, checkClassRoomHygieneMonthly } from '/@/api/stuwork/classroomhygienemonthly';
import { fetchList, delObjs, checkClassRoomHygieneMonthly, monthlySummaryByYearTerm } from '/@/api/stuwork/classroomhygienemonthly';
import { makeExportClassRoomHygieneMonthlyTask } from '/@/api/stuwork/file';
import { useMessage, useMessageBox } from '/@/hooks/message';
import { queryAllSchoolYear } from '/@/api/basic/basicyear';
@@ -244,6 +279,16 @@ const checkDialogVisible = ref(false);
// 模板文件URL - 使用后端接口
const templateUrl = ref('/stuwork/classroomhygienemonthly/import/template');
// 统计相关变量
const summaryVisible = ref(false);
const summaryLoading = ref(false);
const summaryData = ref<any[]>([]);
const summaryForm = reactive({
schoolYear: '',
schoolTerm: '',
deptCode: ''
});
// 表格列配置
const tableColumns = [
{ prop: 'schoolYear', label: '学年' },
@@ -524,6 +569,37 @@ const formatSchoolTerm = (value: string | number) => {
return dictItem ? dictItem.label : value;
};
// 打开统计弹窗
const handleOpenSummary = () => {
summaryVisible.value = true;
summaryForm.schoolYear = '';
summaryForm.schoolTerm = '';
summaryForm.deptCode = '';
summaryData.value = [];
};
// 查询统计数据
const handleQuerySummary = async () => {
if (!summaryForm.schoolYear || !summaryForm.schoolTerm) {
useMessage().warning('请选择学年和学期');
return;
}
summaryLoading.value = true;
try {
const res = await monthlySummaryByYearTerm({
schoolYear: summaryForm.schoolYear,
schoolTerm: summaryForm.schoolTerm,
deptCode: summaryForm.deptCode
});
summaryData.value = Array.isArray(res.data) ? res.data : [];
} catch (err: any) {
useMessage().error(err.msg || '获取统计数据失败');
summaryData.value = [];
} finally {
summaryLoading.value = false;
}
};
// 初始化
onMounted(() => {
getSchoolYearList();

View File

@@ -132,7 +132,7 @@
</template>
</el-table-column>
</template>
<el-table-column label="操作" width="250" align="center" fixed="right">
<el-table-column label="操作" width="300" align="center" fixed="right">
<template #header>
<el-icon><Setting /></el-icon>
<span style="margin-left: 4px">操作</span>
@@ -145,6 +145,13 @@
@click="handleViewDetail(scope.row.id)">
查看详情
</el-button>
<el-button
icon="DataAnalysis"
link
type="success"
@click="handleOpenStatistics(scope.row.id)">
查看统计
</el-button>
<el-button
icon="EditPen"
link
@@ -183,18 +190,53 @@
<!-- 详情对话框 -->
<DetailDialog ref="detailDialogRef" @refresh="getDataList(false)" />
<!-- 查看统计弹出框 -->
<el-dialog v-model="statisticsVisible" title="班级班主任查看状况统计" width="800px" destroy-on-close>
<el-form :model="statisticsForm" :inline="true" class="mb10">
<el-form-item label="学院">
<el-select v-model="statisticsForm.deptCode" placeholder="请选择学院" clearable filterable style="width: 180px">
<el-option v-for="item in deptList" :key="item.deptCode" :label="item.deptName" :value="item.deptCode" />
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="Search" @click="handleQueryStatistics">查询</el-button>
</el-form-item>
</el-form>
<el-table :data="statisticsData" v-loading="statisticsLoading" stripe max-height="400" :cell-style="{ padding: '8px 0', textAlign: 'center' }" :header-cell-style="{ background: '#f5f7fa', color: '#606266', fontWeight: 'bold', textAlign: 'center' }">
<el-table-column type="index" label="序号" width="60" align="center" />
<el-table-column prop="className" label="班级" min-width="150" align="center" show-overflow-tooltip />
<el-table-column prop="teacherRealName" label="班主任" min-width="100" align="center" show-overflow-tooltip />
<el-table-column prop="hasRead" label="是否已查看" min-width="100" align="center">
<template #default="scope">
<el-tag :type="scope.row.hasRead ? 'success' : 'danger'" size="small">
{{ scope.row.hasRead ? '已查看' : '未查看' }}
</el-tag>
</template>
</el-table-column>
<el-table-column prop="readTime" label="查看时间" min-width="160" align="center" show-overflow-tooltip>
<template #default="scope">
{{ scope.row.readTime || '-' }}
</template>
</el-table-column>
</el-table>
<template v-if="statisticsData.length === 0 && !statisticsLoading">
<el-empty description="暂无统计数据" :image-size="80" />
</template>
</el-dialog>
</div>
</template>
<script setup lang="ts" name="WeekPlan">
import { ref, reactive, defineAsyncComponent, onMounted, nextTick } from 'vue'
import { BasicTableProps, useTable } from "/@/hooks/table";
import { fetchList, delObjs } from "/@/api/stuwork/weekplan";
import { fetchList, delObjs, readStatistics } from "/@/api/stuwork/weekplan";
import { useMessage, useMessageBox } from "/@/hooks/message";
import { queryAllSchoolYear } from '/@/api/basic/basicyear'
import { getDeptList } from '/@/api/basic/basicclass'
import TableColumnControl from '/@/components/TableColumnControl/index.vue'
import {
List, Calendar, Clock, Document, User, Setting, Menu, Search, EditPen
List, Calendar, Clock, Document, User, Setting, Menu, Search, EditPen, DataAnalysis
} from '@element-plus/icons-vue'
import { useTableColumnControl } from '/@/hooks/tableColumn'
@@ -210,6 +252,16 @@ const columnControlRef = ref<any>()
// 搜索变量
const showSearch = ref(true)
const schoolYearList = ref<any[]>([])
const deptList = ref<any[]>([])
// 统计相关变量
const statisticsVisible = ref(false)
const statisticsLoading = ref(false)
const statisticsData = ref<any[]>([])
const statisticsForm = reactive({
weekPlanId: '',
deptCode: ''
})
// 搜索表单
const searchForm = reactive({
@@ -326,9 +378,47 @@ const getSchoolYearList = async () => {
}
}
// 获取学院列表
const getDeptListData = async () => {
try {
const res = await getDeptList()
if (res.data) {
deptList.value = Array.isArray(res.data) ? res.data : []
}
} catch (err) {
deptList.value = []
}
}
// 打开统计弹窗
const handleOpenStatistics = (weekPlanId: string) => {
statisticsVisible.value = true
statisticsForm.weekPlanId = weekPlanId
statisticsForm.deptCode = ''
statisticsData.value = []
}
// 查询统计数据
const handleQueryStatistics = async () => {
statisticsLoading.value = true
try {
const res = await readStatistics({
weekPlanId: statisticsForm.weekPlanId,
deptCode: statisticsForm.deptCode
})
statisticsData.value = Array.isArray(res.data) ? res.data : []
} catch (err: any) {
useMessage().error(err.msg || '获取统计数据失败')
statisticsData.value = []
} finally {
statisticsLoading.value = false
}
}
// 初始化
onMounted(() => {
getSchoolYearList()
getDeptListData()
})
</script>