This commit is contained in:
weizhong committed 2025-09-22 22:40:17 +08:00
commit 74ab953c17
164 files changed
+25187 -1775

No files matched your search

+60
View File
@@ -44,6 +44,26 @@ export interface StglActivityVO {
*/
posterUrl?: string;
/**
* 关联部门ID(多个部门时用逗号分隔)
*/
relatedDeptId?: string | number;
/**
* 关联部门ID列表
*/
relatedDeptIds?: (string | number)[];
/**
* 关联部门名称(多个部门时用逗号分隔)
*/
relatedDeptName?: string;
/**
* 关联部门名称列表
*/
relatedDeptNames?: string[];
/**
* 关联社团ID
*/
@@ -272,6 +292,26 @@ export interface StglActivityForm {
*/
posterUrl?: string;
/**
* 关联部门ID(多个部门时用逗号分隔)
*/
relatedDeptId?: string | number;
/**
* 关联部门ID列表
*/
relatedDeptIds?: (string | number)[];
/**
* 关联部门对象(用于选择器绑定)
*/
relatedDept?: DeptOption | null;
/**
* 关联部门对象列表(多选时使用)
*/
relatedDepts?: DeptOption[] | null;
/**
* 关联社团ID
*/
@@ -454,6 +494,11 @@ export interface StglActivityQuery extends PageQuery {
*/
location?: string;
/**
* 关联部门ID
*/
relatedDeptId?: string | number;
/**
* 关联社团ID
*/
@@ -505,6 +550,21 @@ export interface StglActivityQuery extends PageQuery {
params?: any;
}
/**
* 部门选择器选项
*/
export interface DeptOption {
/**
* 部门ID
*/
deptId: string | number;
/**
* 部门名称
*/
deptName: string;
}
/**
* 社团/志愿者队伍选择器选项
*/
@@ -45,6 +45,26 @@ export interface StglActivityVo {
*/
posterUrl: string;
/**
* 关联部门ID(多个部门时用逗号分隔)
*/
relatedDeptId?: string | number;
/**
* 关联部门ID列表
*/
relatedDeptIds?: (string | number)[];
/**
* 关联部门名称(多个部门时用逗号分隔)
*/
relatedDeptName?: string;
/**
* 关联部门名称列表
*/
relatedDeptNames?: string[];
/**
* 关联社团ID
*/
+140
View File
@@ -0,0 +1,140 @@
import request from '@/utils/request'
import { AxiosPromise } from 'axios'
import { StglAuditorVO, StglAuditorForm, StglAuditorQuery } from './types'
/**
* 查询社团管理审核人配置列表
* @param query
* @returns {*}
*/
export const listStglAuditor = (query?: StglAuditorQuery): AxiosPromise<StglAuditorVO[]> => {
return request({
url: '/stgl/auditor/list',
method: 'get',
params: query
})
}
/**
* 查询社团管理审核人配置详细
* @param id
*/
export const getStglAuditor = (id: string | number): AxiosPromise<StglAuditorVO> => {
return request({
url: '/stgl/auditor/' + id,
method: 'get'
})
}
/**
* 新增社团管理审核人配置
* @param data
*/
export const addStglAuditor = (data: StglAuditorForm) => {
return request({
url: '/stgl/auditor',
method: 'post',
data: data
})
}
/**
* 修改社团管理审核人配置
* @param data
*/
export const updateStglAuditor = (data: StglAuditorForm) => {
return request({
url: '/stgl/auditor',
method: 'put',
data: data
})
}
/**
* 删除社团管理审核人配置
* @param id
*/
export const delStglAuditor = (id: string | number | Array<string | number>) => {
return request({
url: '/stgl/auditor/' + id,
method: 'delete'
})
}
/**
* 导出社团管理审核人配置
* @param query
* @returns {*}
*/
export const exportStglAuditor = (query?: StglAuditorQuery) => {
return request({
url: '/stgl/auditor/export',
method: 'post',
data: query,
responseType: 'blob'
})
}
/**
* 批量添加审核人
* @param userIds 用户ID列表
* @param remark 备注
*/
export const batchAddAuditors = (userIds: number[], remark?: string) => {
return request({
url: '/stgl/auditor/batchAdd',
method: 'post',
data: {
userIds,
remark
}
})
}
/**
* 查询我配置的审核人列表
* @param query
*/
export const listMyConfigAuditors = (query?: StglAuditorQuery): AxiosPromise<StglAuditorVO[]> => {
return request({
url: '/stgl/auditor/myConfig',
method: 'get',
params: query
})
}
/**
* 批量启用审核人
* @param ids
*/
export const enableAuditors = (ids: number[]) => {
return request({
url: '/stgl/auditor/enable',
method: 'post',
data: ids
})
}
/**
* 批量停用审核人
* @param ids
*/
export const disableAuditors = (ids: number[]) => {
return request({
url: '/stgl/auditor/disable',
method: 'post',
data: ids
})
}
/**
* 根据部门ID获取用户列表
* @param deptId
*/
export const listUserByDeptId = (deptId: string | number) => {
return request({
url: '/stgl/auditor/users/' + deptId,
method: 'get'
})
}
+184
View File
@@ -0,0 +1,184 @@
import { PageQuery } from '@/api/types'
export interface StglAuditorVO {
/**
* 主键ID
*/
id: string | number;
/**
* 用户ID
*/
userId: number;
/**
* 用户账号
*/
userName: string;
/**
* 用户昵称
*/
nickName: string;
/**
* 部门ID
*/
deptId: number;
/**
* 部门名称
*/
deptName: string;
/**
* 联系电话
*/
phoneNumber: string;
/**
* 邮箱地址
*/
email: string;
/**
* 状态(1正常 0停用)
*/
status: string;
/**
* 备注说明
*/
remark: string;
/**
* 配置人ID
*/
configBy: number;
/**
* 配置人姓名
*/
configByName: string;
/**
* 创建者
*/
createBy: number;
/**
* 创建时间
*/
createTime: string;
/**
* 更新者
*/
updateBy: number;
/**
* 更新时间
*/
updateTime: string;
}
export interface StglAuditorForm {
/**
* 主键ID
*/
id?: string | number;
/**
* 用户ID
*/
userId?: number;
/**
* 用户账号
*/
userName?: string;
/**
* 用户昵称
*/
nickName?: string;
/**
* 部门ID
*/
deptId?: number;
/**
* 部门名称
*/
deptName?: string;
/**
* 联系电话
*/
phoneNumber?: string;
/**
* 邮箱地址
*/
email?: string;
/**
* 状态(1正常 0停用)
*/
status?: string;
/**
* 备注说明
*/
remark?: string;
/**
* 配置人ID
*/
configBy?: number;
/**
* 配置人姓名
*/
configByName?: string;
}
export interface StglAuditorQuery extends PageQuery {
/**
* 用户ID
*/
userId?: number;
/**
* 用户账号
*/
userName?: string;
/**
* 用户昵称
*/
nickName?: string;
/**
* 部门ID
*/
deptId?: number;
/**
* 状态(1正常 0停用)
*/
status?: string;
/**
* 配置人ID
*/
configBy?: number;
/**
* 日期范围参数
*/
'params[beginCreateTime]'?: string;
'params[endCreateTime]'?: string;
}
+276
View File
@@ -0,0 +1,276 @@
import request from '@/utils/request';
import { AxiosPromise } from 'axios';
export interface StglClubAdvisorHistoryVO {
/**
* 主键ID
*/
id?: string | number;
/**
* 社团ID
*/
clubId?: string | number;
/**
* 社团名称
*/
clubName?: string;
/**
* 指导老师姓名
*/
advisorName?: string;
/**
* 指导老师部门
*/
advisorDept?: string;
/**
* 指导老师电话
*/
advisorPhone?: string;
/**
* 指导老师邮箱
*/
advisorEmail?: string;
/**
* 指导老师用户ID
*/
advisorUserId?: string | number;
/**
* 在任状态:1-当前在任,0-历史(已离任)
*/
status?: number;
/**
* 上任时间
*/
startTime?: string;
/**
* 离任时间
*/
endTime?: string;
/**
* 创建者
*/
createBy?: string | number;
/**
* 创建时间
*/
createTime?: string;
/**
* 更新者
*/
updateBy?: string | number;
/**
* 更新时间
*/
updateTime?: string;
}
export interface StglClubAdvisorHistoryForm extends BaseEntity {
/**
* 主键ID
*/
id?: string | number;
/**
* 社团ID
*/
clubId?: string | number;
/**
* 指导老师姓名
*/
advisorName?: string;
/**
* 指导老师部门
*/
advisorDept?: string;
/**
* 指导老师电话
*/
advisorPhone?: string;
/**
* 指导老师邮箱
*/
advisorEmail?: string;
/**
* 指导老师用户ID
*/
advisorUserId?: string | number;
/**
* 在任状态:1-当前在任,0-历史(已离任)
*/
status?: number;
/**
* 上任时间
*/
startTime?: string;
/**
* 离任时间
*/
endTime?: string;
}
export interface StglClubAdvisorHistoryQuery extends PageQuery {
/**
* 社团ID
*/
clubId?: string | number;
/**
* 指导老师姓名
*/
advisorName?: string;
/**
* 指导老师部门
*/
advisorDept?: string;
/**
* 指导老师电话
*/
advisorPhone?: string;
/**
* 指导老师邮箱
*/
advisorEmail?: string;
/**
* 指导老师用户ID
*/
advisorUserId?: string | number;
/**
* 在任状态:1-当前在任,0-历史(已离任)
*/
status?: number;
/**
* 上任时间
*/
startTime?: string;
/**
* 离任时间
*/
endTime?: string;
/**
* 日期范围参数
*/
params?: any;
}
/**
* 查询社团指导老师任职历史列表
* @param query
* @returns {*}
*/
export const listStglClubAdvisorHistory = (query?: StglClubAdvisorHistoryQuery): AxiosPromise<StglClubAdvisorHistoryVO[]> => {
return request({
url: '/stgl/club/advisor/history/list',
method: 'get',
params: query
});
};
/**
* 查询社团指导老师任职历史详细
* @param id
*/
export const getStglClubAdvisorHistory = (id: string | number): AxiosPromise<StglClubAdvisorHistoryVO> => {
return request({
url: '/stgl/club/advisor/history/' + id,
method: 'get'
});
};
/**
* 查询指定社团的当前在任指导老师
* @param clubId
*/
export const getCurrentAdvisors = (clubId: string | number): AxiosPromise<StglClubAdvisorHistoryVO[]> => {
return request({
url: '/stgl/club/advisor/history/current/' + clubId,
method: 'get'
});
};
/**
* 查询指定社团的历史指导老师(已离任)
* @param clubId
*/
export const getHistoryAdvisors = (clubId: string | number): AxiosPromise<StglClubAdvisorHistoryVO[]> => {
return request({
url: '/stgl/club/advisor/history/history/' + clubId,
method: 'get'
});
};
/**
* 查询指定社团的所有指导老师(包含当前和历史)
* @param clubId
*/
export const getAllAdvisors = (clubId: string | number): AxiosPromise<StglClubAdvisorHistoryVO[]> => {
return request({
url: '/stgl/club/advisor/history/all/' + clubId,
method: 'get'
});
};
/**
* 新增社团指导老师任职历史
* @param data
*/
export const addStglClubAdvisorHistory = (data: StglClubAdvisorHistoryForm) => {
return request({
url: '/stgl/club/advisor/history',
method: 'post',
data: data
});
};
/**
* 修改社团指导老师任职历史
* @param data
*/
export const updateStglClubAdvisorHistory = (data: StglClubAdvisorHistoryForm) => {
return request({
url: '/stgl/club/advisor/history',
method: 'put',
data: data
});
};
/**
* 删除社团指导老师任职历史
* @param id
*/
export const delStglClubAdvisorHistory = (id: string | number | Array<string | number>) => {
return request({
url: '/stgl/club/advisor/history/' + id,
method: 'delete'
});
};
+222
View File
@@ -0,0 +1,222 @@
import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { StglClubAnnualReviewVO, StglClubAnnualReviewForm, StglClubAnnualReviewQuery } from './type';
/**
* 查询社团年审记录列表
* @param query
* @returns {*}
*/
export const listStglClubAnnualReview = (query?: StglClubAnnualReviewQuery): AxiosPromise<StglClubAnnualReviewVO[]> => {
return request({
url: '/stgl/club/annualReview/list',
method: 'get',
params: query,
headers: {
isEncrypt: 'true'
}
});
};
/**
* 查询我的社团年审记录列表
* @param query
* @returns {*}
*/
export const listMyStglClubAnnualReview = (query?: StglClubAnnualReviewQuery): AxiosPromise<StglClubAnnualReviewVO[]> => {
return request({
url: '/stgl/club/annualReview/myList',
method: 'get',
params: query,
headers: {
isEncrypt: 'true'
}
});
};
/**
* 查询社团年审记录详细
* @param id
*/
export const getStglClubAnnualReview = (id: string | number): AxiosPromise<StglClubAnnualReviewVO> => {
return request({
url: '/stgl/club/annualReview/' + id,
method: 'get',
headers: {
isEncrypt: 'true'
}
});
};
/**
* 新增社团年审记录
* @param data
*/
export const addStglClubAnnualReview = (data: StglClubAnnualReviewForm) => {
return request({
url: '/stgl/club/annualReview',
method: 'post',
data: data,
headers: {
isEncrypt: 'true'
}
});
};
/**
* 修改社团年审记录
* @param data
*/
export const updateStglClubAnnualReview = (data: StglClubAnnualReviewForm) => {
return request({
url: '/stgl/club/annualReview',
method: 'put',
data: data,
headers: {
isEncrypt: 'true'
}
});
};
/**
* 删除社团年审记录
* @param id
*/
export const delStglClubAnnualReview = (id: string | number | Array<string | number>) => {
return request({
url: '/stgl/club/annualReview/' + id,
method: 'delete',
headers: {
isEncrypt: 'true'
}
});
};
/**
* 提交年审记录
* @param id
*/
export const submitStglClubAnnualReview = (id: string | number) => {
return request({
url: '/stgl/club/annualReview/submit/' + id,
method: 'post',
headers: {
isEncrypt: 'true'
}
});
};
/**
* 撤回年审记录
* @param id
*/
export const withdrawStglClubAnnualReview = (id: string | number) => {
return request({
url: '/stgl/club/annualReview/withdraw/' + id,
method: 'post',
headers: {
isEncrypt: 'true'
}
});
};
/**
* 审核年审记录
* @param params
*/
export const auditStglClubAnnualReview = (params: {
id: string | number;
auditResult: string;
auditOpinion?: string;
auditType: string;
}) => {
return request({
url: '/stgl/club/annualReview/audit',
method: 'post',
params: params,
headers: {
isEncrypt: 'true'
}
});
};
/**
* 检查是否可以创建年审记录
* @param clubId
* @param reviewYear
*/
export const checkCanCreateStglClubAnnualReview = (clubId: string | number, reviewYear: number): AxiosPromise<boolean> => {
return request({
url: '/stgl/club/annualReview/check',
method: 'get',
params: {
clubId,
reviewYear
},
headers: {
isEncrypt: 'true'
}
});
};
/**
* 获取年审状态选项
*/
export const getAnnualReviewStatusOptions = (): AxiosPromise<string[]> => {
return request({
url: '/stgl/club/annualReview/statusOptions',
method: 'get',
headers: {
isEncrypt: 'true'
}
});
};
/**
* 导出社团年审记录
* @param query
*/
export const exportStglClubAnnualReview = (query?: StglClubAnnualReviewQuery) => {
return request({
url: '/stgl/club/annualReview/export',
method: 'post',
data: query,
responseType: 'blob',
headers: {
isEncrypt: 'true'
}
});
};
/**
* 根据社团ID和年审年度获取该年度的活动数据
* @param clubId 社团ID
* @param reviewYear 年审年度 (例如:2024)
*/
export const getClubActivitiesByReviewYear = (clubId: string | number, reviewYear: number) => {
return request({
url: '/stgl/club/annualReview/clubActivities',
method: 'get',
params: {
clubId,
reviewYear
},
headers: {
isEncrypt: 'true'
}
});
};
/**
* 获取年审记录的活动数据(从stgl_club_annual_review_activity表中获取)
* @param annualReviewId 年审记录ID
*/
export const getAnnualReviewActivities = (annualReviewId: string | number) => {
return request({
url: '/stgl/club/annualReview/' + annualReviewId + '/activities',
method: 'get',
headers: {
isEncrypt: 'true'
}
});
};
+323
View File
@@ -0,0 +1,323 @@
export interface StglClubAnnualReviewVO {
/**
* 主键ID
*/
id: string | number;
/**
* 社团ID
*/
clubId: string | number;
/**
* 年审年度
*/
reviewYear: number;
/**
* 年审开始日期
*/
reviewStartDate: string;
/**
* 年审结束日期
*/
reviewEndDate: string;
/**
* 年审时间
*/
reviewTime: string;
/**
* 社团名称
*/
clubName: string;
/**
* 成立日期
*/
establishDate: string;
/**
* 社长姓名
*/
presidentName: string;
/**
* 社团类型
*/
clubType: string;
/**
* 指导老师姓名
*/
advisorName: string;
/**
* 指导老师部门
*/
advisorDept: string;
/**
* 是否有章程
*/
hasCharter: string;
/**
* 章程文件URL
*/
charterUrl: string;
/**
* 是否有资金
*/
hasFunds: string;
/**
* 资金数额
*/
fundAmount: number;
/**
* 成员数量
*/
memberCount: number;
/**
* 状态(0-草稿 1-已提交 2-审核中 3-审核通过 4-审核不通过)
*/
status: string;
/**
* 指导老师意见
*/
advisorOpinion: string;
/**
* 学院意见
*/
collegeOpinion: string;
/**
* 团委意见
*/
youthLeagueOpinion: string;
/**
* 创建者
*/
createBy: string | number;
/**
* 创建时间
*/
createTime: string;
/**
* 更新者
*/
updateBy: string | number;
/**
* 更新时间
*/
updateTime: string;
}
export interface StglClubAnnualReviewForm {
/**
* 主键ID
*/
id?: string | number;
/**
* 社团ID
*/
clubId: string | number;
/**
* 年审年度
*/
reviewYear: number;
/**
* 年审开始日期
*/
reviewStartDate: string;
/**
* 年审结束日期
*/
reviewEndDate: string;
/**
* 年审时间
*/
reviewTime: string;
/**
* 社团名称
*/
clubName: string;
/**
* 成立日期
*/
establishDate?: string;
/**
* 社团类型
*/
clubType?: string;
/**
* 指导老师姓名
*/
advisorName?: string;
/**
* 指导老师部门
*/
advisorDept?: string;
/**
* 是否有章程
*/
hasCharter?: string;
/**
* 章程文件URL
*/
charterUrl?: string;
/**
* 是否有资金
*/
hasFunds?: string;
/**
* 资金数额
*/
fundAmount?: number;
/**
* 成员数量
*/
memberCount?: number;
/**
* 状态(0-草稿 1-已提交 2-审核中 3-审核通过 4-审核不通过)
*/
status?: string;
/**
* 指导老师意见
*/
advisorOpinion?: string;
/**
* 学院意见
*/
collegeOpinion?: string;
/**
* 团委意见
*/
youthLeagueOpinion?: string;
/**
* 成员信息JSON
*/
membersJson?: string;
/**
* 活动信息JSON
*/
activitiesJson?: string;
}
export interface StglClubAnnualReviewQuery extends PageQuery {
/**
* 社团ID
*/
clubId?: string | number;
/**
* 年审年度
*/
reviewYear?: number;
/**
* 年审开始日期范围
*/
beginReviewStartDate?: string;
endReviewStartDate?: string;
/**
* 年审结束日期范围
*/
beginReviewEndDate?: string;
endReviewEndDate?: string;
/**
* 社团名称
*/
clubName?: string;
/**
* 社团类型
*/
clubType?: string;
/**
* 状态(0-草稿 1-已提交 2-审核中 3-审核通过 4-审核不通过)
*/
status?: string;
/**
* 其他查询参数
*/
params?: { [key: string]: any };
}
/**
* 分页查询接口
*/
export interface PageQuery {
/**
* 分页大小
*/
pageSize?: number;
/**
* 当前页数
*/
pageNum?: number;
/**
* 排序列
*/
orderByColumn?: string;
/**
* 排序的方向desc或者asc
*/
isAsc?: string;
}
/**
* 年审状态选项
*/
export const ANNUAL_REVIEW_STATUS_OPTIONS = [
{ label: '草稿', value: '0' },
{ label: '已提交', value: '1' },
{ label: '审核中', value: '2' },
{ label: '审核通过', value: '3' },
{ label: '审核不通过', value: '4' }
];
/**
* 是否选项
*/
export const YES_NO_OPTIONS = [
{ label: '是', value: 'Y' },
{ label: '否', value: 'N' }
];
@@ -0,0 +1,109 @@
import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { StglAnnualReviewAuditVO, StglAnnualReviewAuditForm, StglAnnualReviewAuditQuery } from './type';
/**
* 查询社团年审审批列表
* @param query
* @returns {*}
*/
export const listStglAnnualReviewAudit = (query?: StglAnnualReviewAuditQuery): AxiosPromise<StglAnnualReviewAuditVO[]> => {
return request({
url: '/stgl/annualReviewAudit/list',
method: 'get',
params: query
});
};
/**
* 查询社团年审审批详细
* @param id
*/
export const getStglAnnualReviewAudit = (id: string | number): AxiosPromise<StglAnnualReviewAuditVO> => {
return request({
url: '/stgl/annualReviewAudit/' + id,
method: 'get'
});
};
/**
* 根据年审记录ID查询审批记录
* @param annualReviewId
*/
export const getAnnualReviewAuditsByReviewId = (annualReviewId: string | number): AxiosPromise<StglAnnualReviewAuditVO[]> => {
return request({
url: '/stgl/annualReviewAudit/byAnnualReview/' + annualReviewId,
method: 'get'
});
};
/**
* 根据审批人ID查询待审批记录
* @param approverId
*/
export const getPendingAuditsByApproverId = (approverId: string | number): AxiosPromise<StglAnnualReviewAuditVO[]> => {
return request({
url: '/stgl/annualReviewAudit/pending/' + approverId,
method: 'get'
});
};
/**
* 新增社团年审审批
* @param data
*/
export const addStglAnnualReviewAudit = (data: StglAnnualReviewAuditForm) => {
return request({
url: '/stgl/annualReviewAudit',
method: 'post',
data: data
});
};
/**
* 修改社团年审审批
* @param data
*/
export const updateStglAnnualReviewAudit = (data: StglAnnualReviewAuditForm) => {
return request({
url: '/stgl/annualReviewAudit',
method: 'put',
data: data
});
};
/**
* 删除社团年审审批
* @param id
*/
export const delStglAnnualReviewAudit = (id: string | number | Array<string | number>) => {
return request({
url: '/stgl/annualReviewAudit/' + id,
method: 'delete'
});
};
/**
* 审批年审记录
* @param auditId 审批记录ID
* @param approveResult 审批结果
* @param approveOpinion 审批意见
* @param nextAuditors 下一步审核人列表(可选)
*/
export const approveAnnualReview = (
auditId: string | number,
approveResult: string,
approveOpinion: string,
nextAuditors?: Array<{userId: string | number; userName: string; nickName: string}>
) => {
return request({
url: '/stgl/annualReviewAudit/approve',
method: 'post',
data: {
auditId,
approveResult,
approveOpinion,
nextAuditors: nextAuditors || []
}
});
};
@@ -0,0 +1,182 @@
export interface StglAnnualReviewAuditVO {
/**
* 主键ID
*/
id: string | number;
/**
* 年审记录ID
*/
annualReviewId: string | number;
/**
* 节点代码(advisor_approve/college_approve/youth_league_approve)
*/
nodeCode: string;
/**
* 节点名称(指导老师审批/学院审批/校团委审批)
*/
nodeName: string;
/**
* 节点顺序(1.1,1.2,2,3)
*/
nodeOrder: number;
/**
* 节点状态(pending/waiting/approved)
*/
nodeStatus: string;
/**
* 审批人ID
*/
approverId: string | number;
/**
* 审批人姓名
*/
approverName: string;
/**
* 审批结果(通过/不通过)
*/
approveResult: string;
/**
* 审批意见
*/
approveOpinion: string;
/**
* 审批时间
*/
approveTime: string;
/**
* 创建者
*/
createBy: string | number;
/**
* 创建时间
*/
createTime: string;
/**
* 更新者
*/
updateBy: string | number;
/**
* 更新时间
*/
updateTime: string;
}
export interface StglAnnualReviewAuditForm {
/**
* 主键ID
*/
id?: string | number;
/**
* 年审记录ID
*/
annualReviewId?: string | number;
/**
* 节点代码(advisor_approve/college_approve/youth_league_approve)
*/
nodeCode?: string;
/**
* 节点名称(指导老师审批/学院审批/校团委审批)
*/
nodeName?: string;
/**
* 节点顺序(1.1,1.2,2,3)
*/
nodeOrder?: number;
/**
* 节点状态(pending/waiting/approved)
*/
nodeStatus?: string;
/**
* 审批人ID
*/
approverId?: string | number;
/**
* 审批人姓名
*/
approverName?: string;
/**
* 审批结果(通过/不通过)
*/
approveResult?: string;
/**
* 审批意见
*/
approveOpinion?: string;
/**
* 审批时间
*/
approveTime?: string;
}
export interface StglAnnualReviewAuditQuery extends PageQuery {
/**
* 年审记录ID
*/
annualReviewId?: string | number;
/**
* 节点代码
*/
nodeCode?: string;
/**
* 节点状态
*/
nodeStatus?: string;
/**
* 审批人ID
*/
approverId?: string | number;
/**
* 审批结果
*/
approveResult?: string;
/**
* 审批时间范围
*/
params?: any;
}
/**
* 审批节点状态选项
*/
export const AUDIT_NODE_STATUS_OPTIONS = [
{ label: '待审批', value: 'pending' },
{ label: '等待中', value: 'waiting' },
{ label: '已审批', value: 'approved' }
];
/**
* 审批结果选项
*/
export const APPROVE_RESULT_OPTIONS = [
{ label: '通过', value: '通过' },
{ label: '不通过', value: '不通过' }
];
+93
View File
@@ -0,0 +1,93 @@
import request from '@/utils/request'
// 社团活动权限检查结果类型定义
export interface ClubActivityPermissionResult {
canCreateActivity: boolean
status: 'NORMAL' | 'TEMPORARILY_LIMITED' | 'PERMANENTLY_LIMITED'
message: string
deadlineTime?: string
remainingHours?: number
remainingDays?: number
annualReviewStartTime?: string
}
// 权限详情类型定义
export interface ClubPermissionDetails {
permissionResult: ClubActivityPermissionResult
isInAnnualReviewWindow: boolean
daysUntilNextAnnualReview: number
hasSubmittedCurrentYearAnnualReview: boolean
}
/**
* 检查社团活动权限
* @param clubId 社团ID (支持字符串和数字类型,避免大整数精度丢失)
* @returns 权限检查结果
*/
export function checkClubActivityPermission(clubId: number | string) {
return request<ClubActivityPermissionResult>({
url: `/stgl/club/permission/checkActivityPermission/${clubId}`,
method: 'get'
})
}
/**
* 批量检查多个社团的权限状态
* @param clubIds 社团ID列表
* @returns 权限检查结果映射
*/
export function batchCheckClubPermission(clubIds: number[]) {
return request<Record<number, ClubActivityPermissionResult>>({
url: '/stgl/club/permission/batchCheckPermission',
method: 'post',
data: clubIds
})
}
/**
* 检查社团是否在年审窗口期内
* @param clubId 社团ID
* @returns 是否在年审窗口期
*/
export function isInAnnualReviewWindow(clubId: number) {
return request<boolean>({
url: `/stgl/club/permission/isInAnnualReviewWindow/${clubId}`,
method: 'get'
})
}
/**
* 获取社团距离下次年审的天数
* @param clubId 社团ID
* @returns 距离年审的天数
*/
export function getDaysUntilNextAnnualReview(clubId: number) {
return request<number>({
url: `/stgl/club/permission/getDaysUntilNextAnnualReview/${clubId}`,
method: 'get'
})
}
/**
* 检查社团是否已在当前年审期内提交年审
* @param clubId 社团ID
* @returns 是否已提交年审
*/
export function hasSubmittedCurrentYearAnnualReview(clubId: number) {
return request<boolean>({
url: `/stgl/club/permission/hasSubmittedCurrentYearAnnualReview/${clubId}`,
method: 'get'
})
}
/**
* 获取社团权限详细信息(综合接口)
* @param clubId 社团ID
* @returns 权限详细信息
*/
export function getClubPermissionDetails(clubId: number) {
return request<ClubPermissionDetails>({
url: `/stgl/club/permission/getPermissionDetails/${clubId}`,
method: 'get'
})
}
+4
View File
@@ -97,6 +97,10 @@ export interface MyActivityVO {
undertakerName?: string;
/** 关联类型(1-社团 2-志愿者队伍) */
relatedType?: number;
/** 关联部门名称 */
relatedDeptName?: string;
/** 关联部门名称列表 */
relatedDeptNames?: string;
/** 关联组织名称(社团名称或志愿者团队名称) */
organizationName?: string;
/** 指导老师 */
+15
View File
@@ -74,6 +74,21 @@ export interface StglClassVO {
* 参与活动数量
*/
activityCount: number;
/**
* 今日活动名称(审核通过且时间为今天的活动)
*/
todayActivityName?: string;
/**
* 今日活动开始时间
*/
todayActivityStartTime?: string;
/**
* 今日活动结束时间
*/
todayActivityEndTime?: string;
}
/**
@@ -83,12 +83,14 @@ export const getStudentOptions = (
/**
* 查询单人留宿有效数据
* 获取所有有效的假期留宿数据,筛选出在同一时间段内该宿舍只有一个学生留宿的记录
* @param query 查询参数,支持宿管员权限过滤
* @returns 单人留宿有效数据列表
*/
export const getSinglePersonValidStay = (): AxiosPromise<HolidayStayVO[]> => {
export const getSinglePersonValidStay = (query?: any): AxiosPromise<HolidayStayVO[]> => {
return request({
url: '/holidayStay/holidayStay/singlePersonValidStay',
method: 'get'
method: 'get',
params: query
});
};
@@ -0,0 +1,81 @@
import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { DormApplicationVO, DormApplicationForm, DormApplicationQuery, StudentOptionVO, StudentOptionQuery } from './types';
/**
* 查询学生宿舍申请单表(调宿+退宿)列表
* @param query
* @returns {*}
*/
export const listDormApplication = (query?: DormApplicationQuery): AxiosPromise<DormApplicationVO[]> => {
return request({
url: '/dormApplication/dormApplication/list',
method: 'get',
params: query
});
};
/**
* 查询学生宿舍申请单表(调宿+退宿)详细
* @param id
*/
export const getDormApplication = (id: string | number): AxiosPromise<DormApplicationVO> => {
return request({
url: '/dormApplication/dormApplication/' + id,
method: 'get'
});
};
/**
* 新增学生宿舍申请单表(调宿+退宿)
* @param data
*/
export const addDormApplication = (data: DormApplicationForm) => {
return request({
url: '/dormApplication/dormApplication',
method: 'post',
data: data
});
};
/**
* 修改学生宿舍申请单表(调宿+退宿)
* @param data
*/
export const updateDormApplication = (data: DormApplicationForm) => {
return request({
url: '/dormApplication/dormApplication',
method: 'put',
data: data
});
};
/**
* 删除学生宿舍申请单表(调宿+退宿)
* @param id
*/
export const delDormApplication = (id: string | number | Array<string | number>) => {
return request({
url: '/dormApplication/dormApplication/' + id,
method: 'delete'
});
};
/**
* 获取学生选择器选项列表(支持按学号、姓名检索)
* @param query 查询参数
* @returns 学生选项列表
*/
export const getStudentOptions = (
query?: StudentOptionQuery
): AxiosPromise<{
total: number;
rows: StudentOptionVO[];
}> => {
return request({
url: '/holidayStay/holidayStay/studentOptions',
method: 'get',
params: query
});
};
+586
View File
@@ -0,0 +1,586 @@
export interface PageQuery {
pageNum?: number;
pageSize?: number;
}
export interface DormApplicationVO {
/**
* 主键ID(雪花ID)
*/
id: string | number;
/**
* 申请名称
*/
applicationName: string;
/**
* 申请类型(1:调宿申请 2:退宿申请)
*/
applicationType: string;
/**
* 审批状态:cancel-已撤销 , draft-草稿, waiting-待审核, finish-已完成, invalid-已作废, back-已退回, termination-已终止
*/
applicationStatus: string;
/**
* 申请学生ID
*/
studentId: string | number;
/**
* 学号
*/
studentNo: string;
/**
* 学生姓名
*/
studentName: string;
/**
* 学生联系电话
*/
studentPhone: string;
/**
* 学院ID
*/
collegeId: string | number;
/**
* 学院名称
*/
collegeName: string;
/**
* 专业ID
*/
majorId: string | number;
/**
* 专业名称
*/
majorName: string;
/**
* 班级ID
*/
classId: string | number;
/**
* 班级名称
*/
className: string;
/**
* 当前校区ID
*/
currentCampusId: string | number;
/**
* 当前校区名称
*/
currentCampusName: string;
/**
* 当前宿舍楼ID
*/
currentBuildingId: string | number;
/**
* 当前宿舍楼名称
*/
currentBuildingName: string;
/**
* 当前房间ID
*/
currentRoomId: string | number;
/**
* 当前房间号
*/
currentRoomNo: string;
/**
* 当前床位ID
*/
currentBedId: string | number;
/**
* 当前床位号
*/
currentBedNo: string;
/**
* 目标校区ID
*/
targetCampusId: string | number;
/**
* 目标校区名称
*/
targetCampusName: string;
/**
* 目标宿舍楼ID
*/
targetBuildingId: string | number;
/**
* 目标宿舍楼名称
*/
targetBuildingName: string;
/**
* 目标房间ID
*/
targetRoomId: string | number;
/**
* 目标房间号
*/
targetRoomNo: string;
/**
* 目标床位ID
*/
targetBedId: string | number;
/**
* 目标床位号
*/
targetBedNo: string;
/**
* 详细原因说明
*/
reasonDetail: string;
/**
* 申请时间
*/
applyTime: string;
/**
* 附件OSS文件ID,多个用逗号分隔
*/
attachmentOssIds: string;
/**
* 备注信息
*/
remark: string;
/**
* 扩展字段1
*/
extField1: string;
/**
* 扩展字段2
*/
extField2: string;
/**
* 扩展字段3
*/
extField3: string;
/**
* 删除标志(0代表存在 1代表删除)
*/
deleted: string;
/**
* 创建者
*/
createBy: string | number;
/**
* 创建时间
*/
createTime: string;
/**
* 更新者
*/
updateBy: string | number;
/**
* 更新时间
*/
updateTime: string;
}
export interface DormApplicationForm {
/**
* 主键ID(雪花ID)
*/
id?: string | number;
/**
* 申请名称
*/
applicationName?: string;
/**
* 申请类型(1:调宿申请 2:退宿申请)
*/
applicationType?: string;
/**
* 审批状态:cancel-已撤销 , draft-草稿, waiting-待审核, finish-已完成, invalid-已作废, back-已退回, termination-已终止
*/
applicationStatus?: string;
/**
* 申请学生ID
*/
studentId?: string | number;
/**
* 学号
*/
studentNo?: string;
/**
* 学生姓名
*/
studentName?: string;
/**
* 学生联系电话
*/
studentPhone?: string;
/**
* 学院ID
*/
collegeId?: string | number;
/**
* 学院名称
*/
collegeName?: string;
/**
* 专业ID
*/
majorId?: string | number;
/**
* 专业名称
*/
majorName?: string;
/**
* 班级ID
*/
classId?: string | number;
/**
* 班级名称
*/
className?: string;
/**
* 当前校区ID
*/
currentCampusId?: string | number;
/**
* 当前校区名称
*/
currentCampusName?: string;
/**
* 当前宿舍楼ID
*/
currentBuildingId?: string | number;
/**
* 当前宿舍楼名称
*/
currentBuildingName?: string;
/**
* 当前房间ID
*/
currentRoomId?: string | number;
/**
* 当前房间号
*/
currentRoomNo?: string;
/**
* 当前床位ID
*/
currentBedId?: string | number;
/**
* 当前床位号
*/
currentBedNo?: string;
/**
* 目标校区ID
*/
targetCampusId?: string | number;
/**
* 目标校区名称
*/
targetCampusName?: string;
/**
* 目标宿舍楼ID
*/
targetBuildingId?: string | number;
/**
* 目标宿舍楼名称
*/
targetBuildingName?: string;
/**
* 目标房间ID
*/
targetRoomId?: string | number;
/**
* 目标房间号
*/
targetRoomNo?: string;
/**
* 目标床位ID
*/
targetBedId?: string | number;
/**
* 目标床位号
*/
targetBedNo?: string;
/**
* 详细原因说明
*/
reasonDetail?: string;
/**
* 申请时间
*/
applyTime?: string;
/**
* 附件OSS文件ID,多个用逗号分隔
*/
attachmentOssIds?: string;
/**
* 紧急联系人姓名
*/
emergencyContact?: string;
/**
* 紧急联系人电话
*/
emergencyPhone?: string;
/**
* 备注信息
*/
remark?: string;
/**
* 扩展字段1
*/
extField1?: string;
/**
* 扩展字段2
*/
extField2?: string;
/**
* 扩展字段3
*/
extField3?: string;
}
export interface DormApplicationQuery extends PageQuery {
/**
* 申请名称
*/
applicationName?: string;
/**
* 申请类型(1:调宿申请 2:退宿申请)
*/
applicationType?: string;
/**
* 审批状态:cancel-已撤销 , draft-草稿, waiting-待审核, finish-已完成, invalid-已作废, back-已退回, termination-已终止
*/
applicationStatus?: string;
/**
* 申请学生ID
*/
studentId?: string | number;
/**
* 学号
*/
studentNo?: string;
/**
* 学生姓名
*/
studentName?: string;
/**
* 学生联系电话
*/
studentPhone?: string;
/**
* 学院ID
*/
collegeId?: string | number;
/**
* 学院名称
*/
collegeName?: string;
/**
* 专业ID
*/
majorId?: string | number;
/**
* 专业名称
*/
majorName?: string;
/**
* 班级ID
*/
classId?: string | number;
/**
* 班级名称
*/
className?: string;
/**
* 申请时间
*/
applyTime?: string;
/**
* 日期范围参数
*/
params?: any;
}
/**
* 学生选择器选项
*/
export interface StudentOptionVO {
/**
* 学生ID
*/
id: string | number;
/**
* 学号
*/
studentNo: string;
/**
* 学生姓名
*/
name: string;
/**
* 性别:0-男,1-女
*/
gender: string;
/**
* 学院ID
*/
collegeId?: string | number;
/**
* 学院名称
*/
collegeName?: string;
/**
* 专业ID
*/
majorId?: string | number;
/**
* 专业名称
*/
majorName?: string;
/**
* 班级ID
*/
classId?: string | number;
/**
* 班级名称
*/
className?: string;
/**
* 学生联系电话
*/
phone?: string;
/**
* 宿舍信息
*/
dormInfo?: {
campusId?: string | number;
campusName?: string;
areaId?: string | number;
areaName?: string;
buildingId?: string | number;
buildingName?: string;
roomId?: string | number;
roomName?: string;
bedId?: string | number;
bedName?: string;
};
}
/**
* 学生选择器查询参数
*/
export interface StudentOptionQuery {
/**
* 搜索关键字(学号或姓名)
*/
keyword?: string;
/**
* 页码
*/
pageNum?: number;
/**
* 每页大小
*/
pageSize?: number;
}
+153 -2
View File
@@ -4,18 +4,23 @@ import {
XljkConsultationScheduleVO,
XljkConsultationScheduleForm,
XljkConsultationScheduleQuery,
XljkConsultationScheduleSummaryVO,
XljkConsultationAppointmentVO,
XljkConsultationAppointmentForm,
XljkConsultationAppointmentQuery,
AvailableTimeSlot,
TimeSlotDetail,
CounselorOption
CounselorOption,
ScheduleWithStatus,
XljkConsulterVO,
XljkConsulterForm,
XljkConsulterQuery
} from './types';
// ===== 预约时段管理 API =====
// 查询预约时段列表
export const listXljkSchedule = (query: XljkConsultationScheduleQuery): AxiosPromise<XljkConsultationScheduleVO[]> => {
export const listXljkSchedule = (query: XljkConsultationScheduleQuery): AxiosPromise<XljkConsultationScheduleSummaryVO[]> => {
return request({
url: '/xljk/consultation/schedule/list',
method: 'get',
@@ -102,6 +107,15 @@ export const getXljkAvailableTimeSlots = (startDate: string, endDate: string): A
});
};
// 获取日历视图的排班数据(带预约状态)
export const getXljkCalendarSchedules = (startDate: string, endDate: string): AxiosPromise<ScheduleWithStatus[]> => {
return request({
url: '/xljk/consultation/appointment/calendar-schedules',
method: 'get',
params: { startDate, endDate }
});
};
// 获取可用的详细时段列表(30分钟一个时段)
export const getXljkAvailableDetailSlots = (date: string, timeSlot: string): AxiosPromise<TimeSlotDetail[]> => {
return request({
@@ -213,3 +227,140 @@ export const getXljkConsultationClassOptions = (collegeName?: string, majorName?
params: { collegeName, majorName }
});
};
/**
* 查询心理咨询师配置列表
* @param query
* @returns {*}
*/
export const listXljkConsulter = (query?: XljkConsulterQuery): AxiosPromise<XljkConsulterVO[]> => {
return request({
url: '/xljk/consulter/list',
method: 'get',
params: query
})
}
/**
* 查询心理咨询师配置详细
* @param id
*/
export const getXljkConsulter = (id: string | number): AxiosPromise<XljkConsulterVO> => {
return request({
url: '/xljk/consulter/' + id,
method: 'get'
})
}
/**
* 新增心理咨询师配置
* @param data
*/
export const addXljkConsulter = (data: XljkConsulterForm) => {
return request({
url: '/xljk/consulter',
method: 'post',
data: data
})
}
/**
* 修改心理咨询师配置
* @param data
*/
export const updateXljkConsulter = (data: XljkConsulterForm) => {
return request({
url: '/xljk/consulter',
method: 'put',
data: data
})
}
/**
* 删除心理咨询师配置
* @param id
*/
export const delXljkConsulter = (id: string | number | Array<string | number>) => {
return request({
url: '/xljk/consulter/' + id,
method: 'delete'
})
}
/**
* 导出心理咨询师配置
* @param query
* @returns {*}
*/
export const exportXljkConsulter = (query?: XljkConsulterQuery) => {
return request({
url: '/xljk/consulter/export',
method: 'post',
data: query,
responseType: 'blob'
})
}
/**
* 批量添加咨询师
* @param userIds 用户ID列表
* @param remark 备注
*/
export const batchAddConsulters = (userIds: number[], remark?: string) => {
return request({
url: '/xljk/consulter/batchAdd',
method: 'post',
data: {
userIds,
remark
}
})
}
/**
* 查询我配置的咨询师列表
* @param query
*/
export const listMyConfigConsulters = (query?: XljkConsulterQuery): AxiosPromise<XljkConsulterVO[]> => {
return request({
url: '/xljk/consulter/myConfig',
method: 'get',
params: query
})
}
/**
* 批量启用咨询师
* @param ids
*/
export const enableConsulters = (ids: number[]) => {
return request({
url: '/xljk/consulter/enable',
method: 'post',
data: ids
})
}
/**
* 批量停用咨询师
* @param ids
*/
export const disableConsulters = (ids: number[]) => {
return request({
url: '/xljk/consulter/disable',
method: 'post',
data: ids
})
}
/**
* 根据部门ID获取用户列表
* @param deptId
*/
export const listUserByDeptId = (deptId: string | number) => {
return request({
url: '/xljk/consulter/users/' + deptId,
method: 'get'
})
}
+390 -9
View File
@@ -1,3 +1,5 @@
import { PageQuery } from '@/api/types'
export interface XljkConsultationScheduleVO {
/**
* 主键ID
@@ -14,6 +16,11 @@ export interface XljkConsultationScheduleVO {
*/
counselorName?: string;
/**
* 办公室
*/
office?: string;
/**
* 排班日期
*/
@@ -71,6 +78,11 @@ export interface XljkConsultationScheduleForm extends BaseEntity {
*/
counselorId?: number;
/**
* 办公室
*/
office?: string;
/**
* 排班日期
*/
@@ -103,6 +115,11 @@ export interface XljkConsultationScheduleQuery extends PageQuery {
*/
counselorId?: number;
/**
* 办公室
*/
office?: string;
/**
* 排班日期开始
*/
@@ -130,6 +147,10 @@ export interface XljkConsultationScheduleQuery extends PageQuery {
}
export interface XljkConsultationAppointmentVO extends BaseEntity {
/**
* 主键ID
*/
id?: string | number;
/**
* 学生ID
*/
@@ -163,13 +184,13 @@ export interface XljkConsultationAppointmentVO extends BaseEntity {
*/
reason?: string;
/**
* 状态(0待咨询 1已完成 2已取消 3未到访)
* 咨询主题
*/
status?: number;
consultTheme?: string;
/**
* 实际到访时间
* 状态(0待咨询 1已完成 2已取消 3未到访 4待审核 5已驳回)
*/
actualVisitTime?: any;
status?: number | string;
/**
* 沟通时长(分钟)
*/
@@ -186,6 +207,26 @@ export interface XljkConsultationAppointmentVO extends BaseEntity {
* 学生姓名
*/
studentName?: string;
/**
* 心理病史(0-是,1-否)
*/
psychologicalHistory?: number;
/**
* 心理病史详情
*/
psychologicalHistoryDetail?: string;
/**
* 基本情况
*/
basicSituation?: string;
/**
* 重大生活事件
*/
majorLifeEvents?: string;
/**
* 是否需要转介(0-是,1-否)
*/
needReferral?: number;
/**
* 班级
*/
@@ -194,6 +235,10 @@ export interface XljkConsultationAppointmentVO extends BaseEntity {
* 咨询师姓名
*/
counselorName?: string;
/**
* 办公室
*/
office?: string;
/**
* 院系
*/
@@ -202,6 +247,10 @@ export interface XljkConsultationAppointmentVO extends BaseEntity {
* 专业
*/
majorName?: string;
/**
* 本学期到访次数
*/
semesterVisitCount?: number;
}
export interface XljkConsultationAppointmentForm {
@@ -242,13 +291,13 @@ export interface XljkConsultationAppointmentForm {
*/
reason?: string;
/**
* 状态(0待咨询 1已完成 2已取消 3未到访)
* 咨询主题
*/
status?: number;
consultTheme?: string;
/**
* 实际到访时间
* 状态(0待咨询 1已完成 2已取消 3未到访 4待审核 5已驳回)
*/
actualVisitTime?: any;
status?: number | string;
/**
* 沟通时长(分钟)
*/
@@ -261,6 +310,30 @@ export interface XljkConsultationAppointmentForm {
* 咨询师建议
*/
counselorSuggestion?: string;
/**
* 学生姓名
*/
studentName?: string;
/**
* 心理病史(0-是,1-否)
*/
psychologicalHistory?: number;
/**
* 心理病史详情
*/
psychologicalHistoryDetail?: string;
/**
* 基本情况
*/
basicSituation?: string;
/**
* 重大生活事件
*/
majorLifeEvents?: string;
/**
* 是否需要转介(0-是,1-否)
*/
needReferral?: number;
}
export interface XljkConsultationAppointmentQuery extends PageQuery {
@@ -289,6 +362,11 @@ export interface XljkConsultationAppointmentQuery extends PageQuery {
*/
majorName?: string;
/**
* 班级
*/
className?: string;
/**
* 咨询师ID
*/
@@ -312,7 +390,11 @@ export interface XljkConsultationAppointmentQuery extends PageQuery {
/**
* 日期范围参数
*/
params?: any;
params?: {
beginAppointmentDate?: string;
endAppointmentDate?: string;
[key: string]: any;
};
}
export interface AvailableTimeSlot {
@@ -331,6 +413,11 @@ export interface AvailableTimeSlot {
*/
counselorName?: string;
/**
* 办公室
*/
office?: string;
/**
* 日期
*/
@@ -419,6 +506,11 @@ export interface CounselorOption {
* 咨询师姓名
*/
name: string;
/**
* 办公室
*/
office: string;
}
// 预约时段汇总视图对象
@@ -433,6 +525,7 @@ export interface XljkConsultationScheduleSummaryVO {
deleted: number;
counselorId: number;
counselorName: string;
office: string;
dateRange: string;
morningEnabled: boolean;
morningTime: string;
@@ -602,3 +695,291 @@ export interface NoShowVO {
*/
updateTime?: string;
}
/**
* 带预约状态的排班数据
*/
export interface ScheduleWithStatus {
/**
* 排班ID
*/
scheduleId: number;
/**
* 咨询师ID
*/
counselorId: number;
/**
* 咨询师姓名
*/
counselorName?: string;
/**
* 办公室
*/
office?: string;
/**
* 排班日期
*/
date: string;
/**
* 时段类型(0上午 1中午 2下午)
*/
timeSlot: string;
/**
* 开始时间(HH:mm)
*/
startTime: string;
/**
* 结束时间(HH:mm)
*/
endTime: string;
/**
* 时段显示文本(如:上午 08:30-12:00)
*/
timeDisplay: string;
/**
* 是否已预约满
*/
isFullyBooked: boolean;
/**
* 是否已过期
*/
isExpired: boolean;
/**
* 可预约数量
*/
availableSlots: number;
/**
* 总预约数量
*/
totalSlots: number;
/**
* 创建者
*/
createBy?: number;
/**
* 创建时间
*/
createTime?: string;
/**
* 更新者
*/
updateBy?: number;
/**
* 更新时间
*/
updateTime?: string;
}
export interface XljkConsulterVO {
/**
* 主键ID
*/
id: string | number;
/**
* 用户ID
*/
userId: number;
/**
* 用户账号
*/
userName: string;
/**
* 用户昵称
*/
nickName: string;
/**
* 部门ID
*/
deptId: number;
/**
* 部门名称
*/
deptName: string;
/**
* 办公室
*/
office?: string;
/**
* 联系电话
*/
phoneNumber: string;
/**
* 邮箱地址
*/
email: string;
/**
* 状态(1正常 0停用)
*/
status: string;
/**
* 备注说明
*/
remark: string;
/**
* 配置人ID
*/
configBy: number;
/**
* 配置人姓名
*/
configByName: string;
/**
* 创建者
*/
createBy: number;
/**
* 创建时间
*/
createTime: string;
/**
* 更新者
*/
updateBy: number;
/**
* 更新时间
*/
updateTime: string;
}
export interface XljkConsulterForm {
/**
* 主键ID
*/
id?: string | number;
/**
* 用户ID
*/
userId?: number;
/**
* 用户账号
*/
userName?: string;
/**
* 用户昵称
*/
nickName?: string;
/**
* 部门ID
*/
deptId?: number;
/**
* 部门名称
*/
deptName?: string;
/**
* 办公室
*/
office?: string;
/**
* 联系电话
*/
phoneNumber?: string;
/**
* 邮箱地址
*/
email?: string;
/**
* 状态(1正常 0停用)
*/
status?: string;
/**
* 备注说明
*/
remark?: string;
/**
* 配置人ID
*/
configBy?: number;
/**
* 配置人姓名
*/
configByName?: string;
}
export interface XljkConsulterQuery extends PageQuery {
/**
* 用户ID
*/
userId?: number;
/**
* 用户账号
*/
userName?: string;
/**
* 用户昵称
*/
nickName?: string;
/**
* 部门ID
*/
deptId?: number;
/**
* 状态(1正常 0停用)
*/
status?: string;
/**
* 配置人ID
*/
configBy?: number;
/**
* 办公室
*/
office?: string;
/**
* 日期范围参数
*/
'params[beginCreateTime]'?: string;
'params[endCreateTime]'?: string;
}
@@ -80,6 +80,10 @@ export interface XskhAssessmentIndicatorVo extends BaseEntity {
disciplineTypeIds?: string[];
/** 关联的奖励类型ID列表 */
rewardTypeIds?: string[];
/** 关联的违纪处分类型ID(单个值,用于前端表单) */
disciplineTypeId?: string | number;
/** 关联的奖励类型ID(单个值,用于前端表单) */
rewardTypeId?: string | number;
/** 创建者 */
createBy?: string | number;
/** 创建时间 */
@@ -110,10 +114,10 @@ export interface XskhAssessmentIndicatorForm extends BaseEntity {
status?: string;
/** 排序号 */
sortOrder?: number;
/** 关联的违纪处分类型ID列表 */
disciplineTypeIds?: string[];
/** 关联的奖励类型ID列表 */
rewardTypeIds?: string[];
/** 关联的违纪处分类型ID */
disciplineTypeId?: string | number;
/** 关联的奖励类型ID */
rewardTypeId?: string | number;
}
/**
@@ -0,0 +1,399 @@
<template>
<el-dialog
:model-value="visible"
:title="title"
width="1000px"
append-to-body
@update:model-value="handleClose"
>
<div class="advisor-history-container">
<!-- 当前指导老师 -->
<div class="current-advisors-section">
<h4 class="section-title">
<el-icon><User /></el-icon>
当前指导老师
</h4>
<div v-if="currentAdvisors.length === 0" class="no-data">
<el-empty description="暂无当前指导老师" :image-size="60" />
</div>
<div v-else class="advisor-cards">
<div
v-for="advisor in currentAdvisors"
:key="advisor.id"
class="advisor-card current"
>
<div class="advisor-header">
<span class="advisor-name">{{ advisor.advisorName }}</span>
<el-tag type="success" size="small">在任</el-tag>
</div>
<div class="advisor-info">
<div class="info-item">
<el-icon><OfficeBuilding /></el-icon>
<span>{{ advisor.advisorDept || '暂无' }}</span>
</div>
<div class="info-item">
<el-icon><Phone /></el-icon>
<span>{{ advisor.advisorPhone || '暂无' }}</span>
</div>
<div class="info-item">
<el-icon><Message /></el-icon>
<span>{{ advisor.advisorEmail || '暂无' }}</span>
</div>
<div class="info-item">
<el-icon><Calendar /></el-icon>
<span>上任时间:{{ formatDate(advisor.startTime) }}</span>
</div>
</div>
</div>
</div>
</div>
<!-- 历史记录 -->
<div class="history-section">
<h4 class="section-title">
<el-icon><Clock /></el-icon>
历史记录
<span class="record-count">({{ historyAdvisors.length }}条)</span>
</h4>
<div v-if="historyAdvisors.length === 0" class="no-data">
<el-empty description="暂无历史记录" :image-size="60" />
</div>
<div v-else>
<el-table
:data="historyAdvisors"
style="width: 100%"
max-height="300"
stripe
>
<el-table-column label="姓名" prop="advisorName" width="180" />
<el-table-column label="部门" prop="advisorDept" min-width="120" show-overflow-tooltip />
<el-table-column label="联系方式" min-width="120">
<template #default="scope">
<div class="contact-info">
<div v-if="scope.row.advisorPhone" class="contact-item">
<el-icon><Phone /></el-icon>
{{ scope.row.advisorPhone }}
</div>
<div v-if="scope.row.advisorEmail" class="contact-item email">
<el-icon><Message /></el-icon>
{{ scope.row.advisorEmail }}
</div>
</div>
</template>
</el-table-column>
<el-table-column label="上任时间" width="100">
<template #default="scope">
{{ formatDate(scope.row.startTime) }}
</template>
</el-table-column>
<el-table-column label="离任时间" width="100">
<template #default="scope">
{{ formatDate(scope.row.endTime) }}
</template>
</el-table-column>
<el-table-column label="任期" width="130">
<template #default="scope">
{{ calculateDuration(scope.row.startTime, scope.row.endTime) }}
</template>
</el-table-column>
</el-table>
</div>
</div>
</div>
<template #footer>
<div class="dialog-footer">
<el-button @click="handleClose">关 闭</el-button>
</div>
</template>
</el-dialog>
</template>
<script setup lang="ts">
import { ref, watch, computed } from 'vue';
import { ElMessage } from 'element-plus';
import { User, OfficeBuilding, Phone, Message, Calendar, Clock } from '@element-plus/icons-vue';
import { getCurrentAdvisors, getHistoryAdvisors } from '@/api/stgl/club/advisor-history';
import type { StglClubAdvisorHistoryVO } from '@/api/stgl/club/advisor-history';
interface Props {
visible: boolean;
title: string;
clubId?: string | number;
clubName?: string;
}
const props = withDefaults(defineProps<Props>(), {
visible: false,
title: '指导老师历史记录',
clubId: undefined,
clubName: ''
});
const emit = defineEmits<{
'update:visible': [value: boolean];
}>();
// 响应式数据
const currentAdvisors = ref<StglClubAdvisorHistoryVO[]>([]);
const historyAdvisors = ref<StglClubAdvisorHistoryVO[]>([]);
const loading = ref(false);
// 计算属性
const dialogTitle = computed(() => {
return props.clubName ? `${props.clubName} - ${props.title}` : props.title;
});
// 监听弹窗显示状态
watch(() => props.visible, (newVal) => {
if (newVal && props.clubId) {
loadAdvisorData();
}
});
// 监听社团ID变化
watch(() => props.clubId, (newVal) => {
if (newVal && props.visible) {
loadAdvisorData();
}
});
// 加载指导老师数据
const loadAdvisorData = async () => {
if (!props.clubId) {
ElMessage.warning('社团ID不能为空');
return;
}
loading.value = true;
try {
// 并行加载当前和历史指导老师数据
const [currentRes, historyRes] = await Promise.all([
getCurrentAdvisors(props.clubId),
getHistoryAdvisors(props.clubId)
]);
currentAdvisors.value = currentRes.data || [];
historyAdvisors.value = historyRes.data || [];
console.log('指导老师数据加载成功:', {
current: currentAdvisors.value.length,
history: historyAdvisors.value.length
});
} catch (error) {
console.error('加载指导老师数据失败:', error);
ElMessage.error('加载指导老师数据失败');
} finally {
loading.value = false;
}
};
// 关闭弹窗
const handleClose = () => {
emit('update:visible', false);
};
// 格式化日期
const formatDate = (dateStr?: string) => {
if (!dateStr) return '暂无';
const date = new Date(dateStr);
return date.toLocaleDateString('zh-CN', {
year: 'numeric',
month: '2-digit',
day: '2-digit'
});
};
// 计算任期
const calculateDuration = (startTime?: string, endTime?: string) => {
if (!startTime || !endTime) return '暂无';
const start = new Date(startTime);
const end = new Date(endTime);
const diffTime = Math.abs(end.getTime() - start.getTime());
const diffDays = Math.ceil(diffTime / (1000 * 60 * 60 * 24));
if (diffDays < 30) {
return `${diffDays}天`;
} else if (diffDays < 365) {
const months = Math.floor(diffDays / 30);
const days = diffDays % 30;
return days > 0 ? `${months}个月${days}天` : `${months}个月`;
} else {
const years = Math.floor(diffDays / 365);
const months = Math.floor((diffDays % 365) / 30);
const days = (diffDays % 365) % 30;
let result = `${years}年`;
if (months > 0) result += `${months}个月`;
if (days > 0) result += `${days}天`;
return result;
}
};
</script>
<style scoped>
.advisor-history-container {
padding: 10px 0;
}
.section-title {
display: flex;
align-items: center;
gap: 8px;
margin: 0 0 16px 0;
font-size: 16px;
font-weight: 600;
color: #303133;
border-bottom: 2px solid #409eff;
padding-bottom: 8px;
}
.record-count {
font-size: 14px;
font-weight: normal;
color: #909399;
}
.current-advisors-section {
margin-bottom: 30px;
}
.history-section {
margin-bottom: 20px;
}
.no-data {
text-align: center;
padding: 20px 0;
color: #909399;
}
/* 当前指导老师卡片样式 */
.advisor-cards {
display: flex;
flex-wrap: wrap;
gap: 16px;
}
.advisor-card {
flex: 1;
min-width: 300px;
padding: 16px;
border-radius: 8px;
border: 1px solid #e4e7ed;
background: #fff;
transition: all 0.3s ease;
}
.advisor-card.current {
border-color: #67c23a;
background: linear-gradient(135deg, #f0f9ff 0%, #f8fafc 100%);
}
.advisor-card:hover {
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
transform: translateY(-2px);
}
.advisor-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 12px;
}
.advisor-name {
font-size: 16px;
font-weight: 600;
color: #303133;
}
.advisor-info {
display: flex;
flex-direction: column;
gap: 8px;
}
.info-item {
display: flex;
align-items: center;
gap: 8px;
font-size: 14px;
color: #606266;
}
.info-item .el-icon {
color: #909399;
font-size: 16px;
}
/* 历史记录表格样式 */
.contact-info {
display: flex;
flex-direction: column;
gap: 4px;
}
.contact-item {
display: flex;
align-items: center;
gap: 4px;
font-size: 12px;
color: #606266;
}
.contact-item.email {
color: #409eff;
}
.contact-item .el-icon {
font-size: 12px;
color: #909399;
}
/* 表格样式优化 */
:deep(.el-table) {
border-radius: 6px;
overflow: hidden;
width: 100% !important;
table-layout: auto;
}
:deep(.el-table th) {
background-color: #fafafa;
color: #606266;
font-weight: 600;
}
:deep(.el-table td) {
border-bottom: 1px solid #f0f0f0;
}
:deep(.el-table__body tr:hover > td) {
background-color: #f5f7fa;
}
/* 确保表格充满容器 */
:deep(.el-table__header-wrapper),
:deep(.el-table__body-wrapper) {
width: 100% !important;
}
:deep(.el-table__header),
:deep(.el-table__body) {
width: 100% !important;
table-layout: auto;
}
/* 响应式设计 */
@media (max-width: 768px) {
.advisor-cards {
flex-direction: column;
}
.advisor-card {
min-width: auto;
}
}
</style>
+73 -22
View File
@@ -64,10 +64,14 @@ export interface AdvisorVO {
dept: string;
email: string;
userId?: string;
startTime?: string; // 上任时间
endTime?: string; // 离任时间
}
interface Props {
modelValue: AdvisorVO[];
establishDate?: string; // 社团成立日期
isNewClub?: boolean; // 是否为新建社团
}
interface Emits {
@@ -78,42 +82,74 @@ interface Emits {
const props = defineProps<Props>();
const emit = defineEmits<Emits>();
const advisors = ref<AdvisorVO[]>([...props.modelValue]);
const advisors = ref<AdvisorVO[]>([]);
// 监听props变化
// 使用computed来避免双重监听导致的递归更新
const advisorsData = computed({
get: () => props.modelValue || [],
set: (newValue: AdvisorVO[]) => {
emit('update:modelValue', newValue);
emit('change', newValue);
}
});
// 初始化数据
advisors.value = advisorsData.value.map((item) => ({ ...item }));
// 只监听props变化来同步内部数据
watch(
() => props.modelValue,
(newValue) => {
advisors.value = newValue ? newValue.map((item) => ({ ...item })) : [];
console.log('AdvisorManager: props.modelValue 变化:', newValue);
if (newValue) {
advisors.value = newValue.map((item) => ({ ...item }));
console.log('AdvisorManager: 设置后的 advisors.value:', advisors.value);
} else {
advisors.value = [];
}
},
{ deep: true }
);
// 监听内部数据变化,同步到父组件
watch(
advisors,
(newValue) => {
emit('update:modelValue', newValue);
emit('change', newValue);
},
{ deep: true }
{ deep: true, immediate: true }
);
// 添加指导老师
const addAdvisor = () => {
advisors.value.push({
// 智能设置上任时间:
// 1. 如果是新建社团的首任指导老师且有社团成立日期,使用成立日期
// 2. 否则使用当前日期
let startTime = '';
const isFirstAdvisor = advisors.value.length === 0;
const isNewClub = props.isNewClub !== false; // 默认认为是新建社团,除非明确传入false
if (isFirstAdvisor && isNewClub && props.establishDate) {
startTime = props.establishDate;
console.log('AdvisorManager: 新建社团的首任指导老师,上任时间设置为社团成立日期:', startTime);
} else {
const today = new Date();
startTime = today.getFullYear() + '-' +
String(today.getMonth() + 1).padStart(2, '0') + '-' +
String(today.getDate()).padStart(2, '0');
console.log('AdvisorManager: 后续新增指导老师,上任时间设置为当前日期:', startTime);
}
const newAdvisors = [...advisors.value, {
teacher: null,
name: '',
phone: '',
dept: '',
email: '',
userId: ''
});
userId: '',
startTime: startTime,
endTime: undefined
}];
advisors.value = newAdvisors;
advisorsData.value = newAdvisors;
};
// 删除指导老师
const removeAdvisor = (index: number) => {
advisors.value.splice(index, 1);
const newAdvisors = advisors.value.filter((_, i) => i !== index);
advisors.value = newAdvisors;
advisorsData.value = newAdvisors;
};
// 监听teacher选择变化,自动填充相关信息
@@ -121,28 +157,43 @@ const handleTeacherChange = (advisor: AdvisorVO, teacher: TeacherVO | null) => {
console.log('handleTeacherChange called with teacher:', teacher);
if (teacher) {
// 自动填充老师信息
// 自动填充老师信息,保留时间字段
const originalStartTime = advisor.startTime;
const originalEndTime = advisor.endTime;
advisor.teacher = teacher;
advisor.name = teacher.nickName || '';
advisor.phone = teacher.phonenumber || '暂无电话';
advisor.dept = teacher.deptName || '';
advisor.email = teacher.email || '暂无邮箱';
advisor.userId = teacher.userId?.toString() || '';
console.log('Updated advisor:', {
name: advisor.name,
phone: advisor.phone,
dept: advisor.dept,
email: advisor.email,
userId: advisor.userId
userId: advisor.userId,
startTime: advisor.startTime,
endTime: advisor.endTime
});
} else {
// 清空选择时重置所有信息
// 清空选择时重置所有信息,但保留时间字段
const originalStartTime = advisor.startTime;
const originalEndTime = advisor.endTime;
advisor.teacher = null;
advisor.name = '';
advisor.phone = '';
advisor.dept = '';
advisor.email = '';
advisor.userId = '';
advisor.startTime = originalStartTime; // 保留原有的上任时间
advisor.endTime = originalEndTime; // 保留原有的离任时间
}
// 触发更新
const newAdvisors = [...advisors.value];
advisorsData.value = newAdvisors;
};
// 移除有问题的深度监听,改为在TeacherSelector的change事件中处理
@@ -0,0 +1,136 @@
<template>
<el-select
v-model="selectedDepts"
placeholder="请选择关联部门"
clearable
filterable
multiple
style="width: 100%; height: 32px;"
size="default"
@change="handleChange"
@clear="handleClear"
>
<el-option
v-for="dept in deptOptions"
:key="dept.deptId"
:label="dept.deptName"
:value="dept.deptId"
/>
</el-select>
</template>
<script setup lang="ts">
import { ref, onMounted, watch } from 'vue';
import { listDept } from '@/api/system/dept';
import { DeptVO } from '@/api/system/dept/types';
interface DeptOption {
deptId: string | number;
deptName: string;
}
interface Props {
modelValue?: DeptOption[] | null;
}
interface Emits {
(e: 'update:modelValue', value: DeptOption[] | null): void;
(e: 'change', value: DeptOption[] | null): void;
}
const props = defineProps<Props>();
const emit = defineEmits<Emits>();
const selectedDepts = ref<(string | number)[]>([]);
const deptOptions = ref<DeptOption[]>([]);
// 获取部门列表数据
const loadDeptOptions = async () => {
try {
const response = await listDept({ parentId: 101 } as any);
if (response.data) {
// 过滤出parent_id=101的部门
const filteredDepts = response.data.filter((dept: DeptVO) => dept.parentId === 101);
deptOptions.value = filteredDepts.map((dept: DeptVO) => ({
deptId: dept.deptId,
deptName: dept.deptName
}));
}
} catch (error) {
console.error('获取部门列表失败:', error);
deptOptions.value = [];
}
};
// 处理选择变化
const handleChange = (values: (string | number)[]) => {
if (values && values.length > 0) {
const selectedOptions = values
.map(value => deptOptions.value.find(dept => dept.deptId === value))
.filter(Boolean) as DeptOption[];
emit('update:modelValue', selectedOptions);
emit('change', selectedOptions);
} else {
emit('update:modelValue', null);
emit('change', null);
}
};
// 处理清空
const handleClear = () => {
emit('update:modelValue', null);
emit('change', null);
};
// 监听外部传入的值变化
watch(
() => props.modelValue,
(newValue) => {
if (newValue && Array.isArray(newValue)) {
selectedDepts.value = newValue.map(dept => dept.deptId);
} else {
selectedDepts.value = [];
}
},
{ immediate: true }
);
onMounted(() => {
loadDeptOptions();
});
</script>
<style scoped>
/* 多选部门选择器样式 - 参考系统统一高度设置 */
:deep(.el-select) {
height: 32px !important;
}
:deep(.el-select .el-input__wrapper) {
min-height: 32px !important;
height: 32px !important;
}
/* 多选标签容器 - 参考系统设置 */
:deep(.el-select__tags) {
max-height: 28px !important;
overflow: hidden !important;
}
/* 标签样式 - 显示完整部门名称 */
:deep(.el-tag) {
height: 20px !important;
line-height: 18px !important;
margin: 4px 6px 4px 0 !important;
font-size: 12px !important;
white-space: nowrap !important;
display: inline-flex !important;
align-items: center !important;
}
/* 标签关闭按钮 */
:deep(.el-tag .el-tag__close) {
margin-left: 4px !important;
}
</style>
+100
View File
@@ -0,0 +1,100 @@
<template>
<el-select
v-model="selectedDept"
placeholder="请选择关联部门"
clearable
filterable
style="width: 100%"
@change="handleChange"
@clear="handleClear"
>
<el-option
v-for="dept in deptOptions"
:key="dept.deptId"
:label="dept.deptName"
:value="dept.deptId"
/>
</el-select>
</template>
<script setup lang="ts">
import { ref, onMounted, watch } from 'vue';
import { listDept } from '@/api/system/dept';
import { DeptVO } from '@/api/system/dept/types';
interface DeptOption {
deptId: string | number;
deptName: string;
}
interface Props {
modelValue?: DeptOption | null;
}
interface Emits {
(e: 'update:modelValue', value: DeptOption | null): void;
(e: 'change', value: DeptOption | null): void;
}
const props = defineProps<Props>();
const emit = defineEmits<Emits>();
const selectedDept = ref<string | number>();
const deptOptions = ref<DeptOption[]>([]);
// 获取部门列表数据
const loadDeptOptions = async () => {
try {
const response = await listDept({ parentId: 101 } as any);
if (response.data) {
// 过滤出parent_id=101的部门
const filteredDepts = response.data.filter((dept: DeptVO) => dept.parentId === 101);
deptOptions.value = filteredDepts.map((dept: DeptVO) => ({
deptId: dept.deptId,
deptName: dept.deptName
}));
}
} catch (error) {
console.error('获取部门列表失败:', error);
deptOptions.value = [];
}
};
// 处理选择变化
const handleChange = (value: string | number) => {
if (value) {
const selectedOption = deptOptions.value.find(dept => dept.deptId === value);
if (selectedOption) {
emit('update:modelValue', selectedOption);
emit('change', selectedOption);
}
} else {
emit('update:modelValue', null);
emit('change', null);
}
};
// 处理清空
const handleClear = () => {
selectedDept.value = undefined;
emit('update:modelValue', null);
emit('change', null);
};
// 监听外部传入的值变化
watch(
() => props.modelValue,
(newValue) => {
if (newValue) {
selectedDept.value = newValue.deptId;
} else {
selectedDept.value = undefined;
}
},
{ immediate: true }
);
onMounted(() => {
loadDeptOptions();
});
</script>
+17 -2
View File
@@ -38,7 +38,7 @@
<!-- </el-link> -->
<div class="ele-upload-list__item-content-action">
<el-button type="danger" v-if="!disabled" link @click="handleDelete(index)">删除</el-button>
<el-button type="danger" v-if="!disabled" link @click="handleDownloadAttachment(file)">下载</el-button>
<el-button type="primary" link @click="handleDownloadAttachment(file)">下载</el-button>
</div>
</li>
</transition-group>
@@ -155,7 +155,7 @@ const handleDownloadAttachment = async (file: any) => {
});
// 由于axios响应拦截器对blob类型响应直接返回blob数据
// 这里response直接就是blob对象,而不是包含data属性的响应对象
const blob = response;
const blob = response as unknown as Blob;
// 验证响应数据
if (!blob) {
@@ -306,4 +306,19 @@ const listToString = (list: any[], separator?: string) => {
.ele-upload-list__item-content-action .el-link {
margin-right: 10px;
}
.ele-upload-list__item-content-action {
margin-left: 15px;
}
.ele-upload-list__item-content-action .el-button--primary.is-link {
border: none !important;
padding: 0 !important;
}
.ele-upload-list__item-content-action .el-button--danger.is-link {
border: none !important;
padding: 0 !important;
margin-right: 10px;
}
</style>
+77 -4
View File
@@ -12,10 +12,19 @@
<el-table-column prop="nodeName" label="任务名称" sortable align="center"></el-table-column>
<el-table-column prop="approveName" :show-overflow-tooltip="true" label="办理人" sortable align="center">
<template #default="scope">
<template v-if="scope.row.approveName">
<template v-if="scope.row.approveUserDetails && scope.row.approveUserDetails.length > 0">
<div v-for="(userDetail, index) in scope.row.approveUserDetails" :key="index" style="margin-bottom: 4px">
<el-tag type="success">
{{ `${userDetail.nickName}/${userDetail.userName}/${userDetail.phonenumber || '无'}` }}
</el-tag>
</div>
</template>
<template v-else-if="scope.row.approveName">
<el-tag v-for="(item, index) in scope.row.approveName.split(',')" :key="index" type="success">{{ item }}</el-tag>
</template>
<template v-else> <el-tag type="success">无</el-tag></template>
<template v-else>
<el-tag type="success">无</el-tag>
</template>
</template>
</el-table-column>
<el-table-column prop="flowStatus" label="状态" width="80" sortable align="center">
@@ -62,6 +71,8 @@
import { flowHisTaskList } from '@/api/workflow/instance';
import { propTypes } from '@/utils/propTypes';
import { listByIds } from '@/api/system/oss';
import { optionSelect } from '@/api/system/user';
import { UserVO } from '@/api/system/user/types';
import FlowChart from '@/components/Process/flowChart.vue';
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const { wf_task_status } = toRefs<any>(proxy?.useDict('wf_task_status'));
@@ -81,11 +92,15 @@ const init = async (businessId: string | number) => {
loading.value = true;
tabActiveName.value = 'image';
historyList.value = [];
flowHisTaskList(businessId).then((resp) => {
try {
const resp = await flowHisTaskList(businessId);
if (resp.data) {
historyList.value = resp.data.list;
insId.value = resp.data.instanceId;
if (historyList.value.length > 0) {
// 获取附件信息
historyList.value.forEach((item) => {
if (item.ext) {
getIds(item.ext).then((res) => {
@@ -95,16 +110,74 @@ const init = async (businessId: string | number) => {
item.attachmentList = [];
}
});
// 获取所有办理人的详细信息
await getUserDetails();
}
loading.value = false;
}
});
} catch (error) {
console.error('获取审批记录失败:', error);
loading.value = false;
}
};
const getIds = async (ids: string | number) => {
const res = await listByIds(ids);
return res;
};
// 获取所有办理人的详细信息
const getUserDetails = async () => {
try {
// 收集所有办理人的用户ID
const allUserIds = new Set<string>();
historyList.value.forEach((item) => {
if (item.approver) {
const approverIds = item.approver.split(',').filter((id) => id.trim());
approverIds.forEach((id) => allUserIds.add(id.trim()));
}
});
if (allUserIds.size > 0) {
// 批量获取用户详细信息
const userIds = Array.from(allUserIds);
const userResponse = await optionSelect(userIds);
if (userResponse.data && userResponse.data.length > 0) {
// 创建用户ID到用户详细信息的映射
const userMap = new Map();
userResponse.data.forEach((user: UserVO) => {
userMap.set(String(user.userId), user);
});
// 为每个审批记录项添加办理人详细信息
historyList.value.forEach((item) => {
if (item.approver) {
const approverIds = item.approver.split(',').filter((id) => id.trim());
item.approveUserDetails = approverIds.map((id) => {
const userId = id.trim();
return (
userMap.get(userId) || {
userId: userId,
nickName: '未知用户',
userName: userId,
phonenumber: ''
}
);
});
} else {
item.approveUserDetails = [];
}
});
}
}
} catch (error) {
console.error('获取用户详细信息失败:', error);
// 如果获取用户详细信息失败,保持原有显示方式
}
};
/** 下载按钮操作 */
const handleDownload = (ossId: string, originalName: string) => {
console.log(ossId);
@@ -157,10 +157,13 @@ const treeProps = {
watch(
() => props.modelValue,
(newValue) => {
console.log('TeacherSelector: props.modelValue 变化:', newValue);
if (newValue) {
displayValue.value = newValue.nickName;
console.log('TeacherSelector: 设置 displayValue 为:', displayValue.value);
} else {
displayValue.value = '';
console.log('TeacherSelector: 清空 displayValue');
}
},
{ immediate: true }
@@ -14,10 +14,24 @@
<el-descriptions-item label="活动地点">{{ activity.location || '暂无' }}</el-descriptions-item>
<el-descriptions-item label="开始时间">{{ activity.startTime || '暂无' }}</el-descriptions-item>
<el-descriptions-item label="结束时间">{{ activity.endTime || '暂无' }}</el-descriptions-item>
<el-descriptions-item label="关联部门">
<div v-if="getRelatedDeptNames(activity).length > 0" class="dept-list">
<el-tag
v-for="(deptName, index) in getRelatedDeptNames(activity)"
:key="index"
type="info"
size="small"
class="dept-tag"
>
{{ deptName }}
</el-tag>
</div>
<span v-else>暂无</span>
</el-descriptions-item>
<el-descriptions-item label="关联社团/队伍">{{ activity.relatedClubName || '暂无' }}</el-descriptions-item>
<el-descriptions-item label="活动状态">
<dict-tag :options="stgl_activity_status" :value="activity.activityStatus" />
</el-descriptions-item>
<el-descriptions-item label="关联社团/队伍">{{ activity.relatedClubName || '暂无' }}</el-descriptions-item>
</el-descriptions>
<!-- 活动海报区域 -->
@@ -36,6 +50,7 @@
</div>
<!-- 主办方信息区域 -->
<!--
<el-divider content-position="left">主办方信息</el-divider>
<el-descriptions :column="3" border class="organizer-info-section custom-width-organizer">
<el-descriptions-item label="主办方名称" :label-style="{ width: '13%' }" :content-style="{ width: '35%' }">{{
@@ -48,8 +63,10 @@
activity.organizerPhone || '暂无'
}}</el-descriptions-item>
</el-descriptions>
-->
<!-- 承办方信息区域 -->
<!--
<el-divider content-position="left">承办方信息</el-divider>
<div v-if="coOrganizerList.length > 0">
<div v-for="(organizer, index) in coOrganizerList" :key="index" class="co-organizer-item custom-width-co-organizer">
@@ -67,8 +84,10 @@
</div>
</div>
<div v-else class="no-data">暂无承办方信息</div>
-->
<!-- 指导老师信息区域 -->
<!--
<el-divider content-position="left">指导老师信息</el-divider>
<div v-if="instructorList.length > 0">
<div v-for="(instructor, index) in instructorList" :key="index" class="instructor-item custom-width-instructor">
@@ -89,6 +108,7 @@
</div>
</div>
<div v-else class="no-data">暂无指导老师信息</div>
-->
</el-tab-pane>
<!-- 报名设置标签页 -->
@@ -260,6 +280,37 @@ const instructorList = computed<InstructorInfo[]>(() => {
}
});
// 获取关联部门名称列表
const getRelatedDeptNames = (activity: StglActivityVO | StglActivityVo): string[] => {
// 优先检查relatedDeptNames字段(多部门支持)
if ('relatedDeptNames' in activity && activity.relatedDeptNames) {
// 如果是数组类型,直接使用
if (Array.isArray(activity.relatedDeptNames)) {
return activity.relatedDeptNames.filter(name => name);
}
// 如果是字符串类型(逗号分隔),进行分割
const deptNamesStr = activity.relatedDeptNames as unknown as string;
if (typeof deptNamesStr === 'string' && deptNamesStr.includes(',')) {
return deptNamesStr.split(',').map(name => name.trim()).filter(name => name);
}
// 如果是单个字符串
if (typeof deptNamesStr === 'string' && deptNamesStr.trim()) {
return [deptNamesStr.trim()];
}
}
// 兼容旧的单部门字段
if (activity.relatedDeptName) {
if (activity.relatedDeptName.includes(',')) {
return activity.relatedDeptName.split(',').map(name => name.trim()).filter(name => name);
} else {
return [activity.relatedDeptName];
}
}
return [];
};
// 加载附件信息
const loadAttachments = async () => {
// 重置附件列表
@@ -568,6 +619,20 @@ onMounted(() => {
margin-bottom: 20px;
}
/* 部门列表显示样式 */
.dept-list {
display: flex;
flex-wrap: wrap;
gap: 6px;
align-items: center;
}
.dept-tag {
margin: 0;
font-size: 12px;
border-radius: 4px;
}
/* 附件显示区域样式 */
.attachment-list {
display: flex;
@@ -666,3 +731,4 @@ onMounted(() => {
}
}
</style>
+87 -5
View File
@@ -18,8 +18,8 @@
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="主办方" prop="organizerName">
<el-input v-model="queryParams.organizerName" placeholder="请输入主办方名称" clearable @keyup.enter="handleQuery" />
<el-form-item label="关联部门" prop="relatedDeptId">
<DeptSelector v-model="queryParams.relatedDept" @change="handleQueryRelatedDeptChange" />
</el-form-item>
</el-col>
<el-col :span="6">
@@ -61,7 +61,23 @@
<dict-tag :options="stgl_activity_type" :value="scope.row.activityType" />
</template>
</el-table-column>
<el-table-column label="主办方" align="center" prop="organizerName" min-width="150" show-overflow-tooltip />
<el-table-column label="关联部门" align="center" width="150" show-overflow-tooltip>
<template #default="scope">
<div v-if="getTableRelatedDeptNames(scope.row).length > 0" class="dept-list-table">
<el-tag
v-for="(deptName, index) in getTableRelatedDeptNames(scope.row)"
:key="index"
type="info"
size="small"
class="dept-tag-table"
:title="deptName"
>
{{ deptName }}
</el-tag>
</div>
<span v-else class="text-gray-400">未关联</span>
</template>
</el-table-column>
<el-table-column label="关联社团/队伍" align="center" min-width="150" show-overflow-tooltip>
<template #default="scope">
<span v-if="scope.row.relatedClubName">{{ scope.row.relatedClubName }}</span>
@@ -355,6 +371,7 @@ import type { StudentMsgForm } from '@/api/xg/xsjcxx/studentMsg/studentMsg/types
import { StudentVO } from '@/api/xg/student/types';
import { VicePresidentVO } from '@/components/VicePresidentManager/index.vue';
import { getUser } from '@/api/system/user';
import DeptSelector from '@/components/DeptSelector/index.vue';
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const { stgl_activity_type, stgl_registration_type, stgl_registration_status } = toRefs<any>(
@@ -387,7 +404,7 @@ const viewForm = ref<StglActivityVo>({} as StglActivityVo);
// 用户报名状态缓存
const userRegistrationStatus = ref<Record<number, boolean>>({});
const data = reactive<PageData<StglActivityRegistrationForm, StglActivityQuery>>({
const data = reactive<PageData<StglActivityRegistrationForm, StglActivityQuery & { relatedDept?: any | null }>>({
form: {
activityId: undefined,
registrationType: undefined,
@@ -399,7 +416,8 @@ const data = reactive<PageData<StglActivityRegistrationForm, StglActivityQuery>>
pageSize: 10,
activityName: undefined,
activityType: undefined,
organizerName: undefined,
relatedDeptId: undefined,
relatedDept: null,
registrationType: undefined,
params: {}
},
@@ -506,10 +524,20 @@ const handleQuery = () => {
/** 重置按钮操作 */
const resetQuery = () => {
// 重置关联部门对象
queryParams.value.relatedDept = null;
queryFormRef.value?.resetFields();
handleQuery();
};
/** 关联部门搜索条件变化 */
const handleQueryRelatedDeptChange = (dept: any | null) => {
queryParams.value.relatedDept = dept;
queryParams.value.relatedDeptId = dept?.deptId;
queryParams.value.pageNum = 1;
getList();
};
/** 查看按钮操作 */
const handleView = async (row: StglActivityVo) => {
const res = await getActivityDetail(row.id);
@@ -799,6 +827,37 @@ const formatDate = (dateStr: string): string => {
});
};
/** 获取活动关联部门名称列表 */
const getTableRelatedDeptNames = (activity: StglActivityVo): string[] => {
// 优先检查relatedDeptNames字段(多部门支持)
if (activity.relatedDeptNames) {
// 如果是数组类型,直接使用
if (Array.isArray(activity.relatedDeptNames)) {
return activity.relatedDeptNames.filter(name => name);
}
// 如果是字符串类型(逗号分隔),进行分割
const deptNamesStr = activity.relatedDeptNames as unknown as string;
if (typeof deptNamesStr === 'string' && deptNamesStr.includes(',')) {
return deptNamesStr.split(',').map(name => name.trim()).filter(name => name);
}
// 如果是单个字符串
if (typeof deptNamesStr === 'string' && deptNamesStr.trim()) {
return [deptNamesStr.trim()];
}
}
// 兼容旧的单部门字段
if (activity.relatedDeptName) {
if (activity.relatedDeptName.includes(',')) {
return activity.relatedDeptName.split(',').map(name => name.trim()).filter(name => name);
} else {
return [activity.relatedDeptName];
}
}
return [];
};
onMounted(() => {
getList();
});
@@ -856,4 +915,27 @@ onMounted(() => {
margin-bottom: 0 !important;
}
}
/* 部门标签样式 */
.dept-list-table {
display: flex;
flex-wrap: wrap;
gap: 4px 6px;
align-items: center;
justify-content: center;
width: 100%;
}
.dept-tag-table {
margin: 0;
font-size: 12px;
line-height: 1.3;
padding: 2px 6px;
border-radius: 2px;
white-space: nowrap;
overflow: visible;
text-overflow: unset;
flex-shrink: 0;
max-width: none;
}
</style>
+372 -65
View File
@@ -33,18 +33,23 @@
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="6">
<el-col :span="6" v-if="false">
<el-form-item label="主办方" prop="organizerName">
<el-input v-model="queryParams.organizerName" placeholder="请输入主办方名称" clearable @keyup.enter="handleQuery" />
</el-form-item>
</el-col>
<el-col :span="6">
<el-col :span="6" v-if="false">
<el-form-item label="是否已办" prop="isFinished">
<el-select v-model="queryParams.isFinished" placeholder="请选择是否已办" clearable style="width: 100%">
<el-option v-for="dict in sys_yes_no" :key="dict.value" :label="dict.label" :value="dict.value" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="关联部门" prop="relatedDeptId">
<DeptSelector v-model="queryParams.relatedDept" @change="handleQueryRelatedDeptChange" />
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="关联社团/队伍" prop="relatedClubId">
<ClubSelector v-model="queryParams.relatedClub" @change="handleQueryRelatedClubChange" />
@@ -78,11 +83,22 @@
</div>
</transition>
<el-card shadow="never" class="button-card table-card">
<template #header>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button type="primary" plain icon="Plus" @click="handleAdd" v-hasPermi="['stgl:activity:add']">新增</el-button>
<el-button
type="primary"
plain
icon="Plus"
@click="handleAdd"
:disabled="clubPermissionInfo && !clubPermissionInfo.canCreateActivity"
:loading="isLoadingPermission"
v-hasPermi="['stgl:activity:add']">
新增
</el-button>
</el-col>
<el-col
:span="1.5"
@@ -149,14 +165,31 @@
<dict-tag :options="stgl_activity_type" :value="scope.row.activityType" />
</template>
</el-table-column>
<el-table-column label="主办方" align="center" prop="organizerName" width="120" show-overflow-tooltip />
<el-table-column label="关联社团/队伍" align="center" width="120" show-overflow-tooltip>
<el-table-column label="主办方" align="center" prop="organizerName" width="120" show-overflow-tooltip v-if="false" />
<el-table-column label="关联部门" align="center" width="150" show-overflow-tooltip>
<template #default="scope">
<div v-if="getTableRelatedDeptNames(scope.row).length > 0" class="dept-list-table">
<el-tag
v-for="(deptName, index) in getTableRelatedDeptNames(scope.row)"
:key="index"
type="info"
size="small"
class="dept-tag-table"
:title="deptName"
>
{{ deptName }}
</el-tag>
</div>
<span v-else class="text-gray-400">未关联</span>
</template>
</el-table-column>
<el-table-column label="关联社团/队伍" align="center" width="180" show-overflow-tooltip>
<template #default="scope">
<span v-if="scope.row.relatedClubName">{{ scope.row.relatedClubName }}</span>
<span v-else class="text-gray-400">未关联</span>
</template>
</el-table-column>
<el-table-column label="指导老师" align="center" width="180" :show-overflow-tooltip="false">
<el-table-column label="指导老师" align="center" width="180" :show-overflow-tooltip="false" v-if="false">
<template #default="scope">
<div class="advisor-cell">
<span v-if="getAdvisorNames(scope.row).length === 0" class="no-advisor">暂无</span>
@@ -168,7 +201,7 @@
</div>
</template>
</el-table-column>
<el-table-column label="活动时间" align="center" width="160">
<el-table-column label="活动时间" align="center" width="140">
<template #default="scope">
<div v-if="scope.row.startTime && scope.row.endTime">
<div>{{ formatDate(scope.row.startTime) }}</div>
@@ -177,7 +210,7 @@
<span v-else class="text-gray-400">未设置</span>
</template>
</el-table-column>
<el-table-column label="报名时间" align="center" width="160">
<el-table-column label="报名时间" align="center" width="140">
<template #default="scope">
<div v-if="scope.row.registrationStart && scope.row.registrationEnd">
<div>{{ formatDate(scope.row.registrationStart) }}</div>
@@ -407,6 +440,15 @@
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="关联部门" prop="relatedDeptIds" required>
<MultiDeptSelector
v-model="form.relatedDepts"
@change="handleRelatedDeptsChange"
class="consistent-height-selector"
/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="关联社团/队伍" prop="relatedClubId">
<ClubSelector v-model="form.relatedClub" @change="handleRelatedClubChange" :disabled="isRelatedClubDisabled" />
@@ -421,6 +463,7 @@
</el-form-item>
<!-- 主办方信息 -->
<!--
<div class="section-divider">
<h4 class="section-title">主办方信息</h4>
</div>
@@ -443,14 +486,18 @@
</el-form-item>
</el-col>
</el-row>
-->
<!-- 承办方信息 -->
<!--
<div class="section-divider">
<h4 class="section-title">承办方信息</h4>
</div>
<CoOrganizerManager v-model="form.coOrganizerList" @change="handleCoOrganizersChange" />
-->
<!-- 指导老师信息 -->
<!--
<div class="section-divider">
<h4 class="section-title">指导老师信息</h4>
</div>
@@ -460,6 +507,7 @@
@change="handleAdvisorsChange"
:initial-advisors="form.advisors"
/>
-->
</el-tab-pane>
<el-tab-pane label="报名设置" name="registration">
@@ -640,7 +688,7 @@
</template>
<script setup name="StglActivity" lang="ts">
import { nextTick } from 'vue';
import { nextTick, watch } from 'vue';
import { useRoute, useRouter } from 'vue-router';
import { ElNotification } from 'element-plus';
import {
@@ -653,8 +701,10 @@ import {
copyStglActivity,
summarizeActivity
} from '@/api/stgl/activity';
import { StglActivityVO, StglActivityQuery, StglActivityForm, ClubOption, CoOrganizerInfo, InstructorInfo } from '@/api/stgl/activity/types';
import { StglActivityVO, StglActivityQuery, StglActivityForm, ClubOption, DeptOption, CoOrganizerInfo, InstructorInfo } from '@/api/stgl/activity/types';
import ClubSelector from '@/components/ClubSelector/index.vue';
import DeptSelector from '@/components/DeptSelector/index.vue';
import MultiDeptSelector from '@/components/DeptSelector/MultiDeptSelector.vue';
import CoOrganizerManager from '@/components/CoOrganizerManager/index.vue';
import InstructorManager from '@/components/InstructorManager/index.vue';
import AdvisorManager from '@/components/AdvisorManager/index.vue';
@@ -664,6 +714,7 @@ import ActivityMembersDialog from './components/ActivityMembersDialog.vue';
import ActivityRegistrationView from './components/ActivityRegistrationView.vue'; // Added import
import { AdvisorVO } from '@/components/AdvisorManager/index.vue';
import { useUserStore } from '@/store/modules/user';
import { checkClubActivityPermission, type ClubActivityPermissionResult } from '@/api/stgl/clubPermission';
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const route = useRoute();
@@ -693,6 +744,10 @@ const dateRange = ref<[string, string]>();
const selectedActivity = ref<StglActivityVO | null>(null);
const formKey = ref(0);
// 社团权限相关
const clubPermissionInfo = ref<ClubActivityPermissionResult | null>(null);
const isLoadingPermission = ref(false);
const queryFormRef = ref<ElFormInstance>();
const activityFormRef = ref<ElFormInstance>();
const copyFormRef = ref<ElFormInstance>();
@@ -756,6 +811,10 @@ const initFormData: StglActivityForm = {
location: undefined,
description: undefined,
posterUrl: undefined,
relatedDeptId: undefined,
relatedDeptIds: [],
relatedDept: null,
relatedDepts: null,
relatedClubId: undefined,
relatedType: undefined,
relatedClub: null,
@@ -768,7 +827,7 @@ const initFormData: StglActivityForm = {
instructorList: [],
instructors: '[]',
advisors: [],
registrationType: undefined,
registrationType: '1', // 默认为个人报名
registrationStart: undefined,
registrationEnd: undefined,
registrationStatus: undefined,
@@ -777,7 +836,7 @@ const initFormData: StglActivityForm = {
teamSizeMin: undefined,
teamSizeMax: undefined,
needApproval: 1,
activityRange: 1, // 默认为1-本组织成员
activityRange: 0, // 默认为无限制
activityStatus: '0',
isFinished: 0,
summary: undefined,
@@ -788,7 +847,7 @@ const initFormData: StglActivityForm = {
remark: undefined
};
const data = reactive<PageData<StglActivityForm, StglActivityQuery & { relatedClub?: ClubOption | null }>>({
const data = reactive<PageData<StglActivityForm, StglActivityQuery & { relatedClub?: ClubOption | null; relatedDept?: DeptOption | null }>>({
form: { ...initFormData },
queryParams: {
pageNum: 1,
@@ -799,6 +858,8 @@ const data = reactive<PageData<StglActivityForm, StglActivityQuery & { relatedCl
startTime: undefined,
endTime: undefined,
location: undefined,
relatedDeptId: undefined,
relatedDept: null,
relatedClubId: undefined,
relatedClub: null,
organizerName: undefined,
@@ -818,10 +879,23 @@ const data = reactive<PageData<StglActivityForm, StglActivityQuery & { relatedCl
activityType: [{ required: true, message: '请选择活动类型', trigger: 'change' }],
startTime: [{ required: true, message: '请选择活动开始时间', trigger: 'change' }],
endTime: [{ required: true, message: '请选择活动结束时间', trigger: 'change' }],
organizerName: [
{ required: true, message: '主办方名称不能为空', trigger: 'blur' },
{ min: 2, max: 50, message: '主办方名称长度在2到50个字符', trigger: 'blur' }
relatedDeptIds: [
{
required: true,
validator: (rule: any, value: any, callback: any) => {
if (!value || !Array.isArray(value) || value.length === 0) {
callback(new Error('请选择关联部门'));
} else {
callback();
}
},
trigger: 'change'
}
],
// organizerName: [
// { required: true, message: '主办方名称不能为空', trigger: 'blur' },
// { min: 2, max: 50, message: '主办方名称长度在2到50个字符', trigger: 'blur' }
// ],
registrationType: [{ required: true, message: '请选择报名方式', trigger: 'change' }],
activityRange: [{ required: true, message: '请选择报名范围', trigger: 'change' }]
}
@@ -845,11 +919,7 @@ const initUrlParams = () => {
uniqueKey: `1-${relatedClubId}`
};
console.log('初始化URL参数 - 社团过滤:', {
relatedClubId,
relatedClubName,
queryParams: queryParams.value.relatedClub
});
} else if (relatedTeamId && relatedTeamName && from === 'team') {
// 设置志愿者队伍查询参数
queryParams.value.relatedClubId = relatedTeamId as string | number;
@@ -860,11 +930,7 @@ const initUrlParams = () => {
uniqueKey: `2-${relatedTeamId}`
};
console.log('初始化URL参数 - 志愿者队伍过滤:', {
relatedTeamId,
relatedTeamName,
queryParams: queryParams.value.relatedClub
});
}
};
@@ -936,7 +1002,6 @@ const reset = () => {
form.value.advisors = [];
form.value.instructorList = [];
form.value.instructors = '[]';
// 重置关联社团禁用状态
isRelatedClubDisabled.value = false;
@@ -972,6 +1037,9 @@ const handleQuery = () => {
/** 重置按钮操作 */
const resetQuery = () => {
dateRange.value = undefined;
// 重置关联部门和关联社团对象
queryParams.value.relatedDept = null;
queryParams.value.relatedClub = null;
queryFormRef.value?.resetFields();
handleQuery();
};
@@ -984,8 +1052,57 @@ const handleSelectionChange = (selection: StglActivityVO[]) => {
selectedActivity.value = selection.length === 1 ? selection[0] : null;
};
/** 检查社团活动权限 */
const checkClubPermission = async (clubId: number | string) => {
if (!clubId) {
return null;
}
try {
isLoadingPermission.value = true;
const response = await checkClubActivityPermission(clubId);
clubPermissionInfo.value = response.data;
return response.data;
} catch (error) {
console.error('检查社团权限失败:', error);
proxy?.$modal.msgError('检查社团权限失败');
return null;
} finally {
isLoadingPermission.value = false;
}
};
/** 跳转到年审页面 */
const goToAnnualReview = () => {
if (queryParams.value.relatedClub?.relatedClubId) {
router.push({
path: '/stgl/club/info/annualReview',
query: { clubId: queryParams.value.relatedClub.relatedClubId }
});
}
};
/** 新增按钮操作 */
const handleAdd = () => {
const handleAdd = async () => {
// 如果有关联社团,先检查权限
if (queryParams.value.relatedClub?.relatedClubId && queryParams.value.relatedClub?.relatedType === 1) {
// 避免使用Number()导致的精度丢失,直接使用字符串形式的ID
const clubId = queryParams.value.relatedClub.relatedClubId;
const permission = await checkClubPermission(clubId);
if (permission && !permission.canCreateActivity) {
// 权限不足,显示提示信息
if (permission.status === 'TEMPORARILY_LIMITED') {
proxy?.$modal.msgError(`您的社团当前无法发起活动:${permission.message}`);
} else if (permission.status === 'PERMANENTLY_LIMITED') {
proxy?.$modal.msgError(`您的社团已被永久限制发起活动:${permission.message}`);
}
return; // 停止新增操作
}
}
// 权限检查通过,继续原有的新增逻辑
// 先重置表单
form.value = { ...initFormData };
activeTab.value = 'basic';
@@ -1061,11 +1178,51 @@ const handleUpdate = async (row?: StglActivityVO) => {
return;
}
console.log('handleUpdate - 获取的活动数据:', res.data);
console.log('handleUpdate - 附件字段:', {
summaryAttachments: res.data.summaryAttachments,
achievementsAttachments: res.data.achievementsAttachments
});
// 处理关联部门数据
if (res.data.relatedDeptIds && res.data.relatedDeptNames) {
// 优先使用新的多选部门字段
try {
const deptIds: number[] = JSON.parse(res.data.relatedDeptIds as unknown as string);
const deptNames: string[] = (res.data.relatedDeptNames as unknown as string).split(',').map(name => name.trim());
(res.data as any).relatedDepts = deptIds.map((deptId: number, index: number) => ({
deptId: deptId,
deptName: deptNames[index] || `部门${index + 1}`
}));
(res.data as any).relatedDeptIds = deptIds;
} catch (error) {
console.error('解析多选部门数据失败:', error);
// 降级到单选模式
if (res.data.relatedDeptId && res.data.relatedDeptName) {
(res.data as any).relatedDepts = [{
deptId: res.data.relatedDeptId,
deptName: res.data.relatedDeptName
}];
(res.data as any).relatedDeptIds = [res.data.relatedDeptId];
}
}
} else if (res.data.relatedDeptId && res.data.relatedDeptName) {
// 兼容旧的单选部门数据
(res.data as any).relatedDepts = [{
deptId: res.data.relatedDeptId,
deptName: res.data.relatedDeptName
}];
(res.data as any).relatedDeptIds = [res.data.relatedDeptId];
}
// 保持向后兼容
if (res.data.relatedDeptId && res.data.relatedDeptName) {
(res.data as any).relatedDept = {
deptId: res.data.relatedDeptId,
deptName: res.data.relatedDeptName
};
}
// 处理关联社团数据
if (res.data.relatedClubId && res.data.relatedClubName) {
@@ -1255,6 +1412,38 @@ const submitForm = () => {
submitData.activityStatus = '0';
}
// 处理关联部门数据
if (submitData.relatedDepts && submitData.relatedDepts.length > 0) {
// 多选部门:将ID列表转换为JSON格式字符串传递给后端
const deptIds = submitData.relatedDepts.map(dept => dept.deptId);
submitData.relatedDeptIds = JSON.stringify(deptIds);
// 将部门名称用逗号连接
submitData.relatedDeptNames = submitData.relatedDepts.map(dept => dept.deptName).join(',');
// 设置第一个部门作为主要关联部门(保持兼容性)
submitData.relatedDeptId = deptIds[0];
submitData.relatedDeptName = submitData.relatedDepts[0].deptName;
submitData.relatedDept = submitData.relatedDepts[0];
} else if (submitData.relatedDept) {
// 单选部门的情况(向后兼容)
submitData.relatedDeptId = submitData.relatedDept.deptId;
submitData.relatedDeptName = submitData.relatedDept.deptName;
// 单选时也设置多选字段
submitData.relatedDeptIds = JSON.stringify([submitData.relatedDept.deptId]);
submitData.relatedDeptNames = submitData.relatedDept.deptName;
} else {
// 清空关联部门数据
submitData.relatedDeptId = null;
submitData.relatedDeptName = null;
submitData.relatedDeptIds = null;
submitData.relatedDeptNames = null;
}
// 处理关联社团数据
if (submitData.relatedClub) {
submitData.relatedClubId = submitData.relatedClub.relatedClubId;
@@ -1265,12 +1454,7 @@ const submitForm = () => {
submitData.relatedType = null;
}
// 调试信息
console.log('提交的关联社团数据:', {
relatedClub: submitData.relatedClub,
relatedClubId: submitData.relatedClubId,
relatedType: submitData.relatedType
});
// 处理承办方数据
if (submitData.coOrganizerList && submitData.coOrganizerList.length > 0) {
@@ -1279,6 +1463,18 @@ const submitForm = () => {
submitData.coOrganizers = '[]'; // 修复:使用空JSON数组而不是undefined
}
// 处理主办方数据(由于前端已屏蔽主办方字段显示,设置默认值)
if (!submitData.organizerName) {
// 如果有关联部门,使用第一个部门名称作为主办方
if (submitData.relatedDepts && submitData.relatedDepts.length > 0) {
submitData.organizerName = submitData.relatedDepts[0].deptName;
} else if (submitData.relatedClub && submitData.relatedClub.relatedClubName) {
submitData.organizerName = submitData.relatedClub.relatedClubName;
} else {
submitData.organizerName = '学校'; // 默认主办方
}
}
// 处理指导老师数据
if (submitData.advisors && submitData.advisors.length > 0) {
submitData.instructors = JSON.stringify(submitData.advisors);
@@ -1355,11 +1551,6 @@ const handleDelete = async (row?: StglActivityVO) => {
/** 查看按钮操作 */
const handleView = async (row: StglActivityVO) => {
const res = await getStglActivity(row.id);
console.log('handleView - 获取的活动数据:', res.data);
console.log('handleView - 附件字段:', {
summaryAttachments: res.data.summaryAttachments,
achievementsAttachments: res.data.achievementsAttachments
});
viewForm.value = res.data;
viewDialog.visible = true;
viewDialog.title = '查看活动信息';
@@ -1414,12 +1605,6 @@ const handleSummary = async (row?: StglActivityVO) => {
const res = await getStglActivity(activity.id);
const fullActivity = res.data;
console.log('handleSummary - 完整活动数据:', fullActivity);
console.log('handleSummary - 附件字段:', {
summaryAttachments: fullActivity.summaryAttachments,
achievementsAttachments: fullActivity.achievementsAttachments
});
summaryForm.id = fullActivity.id;
summaryForm.activityName = fullActivity.activityName || '';
summaryForm.summary = fullActivity.summary || '';
@@ -1427,11 +1612,6 @@ const handleSummary = async (row?: StglActivityVO) => {
summaryForm.summaryAttachments = fullActivity.summaryAttachments || '';
summaryForm.achievementsAttachments = fullActivity.achievementsAttachments || '';
console.log('handleSummary - 设置到表单的数据:', {
summaryAttachments: summaryForm.summaryAttachments,
achievementsAttachments: summaryForm.achievementsAttachments
});
summaryDialog.visible = true;
};
@@ -1449,14 +1629,6 @@ const resetSummaryForm = () => {
const confirmSummary = async () => {
summaryLoading.value = true;
try {
console.log('confirmSummary - 提交的数据:', {
id: summaryForm.id,
summary: summaryForm.summary,
achievements: summaryForm.achievements,
summaryAttachments: summaryForm.summaryAttachments,
achievementsAttachments: summaryForm.achievementsAttachments
});
await summarizeActivity({
id: summaryForm.id!,
summary: summaryForm.summary,
@@ -1495,9 +1667,30 @@ const handleExport = async () => {
}
};
/** 关联部门变化处理 */
const handleRelatedDeptChange = (dept: DeptOption | null) => {
form.value.relatedDept = dept;
form.value.relatedDeptId = dept?.deptId;
};
/** 关联部门多选变化处理 */
const handleRelatedDeptsChange = (depts: DeptOption[] | null) => {
form.value.relatedDepts = depts;
if (depts && depts.length > 0) {
form.value.relatedDeptIds = depts.map(dept => dept.deptId);
// 将第一个部门设置为主要关联部门(兼容现有逻辑)
form.value.relatedDeptId = depts[0].deptId;
form.value.relatedDept = depts[0];
} else {
form.value.relatedDeptIds = [];
form.value.relatedDeptId = undefined;
form.value.relatedDept = null;
}
};
/** 关联社团变化处理 */
const handleRelatedClubChange = (club: ClubOption | null) => {
console.log('活动表单 - handleRelatedClubChange:', club);
form.value.relatedClub = club;
form.value.relatedClubId = club?.relatedClubId;
form.value.relatedType = club?.relatedType; // 修复:同时设置关联类型
@@ -1691,6 +1884,37 @@ const formatDate = (dateStr: string): string => {
});
};
/** 获取表格中关联部门名称列表 */
const getTableRelatedDeptNames = (activity: StglActivityVO): string[] => {
// 优先检查relatedDeptNames字段(多部门支持)
if (activity.relatedDeptNames) {
// 如果是数组类型,直接使用
if (Array.isArray(activity.relatedDeptNames)) {
return activity.relatedDeptNames.filter(name => name);
}
// 如果是字符串类型(逗号分隔),进行分割
const deptNamesStr = activity.relatedDeptNames as unknown as string;
if (typeof deptNamesStr === 'string' && deptNamesStr.includes(',')) {
return deptNamesStr.split(',').map(name => name.trim()).filter(name => name);
}
// 如果是单个字符串
if (typeof deptNamesStr === 'string' && deptNamesStr.trim()) {
return [deptNamesStr.trim()];
}
}
// 兼容旧的单部门字段
if (activity.relatedDeptName) {
if (activity.relatedDeptName.includes(',')) {
return activity.relatedDeptName.split(',').map(name => name.trim()).filter(name => name);
} else {
return [activity.relatedDeptName];
}
}
return [];
};
/** 获取指导老师姓名列表 */
const getAdvisorNames = (activity: StglActivityVO): string[] => {
// 优先从JSON字段读取指导老师数据
@@ -1705,7 +1929,6 @@ const getAdvisorNames = (activity: StglActivityVO): string[] => {
}
}
console.log('getAdvisorNames: 没有找到指导老师数据,activity:', activity);
return [];
};
@@ -1766,10 +1989,54 @@ const getOriginalActivityStatus = (activity: StglActivityVO | null): string => {
return activity.originalActivityStatus || activity.activityStatus || '';
};
// 监听活动开始时间变化,自动更新报名结束时间
watch(
() => form.value.startTime,
(newStartTime) => {
// 只有在新增或修改模式下,且有开始时间时才自动填充
if (newStartTime && dialog.visible) {
// 使用nextTick确保异步更新
nextTick(() => {
// 确保时间格式正确,保留完整的日期和时间信息
if (typeof newStartTime === 'string' && newStartTime.includes(':')) {
// 字符串格式且包含时间部分,直接赋值
form.value.registrationEnd = newStartTime;
} else if (typeof newStartTime === 'string') {
// 字符串格式但可能只有日期部分,添加默认时间
form.value.registrationEnd = newStartTime.includes(' ') ? newStartTime : `${newStartTime} 00:00:00`;
} else {
// 如果是Date对象或其他格式,转换为YYYY-MM-DD HH:mm:ss格式
const date = new Date(newStartTime);
if (!isNaN(date.getTime())) {
form.value.registrationEnd = date.toISOString().slice(0, 19).replace('T', ' ');
}
}
});
}
}
);
onMounted(() => {
initUrlParams();
getList();
// 如果有关联社团,检查权限
if (queryParams.value.relatedClub?.relatedClubId && queryParams.value.relatedClub?.relatedType === 1) {
checkClubPermission(Number(queryParams.value.relatedClub.relatedClubId));
}
});
// 监听路由查询参数变化,重新检查权限
watch(
() => queryParams.value.relatedClub,
(newRelatedClub) => {
if (newRelatedClub?.relatedClubId && newRelatedClub.relatedType === 1) {
checkClubPermission(Number(newRelatedClub.relatedClubId));
} else {
clubPermissionInfo.value = null;
}
},
{ deep: true }
);
</script>
<style scoped>
@@ -1848,6 +2115,29 @@ onMounted(() => {
font-weight: 500;
}
/* 部门列表表格样式 */
.dept-list-table {
display: flex;
flex-wrap: wrap;
gap: 4px 6px;
align-items: center;
justify-content: center;
width: 100%;
}
.dept-tag-table {
margin: 0;
font-size: 12px;
line-height: 1.3;
padding: 2px 6px;
border-radius: 2px;
white-space: nowrap;
overflow: visible;
text-overflow: unset;
flex-shrink: 0;
max-width: none;
}
/* 指导老师单元格样式 */
.advisor-cell {
padding: 4px 8px;
@@ -1884,4 +2174,21 @@ onMounted(() => {
border: 1px solid #dcdfe6;
}
}
/* 确保关联部门选择器与其他字段高度一致 */
.consistent-height-selector :deep(.el-select) {
height: 32px !important;
}
.consistent-height-selector :deep(.el-select .el-input__wrapper) {
min-height: 32px !important;
height: 32px !important;
}
.consistent-height-selector :deep(.el-select__tags) {
max-height: 28px !important;
overflow: hidden !important;
}
</style>
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,350 @@
<template>
<el-dialog
title="年审审批"
v-model="visible"
width="600px"
append-to-body
:before-close="handleClose"
>
<el-form ref="formRef" :model="form" :rules="rules" label-width="100px">
<el-form-item label="社团名称:">
<span>{{ auditInfo?.clubName || '加载中...' }}</span>
</el-form-item>
<el-form-item label="年审年度:">
<span>{{ auditInfo?.reviewYear || '加载中...' }}年</span>
</el-form-item>
<el-form-item label="审批节点:">
<span>{{ auditRecord?.nodeName || '加载中...' }}</span>
</el-form-item>
<el-form-item label="审批结果:" prop="approveResult">
<el-radio-group v-model="form.approveResult" @change="handleApproveResultChange">
<el-radio value="通过">通过</el-radio>
<el-radio value="不通过">不通过</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="审批意见:" prop="approveOpinion">
<el-input
v-model="form.approveOpinion"
type="textarea"
:rows="4"
placeholder="请填写审批意见"
maxlength="500"
show-word-limit
/>
</el-form-item>
</el-form>
<template #footer>
<div class="dialog-footer">
<el-button @click="handleClose">取消</el-button>
<el-button type="primary" @click="handleSubmit" :loading="loading">确定</el-button>
</div>
</template>
</el-dialog>
<!-- 审批流程选择对话框 -->
<ApprovalProcessDialog
v-model:visible="showApprovalProcessDialog"
:next-node-name="getNextNodeName()"
@confirm="handleApprovalProcessConfirm"
/>
</template>
<script setup lang="ts">
import { approveAnnualReview, getStglAnnualReviewAudit, getAnnualReviewAuditsByReviewId } from '@/api/stgl/club/annualReviewAudit';
import { getStglClubAnnualReview } from '@/api/stgl/club/annualReview';
import ApprovalProcessDialog from './auditorSelector/ApprovalProcessDialog.vue';
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const emit = defineEmits<{
success: [];
}>();
const visible = ref(false);
const loading = ref(false);
const formRef = ref<ElFormInstance>();
const form = ref({
auditId: '',
approveResult: '',
approveOpinion: ''
});
const auditInfo = ref<any>(null);
const auditRecord = ref<any>(null);
const allAuditRecords = ref<any[]>([]);
const showApprovalProcessDialog = ref(false);
const rules = reactive<ElFormRules>({
approveResult: [
{ required: true, message: '请选择审批结果', trigger: 'change' }
],
approveOpinion: [
{ required: true, message: '请填写审批意见', trigger: 'blur' },
{ max: 500, message: '审批意见不能超过500个字符', trigger: 'blur' }
]
});
/** 打开弹窗 */
const open = async (auditId: string | number, annualReviewId: string | number) => {
visible.value = true;
form.value.auditId = auditId.toString();
// 获取年审记录信息用于显示
try {
const res = await getStglClubAnnualReview(annualReviewId);
auditInfo.value = res.data;
} catch (error) {
console.error('获取年审记录信息失败:', error);
}
// 获取审批记录信息用于显示节点名称
try {
const auditRes = await getStglAnnualReviewAudit(auditId);
auditRecord.value = auditRes.data;
} catch (error) {
console.error('获取审批记录信息失败:', error);
}
// 获取当前年审的所有审批记录,用于判断是否是本环节最后一个节点
try {
const allAuditsRes = await getAnnualReviewAuditsByReviewId(annualReviewId);
allAuditRecords.value = allAuditsRes.data || [];
} catch (error) {
console.error('获取所有审批记录失败:', error);
}
// 重置表单
resetForm();
};
/** 重置表单 */
const resetForm = () => {
form.value.approveResult = '';
form.value.approveOpinion = '';
formRef.value?.clearValidate();
};
/** 审批结果变化处理 */
const handleApproveResultChange = (value: string) => {
// 审批结果变化时的处理逻辑(如需要)
};
/** 关闭弹窗 */
const handleClose = () => {
visible.value = false;
resetForm();
auditInfo.value = null;
auditRecord.value = null;
allAuditRecords.value = [];
};
/** 提交审批 */
const handleSubmit = async () => {
if (!formRef.value) return;
const valid = await formRef.value.validate();
if (!valid) return;
// 如果是校团委审批的最后一个节点,直接结束流程,不弹出审批流程选择对话框
if (form.value.approveResult === '通过' && isSchoolCommitteeLastNode()) {
console.log('校团委最后节点,直接结束流程');
await submitApproval();
return;
}
// 如果审批通过,且当前节点是本环节的最后一个节点,弹出审批流程选择对话框
if (form.value.approveResult === '通过' && isLastNodeInCurrentPhase()) {
showApprovalProcessDialog.value = true;
return;
}
// 直接提交审批(审批不通过或不是本环节最后一个节点的情况)
await submitApproval();
};
/** 判断当前节点是否是本环节的最后一个节点 */
const isLastNodeInCurrentPhase = () => {
if (!auditRecord.value || !allAuditRecords.value.length) {
console.log('判断是否是最后节点: 数据不足', {
hasAuditRecord: !!auditRecord.value,
allAuditRecordsLength: allAuditRecords.value.length
});
return false;
}
const currentNodeCode = auditRecord.value.nodeCode;
const currentNodeOrder = Number(auditRecord.value.nodeOrder);
console.log('当前审批记录详情:', {
currentNodeCode,
currentNodeOrder,
currentNodeOrderType: typeof auditRecord.value.nodeOrder,
currentNodeOrderRaw: auditRecord.value.nodeOrder,
auditRecordKeys: Object.keys(auditRecord.value)
});
// 获取同一环节的所有节点
const samePhaseNodes = allAuditRecords.value.filter(record =>
record.nodeCode === currentNodeCode
);
console.log('所有审批记录:', allAuditRecords.value.map(record => ({
id: record.id,
nodeCode: record.nodeCode,
nodeName: record.nodeName,
nodeOrder: record.nodeOrder,
nodeOrderType: typeof record.nodeOrder,
approverName: record.approverName,
nodeStatus: record.nodeStatus
})));
console.log('同环节节点:', samePhaseNodes.map(n => ({
nodeOrder: n.nodeOrder,
nodeOrderType: typeof n.nodeOrder,
approverName: n.approverName,
nodeStatus: n.nodeStatus
})));
if (samePhaseNodes.length === 0) {
console.log('警告: 没有找到同环节的节点');
return false;
}
// 找出同一环节中最大的nodeOrder,使用Number转换确保数值比较
const nodeOrders = samePhaseNodes.map(node => Number(node.nodeOrder));
const maxNodeOrder = Math.max(...nodeOrders);
console.log('判断是否是最后节点:', {
currentNodeCode,
currentNodeOrder,
maxNodeOrder,
nodeOrders,
isLast: currentNodeOrder === maxNodeOrder,
comparison: `${currentNodeOrder} === ${maxNodeOrder}`
});
// 当前节点的nodeOrder等于同环节最大nodeOrder时,表示是最后一个节点
return currentNodeOrder === maxNodeOrder;
};
/** 判断当前是否是校团委审批的最后一个节点 */
const isSchoolCommitteeLastNode = () => {
if (!auditRecord.value) {
return false;
}
const currentNodeName = auditRecord.value.nodeName;
const currentNodeOrder = Number(auditRecord.value.nodeOrder);
// 检查是否是校团委审批节点且node_order是3.X格式
const isSchoolCommitteeNode = currentNodeName === '校团委审批';
const isNodeOrder3X = currentNodeOrder >= 3 && currentNodeOrder < 4;
console.log('校团委最后节点判断:', {
currentNodeName,
currentNodeOrder,
isSchoolCommitteeNode,
isNodeOrder3X,
isLastInPhase: isLastNodeInCurrentPhase()
});
// 校团委审批 + node_order=3.X + 是本环节最后一个节点
return isSchoolCommitteeNode && isNodeOrder3X && isLastNodeInCurrentPhase();
};
/** 获取下一步节点名称 */
const getNextNodeName = () => {
// 根据当前节点确定下一步节点
const currentNodeName = auditRecord.value?.nodeName;
if (currentNodeName === '指导老师审批') {
return '二级学院审批';
} else if (currentNodeName === '二级学院审批') {
return '校团委审批';
} else if (currentNodeName === '校团委审批') {
return '完成审批';
}
// 默认返回二级学院审批
return '二级学院审批';
};
/** 实际提交审批 */
const submitApproval = async (approvalProcessData?: any) => {
loading.value = true;
try {
// 判断是否是校团委最后节点
const isSchoolCommitteeFinalNode = isSchoolCommitteeLastNode();
// 准备审批数据
const approveData = {
auditId: form.value.auditId,
approveResult: form.value.approveResult,
approveOpinion: form.value.approveOpinion,
// 校团委最后节点时不设置下一步审核人,表示流程结束
// 其他情况:只有审批通过且是本环节最后一个节点时,才包含下一步审核人信息
nextAuditors: isSchoolCommitteeFinalNode ? [] :
(form.value.approveResult === '通过' && isLastNodeInCurrentPhase()) ?
(approvalProcessData?.auditors || []).map((auditor: any) => ({
userId: auditor.userId,
userName: auditor.userName,
nickName: auditor.nickName
})) : []
};
console.log('提交审批数据:', {
审批结果: approveData.approveResult,
是否最后节点: isLastNodeInCurrentPhase(),
是否校团委最后节点: isSchoolCommitteeFinalNode,
下一步审核人数量: approveData.nextAuditors.length,
流程状态: isSchoolCommitteeFinalNode ? '流程结束' : '继续流转'
});
await approveAnnualReview(
approveData.auditId,
approveData.approveResult,
approveData.approveOpinion,
approveData.nextAuditors
);
if (isSchoolCommitteeFinalNode) {
proxy?.$modal.msgSuccess('审批成功,年审流程已完成!');
} else {
proxy?.$modal.msgSuccess('审批成功');
}
handleClose();
emit('success');
} catch (error) {
console.error('审批失败:', error);
} finally {
loading.value = false;
}
};
/** 审批流程确认处理 */
const handleApprovalProcessConfirm = async (approvalProcessData: any) => {
console.log('审批流程确认,数据:', approvalProcessData);
await submitApproval(approvalProcessData);
};
defineExpose({
open
});
</script>
<style scoped>
.dialog-footer {
text-align: right;
}
</style>
@@ -0,0 +1,384 @@
<template>
<el-dialog
title="选择审批流程"
v-model="visible"
width="70%"
append-to-body
destroy-on-close
:close-on-click-modal="false"
:close-on-press-escape="false"
>
<div class="approval-dialog-content">
<el-alert
:title="`请选择${props.nextNodeName}审核人`"
description="社团年审审批提交后将按照您选择的审批人员顺序进行审批,请仔细选择审核人员。"
type="info"
:closable="false"
show-icon
style="margin-bottom: 20px"
/>
<!-- 下一步审批节点提示 -->
<div class="next-node-info">
<div class="node-label">
<el-icon><Document /></el-icon>
下一步审批节点:{{ props.nextNodeName }}
</div>
</div>
<!-- 当前已选择的审核人显示 -->
<div class="current-auditors" v-if="currentAuditors.length > 0">
<div class="section-title">
<el-icon><User /></el-icon>
当前已选择的审核人 ({{ currentAuditors.length }} 人)
</div>
<div class="auditor-tags">
<el-tag
v-for="auditor in currentAuditors"
:key="auditor.userId"
type="info"
style="margin: 2px 5px 2px 0;"
>
{{ auditor.nickName }}({{ auditor.userName }})
</el-tag>
</div>
</div>
<!-- 审核人选择区域 -->
<div class="auditor-selection-section">
<div class="custom-process-config">
<el-form-item label="选择审核人" required>
<div class="auditor-selector">
<div class="selector-header">
<el-button type="primary" icon="Plus" @click="openAuditorSelector">添加审核人</el-button>
<el-text v-if="selectedAuditors.length > 0" type="info" size="small">
已选择 {{ selectedAuditors.length }} 个审核人,将按添加顺序进行审批
</el-text>
</div>
<!-- 已选择的审核人列表 -->
<div v-if="selectedAuditors.length > 0" class="selected-auditors">
<div class="auditor-flow">
<div v-for="(auditor, index) in selectedAuditors" :key="auditor.userId" class="auditor-node">
<div class="node-content">
<span class="node-index">{{ index + 1 }}</span>
<div class="auditor-info">
<div class="auditor-name">{{ auditor.nickName || auditor.userName }}</div>
<div class="auditor-dept">{{ auditor.deptName || '未知部门' }}</div>
</div>
<el-button type="danger" icon="Delete" size="small" circle @click="removeAuditor(auditor)" />
</div>
<div v-if="index < selectedAuditors.length - 1" class="flow-arrow">
<el-icon><ArrowRight /></el-icon>
</div>
</div>
</div>
<!-- 流程预览说明 -->
<div class="flow-description">
<el-alert type="info" :closable="false" show-icon>
<template #title>
<span>审批流程预览:{{ props.nextNodeName }}将按上述顺序进行逐级审批,每个节点审批通过后自动流转到下一节点</span>
</template>
</el-alert>
</div>
</div>
<!-- 空状态提示 -->
<div v-else class="empty-state">
<el-empty description="暂未选择审核人">
<el-button type="primary" @click="openAuditorSelector">选择审核人</el-button>
</el-empty>
</div>
</div>
</el-form-item>
</div>
</div>
</div>
<template #footer>
<div class="dialog-footer">
<el-button @click="handleCancel">取消</el-button>
<el-button
type="primary"
@click="handleConfirm"
:loading="submitting"
:disabled="selectedAuditors.length === 0"
>
<el-icon><Check /></el-icon>
确认提交 ({{ selectedAuditors.length }} 个审核人)
</el-button>
</div>
</template>
</el-dialog>
<!-- 审核人选择器 -->
<AuditorSelector
ref="auditorSelectorRef"
@confirm="handleAuditorsSelected"
/>
</template>
<script setup lang="ts">
import { ref, watch } from 'vue';
import { ElMessage } from 'element-plus';
import { Check, User, UserFilled, Document, Plus, ArrowRight, Delete } from '@element-plus/icons-vue';
import AuditorSelector from './index.vue';
interface Props {
visible: boolean;
currentAuditors?: any[]; // 当前已选择的审核人
nextNodeName?: string; // 下一步审批节点名称
}
interface Emits {
(e: 'update:visible', value: boolean): void;
(e: 'confirm', approvalData: any): void;
}
const props = withDefaults(defineProps<Props>(), {
currentAuditors: () => [],
nextNodeName: '二级学院审批'
});
const emit = defineEmits<Emits>();
const visible = ref(props.visible);
const submitting = ref(false);
const selectedAuditors = ref<any[]>([]);
const currentAuditors = ref<any[]>([]);
const auditorSelectorRef = ref<InstanceType<typeof AuditorSelector>>();
// 监听visible变化
watch(() => props.visible, (newVal) => {
visible.value = newVal;
if (newVal) {
// 初始化当前审核人和选择的审核人
currentAuditors.value = [...(props.currentAuditors || [])];
selectedAuditors.value = [...(props.currentAuditors || [])];
}
});
// 监听内部visible变化
watch(visible, (newVal) => {
emit('update:visible', newVal);
});
// 打开审核人选择器
const openAuditorSelector = () => {
auditorSelectorRef.value?.open(selectedAuditors.value);
};
// 审核人选择确认
const handleAuditorsSelected = (auditors: any[]) => {
selectedAuditors.value = [...auditors];
};
// 移除审核人
const removeAuditor = (auditor: any) => {
const index = selectedAuditors.value.findIndex(item => item.userId === auditor.userId);
if (index > -1) {
selectedAuditors.value.splice(index, 1);
}
};
// 取消操作
const handleCancel = () => {
visible.value = false;
ElMessage.info('已取消提交');
};
// 确认提交
const handleConfirm = async () => {
try {
if (selectedAuditors.value.length === 0) {
ElMessage.warning('请至少选择一个审核人');
return;
}
submitting.value = true;
// 构建审批流程数据
const approvalData = {
auditorIds: selectedAuditors.value.map(auditor => auditor.userId),
processName: '年审审批流程',
auditors: selectedAuditors.value
};
console.log('确认审批流程,数据:', approvalData);
// 触发确认事件
emit('confirm', approvalData);
visible.value = false;
ElMessage.success('审批流程配置成功');
} catch (error) {
console.error('确认审批流程失败:', error);
ElMessage.error('确认审批流程失败');
} finally {
submitting.value = false;
}
};
// 暴露方法供父组件调用
defineExpose({
open: (preSelectedAuditors?: any[]) => {
visible.value = true;
currentAuditors.value = [...(preSelectedAuditors || [])];
selectedAuditors.value = [...(preSelectedAuditors || [])];
}
});
</script>
<style scoped>
.approval-dialog-content {
max-height: 500px;
}
.dialog-footer {
display: flex;
justify-content: space-between;
align-items: center;
}
.next-node-info {
margin-bottom: 20px;
padding: 12px 16px;
background-color: #f0f9ff;
border: 1px solid #d1ecf1;
border-radius: 6px;
}
.node-label {
display: flex;
align-items: center;
gap: 8px;
font-weight: 500;
color: #0c63e4;
font-size: 14px;
}
.current-auditors {
margin-bottom: 20px;
padding: 15px;
border: 1px solid #e4e7ed;
border-radius: 6px;
background-color: #fafafa;
}
.section-title {
display: flex;
align-items: center;
margin-bottom: 10px;
font-weight: 500;
color: #303133;
gap: 8px;
}
.auditor-tags {
display: flex;
flex-wrap: wrap;
gap: 5px;
}
.auditor-selection-section {
margin-bottom: 20px;
}
.custom-process-config {
padding: 24px;
border: 1px solid #e4e7ed;
border-radius: 8px;
background-color: #fafbfc;
}
.auditor-selector {
width: 100%;
}
.selector-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 20px;
}
.selected-auditors {
margin-top: 20px;
}
.auditor-flow {
display: flex;
flex-wrap: wrap;
align-items: center;
gap: 16px;
margin-bottom: 16px;
}
.auditor-node {
display: flex;
align-items: center;
gap: 12px;
}
.node-content {
display: flex;
align-items: center;
gap: 12px;
padding: 12px 16px;
background: white;
border: 1px solid #e4e7ed;
border-radius: 6px;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}
.node-index {
display: flex;
align-items: center;
justify-content: center;
width: 24px;
height: 24px;
background: #409eff;
color: white;
border-radius: 50%;
font-size: 12px;
font-weight: 600;
}
.auditor-info {
flex: 1;
}
.auditor-name {
font-size: 14px;
font-weight: 600;
color: #2c3e50;
margin-bottom: 2px;
}
.auditor-dept {
font-size: 12px;
color: #909399;
}
.flow-arrow {
display: flex;
align-items: center;
color: #409eff;
font-size: 16px;
}
.flow-description {
margin-top: 16px;
}
.empty-state {
text-align: center;
padding: 40px 20px;
}
</style>
@@ -0,0 +1,396 @@
<template>
<div class="auditor-selector">
<el-dialog
v-model="visible"
title="选择审核人"
width="900px"
append-to-body
:before-close="handleClose"
>
<div class="auditor-select-content">
<!-- 搜索区域 -->
<div class="search-section" style="margin-bottom: 20px !important;">
<el-input v-model="searchKeyword" placeholder="搜索审核人姓名或部门" clearable @input="handleSearch" style="width: 300px">
<template #prefix>
<el-icon><Search /></el-icon>
</template>
</el-input>
</div>
<!-- 审核人表格 -->
<el-table
ref="auditorTableRef"
:data="tableData"
@selection-change="handleSelectionChange"
max-height="400"
empty-text="暂无可用审核人"
style="margin-top: 20px !important;"
>
<el-table-column type="selection" width="55" :selectable="isSelectable" header-align="center" align="center" />
<el-table-column label="序号" type="index" width="60" header-align="center" align="center" />
<el-table-column label="姓名" prop="nickName" width="130" header-align="center" align="center" />
<el-table-column label="部门" prop="deptName" header-align="center" align="center" />
<el-table-column label="联系电话" prop="phoneNumber" width="130" header-align="center" />
<el-table-column label="邮箱" prop="email" show-overflow-tooltip header-align="center" />
<el-table-column label="状态" prop="status" width="80" header-align="center" align="center">
<template #default="scope">
<el-tag :type="scope.row.status === '1' ? 'success' : 'danger'" size="small">
{{ scope.row.status === '1' ? '正常' : '停用' }}
</el-tag>
</template>
</el-table-column>
</el-table>
</div>
<template #footer>
<div
class="dialog-footer"
style="display: flex !important; justify-content: space-between !important; align-items: center !important; width: 100% !important; margin: 0 !important;"
>
<span class="selected-count-text" style="color: #909399; font-size: 12px;"> 已选择 {{ selectedUsers.length }} 个审核人 </span>
<div class="footer-buttons" style="display: flex !important; gap: 12px !important;">
<el-button @click="handleClose">取消</el-button>
<el-button type="primary" @click="handleConfirm" :disabled="selectedUsers.length === 0"> 确定添加 </el-button>
</div>
</div>
</template>
</el-dialog>
</div>
</template>
<script setup lang="ts">
import { ref, watch, onMounted, nextTick, computed, getCurrentInstance } from 'vue';
import type { ComponentInternalInstance } from 'vue';
import { ElMessage, ElMessageBox, ElTable } from 'element-plus';
import { Search } from '@element-plus/icons-vue';
import { listStglAuditor } from '@/api/stgl/auditor';
import { listDept } from '@/api/system/dept';
import { StglAuditorVO, StglAuditorQuery } from '@/api/stgl/auditor/types';
import { DeptVO } from '@/api/system/dept/types';
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const { sys_normal_disable } = proxy?.useDict('sys_normal_disable') || {};
const auditorTableRef = ref();
const emit = defineEmits<{
confirm: [users: StglAuditorVO[]];
}>();
// 响应式数据
const visible = ref(false);
const loading = ref(false);
const userList = ref<StglAuditorVO[]>([]);
const filteredUserList = ref<StglAuditorVO[]>([]);
const selectedUsers = ref<StglAuditorVO[]>([]);
const total = ref(0);
const deptOptions = ref<any[]>([]);
const searchKeyword = ref('');
// 计算表格数据
const tableData = computed(() => {
// 确保返回的数组总是有效的
if (searchKeyword.value && filteredUserList.value) {
return filteredUserList.value;
}
return userList.value || [];
});
// 查询参数
const queryParams = ref<StglAuditorQuery>({
pageNum: 1,
pageSize: 500, // 增加页面大小以显示所有审核人
nickName: '',
userName: '',
deptId: undefined,
status: '1' // 只查询正常状态的审核人
});
// 初始查询参数的备份,用于重置
const defaultQuery: StglAuditorQuery = {
pageNum: 1,
pageSize: 500, // 增加页面大小以显示所有审核人
nickName: '',
userName: '',
deptId: undefined,
status: '1'
};
/** 打开选择器 */
const open = (preSelected: StglAuditorVO[] = []) => {
visible.value = true;
selectedUsers.value = [...preSelected];
// 重置搜索状态
searchKeyword.value = '';
filteredUserList.value = [];
getDeptTree();
getList();
};
/** 获取部门树 */
const getDeptTree = async () => {
try {
const response = await listDept();
deptOptions.value = handleTree(response.data, 'id', 'parentId');
} catch (error) {
console.error('获取部门树失败:', error);
}
};
/** 获取审核人列表 */
const getList = async () => {
loading.value = true;
try {
const response = await listStglAuditor(queryParams.value);
userList.value = response.rows;
filteredUserList.value = response.rows;
total.value = response.total;
// 如果有搜索关键词,执行搜索
if (searchKeyword.value) {
handleSearch();
}
// 设置表格选中状态
nextTick(() => {
setTableSelection();
});
} catch (error) {
console.error('获取审核人列表失败:', error);
userList.value = [];
filteredUserList.value = [];
total.value = 0;
} finally {
loading.value = false;
}
};
/** 设置表格选中状态 */
const setTableSelection = () => {
if (!auditorTableRef.value) return;
tableData.value.forEach(user => {
const isSelected = selectedUsers.value.some(selected =>
selected.userId === user.userId
);
auditorTableRef.value.toggleRowSelection(user, isSelected);
});
};
/** 判断行是否可选 */
const isSelectable = (row: StglAuditorVO) => {
return row.status === '1'; // 只有正常状态的审核人可选
};
/** 表格选择变化 */
const handleSelectionChange = (selection: StglAuditorVO[]) => {
// 处理当前显示数据的选择
const currentPageUserIds = tableData.value.map(user => user.userId);
// 移除当前页原有的选择
selectedUsers.value = selectedUsers.value.filter(user =>
!currentPageUserIds.includes(user.userId)
);
// 添加当前页新的选择
selectedUsers.value.push(...selection);
};
/** 移除选中审核人 */
const removeUser = (user: StglAuditorVO) => {
selectedUsers.value = selectedUsers.value.filter(selected =>
selected.userId !== user.userId
);
// 如果当前页包含该用户,需要取消表格选中
if (auditorTableRef.value) {
const currentUser = tableData.value.find(u => u.userId === user.userId);
if (currentUser) {
auditorTableRef.value.toggleRowSelection(currentUser, false);
}
}
};
/** 清空所有选择 */
const clearSelected = () => {
selectedUsers.value = [];
if (auditorTableRef.value) {
auditorTableRef.value.clearSelection();
}
};
/** 搜索处理 */
const handleSearch = () => {
if (!searchKeyword.value) {
filteredUserList.value = userList.value;
return;
}
const keyword = searchKeyword.value.toLowerCase();
filteredUserList.value = userList.value.filter(
(user) =>
(user.nickName && user.nickName.toLowerCase().includes(keyword)) ||
(user.userName && user.userName.toLowerCase().includes(keyword)) ||
(user.deptName && user.deptName.toLowerCase().includes(keyword))
);
};
/** 搜索 */
const handleQuery = () => {
queryParams.value.pageNum = 1;
getList();
};
/** 重置搜索 */
const resetQuery = () => {
Object.assign(queryParams.value, defaultQuery);
handleQuery();
};
/** 关闭弹窗 */
const handleClose = () => {
visible.value = false;
selectedUsers.value = [];
userList.value = [];
filteredUserList.value = [];
searchKeyword.value = '';
Object.assign(queryParams.value, defaultQuery);
};
/** 确认选择 */
const handleConfirm = () => {
emit('confirm', selectedUsers.value);
visible.value = false;
};
/** 处理树形数据 */
const handleTree = (data: any[], id: string, parentId: string, children = 'children') => {
const config = { id, parentId, children };
const childrenListMap: any = {};
const nodeIds: any = {};
const tree = [];
for (const d of data) {
const parentIdValue = d[config.parentId];
if (childrenListMap[parentIdValue] == null) {
childrenListMap[parentIdValue] = [];
}
nodeIds[d[config.id]] = d;
childrenListMap[parentIdValue].push(d);
}
for (const d of data) {
const parentIdValue = d[config.parentId];
if (nodeIds[parentIdValue] == null) {
tree.push(d);
}
}
for (const t of tree) {
adaptToChildrenArray(t);
}
function adaptToChildrenArray(o: any) {
if (childrenListMap[o[config.id]] !== null) {
o[config.children] = childrenListMap[o[config.id]];
}
if (o[config.children]) {
for (const c of o[config.children]) {
adaptToChildrenArray(c);
}
}
}
return tree.map(item => ({
id: item.id,
label: item.deptName,
children: item.children ? item.children.map((child: any) => convertToTreeNode(child)) : []
}));
};
const convertToTreeNode = (item: any): any => ({
id: item.id,
label: item.deptName,
children: item.children ? item.children.map((child: any) => convertToTreeNode(child)) : []
});
defineExpose({
open
});
</script>
<style scoped>
.auditor-selector {
.auditor-select-content {
max-height: 500px;
}
.search-section {
margin-top: 20px !important;
margin-bottom: 20px !important;
}
:deep(.el-table) {
margin-top: 20px !important;
}
.dialog-footer {
display: flex !important;
justify-content: space-between !important;
align-items: center !important;
width: 100%;
}
.footer-buttons {
display: flex;
gap: 12px;
}
}
/* Element Plus Dialog Footer 样式覆盖 - 使用最高优先级的选择器 */
.auditor-selector :deep(.el-dialog__footer) {
padding: 15px 20px !important;
text-align: left !important;
display: block !important;
}
.auditor-selector :deep(.el-dialog__footer .dialog-footer) {
display: flex !important;
justify-content: space-between !important;
align-items: center !important;
width: 100% !important;
margin: 0 !important;
padding: 0 !important;
box-sizing: border-box !important;
}
/* 确保按钮容器样式正确 */
.auditor-selector .dialog-footer .footer-buttons {
display: flex !important;
gap: 12px !important;
margin-left: auto !important;
flex-shrink: 0 !important;
}
/* 确保文本不会撑开容器 */
.auditor-selector .dialog-footer .selected-count-text {
flex-shrink: 0 !important;
white-space: nowrap !important;
}
/* 确保搜索框和表格间距的全局样式 */
.auditor-selector .auditor-select-content .search-section {
margin-bottom: 20px !important;
}
.auditor-selector .auditor-select-content .el-table {
margin-top: 20px !important;
}
</style>
@@ -0,0 +1,711 @@
<template>
<div class="annual-review-detail">
<div v-loading="loading">
<div v-if="annualReview">
<el-form ref="formRef" :model="annualReview" label-width="120px">
<!-- 年审表头信息 -->
<div class="form-header">
<h3 class="form-title">杭州第一技师学院社团资格年审表</h3>
<div class="year-range">{{ yearRange }} 年</div>
<div class="review-date">年审时间:{{ reviewDate }}</div>
</div>
<!-- 基本信息区域 -->
<div class="form-section">
<h4 class="section-title">基本信息</h4>
<div class="basic-info-table">
<!-- 第一行:社团名称 | 成立时间 -->
<div class="info-row">
<div class="info-item">
<div class="info-label">社团名称</div>
<div class="info-value">{{ annualReview.clubName }}</div>
</div>
<div class="info-item">
<div class="info-label">成立时间</div>
<div class="info-value">{{ parseTime(annualReview.establishDate, '{y}-{m}-{d}') }}</div>
</div>
</div>
<!-- 第二行:指导部门 | 社团类别 -->
<div class="info-row">
<div class="info-item">
<div class="info-label">指导部门</div>
<div class="info-value">{{ annualReview.advisorDept }}</div>
</div>
<div class="info-item">
<div class="info-label">社团类别</div>
<div class="info-value">
<dict-tag :options="stgl_club_type" :value="annualReview.clubType" />
</div>
</div>
</div>
<!-- 第三行:指导老师 | 成员 -->
<div class="info-row">
<div class="info-item">
<div class="info-label">指导老师</div>
<div class="info-value">{{ annualReview.advisorName }}</div>
</div>
<div class="info-item">
<div class="info-label">成员</div>
<div class="info-value">{{ memberCountText }}</div>
</div>
</div>
<!-- 第四行:有无章程 | 社团金额 -->
<div class="info-row">
<div class="info-item">
<div class="info-label">有无章程</div>
<div class="info-value">
<span v-if="annualReview.hasCharter === 'Y'" class="charter-status">
有
<div class="charter-info">
<file-upload
v-model="annualReview.charterUrl"
:disabled="true"
:is-show-tip="false"
:limit="1"
:file-type="['pdf', 'doc', 'docx']"
:file-size="10"
/>
</div>
</span>
<span v-else class="charter-status">无</span>
</div>
</div>
<div class="info-item">
<div class="info-label">社团金额</div>
<div class="info-value">
<span v-if="annualReview.hasFunds === 'Y'">
有
<span v-if="annualReview.fundAmount" style="margin-left: 10px;">
{{ annualReview.fundAmount }}元
</span>
</span>
<span v-else>无</span>
</div>
</div>
</div>
</div>
</div>
<!-- 社团主要成员 -->
<div class="form-section">
<h4 class="section-title">社团主要成员</h4>
<el-table :data="memberList" border style="width: 100%" max-height="300" class="member-table">
<el-table-column label="姓名" prop="name" width="100" align="center" header-align="center" />
<el-table-column label="班级" prop="className" min-width="140" align="center" header-align="center" />
<el-table-column label="社团职务" prop="role" width="100" align="center" header-align="center" />
<el-table-column label="联系方式" prop="phone" min-width="130" align="center" header-align="center" />
</el-table>
</div>
<!-- 年度活动开展情况 -->
<div class="form-section">
<h4 class="section-title">年度活动开展情况</h4>
<el-table :data="activityList" border style="width: 100%" max-height="300" class="activity-table">
<el-table-column label="时间" width="200" align="center" header-align="center">
<template #default="{ row }">
<div class="activity-time-display">
{{ row.activityTimeDisplay }}
</div>
</template>
</el-table-column>
<el-table-column label="地点" prop="location" width="150" align="center" header-align="center" />
<el-table-column label="活动名称" prop="activityName" min-width="200" align="center" header-align="center" />
<el-table-column label="参加人数" prop="participantCount" width="100" align="center" header-align="center" />
</el-table>
</div>
<!-- 审批意见 -->
<div class="form-section">
<h4 class="section-title">审批意见</h4>
<!-- 指导老师意见 -->
<div class="opinion-section">
<div class="opinion-title">指导老师意见</div>
<div v-if="advisorAudits.length > 0" class="audit-records">
<div v-for="audit in advisorAudits" :key="audit.id" class="audit-record">
<div class="audit-header">
<span class="approver-name">{{ audit.approverName }}</span>
<span class="audit-status" :class="getAuditStatusClass(audit.nodeStatus)">
{{ getAuditStatusText(audit.nodeStatus) }}
</span>
<span v-if="audit.approveTime" class="audit-time">
{{ parseTime(audit.approveTime, '{y}-{m}-{d} {h}:{i}:{s}') }}
</span>
</div>
<div v-if="audit.approveOpinion" class="audit-opinion">
{{ audit.approveOpinion }}
</div>
<div v-else class="audit-opinion pending">
待审批
</div>
</div>
</div>
<div v-else class="opinion-content">
暂无审批记录
</div>
<div class="opinion-signature">签名(公章)</div>
</div>
<!-- 二级学院意见 -->
<div class="opinion-section">
<div class="opinion-title">二级学院意见</div>
<div v-if="collegeAudits.length > 0" class="audit-records">
<div v-for="audit in collegeAudits" :key="audit.id" class="audit-record">
<div class="audit-header">
<span class="approver-name">{{ audit.approverName }}</span>
<span class="audit-status" :class="getAuditStatusClass(audit.nodeStatus)">
{{ getAuditStatusText(audit.nodeStatus) }}
</span>
<span v-if="audit.approveTime" class="audit-time">
{{ parseTime(audit.approveTime, '{y}-{m}-{d} {h}:{i}:{s}') }}
</span>
</div>
<div v-if="audit.approveOpinion" class="audit-opinion">
{{ audit.approveOpinion }}
</div>
<div v-else class="audit-opinion pending">
待审批
</div>
</div>
</div>
<div v-else class="opinion-content">
暂无审批记录
</div>
<div class="opinion-signature">签名(公章)</div>
</div>
<!-- 校团委意见 -->
<div class="opinion-section">
<div class="opinion-title">校团委意见</div>
<div v-if="youthLeagueAudits.length > 0" class="audit-records">
<div v-for="audit in youthLeagueAudits" :key="audit.id" class="audit-record">
<div class="audit-header">
<span class="approver-name">{{ audit.approverName }}</span>
<span class="audit-status" :class="getAuditStatusClass(audit.nodeStatus)">
{{ getAuditStatusText(audit.nodeStatus) }}
</span>
<span v-if="audit.approveTime" class="audit-time">
{{ parseTime(audit.approveTime, '{y}-{m}-{d} {h}:{i}:{s}') }}
</span>
</div>
<div v-if="audit.approveOpinion" class="audit-opinion">
{{ audit.approveOpinion }}
</div>
<div v-else class="audit-opinion pending">
待审批
</div>
</div>
</div>
<div v-else class="opinion-content">
暂无审批记录
</div>
<div class="opinion-signature">签名(公章)</div>
</div>
</div>
</el-form>
</div>
<el-empty v-else description="暂无数据" />
</div>
</div>
</template>
<script setup lang="ts">
import { getStglClubAnnualReview, getAnnualReviewActivities } from '@/api/stgl/club/annualReview';
import { getAnnualReviewAuditsByReviewId } from '@/api/stgl/club/annualReviewAudit';
import { StglClubAnnualReviewVO } from '@/api/stgl/club/annualReview/type';
import { StglAnnualReviewAuditVO } from '@/api/stgl/club/annualReviewAudit/type';
// 扩展的年审VO接口(包含JSON字段)
interface ExtendedAnnualReviewVO extends StglClubAnnualReviewVO {
membersJson?: string;
activitiesJson?: string;
}
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const { stgl_club_type } = toRefs(proxy?.useDict('stgl_club_type') as any);
const props = defineProps<{
annualReviewId: string | number;
}>();
const loading = ref(false);
const annualReview = ref<ExtendedAnnualReviewVO>();
// 成员列表
const memberList = ref<any[]>([]);
// 活动列表
const activityList = ref<any[]>([]);
// 审批记录列表
const auditList = ref<StglAnnualReviewAuditVO[]>([]);
// 年份范围计算
const yearRange = computed(() => {
if (annualReview.value?.reviewYear) {
const currentYear = annualReview.value.reviewYear;
const lastYear = currentYear - 1;
return `${lastYear}-${currentYear}`;
}
return '';
});
// 年审日期
const reviewDate = computed(() => {
if (annualReview.value?.reviewTime) {
const date = new Date(annualReview.value.reviewTime);
const year = date.getFullYear();
const month = String(date.getMonth() + 1).padStart(2, '0');
const day = String(date.getDate()).padStart(2, '0');
return `${year}年${month}月${day}日`;
}
return '';
});
// 成员数量文本
const memberCountText = computed(() => {
return `${annualReview.value?.memberCount || 0}人`;
});
// 指导老师审批记录
const advisorAudits = computed(() => {
return auditList.value.filter(audit => audit.nodeCode === 'advisor_approve');
});
// 二级学院审批记录
const collegeAudits = computed(() => {
return auditList.value.filter(audit => audit.nodeCode === 'college_approve');
});
// 校团委审批记录
const youthLeagueAudits = computed(() => {
return auditList.value.filter(audit => audit.nodeCode === 'youth_league_approve');
});
/** 获取审批状态样式类 */
const getAuditStatusClass = (status: string) => {
const statusClasses: { [key: string]: string } = {
'pending': 'status-pending',
'waiting': 'status-waiting',
'approved': 'status-approved'
};
return statusClasses[status] || '';
};
/** 获取审批状态文本 */
const getAuditStatusText = (status: string) => {
const statusTexts: { [key: string]: string } = {
'pending': '待审批',
'waiting': '等待中',
'approved': '已审批'
};
return statusTexts[status] || status;
};
/** 格式化活动时间显示 */
const formatActivityTime = (startTime: string, endTime?: string): string => {
if (!startTime) return '';
try {
// 处理标准格式 (如: "2024-09-05 14:30:00" 或 "2024-09-05")
const parseTimeString = (timeStr: string): Date | null => {
if (!timeStr) return null;
if (timeStr.match(/^\d{4}-\d{2}-\d{2}/)) {
const date = new Date(timeStr);
return isNaN(date.getTime()) ? null : date;
}
const date = new Date(timeStr);
return isNaN(date.getTime()) ? null : date;
};
const startDate = parseTimeString(startTime);
const endDate = endTime ? parseTimeString(endTime) : null;
if (!startDate) {
return startTime;
}
// 格式化为完整的日期时间(保留00:00:00)
const formatDateTime = (date: Date): string => {
const year = date.getFullYear();
const month = String(date.getMonth() + 1).padStart(2, '0');
const day = String(date.getDate()).padStart(2, '0');
const hours = String(date.getHours()).padStart(2, '0');
const minutes = String(date.getMinutes()).padStart(2, '0');
const seconds = String(date.getSeconds()).padStart(2, '0');
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
};
const formattedStartTime = formatDateTime(startDate);
if (!endDate || startDate.getTime() === endDate.getTime()) {
return formattedStartTime;
}
const formattedEndTime = formatDateTime(endDate);
// 检查是否是同一天
const isSameDay = startDate.toDateString() === endDate.toDateString();
if (isSameDay) {
// 同一天的情况,分行显示:日期在上,时间范围在下
const dateStr = formattedStartTime.split(' ')[0];
const startTimeStr = formattedStartTime.split(' ')[1];
const endTimeStr = formattedEndTime.split(' ')[1];
return `${dateStr}\n${startTimeStr}-${endTimeStr}`;
}
// 不同天的情况,分行显示完整时间
return `${formattedStartTime}\n${formattedEndTime}`;
} catch (error) {
console.warn('格式化活动时间失败:', error, '原始数据:', startTime);
return startTime;
}
};
/** 获取年审记录详情 */
const getDetail = async () => {
if (!props.annualReviewId) return;
loading.value = true;
try {
const res = await getStglClubAnnualReview(props.annualReviewId);
annualReview.value = res.data;
// 检查数据是否存在
if (!annualReview.value) {
console.warn('年审记录数据为空');
memberList.value = [];
activityList.value = [];
return;
}
// 解析成员JSON数据
if (annualReview.value.membersJson) {
try {
memberList.value = JSON.parse(annualReview.value.membersJson);
} catch (error) {
console.warn('解析成员JSON数据失败:', error);
memberList.value = [];
}
} else {
memberList.value = [];
}
// 获取审批记录
try {
const auditRes = await getAnnualReviewAuditsByReviewId(props.annualReviewId);
if (auditRes && auditRes.data && Array.isArray(auditRes.data)) {
auditList.value = auditRes.data;
} else {
auditList.value = [];
}
} catch (error) {
console.warn('获取审批记录失败:', error);
auditList.value = [];
}
// 从stgl_club_annual_review_activity表中获取年审记录对应的活动数据
try {
const activitiesRes = await getAnnualReviewActivities(props.annualReviewId);
// 检查活动数据是否存在
if (activitiesRes && activitiesRes.data && Array.isArray(activitiesRes.data)) {
// 处理活动数据
activityList.value = activitiesRes.data.map((activity: any) => {
// 使用后端 VO 中的标准字段名
const activityStartTime = activity.activityStartTime || activity.startTime;
const activityEndTime = activity.activityEndTime || activity.endTime;
// 生成显示用的时间格式
let timeDisplay = '';
if (activityStartTime || activityEndTime) {
timeDisplay = formatActivityTime(activityStartTime, activityEndTime);
}
return {
activityStartTime: activityStartTime,
activityEndTime: activityEndTime,
activityTimeDisplay: timeDisplay || '时间未知',
location: activity.location || activity.activityLocation || '',
activityName: activity.activityName || '',
participantCount: activity.participantCount || 0
};
});
} else {
console.warn('活动数据为空或格式不正确:', activitiesRes);
activityList.value = [];
}
} catch (error) {
console.warn('获取年审活动数据失败:', error);
activityList.value = [];
}
} catch (error) {
console.error('获取详情失败:', error);
} finally {
loading.value = false;
}
};
watch(
() => props.annualReviewId,
() => {
getDetail();
},
{ immediate: true }
);
</script>
<style scoped>
.annual-review-detail {
padding: 20px;
max-height: 80vh;
overflow-y: auto;
}
.form-header {
text-align: center;
margin-bottom: 30px;
padding: 20px;
border: 2px solid #409eff;
border-radius: 8px;
background: #fafafa;
}
.form-title {
margin: 0 0 15px 0;
font-size: 24px;
font-weight: bold;
color: #303133;
}
.year-range {
font-size: 18px;
font-weight: bold;
margin-bottom: 10px;
color: #606266;
}
.review-date {
font-size: 14px;
color: #909399;
text-align: right;
}
.form-section {
margin-bottom: 30px;
padding: 20px;
border: 1px solid #e4e7ed;
border-radius: 8px;
background: #fff;
}
.section-title {
margin: 0 0 20px 0;
padding-bottom: 10px;
font-size: 16px;
font-weight: bold;
color: #303133;
border-bottom: 2px solid #409eff;
}
.basic-info-table {
border: 1px solid #e4e7ed;
border-radius: 4px;
overflow: hidden;
}
.info-row {
display: flex;
border-bottom: 1px solid #e4e7ed;
}
.info-row:last-child {
border-bottom: none;
}
.info-item {
flex: 1;
display: flex;
border-right: 1px solid #e4e7ed;
}
.info-item:last-child {
border-right: none;
}
.info-label {
width: 100px;
min-width: 100px;
padding: 12px 15px;
background-color: #f5f7fa;
border-right: 1px solid #e4e7ed;
font-weight: 500;
color: #303133;
font-size: 14px;
display: flex;
align-items: center;
}
.info-value {
flex: 1;
padding: 12px 15px;
background-color: #fff;
color: #606266;
font-size: 14px;
display: flex;
align-items: center;
min-height: 44px;
}
.charter-status {
font-size: 14px;
color: #606266;
font-weight: 400;
display: flex;
flex-direction: column;
align-items: flex-start;
}
.charter-info {
margin-top: 5px;
margin-left: 0;
}
.opinion-section {
margin-bottom: 20px;
padding: 15px;
border: 1px solid #e4e7ed;
border-radius: 4px;
background: #fafafa;
}
.opinion-title {
font-weight: bold;
margin-bottom: 10px;
color: #303133;
}
.opinion-content {
min-height: 60px;
padding: 10px;
border: 1px solid #e4e7ed;
border-radius: 4px;
background: #fff;
margin-bottom: 10px;
line-height: 1.6;
}
.opinion-signature {
text-align: right;
color: #606266;
font-size: 14px;
}
:deep(.el-table) {
margin-bottom: 10px;
}
:deep(.el-table th) {
background-color: #f5f7fa;
color: #303133;
font-weight: bold;
}
:deep(.el-descriptions__label) {
font-weight: bold;
color: #303133;
}
:deep(.el-descriptions__content) {
color: #606266;
}
.activity-time-display {
white-space: pre-line;
line-height: 1.4;
font-size: 13px;
}
/* 审批记录样式 */
.audit-records {
margin-bottom: 10px;
}
.audit-record {
margin-bottom: 15px;
padding: 12px;
border: 1px solid #e4e7ed;
border-radius: 4px;
background: #fafafa;
}
.audit-record:last-child {
margin-bottom: 0;
}
.audit-header {
display: flex;
align-items: center;
margin-bottom: 8px;
font-size: 14px;
}
.approver-name {
font-weight: bold;
color: #303133;
margin-right: 15px;
}
.audit-status {
padding: 2px 8px;
border-radius: 4px;
font-size: 12px;
margin-right: 15px;
}
.status-pending {
background: #fdf6ec;
color: #e6a23c;
border: 1px solid #f5dab1;
}
.status-waiting {
background: #f4f4f5;
color: #909399;
border: 1px solid #d3d4d6;
}
.status-approved {
background: #f0f9ff;
color: #67c23a;
border: 1px solid #b3d8ff;
}
.audit-time {
color: #909399;
font-size: 12px;
margin-left: auto;
}
.audit-opinion {
line-height: 1.6;
color: #606266;
background: #fff;
padding: 8px;
border-radius: 4px;
border: 1px solid #e4e7ed;
}
.audit-opinion.pending {
color: #909399;
font-style: italic;
}
</style>
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,593 @@
<template>
<div class="p-2 page-container">
<transition :enter-active-class="proxy?.animate.searchAnimate.enter" :leave-active-class="proxy?.animate.searchAnimate.leave">
<div v-show="showSearch" class="mb-[10px]">
<el-card shadow="hover">
<el-form ref="queryFormRef" :model="queryParams" label-width="100px">
<el-row :gutter="20">
<el-col :span="6">
<el-form-item label="社团名称" prop="clubName">
<el-input v-model="queryParams.clubName" placeholder="请输入社团名称" clearable @keyup.enter="handleQuery" />
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="年审年度" prop="reviewYear">
<el-select v-model="queryParams.reviewYear" placeholder="请选择年审年度" clearable style="width: 100%">
<el-option v-for="year in yearOptions" :key="year" :label="year + '年'" :value="year" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="状态" prop="status">
<el-select v-model="queryParams.status" placeholder="请选择状态" clearable style="width: 100%">
<el-option v-for="option in statusOptions" :key="option.value" :label="option.label" :value="option.value" />
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="24" class="search-btn-container">
<el-form-item>
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
<el-button icon="Refresh" @click="resetQuery">重置</el-button>
</el-form-item>
</el-col>
</el-row>
</el-form>
</el-card>
</div>
</transition>
<el-card shadow="never" class="button-card table-card">
<template #header>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button type="primary" plain icon="Plus" @click="handleAdd" v-hasPermi="['stgl:clubAnnualReview:add']">新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button icon="Edit" :disabled="single" @click="handleUpdate()" v-hasPermi="['stgl:clubAnnualReview:edit']">修改</el-button>
</el-col>
<el-col :span="1.5">
<el-button icon="Delete" :disabled="multiple" @click="handleDelete()" v-hasPermi="['stgl:clubAnnualReview:remove']">删除</el-button>
</el-col>
<el-col :span="1.5">
<el-button type="warning" icon="Download" @click="handleExport" v-hasPermi="['stgl:clubAnnualReview:export']">导出</el-button>
</el-col>
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
</template>
<el-table v-loading="loading" border :data="annualReviewList" :key="tableKey" @selection-change="handleSelectionChange" @row-dblclick="handleView">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="社团名称" align="center" prop="clubName" min-width="150" />
<el-table-column label="成立日期" align="center" prop="establishDate" width="120">
<template #default="scope">
<span>{{ parseTime(scope.row.establishDate, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
<el-table-column label="社长" align="center" prop="presidentName" width="100" />
<el-table-column label="年审年度" align="center" prop="reviewYear" width="100" />
<el-table-column label="社团类型" align="center" prop="clubType" width="100">
<template #default="scope">
<dict-tag :options="stgl_club_type" :value="scope.row.clubType" />
</template>
</el-table-column>
<el-table-column label="指导老师" align="center" prop="advisorName" width="100" />
<el-table-column label="成员数量" align="center" prop="memberCount" width="100" />
<el-table-column label="资金数额" align="center" prop="fundAmount" width="120">
<template #default="scope">
<span v-if="scope.row.fundAmount">{{ scope.row.fundAmount }}元</span>
<span v-else>-</span>
</template>
</el-table-column>
<el-table-column label="状态" align="center" prop="status" width="120">
<template #default="scope">
<el-tag :type="getStatusTagType(scope.row.status) as any">{{ getStatusText(scope.row.status) }}</el-tag>
</template>
</el-table-column>
<el-table-column label="年审时间" align="center" prop="createTime" width="180">
<template #default="scope">
<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="200" fixed="right">
<template #default="scope">
<el-tooltip content="查看" placement="top">
<el-button link type="primary" icon="View" @click="handleView(scope.row)" v-hasPermi="['stgl:clubAnnualReview:query']"></el-button>
</el-tooltip>
<el-tooltip content="编辑" placement="top" v-if="scope.row.status === '0'">
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['stgl:clubAnnualReview:edit']"></el-button>
</el-tooltip>
<el-tooltip content="提交" placement="top" v-if="scope.row.status === '0'">
<el-button link type="success" icon="Check" @click="handleSubmit(scope.row)" v-hasPermi="['stgl:clubAnnualReview:submit']"></el-button>
</el-tooltip>
<el-tooltip content="撤回" placement="top" v-if="scope.row.status === '1'">
<el-button link type="warning" icon="RefreshLeft" @click="handleWithdraw(scope.row)" v-hasPermi="['stgl:clubAnnualReview:withdraw']"></el-button>
</el-tooltip>
<el-tooltip content="审批" placement="top" v-if="(scope.row.status === '1' || scope.row.status === '2') && canApprove(scope.row)">
<el-button link type="success" icon="Check" @click="handleApprove(scope.row)" v-hasPermi="['stgl:annualReviewAudit:approve']"></el-button>
</el-tooltip>
<el-tooltip content="删除" placement="top" v-if="scope.row.status === '0' || scope.row.status === '4'">
<el-button link type="danger" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['stgl:clubAnnualReview:remove']"></el-button>
</el-tooltip>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total > 0"
:total="total"
v-model:page="queryParams.pageNum"
v-model:limit="queryParams.pageSize"
@pagination="getList"
/>
</el-card>
<!-- 添加或修改社团年审记录对话框 -->
<el-dialog :title="dialog.title" v-model="dialog.visible" width="1000px" append-to-body>
<annual-review-form ref="annualReviewFormRef" @success="handleFormSuccess" />
</el-dialog>
<!-- 查看社团年审记录对话框 -->
<el-dialog title="年审记录详情" v-model="detailDialog.visible" width="1000px" append-to-body>
<annual-review-detail :annual-review-id="detailDialog.annualReviewId" />
</el-dialog>
<!-- 审批对话框 -->
<approve-dialog ref="approveDialogRef" @success="handleApproveSuccess" />
</div>
</template>
<script setup name="StglClubAnnualReview" lang="ts">
import { ref, reactive, toRefs, nextTick, onMounted, getCurrentInstance } from 'vue';
import type { ComponentInternalInstance } from 'vue';
import { useRoute } from 'vue-router';
import {
listStglClubAnnualReview,
getStglClubAnnualReview,
delStglClubAnnualReview,
submitStglClubAnnualReview,
withdrawStglClubAnnualReview,
exportStglClubAnnualReview
} from '@/api/stgl/club/annualReview';
import { StglClubAnnualReviewVO, StglClubAnnualReviewQuery, ANNUAL_REVIEW_STATUS_OPTIONS } from '@/api/stgl/club/annualReview/type';
import { getPendingAuditsByApproverId } from '@/api/stgl/club/annualReviewAudit';
import { StglAnnualReviewAuditVO } from '@/api/stgl/club/annualReviewAudit/type';
import { useUserStore } from '@/store/modules/user';
import AnnualReviewForm from './form.vue';
import AnnualReviewDetail from './detail.vue';
import ApproveDialog from './approveDialog.vue';
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const route = useRoute();
const userStore = useUserStore();
const { stgl_club_type } = toRefs(proxy?.useDict('stgl_club_type') as any);
const annualReviewList = ref<StglClubAnnualReviewVO[]>([]);
const loading = ref(true);
const showSearch = ref(true);
const ids = ref<Array<string | number>>([]);
const single = ref(true);
const multiple = ref(true);
const total = ref(0);
const tableKey = ref(0); // 用于强制重新渲染表格
// 审批权限相关状态
const pendingAudits = ref<StglAnnualReviewAuditVO[]>([]);
const pendingAuditsLoading = ref(false);
const pendingAuditsCache = ref<Map<number, boolean>>(new Map());
const queryFormRef = ref<ElFormInstance>();
const annualReviewFormRef = ref<InstanceType<typeof AnnualReviewForm>>();
const approveDialogRef = ref<InstanceType<typeof ApproveDialog>>();
// 状态选项
const statusOptions = ref(ANNUAL_REVIEW_STATUS_OPTIONS);
// 年份选项(最近10年)
const yearOptions = ref<number[]>([]);
const initYearOptions = () => {
const currentYear = new Date().getFullYear();
for (let i = 0; i < 10; i++) {
yearOptions.value.push(currentYear - i);
}
};
const data = reactive<{
queryParams: StglClubAnnualReviewQuery;
dialog: DialogOption;
detailDialog: {
visible: boolean;
annualReviewId: string | number;
};
}>({
queryParams: {
pageNum: 1,
pageSize: 10,
clubName: undefined,
reviewYear: undefined,
status: undefined
},
dialog: {
visible: false,
title: ''
},
detailDialog: {
visible: false,
annualReviewId: ''
}
});
// 初始化查询参数(处理从社团管理页面传递的参数)
const initQueryParams = () => {
if (route.query.clubName) {
queryParams.value.clubName = route.query.clubName as string;
}
if (route.query.clubId) {
// 如果有具体的社团ID,我们可以根据需要进行筛选
// 这里暂时使用社团名称进行筛选
}
};
const { queryParams, dialog, detailDialog } = toRefs(data);
/** 查询社团年审记录列表 */
const getList = async () => {
loading.value = true;
try {
// 并行加载年审记录和待审批记录
const [annualReviewRes] = await Promise.all([
listStglClubAnnualReview(queryParams.value),
loadPendingAudits()
]);
// 确保数据更新
if (annualReviewRes && annualReviewRes.rows) {
annualReviewList.value = annualReviewRes.rows;
total.value = annualReviewRes.total;
} else {
console.warn('获取的年审记录数据格式异常:', annualReviewRes);
annualReviewList.value = [];
total.value = 0;
}
// 强制触发 Vue 的响应式更新
nextTick(() => {
console.log('年审记录列表已更新,记录数:', annualReviewList.value.length);
});
} catch (error) {
console.error('加载数据失败:', error);
proxy?.$modal.msgError('加载数据失败');
// 重置数据
annualReviewList.value = [];
total.value = 0;
} finally {
loading.value = false;
}
};
/** 搜索按钮操作 */
const handleQuery = () => {
queryParams.value.pageNum = 1;
getList();
};
/** 重置按钮操作 */
const resetQuery = () => {
queryFormRef.value?.resetFields();
handleQuery();
};
/** 多选框选中数据 */
const handleSelectionChange = (selection: StglClubAnnualReviewVO[]) => {
ids.value = selection.map((item) => item.id);
single.value = selection.length !== 1;
multiple.value = !selection.length;
};
/** 新增按钮操作 */
const handleAdd = () => {
dialog.value = {
visible: true,
title: '添加社团年审记录'
};
nextTick(async () => {
await annualReviewFormRef.value?.resetForm();
// 如果从社团管理页面跳转过来,自动设置社团信息
if (route.query.clubId) {
annualReviewFormRef.value?.setClubId(route.query.clubId as string);
}
});
};
/** 修改按钮操作 */
const handleUpdate = async (row?: StglClubAnnualReviewVO) => {
const annualReviewId = row?.id || ids.value[0];
const res = await getStglClubAnnualReview(annualReviewId);
dialog.value = {
visible: true,
title: '修改社团年审记录'
};
nextTick(async () => {
await annualReviewFormRef.value?.resetForm(res.data);
});
};
/** 查看按钮操作 */
const handleView = (row: StglClubAnnualReviewVO) => {
detailDialog.value = {
visible: true,
annualReviewId: row.id
};
};
/** 提交按钮操作 */
const handleSubmit = async (row: StglClubAnnualReviewVO) => {
try {
await proxy?.$modal.confirm(`是否确认提交年审记录"${row.clubName}"?`);
// 调用提交接口
await submitStglClubAnnualReview(row.id);
// API调用成功后,立即更新本地状态,避免被getList覆盖
await updateRowStatus(row.id, '1');
proxy?.$modal.msgSuccess('提交成功');
// 延迟重新获取数据,确保状态已经在界面上显示
setTimeout(async () => {
await getList();
}, 100);
} catch (error) {
console.error('提交失败:', error);
// 提交失败时才需要恢复状态,因为我们现在是先调用API再更新状态
}
};
/** 撤回按钮操作 */
const handleWithdraw = async (row: StglClubAnnualReviewVO) => {
try {
await proxy?.$modal.confirm(`是否确认撤回年审记录"${row.clubName}"?`);
// 调用撤回接口
await withdrawStglClubAnnualReview(row.id);
// API调用成功后,立即更新本地状态,避免被getList覆盖
await updateRowStatus(row.id, '0');
proxy?.$modal.msgSuccess('撤回成功');
// 延迟重新获取数据,确保状态已经在界面上显示
setTimeout(async () => {
await Promise.all([
getList(),
loadPendingAudits()
]);
}, 100);
} catch (error) {
console.error('撤回失败:', error);
// 撤回失败时才需要恢复状态,因为我们现在是先调用API再更新状态
}
};
/** 删除按钮操作 */
const handleDelete = async (row?: StglClubAnnualReviewVO) => {
const annualReviewIds = row?.id || ids.value;
try {
await proxy?.$modal.confirm('是否确认删除所选的社团年审记录?');
await delStglClubAnnualReview(annualReviewIds);
await getList();
proxy?.$modal.msgSuccess('删除成功');
} catch {}
};
/** 导出按钮操作 */
const handleExport = async () => {
try {
const res = await exportStglClubAnnualReview(queryParams.value);
proxy?.$download.excel(res, `annual_review_${new Date().getTime()}.xlsx`);
} catch (error) {
proxy?.$modal.msgError('导出失败');
}
};
/** 表单提交成功回调 */
const handleFormSuccess = () => {
dialog.value.visible = false;
getList();
};
/** 更新行状态的工具函数 */
const updateRowStatus = async (rowId: string | number, newStatus: string) => {
const rowIndex = annualReviewList.value.findIndex(item => item.id === rowId);
if (rowIndex !== -1) {
// 创建新对象确保Vue能检测到变化
const updatedRow = {
...annualReviewList.value[rowIndex],
status: newStatus
};
// 使用splice替换整个对象,触发响应式更新
annualReviewList.value.splice(rowIndex, 1, updatedRow);
// 强制触发DOM更新和表格重新渲染
tableKey.value++;
await nextTick();
console.log(`状态已同步更新: ${updatedRow.status}`);
console.log('当前数组状态:', annualReviewList.value.map(item => ({ id: item.id, status: item.status, clubName: item.clubName })));
return updatedRow;
}
return null;
};
/** 获取状态标签类型 */
const getStatusTagType = (status: string) => {
const tagTypes: { [key: string]: string } = {
'0': 'info',
'1': 'warning',
'2': '',
'3': 'success',
'4': 'danger'
};
return tagTypes[status] || '';
};
/** 获取状态文本 */
const getStatusText = (status: string) => {
// 本地状态映射,确保显示正确
const statusMap: { [key: string]: string } = {
'0': '草稿',
'1': '已提交',
'2': '审核中',
'3': '审核通过',
'4': '审核不通过'
};
// 优先使用本地映射
if (statusMap[status]) {
const result = statusMap[status];
console.log(`getStatusText: 状态=${status}, 返回文本="${result}"`);
return result;
}
// fallback到原来的逻辑
const option = statusOptions.value.find(item => item.value === status);
const result = option?.label || status;
console.log(`getStatusText: 状态=${status}, fallback返回="${result}"`);
return result;
};
/** 获取当前用户的待审批记录 */
const loadPendingAudits = async () => {
if (!userStore.userId || pendingAuditsLoading.value) {
return;
}
try {
pendingAuditsLoading.value = true;
const response = await getPendingAuditsByApproverId(userStore.userId);
// 处理响应数据,确保 data 是数组
// 后端返回的是 R<List<StglAnnualReviewAudit>>,R.data 可能为 null 或 []
let data = [];
if (response && response.data !== undefined) {
// 如果response.data存在但为null,使用空数组
data = response.data || [];
} else if (response && response.rows !== undefined) {
// 有些API返回格式可能是分页格式
data = response.rows || [];
}
pendingAudits.value = data;
// 更新缓存
pendingAuditsCache.value.clear();
if (Array.isArray(data)) {
data.forEach((audit: StglAnnualReviewAuditVO) => {
if (audit.annualReviewId) {
pendingAuditsCache.value.set(Number(audit.annualReviewId), true);
}
});
}
} catch (error) {
console.error('获取待审批记录失败:', error);
// 重置数据
pendingAudits.value = [];
pendingAuditsCache.value.clear();
// 不显示错误提示,避免影响页面正常使用
} finally {
pendingAuditsLoading.value = false;
}
};
/** 判断当前用户是否可以审批该年审记录 */
const canApprove = (row: StglClubAnnualReviewVO) => {
// 检查当前用户是否登录
if (!userStore.userId) {
console.log('canApprove: 用户未登录');
return false;
}
// 检查年审记录状态,支持"已提交"和"审核中"状态
if (row.status !== '1' && row.status !== '2') {
console.log(`canApprove: 状态不符合 ${row.status}`);
return false;
}
// 检查缓存中是否有该年审记录的审批权限
const hasPermission = pendingAuditsCache.value.has(Number(row.id));
console.log(`canApprove: 年审ID=${row.id}, 当前用户=${userStore.userId}, 缓存权限=${hasPermission}, 缓存内容=`, Array.from(pendingAuditsCache.value.keys()));
return hasPermission;
};
/** 审批按钮操作 */
const handleApprove = async (row: StglClubAnnualReviewVO) => {
// 从待审批记录中找到对应的审批ID
const audit = pendingAudits.value.find(audit =>
Number(audit.annualReviewId) === Number(row.id)
);
if (!audit) {
proxy?.$modal.msgError('未找到对应的审批记录');
return;
}
approveDialogRef.value?.open(audit.id, row.id);
};
/** 审批成功回调 */
const handleApproveSuccess = async () => {
// 审批完成后,需要同时刷新年审记录和待审批记录
await Promise.all([
getList(),
loadPendingAudits()
]);
};
onMounted(() => {
initYearOptions();
initQueryParams();
getList();
});
</script>
<style scoped>
/* 页面容器样式 */
.page-container {
padding: 8px;
background-color: #f5f5f5;
}
/* 表格卡片布局 */
.table-card {
margin-top: 0;
border-radius: 12px;
border: 1px solid #e4e7ed;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}
.table-card :deep(.el-card__body) {
padding: 0px 20px 20px 20px !important;
}
/* 移除按钮栏底部边框 */
.button-card :deep(.el-card__header) {
border-bottom: none !important;
background: linear-gradient(135deg, #fafbff 0%, #f8fafc 100%);
padding: 16px 20px;
}
/* 搜索按钮容器样式 */
.search-btn-container {
display: flex;
justify-content: flex-end;
margin-top: 10px;
.el-form-item {
margin-bottom: 0 !important;
}
}
</style>
@@ -100,7 +100,7 @@
<el-table-column label="班级" align="center" prop="className" width="120" />
<el-table-column label="成员角色" align="center" prop="roleType" width="100">
<template #default="scope">
<span v-if="scope.row.roleType">{{ scope.row.roleType }}</span>
<dict-tag :options="stgl_role_type" :value="scope.row.roleType" v-if="scope.row.roleType" />
<span v-else>-</span>
</template>
</el-table-column>
@@ -199,7 +199,9 @@
</el-col>
<el-col :span="12">
<el-form-item label="成员角色" prop="roleType">
<el-input v-model="form.roleType" placeholder="请输入成员角色" />
<el-select v-model="form.roleType" placeholder="请选择成员角色">
<el-option v-for="dict in stgl_role_type" :key="dict.value" :label="dict.label" :value="dict.value" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
@@ -236,7 +238,8 @@
<el-descriptions-item label="联系方式">{{ viewForm.phone }}</el-descriptions-item>
<el-descriptions-item label="邮箱">{{ viewForm.email }}</el-descriptions-item>
<el-descriptions-item label="成员角色">
{{ viewForm.roleType || '-' }}
<dict-tag :options="stgl_role_type" :value="viewForm.roleType" v-if="viewForm.roleType" />
<span v-else>-</span>
</el-descriptions-item>
<el-descriptions-item label="状态">
<dict-tag :options="stgl_member_status" :value="viewForm.status" />
@@ -321,7 +324,7 @@ interface Props {
const props = defineProps<Props>();
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const { sys_user_sex, stgl_member_status } = toRefs<any>(proxy?.useDict('sys_user_sex', 'stgl_member_status'));
const { sys_user_sex, stgl_member_status, stgl_role_type } = toRefs<any>(proxy?.useDict('sys_user_sex', 'stgl_member_status', 'stgl_role_type'));
const memberList = ref<StglMemberVO[]>([]);
const buttonLoading = ref(false);
+132 -107
View File
@@ -58,6 +58,26 @@
>转让</el-button
>
</el-col>
<el-col :span="1.5">
<el-button
type="info"
icon="UserFilled"
:disabled="single"
@click="handleAdvisorHistoryFromToolbar()"
v-hasPermi="['stgl:club:query']"
>指导老师</el-button
>
</el-col>
<el-col :span="1.5">
<el-button
type="success"
icon="Document"
:disabled="single"
@click="handleAnnualReview()"
v-hasPermi="['stgl:clubAnnualReview:list']"
>年审管理</el-button
>
</el-col>
<el-col :span="1.5">
<el-button icon="Delete" :disabled="multiple" @click="handleDelete()" v-hasPermi="['stgl:club:remove']">删除</el-button>
</el-col>
@@ -125,7 +145,7 @@
<div class="description-cell">{{ scope.row.description }}</div>
</template>
</el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="280" fixed="right">
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="240" fixed="right">
<template #default="scope">
<el-tooltip content="查看" placement="top">
<el-button
@@ -160,17 +180,18 @@
v-hasPermi="['stgl:clubmember:list']"
></el-button>
</el-tooltip>
<el-tooltip content="活动管理" placement="top">
<el-button
link
type="success"
icon="Calendar"
size="default"
style="font-size: 16px; margin-right: 8px"
@click="handleActivityManagement(scope.row)"
v-hasPermi="['stgl:activity:list']"
></el-button>
</el-tooltip>
<el-tooltip content="活动管理" placement="top">
<el-button
link
type="success"
icon="Calendar"
size="default"
style="font-size: 16px; margin-right: 8px"
@click="handleActivityManagement(scope.row)"
v-hasPermi="['stgl:activity:list']"
></el-button>
</el-tooltip>
<el-tooltip content="转让" placement="top">
<el-button
link
@@ -315,7 +336,12 @@
<!-- 指导老师信息 -->
<div class="personnel-section">
<h4 class="section-title">指导老师信息</h4>
<AdvisorManager v-model="form.advisors" @change="handleAdvisorsChange" :disabled="!hasInstructorPermission" />
<AdvisorManager
v-model="form.advisors"
:establish-date="form.establishDate"
:is-new-club="!form.id"
:disabled="!hasInstructorPermission"
/>
</div>
</el-tab-pane>
@@ -618,6 +644,14 @@
:current-member-count="currentClub?.memberCount"
@member-count-changed="handleMemberCountChanged"
/>
<!-- 指导老师历史记录弹窗 -->
<AdvisorHistoryDialog
v-model:visible="advisorHistoryDialog.visible"
:title="advisorHistoryDialog.title"
:club-id="currentAdvisorClub?.id"
:club-name="currentAdvisorClub?.clubName"
/>
</div>
</template>
@@ -649,6 +683,7 @@ import { StglClubVO, StglClubQuery, StglClubForm } from '@/api/stgl/club/types';
import StudentSelector from '@/components/StudentSelector/index.vue';
import AdvisorManager from '@/components/AdvisorManager/index.vue';
import MemberManagementDialog from './components/MemberManagementDialog.vue';
import AdvisorHistoryDialog from '@/components/AdvisorHistoryDialog/index.vue';
import { StudentVO } from '@/api/xg/student/types';
import { AdvisorVO } from '@/components/AdvisorManager/index.vue';
import { Document } from '@element-plus/icons-vue';
@@ -710,6 +745,14 @@ const memberDialog = reactive<DialogOption>({
const currentClub = ref<StglClubVO | null>(null);
const memberActiveTab = ref('joined');
// 指导老师历史记录相关
const advisorHistoryDialog = reactive<DialogOption>({
visible: false,
title: ''
});
const currentAdvisorClub = ref<StglClubVO | null>(null);
interface TransferForm {
clubId?: string | number;
oldPresidentName?: string;
@@ -849,12 +892,7 @@ const getList = async () => {
const res = await listStglClub(queryParams.value);
// 🔥 调试信息:检查返回的数据结构
console.log('getList: 获取到的社团列表数据:', res);
if (res.rows && res.rows.length > 0) {
console.log('getList: 第一条社团数据详情:', res.rows[0]);
console.log('getList: 第一条社团的advisorsJson字段:', res.rows[0].advisorsJson);
}
// 处理列表数据:将状态字段从数字类型转换为字符串类型,确保字典组件正常显示
if (res.rows && Array.isArray(res.rows)) {
@@ -926,10 +964,8 @@ const handleAdd = () => {
const handleUpdate = async (row?: StglClubVO) => {
reset();
const _id = row?.id || ids.value[0];
console.log('handleUpdate: 开始获取社团数据,ID:', _id);
const res = await getStglClub(_id);
console.log('handleUpdate: API响应数据:', res.data);
// 处理经费来源数据:如果是字符串则分割为数组
if (res.data.fundingSources) {
@@ -963,35 +999,28 @@ const handleUpdate = async (row?: StglClubVO) => {
}
// 处理副社长信息:优先从JSON字段读取,如果没有则使用单一字段
console.log('handleUpdate: 副社长原始数据:', {
vicePresidentsJson: res.data.vicePresidentsJson,
vicePresidentName: res.data.vicePresidentName,
vicePresidentStudentNo: res.data.vicePresidentStudentNo,
vicePresidentDept: res.data.vicePresidentDept,
vicePresidentMajor: res.data.vicePresidentMajor,
vicePresidentClass: res.data.vicePresidentClass,
vicePresidentPhone: res.data.vicePresidentPhone
});
// 处理指导老师信息:优先从JSON字段读取,如果没有则使用单一字段
// 🔥 优先从JSON字段读取指导老师数据
let advisorsData = [];
if (res.data.advisorsJson) {
try {
(res.data as any).advisors = JSON.parse(res.data.advisorsJson);
console.log('handleUpdate: 从JSON字段读取的指导老师数据:', (res.data as any).advisors);
advisorsData = JSON.parse(res.data.advisorsJson);
} catch (error) {
console.warn('解析指导老师JSON数据失败:', error);
(res.data as any).advisors = [];
advisorsData = [];
}
} else if (res.data.advisorName) {
// 回退到单一字段
(res.data as any).advisors = [
// 回退到单一字段,构建完整的teacher对象
advisorsData = [
{
name: res.data.advisorName,
dept: res.data.advisorDept,
phone: res.data.advisorPhone || '',
email: res.data.advisorEmail || '',
userId: '',
teacher: {
userId: null,
userName: '',
nickName: res.data.advisorName,
deptName: res.data.advisorDept,
phonenumber: res.data.advisorPhone || '',
@@ -999,13 +1028,15 @@ const handleUpdate = async (row?: StglClubVO) => {
}
}
];
} else {
(res.data as any).advisors = [];
}
// 先设置其他数据
Object.assign(form.value, res.data);
console.log('handleUpdate: 表单数据设置后:', form.value);
console.log('handleUpdate: 表单中的副社长数据:', form.value.vicePresidents);
// 然后单独设置指导老师数据,避免触发 watch 时的冲突
nextTick(() => {
form.value.advisors = advisorsData;
});
dialog.visible = true;
dialog.title = '修改社团信息';
@@ -1040,12 +1071,6 @@ const submitForm = () => {
// 🔥 新增:同时保存JSON字段和兼容性字段
submitData.advisorsJson = JSON.stringify(submitData.advisors || []);
// 调试日志:检查指导老师数据
console.log('提交数据 - advisors:', submitData.advisors);
console.log('提交数据 - advisorName:', submitData.advisorName);
console.log('提交数据 - advisorDept:', submitData.advisorDept);
console.log('完整提交数据:', submitData);
if (form.value.id) {
await updateStglClub(submitData).finally(() => (buttonLoading.value = false));
} else {
@@ -1113,7 +1138,6 @@ const handleView = async (row: StglClubVO) => {
if (viewData.advisorsJson) {
try {
(viewData as any).advisors = JSON.parse(viewData.advisorsJson);
console.log('handleView: 从JSON字段读取的指导老师数据:', (viewData as any).advisors);
} catch (error) {
console.warn('解析指导老师JSON数据失败:', error);
(viewData as any).advisors = [];
@@ -1138,10 +1162,6 @@ const handleView = async (row: StglClubVO) => {
(viewData as any).advisors = [];
}
console.log('handleView: 处理后的数据:', {
advisors: (viewData as any).advisors
});
Object.assign(viewForm, viewData);
viewDialog.visible = true;
viewDialog.title = '查看社团信息';
@@ -1205,16 +1225,12 @@ const getSourceTagType = (value: string) => {
/** 获取指导老师姓名列表 */
const getAdvisorNames = (row: any): string[] => {
console.log('getAdvisorNames: 处理行数据:', row);
// 优先从JSON字段读取指导老师数据
if (row.advisorsJson) {
try {
const advisors = JSON.parse(row.advisorsJson);
console.log('getAdvisorNames: 从JSON字段解析的指导老师数据:', advisors);
if (Array.isArray(advisors)) {
const names = advisors.map((advisor: any) => advisor.name || advisor.teacher?.nickName || '').filter((name) => name);
console.log('getAdvisorNames: 从JSON提取的姓名列表:', names);
return names;
}
} catch (error) {
@@ -1224,11 +1240,9 @@ const getAdvisorNames = (row: any): string[] => {
// 回退到单一字段
if (row.advisorName) {
console.log('getAdvisorNames: 从单一字段获取指导老师:', row.advisorName);
return [row.advisorName];
}
console.log('getAdvisorNames: 没有找到指导老师数据');
return [];
};
@@ -1259,104 +1273,88 @@ const handlePresidentChange = (student: StudentVO | null) => {
// 防止递归更新的锁
const syncLock = ref(false);
/** 指导老师列表变化处理 */
const handleAdvisorsChange = (advisors: AdvisorVO[]) => {
// 添加调试日志
console.log('handleAdvisorsChange 被调用,advisors:', advisors);
// 添加防护锁,避免递归更新
if (syncLock.value) return;
syncLock.value = true;
nextTick(() => {
// 同步指导老师数据到表单
form.value.advisors = advisors;
// 为了兼容旧版本,同步第一个指导老师的信息到旧字段
if (advisors.length > 0) {
const firstAdvisor = advisors[0];
form.value.advisorName = firstAdvisor.name || firstAdvisor.teacher?.nickName;
form.value.advisorDept = firstAdvisor.dept || firstAdvisor.teacher?.deptName;
form.value.advisorPhone = firstAdvisor.phone || firstAdvisor.teacher?.phonenumber;
form.value.advisorEmail = firstAdvisor.email || firstAdvisor.teacher?.email;
} else {
form.value.advisorName = undefined;
form.value.advisorDept = undefined;
form.value.advisorPhone = undefined;
form.value.advisorEmail = undefined;
}
syncLock.value = false;
});
};
/** 监听指导老师数据变化,同步兼容性字段 */
watch(
() => form.value.advisors,
(advisors: AdvisorVO[]) => {
// 防止递归更新
if (syncLock.value) return;
syncLock.value = true;
nextTick(() => {
try {
// 为了兼容旧版本,同步第一个指导老师的信息到旧字段
if (advisors && advisors.length > 0) {
const firstAdvisor = advisors[0];
form.value.advisorName = firstAdvisor.name || firstAdvisor.teacher?.nickName;
form.value.advisorDept = firstAdvisor.dept || firstAdvisor.teacher?.deptName;
form.value.advisorPhone = firstAdvisor.phone || firstAdvisor.teacher?.phonenumber;
form.value.advisorEmail = firstAdvisor.email || firstAdvisor.teacher?.email;
} else {
form.value.advisorName = undefined;
form.value.advisorDept = undefined;
form.value.advisorPhone = undefined;
form.value.advisorEmail = undefined;
}
} finally {
syncLock.value = false;
}
});
},
{ deep: true }
);
/** 检查用户是否为指定社团的社长(无论是否为创建者) */
const checkIsPresident = async (clubId: string | number): Promise<boolean> => {
try {
console.log('🔍 checkIsPresident: 开始检查社长权限, clubId:', clubId);
const res = await checkPresidentRole(clubId);
console.log('🔍 checkIsPresident: API返回结果:', res);
const isPresident = res.data === true;
console.log('🔍 checkIsPresident: 最终结果:', isPresident);
return isPresident;
} catch (error) {
console.error('❌ checkIsPresident: 检查社长权限失败:', error);
console.error('checkIsPresident: 检查社长权限失败:', error);
return false;
}
};
/** 批量检查社长权限(检查用户是否为各社团的社长,无论是否为创建者) */
const checkBatchPresidentRoles = async (clubs: StglClubVO[]) => {
console.log('🔍 checkBatchPresidentRoles: 开始批量检查权限, clubs数量:', clubs.length);
const checks = clubs.map(async (club) => {
const isPresident = await checkIsPresident(club.id!);
presidentRoles.value[club.id!] = isPresident;
console.log(`🔍 checkBatchPresidentRoles: 社团${club.id}(${club.clubName}) 权限检查结果:`, isPresident);
return { clubId: club.id!, isPresident };
});
await Promise.all(checks);
console.log('🔍 checkBatchPresidentRoles: 批量权限检查完成, presidentRoles:', presidentRoles.value);
};
/** 判断是否显示转让按钮 */
const shouldShowTransferButton = (club: StglClubVO): boolean => {
console.log('🔍 shouldShowTransferButton: 开始判断转让按钮显示, club:', club);
// 1. 检查基础权限
const hasEditPermission = proxy?.$auth.hasPermi('stgl:club:edit');
console.log('🔍 shouldShowTransferButton: 基础edit权限检查:', hasEditPermission);
if (!hasEditPermission) {
console.log('❌ shouldShowTransferButton: 无基础edit权限,返回false');
return false;
}
// 2. 检查角色权限 - 如果有stgl_president角色,则需要进一步检查是否为该社团社长
const hasPresidentRole = proxy?.$auth.hasRole('stgl_president');
console.log('🔍 shouldShowTransferButton: stgl_president角色检查:', hasPresidentRole);
if (hasPresidentRole) {
// 如果权限检查还未完成,返回false(避免按钮闪现)
const isPresident = presidentRoles.value[club.id!];
console.log('🔍 shouldShowTransferButton: 社团社长权限检查结果:', isPresident, 'presidentRoles:', presidentRoles.value);
if (isPresident === undefined) {
console.log('⏳ shouldShowTransferButton: 权限检查未完成,返回false避免闪现');
return false;
}
// 社长可以看到转让按钮(无论是否为创建者)
const result = isPresident === true;
console.log('🔍 shouldShowTransferButton: stgl_president角色最终结果:', result);
return result;
}
// 3. 如果是管理员角色,显示转让按钮(但转让操作仍需社长权限验证)
const hasAdminRole = proxy?.$auth.hasRoleOr(['admin', 'common']);
console.log('🔍 shouldShowTransferButton: 管理员角色检查:', hasAdminRole);
if (hasAdminRole) {
console.log('✅ shouldShowTransferButton: 管理员角色,返回true');
return true;
}
console.log('❌ shouldShowTransferButton: 无任何有效角色,返回false');
return false;
};
@@ -1464,7 +1462,6 @@ const handleActivityManagement = (row: StglClubVO) => {
/** 成员管理按钮操作 */
const handleMemberManagement = (row: StglClubVO) => {
console.log('handleMemberManagement: 打开成员管理弹窗, row:', row);
currentClub.value = row;
memberDialog.visible = true;
memberDialog.title = `${row.clubName} - 成员管理`;
@@ -1473,7 +1470,6 @@ const handleMemberManagement = (row: StglClubVO) => {
/** 处理成员数量变化 */
const handleMemberCountChanged = (newCount: number) => {
console.log('handleMemberCountChanged: 成员数量变化:', newCount, '当前社团:', currentClub.value);
if (currentClub.value) {
// 更新当前社团的成员数量
currentClub.value.memberCount = newCount;
@@ -1482,11 +1478,40 @@ const handleMemberCountChanged = (newCount: number) => {
const clubIndex = clubList.value.findIndex((club) => club.id === currentClub.value?.id);
if (clubIndex !== -1) {
clubList.value[clubIndex].memberCount = newCount;
console.log('handleMemberCountChanged: 已更新列表中的成员数量:', clubList.value[clubIndex]);
}
}
};
/** 指导老师历史记录按钮操作 */
const handleAdvisorHistory = (row: StglClubVO) => {
currentAdvisorClub.value = row;
advisorHistoryDialog.visible = true;
advisorHistoryDialog.title = `${row.clubName} - 指导老师历史记录`;
};
/** 工具栏指导老师按钮操作 */
const handleAdvisorHistoryFromToolbar = () => {
const selectedClub = clubList.value.find((c) => ids.value.includes(c.id!));
if (selectedClub) {
handleAdvisorHistory(selectedClub);
}
};
/** 年审管理按钮操作 */
const handleAnnualReview = () => {
const selectedClub = clubList.value.find((c) => ids.value.includes(c.id!));
if (selectedClub) {
router.push({
path: '/stgl/club/info/annualReview/index',
query: {
clubId: selectedClub.id,
clubName: selectedClub.clubName,
from: 'club'
}
});
}
};
onMounted(() => {
getList();
});
+102 -15
View File
@@ -67,8 +67,26 @@
<dict-tag :options="stgl_activity_type" :value="scope.row.activityType" />
</template>
</el-table-column>
<el-table-column label="主办方" align="center" prop="organizerName" width="120" show-overflow-tooltip />
<el-table-column label="关联组织" align="center" width="120" show-overflow-tooltip>
<!-- 隐藏主办方字段 -->
<!-- <el-table-column label="主办方" align="center" prop="organizerName" width="120" show-overflow-tooltip /> -->
<el-table-column label="关联部门" align="center" width="150" show-overflow-tooltip>
<template #default="scope">
<div v-if="getTableRelatedDeptNames(scope.row).length > 0" class="dept-list-table">
<el-tag
v-for="(deptName, index) in getTableRelatedDeptNames(scope.row)"
:key="index"
type="info"
size="small"
class="dept-tag-table"
:title="deptName"
>
{{ deptName }}
</el-tag>
</div>
<span v-else class="text-gray-400">未关联</span>
</template>
</el-table-column>
<el-table-column label="关联社团" align="center" width="120" show-overflow-tooltip>
<template #default="scope">
<span v-if="scope.row.organizationName">{{ scope.row.organizationName }}</span>
<span v-else class="text-gray-400">未关联</span>
@@ -86,7 +104,7 @@
<el-table-column label="活动地点" align="center" prop="location" width="120" show-overflow-tooltip />
<el-table-column label="活动状态" align="center" prop="activityStatus" width="100">
<template #default="scope">
<dict-tag :options="stgl_activity_status" :value="scope.row.activityStatus" />
<dict-tag :options="stgl_activity_status" :value="calculateActivityStatus(scope.row)" />
</template>
</el-table-column>
<el-table-column label="报名时间" align="center" width="180">
@@ -165,15 +183,28 @@
<div class="detail-content">
<!-- 基本信息 -->
<div class="detail-section">
<el-descriptions :column="2" border>
<el-descriptions :column="2" border class="activity-detail-descriptions">
<el-descriptions-item label="活动名称">{{ detailForm.activityName }}</el-descriptions-item>
<el-descriptions-item label="活动类型">
<dict-tag :options="stgl_activity_type" :value="detailForm.activityType" />
</el-descriptions-item>
<el-descriptions-item label="活动主题">{{ detailForm.activityTheme || '暂无' }}</el-descriptions-item>
<el-descriptions-item label="主办方">{{ detailForm.organizerName || '暂无' }}</el-descriptions-item>
<el-descriptions-item label="承办方">{{ detailForm.undertakerName || '暂无' }}</el-descriptions-item>
<el-descriptions-item label="关联组织">
<el-descriptions-item label="活动地点">{{ detailForm.location || '暂无' }}</el-descriptions-item>
<el-descriptions-item label="关联部门">
<div v-if="getTableRelatedDeptNames(detailForm).length > 0" class="dept-list-detail-optimized">
<el-tag
v-for="(deptName, index) in getTableRelatedDeptNames(detailForm)"
:key="index"
type="info"
size="small"
class="dept-tag-detail-optimized"
>
{{ deptName }}
</el-tag>
</div>
<span v-else class="text-gray-400">未关联</span>
</el-descriptions-item>
<el-descriptions-item label="关联社团">
<span v-if="detailForm.organizationName">
{{ detailForm.organizationName }}
<el-tag size="small" type="info" class="ml-1">
@@ -182,17 +213,10 @@
</span>
<span v-else>未关联</span>
</el-descriptions-item>
<el-descriptions-item label="指导老师">
<span v-if="detailForm.instructors && detailForm.instructors.length > 0">
{{ getInstructorNames(detailForm.instructors) }}
</span>
<span v-else>暂无</span>
</el-descriptions-item>
<el-descriptions-item label="活动地点">{{ detailForm.location || '暂无' }}</el-descriptions-item>
<el-descriptions-item label="开始时间">{{ parseTime(detailForm.startTime, '{y}-{m}-{d} {h}:{i}') }}</el-descriptions-item>
<el-descriptions-item label="结束时间">{{ parseTime(detailForm.endTime, '{y}-{m}-{d} {h}:{i}') }}</el-descriptions-item>
<el-descriptions-item label="活动状态">
<dict-tag :options="stgl_activity_status" :value="detailForm.activityStatus" />
<dict-tag :options="stgl_activity_status" :value="calculateActivityStatus(detailForm)" />
</el-descriptions-item>
<el-descriptions-item label="报名状态">
<dict-tag :options="stgl_registration_status" :value="detailForm.registrationStatus" />
@@ -1084,6 +1108,69 @@ const getInstructorNames = (instructors: string | any[]): string => {
.join('、');
};
/** 获取活动关联部门名称列表 */
const getTableRelatedDeptNames = (activity: MyActivityVO): string[] => {
// 优先检查relatedDeptNames字段(多部门支持)
if (activity.relatedDeptNames) {
// 如果是数组类型,直接使用
if (Array.isArray(activity.relatedDeptNames)) {
return activity.relatedDeptNames.filter(name => name);
}
// 如果是字符串类型(逗号分隔),进行分割
const deptNamesStr = activity.relatedDeptNames as unknown as string;
if (typeof deptNamesStr === 'string' && deptNamesStr.includes(',')) {
return deptNamesStr.split(',').map(name => name.trim()).filter(name => name);
}
// 如果是单个字符串
if (typeof deptNamesStr === 'string' && deptNamesStr.trim()) {
return [deptNamesStr.trim()];
}
}
// 兼容旧的单部门字段
if (activity.relatedDeptName) {
if (activity.relatedDeptName.includes(',')) {
return activity.relatedDeptName.split(',').map(name => name.trim()).filter(name => name);
} else {
return [activity.relatedDeptName];
}
}
return [];
};
/** 计算活动的实际状态(基于时间比较) */
const calculateActivityStatus = (activity: MyActivityVO): string => {
// 如果活动状态是草稿(0)、提交审核(1)、待审批(2)、已驳回(7)、已取消(6),直接返回原状态
const originalStatus = activity.activityStatus;
if (['0', '1', '2', '6', '7'].includes(originalStatus)) {
return originalStatus;
}
// 只有已通过(3)、进行中(4)、已结束(5)状态的活动需要根据时间动态计算
if (!['3', '4', '5'].includes(originalStatus)) {
return originalStatus;
}
// 如果没有开始时间和结束时间,返回原状态
if (!activity.startTime || !activity.endTime) {
return originalStatus;
}
const now = new Date();
const startTime = new Date(activity.startTime);
const endTime = new Date(activity.endTime);
// 根据时间比较确定实际状态
if (now < startTime) {
return '3'; // 已通过(活动还未开始)
} else if (now >= startTime && now <= endTime) {
return '4'; // 进行中(活动正在进行)
} else {
return '5'; // 已结束(活动已结束)
}
};
/** 对话框关闭时重置队伍信息 */
const handleDetailClose = () => {
teamInfo.value = null;
+21 -3
View File
@@ -61,7 +61,7 @@
</template>
</el-table-column>
<el-table-column label="联系电话" align="center" prop="phone" min-width="55" />
<el-table-column label="加入社团" align="center" width="160">
<el-table-column label="加入社团" align="center" width="120">
<template #default="scope">
<el-button
v-if="scope.row.clubCount > 0"
@@ -75,7 +75,7 @@
<span v-else class="no-data">0</span>
</template>
</el-table-column>
<el-table-column label="加入志愿者队伍" align="center" width="170">
<el-table-column label="加入志愿者队伍" align="center" width="130">
<template #default="scope">
<el-button
v-if="scope.row.volunteerTeamCount > 0"
@@ -89,7 +89,7 @@
<span v-else class="no-data">0</span>
</template>
</el-table-column>
<el-table-column label="参与活动" align="center" width="160">
<el-table-column label="参与活动" align="center" width="120">
<template #default="scope">
<el-button
v-if="scope.row.activityCount > 0"
@@ -103,6 +103,24 @@
<span v-else class="no-data">0</span>
</template>
</el-table-column>
<el-table-column label="今日活动" align="center" width="240">
<template #default="scope">
<span v-if="scope.row.todayActivityName" class="activity-name">
{{ scope.row.todayActivityName }}
</span>
<span v-else class="no-data">暂无今日活动</span>
</template>
</el-table-column>
<el-table-column label="活动时间" align="center" width="160">
<template #default="scope">
<div v-if="scope.row.todayActivityStartTime && scope.row.todayActivityEndTime" class="activity-time">
<div class="time-start">{{ scope.row.todayActivityStartTime }}</div>
<div class="time-separator">~</div>
<div class="time-end">{{ scope.row.todayActivityEndTime }}</div>
</div>
<span v-else class="no-data">-</span>
</template>
</el-table-column>
</el-table>
<div class="pagination-container">
@@ -498,9 +498,6 @@
</el-option>
</el-select>
</el-form-item>
<el-form-item label="学生姓名" prop="studentName">
<el-input v-model="form.studentName" placeholder="选择学生后自动填充" :disabled="true" />
</el-form-item>
<el-form-item label="学号" prop="studentNo" v-if="false">
<el-input v-model="form.studentNo" placeholder="请输入学号" />
</el-form-item>
@@ -529,6 +526,9 @@
<!-- 右列:宿舍信息 -->
<el-col :span="12">
<el-form-item label="学生姓名" prop="studentName">
<el-input v-model="form.studentName" placeholder="选择学生后自动填充" :disabled="true" />
</el-form-item>
<el-form-item label="校区ID" prop="campusId" v-if="false">
<el-input v-model="form.campusId" placeholder="请输入校区ID" />
</el-form-item>
@@ -545,23 +545,6 @@
<el-option v-for="campus in campusOptions" :key="campus.id" :label="campus.campusName" :value="campus.id" />
</el-select>
</el-form-item>
<el-form-item label="宿舍区ID" prop="areaId" v-if="false">
<el-input v-model="form.areaId" placeholder="请输入宿舍区ID" />
</el-form-item>
<el-form-item label="宿舍区名称" prop="areaId">
<el-select
v-model="form.areaId"
placeholder="请选择宿舍区"
clearable
filterable
:loading="dormLoading"
@change="handleAreaChange"
style="width: 100%"
:disabled="!form.campusId"
>
<el-option v-for="area in areaOptions" :key="area.id" :label="area.areaName" :value="area.id" />
</el-select>
</el-form-item>
<el-form-item label="宿舍楼ID" prop="buildingId" v-if="false">
<el-input v-model="form.buildingId" placeholder="请输入宿舍楼ID" />
</el-form-item>
@@ -574,7 +557,7 @@
:loading="dormLoading"
@change="handleBuildingChange"
style="width: 100%"
:disabled="!form.areaId"
:disabled="!form.campusId"
>
<el-option v-for="building in buildingOptions" :key="building.id" :label="building.buildingName" :value="building.id" />
</el-select>
@@ -849,7 +832,6 @@ const studentSelectVisible = ref(false);
// 宿舍级联选择器相关状态
const campusOptions = ref<CampusOptionVO[]>([]);
const areaOptions = ref<AreaOptionVO[]>([]);
const buildingOptions = ref<BuildingOptionVO[]>([]);
const roomOptions = ref<RoomOptionVO[]>([]);
const bedOptions = ref<BedOptionVO[]>([]);
@@ -880,8 +862,6 @@ const initFormData: HolidayStayForm = {
collegeName: undefined,
campusId: undefined,
campusName: undefined,
areaId: undefined,
areaName: undefined,
buildingId: undefined,
buildingName: undefined,
roomId: undefined,
@@ -920,8 +900,6 @@ const data = reactive<PageData<HolidayStayForm, HolidayStayQuery>>({
collegeName: undefined,
campusId: undefined,
campusName: undefined,
areaId: undefined,
areaName: undefined,
buildingId: undefined,
buildingName: undefined,
roomId: undefined,
@@ -1111,7 +1089,6 @@ const reset = () => {
holidayStayFormRef.value?.resetFields();
// 清空宿舍级联选项
areaOptions.value = [];
buildingOptions.value = [];
roomOptions.value = [];
bedOptions.value = [];
@@ -1170,8 +1147,6 @@ const handleUpdate = async (row?: HolidayStayVO) => {
dormInfo: {
campusId: form.value.campusId,
campusName: form.value.campusName,
areaId: form.value.areaId,
areaName: form.value.areaName,
buildingId: form.value.buildingId,
buildingName: form.value.buildingName,
roomId: form.value.roomId,
@@ -1335,8 +1310,6 @@ const handleStudentChange = async (studentId: string | number) => {
// 清空宿舍信息及选项
form.value.campusId = undefined;
form.value.campusName = undefined;
form.value.areaId = undefined;
form.value.areaName = undefined;
form.value.buildingId = undefined;
form.value.buildingName = undefined;
form.value.roomId = undefined;
@@ -1344,7 +1317,6 @@ const handleStudentChange = async (studentId: string | number) => {
form.value.bedId = undefined;
form.value.bedName = undefined;
areaOptions.value = [];
buildingOptions.value = [];
roomOptions.value = [];
bedOptions.value = [];
@@ -1372,8 +1344,6 @@ const handleStudentChange = async (studentId: string | number) => {
// 填充宿舍信息
form.value.campusId = selectedStudent.dormInfo.campusId;
form.value.campusName = selectedStudent.dormInfo.campusName;
form.value.areaId = selectedStudent.dormInfo.areaId;
form.value.areaName = selectedStudent.dormInfo.areaName;
form.value.buildingId = selectedStudent.dormInfo.buildingId;
form.value.buildingName = selectedStudent.dormInfo.buildingName;
form.value.roomId = selectedStudent.dormInfo.roomId;
@@ -1384,17 +1354,13 @@ const handleStudentChange = async (studentId: string | number) => {
// 级联加载对应的选项
try {
if (selectedStudent.dormInfo.campusId) {
await loadAreaOptions(selectedStudent.dormInfo.campusId);
await loadBuildingOptions(selectedStudent.dormInfo.campusId);
if (selectedStudent.dormInfo.areaId) {
await loadBuildingOptions(selectedStudent.dormInfo.areaId);
if (selectedStudent.dormInfo.buildingId) {
await loadRoomOptions(selectedStudent.dormInfo.buildingId);
if (selectedStudent.dormInfo.buildingId) {
await loadRoomOptions(selectedStudent.dormInfo.buildingId);
if (selectedStudent.dormInfo.roomId) {
await loadBedOptions(selectedStudent.dormInfo.roomId);
}
if (selectedStudent.dormInfo.roomId) {
await loadBedOptions(selectedStudent.dormInfo.roomId);
}
}
}
@@ -1405,8 +1371,6 @@ const handleStudentChange = async (studentId: string | number) => {
// 如果宿舍信息为空,清空宿舍相关字段
form.value.campusId = undefined;
form.value.campusName = undefined;
form.value.areaId = undefined;
form.value.areaName = undefined;
form.value.buildingId = undefined;
form.value.buildingName = undefined;
form.value.roomId = undefined;
@@ -1414,7 +1378,6 @@ const handleStudentChange = async (studentId: string | number) => {
form.value.bedId = undefined;
form.value.bedName = undefined;
areaOptions.value = [];
buildingOptions.value = [];
roomOptions.value = [];
bedOptions.value = [];
@@ -1426,7 +1389,10 @@ const handleStudentChange = async (studentId: string | number) => {
const loadCampusOptions = async () => {
try {
dormLoading.value = true;
const res = await getCampusOptions();
const res = await request({
url: '/xqxx/dormCampus/list',
method: 'get'
});
campusOptions.value = res.rows || [];
} catch (error) {
console.error('加载校区选项失败:', error);
@@ -1440,8 +1406,6 @@ const loadCampusOptions = async () => {
const handleCampusChange = async (campusId: string | number) => {
console.log('校区选择变化处理', campusId);
// 清空下级选项
form.value.areaId = undefined;
form.value.areaName = undefined;
form.value.buildingId = undefined;
form.value.buildingName = undefined;
form.value.roomId = undefined;
@@ -1449,7 +1413,6 @@ const handleCampusChange = async (campusId: string | number) => {
form.value.bedId = undefined;
form.value.bedName = undefined;
areaOptions.value = [];
buildingOptions.value = [];
roomOptions.value = [];
bedOptions.value = [];
@@ -1462,63 +1425,23 @@ const handleCampusChange = async (campusId: string | number) => {
form.value.campusName = selectedCampus.campusName;
}
// 加载宿舍区选项
await loadAreaOptions(campusId);
// 直接加载宿舍楼选项
await loadBuildingOptions(campusId);
} else {
form.value.campusId = undefined;
form.value.campusName = undefined;
}
};
/** 加载宿舍区选项 */
const loadAreaOptions = async (campusId: string | number) => {
try {
dormLoading.value = true;
const res = await getAreaOptions(campusId);
areaOptions.value = res.rows || [];
} catch (error) {
console.error('加载宿舍区选项失败:', error);
areaOptions.value = [];
} finally {
dormLoading.value = false;
}
};
/** 宿舍区选择变化处理 */
const handleAreaChange = async (areaId: string | number) => {
// 清空下级选项
form.value.buildingId = undefined;
form.value.buildingName = undefined;
form.value.roomId = undefined;
form.value.roomName = undefined;
form.value.bedId = undefined;
form.value.bedName = undefined;
buildingOptions.value = [];
roomOptions.value = [];
bedOptions.value = [];
if (areaId) {
// 设置宿舍区名称
const selectedArea = areaOptions.value.find((area) => area.id === areaId);
if (selectedArea) {
form.value.areaId = areaId;
form.value.areaName = selectedArea.areaName;
}
// 加载宿舍楼选项
await loadBuildingOptions(areaId);
} else {
form.value.areaId = undefined;
form.value.areaName = undefined;
}
};
/** 加载宿舍楼选项 */
const loadBuildingOptions = async (areaId: string | number) => {
const loadBuildingOptions = async (campusId: string | number) => {
try {
dormLoading.value = true;
const res = await getBuildingOptions(areaId);
const res = await request({
url: '/sslxx/dormBuilding/list',
method: 'get',
params: { campusId }
});
buildingOptions.value = res.rows || [];
} catch (error) {
console.error('加载宿舍楼选项失败:', error);
@@ -1625,22 +1548,17 @@ const handleBedChange = (bedId: string | number) => {
/** 修改时级联加载宿舍选项数据 */
const loadCascadeOptionsForUpdate = async (formData: HolidayStayForm) => {
try {
// 如果有校区ID,加载宿舍区选项
// 如果有校区ID,加载宿舍楼选项
if (formData.campusId) {
await loadAreaOptions(formData.campusId);
await loadBuildingOptions(formData.campusId);
// 如果有宿舍区ID,加载宿舍楼选项
if (formData.areaId) {
await loadBuildingOptions(formData.areaId);
// 如果有宿舍楼ID,加载房间选项
if (formData.buildingId) {
await loadRoomOptions(formData.buildingId);
// 如果有宿舍楼ID,加载房间选项
if (formData.buildingId) {
await loadRoomOptions(formData.buildingId);
// 如果有房间ID,加载床位选项
if (formData.roomId) {
await loadBedOptions(formData.roomId);
}
// 如果有房间ID,加载床位选项
if (formData.roomId) {
await loadBedOptions(formData.roomId);
}
}
}
@@ -1946,7 +1864,38 @@ const getSinglePersonValidStayData = async () => {
singlePersonLoading.value = true;
try {
console.log('开始获取单人留宿有效数据...');
const res = await getSinglePersonValidStay();
// 确保用户信息已加载
if (!userStore.userId) {
await userStore.getInfo();
}
// 获取宿管员权限楼栋列表
const buildingIds = await getDormManagerBuildingIds();
// 如果没有宿管员权限,直接返回空列表
if (!hasDormManagerPermission.value || buildingIds.length === 0) {
singlePersonStayList.value = [];
groupedSinglePersonStayList.value = {};
console.log('当前用户没有宿管员权限或没有分配管理楼栋,单人留宿数据为空');
return;
}
// 构建请求参数,添加宿管员权限过滤
const requestParams: any = {};
// 宿管员权限过滤:添加楼栋ID过滤条件
if (buildingIds.length === 1) {
// 单个楼栋直接设置buildingId
requestParams.buildingId = buildingIds[0];
} else {
// 多个楼栋使用in查询,通过params传递
requestParams.params = {
buildingIds: buildingIds.join(',')
};
}
const res = await getSinglePersonValidStay(requestParams);
console.log('单人留宿数据响应:', res);
if (res.code === 200) {
@@ -290,9 +290,6 @@
</el-option>
</el-select>
</el-form-item>
<el-form-item label="学生姓名" prop="studentName">
<el-input v-model="form.studentName" placeholder="选择学生后自动填充" :disabled="true" />
</el-form-item>
<el-form-item label="学号" prop="studentNo" v-if="false">
<el-input v-model="form.studentNo" placeholder="请输入学号" />
</el-form-item>
@@ -321,6 +318,9 @@
<!-- 右列:宿舍信息 -->
<el-col :span="12">
<el-form-item label="学生姓名" prop="studentName">
<el-input v-model="form.studentName" placeholder="选择学生后自动填充" :disabled="true" />
</el-form-item>
<el-form-item label="校区ID" prop="campusId" v-if="false">
<el-input v-model="form.campusId" placeholder="请输入校区ID" />
</el-form-item>
@@ -337,23 +337,6 @@
<el-option v-for="campus in campusOptions" :key="campus.id" :label="campus.campusName" :value="campus.id" />
</el-select>
</el-form-item>
<el-form-item label="宿舍区ID" prop="areaId" v-if="false">
<el-input v-model="form.areaId" placeholder="请输入宿舍区ID" />
</el-form-item>
<el-form-item label="宿舍区名称" prop="areaId">
<el-select
v-model="form.areaId"
placeholder="请选择宿舍区"
clearable
filterable
:loading="dormLoading"
@change="handleAreaChange"
style="width: 100%"
:disabled="!form.campusId"
>
<el-option v-for="area in areaOptions" :key="area.id" :label="area.areaName" :value="area.id" />
</el-select>
</el-form-item>
<el-form-item label="宿舍楼ID" prop="buildingId" v-if="false">
<el-input v-model="form.buildingId" placeholder="请输入宿舍楼ID" />
</el-form-item>
@@ -366,7 +349,7 @@
:loading="dormLoading"
@change="handleBuildingChange"
style="width: 100%"
:disabled="!form.areaId"
:disabled="!form.campusId"
>
<el-option v-for="building in buildingOptions" :key="building.id" :label="building.buildingName" :value="building.id" />
</el-select>
@@ -631,7 +614,6 @@ const studentSelectVisible = ref(false);
// 宿舍级联选择器相关状态
const campusOptions = ref<CampusOptionVO[]>([]);
const areaOptions = ref<AreaOptionVO[]>([]);
const buildingOptions = ref<BuildingOptionVO[]>([]);
const roomOptions = ref<RoomOptionVO[]>([]);
const bedOptions = ref<BedOptionVO[]>([]);
@@ -662,8 +644,6 @@ const initFormData: HolidayStayForm = {
collegeName: undefined,
campusId: undefined,
campusName: undefined,
areaId: undefined,
areaName: undefined,
buildingId: undefined,
buildingName: undefined,
roomId: undefined,
@@ -702,8 +682,6 @@ const data = reactive<PageData<HolidayStayForm, HolidayStayQuery>>({
collegeName: undefined,
campusId: undefined,
campusName: undefined,
areaId: undefined,
areaName: undefined,
buildingId: undefined,
buildingName: undefined,
roomId: undefined,
@@ -813,7 +791,6 @@ const reset = () => {
holidayStayFormRef.value?.resetFields();
// 清空宿舍级联选项
areaOptions.value = [];
buildingOptions.value = [];
roomOptions.value = [];
bedOptions.value = [];
@@ -872,8 +849,6 @@ const handleUpdate = async (row?: HolidayStayVO) => {
dormInfo: {
campusId: form.value.campusId,
campusName: form.value.campusName,
areaId: form.value.areaId,
areaName: form.value.areaName,
buildingId: form.value.buildingId,
buildingName: form.value.buildingName,
roomId: form.value.roomId,
@@ -1037,8 +1012,6 @@ const handleStudentChange = async (studentId: string | number) => {
// 清空宿舍信息及选项
form.value.campusId = undefined;
form.value.campusName = undefined;
form.value.areaId = undefined;
form.value.areaName = undefined;
form.value.buildingId = undefined;
form.value.buildingName = undefined;
form.value.roomId = undefined;
@@ -1046,7 +1019,6 @@ const handleStudentChange = async (studentId: string | number) => {
form.value.bedId = undefined;
form.value.bedName = undefined;
areaOptions.value = [];
buildingOptions.value = [];
roomOptions.value = [];
bedOptions.value = [];
@@ -1074,8 +1046,6 @@ const handleStudentChange = async (studentId: string | number) => {
// 填充宿舍信息
form.value.campusId = selectedStudent.dormInfo.campusId;
form.value.campusName = selectedStudent.dormInfo.campusName;
form.value.areaId = selectedStudent.dormInfo.areaId;
form.value.areaName = selectedStudent.dormInfo.areaName;
form.value.buildingId = selectedStudent.dormInfo.buildingId;
form.value.buildingName = selectedStudent.dormInfo.buildingName;
form.value.roomId = selectedStudent.dormInfo.roomId;
@@ -1086,17 +1056,13 @@ const handleStudentChange = async (studentId: string | number) => {
// 级联加载对应的选项
try {
if (selectedStudent.dormInfo.campusId) {
await loadAreaOptions(selectedStudent.dormInfo.campusId);
await loadBuildingOptions(selectedStudent.dormInfo.campusId);
if (selectedStudent.dormInfo.areaId) {
await loadBuildingOptions(selectedStudent.dormInfo.areaId);
if (selectedStudent.dormInfo.buildingId) {
await loadRoomOptions(selectedStudent.dormInfo.buildingId);
if (selectedStudent.dormInfo.buildingId) {
await loadRoomOptions(selectedStudent.dormInfo.buildingId);
if (selectedStudent.dormInfo.roomId) {
await loadBedOptions(selectedStudent.dormInfo.roomId);
}
if (selectedStudent.dormInfo.roomId) {
await loadBedOptions(selectedStudent.dormInfo.roomId);
}
}
}
@@ -1107,8 +1073,6 @@ const handleStudentChange = async (studentId: string | number) => {
// 如果宿舍信息为空,清空宿舍相关字段
form.value.campusId = undefined;
form.value.campusName = undefined;
form.value.areaId = undefined;
form.value.areaName = undefined;
form.value.buildingId = undefined;
form.value.buildingName = undefined;
form.value.roomId = undefined;
@@ -1116,7 +1080,6 @@ const handleStudentChange = async (studentId: string | number) => {
form.value.bedId = undefined;
form.value.bedName = undefined;
areaOptions.value = [];
buildingOptions.value = [];
roomOptions.value = [];
bedOptions.value = [];
@@ -1128,7 +1091,10 @@ const handleStudentChange = async (studentId: string | number) => {
const loadCampusOptions = async () => {
try {
dormLoading.value = true;
const res = await getCampusOptions();
const res = await request({
url: '/xqxx/dormCampus/list',
method: 'get'
});
campusOptions.value = res.rows || [];
} catch (error) {
console.error('加载校区选项失败:', error);
@@ -1142,8 +1108,6 @@ const loadCampusOptions = async () => {
const handleCampusChange = async (campusId: string | number) => {
console.log('校区选择变化处理', campusId);
// 清空下级选项
form.value.areaId = undefined;
form.value.areaName = undefined;
form.value.buildingId = undefined;
form.value.buildingName = undefined;
form.value.roomId = undefined;
@@ -1151,7 +1115,6 @@ const handleCampusChange = async (campusId: string | number) => {
form.value.bedId = undefined;
form.value.bedName = undefined;
areaOptions.value = [];
buildingOptions.value = [];
roomOptions.value = [];
bedOptions.value = [];
@@ -1164,63 +1127,23 @@ const handleCampusChange = async (campusId: string | number) => {
form.value.campusName = selectedCampus.campusName;
}
// 加载宿舍区选项
await loadAreaOptions(campusId);
// 直接加载宿舍楼选项
await loadBuildingOptions(campusId);
} else {
form.value.campusId = undefined;
form.value.campusName = undefined;
}
};
/** 加载宿舍区选项 */
const loadAreaOptions = async (campusId: string | number) => {
try {
dormLoading.value = true;
const res = await getAreaOptions(campusId);
areaOptions.value = res.rows || [];
} catch (error) {
console.error('加载宿舍区选项失败:', error);
areaOptions.value = [];
} finally {
dormLoading.value = false;
}
};
/** 宿舍区选择变化处理 */
const handleAreaChange = async (areaId: string | number) => {
// 清空下级选项
form.value.buildingId = undefined;
form.value.buildingName = undefined;
form.value.roomId = undefined;
form.value.roomName = undefined;
form.value.bedId = undefined;
form.value.bedName = undefined;
buildingOptions.value = [];
roomOptions.value = [];
bedOptions.value = [];
if (areaId) {
// 设置宿舍区名称
const selectedArea = areaOptions.value.find((area) => area.id === areaId);
if (selectedArea) {
form.value.areaId = areaId;
form.value.areaName = selectedArea.areaName;
}
// 加载宿舍楼选项
await loadBuildingOptions(areaId);
} else {
form.value.areaId = undefined;
form.value.areaName = undefined;
}
};
/** 加载宿舍楼选项 */
const loadBuildingOptions = async (areaId: string | number) => {
const loadBuildingOptions = async (campusId: string | number) => {
try {
dormLoading.value = true;
const res = await getBuildingOptions(areaId);
const res = await request({
url: '/sslxx/dormBuilding/list',
method: 'get',
params: { campusId }
});
buildingOptions.value = res.rows || [];
} catch (error) {
console.error('加载宿舍楼选项失败:', error);
@@ -1327,22 +1250,17 @@ const handleBedChange = (bedId: string | number) => {
/** 修改时级联加载宿舍选项数据 */
const loadCascadeOptionsForUpdate = async (formData: HolidayStayForm) => {
try {
// 如果有校区ID,加载宿舍区选项
// 如果有校区ID,加载宿舍楼选项
if (formData.campusId) {
await loadAreaOptions(formData.campusId);
await loadBuildingOptions(formData.campusId);
// 如果有宿舍区ID,加载宿舍楼选项
if (formData.areaId) {
await loadBuildingOptions(formData.areaId);
// 如果有宿舍楼ID,加载房间选项
if (formData.buildingId) {
await loadRoomOptions(formData.buildingId);
// 如果有宿舍楼ID,加载房间选项
if (formData.buildingId) {
await loadRoomOptions(formData.buildingId);
// 如果有房间ID,加载床位选项
if (formData.roomId) {
await loadBedOptions(formData.roomId);
}
// 如果有房间ID,加载床位选项
if (formData.roomId) {
await loadBedOptions(formData.roomId);
}
}
}
@@ -7,7 +7,7 @@
</template>
<template v-else>
<el-select
v-model="form.name"
v-model="selectedTeacherId"
filterable
remote
reserve-keyword
@@ -75,6 +75,7 @@ export default defineComponent({
setup(props, { emit }) {
const loading = ref(false);
const teacherOptions = ref<any[]>([]);
const selectedTeacherId = ref(''); // 专门用于下拉框选择的字段
// 根据类型获取对话框标题
const getDialogTitle = () => {
@@ -142,7 +143,7 @@ export default defineComponent({
teacherOptions.value = res.data.map((item: any) => {
return {
value: item.value,
label: item.label,
label: item.username ? `${item.label}(${item.username})` : item.label,
username: item.username,
nickName: item.label,
userId: item.value, // 直接使用API返回的value作为userId
@@ -171,11 +172,28 @@ export default defineComponent({
// 确保性别值为数字类型
form.sex = Number(form.sex);
}
// 在编辑模式下,设置选中的教师ID
if (props.mode === 'edit' && newVal.userId) {
selectedTeacherId.value = newVal.userId;
}
}
},
{ deep: true, immediate: true }
);
// 监听选择的教师ID变化
watch(selectedTeacherId, (newVal) => {
if (!newVal) {
// 清空选择时重置相关字段
form.userId = null;
form.name = '';
form.nickName = '';
form.phone = '';
form.sex = 0;
form.remark = '';
}
});
// 选择教师后处理逻辑
const handleTeacherSelect = (value: any) => {
const selectedTeacher = teacherOptions.value.find((item) => item.value === value);
@@ -186,7 +204,7 @@ export default defineComponent({
// 确保性别值为数字类型
form.sex = selectedTeacher.sex !== undefined ? Number(selectedTeacher.sex) : 0;
form.nickName = selectedTeacher.nickName;
form.name = selectedTeacher.label;
form.name = selectedTeacher.nickName; // 存储纯粹的姓名
// form.id = selectedTeacher.userId;
form.remark = '';
console.log('选中教师信息:', selectedTeacher, '转换后性别值:', form.sex);
@@ -218,7 +236,7 @@ export default defineComponent({
teacherOptions.value = res.data.map((item: any) => {
return {
value: item.value,
label: item.label,
label: item.username ? `${item.label}(${item.username})` : item.label,
username: item.username,
userId: item.value,
nickName: item.label,
@@ -258,7 +276,7 @@ export default defineComponent({
teacherOptions.value = res.data.map((item: any) => {
return {
value: item.value,
label: item.label,
label: item.username ? `${item.label}(${item.username})` : item.label,
username: item.username,
userId: item.value,
nickName: item.label,
@@ -337,6 +355,7 @@ export default defineComponent({
formRef,
loading,
teacherOptions,
selectedTeacherId,
rules,
getDialogTitle,
queryTeachers,
File diff suppressed because it is too large. Load diff
+369
View File
@@ -0,0 +1,369 @@
<template>
<div class="p-2 page-container">
<transition :enter-active-class="proxy?.animate.searchAnimate.enter" :leave-active-class="proxy?.animate.searchAnimate.leave">
<div v-show="showSearch" class="mb-[10px]">
<el-card shadow="hover">
<el-form ref="queryFormRef" :model="queryParams" label-width="100px">
<el-row :gutter="20">
<el-col :span="6">
<el-form-item label="学生姓名" prop="studentName">
<el-input v-model="queryParams.studentName" placeholder="请输入学生姓名" clearable @keyup.enter="handleQuery" />
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="学号" prop="studentNo">
<el-input v-model="queryParams.studentNo" placeholder="请输入学号" clearable @keyup.enter="handleQuery" />
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="学院名称" prop="collegeName">
<el-input v-model="queryParams.collegeName" placeholder="请输入学院名称" clearable @keyup.enter="handleQuery" />
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="专业名称" prop="majorName">
<el-input v-model="queryParams.majorName" placeholder="请输入专业名称" clearable @keyup.enter="handleQuery" />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="6">
<el-form-item label="班级名称" prop="className">
<el-input v-model="queryParams.className" placeholder="请输入班级名称" clearable @keyup.enter="handleQuery" />
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="申请类型" prop="applicationType">
<el-select v-model="queryParams.applicationType" placeholder="请选择申请类型" clearable style="width: 100%">
<el-option label="调宿申请" value="1" />
<el-option label="退宿申请" value="2" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="申请时间" prop="applyTime">
<el-date-picker
clearable
v-model="queryParams.applyTime"
type="date"
style="width: 100%"
value-format="YYYY-MM-DD"
placeholder="请选择申请时间"
/>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="审批状态" prop="applicationStatus">
<el-select v-model="queryParams.applicationStatus" placeholder="请选择审批状态" clearable style="width: 100%">
<el-option label="草稿" value="draft" />
<el-option label="待审核" value="waiting" />
<el-option label="已完成" value="finish" />
<el-option label="已撤销" value="cancel" />
<el-option label="已退回" value="back" />
<el-option label="已作废" value="invalid" />
<el-option label="已终止" value="termination" />
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="24" class="search-btn-container">
<el-form-item>
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
<el-button icon="Refresh" @click="resetQuery">重置</el-button>
</el-form-item>
</el-col>
</el-row>
</el-form>
</el-card>
</div>
</transition>
<el-card shadow="never">
<template #header>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button type="primary" plain icon="Plus" @click="handleAdd" v-hasPermi="['dormApplication:dormApplication:add']">新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="success"
plain
icon="Edit"
:disabled="single"
@click="handleUpdate()"
v-hasPermi="['dormApplication:dormApplication:edit']"
>修改</el-button
>
</el-col>
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
</template>
<el-table v-loading="loading" border :data="dormApplicationList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="主键ID" align="center" prop="id" v-if="false" />
<el-table-column label="申请名称" align="center" prop="applicationName" />
<el-table-column label="申请类型" align="center" prop="applicationType">
<template #default="scope">
<dict-tag :options="dorm_application_type" :value="scope.row.applicationType" />
</template>
</el-table-column>
<el-table-column label="学院名称" align="center" prop="collegeName" />
<el-table-column label="专业名称" align="center" prop="majorName" />
<el-table-column label="班级名称" align="center" prop="className" />
<el-table-column label="学生姓名" align="center" prop="studentName" />
<el-table-column label="学号" align="center" prop="studentNo" />
<el-table-column label="申请时间" align="center" prop="applyTime" width="180">
<template #default="scope">
<span>{{ parseTime(scope.row.applyTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
</template>
</el-table-column>
<el-table-column label="审批状态" align="center" prop="applicationStatus">
<template #default="scope">
<dict-tag :options="student_leave_approval_status" :value="scope.row.applicationStatus" />
</template>
</el-table-column>
<el-table-column label="操作" align="center" width="200px" class-name="small-padding fixed-width" fixed="right">
<template #default="scope">
<el-tooltip :content="['draft', 'cancel', 'back'].includes(scope.row.applicationStatus) ? '修改' : '查看'" placement="top">
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['dormApplication:dormApplication:edit']">
{{ ['draft', 'cancel', 'back'].includes(scope.row.applicationStatus) ? '修改' : '查看' }}
</el-button>
</el-tooltip>
<!-- 删除按钮:仅草稿状态可见 -->
<el-tooltip content="删除" placement="top" v-if="scope.row.applicationStatus === 'draft'">
<el-button link type="danger" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['dormApplication:dormApplication:remove']"
>删除</el-button
>
</el-tooltip>
</template>
</el-table-column>
</el-table>
<pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize" @pagination="getList" />
</el-card>
</div>
</template>
<script setup name="DormApplication" lang="ts">
import { ref, reactive, toRefs, onMounted, getCurrentInstance, type ComponentInternalInstance } from 'vue';
import {
listDormApplication,
getDormApplication,
delDormApplication,
addDormApplication,
updateDormApplication
} from '@/api/xg/xsjcxx/xssssq/dormApplication';
import { DormApplicationVO, DormApplicationQuery, DormApplicationForm } from '@/api/xg/xsjcxx/xssssq/types';
// 类型定义
interface DialogOption {
visible: boolean;
title: string;
}
interface ElFormInstance {
validate: (callback?: (valid: boolean) => void) => Promise<boolean>;
resetFields: () => void;
}
interface PageData<T, Q> {
form: T;
queryParams: Q;
rules: Record<string, any>;
}
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
// 加载字典数据
const { dorm_application_type, student_leave_approval_status } = toRefs<any>(
proxy?.useDict('dorm_application_type', 'student_leave_approval_status')
);
const dormApplicationList = ref<DormApplicationVO[]>([]);
const buttonLoading = ref(false);
const loading = ref(true);
const showSearch = ref(true);
const ids = ref<Array<string | number>>([]);
const single = ref(true);
const multiple = ref(true);
const total = ref(0);
const queryFormRef = ref<ElFormInstance>();
const dormApplicationFormRef = ref<ElFormInstance>();
const dialog = reactive<DialogOption>({
visible: false,
title: ''
});
const initFormData: DormApplicationForm = {
id: undefined,
applicationName: undefined,
applicationType: undefined,
applicationStatus: undefined,
studentId: undefined,
studentName: undefined,
studentNo: undefined,
studentPhone: undefined,
collegeId: undefined,
collegeName: undefined,
majorId: undefined,
majorName: undefined,
classId: undefined,
className: undefined,
currentCampusId: undefined,
currentCampusName: undefined,
currentBuildingId: undefined,
currentBuildingName: undefined,
currentRoomId: undefined,
currentRoomNo: undefined,
currentBedId: undefined,
currentBedNo: undefined,
targetCampusId: undefined,
targetCampusName: undefined,
targetBuildingId: undefined,
targetBuildingName: undefined,
targetRoomId: undefined,
targetRoomNo: undefined,
targetBedId: undefined,
targetBedNo: undefined,
reasonDetail: undefined,
applyTime: undefined,
attachmentOssIds: undefined,
remark: undefined,
extField1: undefined,
extField2: undefined,
extField3: undefined
};
const data = reactive<PageData<DormApplicationForm, DormApplicationQuery>>({
form: { ...initFormData },
queryParams: {
pageNum: 1,
pageSize: 10,
applicationName: undefined,
applicationType: undefined,
applicationStatus: undefined,
studentId: undefined,
studentName: undefined,
studentNo: undefined,
studentPhone: undefined,
collegeId: undefined,
collegeName: undefined,
majorId: undefined,
majorName: undefined,
classId: undefined,
className: undefined,
applyTime: undefined,
params: {}
},
rules: {
id: [{ required: true, message: '主键ID不能为空', trigger: 'blur' }],
applicationName: [{ required: true, message: '申请名称不能为空', trigger: 'blur' }],
applicationType: [{ required: true, message: '申请类型不能为空', trigger: 'change' }],
studentId: [{ required: true, message: '申请学生ID不能为空', trigger: 'blur' }],
studentName: [{ required: true, message: '学生姓名不能为空', trigger: 'blur' }],
studentNo: [{ required: true, message: '学号不能为空', trigger: 'blur' }],
collegeId: [{ required: true, message: '学院ID不能为空', trigger: 'blur' }],
reasonDetail: [{ required: true, message: '详细原因说明不能为空', trigger: 'blur' }],
applyTime: [{ required: true, message: '申请时间不能为空', trigger: 'blur' }]
}
});
const { queryParams, form, rules } = toRefs(data);
/** 查询学生宿舍申请单表(调宿+退宿)列表 */
const getList = async () => {
loading.value = true;
const res = await listDormApplication(queryParams.value);
dormApplicationList.value = res.rows;
total.value = res.total;
loading.value = false;
};
/** 取消按钮 */
const cancel = () => {
reset();
dialog.visible = false;
};
/** 表单重置 */
const reset = () => {
form.value = { ...initFormData };
dormApplicationFormRef.value?.resetFields();
};
/** 搜索按钮操作 */
const handleQuery = () => {
queryParams.value.pageNum = 1;
getList();
};
/** 重置按钮操作 */
const resetQuery = () => {
queryFormRef.value?.resetFields();
handleQuery();
};
/** 多选框选中数据 */
const handleSelectionChange = (selection: DormApplicationVO[]) => {
ids.value = selection.map((item) => item.id);
single.value = selection.length != 1;
multiple.value = !selection.length;
};
/** 新增按钮操作 */
const handleAdd = () => {
proxy.$router.push({
path: `/xg/xsjcxx/xssssq/dialog`,
query: {
type: 'add'
}
});
};
/** 修改按钮操作 */
const handleUpdate = async (row?: DormApplicationVO) => {
const _id = row?.id || ids.value[0];
proxy.$router.push({
path: `/xg/xsjcxx/xssssq/dialog`,
query: {
id: _id,
type: 'update'
}
});
};
/** 删除按钮操作 */
const handleDelete = async (row?: DormApplicationVO) => {
const _ids = row?.id || ids.value;
await proxy?.$modal.confirm('是否确认删除学生宿舍申请单编号为"' + _ids + '"的数据项?').finally(() => (loading.value = false));
await delDormApplication(_ids);
proxy?.$modal.msgSuccess('删除成功');
await getList();
};
onMounted(() => {
getList();
});
</script>
<style scoped>
/* 页面容器样式 */
.page-container {
padding: 8px;
}
/* 搜索按钮容器样式 */
.search-btn-container {
display: flex;
justify-content: flex-end;
margin-top: 10px;
}
.search-btn-container .el-form-item {
margin-bottom: 0 !important;
}
</style>
@@ -33,21 +33,21 @@
<el-col :span="6">
<el-form-item label="院系" prop="collegeName">
<el-select v-model="queryParams.collegeName" placeholder="请选择院系" clearable style="width: 100%" @change="handleCollegeChange">
<el-option v-for="college in collegeOptions" :key="college.name" :label="college.name" :value="college.name" />
<el-option v-for="college in collegeOptions" :key="college.value" :label="college.label" :value="college.value" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="专业" prop="majorName">
<el-select v-model="queryParams.majorName" placeholder="请选择专业" clearable style="width: 100%" @change="handleMajorChange">
<el-option v-for="major in majorOptions" :key="major.name" :label="major.name" :value="major.name" />
<el-option v-for="major in majorOptions" :key="major.value" :label="major.label" :value="major.value" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="班级" prop="className">
<el-select v-model="queryParams.className" placeholder="请选择班级" clearable style="width: 100%">
<el-option v-for="classItem in classOptions" :key="classItem.name" :label="classItem.name" :value="classItem.name" />
<el-option v-for="classItem in classOptions" :key="classItem.value" :label="classItem.label" :value="classItem.value" />
</el-select>
</el-form-item>
</el-col>
@@ -106,10 +106,28 @@
<el-tag v-else-if="scope.row.status === 1" type="success">已到访</el-tag>
<el-tag v-else-if="scope.row.status === 2" type="danger">已取消</el-tag>
<el-tag v-else-if="scope.row.status === 3" type="warning">未到访</el-tag>
<el-tag v-else-if="scope.row.status === 4" type="info">待审核</el-tag>
<el-tag v-else-if="scope.row.status === 5" type="danger">已驳回</el-tag>
<el-tag v-else type="info">未知状态</el-tag>
</div>
</template>
</el-table-column>
<el-table-column label="是否需要转介" align="center" prop="needReferral" width="120">
<template #default="scope">
<div v-if="scope.row.status === 1">
<el-tag v-if="scope.row.needReferral === 2" type="warning">是</el-tag>
<el-tag v-else-if="scope.row.needReferral === 1" type="success">否</el-tag>
<span v-else>-</span>
</div>
<span v-else>-</span>
</template>
</el-table-column>
<el-table-column label="本学期到访次数" align="center" prop="semesterVisitCount" width="120">
<template #default="scope">
<el-tag v-if="scope.row.semesterVisitCount > 0" type="info">{{ scope.row.semesterVisitCount }}次</el-tag>
<span v-else>0次</span>
</template>
</el-table-column>
<el-table-column label="创建时间" align="center" prop="createTime" width="150">
<template #default="scope">
<span>{{ parseTime(scope.row.createTime) }}</span>
@@ -129,6 +147,31 @@
></el-button>
</el-tooltip>
<!-- 待审核状态可审核通过或拒绝 -->
<el-tooltip content="审核通过" placement="top" v-if="scope.row.status === 4">
<el-button
link
type="success"
icon="Check"
size="default"
style="font-size: 16px; margin-right: 8px"
@click="handleApprove(scope.row)"
v-hasPermi="['xljk:consultationappointment:edit']"
></el-button>
</el-tooltip>
<el-tooltip content="审核拒绝" placement="top" v-if="scope.row.status === 4">
<el-button
link
type="danger"
icon="Close"
size="default"
style="font-size: 16px; margin-right: 8px"
@click="handleReject(scope.row)"
v-hasPermi="['xljk:consultationappointment:edit']"
></el-button>
</el-tooltip>
<!-- 待咨询状态可记录咨询结果 -->
<el-tooltip content="记录结果" placement="top" v-if="scope.row.status === 0">
<el-button
@@ -161,29 +204,45 @@
<el-descriptions-item label="咨询师">{{ form.counselorName }}</el-descriptions-item>
<el-descriptions-item label="预约日期">{{ parseTime(form.appointmentDate, '{y}-{m}-{d}') }}</el-descriptions-item>
<el-descriptions-item label="预约时段">{{ form.appointmentDetailTime }}</el-descriptions-item>
<el-descriptions-item label="咨询原因" :span="2">{{ form.reason }}</el-descriptions-item>
<el-descriptions-item label="咨询主题">{{ form.consultTheme || '未选择' }}</el-descriptions-item>
<el-descriptions-item label="咨询原因">{{ form.reason }}</el-descriptions-item>
<el-descriptions-item label="状态">
<el-tag v-if="form.status === 0" type="primary">待咨询</el-tag>
<el-tag v-else-if="form.status === 1" type="success">已到访</el-tag>
<el-tag v-else-if="form.status === 2" type="danger">已取消</el-tag>
<el-tag v-else-if="form.status === 3" type="warning">未到访</el-tag>
<el-tag v-else-if="form.status === 4" type="info">待审核</el-tag>
<el-tag v-else-if="form.status === 5" type="danger">已驳回</el-tag>
<el-tag v-else type="info">未知状态({{ form.status }})</el-tag>
</el-descriptions-item>
<el-descriptions-item label="创建时间">{{ parseTime(form.createTime) }}</el-descriptions-item>
<!-- 只有在已到访状态时才显示咨询结果相关字段 -->
<template v-if="form.status == 1">
<el-descriptions-item label="实际到访时间">
{{ form.actualVisitTime ? parseTime(form.actualVisitTime, '{y}-{m}-{d} {h}:{i}:{s}') : '未记录' }}
</el-descriptions-item>
<el-descriptions-item label="沟通时长">
{{ form.communicationDuration ? form.communicationDuration + ' 分钟' : '未记录' }}
</el-descriptions-item>
<el-descriptions-item label="咨询内容" :span="2">
<el-descriptions-item label="心理病史">
<el-tag v-if="form.psychologicalHistory === 2" type="warning">是</el-tag>
<el-tag v-else-if="form.psychologicalHistory === 1" type="success">否</el-tag>
<span v-else>未记录</span>
</el-descriptions-item>
<el-descriptions-item label="心理病史详情" :span="2" v-if="form.psychologicalHistory === 2">
{{ form.psychologicalHistoryDetail || '未记录' }}
</el-descriptions-item>
<el-descriptions-item label="基本情况" :span="2">
{{ form.basicSituation || '未记录' }}
</el-descriptions-item>
<el-descriptions-item label="重大生活事件" :span="2">
{{ form.majorLifeEvents || '未记录' }}
</el-descriptions-item>
<el-descriptions-item label="本次咨询过程" :span="2">
{{ form.consultationContent || '未记录' }}
</el-descriptions-item>
<el-descriptions-item label="咨询师建议" :span="2">
{{ form.counselorSuggestion || '未记录' }}
<el-descriptions-item label="是否需要转介">
<el-tag v-if="form.needReferral === 2" type="warning">是</el-tag>
<el-tag v-else-if="form.needReferral === 1" type="success">否</el-tag>
<span v-else>未记录</span>
</el-descriptions-item>
</template>
</el-descriptions>
@@ -196,8 +255,8 @@
</el-dialog>
<!-- 记录咨询结果对话框 -->
<el-dialog title="记录咨询结果" v-model="recordDialogVisible" width="600px" append-to-body>
<el-form ref="recordFormRef" :model="recordForm" :rules="recordRules" label-width="100px">
<el-dialog title="记录咨询结果" v-model="recordDialogVisible" width="800px" append-to-body>
<el-form ref="recordFormRef" :model="recordForm" :rules="recordRules" label-width="120px">
<el-form-item label="学生姓名">
<el-input v-model="recordForm.studentName" disabled />
</el-form-item>
@@ -215,27 +274,35 @@
</el-form-item>
<!-- 只有在已到访状态时才显示以下字段 -->
<template v-if="recordForm.status === 1">
<el-form-item label="实际到访时间" prop="actualVisitTime" class="no-wrap-label">
<el-date-picker
v-model="recordForm.actualVisitTime"
type="datetime"
placeholder="选择日期时间"
style="width: 100%"
value-format="YYYY-MM-DD HH:mm:ss"
format="YYYY-MM-DD HH:mm:ss"
/>
</el-form-item>
<el-form-item label="沟通时长" prop="communicationDuration">
<div class="flex-row align-center">
<el-input-number v-model="recordForm.communicationDuration" :min="1" :max="180" />
<span class="ml-2">分钟</span>
</div>
</el-form-item>
<el-form-item label="咨询内容" prop="consultationContent">
<el-input v-model="recordForm.consultationContent" type="textarea" placeholder="请输入咨询内容" :rows="4" />
<el-form-item label="心理病史" prop="psychologicalHistory">
<el-radio-group v-model="recordForm.psychologicalHistory" @change="handlePsychologicalHistoryChange">
<el-radio :value="2">是</el-radio>
<el-radio :value="1">否</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="咨询师建议" prop="counselorSuggestion">
<el-input v-model="recordForm.counselorSuggestion" type="textarea" placeholder="请输入咨询师建议" :rows="4" />
<el-form-item label="心理病史详情" prop="psychologicalHistoryDetail" v-if="recordForm.psychologicalHistory === 2">
<el-input v-model="recordForm.psychologicalHistoryDetail" type="textarea" placeholder="请详细描述心理病史" :rows="3" />
</el-form-item>
<el-form-item label="基本情况" prop="basicSituation">
<el-input v-model="recordForm.basicSituation" type="textarea" placeholder="请输入基本情况" :rows="4" />
</el-form-item>
<el-form-item label="重大生活事件" prop="majorLifeEvents">
<el-input v-model="recordForm.majorLifeEvents" type="textarea" placeholder="请输入重大生活事件(可选)" :rows="3" />
</el-form-item>
<el-form-item label="本次咨询过程" prop="consultationContent">
<el-input v-model="recordForm.consultationContent" type="textarea" placeholder="请输入本次咨询过程" :rows="4" />
</el-form-item>
<el-form-item label="是否需要转介" prop="needReferral">
<el-radio-group v-model="recordForm.needReferral" @change="handleReferralChange">
<el-radio :value="2">是</el-radio>
<el-radio :value="1">否</el-radio>
</el-radio-group>
</el-form-item>
</template>
</el-form>
@@ -268,7 +335,8 @@ import {
CounselorOption,
CollegeOption,
MajorOption,
ClassOption
ClassOption,
XljkConsultationAppointmentQuery
} from '@/api/xljk/consultation/types';
import { ElMessage, ElMessageBox } from 'element-plus';
import { parseTime } from '@/utils/ruoyi';
@@ -281,7 +349,9 @@ const appointment_status = ref([
{ label: '待咨询', value: 0 },
{ label: '已到访', value: 1 },
{ label: '已取消', value: 2 },
{ label: '未到访', value: 3 }
{ label: '未到访', value: 3 },
{ label: '待审核', value: 4 },
{ label: '已驳回', value: 5 }
]);
// 遮罩层
@@ -304,19 +374,17 @@ const open = ref(false);
const dateRange = ref<string[]>([]);
// 咨询师选项
const counselorOptions = ref<CounselorOption[]>([]);
// 院系选项
const collegeOptions = ref<CollegeOption[]>([]);
// 专业选项
const majorOptions = ref<MajorOption[]>([]);
// 班级选项
const classOptions = ref<ClassOption[]>([]);
// 修复院系、专业、班级选项的类型定义
const collegeOptions = ref<Array<{ value: string; label: string }>>([]);
const majorOptions = ref<Array<{ value: string; label: string }>>([]);
const classOptions = ref<Array<{ value: string; label: string }>>([]);
// 是否显示记录对话框
const recordDialogVisible = ref(false);
// 提交按钮加载状态
const submitLoading = ref(false);
// 查询参数
const queryParams = reactive({
// 查询参数的类型定义和字段修复
const queryParams = reactive<XljkConsultationAppointmentQuery>({
pageNum: 1,
pageSize: 10,
studentName: undefined,
@@ -339,20 +407,28 @@ const recordForm = reactive<XljkConsultationAppointmentForm>({
scheduleId: undefined,
appointmentDate: '',
appointmentTime: '',
appointmentDetailTime: '',
reason: '',
status: 1, // 默认已到访,使用数值类型
actualVisitTime: undefined,
communicationDuration: 30, // 默认30分钟
consultationContent: '',
counselorSuggestion: ''
counselorSuggestion: '',
studentName: '',
psychologicalHistory: 1, // 默认否
psychologicalHistoryDetail: '',
basicSituation: '',
majorLifeEvents: '',
needReferral: 1 // 默认不需要转介
});
// 记录表单校验
const recordRules = ref({
// 修复表单验证规则的类型定义
const recordRules = ref<any>({
status: [{ required: true, message: '请选择咨询结果', trigger: 'change' }],
actualVisitTime: [{ required: true, message: '请选择实际到访时间', trigger: 'change' }],
communicationDuration: [{ required: true, message: '请输入沟通时长', trigger: 'blur' }],
consultationContent: [{ required: true, message: '请输入咨询内容', trigger: 'blur' }]
psychologicalHistory: [{ required: true, message: '请选择心理病史', trigger: 'change' }],
basicSituation: [{ required: true, message: '请输入基本情况', trigger: 'blur' }],
consultationContent: [{ required: true, message: '请输入本次咨询过程', trigger: 'blur' }],
needReferral: [{ required: true, message: '请选择是否需要转介', trigger: 'change' }]
});
// 监听状态变化,动态调整表单验证规则
@@ -368,9 +444,11 @@ watch(
// 已到访
recordRules.value = {
status: [{ required: true, message: '请选择咨询结果', trigger: 'change' }],
actualVisitTime: [{ required: true, message: '请选择实际到访时间', trigger: 'change' }],
communicationDuration: [{ required: true, message: '请输入沟通时长', trigger: 'blur' }],
consultationContent: [{ required: true, message: '请输入咨询内容', trigger: 'blur' }]
psychologicalHistory: [{ required: true, message: '请选择心理病史', trigger: 'change' }],
basicSituation: [{ required: true, message: '请输入基本情况', trigger: 'blur' }],
consultationContent: [{ required: true, message: '请输入本次咨询过程', trigger: 'blur' }],
needReferral: [{ required: true, message: '请选择是否需要转介', trigger: 'change' }]
};
}
}
@@ -384,7 +462,9 @@ const getList = async () => {
loading.value = true;
try {
// 处理日期范围
queryParams.params = {};
if (!queryParams.params) {
queryParams.params = {};
}
if (dateRange.value && dateRange.value.length === 2) {
queryParams.params.beginAppointmentDate = dateRange.value[0];
queryParams.params.endAppointmentDate = dateRange.value[1];
@@ -503,24 +583,13 @@ const handleView = async (row: XljkConsultationAppointmentVO) => {
console.log('转换后的status:', form.status);
}
// 检查实际到访时间
console.log('实际到访时间:', form.actualVisitTime);
if (form.status === 1 && !form.actualVisitTime) {
console.warn('已到访状态但实际到访时间为空,尝试使用行数据');
if (row.actualVisitTime) {
form.actualVisitTime = row.actualVisitTime;
console.log('使用行数据的实际到访时间:', form.actualVisitTime);
} else {
console.warn('行数据也没有实际到访时间');
}
}
console.log('复制后的表单数据:', form);
// 如果是已到访状态,确保咨询结果相关字段有值
if (form.status === 1) {
console.log('已到访状态,咨询结果相关字段:', {
actualVisitTime: form.actualVisitTime,
communicationDuration: form.communicationDuration,
consultationContent: form.consultationContent,
counselorSuggestion: form.counselorSuggestion
@@ -558,6 +627,58 @@ const handleView = async (row: XljkConsultationAppointmentVO) => {
}
};
/** 审核通过操作 */
const handleApprove = async (row: XljkConsultationAppointmentVO) => {
try {
await ElMessageBox.confirm('确认审核通过该预约申请?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
});
// 构建更新数据
const updateData = {
id: row.id,
status: "0" // 审核通过,状态改为待咨询
};
await updateXljkAppointment(updateData);
ElMessage.success('审核通过成功');
getList();
} catch (error) {
if (error !== 'cancel') {
console.error('审核通过失败', error);
ElMessage.error('审核通过失败');
}
}
};
/** 审核拒绝操作 */
const handleReject = async (row: XljkConsultationAppointmentVO) => {
try {
await ElMessageBox.confirm('确认拒绝该预约申请?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
});
// 构建更新数据
const updateData = {
id: row.id,
status: "5" // 拒绝,状态改为已驳回
};
await updateXljkAppointment(updateData);
ElMessage.success('审核拒绝成功');
getList();
} catch (error) {
if (error !== 'cancel') {
console.error('审核拒绝失败', error);
ElMessage.error('审核拒绝失败');
}
}
};
/** 记录咨询结果操作 */
const handleRecord = async (row: XljkConsultationAppointmentVO) => {
try {
@@ -575,10 +696,15 @@ const handleRecord = async (row: XljkConsultationAppointmentVO) => {
appointmentDetailTime: '',
reason: '',
status: 1, // 默认已完成
actualVisitTime: new Date(),
communicationDuration: 30,
consultationContent: '',
counselorSuggestion: ''
counselorSuggestion: '',
studentName: '',
psychologicalHistory: 1, // 默认否(1=否,2=是)
psychologicalHistoryDetail: '',
basicSituation: '',
majorLifeEvents: '',
needReferral: 1 // 默认不需要转介(1=不需要,2=需要)
};
Object.assign(recordForm, defaultValues);
@@ -594,6 +720,16 @@ const handleRecord = async (row: XljkConsultationAppointmentVO) => {
recordForm.appointmentDetailTime = res.data.appointmentDetailTime;
recordForm.reason = res.data.reason;
recordForm.studentName = res.data.studentName;
// 如果API返回了已有的咨询记录数据,保持原有值
if (res.data.needReferral !== undefined && res.data.needReferral !== null) {
recordForm.needReferral = res.data.needReferral;
console.log('从API获取的needReferral值:', res.data.needReferral, res.data.needReferral === 2 ? '是(需要转介)' : res.data.needReferral === 1 ? '否(不需要转介)' : '未知状态');
}
if (res.data.psychologicalHistory !== undefined && res.data.psychologicalHistory !== null) {
recordForm.psychologicalHistory = res.data.psychologicalHistory;
console.log('从API获取的psychologicalHistory值:', res.data.psychologicalHistory, res.data.psychologicalHistory === 2 ? '是(有病史)' : res.data.psychologicalHistory === 1 ? '否(无病史)' : '未知状态');
}
} else {
console.warn('API响应格式不正确或无数据:', res);
// 使用行数据填充
@@ -608,6 +744,7 @@ const handleRecord = async (row: XljkConsultationAppointmentVO) => {
}
console.log('填充后的记录表单:', recordForm);
console.log('最终needReferral值:', recordForm.needReferral, recordForm.needReferral === 2 ? '是(需要转介)' : recordForm.needReferral === 1 ? '否(不需要转介)' : '未知状态');
recordDialogVisible.value = true;
} catch (error) {
console.error('获取预约详情失败', error);
@@ -625,6 +762,8 @@ const submitRecordForm = async () => {
try {
submitLoading.value = true;
console.log('提交前的recordForm数据:', recordForm);
// 构建提交数据
const submitData: any = {
id: recordForm.id,
@@ -633,39 +772,59 @@ const submitRecordForm = async () => {
// 如果是已到访状态,添加其他字段
if (recordForm.status === 1) {
// 确保日期格式正确
if (recordForm.actualVisitTime) {
// 如果是Date对象,转换为ISO字符串格式
if (recordForm.actualVisitTime instanceof Date) {
const year = recordForm.actualVisitTime.getFullYear();
const month = String(recordForm.actualVisitTime.getMonth() + 1).padStart(2, '0');
const day = String(recordForm.actualVisitTime.getDate()).padStart(2, '0');
const hours = String(recordForm.actualVisitTime.getHours()).padStart(2, '0');
const minutes = String(recordForm.actualVisitTime.getMinutes()).padStart(2, '0');
const seconds = String(recordForm.actualVisitTime.getSeconds()).padStart(2, '0');
submitData.actualVisitTime = `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
} else {
submitData.actualVisitTime = recordForm.actualVisitTime;
}
console.log('提交的实际到访时间:', submitData.actualVisitTime);
}
submitData.communicationDuration = recordForm.communicationDuration;
submitData.consultationContent = recordForm.consultationContent;
submitData.counselorSuggestion = recordForm.counselorSuggestion;
submitData.counselorSuggestion = recordForm.counselorSuggestion || '';
submitData.psychologicalHistory = recordForm.psychologicalHistory;
submitData.psychologicalHistoryDetail = recordForm.psychologicalHistoryDetail || '';
submitData.basicSituation = recordForm.basicSituation;
submitData.majorLifeEvents = recordForm.majorLifeEvents || '';
submitData.needReferral = recordForm.needReferral;
console.log('已到访状态,提交的数据字段:');
console.log('- psychologicalHistoryDetail:', submitData.psychologicalHistoryDetail, '类型:', typeof submitData.psychologicalHistoryDetail, '长度:', submitData.psychologicalHistoryDetail?.length);
console.log('- basicSituation:', submitData.basicSituation, '类型:', typeof submitData.basicSituation, '长度:', submitData.basicSituation?.length);
console.log('- majorLifeEvents:', submitData.majorLifeEvents, '类型:', typeof submitData.majorLifeEvents, '长度:', submitData.majorLifeEvents?.length);
console.log('- needReferral:', submitData.needReferral, '类型:', typeof submitData.needReferral);
console.log('- psychologicalHistory:', submitData.psychologicalHistory, '类型:', typeof submitData.psychologicalHistory);
} else {
// 未到访状态,设置默认值
submitData.actualVisitTime = null;
submitData.communicationDuration = 0;
submitData.consultationContent = '';
submitData.counselorSuggestion = '';
submitData.psychologicalHistory = null;
submitData.psychologicalHistoryDetail = '';
submitData.basicSituation = '';
submitData.majorLifeEvents = '';
submitData.needReferral = null;
}
await recordXljkConsultation(recordForm.id as number, submitData);
console.log('最终提交的数据:', submitData);
const response = await recordXljkConsultation(recordForm.id as number, submitData);
console.log('API响应:', response);
ElMessage.success('记录成功');
recordDialogVisible.value = false;
getList();
// 重新查询列表,并验证数据是否保存成功
await getList();
// 验证数据保存情况
try {
const verifyRes = await getXljkAppointment(recordForm.id as number);
console.log('验证保存结果,获取的数据:', verifyRes.data);
if (verifyRes.code === 200 && verifyRes.data) {
console.log('验证字段保存情况:');
console.log('- psychologicalHistoryDetail 保存值:', verifyRes.data.psychologicalHistoryDetail);
console.log('- basicSituation 保存值:', verifyRes.data.basicSituation);
console.log('- majorLifeEvents 保存值:', verifyRes.data.majorLifeEvents);
console.log('- needReferral 保存值:', verifyRes.data.needReferral);
console.log('- psychologicalHistory 保存值:', verifyRes.data.psychologicalHistory);
}
} catch (error) {
console.error('验证保存结果失败:', error);
}
} catch (error) {
console.error('提交记录失败', error);
ElMessage.error('提交记录失败');
@@ -710,8 +869,8 @@ const handleDelete = async (row?: XljkConsultationAppointmentVO) => {
/** 导出按钮操作 */
const handleExport = async () => {
// 构建查询参数,处理日期范围和params对象
const exportParams = { ...queryParams };
// 构建查询参数,处理日期范围
const exportParams: any = { ...queryParams };
delete exportParams.params; // 移除params对象
// 将日期范围添加到参数中
@@ -771,7 +930,7 @@ const handleExport = async () => {
a.click();
window.URL.revokeObjectURL(url);
document.body.removeChild(a);
} catch (error) {
} catch (error: any) {
console.error('导出失败:', error);
ElMessage.error(`导出失败: ${error.message}`);
}
@@ -788,7 +947,7 @@ const handleCollegeChange = async (collegeName: string) => {
if (collegeName) {
// 获取该院系下的专业
try {
const res = await getMajorOptions(collegeName);
const res = await getXljkConsultationMajorOptions(collegeName);
majorOptions.value = res.data || [];
} catch (error) {
console.error('获取专业选项失败', error);
@@ -808,7 +967,7 @@ const handleMajorChange = async (majorName: string) => {
if (majorName && queryParams.collegeName) {
// 获取专业下的班级
try {
const res = await getClassOptions(queryParams.collegeName, majorName);
const res = await getXljkConsultationClassOptions(queryParams.collegeName, majorName);
classOptions.value = res.data || [];
} catch (error) {
console.error('获取班级选项失败', error);
@@ -816,7 +975,7 @@ const handleMajorChange = async (majorName: string) => {
} else if (queryParams.collegeName) {
// 如果清空专业但有院系,则获取院系下所有班级
try {
const res = await getClassOptions(queryParams.collegeName);
const res = await getXljkConsultationClassOptions(queryParams.collegeName);
classOptions.value = res.data || [];
} catch (error) {
console.error('获取班级选项失败', error);
@@ -827,6 +986,18 @@ const handleMajorChange = async (majorName: string) => {
}
};
/** 转介选择变化时的调试日志 */
const handleReferralChange = (value: number) => {
console.log('转介字段值变化:', value, value === 2 ? '是(需要转介)' : value === 1 ? '否(不需要转介)' : '未知状态');
console.log('当前recordForm.needReferral:', recordForm.needReferral);
};
/** 心理病史选择变化时的调试日志 */
const handlePsychologicalHistoryChange = (value: number) => {
console.log('心理病史字段值变化:', value, value === 2 ? '是(有心理病史)' : value === 1 ? '否(无心理病史)' : '未知状态');
console.log('当前recordForm.psychologicalHistory:', recordForm.psychologicalHistory);
};
// 初始化
onMounted(() => {
console.log('初始化appointment_status字典数据:', appointment_status.value);
@@ -33,56 +33,75 @@
</div>
</div>
<!-- 表格内容:显示全天和时间段 -->
<!-- 表格内容:显示时间段 -->
<div class="week-body">
<div class="time-row">
<div class="time-label-cell">
<span>全天</span>
</div>
<div v-for="day in weekDays" :key="day.date" class="day-cell">
<!-- 这里可以放全天事件,目前为空 -->
</div>
</div>
<!-- 时间段行 -->
<div class="time-slots-container">
<!-- 上午时段 -->
<div class="time-row">
<div class="time-label-cell">
<span>上午</span>
</div>
<div v-for="day in weekDays" :key="day.date" class="day-cell">
<div
v-if="getMorningSlot(day.date)"
class="time-slot-card morning"
:class="{
'fully-booked': getMorningSlot(day.date).allBooked || getMorningSlot(day.date).isExpired
}"
@click="handleSlotClick(getMorningSlot(day.date))"
>
{{ getMorningSlot(day.date).startTime }}-{{ getMorningSlot(day.date).endTime }}
<!-- 动态显示所有排班时段 -->
<template v-for="timeSlotType in getUniqueTimeSlots()" :key="timeSlotType">
<div class="time-row">
<div class="time-label-cell">
<span>{{ getTimeSlotLabel(timeSlotType) }}</span>
</div>
<div v-for="day in weekDays" :key="day.date" class="day-cell">
<div
v-for="schedule in getSchedulesForDateAndTimeSlot(day.date, timeSlotType)"
:key="`${schedule.scheduleId}-${schedule.startTime}`"
class="time-slot-card"
:class="{
'morning': schedule.timeSlot === '0',
'noon': schedule.timeSlot === '1',
'afternoon': schedule.timeSlot === '2',
'fully-booked': schedule.isFullyBooked || schedule.isExpired
}"
@click="handleScheduleClickEvent(schedule)"
>
{{ schedule.startTime }}-{{ schedule.endTime }}
</div>
</div>
</div>
</div>
</template>
<!-- 下午时段 -->
<div class="time-row">
<div class="time-label-cell">
<span>下午</span>
</div>
<div v-for="day in weekDays" :key="day.date" class="day-cell">
<div
v-if="getAfternoonSlot(day.date)"
class="time-slot-card afternoon"
:class="{
'fully-booked': getAfternoonSlot(day.date).allBooked || getAfternoonSlot(day.date).isExpired
}"
@click="handleSlotClick(getAfternoonSlot(day.date))"
>
{{ getAfternoonSlot(day.date).startTime }}-{{ getAfternoonSlot(day.date).endTime }}
<!-- 兼容性:如果没有新排班数据,继续显示原有的中午/下午时段 -->
<template v-if="getUniqueTimeSlots().length === 0">
<!-- 中午时段 -->
<div class="time-row">
<div class="time-label-cell">
<span>中午</span>
</div>
<div v-for="day in weekDays" :key="day.date" class="day-cell">
<div
v-if="getMorningSlot(day.date)"
class="time-slot-card morning"
:class="{
'fully-booked': getMorningSlot(day.date).allBooked || getMorningSlot(day.date).isExpired
}"
@click="handleSlotClick(getMorningSlot(day.date))"
>
{{ getMorningSlot(day.date).startTime }}-{{ getMorningSlot(day.date).endTime }}
</div>
</div>
</div>
</div>
<!-- 下午时段 -->
<div class="time-row">
<div class="time-label-cell">
<span>下午</span>
</div>
<div v-for="day in weekDays" :key="day.date" class="day-cell">
<div
v-if="getAfternoonSlot(day.date)"
class="time-slot-card afternoon"
:class="{
'fully-booked': getAfternoonSlot(day.date).allBooked || getAfternoonSlot(day.date).isExpired
}"
@click="handleSlotClick(getAfternoonSlot(day.date))"
>
{{ getAfternoonSlot(day.date).startTime }}-{{ getAfternoonSlot(day.date).endTime }}
</div>
</div>
</div>
</template>
</div>
</div>
</div>
@@ -111,25 +130,44 @@
>
<div class="month-day-number">{{ day.dayNumber }}</div>
<!-- 上午时段 -->
<!-- 显示该日期的所有排班 -->
<div
v-if="getMorningSlot(day.date)"
class="month-slot morning"
:class="{ 'fully-booked': getMorningSlot(day.date).allBooked || getMorningSlot(day.date).isExpired }"
@click.stop="handleSlotClick(getMorningSlot(day.date))"
v-for="schedule in getSchedulesForDate(day.date)"
:key="`${schedule.scheduleId}-${schedule.startTime}`"
class="month-slot"
:class="{
'morning': schedule.timeSlot === '0',
'noon': schedule.timeSlot === '1',
'afternoon': schedule.timeSlot === '2',
'fully-booked': schedule.isFullyBooked || schedule.isExpired
}"
@click.stop="handleScheduleClickEvent(schedule)"
>
上午 {{ getMorningSlot(day.date).startTime }}-{{ getMorningSlot(day.date).endTime }}
{{ schedule.timeDisplay }}
</div>
<!-- 下午时段 -->
<div
v-if="getAfternoonSlot(day.date)"
class="month-slot afternoon"
:class="{ 'fully-booked': getAfternoonSlot(day.date).allBooked || getAfternoonSlot(day.date).isExpired }"
@click.stop="handleSlotClick(getAfternoonSlot(day.date))"
>
下午 {{ getAfternoonSlot(day.date).startTime }}-{{ getAfternoonSlot(day.date).endTime }}
</div>
<!-- 兼容性:如果没有新排班数据,继续显示原有的中午/下午时段 -->
<template v-if="getSchedulesForDate(day.date).length === 0">
<!-- 中午时段 -->
<div
v-if="getMorningSlot(day.date)"
class="month-slot morning"
:class="{ 'fully-booked': getMorningSlot(day.date).allBooked || getMorningSlot(day.date).isExpired }"
@click.stop="handleSlotClick(getMorningSlot(day.date))"
>
中午 {{ getMorningSlot(day.date).startTime }}-{{ getMorningSlot(day.date).endTime }}
</div>
<!-- 下午时段 -->
<div
v-if="getAfternoonSlot(day.date)"
class="month-slot afternoon"
:class="{ 'fully-booked': getAfternoonSlot(day.date).allBooked || getAfternoonSlot(day.date).isExpired }"
@click.stop="handleSlotClick(getAfternoonSlot(day.date))"
>
下午 {{ getAfternoonSlot(day.date).startTime }}-{{ getAfternoonSlot(day.date).endTime }}
</div>
</template>
</div>
</div>
</div>
@@ -142,7 +180,7 @@ import { ref, computed, onMounted, watch } from 'vue';
import { parseTime } from '@/utils/ruoyi';
import { ElMessage } from 'element-plus';
import { ArrowLeft, ArrowRight } from '@element-plus/icons-vue';
import { AvailableTimeSlot } from '@/api/xljk/consultation/types';
import { AvailableTimeSlot, ScheduleWithStatus } from '@/api/xljk/consultation/types';
// 定义组件的Props
const props = defineProps({
@@ -150,6 +188,10 @@ const props = defineProps({
type: Array as () => AvailableTimeSlot[],
default: () => []
},
calendarSchedules: {
type: Array as () => ScheduleWithStatus[],
default: () => []
},
defaultView: {
type: String,
default: 'week',
@@ -158,7 +200,7 @@ const props = defineProps({
});
// 定义组件的事件
const emit = defineEmits(['dateRangeChange', 'slotClick', 'viewChange']);
const emit = defineEmits(['dateRangeChange', 'slotClick', 'scheduleClick', 'viewChange']);
// 当前日期和周期的开始日期
const today = ref(new Date());
@@ -382,7 +424,7 @@ const monthDays = computed(() => {
// 如果是最后一行,添加额外日志
if (week === 5) {
console.log(`日期 ${formattedDate} (${date.toLocaleDateString()}) 数据状态:`, {
上午时段: morningSlot ? '有数据' : '无数据',
中午时段: morningSlot ? '有数据' : '无数据',
下午时段: afternoonSlot ? '有数据' : '无数据',
isOtherMonth
});
@@ -412,7 +454,7 @@ function formatDate(date: Date) {
return parseTime(date, '{y}-{m}-{d}');
}
// 获取指定日期的上午时段
// 获取指定日期的中午时段
function getMorningSlot(dateStr: string) {
return props.availableSlots.find((slot) => slot.date === dateStr && slot.timeSlot === '0');
}
@@ -422,6 +464,76 @@ function getAfternoonSlot(dateStr: string) {
return props.availableSlots.find((slot) => slot.date === dateStr && slot.timeSlot === '1');
}
// 获取指定日期的所有排班
function getSchedulesForDate(dateStr: string) {
return props.calendarSchedules.filter(schedule => schedule.date === dateStr)
.sort((a, b) => {
// 先按时段类型排序
const timeSlotCompare = a.timeSlot.localeCompare(b.timeSlot);
if (timeSlotCompare !== 0) return timeSlotCompare;
// 再按开始时间排序
return a.startTime.localeCompare(b.startTime);
});
}
// 处理排班点击
function handleScheduleClickEvent(schedule: ScheduleWithStatus) {
if (!schedule) return;
// 如果该时段已过期,则不允许预约
if (schedule.isExpired) {
ElMessage.warning('该时段已过期,请选择其他时段');
return;
}
// 如果该时段全部约满,则不允许预约
if (schedule.isFullyBooked) {
ElMessage.warning('该时段已全部约满,请选择其他时段');
return;
}
emit('scheduleClick', schedule);
}
// 获取所有唯一的时段类型
function getUniqueTimeSlots() {
const timeSlots = new Set<string>();
props.calendarSchedules.forEach(schedule => {
timeSlots.add(schedule.timeSlot);
});
return Array.from(timeSlots).sort();
}
// 获取时段类型标签
function getTimeSlotLabel(timeSlot: string) {
switch (timeSlot) {
case '0': return '中午';
case '1': return '下午';
case '2': return '下午';
default: return '时段' + timeSlot;
}
}
// 获取指定日期和时段类型的排班
function getSchedulesForDateAndTimeSlot(dateStr: string, timeSlot: string) {
const result = props.calendarSchedules
.filter(schedule => schedule.date === dateStr && schedule.timeSlot === timeSlot)
.sort((a, b) => a.startTime.localeCompare(b.startTime));
// 特别调试9月18日time_slot=0的情况
if (dateStr === '2025-09-18' && timeSlot === '0') {
console.log('🔍 WeekView调试 - getSchedulesForDateAndTimeSlot:', {
dateStr,
timeSlot,
totalSchedules: props.calendarSchedules.length,
filteredResult: result,
resultCount: result.length
});
}
return result;
}
// 监听视图变化
watch(
() => props.defaultView,
@@ -551,12 +663,18 @@ watch(
background-color: #67c23a;
}
.time-slot-card.noon {
background-color: #e6a23c;
}
.time-slot-card.fully-booked {
background-color: #c0c0c0;
cursor: not-allowed;
opacity: 0.7;
}
/* 月视图样式 */
.month-grid {
flex: 1;
@@ -645,9 +763,15 @@ watch(
background-color: #67c23a;
}
.month-slot.noon {
background-color: #e6a23c;
}
.month-slot.fully-booked {
background-color: #c0c0c0;
cursor: not-allowed;
opacity: 0.7;
}
</style>
@@ -19,9 +19,11 @@
<!-- 使用WeekView组件,支持月视图和周视图切换 -->
<WeekView
:available-slots="availableSlots"
:calendar-schedules="calendarSchedules"
:default-view="calendarView"
@date-range-change="handleDateRangeChange"
@slot-click="handleSlotClick"
@schedule-click="handleScheduleClick"
@view-change="handleViewChange"
/>
</div>
@@ -35,27 +37,31 @@
<el-form-item label="咨询师" prop="counselorId">
<el-input v-model="counselorDisplayName" disabled />
</el-form-item>
<el-form-item label="办公室" prop="office">
<el-input v-model="selectedOffice" disabled />
</el-form-item>
<el-form-item label="预约日期" prop="appointmentDate">
<el-input v-model="formattedDate" disabled />
</el-form-item>
<el-form-item label="姓名" prop="studentName">
<el-input v-model="studentName" disabled />
</el-form-item>
<el-form-item label="预约时段" prop="appointmentDetailTime">
<el-select v-model="appointmentForm.appointmentDetailTime" placeholder="请选择具体预约时段" style="width: 100%">
<el-input v-model="appointmentForm.appointmentDetailTime" disabled />
</el-form-item>
<el-form-item label="咨询主题" prop="consultTheme">
<el-select v-model="appointmentForm.consultTheme" placeholder="请选择咨询主题*" style="width: 100%">
<el-option
v-for="slot in availableDetailSlots"
:key="slot.timeSlot"
:label="slot.timeSlot"
:value="slot.timeSlot"
:disabled="slot.isBooked || slot.isExpired"
:style="getTimeSlotStyle(slot)"
v-for="theme in xljk_consult_theme"
:key="theme.value"
:label="theme.label"
:value="theme.value"
/>
</el-select>
</el-form-item>
<el-form-item label="学号" prop="studentNo" v-if="!hasStudentInfo">
<el-input v-model="studentNo" placeholder="请输入学号" @blur="handleStudentNoBlur" />
</el-form-item>
<el-form-item label="姓名" prop="studentName">
<el-input v-model="studentName" disabled />
</el-form-item>
<el-form-item label="咨询原因" prop="reason">
<el-input v-model="appointmentForm.reason" type="textarea" placeholder="请简要描述咨询原因" :rows="4" />
</el-form-item>
@@ -69,13 +75,14 @@
</el-dialog>
<!-- 我的预约列表弹窗 -->
<el-dialog v-model="myAppointmentsVisible" title="我的预约记录" width="800px" append-to-body destroy-on-close>
<el-table :data="myAppointmentsList" border style="width: 100%">
<el-table-column label="预约日期" prop="appointmentDate" width="120" />
<el-table-column label="预约时段" prop="appointmentDetailTime" width="120" />
<el-table-column label="咨询师" prop="counselorName" width="100" />
<el-table-column label="咨询原因" prop="reason" show-overflow-tooltip />
<el-table-column label="状态" prop="status" width="100">
<el-dialog v-model="myAppointmentsVisible" title="我的预约记录" width="1200px" append-to-body destroy-on-close>
<el-table :data="myAppointmentsList" border style="width: 100%" header-align="center">
<el-table-column label="预约日期" prop="appointmentDate" width="120" align="center" />
<el-table-column label="预约时段" prop="appointmentDetailTime" width="140" align="center" />
<el-table-column label="咨询师" prop="counselorName" width="100" align="center" />
<el-table-column label="办公室" prop="office" width="200" show-overflow-tooltip header-align="center" />
<el-table-column label="咨询原因" prop="reason" min-width="200" show-overflow-tooltip header-align="center" />
<el-table-column label="状态" prop="status" width="100" align="center">
<template #default="scope">
<!-- 添加调试信息 -->
<div style="display: none">状态值: {{ scope.row.status }} 类型: {{ typeof scope.row.status }} 字典数据: {{ appointment_status }}</div>
@@ -85,6 +92,8 @@
<el-tag v-else-if="scope.row.status === 1 || scope.row.status === '1'" type="success">已到访</el-tag>
<el-tag v-else-if="scope.row.status === 2 || scope.row.status === '2'" type="danger">已取消</el-tag>
<el-tag v-else-if="scope.row.status === 3 || scope.row.status === '3'" type="warning">未到访</el-tag>
<el-tag v-else-if="scope.row.status === 4 || scope.row.status === '4'" type="info">待审核</el-tag>
<el-tag v-else-if="scope.row.status === 5 || scope.row.status === '5'" type="danger">已驳回</el-tag>
<el-tag v-else type="info">未知({{ scope.row.status }})</el-tag>
</template>
</el-table-column>
@@ -96,7 +105,7 @@
</div>
<!-- 使用更直接的方式显示取消按钮 -->
<template v-if="scope.row.status === 0 || scope.row.status === '0'">
<template v-if="scope.row.status === 0 || scope.row.status === '0' || scope.row.status === 4 || scope.row.status === '4'">
<el-button link type="danger" size="small" @click="cancelAppointment(scope.row)"> 取消预约 </el-button>
</template>
<span v-else>--</span>
@@ -117,6 +126,7 @@
import { ref, reactive, onMounted, computed, watch } from 'vue';
import {
getXljkAvailableTimeSlots,
getXljkCalendarSchedules,
submitXljkAppointment,
getXljkMyAppointments,
updateXljkAppointment,
@@ -124,7 +134,7 @@ import {
getXljkCounselorOptions,
getXljkAvailableDetailSlots
} from '@/api/xljk/consultation';
import { AvailableTimeSlot, XljkConsultationAppointmentForm, CounselorOption, TimeSlotDetail } from '@/api/xljk/consultation/types';
import { AvailableTimeSlot, XljkConsultationAppointmentForm, CounselorOption, TimeSlotDetail, ScheduleWithStatus } from '@/api/xljk/consultation/types';
import { ElMessage, ElMessageBox } from 'element-plus';
import { parseTime } from '@/utils/ruoyi';
import { useUserStore } from '@/store/modules/user';
@@ -134,12 +144,17 @@ const { proxy } = getCurrentInstance() as any;
// 不再使用后端字典数据
// const { appointment_status } = toRefs(proxy?.useDict('appointment_status'));
// 获取咨询主题字典数据
const { xljk_consult_theme } = toRefs<any>(proxy?.useDict('xljk_consult_theme'));
// 本地定义状态字典(与预约记录管理页面保持一致)
const appointment_status = ref([
{ label: '待咨询', value: 0, listClass: 'primary' },
{ label: '已到访', value: 1, listClass: 'success' },
{ label: '已取消', value: 2, listClass: 'danger' },
{ label: '未到访', value: 3, listClass: 'warning' }
{ label: '未到访', value: 3, listClass: 'warning' },
{ label: '待审核', value: 4, listClass: 'info' },
{ label: '已驳回', value: 5, listClass: 'danger' }
]);
// 用户信息
@@ -150,6 +165,7 @@ const hasStudentInfo = computed(() => Boolean(studentId.value));
// 日历相关
const availableSlots = ref<AvailableTimeSlot[]>([]);
const calendarSchedules = ref<ScheduleWithStatus[]>([]);
const calendarView = ref('month'); // 默认使用月视图
// 预约表单相关
@@ -161,6 +177,7 @@ const studentNo = ref('');
const studentName = ref('');
const studentId = ref<string | number | null>(null);
const availableDetailSlots = ref<TimeSlotDetail[]>([]);
const selectedOffice = ref(''); // 添加办公室字段
const appointmentForm = reactive<XljkConsultationAppointmentForm>({
counselorId: undefined,
@@ -168,6 +185,7 @@ const appointmentForm = reactive<XljkConsultationAppointmentForm>({
appointmentDate: '',
appointmentTime: '',
appointmentDetailTime: '',
consultTheme: '', // 咨询主题
reason: '',
status: 0 // 默认待咨询状态,使用数值类型
});
@@ -175,7 +193,7 @@ const appointmentForm = reactive<XljkConsultationAppointmentForm>({
const appointmentRules = {
reason: [{ required: true, message: '请输入咨询原因', trigger: 'blur' }],
studentNo: [{ required: true, message: '请输入学号', trigger: 'blur' }],
appointmentDetailTime: [{ required: true, message: '请选择具体预约时段', trigger: 'change' }]
consultTheme: [{ required: true, message: '请选择咨询主题', trigger: 'change' }]
};
// 我的预约相关
@@ -196,7 +214,13 @@ const formattedTimeSlot = computed(() => {
// 计算属性:咨询师名称
const counselorDisplayName = computed(() => {
return selectedSlot.value?.counselorName || '正在加载...';
if (selectedSlot.value?.counselorName) {
return selectedSlot.value.counselorName;
}
if (selectedSlot.value?.counselorId) {
return '正在加载...';
}
return '请选择咨询师';
});
// 处理日期范围变化
@@ -230,27 +254,52 @@ function handleViewChange(view: string) {
// 加载可用预约时段
async function loadAvailableSlots(startDate: string, endDate: string) {
try {
// 加载新的排班数据
const scheduleRes = await getXljkCalendarSchedules(startDate, endDate);
if (scheduleRes.code === 200) {
calendarSchedules.value = scheduleRes.data || [];
}
// 为了兼容现有逻辑,同时保留原有的时段数据加载
const res = await getXljkAvailableTimeSlots(startDate, endDate);
if (res.code === 200) {
availableSlots.value = res.data || [];
// 如果有可用时段但没有咨询师姓名,尝试加载咨询师信息
if (availableSlots.value.length > 0 && !availableSlots.value[0].counselorName) {
try {
const counselorRes = await getXljkCounselorOptions();
if (counselorRes.code === 200 && counselorRes.data) {
const counselors = counselorRes.data;
// 为每个时段添加咨询师姓名
availableSlots.value = availableSlots.value.map((slot) => {
const counselor = counselors.find((c: CounselorOption) => c.id === slot.counselorId);
if (counselor) {
return { ...slot, counselorName: counselor.name };
}
return slot;
});
// 如果有可用时段,检查并补充咨询师姓名
if (availableSlots.value.length > 0) {
// 检查是否有时段缺少咨询师姓名或办公室信息
const hasMissingCounselorInfo = availableSlots.value.some(slot =>
(!slot.counselorName || !slot.office) && slot.counselorId
);
if (hasMissingCounselorInfo) {
try {
console.log('检测到缺少咨询师信息,开始获取咨询师详细信息...');
const counselorRes = await getXljkCounselorOptions();
if (counselorRes.code === 200 && counselorRes.data) {
const counselors = counselorRes.data;
console.log('获取到咨询师列表:', counselors);
// 为每个时段添加咨询师姓名和办公室信息
availableSlots.value = availableSlots.value.map((slot) => {
if ((!slot.counselorName || !slot.office) && slot.counselorId) {
const counselor = counselors.find((c: CounselorOption) => c.id === slot.counselorId);
if (counselor) {
const updatedSlot = {
...slot,
counselorName: slot.counselorName || counselor.name,
office: slot.office || counselor.office
};
console.log('更新时段信息:', updatedSlot);
return updatedSlot;
}
}
return slot;
});
}
} catch (error) {
console.error('获取咨询师信息失败', error);
}
} catch (error) {
console.error('获取咨询师信息失败', error);
}
}
}
@@ -260,19 +309,103 @@ async function loadAvailableSlots(startDate: string, endDate: string) {
}
}
// 处理新的排班点击
async function handleScheduleClick(schedule: ScheduleWithStatus) {
console.log('点击排班:', schedule);
// 如果该时段已过期,则不允许预约
if (schedule.isExpired) {
ElMessage.warning('该时段已过期,请选择其他时段');
return;
}
// 如果该时段全部约满,则不允许预约
if (schedule.isFullyBooked) {
ElMessage.warning('该时段已全部约满,请选择其他时段');
return;
}
// 获取咨询师名称和办公室信息
let counselorName = schedule.counselorName || '';
let office = schedule.office || '';
// 如果缺少咨询师姓名或办公室信息,则去获取完整的咨询师信息
if ((!counselorName || !office) && schedule.counselorId) {
try {
console.log('获取咨询师详细信息,counselorId:', schedule.counselorId);
const res = await getXljkCounselorOptions();
if (res.code === 200 && res.data) {
const counselor = res.data.find((item: CounselorOption) => item.id === schedule.counselorId);
if (counselor) {
counselorName = counselorName || counselor.name;
office = office || counselor.office || '';
console.log('获取到咨询师信息:', { name: counselor.name, office: counselor.office });
} else {
console.log('未找到对应的咨询师信息, counselorId:', schedule.counselorId);
}
}
} catch (error) {
console.error('获取咨询师信息失败', error);
}
}
console.log('最终的办公室信息:', office);
// 填充预约表单 - 直接使用排班数据,不需要再选择详细时段
appointmentForm.counselorId = schedule.counselorId;
appointmentForm.scheduleId = schedule.scheduleId;
appointmentForm.appointmentDate = schedule.date;
appointmentForm.appointmentTime = `${schedule.startTime}-${schedule.endTime}`;
appointmentForm.appointmentDetailTime = `${schedule.startTime}-${schedule.endTime}`; // 直接使用完整时段
appointmentForm.consultTheme = ''; // 清空咨询主题,等待用户选择
appointmentForm.reason = ''; // 清空咨询原因,避免带出上次的内容
// 设置选中的时段信息以便显示
selectedSlot.value = {
scheduleId: schedule.scheduleId,
counselorId: schedule.counselorId,
counselorName: counselorName,
office: office,
date: schedule.date,
timeSlot: schedule.timeSlot,
startTime: schedule.startTime,
endTime: schedule.endTime,
allBooked: schedule.isFullyBooked,
isExpired: schedule.isExpired
} as AvailableTimeSlot;
// 设置办公室信息
selectedOffice.value = office;
// 如果已登录且有用户ID,初始化学生信息
if (userId.value) {
// 初始设置为当前用户ID
studentId.value = userId.value;
studentName.value = nickname.value || '';
studentNo.value = nickname.value || '';
}
appointmentFormVisible.value = true;
}
// 处理时段点击
async function handleSlotClick(slot: AvailableTimeSlot) {
selectedSlot.value = slot;
// 如果没有咨询师姓名,尝试获取咨询师信息
if (!slot.counselorName && slot.counselorId) {
// 如果没有咨询师姓名或办公室信息,尝试获取咨询师信息
if ((!slot.counselorName || !slot.office) && slot.counselorId) {
try {
console.log('获取咨询师详细信息,counselorId:', slot.counselorId);
const res = await getXljkCounselorOptions();
if (res.code === 200 && res.data) {
const counselor = res.data.find((item: CounselorOption) => item.id === slot.counselorId);
if (counselor) {
slot.counselorName = counselor.name;
slot.counselorName = slot.counselorName || counselor.name;
slot.office = slot.office || counselor.office || '';
selectedSlot.value = { ...slot };
console.log('获取到咨询师信息:', { name: counselor.name, office: counselor.office });
} else {
console.log('未找到对应的咨询师信息, counselorId:', slot.counselorId);
}
}
} catch (error) {
@@ -280,12 +413,16 @@ async function handleSlotClick(slot: AvailableTimeSlot) {
}
}
// 设置办公室信息
selectedOffice.value = slot.office || '';
// 填充预约表单
appointmentForm.counselorId = slot.counselorId;
appointmentForm.scheduleId = slot.scheduleId;
appointmentForm.appointmentDate = slot.date;
appointmentForm.appointmentTime = `${slot.startTime}-${slot.endTime}`;
appointmentForm.appointmentDetailTime = ''; // 清空详细时段,等待用户选择
appointmentForm.consultTheme = ''; // 清空咨询主题,等待用户选择
appointmentForm.reason = ''; // 清空咨询原因,避免带出上次的内容
// 加载详细时段
@@ -387,7 +524,12 @@ function submitAppointmentForm() {
}
if (!appointmentForm.appointmentDetailTime) {
ElMessage.warning('请选择具体预约时段');
ElMessage.warning('预约时段信息缺失,请重新点击时段');
return;
}
if (!appointmentForm.consultTheme) {
ElMessage.warning('请选择咨询主题');
return;
}
@@ -452,12 +594,36 @@ async function viewMyAppointments() {
let res = await getXljkMyAppointments(id, true); // 强制刷新数据
console.log('查询结果:', res);
// 获取咨询师信息用于补充办公室字段
let counselors: CounselorOption[] = [];
try {
const counselorRes = await getXljkCounselorOptions();
if (counselorRes.code === 200 && counselorRes.data) {
counselors = counselorRes.data;
console.log('获取到咨询师列表:', counselors);
}
} catch (error) {
console.error('获取咨询师信息失败', error);
}
if (res.code === 200 && res.data && res.data.length > 0) {
// 处理数据,确保状态字段是数值类型
// 处理数据,确保状态字段是数值类型,并补充办公室信息
myAppointmentsList.value = res.data.map((item: any) => {
console.log('原始记录项:', item);
// 注意:移除了本地状态优先的逻辑,始终使用后端最新状态
// 补充办公室信息
if (item.counselorId && counselors.length > 0) {
const counselor = counselors.find((c: CounselorOption) => c.id === item.counselorId);
if (counselor) {
item.office = counselor.office || '';
item.counselorName = item.counselorName || counselor.name || '';
console.log('补充咨询师信息:', { counselorId: item.counselorId, name: counselor.name, office: counselor.office });
} else {
console.log('未找到对应的咨询师信息, counselorId:', item.counselorId);
}
}
// 如果status是undefined或null,设置默认值为0
if (item.status === undefined || item.status === null) {
@@ -473,7 +639,7 @@ async function viewMyAppointments() {
}
}
console.log('处理后的预约记录项:', item.id, '状态:', item.status, '类型:', typeof item.status);
console.log('处理后的预约记录项:', item.id, '状态:', item.status, '办公室:', item.office, '类型:', typeof item.status);
return item;
});
@@ -491,11 +657,23 @@ async function viewMyAppointments() {
console.log('数字类型查询结果:', res);
if (res.code === 200) {
// 处理数据,确保状态字段是数值类型
// 处理数据,确保状态字段是数值类型,并补充办公室信息
myAppointmentsList.value = (res.data || []).map((item: any) => {
console.log('原始记录项:', item);
// 注意:移除了本地状态优先的逻辑,始终使用后端最新状态
// 补充办公室信息
if (item.counselorId && counselors.length > 0) {
const counselor = counselors.find((c: CounselorOption) => c.id === item.counselorId);
if (counselor) {
item.office = counselor.office || '';
item.counselorName = item.counselorName || counselor.name || '';
console.log('补充咨询师信息:', { counselorId: item.counselorId, name: counselor.name, office: counselor.office });
} else {
console.log('未找到对应的咨询师信息, counselorId:', item.counselorId);
}
}
// 如果status是undefined或null,设置默认值为0
if (item.status === undefined || item.status === null) {
@@ -511,7 +689,7 @@ async function viewMyAppointments() {
}
}
console.log('处理后的预约记录项:', item.id, '状态:', item.status, '类型:', typeof item.status);
console.log('处理后的预约记录项:', item.id, '状态:', item.status, '办公室:', item.office, '类型:', typeof item.status);
return item;
});
@@ -594,7 +772,7 @@ async function initCounselorInfo() {
availableSlots.value = availableSlots.value.map((slot) => {
const counselor = counselors.find((c: CounselorOption) => c.id === slot.counselorId);
if (counselor) {
return { ...slot, counselorName: counselor.name };
return { ...slot, counselorName: counselor.name, office: counselor.office };
}
return slot;
});
@@ -616,9 +794,34 @@ async function refreshMyAppointments() {
try {
// 强制刷新数据
const res = await getXljkMyAppointments(studentId.value, true);
// 获取咨询师信息用于补充办公室字段
let counselors: CounselorOption[] = [];
try {
const counselorRes = await getXljkCounselorOptions();
if (counselorRes.code === 200 && counselorRes.data) {
counselors = counselorRes.data;
console.log('刷新时获取到咨询师列表:', counselors);
}
} catch (error) {
console.error('获取咨询师信息失败', error);
}
if (res.code === 200) {
// 处理数据,确保状态字段是数值类型
// 处理数据,确保状态字段是数值类型,并补充办公室信息
myAppointmentsList.value = (res.data || []).map((item: any) => {
// 补充办公室信息
if (item.counselorId && counselors.length > 0) {
const counselor = counselors.find((c: CounselorOption) => c.id === item.counselorId);
if (counselor) {
item.office = counselor.office || '';
item.counselorName = item.counselorName || counselor.name || '';
console.log('刷新时补充咨询师信息:', { counselorId: item.counselorId, name: counselor.name, office: counselor.office });
} else {
console.log('刷新时未找到对应的咨询师信息, counselorId:', item.counselorId);
}
}
// 如果status是undefined或null,设置默认值为0
if (item.status === undefined || item.status === null) {
item.status = 0; // 默认为待咨询
@@ -631,6 +834,7 @@ async function refreshMyAppointments() {
}
}
console.log('刷新后的预约记录项:', item.id, '状态:', item.status, '办公室:', item.office);
return item;
});
ElMessage.success('刷新成功');
+460 -131
View File
@@ -12,6 +12,11 @@
</el-select>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="办公室" prop="office">
<el-input v-model="queryParams.office" placeholder="请输入办公室" clearable style="width: 100%" />
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="排班日期" prop="dateRange">
<el-date-picker
@@ -28,7 +33,7 @@
<el-col :span="6">
<el-form-item label="时段类型" prop="timeSlot">
<el-select v-model="queryParams.timeSlot" placeholder="请选择时段类型" clearable style="width: 100%">
<el-option label="上午" value="0" />
<el-option label="中午" value="0" />
<el-option label="下午" value="1" />
</el-select>
</el-form-item>
@@ -75,8 +80,9 @@
<el-table v-loading="loading" border :data="scheduleList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="咨询师" align="center" prop="counselorName" min-width="100" show-overflow-tooltip />
<el-table-column label="办公室" align="center" prop="office" min-width="120" show-overflow-tooltip />
<el-table-column label="日期范围" align="center" prop="dateRange" min-width="180" />
<el-table-column label="上午时段" align="center" min-width="120">
<el-table-column label="中午时段" align="center" min-width="120">
<template #default="scope">
<span v-if="scope.row.morningEnabled">{{ scope.row.morningTime }}</span>
<span v-else>-</span>
@@ -129,13 +135,16 @@
</el-card>
<!-- 添加或修改预约时段对话框 -->
<el-dialog :title="title" v-model="open" width="500px" append-to-body>
<el-dialog :title="title" v-model="open" width="800px" append-to-body>
<el-form ref="scheduleFormRef" :model="form" :rules="rules" label-width="100px">
<el-form-item label="咨询师" prop="counselorId">
<el-select v-model="form.counselorId" placeholder="请选择咨询师" style="width: 100%">
<el-select v-model="form.counselorId" placeholder="请选择咨询师" style="width: 100%" @change="handleCounselorChange">
<el-option v-for="item in counselorOptions" :key="item.id" :label="item.name" :value="item.id" />
</el-select>
</el-form-item>
<el-form-item label="办公室" prop="office">
<el-input v-model="form.office" placeholder="请输入办公室" style="width: 100%" />
</el-form-item>
<el-form-item label="排班日期" prop="dateRange" v-if="!form.id">
<el-date-picker
v-model="form.dateRange"
@@ -151,60 +160,92 @@
<el-date-picker v-model="form.scheduleDate" type="date" placeholder="选择日期" value-format="YYYY-MM-DD" style="width: 100%" />
</el-form-item>
<!-- 上午时段设置 -->
<el-divider content-position="left">上午时段</el-divider>
<el-form-item label="启用上午" prop="morningEnabled">
<el-switch v-model="form.morningEnabled" />
</el-form-item>
<template v-if="form.morningEnabled">
<el-form-item label="开始时间" prop="morningStartTime">
<el-time-picker
v-model="morningStartTimeTemp"
format="HH:mm"
placeholder="选择时间"
style="width: 100%"
:picker-options="morningTimePickerOptions"
@change="handleMorningStartTimeChange"
/>
</el-form-item>
<el-form-item label="结束时间" prop="morningEndTime">
<el-time-picker
v-model="morningEndTimeTemp"
format="HH:mm"
placeholder="选择时间"
style="width: 100%"
:picker-options="morningTimePickerOptions"
@change="handleMorningEndTimeChange"
/>
</el-form-item>
<!-- 中午时段设置 -->
<el-divider content-position="left">中午时段</el-divider>
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="启用中午" prop="noonEnabled">
<el-switch v-model="form.noonEnabled" />
</el-form-item>
</el-col>
<el-col :span="12" class="text-right">
<el-button v-if="form.noonEnabled" type="primary" link icon="Plus" class="add-time-slot-btn" @click="addNoonTimeSlot">增加时段</el-button>
</el-col>
</el-row>
<template v-if="form.noonEnabled">
<div v-for="(slot, index) in form.noonTimeSlots" :key="`noon-${index}`" class="time-slot-row">
<el-row :gutter="20">
<el-col :span="10">
<el-form-item :label="index === 0 ? '开始时间' : ''" :prop="`noonTimeSlots.${index}.startTime`">
<el-time-picker
v-model="slot.startTimeTemp"
format="HH:mm"
placeholder="选择时间"
style="width: 100%"
@change="(time) => handleNoonStartTimeChange(time, index)"
/>
</el-form-item>
</el-col>
<el-col :span="10">
<el-form-item :label="index === 0 ? '结束时间' : ''" :prop="`noonTimeSlots.${index}.endTime`">
<el-time-picker
v-model="slot.endTimeTemp"
format="HH:mm"
placeholder="选择时间"
style="width: 100%"
@change="(time) => handleNoonEndTimeChange(time, index)"
/>
</el-form-item>
</el-col>
<el-col :span="4" class="time-slot-actions">
<el-button v-if="index > 0" type="danger" link icon="Delete" class="delete-time-slot-btn" @click="removeNoonTimeSlot(index)"></el-button>
</el-col>
</el-row>
</div>
</template>
<!-- 下午时段设置 -->
<el-divider content-position="left">下午时段</el-divider>
<el-form-item label="启用下午" prop="afternoonEnabled">
<el-switch v-model="form.afternoonEnabled" />
</el-form-item>
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="启用下午" prop="afternoonEnabled">
<el-switch v-model="form.afternoonEnabled" />
</el-form-item>
</el-col>
<el-col :span="12" class="text-right">
<el-button v-if="form.afternoonEnabled" type="primary" link icon="Plus" class="add-time-slot-btn" @click="addAfternoonTimeSlot">增加时段</el-button>
</el-col>
</el-row>
<template v-if="form.afternoonEnabled">
<el-form-item label="开始时间" prop="afternoonStartTime">
<el-time-picker
v-model="afternoonStartTimeTemp"
format="HH:mm"
placeholder="选择时间"
style="width: 100%"
:picker-options="afternoonTimePickerOptions"
@change="handleAfternoonStartTimeChange"
/>
</el-form-item>
<el-form-item label="结束时间" prop="afternoonEndTime">
<el-time-picker
v-model="afternoonEndTimeTemp"
format="HH:mm"
placeholder="选择时间"
style="width: 100%"
:picker-options="afternoonTimePickerOptions"
@change="handleAfternoonEndTimeChange"
/>
</el-form-item>
<div v-for="(slot, index) in form.afternoonTimeSlots" :key="`afternoon-${index}`" class="time-slot-row">
<el-row :gutter="20">
<el-col :span="10">
<el-form-item :label="index === 0 ? '开始时间' : ''" :prop="`afternoonTimeSlots.${index}.startTime`">
<el-time-picker
v-model="slot.startTimeTemp"
format="HH:mm"
placeholder="选择时间"
style="width: 100%"
@change="(time) => handleAfternoonStartTimeChange(time, index)"
/>
</el-form-item>
</el-col>
<el-col :span="10">
<el-form-item :label="index === 0 ? '结束时间' : ''" :prop="`afternoonTimeSlots.${index}.endTime`">
<el-time-picker
v-model="slot.endTimeTemp"
format="HH:mm"
placeholder="选择时间"
style="width: 100%"
@change="(time) => handleAfternoonEndTimeChange(time, index)"
/>
</el-form-item>
</el-col>
<el-col :span="4" class="time-slot-actions">
<el-button v-if="index > 0" type="danger" link icon="Delete" class="delete-time-slot-btn" @click="removeAfternoonTimeSlot(index)"></el-button>
</el-col>
</el-row>
</div>
</template>
<el-form-item label="状态" prop="status">
@@ -268,34 +309,13 @@ const open = ref(false);
const dateRange = ref<string[]>([]);
// 咨询师选项
const counselorOptions = ref<CounselorOption[]>([]);
// 时间选择器临时变量
const startTimeTemp = ref<Date | null>(null);
const endTimeTemp = ref<Date | null>(null);
const morningStartTimeTemp = ref<Date | null>(null);
const morningEndTimeTemp = ref<Date | null>(null);
const afternoonStartTimeTemp = ref<Date | null>(null);
const afternoonEndTimeTemp = ref<Date | null>(null);
// 时间选择器配置
const morningTimePickerOptions = {
start: '08:00',
step: '00:30',
end: '12:00',
format: 'HH:mm'
};
const afternoonTimePickerOptions = {
start: '14:00',
step: '00:30',
end: '17:00',
format: 'HH:mm'
};
// 查询参数
const queryParams = reactive({
pageNum: 1,
pageSize: 10,
counselorId: undefined,
office: undefined,
timeSlot: undefined,
status: undefined,
params: {} as any
@@ -305,23 +325,50 @@ const queryParams = reactive({
const form = reactive<any>({
id: undefined,
counselorId: undefined,
office: '',
scheduleDate: '',
dateRange: [],
morningEnabled: true,
morningStartTime: '08:30',
morningEndTime: '12:00',
noonEnabled: true,
noonTimeSlots: [
{
startTime: '12:00',
endTime: '12:40',
startTimeTemp: (() => {
const time = new Date();
time.setHours(12, 0, 0, 0);
return time;
})(),
endTimeTemp: (() => {
const time = new Date();
time.setHours(12, 40, 0, 0);
return time;
})()
}
],
afternoonEnabled: true,
afternoonStartTime: '14:30',
afternoonEndTime: '17:00',
timeSlot: '0',
startTime: '',
endTime: '',
afternoonTimeSlots: [
{
startTime: '17:00',
endTime: '17:40',
startTimeTemp: (() => {
const time = new Date();
time.setHours(17, 0, 0, 0);
return time;
})(),
endTimeTemp: (() => {
const time = new Date();
time.setHours(17, 40, 0, 0);
return time;
})()
}
],
status: '0'
});
// 表单校验
const rules = {
counselorId: [{ required: true, message: '咨询师不能为空', trigger: 'change' }],
office: [{ required: true, message: '办公室不能为空', trigger: 'blur' }],
scheduleDate: [{ required: false, message: '排班日期不能为空', trigger: 'change' }],
dateRange: [{ required: true, message: '排班日期范围不能为空', trigger: 'change' }],
status: [{ required: true, message: '状态不能为空', trigger: 'change' }]
@@ -377,38 +424,42 @@ const cancel = () => {
const reset = () => {
form.id = undefined;
form.counselorId = undefined;
form.office = '';
form.scheduleDate = '';
form.dateRange = [];
form.morningEnabled = true;
form.noonEnabled = true;
form.afternoonEnabled = true;
form.morningStartTime = '08:30';
form.morningEndTime = '12:00';
form.afternoonStartTime = '14:30';
form.afternoonEndTime = '17:00';
form.timeSlot = '0';
form.startTime = '';
form.endTime = '';
form.status = '0';
startTimeTemp.value = null;
endTimeTemp.value = null;
// 设置中午时段默认值
const noonStartTime = new Date();
noonStartTime.setHours(12, 0, 0, 0);
const noonEndTime = new Date();
noonEndTime.setHours(12, 40, 0, 0);
// 设置默认时间
const morningStart = new Date();
morningStart.setHours(8, 30, 0, 0);
morningStartTimeTemp.value = morningStart;
form.noonTimeSlots = [
{
startTime: '12:00',
endTime: '12:40',
startTimeTemp: noonStartTime,
endTimeTemp: noonEndTime
}
];
const morningEnd = new Date();
morningEnd.setHours(12, 0, 0, 0);
morningEndTimeTemp.value = morningEnd;
// 设置下午时段默认值
const afternoonStartTime = new Date();
afternoonStartTime.setHours(17, 0, 0, 0);
const afternoonEndTime = new Date();
afternoonEndTime.setHours(17, 40, 0, 0);
const afternoonStart = new Date();
afternoonStart.setHours(14, 30, 0, 0);
afternoonStartTimeTemp.value = afternoonStart;
const afternoonEnd = new Date();
afternoonEnd.setHours(17, 0, 0, 0);
afternoonEndTimeTemp.value = afternoonEnd;
form.afternoonTimeSlots = [
{
startTime: '17:00',
endTime: '17:40',
startTimeTemp: afternoonStartTime,
endTimeTemp: afternoonEndTime
}
];
scheduleFormRef.value?.resetFields();
};
@@ -441,7 +492,7 @@ const handleAdd = () => {
};
/** 查看按钮操作 */
const handleView = async (row: XljkConsultationScheduleVO) => {
const handleView = async (row: XljkConsultationScheduleSummaryVO) => {
try {
const res = await getXljkSchedule(row.id);
if (res.code === 200 && res.data) {
@@ -455,7 +506,7 @@ const handleView = async (row: XljkConsultationScheduleVO) => {
};
/** 修改按钮操作 */
const handleUpdate = async (row?: XljkConsultationScheduleVO) => {
const handleUpdate = async (row?: XljkConsultationScheduleSummaryVO) => {
if (row && row.id) {
try {
// 修复:将字符串状态正确转换为数字进行比较
@@ -491,6 +542,7 @@ const submitForm = async () => {
await updateXljkSchedule({
id: form.id,
counselorId: form.counselorId,
office: form.office,
scheduleDate: form.scheduleDate,
timeSlot: form.timeSlot,
startTime: form.startTime,
@@ -514,26 +566,67 @@ const submitForm = async () => {
}
// 检查是否至少启用了一个时段
if (!form.morningEnabled && !form.afternoonEnabled) {
ElMessage.warning('请至少启用一个时段(上午或下午)');
if (!form.noonEnabled && !form.afternoonEnabled) {
ElMessage.warning('请至少启用一个时段(中午或下午)');
return;
}
// 确保时间数据同步 - 从时间选择器同步到字符串字段
if (form.noonEnabled) {
form.noonTimeSlots.forEach((slot, index) => {
if (slot.startTimeTemp && !slot.startTime) {
const hours = slot.startTimeTemp.getHours().toString().padStart(2, '0');
const minutes = slot.startTimeTemp.getMinutes().toString().padStart(2, '0');
slot.startTime = `${hours}:${minutes}`;
}
if (slot.endTimeTemp && !slot.endTime) {
const hours = slot.endTimeTemp.getHours().toString().padStart(2, '0');
const minutes = slot.endTimeTemp.getMinutes().toString().padStart(2, '0');
slot.endTime = `${hours}:${minutes}`;
}
});
}
if (form.afternoonEnabled) {
form.afternoonTimeSlots.forEach((slot, index) => {
if (slot.startTimeTemp && !slot.startTime) {
const hours = slot.startTimeTemp.getHours().toString().padStart(2, '0');
const minutes = slot.startTimeTemp.getMinutes().toString().padStart(2, '0');
slot.startTime = `${hours}:${minutes}`;
}
if (slot.endTimeTemp && !slot.endTime) {
const hours = slot.endTimeTemp.getHours().toString().padStart(2, '0');
const minutes = slot.endTimeTemp.getMinutes().toString().padStart(2, '0');
slot.endTime = `${hours}:${minutes}`;
}
});
}
// 批量创建预约时段的请求数据
const batchCreateData = {
counselorId: form.counselorId,
office: form.office,
startDate: form.dateRange[0],
endDate: form.dateRange[1],
morningEnabled: form.morningEnabled,
morningStartTime: form.morningStartTime,
morningEndTime: form.morningEndTime,
noonEnabled: form.noonEnabled,
noonTimeSlots: form.noonTimeSlots.map(slot => ({
startTime: slot.startTime,
endTime: slot.endTime
})),
afternoonEnabled: form.afternoonEnabled,
afternoonStartTime: form.afternoonStartTime,
afternoonEndTime: form.afternoonEndTime,
afternoonTimeSlots: form.afternoonTimeSlots.map(slot => ({
startTime: slot.startTime,
endTime: slot.endTime
})),
status: form.status,
skipWeekends: true // 自动跳过周末
};
// 调试日志 - 确认时间数据
console.log('提交的批量创建数据:', batchCreateData);
console.log('中午时段数据:', form.noonTimeSlots);
console.log('下午时段数据:', form.afternoonTimeSlots);
// 调用批量创建API
const res = await addXljkSchedule(batchCreateData);
if (res.code === 200) {
@@ -551,7 +644,7 @@ const submitForm = async () => {
};
/** 删除按钮操作 */
const handleDelete = async (row?: XljkConsultationScheduleVO) => {
const handleDelete = async (row?: XljkConsultationScheduleSummaryVO) => {
const _ids = row?.id || ids.value;
const confirmMessage = row
? `是否确认删除该预约时段?${row.scheduleCount > 1 ? `(包含${row.scheduleCount}条记录)` : ''}`
@@ -594,47 +687,147 @@ const handleEndTimeChange = (time: Date) => {
}
};
/** 处理上午开始时间变化 */
const handleMorningStartTimeChange = (time: Date) => {
/** 处理中午开始时间变化 */
const handleNoonStartTimeChange = (time: Date, index: number) => {
if (time) {
const hours = time.getHours().toString().padStart(2, '0');
const minutes = time.getMinutes().toString().padStart(2, '0');
form.morningStartTime = `${hours}:${minutes}`;
const timeString = `${hours}:${minutes}`;
form.noonTimeSlots[index].startTime = timeString;
form.noonTimeSlots[index].startTimeTemp = time;
} else {
form.morningStartTime = '';
form.noonTimeSlots[index].startTime = '';
form.noonTimeSlots[index].startTimeTemp = null;
}
};
/** 处理上午结束时间变化 */
const handleMorningEndTimeChange = (time: Date) => {
/** 处理中午结束时间变化 */
const handleNoonEndTimeChange = (time: Date, index: number) => {
if (time) {
const hours = time.getHours().toString().padStart(2, '0');
const minutes = time.getMinutes().toString().padStart(2, '0');
form.morningEndTime = `${hours}:${minutes}`;
const timeString = `${hours}:${minutes}`;
form.noonTimeSlots[index].endTime = timeString;
form.noonTimeSlots[index].endTimeTemp = time;
} else {
form.morningEndTime = '';
form.noonTimeSlots[index].endTime = '';
form.noonTimeSlots[index].endTimeTemp = null;
}
};
/** 新增中午时段 */
const addNoonTimeSlot = () => {
const lastSlot = form.noonTimeSlots[form.noonTimeSlots.length - 1];
let startTime = '12:00';
let endTime = '12:40';
if (lastSlot && lastSlot.endTime) {
startTime = lastSlot.endTime;
// 计算结束时间(开始时间+40分钟)
const [hours, minutes] = startTime.split(':').map(Number);
const startDate = new Date();
startDate.setHours(hours, minutes, 0, 0);
const endDate = new Date(startDate.getTime() + 40 * 60 * 1000); // 加40分钟
endTime = `${endDate.getHours().toString().padStart(2, '0')}:${endDate.getMinutes().toString().padStart(2, '0')}`;
}
// 创建对应的Date对象用于时间选择器
const startTimeDate = new Date();
const [startHours, startMinutes] = startTime.split(':').map(Number);
startTimeDate.setHours(startHours, startMinutes, 0, 0);
const endTimeDate = new Date();
const [endHours, endMinutes] = endTime.split(':').map(Number);
endTimeDate.setHours(endHours, endMinutes, 0, 0);
form.noonTimeSlots.push({
startTime,
endTime,
startTimeTemp: startTimeDate,
endTimeTemp: endTimeDate
});
};
/** 移除中午时段 */
const removeNoonTimeSlot = (index: number) => {
form.noonTimeSlots.splice(index, 1);
};
/** 处理下午开始时间变化 */
const handleAfternoonStartTimeChange = (time: Date) => {
const handleAfternoonStartTimeChange = (time: Date, index: number) => {
if (time) {
const hours = time.getHours().toString().padStart(2, '0');
const minutes = time.getMinutes().toString().padStart(2, '0');
form.afternoonStartTime = `${hours}:${minutes}`;
const timeString = `${hours}:${minutes}`;
form.afternoonTimeSlots[index].startTime = timeString;
form.afternoonTimeSlots[index].startTimeTemp = time;
} else {
form.afternoonStartTime = '';
form.afternoonTimeSlots[index].startTime = '';
form.afternoonTimeSlots[index].startTimeTemp = null;
}
};
/** 处理下午结束时间变化 */
const handleAfternoonEndTimeChange = (time: Date) => {
const handleAfternoonEndTimeChange = (time: Date, index: number) => {
if (time) {
const hours = time.getHours().toString().padStart(2, '0');
const minutes = time.getMinutes().toString().padStart(2, '0');
form.afternoonEndTime = `${hours}:${minutes}`;
const timeString = `${hours}:${minutes}`;
form.afternoonTimeSlots[index].endTime = timeString;
form.afternoonTimeSlots[index].endTimeTemp = time;
} else {
form.afternoonEndTime = '';
form.afternoonTimeSlots[index].endTime = '';
form.afternoonTimeSlots[index].endTimeTemp = null;
}
};
/** 新增下午时段 */
const addAfternoonTimeSlot = () => {
const lastSlot = form.afternoonTimeSlots[form.afternoonTimeSlots.length - 1];
let startTime = '17:00';
let endTime = '17:40';
if (lastSlot && lastSlot.endTime) {
startTime = lastSlot.endTime;
// 计算结束时间(开始时间+40分钟)
const [hours, minutes] = startTime.split(':').map(Number);
const startDate = new Date();
startDate.setHours(hours, minutes, 0, 0);
const endDate = new Date(startDate.getTime() + 40 * 60 * 1000); // 加40分钟
endTime = `${endDate.getHours().toString().padStart(2, '0')}:${endDate.getMinutes().toString().padStart(2, '0')}`;
}
// 创建对应的Date对象用于时间选择器
const startTimeDate = new Date();
const [startHours, startMinutes] = startTime.split(':').map(Number);
startTimeDate.setHours(startHours, startMinutes, 0, 0);
const endTimeDate = new Date();
const [endHours, endMinutes] = endTime.split(':').map(Number);
endTimeDate.setHours(endHours, endMinutes, 0, 0);
form.afternoonTimeSlots.push({
startTime,
endTime,
startTimeTemp: startTimeDate,
endTimeTemp: endTimeDate
});
};
/** 移除下午时段 */
const removeAfternoonTimeSlot = (index: number) => {
form.afternoonTimeSlots.splice(index, 1);
};
/** 处理咨询师变化 */
const handleCounselorChange = (counselorId: number) => {
if (counselorId) {
const selectedCounselor = counselorOptions.value.find(counselor => counselor.id === counselorId);
if (selectedCounselor && selectedCounselor.office) {
form.office = selectedCounselor.office;
}
} else {
form.office = '';
}
};
@@ -684,4 +877,140 @@ onMounted(() => {
margin-bottom: 0 !important;
}
}
/* 时间槽行样式 */
.time-slot-row {
margin-bottom: 10px;
padding: 10px;
background-color: #f5f7fa;
border-radius: 4px;
}
/* 时间槽操作按钮样式 */
.time-slot-actions {
display: flex;
justify-content: flex-end;
align-items: center;
padding-top: 8px;
}
/* 右对齐样式 */
.text-right {
text-align: right;
}
/* 新增时段按钮样式 */
.add-time-slot-btn {
border: none !important;
box-shadow: none !important;
background-color: transparent !important;
color: #409eff !important;
padding: 8px 12px;
font-size: 14px;
font-weight: normal;
transition: color 0.3s ease;
}
.add-time-slot-btn:hover {
color: #66b1ff !important;
background-color: transparent !important;
}
.add-time-slot-btn:focus {
border: none !important;
box-shadow: none !important;
background-color: transparent !important;
outline: none !important;
}
.add-time-slot-btn:active {
border: none !important;
box-shadow: none !important;
background-color: transparent !important;
}
/* 更强的选择器覆盖 Element Plus 默认样式 */
.el-button.add-time-slot-btn.el-button--primary.is-link {
border: none !important;
box-shadow: none !important;
background-color: transparent !important;
color: #409eff !important;
}
.el-button.add-time-slot-btn.el-button--primary.is-link:hover {
border: none !important;
box-shadow: none !important;
background-color: transparent !important;
color: #66b1ff !important;
}
.el-button.add-time-slot-btn.el-button--primary.is-link:focus {
border: none !important;
box-shadow: none !important;
background-color: transparent !important;
outline: none !important;
}
.el-button.add-time-slot-btn.el-button--primary.is-link:active {
border: none !important;
box-shadow: none !important;
background-color: transparent !important;
}
/* 删除时段按钮样式 */
.delete-time-slot-btn {
border: none !important;
box-shadow: none !important;
background-color: transparent !important;
color: #f56c6c !important;
padding: 8px;
font-size: 16px;
transition: color 0.3s ease;
}
.delete-time-slot-btn:hover {
color: #f78989 !important;
background-color: transparent !important;
}
.delete-time-slot-btn:focus {
border: none !important;
box-shadow: none !important;
background-color: transparent !important;
outline: none !important;
}
.delete-time-slot-btn:active {
border: none !important;
box-shadow: none !important;
background-color: transparent !important;
}
/* 更强的选择器覆盖 Element Plus 默认样式 */
.el-button.delete-time-slot-btn.el-button--danger.is-link {
border: none !important;
box-shadow: none !important;
background-color: transparent !important;
color: #f56c6c !important;
}
.el-button.delete-time-slot-btn.el-button--danger.is-link:hover {
border: none !important;
box-shadow: none !important;
background-color: transparent !important;
color: #f78989 !important;
}
.el-button.delete-time-slot-btn.el-button--danger.is-link:focus {
border: none !important;
box-shadow: none !important;
background-color: transparent !important;
outline: none !important;
}
.el-button.delete-time-slot-btn.el-button--danger.is-link:active {
border: none !important;
box-shadow: none !important;
background-color: transparent !important;
}
</style>
File diff suppressed because it is too large. Load diff
@@ -65,7 +65,7 @@
<el-card shadow="never">
<template #header>
<div class="card-header">
<span>指标模块 </span>
<span>指标模块(基础分:100分)</span>
</div>
</template>
<el-table :data="form.selfScoreList" border style="width: 100%">
@@ -85,34 +85,25 @@
</div>
</template>
</el-table-column>
<el-table-column label="指标编码" prop="indicatorCode" min-width="100" />
<!-- <el-table-column label="指标编码" prop="indicatorCode" min-width="100" /> -->
<el-table-column label="指标说明" prop="indicatorDescription" min-width="150" show-overflow-tooltip />
<el-table-column label="最高分值" prop="planMaxScore" min-width="80" />
<!-- <el-table-column label="最高分值" prop="planMaxScore" min-width="80" /> -->
<el-table-column label="自评得分" width="120">
<template #header>
<div class="column-header">
<span>自评得分</span>
<el-tooltip content="自评得分不能超过最高分值,且不能为负数" placement="top">
<el-tooltip
content="新算分规则:基础分100分,先扣除违纪处分,再加上奖励加分和附加分。自评得分为系统自动计算,不可手动编辑"
placement="top"
>
<el-icon class="header-icon"><QuestionFilled /></el-icon>
</el-tooltip>
</div>
</template>
<template #default="scope">
<div v-if="isViewMode" class="score-display">
{{ scope.row.selfScore || '-' }}
<div class="score-display auto-calculated">
{{ scope.row.selfScore || '0' }}
</div>
<el-input
v-else
v-model="scope.row.selfScore"
type="number"
:min="0"
:max="scope.row.planMaxScore"
:step="0.1"
@input="(value) => handleSelfScoreInput(value, scope.row)"
@blur="(event) => handleSelfScoreBlur(event, scope.row)"
:class="{ 'score-input-warning': isScoreExceeded(scope.row) }"
style="width: 100%"
/>
</template>
</el-table-column>
<el-table-column label="自评备注" min-width="120">
@@ -401,6 +392,7 @@ import {
getApplicationByStudentAndSchedule,
getIndicatorsByScheduleId
} from '@/api/xskh/assessmentApplication/assessmentApplication';
// 注意:暂时使用request直接调用API,避免导入路径问题
// 类型定义
interface XskhAssessmentApplicationApprovalForm {
@@ -446,6 +438,9 @@ interface XskhAssessmentSelfScoreForm {
selfRemark?: string;
teacherScore?: number;
teacherRemark?: string;
// 新增字段:用于新算分规则
deductionScore?: number; // 扣分
additionScore?: number; // 加分
}
interface XskhAssessmentBonusApprovalForm {
@@ -600,6 +595,210 @@ const getCurrentUserStudentInfo = async () => {
}
};
/** 计算单个指标的自评得分(新算分规则) */
const calculateIndicatorSelfScore = async (indicatorId: string | number): Promise<{ deduction: number; addition: number }> => {
try {
// 获取指标关联的违纪处分类型和奖励类型
const indicatorTypesResponse = await request({
url: `/disciplineRecord/disciplineRecord/getIndicatorTypes/${indicatorId}`,
method: 'get'
});
if (indicatorTypesResponse.code !== 200 || !indicatorTypesResponse.data) {
console.warn(`获取指标 ${indicatorId} 的类型信息失败`);
return { deduction: 0, addition: 0 };
}
// 修复字段名映射:后端返回下划线格式,前端使用驼峰格式
const disciplineTypeIds = indicatorTypesResponse.data.discipline_type_ids || indicatorTypesResponse.data.disciplineTypeIds;
const rewardTypeIds = indicatorTypesResponse.data.reward_type_ids || indicatorTypesResponse.data.rewardTypeIds;
// 并行获取违纪处分记录和奖励记录
const [disciplineRecords, rewardRecords] = await Promise.all([getDisciplineRecords(disciplineTypeIds), getRewardRecords(rewardTypeIds)]);
// 计算违纪扣分(正数,表示扣分金额)
let disciplineDeduction = 0;
if (disciplineRecords && disciplineRecords.length > 0) {
disciplineDeduction = disciplineRecords.reduce((sum: number, record: any) => {
const deduction = parseFloat(String(record.scoreDeduction || 0)) || 0;
return sum + deduction;
}, 0);
// 检查违纪类型是否需要均化处理
if (disciplineTypeIds) {
disciplineDeduction = await applyEqualizationIfNeeded(disciplineTypeIds, disciplineDeduction, 'discipline');
}
}
// 计算奖励加分(正数,表示加分金额)
let rewardAddition = 0;
if (rewardRecords && rewardRecords.length > 0) {
rewardAddition = rewardRecords.reduce((sum: number, record: any) => {
const addition = parseFloat(String(record.scoreAddition || 0)) || 0;
return sum + addition;
}, 0);
// 检查奖励类型是否需要均化处理
if (rewardTypeIds) {
rewardAddition = await applyEqualizationIfNeeded(rewardTypeIds, rewardAddition, 'reward');
}
}
console.log(
`指标 ${indicatorId} 自评得分计算完成: 扣分=${disciplineDeduction}, 加分=${rewardAddition} (违纪扣分: ${disciplineRecords?.length || 0}条, 奖励加分: ${rewardRecords?.length || 0}条)`
);
return {
deduction: Math.round(disciplineDeduction * 10) / 10,
addition: Math.round(rewardAddition * 10) / 10
};
} catch (error) {
console.error(`计算指标 ${indicatorId} 自评得分失败:`, error);
return { deduction: 0, addition: 0 };
}
};
/** 获取学生违纪处分记录 */
const getDisciplineRecords = async (disciplineTypeIds: string): Promise<any[]> => {
if (!disciplineTypeIds || !form.value.studentId) {
return [];
}
try {
const response = await request({
url: '/disciplineRecord/disciplineRecord/getStudentDisciplineRecords',
method: 'get',
params: {
studentId: form.value.studentId,
disciplineTypeIds: disciplineTypeIds,
startTime: form.value.dataStartTime,
endTime: form.value.dataEndTime,
status: 1 // 只查询状态为1的记录
}
});
if (response.code === 200) {
return response.data || [];
} else {
console.warn('获取违纪处分记录失败:', response.msg);
return [];
}
} catch (error) {
console.error('获取违纪处分记录失败:', error);
return [];
}
};
/** 获取学生奖励记录 */
const getRewardRecords = async (rewardTypeIds: string): Promise<any[]> => {
if (!rewardTypeIds || !form.value.studentId) {
return [];
}
try {
const response = await request({
url: '/rewardRecord/rewardRecord/getStudentRewardRecords',
method: 'get',
params: {
studentId: form.value.studentId,
rewardTypeIds: rewardTypeIds,
startTime: form.value.dataStartTime,
endTime: form.value.dataEndTime,
status: 1 // 只查询状态为1的记录
}
});
if (response.code === 200) {
return response.data || [];
} else {
console.warn('获取奖励记录失败:', response.msg);
return [];
}
} catch (error) {
console.error('获取奖励记录失败:', error);
return [];
}
};
/** 应用均化处理(如果需要) */
const applyEqualizationIfNeeded = async (typeIds: string, studentScore: number, scoreType: 'discipline' | 'reward'): Promise<number> => {
if (!typeIds || studentScore === 0) {
return studentScore;
}
try {
// 将逗号分隔的类型ID字符串转换为数组
const typeIdArray = typeIds
.split(',')
.map((id) => id.trim())
.filter((id) => id);
console.log('typeIdArray:', typeIdArray);
// 遍历每个类型,检查是否需要均化
for (const typeId of typeIdArray) {
console.log('typeId:', typeId);
// 获取类型的均化设置
const typeDetailsResponse = await request({
url: scoreType === 'discipline' ? `/disciplineType/disciplineType/${typeId}` : `/rewardType/rewardType/${typeId}`,
method: 'get'
});
console.log('typeDetailsResponse:', typeDetailsResponse);
if (typeDetailsResponse.code === 200 && typeDetailsResponse.data) {
const typeInfo = typeDetailsResponse.data;
// 检查是否启用均化 (isEqualized: '1' 表示启用)
const isEqualized = typeInfo.isEqualized === '1';
const equalizedThreshold = parseFloat(String(typeInfo.equalizedThreshold || 0)) || 0;
if (isEqualized && equalizedThreshold > 0) {
console.log(`类型 ${typeId} 启用了均化处理,均化阈值: ${equalizedThreshold}`);
// 调用专门的接口获取统计周期内该类型下所有学生的最高总分值
const maxScoreResponse = await request({
url:
scoreType === 'discipline'
? `/disciplineRecord/disciplineRecord/getMaxScoreByTypeAndPeriod/${typeId}`
: `/rewardRecord/rewardRecord/getMaxScoreByTypeAndPeriod/${typeId}`,
method: 'get',
params: {
startTime: form.value.dataStartTime,
endTime: form.value.dataEndTime
}
});
if (maxScoreResponse.code === 200 && maxScoreResponse.data !== null && maxScoreResponse.data !== undefined) {
const maxScore = parseFloat(String(maxScoreResponse.data)) || 0;
console.log(`类型 ${typeId} 统计周期内学生最高总分值: ${maxScore}, 当前学生得分: ${studentScore}, 均化阈值: ${equalizedThreshold}`);
// 如果最高分值超过了均化阈值,应用均化公式
if (maxScore > equalizedThreshold) {
const equalizedScore = (studentScore * equalizedThreshold) / maxScore;
console.log(`应用均化公式: ${studentScore} * ${equalizedThreshold} / ${maxScore} = ${equalizedScore}`);
return Math.round(equalizedScore * 10) / 10; // 保留一位小数
} else {
console.log(`最高分值 ${maxScore} 未超过均化阈值 ${equalizedThreshold},不需要均化处理`);
}
} else {
console.warn(`获取类型 ${typeId} 的最高分值失败:`, maxScoreResponse.msg);
}
}
}
}
// 如果没有需要均化的类型,返回原始分值
return studentScore;
} catch (error) {
console.error(`均化处理失败 (类型: ${scoreType}, typeIds: ${typeIds}):`, error);
// 均化失败时返回原始分值,不影响正常计算
return studentScore;
}
};
/** 根据考核计划ID获取关联的指标数据 */
const loadIndicatorsByScheduleId = async (scheduleId: string | number) => {
try {
@@ -607,7 +806,7 @@ const loadIndicatorsByScheduleId = async (scheduleId: string | number) => {
if (response.code === 200 && response.data) {
// 将指标数据转换为自评得分列表格式
form.value.selfScoreList = response.data.map((item: any) => ({
const indicatorList = response.data.map((item: any) => ({
id: undefined,
applicationId: undefined,
indicatorId: item.indicatorId,
@@ -618,12 +817,19 @@ const loadIndicatorsByScheduleId = async (scheduleId: string | number) => {
maxScore: item.maxScore, // 修改:使用maxScore字段名,匹配后端期望
planMaxScore: item.maxScore, // 保留planMaxScore用于前端显示
sortOrder: item.sortOrder,
selfScore: 0,
selfScore: 0, // 初始化为0,稍后计算
selfRemark: '',
teacherScore: 0,
teacherRemark: ''
}));
form.value.selfScoreList = indicatorList;
// 自动计算每个指标的自评得分
if (form.value.studentId && form.value.dataStartTime && form.value.dataEndTime) {
await calculateAllIndicatorScores();
}
console.log('获取到考核计划关联的指标数据:', response.data);
} else {
ElMessage.warning(response.msg || '获取指标数据失败');
@@ -638,115 +844,133 @@ const loadIndicatorsByScheduleId = async (scheduleId: string | number) => {
}
};
/** 计算总得分 */
const calculateTotalScore = () => {
// 计算自评得分
let selfScore = 0;
if (form.value.selfScoreList && form.value.selfScoreList.length > 0) {
selfScore += form.value.selfScoreList.reduce((sum, item) => {
const score = parseFloat(String(item.selfScore || 0)) || 0;
return sum + score;
}, 0);
/** 计算所有指标的自评得分(新算分规则) */
const calculateAllIndicatorScores = async () => {
if (!form.value.selfScoreList || form.value.selfScoreList.length === 0) {
return;
}
console.log('开始计算所有指标的自评得分(新算分规则)...');
// 并行计算所有指标的得分
const scorePromises = form.value.selfScoreList.map(async (indicator) => {
const { deduction, addition } = await calculateIndicatorSelfScore(indicator.indicatorId);
// 设置扣分和加分
indicator.deductionScore = deduction;
indicator.additionScore = addition;
// 为了兼容现有显示,selfScore设置为净得分(加分-扣分)
indicator.selfScore = addition - deduction;
return {
indicatorId: indicator.indicatorId,
deduction,
addition,
netScore: indicator.selfScore
};
});
try {
const results = await Promise.all(scorePromises);
console.log('所有指标自评得分计算完成(新算分规则):', results);
// 重新计算总得分
calculateTotalScore();
} catch (error) {
console.error('计算指标自评得分失败:', error);
ElMessage.error('计算指标自评得分失败,请稍后重试');
}
};
/** 计算总得分(新算分规则) */
const calculateTotalScore = () => {
// 第1步:基础分100分 - 指标模块的扣分,最小为0
const baseScore = 100;
let totalIndicatorDeduction = 0;
let totalIndicatorAddition = 0;
// 计算指标模块的总扣分和总加分
if (form.value.selfScoreList && form.value.selfScoreList.length > 0) {
form.value.selfScoreList.forEach((item) => {
const deduction = parseFloat(String(item.deductionScore || 0)) || 0;
const addition = parseFloat(String(item.additionScore || 0)) || 0;
totalIndicatorDeduction += deduction;
totalIndicatorAddition += addition;
});
}
// 第1步:基础分 - 扣分,结果不能小于0
let step1Score = baseScore - totalIndicatorDeduction;
if (step1Score < 0) {
step1Score = 0;
}
// 第2步:加上指标模块的加分
const step2Score = step1Score + totalIndicatorAddition;
// 第3步:加上附加分模块的分值(可正可负)
let totalBonusScore = 0;
if (form.value.bonusApprovalList && form.value.bonusApprovalList.length > 0) {
selfScore += form.value.bonusApprovalList.reduce((sum, item) => {
totalBonusScore = form.value.bonusApprovalList.reduce((sum, item) => {
const score = parseFloat(String(item.bonusScore || 0)) || 0;
return sum + score;
}, 0);
}
form.value.selfScore = parseFloat(selfScore.toFixed(1));
// 最终自评得分
const finalSelfScore = step2Score + totalBonusScore;
form.value.selfScore = parseFloat(finalSelfScore.toFixed(1));
// 计算班主任评分
let teacherScore = 0;
console.log(
`自评得分计算详情: 基础分=${baseScore}, 指标扣分=${totalIndicatorDeduction}, 第1步结果=${step1Score}, 指标加分=${totalIndicatorAddition}, 第2步结果=${step2Score}, 附加分=${totalBonusScore}, 最终得分=${form.value.selfScore}`
);
// 班主任评分采用相同逻辑,但使用班主任的评分数据
let teacherTotalIndicatorDeduction = 0;
let teacherTotalIndicatorAddition = 0;
// 计算班主任对指标模块的评分
if (form.value.selfScoreList && form.value.selfScoreList.length > 0) {
teacherScore += form.value.selfScoreList.reduce((sum, item) => {
const score = parseFloat(String(item.teacherScore || 0)) || 0;
return sum + score;
}, 0);
form.value.selfScoreList.forEach((item) => {
const teacherScore = parseFloat(String(item.teacherScore || 0)) || 0;
// 班主任评分可能是综合评分,这里需要根据实际情况调整
if (teacherScore < 0) {
teacherTotalIndicatorDeduction += Math.abs(teacherScore);
} else {
teacherTotalIndicatorAddition += teacherScore;
}
});
}
// 第1步:基础分 - 班主任评定的扣分
let teacherStep1Score = baseScore - teacherTotalIndicatorDeduction;
if (teacherStep1Score < 0) {
teacherStep1Score = 0;
}
// 第2步:加上班主任评定的加分
const teacherStep2Score = teacherStep1Score + teacherTotalIndicatorAddition;
// 第3步:加上附加分模块的审核得分
let totalApprovalScore = 0;
if (form.value.bonusApprovalList && form.value.bonusApprovalList.length > 0) {
teacherScore += form.value.bonusApprovalList.reduce((sum, item) => {
totalApprovalScore = form.value.bonusApprovalList.reduce((sum, item) => {
const score = parseFloat(String(item.approvalScore || 0)) || 0;
return sum + score;
}, 0);
}
form.value.teacherScore = parseFloat(teacherScore.toFixed(1));
// 最终班主任评分
const finalTeacherScore = teacherStep2Score + totalApprovalScore;
form.value.teacherScore = parseFloat(finalTeacherScore.toFixed(1));
// 总得分等于班主任评分
form.value.totalScore = parseFloat(teacherScore.toFixed(1));
};
form.value.totalScore = parseFloat(finalTeacherScore.toFixed(1));
/** 处理自评得分输入验证 */
const handleSelfScoreInput = (value: string | number, row: XskhAssessmentSelfScoreForm) => {
const numValue = parseFloat(String(value)) || 0;
const maxScore = parseFloat(String(row.planMaxScore)) || 0;
// 如果输入值超过最高分值,自动限制为最高分值
if (numValue > maxScore) {
row.selfScore = maxScore;
ElMessage.warning(`自评得分不能超过最高分值 ${maxScore}`);
} else {
row.selfScore = numValue;
}
// 重新计算总得分
calculateTotalScore();
};
/** 处理自评得分失焦验证 */
const handleSelfScoreBlur = (event: Event, row: XskhAssessmentSelfScoreForm) => {
const target = event.target as HTMLInputElement;
const value = parseFloat(target.value) || 0;
const maxScore = parseFloat(String(row.planMaxScore)) || 0;
// 失焦时再次验证,确保不超过最高分值
if (value > maxScore) {
row.selfScore = maxScore;
target.value = maxScore.toString();
ElMessage.warning(`自评得分已自动调整为最高分值 ${maxScore}`);
}
// 确保值为非负数
if (value < 0) {
row.selfScore = 0;
target.value = '0';
}
};
/** 验证所有自评得分是否超过最高分值 */
const validateSelfScores = (): boolean => {
if (!form.value.selfScoreList || form.value.selfScoreList.length === 0) {
return true;
}
for (let i = 0; i < form.value.selfScoreList.length; i++) {
const item = form.value.selfScoreList[i];
const selfScore = parseFloat(String(item.selfScore || 0)) || 0;
const maxScore = parseFloat(String(item.planMaxScore || 0)) || 0;
if (selfScore > maxScore) {
ElMessage.error(`第${i + 1}项指标"${item.indicatorName}"的自评得分(${selfScore})不能超过最高分值(${maxScore})`);
return false;
}
if (selfScore < 0) {
ElMessage.error(`第${i + 1}项指标"${item.indicatorName}"的自评得分不能为负数`);
return false;
}
}
return true;
};
/** 检查单个指标的自评得分是否超过最高分值 */
const isScoreExceeded = (row: XskhAssessmentSelfScoreForm): boolean => {
const selfScore = parseFloat(String(row.selfScore || 0)) || 0;
const maxScore = parseFloat(String(row.planMaxScore || 0)) || 0;
return selfScore > maxScore;
console.log(
`班主任评分计算详情: 基础分=${baseScore}, 指标扣分=${teacherTotalIndicatorDeduction}, 第1步结果=${teacherStep1Score}, 指标加分=${teacherTotalIndicatorAddition}, 第2步结果=${teacherStep2Score}, 附加审核分=${totalApprovalScore}, 最终得分=${form.value.teacherScore}`
);
};
/** 添加附加分项目 */
@@ -1096,6 +1320,11 @@ const openDialog = async (id?: string | number, title?: string, schedule?: Asses
teacherScore: item.teacherScore || 0,
teacherRemark: item.teacherRemark || ''
}));
// 重新计算自评得分(确保数据是最新的)
if (form.value.studentId && form.value.dataStartTime && form.value.dataEndTime) {
await calculateAllIndicatorScores();
}
}
// 确保附加分列表正确回显
@@ -1164,6 +1393,11 @@ const openDialog = async (id?: string | number, title?: string, schedule?: Asses
teacherScore: item.teacherScore || 0,
teacherRemark: item.teacherRemark || ''
}));
// 重新计算自评得分(确保数据是最新的)
if (form.value.studentId && form.value.dataStartTime && form.value.dataEndTime) {
await calculateAllIndicatorScores();
}
}
// 确保附加分列表正确回显
@@ -1258,11 +1492,6 @@ const safeConvertId = (id: string | number | undefined): string | undefined => {
const handleSave = async () => {
assessmentApplicationFormRef.value?.validate(async (valid) => {
if (valid) {
// 验证自评得分是否超过最高分值
if (!validateSelfScores()) {
return;
}
try {
// 处理附件数据,将fileList中的ossId合并为evidenceFile字段
if (form.value.bonusApprovalList && form.value.bonusApprovalList.length > 0) {
@@ -1310,11 +1539,6 @@ const handleSave = async () => {
const handleSubmit = async () => {
assessmentApplicationFormRef.value?.validate(async (valid) => {
if (valid) {
// 验证自评得分是否超过最高分值
if (!validateSelfScores()) {
return;
}
try {
// 处理附件数据,将fileList中的ossId合并为evidenceFile字段
if (form.value.bonusApprovalList && form.value.bonusApprovalList.length > 0) {
@@ -1764,6 +1988,28 @@ defineExpose({
justify-content: center;
}
/* 自动计算得分样式 */
.score-display.auto-calculated {
/* background: #f0f9ff; */
/* order: 1px solid #38bdf8; */
/* color: #0369a1; */
font-weight: 600;
position: relative;
}
.score-display.auto-calculated::after {
/* content: '自动计算'; */
position: absolute;
top: -8px;
right: -8px;
background: #38bdf8;
color: white;
font-size: 10px;
padding: 1px 4px;
border-radius: 2px;
font-weight: normal;
}
/* 备注展示样式 */
.remark-display {
padding: 8px 12px;
@@ -1,15 +1,15 @@
<template>
<el-dialog :title="`${indicatorName} - 学生数据详情`" v-model="dialogVisible" width="1000px" append-to-body destroy-on-close>
<div v-loading="loading" element-loading-text="正在加载数据...">
<!-- 违纪处分记录区域 -->
<el-card class="mb-4" shadow="never">
<!-- 违纪处分记录区域 - 只有数据时才显示 -->
<el-card class="mb-4" shadow="never" v-if="disciplineRecords.length > 0">
<template #header>
<div class="card-header">
<span>违纪处分记录</span>
<el-tag type="danger" size="small">{{ disciplineRecords.length }} 条记录</el-tag>
</div>
</template>
<el-table :data="disciplineRecords" border style="width: 100%" v-if="disciplineRecords.length > 0">
<el-table :data="disciplineRecords" border style="width: 100%">
<el-table-column label="违纪日期" prop="disciplineDate" width="120">
<template #default="scope">
{{ formatDate(scope.row.disciplineDate) }}
@@ -24,18 +24,17 @@
</template>
</el-table-column>
</el-table>
<el-empty v-else description="暂无违纪处分记录" />
</el-card>
<!-- 奖励记录区域 -->
<el-card shadow="never">
<!-- 奖励记录区域 - 只有数据时才显示 -->
<el-card shadow="never" v-if="rewardRecords.length > 0">
<template #header>
<div class="card-header">
<span>奖励记录</span>
<el-tag type="success" size="small">{{ rewardRecords.length }} 条记录</el-tag>
</div>
</template>
<el-table :data="rewardRecords" border style="width: 100%" v-if="rewardRecords.length > 0">
<el-table :data="rewardRecords" border style="width: 100%">
<el-table-column label="奖励日期" prop="rewardDate" width="120">
<template #default="scope">
{{ formatDate(scope.row.rewardDate) }}
@@ -49,8 +48,10 @@
</template>
</el-table-column>
</el-table>
<el-empty v-else description="暂无奖励记录" />
</el-card>
<!-- 当没有任何数据时显示 -->
<el-empty v-if="disciplineRecords.length === 0 && rewardRecords.length === 0 && !loading" description="暂无相关数据记录" />
</div>
</el-dialog>
</template>
@@ -67,10 +67,10 @@
<el-card shadow="never">
<template #header>
<div class="card-header">
<span>指标模块</span>
<span>指标模块(基础分:100分)</span>
</div>
</template>
<el-table :data="form.selfScoreList" border style="width: 100%">
<el-table :data="sortedSelfScoreList" border style="width: 100%">
<el-table-column label="指标名称" prop="indicatorName" min-width="120">
<template #default="scope">
<div class="indicator-name-cell">
@@ -484,46 +484,130 @@ const isViewMode = computed(() => {
return dialog.title === '查看考核申请' || form.value.status === '6';
});
/** 计算总得分 */
const calculateTotalScore = () => {
// 计算自评得分
let selfScore = 0;
if (form.value.selfScoreList && form.value.selfScoreList.length > 0) {
selfScore += form.value.selfScoreList.reduce((sum, item) => {
const score = parseFloat(String(item.selfScore || 0)) || 0;
return sum + score;
}, 0);
// 计算排序后的指标列表
const sortedSelfScoreList = computed(() => {
if (!form.value.selfScoreList || form.value.selfScoreList.length === 0) {
return [];
}
// 创建副本进行排序,避免修改原数据
const list = [...form.value.selfScoreList];
return list.sort((a, b) => {
const scoreA = parseFloat(String(a.selfScore || 0)) || 0;
const scoreB = parseFloat(String(b.selfScore || 0)) || 0;
// 如果A不为0,B为0,A排前面
if (scoreA !== 0 && scoreB === 0) return -1;
// 如果A为0,B不为0,B排前面
if (scoreA === 0 && scoreB !== 0) return 1;
// 如果都不为0,按分值倒序排列(高分在前)
if (scoreA !== 0 && scoreB !== 0) return scoreB - scoreA;
// 如果都为0,保持原顺序
return 0;
});
});
/** 计算总得分(新算分规则) */
const calculateTotalScore = () => {
// 第1步:基础分100分 - 指标模块的扣分,最小为0
const baseScore = 100;
let totalIndicatorDeduction = 0;
let totalIndicatorAddition = 0;
// 计算指标模块的总扣分和总加分
if (form.value.selfScoreList && form.value.selfScoreList.length > 0) {
form.value.selfScoreList.forEach((item) => {
// 兼容性处理:如果存在 deductionScore 和 additionScore 字段,使用新算分规则
const itemWithNewFields = item as any; // 类型断言以访问可能的新字段
if (itemWithNewFields.deductionScore !== undefined || itemWithNewFields.additionScore !== undefined) {
const deduction = parseFloat(String(itemWithNewFields.deductionScore || 0)) || 0;
const addition = parseFloat(String(itemWithNewFields.additionScore || 0)) || 0;
totalIndicatorDeduction += deduction;
totalIndicatorAddition += addition;
} else {
// 兼容性处理:如果没有新字段,从 selfScore 推算(假设都是加分)
const score = parseFloat(String(item.selfScore || 0)) || 0;
if (score >= 0) {
totalIndicatorAddition += score;
} else {
totalIndicatorDeduction += Math.abs(score);
}
}
});
}
// 第1步:基础分 - 扣分,结果不能小于0
let step1Score = baseScore - totalIndicatorDeduction;
if (step1Score < 0) {
step1Score = 0;
}
// 第2步:加上指标模块的加分
const step2Score = step1Score + totalIndicatorAddition;
// 第3步:加上附加分模块的分值(可正可负)
let totalBonusScore = 0;
if (form.value.bonusApprovalList && form.value.bonusApprovalList.length > 0) {
selfScore += form.value.bonusApprovalList.reduce((sum, item) => {
totalBonusScore = form.value.bonusApprovalList.reduce((sum, item) => {
const score = parseFloat(String(item.bonusScore || 0)) || 0;
return sum + score;
}, 0);
}
form.value.selfScore = parseFloat(selfScore.toFixed(1));
// 最终自评得分
const finalSelfScore = step2Score + totalBonusScore;
form.value.selfScore = parseFloat(finalSelfScore.toFixed(1));
// 计算班主任评分
let teacherScore = 0;
console.log(
`自评得分计算详情: 基础分=${baseScore}, 指标扣分=${totalIndicatorDeduction}, 第1步结果=${step1Score}, 指标加分=${totalIndicatorAddition}, 第2步结果=${step2Score}, 附加分=${totalBonusScore}, 最终得分=${form.value.selfScore}`
);
// 班主任评分采用相同逻辑,但使用班主任的评分数据
let teacherTotalIndicatorDeduction = 0;
let teacherTotalIndicatorAddition = 0;
// 计算班主任对指标模块的评分
if (form.value.selfScoreList && form.value.selfScoreList.length > 0) {
teacherScore += form.value.selfScoreList.reduce((sum, item) => {
const score = parseFloat(String(item.teacherScore || 0)) || 0;
return sum + score;
}, 0);
form.value.selfScoreList.forEach((item) => {
const teacherScore = parseFloat(String(item.teacherScore || 0)) || 0;
// 班主任评分:负数视为扣分,正数视为加分
if (teacherScore < 0) {
teacherTotalIndicatorDeduction += Math.abs(teacherScore);
} else {
teacherTotalIndicatorAddition += teacherScore;
}
});
}
// 第1步:基础分 - 班主任评定的扣分
let teacherStep1Score = baseScore - teacherTotalIndicatorDeduction;
if (teacherStep1Score < 0) {
teacherStep1Score = 0;
}
// 第2步:加上班主任评定的加分
const teacherStep2Score = teacherStep1Score + teacherTotalIndicatorAddition;
// 第3步:加上附加分模块的审核得分
let totalApprovalScore = 0;
if (form.value.bonusApprovalList && form.value.bonusApprovalList.length > 0) {
teacherScore += form.value.bonusApprovalList.reduce((sum, item) => {
totalApprovalScore = form.value.bonusApprovalList.reduce((sum, item) => {
const score = parseFloat(String(item.approvalScore || 0)) || 0;
return sum + score;
}, 0);
}
form.value.teacherScore = parseFloat(teacherScore.toFixed(1));
// 最终班主任评分
const finalTeacherScore = teacherStep2Score + totalApprovalScore;
form.value.teacherScore = parseFloat(finalTeacherScore.toFixed(1));
// 总得分等于班主任评分
form.value.totalScore = parseFloat(teacherScore.toFixed(1));
form.value.totalScore = parseFloat(finalTeacherScore.toFixed(1));
console.log(
`班主任评分计算详情: 基础分=${baseScore}, 指标扣分=${teacherTotalIndicatorDeduction}, 第1步结果=${teacherStep1Score}, 指标加分=${teacherTotalIndicatorAddition}, 第2步结果=${teacherStep2Score}, 附加审核分=${totalApprovalScore}, 最终得分=${form.value.teacherScore}`
);
};
/** 获取状态标签类型 */
@@ -1465,11 +1549,24 @@ defineExpose({
.indicator-name-cell {
display: flex;
align-items: center;
gap: 8px;
gap: 6px;
}
.indicator-name-cell span {
flex: 1;
font-size: inherit;
}
.indicator-data-btn {
flex-shrink: 0;
margin-left: 4px;
transform: scale(0.7);
opacity: 0.7;
}
.indicator-data-btn:hover {
transform: scale(0.8);
opacity: 1;
transition: all 0.2s ease;
}
</style>
@@ -26,7 +26,8 @@
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<!-- 隐藏最高分值字段 -->
<el-col :span="12" v-show="false">
<el-form-item label="最高分值" prop="maxScore">
<el-input-number
v-model="form.maxScore"
@@ -68,52 +69,46 @@
</el-col>
</el-row>
<!-- 关联的违纪处分类型和奖励类型 -->
<!-- 关联的违纪处分类型和奖励类型(改为单选且互斥) -->
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="违纪处分类型" prop="disciplineTypeIds">
<el-form-item label="违纪处分类型" prop="disciplineTypeId">
<el-select
v-model="form.disciplineTypeIds"
v-model="form.disciplineTypeId"
placeholder="请选择违纪处分类型"
multiple
filterable
clearable
style="width: 100%"
:disabled="dialog.title === '查看'"
class="fixed-height-select"
collapse-tags
collapse-tags-tooltip
@change="onDisciplineTypeChange"
>
<el-option v-for="type in disciplineTypeOptions" :key="type.id" :label="`${type.typeCode} - ${type.typeName}`" :value="type.id" />
</el-select>
</el-form-item>
<!-- 显示选择的违纪处分类型 -->
<div v-if="selectedDisciplineTypes.length > 0" class="selected-items">
<div v-if="selectedDisciplineType" class="selected-items">
<div class="selected-title">已选择的违纪处分类型:</div>
<div v-for="type in selectedDisciplineTypes" :key="type.id" class="selected-item">{{ type.typeCode }} - {{ type.typeName }}</div>
<div class="selected-item">{{ selectedDisciplineType.typeCode }} - {{ selectedDisciplineType.typeName }}</div>
</div>
</el-col>
<el-col :span="12">
<el-form-item label="奖励类型" prop="rewardTypeIds">
<el-form-item label="奖励类型" prop="rewardTypeId">
<el-select
v-model="form.rewardTypeIds"
v-model="form.rewardTypeId"
placeholder="请选择奖励类型"
multiple
filterable
clearable
style="width: 100%"
:disabled="dialog.title === '查看'"
class="fixed-height-select"
collapse-tags
collapse-tags-tooltip
@change="onRewardTypeChange"
>
<el-option v-for="type in rewardTypeOptions" :key="type.id" :label="`${type.typeCode} - ${type.typeName}`" :value="type.id" />
</el-select>
</el-form-item>
<!-- 显示选择的奖励类型 -->
<div v-if="selectedRewardTypes.length > 0" class="selected-items">
<div v-if="selectedRewardType" class="selected-items">
<div class="selected-title">已选择的奖励类型:</div>
<div v-for="type in selectedRewardTypes" :key="type.id" class="selected-item">{{ type.typeCode }} - {{ type.typeName }}</div>
<div class="selected-item">{{ selectedRewardType.typeCode }} - {{ selectedRewardType.typeName }}</div>
</div>
</el-col>
</el-row>
@@ -158,11 +153,11 @@ const initFormData: XskhAssessmentIndicatorForm = {
indicatorName: undefined,
description: undefined,
indicatorTypeId: undefined,
maxScore: undefined,
maxScore: 100, // 默认值设为100
status: '0',
sortOrder: 0,
disciplineTypeIds: [],
rewardTypeIds: []
disciplineTypeId: undefined, // 改为单个值
rewardTypeId: undefined // 改为单个值
};
const data = reactive({
@@ -181,22 +176,38 @@ const rules = reactive({
{ min: 1, max: 100, message: '指标名称长度必须介于 1 和 100 之间', trigger: 'blur' }
],
indicatorTypeId: [{ required: true, message: '指标类型不能为空', trigger: 'change' }],
maxScore: [{ required: true, message: '最高分值不能为空', trigger: 'blur' }],
// maxScore: [{ required: true, message: '最高分值不能为空', trigger: 'blur' }],
status: [{ required: true, message: '状态不能为空', trigger: 'change' }],
sortOrder: [{ required: true, message: '排序号不能为空', trigger: 'blur' }],
description: [{ max: 500, message: '指标说明长度不能超过 500 个字符', trigger: 'blur' }]
} as any);
// 计算属性:已选择的违纪处分类型
const selectedDisciplineTypes = computed(() => {
return disciplineTypeOptions.value.filter((type) => form.value.disciplineTypeIds?.includes(type.id.toString()));
// 计算属性:已选择的违纪处分类型(改为单个)
const selectedDisciplineType = computed(() => {
return disciplineTypeOptions.value.find((type) => type.id.toString() === form.value.disciplineTypeId?.toString());
});
// 计算属性:已选择的奖励类型
const selectedRewardTypes = computed(() => {
return rewardTypeOptions.value.filter((type) => form.value.rewardTypeIds?.includes(type.id.toString()));
// 计算属性:已选择的奖励类型(改为单个)
const selectedRewardType = computed(() => {
return rewardTypeOptions.value.find((type) => type.id.toString() === form.value.rewardTypeId?.toString());
});
// 违纪处分类型选择变化时的处理(实现互斥逻辑)
const onDisciplineTypeChange = (value: any) => {
if (value) {
// 如果选择了违纪处分类型,清空奖励类型
form.value.rewardTypeId = undefined;
}
};
// 奖励类型选择变化时的处理(实现互斥逻辑)
const onRewardTypeChange = (value: any) => {
if (value) {
// 如果选择了奖励类型,清空违纪处分类型
form.value.disciplineTypeId = undefined;
}
};
/** 获取指标类型选项 */
const getIndicatorTypeOptions = async () => {
try {
@@ -270,7 +281,41 @@ const openDialog = async (id?: string | number, title?: string) => {
if (id) {
try {
const res = await getAssessmentIndicator(id);
Object.assign(form.value, res.data);
console.log('API响应数据:', res);
console.log('res.data:', res.data);
// 处理后端返回的数据,将数组格式转换为单个值格式
const responseData = res.data;
console.log('处理后的数据:', responseData);
// 创建表单数据对象,只包含表单需要的字段
const formData: any = {
id: responseData.id,
indicatorCode: responseData.indicatorCode,
indicatorName: responseData.indicatorName,
description: responseData.description,
indicatorTypeId: responseData.indicatorTypeId,
maxScore: responseData.maxScore,
status: responseData.status,
sortOrder: responseData.sortOrder
};
// 转换违纪处分类型ID(取第一个,因为前端现在只支持单选)
if (responseData.disciplineTypeIds && responseData.disciplineTypeIds.length > 0) {
formData.disciplineTypeId = responseData.disciplineTypeIds[0];
}
// 转换奖励类型ID(取第一个,因为前端现在只支持单选)
if (responseData.rewardTypeIds && responseData.rewardTypeIds.length > 0) {
formData.rewardTypeId = responseData.rewardTypeIds[0];
}
console.log('表单数据:', formData);
console.log('赋值前的form.value:', form.value);
Object.assign(form.value, formData);
console.log('赋值后的form.value:', form.value);
} catch (error) {
console.error('获取数据失败:', error);
}
@@ -282,11 +327,27 @@ const submitForm = async () => {
assessmentIndicatorFormRef.value?.validate(async (valid) => {
if (valid) {
try {
// 按照XskhAssessmentIndicatorForm接口定义,只提取需要的字段
const submitData: any = {
indicatorCode: form.value.indicatorCode,
indicatorName: form.value.indicatorName,
description: form.value.description,
indicatorTypeId: form.value.indicatorTypeId,
maxScore: Number(form.value.maxScore) || 100,
status: form.value.status,
sortOrder: form.value.sortOrder,
// 将单个ID转换为数组格式以兼容后端
disciplineTypeIds: form.value.disciplineTypeId ? [form.value.disciplineTypeId] : [],
rewardTypeIds: form.value.rewardTypeId ? [form.value.rewardTypeId] : []
};
// 如果是编辑,添加ID字段
if (form.value.id) {
await updateAssessmentIndicator(form.value);
submitData.id = form.value.id;
await updateAssessmentIndicator(submitData);
proxy?.$modal.msgSuccess('修改成功');
} else {
await addAssessmentIndicator(form.value);
await addAssessmentIndicator(submitData);
proxy?.$modal.msgSuccess('新增成功');
}
dialog.visible = false;
@@ -331,34 +392,4 @@ defineExpose({
color: #409eff;
font-size: 14px;
}
/* 固定多选框高度,防止动态变化 */
.fixed-height-select :deep(.el-select__tags) {
max-height: 32px;
overflow: hidden;
}
.fixed-height-select :deep(.el-select__tags-text) {
max-width: 120px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.fixed-height-select :deep(.el-select__collapse-tags) {
max-width: 100%;
}
/* 确保多选框输入框高度固定 */
.fixed-height-select :deep(.el-input__wrapper) {
min-height: 32px;
max-height: 32px;
overflow: hidden;
}
/* 多选框下拉选项的最大高度 */
.fixed-height-select :deep(.el-select-dropdown__list) {
max-height: 200px;
overflow-y: auto;
}
</style>
@@ -62,7 +62,7 @@
<el-table-column label="指标名称" align="center" prop="indicatorName" min-width="140" show-overflow-tooltip />
<el-table-column label="指标类型" align="center" prop="indicatorTypeName" min-width="120" show-overflow-tooltip />
<el-table-column label="指标说明" align="center" prop="description" min-width="200" show-overflow-tooltip />
<el-table-column label="最高分值" align="center" prop="maxScore" min-width="100">
<el-table-column label="最高分值" align="center" prop="maxScore" min-width="100" v-if="false">
<template #default="scope">
<span>{{ scope.row.maxScore ? parseFloat(scope.row.maxScore).toFixed(2) : '0.00' }}</span>
</template>
@@ -69,12 +69,12 @@
<el-input v-model="scope.row.indicatorDescription" readonly />
</template>
</el-table-column>
<el-table-column label="指标默认最高分值" min-width="150">
<el-table-column label="指标默认最高分值" min-width="150" v-if="false">
<template #default="scope">
<el-input v-model="scope.row.indicatorMaxScore" readonly />
</template>
</el-table-column>
<el-table-column label="该方案中该指标最高分值" min-width="180">
<el-table-column label="该方案中该指标最高分值" min-width="180" v-if="false">
<template #default="scope">
<el-input-number
v-model="scope.row.maxScore"
@@ -252,8 +252,8 @@ const openDialog = async (id?: string | number, title?: string) => {
dialog.visible = true;
dialog.title = title || '新增';
// 重置表单
Object.assign(form.value, initFormData);
// 重置表单数据
form.value = { ...initFormData };
indicatorList.value = [];
// 获取选项数据
@@ -304,8 +304,13 @@ const submitForm = async () => {
}
try {
// 准备提交数据,排除自动填充字段
const submitData = {
...form.value,
id: form.value.id,
planCode: form.value.planCode,
planName: form.value.planName,
description: form.value.description,
status: form.value.status,
indicatorList: indicatorList.value
};
@@ -182,6 +182,8 @@ const data = reactive<PageData<AssessmentScheduleFormType, XskhAssessmentSchedul
academicYear: undefined,
semester: undefined,
status: undefined,
orderByColumn: 'createTime',
isAsc: 'desc',
params: {}
}
});