“班主任考核修复weiz”
This commit is contained in:
1 parent
3c62f1f6de
commit
6bffe5fa08
6 files changed
+184
-85
No files matched your search
@@ -185,13 +185,51 @@ const data = reactive<PageData<AssessmentIndicatorTypeForm, AssessmentIndicatorT
|
||||
|
||||
const { queryParams, form, rules } = toRefs(data);
|
||||
|
||||
/** 搜索按钮操作 */
|
||||
const handleQuery = () => {
|
||||
console.log('🔍 搜索按钮点击,当前查询参数:', {
|
||||
indicatorTypeCode: queryParams.value.indicatorTypeCode,
|
||||
indicatorTypeName: queryParams.value.indicatorTypeName,
|
||||
status: queryParams.value.status,
|
||||
pageNum: queryParams.value.pageNum,
|
||||
pageSize: queryParams.value.pageSize
|
||||
});
|
||||
|
||||
queryParams.value.pageNum = 1;
|
||||
getList();
|
||||
};
|
||||
|
||||
/** 查询班主任考核指标类型列表 */
|
||||
const getList = async () => {
|
||||
loading.value = true;
|
||||
const res = await listAssessmentIndicatorType(queryParams.value);
|
||||
assessmentIndicatorTypeList.value = res.rows;
|
||||
total.value = res.total;
|
||||
loading.value = false;
|
||||
|
||||
// 构建查询参数,过滤掉undefined和null值
|
||||
const queryData = {
|
||||
pageNum: queryParams.value.pageNum,
|
||||
pageSize: queryParams.value.pageSize,
|
||||
...(queryParams.value.indicatorTypeCode && { indicatorTypeCode: queryParams.value.indicatorTypeCode }),
|
||||
...(queryParams.value.indicatorTypeName && { indicatorTypeName: queryParams.value.indicatorTypeName }),
|
||||
...(queryParams.value.status && { status: queryParams.value.status })
|
||||
};
|
||||
|
||||
console.log('📋 发送查询请求,参数:', queryData);
|
||||
|
||||
try {
|
||||
const res = await listAssessmentIndicatorType(queryData);
|
||||
console.log('📊 查询结果:', {
|
||||
total: res.total,
|
||||
dataCount: res.rows?.length,
|
||||
firstItem: res.rows?.[0]
|
||||
});
|
||||
|
||||
assessmentIndicatorTypeList.value = res.rows;
|
||||
total.value = res.total;
|
||||
} catch (error) {
|
||||
console.error('❌ 查询失败:', error);
|
||||
proxy?.$modal.msgError('查询失败,请检查网络连接');
|
||||
} finally {
|
||||
loading.value = false;
|
||||
}
|
||||
};
|
||||
|
||||
/** 取消按钮 */
|
||||
@@ -206,16 +244,28 @@ const reset = () => {
|
||||
assessmentIndicatorTypeFormRef.value?.resetFields();
|
||||
};
|
||||
|
||||
/** 搜索按钮操作 */
|
||||
const handleQuery = () => {
|
||||
queryParams.value.pageNum = 1;
|
||||
getList();
|
||||
};
|
||||
|
||||
/** 重置按钮操作 */
|
||||
const resetQuery = () => {
|
||||
console.log('🔄 重置查询参数');
|
||||
|
||||
// 重置表单字段
|
||||
queryFormRef.value?.resetFields();
|
||||
handleQuery();
|
||||
|
||||
// 手动重置查询参数对象
|
||||
queryParams.value.indicatorTypeCode = undefined;
|
||||
queryParams.value.indicatorTypeName = undefined;
|
||||
queryParams.value.status = undefined;
|
||||
queryParams.value.pageNum = 1;
|
||||
|
||||
console.log('🔄 重置后的查询参数:', {
|
||||
indicatorTypeCode: queryParams.value.indicatorTypeCode,
|
||||
indicatorTypeName: queryParams.value.indicatorTypeName,
|
||||
status: queryParams.value.status,
|
||||
pageNum: queryParams.value.pageNum
|
||||
});
|
||||
|
||||
// 重新查询
|
||||
getList();
|
||||
};
|
||||
|
||||
/** 多选框选中数据 */
|
||||
@@ -285,6 +335,15 @@ const handleDelete = async (row?: AssessmentIndicatorTypeVO) => {
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
console.log('🚀 页面初始化,开始加载数据');
|
||||
console.log('📋 初始查询参数:', {
|
||||
indicatorTypeCode: queryParams.value.indicatorTypeCode,
|
||||
indicatorTypeName: queryParams.value.indicatorTypeName,
|
||||
status: queryParams.value.status,
|
||||
pageNum: queryParams.value.pageNum,
|
||||
pageSize: queryParams.value.pageSize
|
||||
});
|
||||
|
||||
getList();
|
||||
});
|
||||
</script>
|
||||
|
||||
@@ -75,7 +75,7 @@
|
||||
<span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="180">
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="220">
|
||||
<template #default="scope">
|
||||
<!-- 审核通过状态:只显示查看考核按钮 -->
|
||||
<template v-if="scope.row.auditStatus === '1'">
|
||||
@@ -86,6 +86,7 @@
|
||||
icon="View"
|
||||
:disabled="loading || !isDataReady"
|
||||
@click="handleViewAssessment(scope.row)"
|
||||
v-hasPermi="['bzrkh:teacherAssessment:detail']"
|
||||
></el-button>
|
||||
</el-tooltip>
|
||||
</template>
|
||||
@@ -94,16 +95,17 @@
|
||||
<!-- 未提交状态、草稿状态或审核不通过状态:显示提交考核按钮 -->
|
||||
<template v-if="!scope.row.submitted || scope.row.auditStatus === '9' || scope.row.auditStatus === '2'">
|
||||
<el-tooltip content="提交考核" placement="top">
|
||||
<el-button
|
||||
link
|
||||
type="primary"
|
||||
icon="Edit"
|
||||
:disabled="loading || !isDataReady"
|
||||
@click="handleSubmitAssessment(scope.row)"
|
||||
></el-button>
|
||||
<el-button
|
||||
link
|
||||
type="primary"
|
||||
icon="Edit"
|
||||
:disabled="loading || !isDataReady"
|
||||
@click="handleSubmitAssessment(scope.row)"
|
||||
v-hasPermi="['bzrkh:teacherAssessment:submit']"
|
||||
></el-button>
|
||||
</el-tooltip>
|
||||
</template>
|
||||
<!-- 待审核状态:显示查看考核按钮 -->
|
||||
<!-- 待审核状态:显示查看考核和撤销按钮 -->
|
||||
<template v-else-if="scope.row.auditStatus === '0'">
|
||||
<el-tooltip content="查看考核" placement="top">
|
||||
<el-button
|
||||
@@ -112,6 +114,17 @@
|
||||
icon="View"
|
||||
:disabled="loading || !isDataReady"
|
||||
@click="handleViewAssessment(scope.row)"
|
||||
v-hasPermi="['bzrkh:teacherAssessment:detail']"
|
||||
></el-button>
|
||||
</el-tooltip>
|
||||
<el-tooltip content="撤销考核" placement="top">
|
||||
<el-button
|
||||
link
|
||||
type="warning"
|
||||
icon="Close"
|
||||
:disabled="loading || !isDataReady"
|
||||
@click="handleWithdrawAssessment(scope.row)"
|
||||
v-hasPermi="['bzrkh:teacherAssessment:withdraw']"
|
||||
></el-button>
|
||||
</el-tooltip>
|
||||
</template>
|
||||
@@ -149,7 +162,8 @@
|
||||
</template>
|
||||
|
||||
<script setup name="TeacherAssessment" lang="ts">
|
||||
import { computed, nextTick } from 'vue';
|
||||
import { computed, nextTick, getCurrentInstance } from 'vue';
|
||||
import type { FormInstance as ElFormInstance } from 'element-plus';
|
||||
import {
|
||||
listTeacherClasses,
|
||||
listTeacherAssessmentPlans,
|
||||
@@ -223,8 +237,17 @@ const getTeacherClasses = async () => {
|
||||
if (teacherClasses.value.length > 0) {
|
||||
// 默认选中第一个班级
|
||||
activeTab.value = teacherClasses.value[0].id?.toString() || '';
|
||||
// 设置查询参数中的班级ID
|
||||
// 重置搜索条件并设置查询参数中的班级ID
|
||||
queryParams.value.planName = undefined; // 确保搜索条件被重置
|
||||
queryParams.value.pageNum = 1;
|
||||
queryParams.value.classId = activeTab.value;
|
||||
|
||||
console.log('🔄 初始化完成:', {
|
||||
activeTab: activeTab.value,
|
||||
classId: queryParams.value.classId,
|
||||
planName: queryParams.value.planName
|
||||
});
|
||||
|
||||
// 等待activeTab设置完成后再获取列表
|
||||
await nextTick();
|
||||
await getList();
|
||||
@@ -241,14 +264,16 @@ const getTeacherClasses = async () => {
|
||||
const getList = async () => {
|
||||
loading.value = true;
|
||||
try {
|
||||
console.log('📋 查询参数:', {
|
||||
classId: queryParams.value.classId,
|
||||
teacherId: userStore.userId,
|
||||
planName: queryParams.value.planName,
|
||||
planStatus: queryParams.value.planStatus
|
||||
});
|
||||
// 构建完整的查询参数
|
||||
const queryData = {
|
||||
...queryParams.value,
|
||||
teacherId: userStore.userId, // 确保包含teacherId
|
||||
planStatus: '1' // 确保包含planStatus
|
||||
};
|
||||
|
||||
const res = await listTeacherAssessmentPlans(queryParams.value);
|
||||
console.log('📋 查询参数:', queryData);
|
||||
|
||||
const res = await listTeacherAssessmentPlans(queryData);
|
||||
console.log('📊 查询结果:', {
|
||||
total: res.total,
|
||||
dataCount: res.rows?.length,
|
||||
@@ -270,16 +295,19 @@ const handleTabChange = async (tabName: string) => {
|
||||
console.log('🔄 标签页值变化:', {
|
||||
oldClassId: queryParams.value.classId,
|
||||
newTabName: tabName,
|
||||
activeTab: activeTab.value
|
||||
activeTab: activeTab.value,
|
||||
oldPlanName: queryParams.value.planName
|
||||
});
|
||||
|
||||
// 重置分页和设置班级ID
|
||||
// 重置分页和搜索条件,设置新的班级ID
|
||||
queryParams.value.pageNum = 1;
|
||||
queryParams.value.planName = undefined; // 重置搜索条件,避免标签页间共享
|
||||
queryParams.value.classId = tabName;
|
||||
|
||||
console.log('🔄 参数设置完成:', {
|
||||
classId: queryParams.value.classId,
|
||||
activeTab: activeTab.value
|
||||
activeTab: activeTab.value,
|
||||
planName: queryParams.value.planName
|
||||
});
|
||||
|
||||
// 等待参数设置完成后再查询
|
||||
@@ -303,8 +331,40 @@ const handleQuery = () => {
|
||||
|
||||
/** 重置按钮操作 */
|
||||
const resetQuery = () => {
|
||||
queryFormRef.value?.resetFields();
|
||||
handleQuery();
|
||||
console.log('🔄 开始重置查询参数');
|
||||
|
||||
try {
|
||||
// 保存当前班级ID和计划状态(这些不应该被重置)
|
||||
const currentClassId = queryParams.value.classId;
|
||||
const currentPlanStatus = queryParams.value.planStatus;
|
||||
|
||||
// 手动重置查询参数到初始状态
|
||||
queryParams.value.planName = undefined;
|
||||
queryParams.value.pageNum = 1;
|
||||
|
||||
// 恢复不应该被重置的参数
|
||||
queryParams.value.classId = currentClassId;
|
||||
queryParams.value.planStatus = currentPlanStatus;
|
||||
|
||||
console.log('🔄 重置后的查询参数:', {
|
||||
planName: queryParams.value.planName,
|
||||
pageNum: queryParams.value.pageNum,
|
||||
classId: queryParams.value.classId,
|
||||
planStatus: queryParams.value.planStatus,
|
||||
teacherId: userStore.userId
|
||||
});
|
||||
|
||||
// 等待DOM更新完成后再刷新数据
|
||||
nextTick(() => {
|
||||
console.log('🔄 开始强制刷新数据');
|
||||
// 强制刷新数据
|
||||
getList();
|
||||
});
|
||||
} catch (error) {
|
||||
console.error('❌ 重置查询参数时发生错误:', error);
|
||||
// 即使出错也要尝试刷新数据
|
||||
getList();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -316,7 +316,7 @@
|
||||
<template #footer>
|
||||
<div class="dialog-footer">
|
||||
<el-button :loading="saveLoading" type="primary" @click="handleSubmit">保存</el-button>
|
||||
<el-button :loading="submitLoading" type="success" @click="handleSubmitForApproval">提交</el-button>
|
||||
<el-button :loading="submitLoading" type="success" @click="handleSubmitForApproval" v-hasPermi="['bzrkh:teacherAssessment:submit']">提交</el-button>
|
||||
<el-button @click="handleClose">取消</el-button>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
Reference in new issue
Block a user