前端学工处增加一键确认待确认的学生住宿费用功能

This commit is contained in:
MDSMO
2025-08-26 10:28:02 +08:00
parent c786b89e7f
commit 5fd821b08a
4 changed files with 76 additions and 18 deletions

View File

@@ -122,6 +122,14 @@ export function updateNewRecord(data) {
export function delNewRecord(id) {
return request({
url: '/dormitory/newRecord/' + id,
method: 'post'
method: 'delete'
})
}
// 一键确认未进行住宿费用确认的学生
export function confirmUnconfirmedStudents() {
return request({
url: '/dormitory/newRecord/confirmUnconfirmedStudents',
method: 'POST'
})
}

View File

@@ -204,7 +204,10 @@ export default {
let res = await initRecord(sdata);
loading.close();
if (res.code == 200) {
this.$message.success(res.msg);
this.$message.success(res.msg + ",住宿费用确认消息已发送给相关学生");
this.getList(); // 刷新列表
} else {
this.$message.error(res.msg || "初始化失败");
}
},
async listAllGrade() {

View File

@@ -91,6 +91,24 @@
<!-- 角色切换按钮 -->
<el-form-item label="查看权限" v-if="showRoleSwitch">
<el-button-group>
<!-- 学工+辅导员组合 -->
<template v-if="userRoleInfo && userRoleInfo.isXuegong && userRoleInfo.isFudaoyuan">
<el-button
:type="queryParams.roleType === 'xuegong' ? 'primary' : 'default'"
size="mini"
@click="switchRole('xuegong')">
学工数据全部
</el-button>
<el-button
:type="queryParams.roleType === 'teacher' ? 'primary' : 'default'"
size="mini"
@click="switchRole('teacher')">
个人班级
</el-button>
</template>
<!-- 学务干事+辅导员组合 -->
<template v-else-if="userRoleInfo && userRoleInfo.isXuewu && userRoleInfo.isFudaoyuan">
<el-button
:type="queryParams.roleType === 'dept' ? 'primary' : 'default'"
size="mini"
@@ -103,6 +121,7 @@
@click="switchRole('teacher')">
个人班级
</el-button>
</template>
</el-button-group>
</el-form-item>
@@ -342,8 +361,9 @@ export default {
let res = await getDeptName();
let allDepts = [...res.data];
// 如果是学务干事或辅导员,只显示其所属的学院
if (this.userRoleInfo && (this.userRoleInfo.isXuewu || this.userRoleInfo.isFudaoyuan) && this.userRoleInfo.userDeptName) {
// 如果是学务干事或辅导员(但不是学工),只显示其所属的学院
// 学工角色可以查看所有学院
if (this.userRoleInfo && (this.userRoleInfo.isXuewu || this.userRoleInfo.isFudaoyuan) && !this.userRoleInfo.isXuegong && this.userRoleInfo.userDeptName) {
this.deptList = allDepts.filter(dept => dept.label === this.userRoleInfo.userDeptName);
} else {
this.deptList = allDepts;
@@ -471,10 +491,14 @@ export default {
let res = await checkRoles();
if (res.code === 200 && res.data) {
this.userRoleInfo = res.data;
// 只有在多角色情况下才显示角色切换按钮
if (res.data.hasMultipleRoles) {
this.showRoleSwitch = true;
this.queryParams.roleType = res.data.defaultRole || 'dept';
} else {
this.showRoleSwitch = false;
}
// 设置默认角色类型
this.queryParams.roleType = res.data.defaultRole;
}
} catch (error) {
console.error('获取用户角色信息失败:', error);
@@ -484,6 +508,8 @@ export default {
/** 切换角色 */
switchRole(roleType) {
this.queryParams.roleType = roleType;
// 角色切换时重新加载学院列表,确保权限正确
this.listDept();
this.handleQuery();
},
}

View File

@@ -42,6 +42,7 @@
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
<el-button type="success" icon="el-icon-check" size="mini" @click="fastConfirm">一键确认所有辅导员已确认的记录</el-button>
<el-button type="success" icon="el-icon-check" size="mini" @click="confirmUnconfirmedStudents">一键确认未进行住宿费用确认的学生</el-button>
</el-form-item>
</el-form>
@@ -152,7 +153,7 @@
</template>
<script>
import { fastConfirm, jwcConfirm, listNewRecord, getNewRecord, delNewRecord, addNewRecord, updateNewRecord } from "@/api/dormitory/new/record";
import { fastConfirm, jwcConfirm, listNewRecord, getNewRecord, delNewRecord, addNewRecord, updateNewRecord, confirmUnconfirmedStudents } from "@/api/dormitory/new/record";
import { listAllYear } from "@/api/stuCQS/basedata/year";
@@ -358,6 +359,26 @@ export default {
this.download('dormitory/newRecord/export', {
...this.queryParams
}, `newRecord_${new Date().getTime()}.xlsx`)
},
/** 一键确认未进行住宿费用确认的学生 */
confirmUnconfirmedStudents() {
this.$modal.confirm('确定要一键确认所有未进行住宿费用确认的学生吗?').then(() => {
this.loading = true;
confirmUnconfirmedStudents().then(response => {
this.loading = false;
if (response.code === 200) {
this.$modal.msgSuccess(response.msg || "确认成功");
this.getList();
} else {
this.$modal.msgError(response.msg || "确认失败");
}
}).catch(error => {
this.loading = false;
this.$modal.msgError("操作失败,请稍后重试");
});
}).catch(() => {
// 用户取消操作
});
}
}
};