feat(xg): 落实教师反馈中的留宿、点名、卫生和处分规则
留宿按次日早上8点结束,点名按校区分日共用批次,处分计入现有班级月扣分,开除学籍只登记不计分。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
51abfca40f
commit
f75c8a6834
49 files changed
+2163
-276
No files matched your search
+9
-1
@@ -386,7 +386,15 @@ public class FlwTaskServiceImpl implements IFlwTaskService {
|
||||
private QueryWrapper<FlowTaskBo> buildQueryWrapper(FlowTaskBo flowTaskBo) {
|
||||
QueryWrapper<FlowTaskBo> wrapper = Wrappers.query();
|
||||
wrapper.like(StringUtils.isNotBlank(flowTaskBo.getNodeName()), "t.node_name", flowTaskBo.getNodeName());
|
||||
wrapper.like(StringUtils.isNotBlank(flowTaskBo.getFlowName()), "t.flow_name", flowTaskBo.getFlowName());
|
||||
if (StringUtils.isNotBlank(flowTaskBo.getFlowName())) {
|
||||
String keyword = flowTaskBo.getFlowName().trim();
|
||||
String likeKeyword = "%" + keyword + "%";
|
||||
wrapper.and(w -> w.like("t.flow_name", keyword)
|
||||
.or()
|
||||
.apply("exists (select 1 from xg_student_leave l where cast(l.id as char) = t.business_id and ifnull(l.deleted, 0) = 0 and (l.student_name like {0} or l.student_no like {0}))", likeKeyword)
|
||||
.or()
|
||||
.apply("exists (select 1 from xg_student_cancel_leave c where cast(c.id as char) = t.business_id and ifnull(c.deleted, 0) = 0 and (c.student_name like {0} or c.student_no like {0}))", likeKeyword));
|
||||
}
|
||||
wrapper.like(StringUtils.isNotBlank(flowTaskBo.getFlowCode()), "t.flow_code", flowTaskBo.getFlowCode());
|
||||
wrapper.in(CollUtil.isNotEmpty(flowTaskBo.getCreateByIds()), "t.create_by", flowTaskBo.getCreateByIds());
|
||||
if (StringUtils.isNotBlank(flowTaskBo.getCategory())) {
|
||||
|
||||
+7
-5
@@ -41,19 +41,21 @@ public class XgDormRollCallController extends BaseController {
|
||||
/**
|
||||
* 当天点名人数汇总(总人数/已点名人数 + 请假/留宿/异常明细)
|
||||
*
|
||||
* @param buildingId 可选;空=全校,有值=指定楼栋
|
||||
* @param buildingId 可选,指定楼栋
|
||||
* @param campusId 可选,指定校区。校区和楼栋都为空时不汇总,避免两个校区混在一起
|
||||
*/
|
||||
@SaCheckPermission("dormRollCall:dormRollCall:list1")
|
||||
@GetMapping("/todaySummary")
|
||||
public R<DormRollCallTodaySummaryVo> todaySummary(
|
||||
@RequestParam(value = "buildingId", required = false) Long buildingId) {
|
||||
return R.ok(xgDormRollCallService.queryTodaySummary(buildingId));
|
||||
@RequestParam(value = "buildingId", required = false) Long buildingId,
|
||||
@RequestParam(value = "campusId", required = false) Long campusId) {
|
||||
return R.ok(xgDormRollCallService.queryTodaySummary(buildingId, campusId));
|
||||
}
|
||||
|
||||
@SaCheckPermission("dormRollCall:dormRollCall:add")
|
||||
@GetMapping("/generateBatchNo")
|
||||
public R<String> generateBatchNo() {
|
||||
return R.ok(xgDormRollCallService.generateBatchNo());
|
||||
public R<String> generateBatchNo(@RequestParam(value = "campusId", required = false) Long campusId) {
|
||||
return R.ok(xgDormRollCallService.generateBatchNo(campusId));
|
||||
}
|
||||
|
||||
@SaCheckPermission("dormRollCall:dormRollCall:list1")
|
||||
|
||||
+39
-1
@@ -1,6 +1,7 @@
|
||||
package org.dromara.xg.controller;
|
||||
|
||||
import org.dromara.common.web.handler.GlobalExceptionHandler;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -9,6 +10,7 @@ import lombok.RequiredArgsConstructor;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import jakarta.validation.constraints.*;
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.dev33.satoken.annotation.SaMode;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.dromara.common.idempotent.annotation.RepeatSubmit;
|
||||
@@ -111,7 +113,14 @@ public class XgStudentLeaveController extends BaseController {
|
||||
* @param studentIds 学生ID列表(逗号分隔)
|
||||
* @param checkDate 检查日期
|
||||
*/
|
||||
@SaCheckPermission("studentLeave:studentLeave:query")
|
||||
@SaCheckPermission(value = {
|
||||
"studentLeave:studentLeave:query",
|
||||
"dormHygieneCheck:dormHygieneCheck:list",
|
||||
"dormHygieneCheck:dormHygieneCheck:query",
|
||||
"dormHygieneCheck:dormHygieneCheck:add",
|
||||
"dormRollCall:dormRollCall:list1",
|
||||
"dormRollCall:dormRollCall:query"
|
||||
}, mode = SaMode.OR)
|
||||
@GetMapping("/queryByCheckDate")
|
||||
public R<Map<Long, XgStudentLeaveVo>> queryByCheckDate(
|
||||
@RequestParam("studentIds") String studentIds,
|
||||
@@ -130,4 +139,33 @@ public class XgStudentLeaveController extends BaseController {
|
||||
return R.fail("参数格式错误:" + GlobalExceptionHandler.safeMessage(e.getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询某一天内的有效请假(含白天临时请假、晚上晚归),供检查和点名只读查看。
|
||||
*/
|
||||
@SaCheckPermission(value = {
|
||||
"studentLeave:studentLeave:query",
|
||||
"dormHygieneCheck:dormHygieneCheck:list",
|
||||
"dormHygieneCheck:dormHygieneCheck:query",
|
||||
"dormHygieneCheck:dormHygieneCheck:add",
|
||||
"dormRollCall:dormRollCall:list1",
|
||||
"dormRollCall:dormRollCall:query"
|
||||
}, mode = SaMode.OR)
|
||||
@GetMapping("/queryByCheckDay")
|
||||
public R<Map<Long, List<XgStudentLeaveVo>>> queryByCheckDay(
|
||||
@RequestParam("studentIds") String studentIds,
|
||||
@RequestParam("checkDate") String checkDate) {
|
||||
try {
|
||||
List<Long> studentIdList = List.of(studentIds.split(","))
|
||||
.stream()
|
||||
.map(String::trim)
|
||||
.filter(text -> !text.isEmpty())
|
||||
.map(Long::valueOf)
|
||||
.toList();
|
||||
LocalDate day = LocalDateTime.parse(checkDate.replace(" ", "T")).toLocalDate();
|
||||
return R.ok(xgStudentLeaveService.queryStudentLeavesOverlappingDay(studentIdList, day));
|
||||
} catch (Exception e) {
|
||||
return R.fail("参数格式错误:" + GlobalExceptionHandler.safeMessage(e.getMessage()));
|
||||
}
|
||||
}
|
||||
}
|
||||
+7
-2
@@ -26,6 +26,11 @@ public interface IXgDormRollCallService {
|
||||
|
||||
String generateBatchNo();
|
||||
|
||||
/**
|
||||
* 每个校区每个自然日一个批次,该校区所有寝室老师共用。
|
||||
*/
|
||||
String generateBatchNo(Long campusId);
|
||||
|
||||
List<RoomRollCallStatusVo> getBuildingRoomsStatus(Long buildingId, String batchNo);
|
||||
|
||||
XgDormRollCallVo submitRollCall(XgDormRollCallBo bo);
|
||||
@@ -36,7 +41,7 @@ public interface IXgDormRollCallService {
|
||||
* 当天点名人数汇总(总人数 / 已点名人数 + 请假/留宿/异常明细)。
|
||||
* <p>
|
||||
* 总人数 = 有床位且在住学生数;已点名人数 = 本日点名明细有记录的去重学生数。
|
||||
* buildingId 为空时统计全校;有值时仅统计该楼。
|
||||
* 必须指定校区或楼栋,避免临安、西溪混在一起。
|
||||
*/
|
||||
DormRollCallTodaySummaryVo queryTodaySummary(Long buildingId);
|
||||
DormRollCallTodaySummaryVo queryTodaySummary(Long buildingId, Long campusId);
|
||||
}
|
||||
+6
@@ -5,6 +5,7 @@ import org.dromara.xg.domain.bo.XgStudentLeaveBo;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
@@ -77,4 +78,9 @@ public interface IXgStudentLeaveService {
|
||||
* @return 学生ID -> 请假信息的映射
|
||||
*/
|
||||
Map<Long, XgStudentLeaveVo> queryStudentLeavesByCheckDate(List<Long> studentIds, LocalDateTime checkDate);
|
||||
|
||||
/**
|
||||
* 查询与某一天有交集、且审批已结束的请假。用于教官查看白天临时请假和晚上晚归。
|
||||
*/
|
||||
Map<Long, List<XgStudentLeaveVo>> queryStudentLeavesOverlappingDay(List<Long> studentIds, LocalDate day);
|
||||
}
|
||||
+15
@@ -2524,9 +2524,11 @@ public class XgDormBedStudentServiceImpl implements IXgDormBedStudentService {
|
||||
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
Map<Long, XgStudentLeaveVo> leaveMap = Map.of();
|
||||
Map<Long, List<XgStudentLeaveVo>> todayLeaveMap = Map.of();
|
||||
Map<Long, XgHolidayStayVo> holidayStayMap = Map.of();
|
||||
if (!studentIds.isEmpty()) {
|
||||
leaveMap = xgStudentLeaveService.queryStudentLeavesByCheckDate(studentIds, now);
|
||||
todayLeaveMap = xgStudentLeaveService.queryStudentLeavesOverlappingDay(studentIds, now.toLocalDate());
|
||||
IXgHolidayStayService holidayStayService = xgHolidayStayServiceProvider.getIfAvailable();
|
||||
if (holidayStayService != null) {
|
||||
holidayStayMap = holidayStayService.queryStudentHolidayStaysByCheckDate(studentIds, now);
|
||||
@@ -2579,6 +2581,19 @@ public class XgDormBedStudentServiceImpl implements IXgDormBedStudentService {
|
||||
leaveInfoMap.put("leaveEndTime", leaveInfo.getEndTime());
|
||||
studentInfo.put("leaveInfo", leaveInfoMap);
|
||||
}
|
||||
List<XgStudentLeaveVo> todayLeaves = todayLeaveMap.get(studentIdValue);
|
||||
if (todayLeaves != null && !todayLeaves.isEmpty()) {
|
||||
List<Map<String, Object>> todayLeaveList = new ArrayList<>();
|
||||
for (XgStudentLeaveVo todayLeave : todayLeaves) {
|
||||
Map<String, Object> item = new LinkedHashMap<>();
|
||||
item.put("leaveId", todayLeave.getId());
|
||||
item.put("leaveTypeName", todayLeave.getLeaveTypeName());
|
||||
item.put("leaveStartTime", todayLeave.getStartTime());
|
||||
item.put("leaveEndTime", todayLeave.getEndTime());
|
||||
todayLeaveList.add(item);
|
||||
}
|
||||
studentInfo.put("todayLeaveList", todayLeaveList);
|
||||
}
|
||||
// 请假与假期留宿可同时生效,一并返回供点名双状态展示
|
||||
XgHolidayStayVo holidayStay = holidayStayMap.get(studentIdValue);
|
||||
if (holidayStay != null) {
|
||||
|
||||
+18
-3
@@ -36,6 +36,7 @@ import org.dromara.xg.service.IXgDormRollCallService;
|
||||
import org.dromara.common.satoken.utils.LoginHelper;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.*;
|
||||
@@ -126,6 +127,15 @@ public class XgDormRollCallServiceImpl implements IXgDormRollCallService {
|
||||
|
||||
@Override
|
||||
public String generateBatchNo() {
|
||||
return generateBatchNo(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String generateBatchNo(Long campusId) {
|
||||
if (campusId != null) {
|
||||
String day = LocalDate.now().format(DateTimeFormatter.BASIC_ISO_DATE);
|
||||
return "RC" + day + "C" + campusId;
|
||||
}
|
||||
String timestamp = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmmss"));
|
||||
String random = String.format("%04x", ThreadLocalRandom.current().nextInt(0x10000));
|
||||
return "RC" + timestamp + random;
|
||||
@@ -276,15 +286,19 @@ public class XgDormRollCallServiceImpl implements IXgDormRollCallService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public DormRollCallTodaySummaryVo queryTodaySummary(Long buildingId) {
|
||||
public DormRollCallTodaySummaryVo queryTodaySummary(Long buildingId, Long campusId) {
|
||||
DormRollCallTodaySummaryVo summary = new DormRollCallTodaySummaryVo();
|
||||
if (buildingId == null && campusId == null) {
|
||||
return summary;
|
||||
}
|
||||
|
||||
// 总人数:有床位且在住(status=0)
|
||||
// 总人数:有床位且在住(status=0),按校区或楼栋分开统计
|
||||
LambdaQueryWrapper<XgDormBedStudent> totalLqw = Wrappers.<XgDormBedStudent>lambdaQuery()
|
||||
.eq(XgDormBedStudent::getStatus, "0")
|
||||
.eq(XgDormBedStudent::getDeleted, "0")
|
||||
.isNotNull(XgDormBedStudent::getStudentId)
|
||||
.isNotNull(XgDormBedStudent::getBedId)
|
||||
.eq(campusId != null, XgDormBedStudent::getCampusId, campusId)
|
||||
.eq(buildingId != null, XgDormBedStudent::getBuildingId, buildingId);
|
||||
Long totalStudents = bedStudentMapper.selectCount(totalLqw);
|
||||
summary.setTotalStudentCount(totalStudents == null ? 0 : totalStudents.intValue());
|
||||
@@ -292,11 +306,11 @@ public class XgDormRollCallServiceImpl implements IXgDormRollCallService {
|
||||
Date dayBegin = DateUtil.beginOfDay(new Date());
|
||||
Date dayEnd = DateUtil.endOfDay(new Date());
|
||||
|
||||
// 全校或指定楼栋的当天点名主表
|
||||
LambdaQueryWrapper<XgDormRollCall> rollLqw = Wrappers.<XgDormRollCall>lambdaQuery()
|
||||
.eq(XgDormRollCall::getStatus, "0")
|
||||
.ge(XgDormRollCall::getCheckDate, dayBegin)
|
||||
.le(XgDormRollCall::getCheckDate, dayEnd)
|
||||
.eq(campusId != null, XgDormRollCall::getCampusId, campusId)
|
||||
.eq(buildingId != null, XgDormRollCall::getBuildingId, buildingId)
|
||||
.orderByDesc(XgDormRollCall::getCheckDate);
|
||||
List<XgDormRollCall> todayRecords = baseMapper.selectList(rollLqw);
|
||||
@@ -397,6 +411,7 @@ public class XgDormRollCallServiceImpl implements IXgDormRollCallService {
|
||||
private LambdaQueryWrapper<XgDormRollCall> buildQueryWrapper(XgDormRollCallBo bo) {
|
||||
LambdaQueryWrapper<XgDormRollCall> lqw = Wrappers.<XgDormRollCall>lambdaQuery();
|
||||
lqw.like(StringUtils.isNotBlank(bo.getBatchNo()), XgDormRollCall::getBatchNo, bo.getBatchNo());
|
||||
lqw.eq(bo.getCampusId() != null, XgDormRollCall::getCampusId, bo.getCampusId());
|
||||
lqw.eq(bo.getBuildingId() != null, XgDormRollCall::getBuildingId, bo.getBuildingId());
|
||||
lqw.eq(bo.getRoomId() != null, XgDormRollCall::getRoomId, bo.getRoomId());
|
||||
lqw.eq(bo.getCheckerId() != null, XgDormRollCall::getCheckerId, bo.getCheckerId());
|
||||
|
||||
+46
-2
@@ -98,7 +98,7 @@ public class XgHolidayStayServiceImpl implements IXgHolidayStayService {
|
||||
private LambdaQueryWrapper<XgHolidayStay> buildQueryWrapper(XgHolidayStayBo bo) {
|
||||
Map<String, Object> params = bo.getParams();
|
||||
LambdaQueryWrapper<XgHolidayStay> lqw = Wrappers.lambdaQuery();
|
||||
lqw.orderByAsc(XgHolidayStay::getId);
|
||||
lqw.orderByAsc(XgHolidayStay::getApplyStartDate).orderByAsc(XgHolidayStay::getId);
|
||||
lqw.eq(bo.getDeleted() != null, XgHolidayStay::getDeleted, bo.getDeleted());
|
||||
lqw.eq(bo.getStudentId() != null, XgHolidayStay::getStudentId, bo.getStudentId());
|
||||
lqw.like(StringUtils.isNotBlank(bo.getStudentName()), XgHolidayStay::getStudentName, bo.getStudentName());
|
||||
@@ -256,6 +256,51 @@ public class XgHolidayStayServiceImpl implements IXgHolidayStayService {
|
||||
if (StringUtils.isBlank(entity.getEmergencyPhone())) {
|
||||
throw new ServiceException("紧急联系电话不能为空");
|
||||
}
|
||||
normalizeStayWindow(entity);
|
||||
}
|
||||
|
||||
/**
|
||||
* 学生只选日期。开始日 08:00,结束日的次日 08:00。
|
||||
* 结束时间已经是 08:00 且晚于开始日时视为已规范化,避免编辑时再加一天。
|
||||
*/
|
||||
private void normalizeStayWindow(XgHolidayStay entity) {
|
||||
if (entity.getApplyStartDate() == null || entity.getApplyEndDate() == null) {
|
||||
throw new ServiceException("请选择留宿开始和结束日期");
|
||||
}
|
||||
Calendar start = Calendar.getInstance();
|
||||
start.setTime(entity.getApplyStartDate());
|
||||
Calendar end = Calendar.getInstance();
|
||||
end.setTime(entity.getApplyEndDate());
|
||||
|
||||
Calendar startDay = (Calendar) start.clone();
|
||||
startDay.set(Calendar.HOUR_OF_DAY, 0);
|
||||
startDay.set(Calendar.MINUTE, 0);
|
||||
startDay.set(Calendar.SECOND, 0);
|
||||
startDay.set(Calendar.MILLISECOND, 0);
|
||||
|
||||
boolean endAlreadyMorning = end.get(Calendar.HOUR_OF_DAY) == 8
|
||||
&& end.get(Calendar.MINUTE) == 0
|
||||
&& end.get(Calendar.SECOND) == 0
|
||||
&& end.after(startDay);
|
||||
|
||||
start.set(Calendar.HOUR_OF_DAY, 8);
|
||||
start.set(Calendar.MINUTE, 0);
|
||||
start.set(Calendar.SECOND, 0);
|
||||
start.set(Calendar.MILLISECOND, 0);
|
||||
|
||||
if (!endAlreadyMorning) {
|
||||
end.add(Calendar.DAY_OF_MONTH, 1);
|
||||
}
|
||||
end.set(Calendar.HOUR_OF_DAY, 8);
|
||||
end.set(Calendar.MINUTE, 0);
|
||||
end.set(Calendar.SECOND, 0);
|
||||
end.set(Calendar.MILLISECOND, 0);
|
||||
|
||||
if (!end.after(start)) {
|
||||
throw new ServiceException("留宿结束日期不能早于开始日期");
|
||||
}
|
||||
entity.setApplyStartDate(start.getTime());
|
||||
entity.setApplyEndDate(end.getTime());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -851,7 +896,6 @@ public class XgHolidayStayServiceImpl implements IXgHolidayStayService {
|
||||
if (bo.getClassId() == null) {
|
||||
lqw.in(XgHolidayStay::getClassId, classIds);
|
||||
}
|
||||
lqw.orderByDesc(XgHolidayStay::getApplyTime).orderByDesc(XgHolidayStay::getId);
|
||||
Page<XgHolidayStayVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
||||
return TableDataInfo.build(result);
|
||||
}
|
||||
|
||||
+27
@@ -52,12 +52,14 @@ import org.dromara.xg.domain.XgStudentManager;
|
||||
import org.dromara.xg.domain.XgStudentManagerSource;
|
||||
import org.dromara.xg.domain.XgClassMsg;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Collection;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
import java.util.HashSet;
|
||||
@@ -712,4 +714,29 @@ public class XgStudentLeaveServiceImpl implements IXgStudentLeaveService {
|
||||
));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<Long, List<XgStudentLeaveVo>> queryStudentLeavesOverlappingDay(List<Long> studentIds, LocalDate day) {
|
||||
if (studentIds == null || studentIds.isEmpty() || day == null) {
|
||||
return Map.of();
|
||||
}
|
||||
LocalDateTime dayStart = day.atStartOfDay();
|
||||
LocalDateTime dayEnd = day.atTime(23, 59, 59);
|
||||
LambdaQueryWrapper<XgStudentLeave> lqw = Wrappers.lambdaQuery();
|
||||
lqw.in(XgStudentLeave::getStudentId, studentIds);
|
||||
lqw.eq(XgStudentLeave::getApprovalStatus, BusinessStatusEnum.FINISH.getStatus());
|
||||
lqw.le(XgStudentLeave::getStartTime, dayEnd);
|
||||
lqw.ge(XgStudentLeave::getEndTime, dayStart);
|
||||
lqw.orderByAsc(XgStudentLeave::getStartTime);
|
||||
List<XgStudentLeave> leaveList = baseMapper.selectList(lqw);
|
||||
Map<Long, List<XgStudentLeaveVo>> grouped = new HashMap<>();
|
||||
for (XgStudentLeave leave : leaveList) {
|
||||
if (leave.getStudentId() == null) {
|
||||
continue;
|
||||
}
|
||||
grouped.computeIfAbsent(leave.getStudentId(), key -> new ArrayList<>())
|
||||
.add(MapstructUtils.convert(leave, XgStudentLeaveVo.class));
|
||||
}
|
||||
return grouped;
|
||||
}
|
||||
|
||||
}
|
||||
+60
@@ -19,6 +19,8 @@ import org.dromara.common.core.validate.EditGroup;
|
||||
import org.dromara.common.log.enums.BusinessType;
|
||||
import org.dromara.common.excel.utils.ExcelUtil;
|
||||
import org.dromara.xskh.domain.vo.XskhDisciplineRecordVo;
|
||||
import org.dromara.xskh.domain.vo.XskhPunishmentExportVo;
|
||||
import org.dromara.xskh.domain.vo.XskhPunishmentSummaryVo;
|
||||
import org.dromara.xskh.domain.bo.XskhDisciplineRecordBo;
|
||||
import org.dromara.xskh.domain.vo.XskhStudentOptionVo;
|
||||
import org.dromara.xskh.service.IXskhDisciplineRecordService;
|
||||
@@ -188,4 +190,62 @@ public class XskhDisciplineRecordController extends BaseController {
|
||||
PageQuery pageQuery) {
|
||||
return xskhDisciplineRecordService.queryMyCreatedPageList(bo, pageQuery);
|
||||
}
|
||||
|
||||
/**
|
||||
* 学生处分种类
|
||||
*/
|
||||
@SaCheckPermission("disciplineRecord:disciplineRecord:query")
|
||||
@GetMapping("/punishment/options")
|
||||
public R<List<Map<String, Object>>> punishmentOptions() {
|
||||
return R.ok(xskhDisciplineRecordService.punishmentOptions());
|
||||
}
|
||||
|
||||
/**
|
||||
* 录入学生处分,分值计入班级月扣分。开除学籍不计分。
|
||||
*/
|
||||
@SaCheckPermission("disciplineRecord:disciplineRecord:add")
|
||||
@Log(title = "学生处分", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit()
|
||||
@PostMapping("/punishment")
|
||||
public R<Void> addPunishment(@RequestBody XskhDisciplineRecordBo bo) {
|
||||
return toAjax(xskhDisciplineRecordService.insertPunishment(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 学生处分汇总:按种类、按班级
|
||||
*/
|
||||
@SaCheckPermission("disciplineRecord:disciplineRecord:list")
|
||||
@GetMapping("/punishment/summary")
|
||||
public R<XskhPunishmentSummaryVo> punishmentSummary(XskhDisciplineRecordBo bo) {
|
||||
return R.ok(xskhDisciplineRecordService.summarizePunishment(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出学生处分登记表
|
||||
*/
|
||||
@SaCheckPermission("disciplineRecord:disciplineRecord:export")
|
||||
@Log(title = "学生处分登记表", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/punishment/export")
|
||||
public void exportPunishment(XskhDisciplineRecordBo bo, HttpServletResponse response) {
|
||||
List<XskhPunishmentExportVo> list = xskhDisciplineRecordService.listPunishmentExport(bo);
|
||||
ExcelUtil.exportExcel(list, "学生处分登记表", XskhPunishmentExportVo.class, response);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出学生处分汇总表
|
||||
*/
|
||||
@SaCheckPermission("disciplineRecord:disciplineRecord:export")
|
||||
@Log(title = "学生处分汇总表", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/punishment/exportSummary")
|
||||
public void exportPunishmentSummary(XskhDisciplineRecordBo bo, HttpServletResponse response) {
|
||||
XskhPunishmentSummaryVo summary = xskhDisciplineRecordService.summarizePunishment(bo);
|
||||
List<XskhPunishmentSummaryVo.Row> rows = new java.util.ArrayList<>();
|
||||
if (summary.getByType() != null) {
|
||||
rows.addAll(summary.getByType());
|
||||
}
|
||||
if (summary.getByClass() != null) {
|
||||
rows.addAll(summary.getByClass());
|
||||
}
|
||||
ExcelUtil.exportExcel(rows, "学生处分汇总表", XskhPunishmentSummaryVo.Row.class, response);
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -111,7 +111,7 @@ public class XskhDisciplineRecord extends TenantEntity {
|
||||
private String status;
|
||||
|
||||
/**
|
||||
* 违纪来源(1-宿舍卫生检查 2-教学区违纪)
|
||||
* 违纪来源(1-宿舍卫生检查 2-教学区违纪 3-学生处分)
|
||||
*/
|
||||
private String violationSource;
|
||||
|
||||
|
||||
+18
-1
@@ -129,10 +129,27 @@ public class XskhDisciplineRecordBo extends BaseEntity {
|
||||
private String status;
|
||||
|
||||
/**
|
||||
* 违纪来源(1-宿舍卫生检查 2-教学区违纪)
|
||||
* 违纪来源(1-宿舍卫生检查 2-教学区违纪 3-学生处分)
|
||||
*/
|
||||
private String violationSource;
|
||||
|
||||
/**
|
||||
* 处分编码(cf_warning 等),仅学生处分录入使用
|
||||
*/
|
||||
private String punishmentCode;
|
||||
|
||||
/**
|
||||
* 查询开始日期
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
private LocalDate beginDisciplineDate;
|
||||
|
||||
/**
|
||||
* 查询结束日期
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
private LocalDate endDisciplineDate;
|
||||
|
||||
/**
|
||||
* 附件OSS ID列表,逗号分隔
|
||||
*/
|
||||
|
||||
+46
@@ -0,0 +1,46 @@
|
||||
package org.dromara.xskh.domain.vo;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
|
||||
/**
|
||||
* 学生处分登记表导出行
|
||||
*/
|
||||
@Data
|
||||
public class XskhPunishmentExportVo implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ExcelProperty("学号")
|
||||
private String studentNo;
|
||||
|
||||
@ExcelProperty("姓名")
|
||||
private String studentName;
|
||||
|
||||
@ExcelProperty("学院")
|
||||
private String collegeName;
|
||||
|
||||
@ExcelProperty("班级")
|
||||
private String className;
|
||||
|
||||
@ExcelProperty("处分种类")
|
||||
private String disciplineTypeName;
|
||||
|
||||
@ExcelProperty("班级扣分")
|
||||
private BigDecimal scoreDeduction;
|
||||
|
||||
@ExcelProperty("处分日期")
|
||||
private LocalDate disciplineDate;
|
||||
|
||||
@ExcelProperty("原因")
|
||||
private String disciplineReason;
|
||||
|
||||
@ExcelProperty("备注")
|
||||
private String disciplineContent;
|
||||
}
|
||||
+43
@@ -0,0 +1,43 @@
|
||||
package org.dromara.xskh.domain.vo;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 学生处分汇总
|
||||
*/
|
||||
@Data
|
||||
public class XskhPunishmentSummaryVo implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private List<Row> byType = new ArrayList<>();
|
||||
|
||||
private List<Row> byClass = new ArrayList<>();
|
||||
|
||||
@Data
|
||||
public static class Row implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ExcelProperty("维度")
|
||||
private String dimension;
|
||||
|
||||
@ExcelProperty("名称")
|
||||
private String name;
|
||||
|
||||
@ExcelProperty("人次")
|
||||
private Integer count;
|
||||
|
||||
@ExcelProperty("班级扣分")
|
||||
private BigDecimal score;
|
||||
}
|
||||
}
|
||||
+2
@@ -31,6 +31,8 @@ public interface XskhDisciplineRecordMapper extends BaseMapperPlus<XskhDisciplin
|
||||
@Param("offset") Integer offset,
|
||||
@Param("pageSize") Integer pageSize);
|
||||
|
||||
XskhStudentOptionVo selectStudentById(@Param("id") Long id);
|
||||
|
||||
/**
|
||||
* 查询班主任班级的违纪处分记录列表(班主任专用)
|
||||
*
|
||||
|
||||
+10
@@ -4,6 +4,8 @@ import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.xskh.domain.bo.XskhDisciplineRecordBo;
|
||||
import org.dromara.xskh.domain.vo.XskhDisciplineRecordVo;
|
||||
import org.dromara.xskh.domain.vo.XskhPunishmentExportVo;
|
||||
import org.dromara.xskh.domain.vo.XskhPunishmentSummaryVo;
|
||||
import org.dromara.xskh.domain.vo.XskhStudentOptionVo;
|
||||
|
||||
import java.util.Collection;
|
||||
@@ -123,4 +125,12 @@ public interface IXskhDisciplineRecordService {
|
||||
* @return 违纪记录分页列表
|
||||
*/
|
||||
TableDataInfo<XskhDisciplineRecordVo> queryMyCreatedPageList(XskhDisciplineRecordBo bo, PageQuery pageQuery);
|
||||
|
||||
List<Map<String, Object>> punishmentOptions();
|
||||
|
||||
Boolean insertPunishment(XskhDisciplineRecordBo bo);
|
||||
|
||||
XskhPunishmentSummaryVo summarizePunishment(XskhDisciplineRecordBo bo);
|
||||
|
||||
List<XskhPunishmentExportVo> listPunishmentExport(XskhDisciplineRecordBo bo);
|
||||
}
|
||||
+181
-1
@@ -5,22 +5,31 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.dromara.common.core.exception.ServiceException;
|
||||
import org.dromara.common.core.utils.MapstructUtils;
|
||||
import org.dromara.common.core.utils.StringUtils;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.common.satoken.utils.LoginHelper;
|
||||
import org.dromara.xskh.domain.XskhDisciplineRecord;
|
||||
import org.dromara.xskh.domain.XskhDisciplineType;
|
||||
import org.dromara.xskh.domain.bo.XskhDisciplineRecordBo;
|
||||
import org.dromara.xskh.domain.vo.XskhDisciplineRecordVo;
|
||||
import org.dromara.xskh.domain.vo.XskhPunishmentExportVo;
|
||||
import org.dromara.xskh.domain.vo.XskhPunishmentSummaryVo;
|
||||
import org.dromara.xskh.domain.vo.XskhStudentOptionVo;
|
||||
import org.dromara.xskh.mapper.XskhDisciplineRecordMapper;
|
||||
import org.dromara.xskh.mapper.XskhDisciplineTypeMapper;
|
||||
import org.dromara.xskh.service.IXskhDisciplineRecordService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Arrays;
|
||||
@@ -37,7 +46,18 @@ import java.util.stream.Collectors;
|
||||
@Service
|
||||
public class XskhDisciplineRecordServiceImpl implements IXskhDisciplineRecordService {
|
||||
|
||||
private static final String PUNISHMENT_SOURCE = "3";
|
||||
|
||||
private static final List<PunishmentLevel> PUNISHMENT_LEVELS = List.of(
|
||||
new PunishmentLevel("cf_warning", "警告", new BigDecimal("4")),
|
||||
new PunishmentLevel("cf_serious_warning", "严重警告", new BigDecimal("5")),
|
||||
new PunishmentLevel("cf_demerit", "记过", new BigDecimal("8")),
|
||||
new PunishmentLevel("cf_probation", "留校察看", new BigDecimal("10")),
|
||||
new PunishmentLevel("cf_expulsion", "开除学籍", BigDecimal.ZERO)
|
||||
);
|
||||
|
||||
private final XskhDisciplineRecordMapper baseMapper;
|
||||
private final XskhDisciplineTypeMapper disciplineTypeMapper;
|
||||
|
||||
/**
|
||||
* 查询学生违纪处分记录
|
||||
@@ -81,8 +101,13 @@ public class XskhDisciplineRecordServiceImpl implements IXskhDisciplineRecordSer
|
||||
lqw.eq(bo.getClassId() != null, XskhDisciplineRecord::getClassId, bo.getClassId());
|
||||
lqw.like(StringUtils.isNotBlank(bo.getClassName()), XskhDisciplineRecord::getClassName, bo.getClassName());
|
||||
lqw.eq(bo.getDisciplineTypeId() != null, XskhDisciplineRecord::getDisciplineTypeId, bo.getDisciplineTypeId());
|
||||
lqw.like(StringUtils.isNotBlank(bo.getDisciplineTypeName()), XskhDisciplineRecord::getDisciplineTypeName,
|
||||
if (PUNISHMENT_SOURCE.equals(bo.getViolationSource())) {
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getDisciplineTypeName()), XskhDisciplineRecord::getDisciplineTypeName,
|
||||
bo.getDisciplineTypeName());
|
||||
} else {
|
||||
lqw.like(StringUtils.isNotBlank(bo.getDisciplineTypeName()), XskhDisciplineRecord::getDisciplineTypeName,
|
||||
bo.getDisciplineTypeName());
|
||||
}
|
||||
lqw.eq(bo.getDisciplineDate() != null, XskhDisciplineRecord::getDisciplineDate, bo.getDisciplineDate());
|
||||
lqw.like(StringUtils.isNotBlank(bo.getDisciplineReason()), XskhDisciplineRecord::getDisciplineReason,
|
||||
bo.getDisciplineReason());
|
||||
@@ -90,6 +115,9 @@ public class XskhDisciplineRecordServiceImpl implements IXskhDisciplineRecordSer
|
||||
bo.getDisciplineContent());
|
||||
lqw.eq(bo.getScoreDeduction() != null, XskhDisciplineRecord::getScoreDeduction, bo.getScoreDeduction());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getStatus()), XskhDisciplineRecord::getStatus, bo.getStatus());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getViolationSource()), XskhDisciplineRecord::getViolationSource, bo.getViolationSource());
|
||||
lqw.ge(bo.getBeginDisciplineDate() != null, XskhDisciplineRecord::getDisciplineDate, bo.getBeginDisciplineDate());
|
||||
lqw.le(bo.getEndDisciplineDate() != null, XskhDisciplineRecord::getDisciplineDate, bo.getEndDisciplineDate());
|
||||
lqw.orderByDesc(XskhDisciplineRecord::getCreateTime);
|
||||
return lqw;
|
||||
}
|
||||
@@ -339,4 +367,156 @@ public class XskhDisciplineRecordServiceImpl implements IXskhDisciplineRecordSer
|
||||
log.info("查询到 {} 条记录", result.getTotal());
|
||||
return TableDataInfo.build(result);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Map<String, Object>> punishmentOptions() {
|
||||
List<Map<String, Object>> options = new ArrayList<>();
|
||||
for (PunishmentLevel level : PUNISHMENT_LEVELS) {
|
||||
Map<String, Object> item = new LinkedHashMap<>();
|
||||
item.put("code", level.code);
|
||||
item.put("name", level.name);
|
||||
item.put("score", level.score);
|
||||
item.put("countInClass", level.score.compareTo(BigDecimal.ZERO) > 0);
|
||||
options.add(item);
|
||||
}
|
||||
return options;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean insertPunishment(XskhDisciplineRecordBo bo) {
|
||||
if (bo == null || bo.getStudentId() == null) {
|
||||
throw new ServiceException("请选择学生");
|
||||
}
|
||||
if (StringUtils.isBlank(bo.getDisciplineReason())) {
|
||||
throw new ServiceException("请填写处分原因");
|
||||
}
|
||||
PunishmentLevel level = findPunishmentLevel(bo.getPunishmentCode());
|
||||
XskhStudentOptionVo student = baseMapper.selectStudentById(bo.getStudentId());
|
||||
if (student == null) {
|
||||
throw new ServiceException("未找到学生信息");
|
||||
}
|
||||
if (student.getClassId() == null) {
|
||||
throw new ServiceException("该学生未分配班级,无法把处分计入班级");
|
||||
}
|
||||
XskhDisciplineType type = ensurePunishmentType(level);
|
||||
XskhDisciplineRecord record = new XskhDisciplineRecord();
|
||||
record.setStudentId(student.getId());
|
||||
record.setStudentNo(student.getStudentNo());
|
||||
record.setStudentName(student.getName());
|
||||
record.setCollegeId(student.getCollegeId());
|
||||
record.setCollegeName(student.getCollegeName());
|
||||
record.setMajorId(student.getMajorId());
|
||||
record.setMajorName(student.getMajorName());
|
||||
record.setClassId(student.getClassId());
|
||||
record.setClassName(student.getClassName());
|
||||
record.setDisciplineTypeId(type.getId());
|
||||
record.setDisciplineTypeName(level.name);
|
||||
record.setDisciplineDate(bo.getDisciplineDate() == null ? LocalDate.now() : bo.getDisciplineDate());
|
||||
record.setDisciplineReason(bo.getDisciplineReason().trim());
|
||||
record.setDisciplineContent(bo.getDisciplineContent());
|
||||
record.setScoreDeduction(level.score);
|
||||
record.setStatus("1");
|
||||
record.setViolationSource(PUNISHMENT_SOURCE);
|
||||
return baseMapper.insert(record) > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public XskhPunishmentSummaryVo summarizePunishment(XskhDisciplineRecordBo bo) {
|
||||
List<XskhDisciplineRecordVo> records = listPunishmentRecords(bo);
|
||||
Map<String, XskhPunishmentSummaryVo.Row> typeMap = new LinkedHashMap<>();
|
||||
for (PunishmentLevel level : PUNISHMENT_LEVELS) {
|
||||
typeMap.put(level.name, summaryRow("处分种类", level.name));
|
||||
}
|
||||
Map<String, XskhPunishmentSummaryVo.Row> classMap = new LinkedHashMap<>();
|
||||
for (XskhDisciplineRecordVo record : records) {
|
||||
String typeName = StringUtils.blankToDefault(record.getDisciplineTypeName(), "未分类");
|
||||
XskhPunishmentSummaryVo.Row typeRow = typeMap.computeIfAbsent(typeName, name -> summaryRow("处分种类", name));
|
||||
addSummary(typeRow, record.getScoreDeduction());
|
||||
String classKey = StringUtils.blankToDefault(record.getCollegeName(), "") + "/"
|
||||
+ StringUtils.blankToDefault(record.getClassName(), "未分班");
|
||||
XskhPunishmentSummaryVo.Row classRow = classMap.computeIfAbsent(classKey,
|
||||
key -> summaryRow("班级", classKey));
|
||||
addSummary(classRow, record.getScoreDeduction());
|
||||
}
|
||||
XskhPunishmentSummaryVo summary = new XskhPunishmentSummaryVo();
|
||||
summary.setByType(new ArrayList<>(typeMap.values()));
|
||||
summary.setByClass(new ArrayList<>(classMap.values()));
|
||||
return summary;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<XskhPunishmentExportVo> listPunishmentExport(XskhDisciplineRecordBo bo) {
|
||||
return listPunishmentRecords(bo).stream().map(record -> {
|
||||
XskhPunishmentExportVo row = new XskhPunishmentExportVo();
|
||||
row.setStudentNo(record.getStudentNo());
|
||||
row.setStudentName(record.getStudentName());
|
||||
row.setCollegeName(record.getCollegeName());
|
||||
row.setClassName(record.getClassName());
|
||||
row.setDisciplineTypeName(record.getDisciplineTypeName());
|
||||
row.setScoreDeduction(record.getScoreDeduction());
|
||||
row.setDisciplineDate(record.getDisciplineDate());
|
||||
row.setDisciplineReason(record.getDisciplineReason());
|
||||
row.setDisciplineContent(record.getDisciplineContent());
|
||||
return row;
|
||||
}).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
private List<XskhDisciplineRecordVo> listPunishmentRecords(XskhDisciplineRecordBo bo) {
|
||||
if (bo == null) {
|
||||
bo = new XskhDisciplineRecordBo();
|
||||
}
|
||||
bo.setViolationSource(PUNISHMENT_SOURCE);
|
||||
return queryList(bo);
|
||||
}
|
||||
|
||||
private PunishmentLevel findPunishmentLevel(String code) {
|
||||
if (StringUtils.isBlank(code)) {
|
||||
throw new ServiceException("请选择处分种类");
|
||||
}
|
||||
return PUNISHMENT_LEVELS.stream()
|
||||
.filter(level -> level.code.equals(code))
|
||||
.findFirst()
|
||||
.orElseThrow(() -> new ServiceException("处分种类不正确"));
|
||||
}
|
||||
|
||||
private XskhDisciplineType ensurePunishmentType(PunishmentLevel level) {
|
||||
XskhDisciplineType existing = disciplineTypeMapper.selectOne(Wrappers.<XskhDisciplineType>lambdaQuery()
|
||||
.eq(XskhDisciplineType::getTypeCode, level.code)
|
||||
.last("limit 1"));
|
||||
if (existing != null) {
|
||||
return existing;
|
||||
}
|
||||
XskhDisciplineType type = new XskhDisciplineType();
|
||||
type.setTypeCode(level.code);
|
||||
type.setTypeName(level.name);
|
||||
type.setTypeCategory("2");
|
||||
type.setAreaType("0");
|
||||
type.setMinScore(level.score);
|
||||
type.setMaxScore(level.score);
|
||||
type.setStatus("0");
|
||||
type.setIsEqualized("0");
|
||||
type.setSortOrder((long) (PUNISHMENT_LEVELS.indexOf(level) + 1));
|
||||
type.setRemark(level.score.compareTo(BigDecimal.ZERO) > 0
|
||||
? "学生处分,计入班级月扣分"
|
||||
: "开除学籍不计班级扣分");
|
||||
disciplineTypeMapper.insert(type);
|
||||
return type;
|
||||
}
|
||||
|
||||
private XskhPunishmentSummaryVo.Row summaryRow(String dimension, String name) {
|
||||
XskhPunishmentSummaryVo.Row row = new XskhPunishmentSummaryVo.Row();
|
||||
row.setDimension(dimension);
|
||||
row.setName(name);
|
||||
row.setCount(0);
|
||||
row.setScore(BigDecimal.ZERO);
|
||||
return row;
|
||||
}
|
||||
|
||||
private void addSummary(XskhPunishmentSummaryVo.Row row, BigDecimal score) {
|
||||
row.setCount(row.getCount() + 1);
|
||||
row.setScore(row.getScore().add(score == null ? BigDecimal.ZERO : score));
|
||||
}
|
||||
|
||||
private record PunishmentLevel(String code, String name, BigDecimal score) {
|
||||
}
|
||||
}
|
||||
+10
@@ -49,6 +49,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
select id, student_id, student_no, student_name, college_id, college_name, major_id, major_name, class_id, class_name, discipline_type_id, discipline_type_name, discipline_date, discipline_reason, discipline_content, score_deduction, status, violation_source, attachment_oss_ids, create_by, create_time, create_dept, update_by, update_time, deleted, tenant_id from xskh_discipline_record
|
||||
</sql>
|
||||
|
||||
<select id="selectStudentById" resultMap="StudentOptionResult">
|
||||
select
|
||||
id, student_no, name, college_id, college_name,
|
||||
major_id, major_name, class_id, class_name
|
||||
from xg_student_msg
|
||||
where deleted = 0
|
||||
and id = #{id}
|
||||
limit 1
|
||||
</select>
|
||||
|
||||
<select id="selectStudentOptions" resultMap="StudentOptionResult">
|
||||
select
|
||||
id, student_no, name, college_id, college_name,
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
-- =============================================================================
|
||||
-- 2026-11-13 教师反馈整改
|
||||
-- 1. 违纪来源增加「学生处分」
|
||||
-- 2. 在违纪处分记录菜单下增加「学生处分」页面,并授权给已有该菜单的角色
|
||||
-- 处分种类由后端按编码自动补齐,本脚本不写死类型数据
|
||||
-- 执行后相关用户需重新登录
|
||||
-- =============================================================================
|
||||
|
||||
INSERT INTO `sys_dict_data` (
|
||||
`dict_code`, `tenant_id`, `dict_sort`, `dict_label`, `dict_value`,
|
||||
`dict_type`, `css_class`, `list_class`, `is_default`,
|
||||
`create_dept`, `create_by`, `create_time`, `remark`
|
||||
)
|
||||
SELECT 2026111310010000001, '000000', 3, '学生处分', '3', 'xskh_violation_source', '', 'warning', 'N',
|
||||
103, 1, NOW(), '学生处分。警告4、严重警告5、记过8、留校察看10计入班级月扣分;开除学籍记0分'
|
||||
FROM DUAL
|
||||
WHERE NOT EXISTS (
|
||||
SELECT 1 FROM `sys_dict_data` WHERE `dict_type` = 'xskh_violation_source' AND `dict_value` = '3'
|
||||
);
|
||||
|
||||
INSERT INTO `sys_menu` (
|
||||
`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query_param`,
|
||||
`is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`,
|
||||
`create_dept`, `create_by`, `create_time`, `remark`
|
||||
)
|
||||
SELECT 2026111310010000101, '学生处分', parent.menu_id, 8, 'studentPunishment', 'xskh/studentPunishment/index', NULL,
|
||||
1, 0, 'C', '0', '0', 'disciplineRecord:disciplineRecord:list', 'form',
|
||||
103, 1, NOW(), '学生处分登记。分值进入班主任考核班级月扣分,开除学籍不计分'
|
||||
FROM `sys_menu` parent
|
||||
WHERE parent.perms = 'disciplineRecord:disciplineRecord:list'
|
||||
AND parent.menu_type = 'C'
|
||||
AND NOT EXISTS (SELECT 1 FROM `sys_menu` WHERE `menu_id` = 2026111310010000101)
|
||||
LIMIT 1;
|
||||
|
||||
INSERT INTO `sys_role_menu` (`role_id`, `menu_id`)
|
||||
SELECT DISTINCT rm.role_id, 2026111310010000101
|
||||
FROM `sys_role_menu` rm
|
||||
JOIN `sys_menu` parent ON parent.menu_id = rm.menu_id
|
||||
WHERE parent.perms = 'disciplineRecord:disciplineRecord:list'
|
||||
AND parent.menu_type = 'C'
|
||||
AND EXISTS (SELECT 1 FROM `sys_menu` WHERE `menu_id` = 2026111310010000101)
|
||||
AND NOT EXISTS (
|
||||
SELECT 1 FROM `sys_role_menu` owned
|
||||
WHERE owned.role_id = rm.role_id AND owned.menu_id = 2026111310010000101
|
||||
);
|
||||
@@ -0,0 +1,39 @@
|
||||
# 2026-11-13 教师反馈整改说明
|
||||
|
||||
## 假期留宿
|
||||
|
||||
学生和管理员只选日期。保存时开始日写成当天 08:00:00,结束日写成最后一晚的次日 08:00:00。已经是次日 08:00:00 的记录再次保存时不再加一天。待审、已通过可以按寝室号搜索,列表按开始日期升序。
|
||||
|
||||
## 寝室点名
|
||||
|
||||
同一校区同一天共用一个批次,格式 `RC{yyyyMMdd}C{校区ID}`。未传校区时今日汇总返回空,不汇总全校。请假和假期留宿同时显示;请假结束时刻落在 20:30–24:00 或 00:00–05:00 时,床位用橙色标出预计返寝时间。
|
||||
|
||||
## 纪律卫生
|
||||
|
||||
扣分项按类型说明前缀分成卫生、纪律、重大违纪,其余归入其他。分值按 0.5 分一档。每项可填写说明,提醒按钮展示类型规则。
|
||||
|
||||
教官查看当天请假使用:
|
||||
|
||||
`GET /studentLeave/studentLeave/queryByCheckDay?studentIds=&checkDate=`
|
||||
|
||||
返回学生 ID 到请假列表。权限与请假查询、宿舍检查、宿舍点名任一满足即可。床位是否锁定为请假仍按检查时刻是否落在请假区间内判断,不把当天已结束的请假算成当前请假。
|
||||
|
||||
## 请假待办
|
||||
|
||||
移动端从我的待办办理完成后回到待办列表。我的已办搜索词同时匹配流程名称、学生姓名、学号,销假同样适用。
|
||||
|
||||
## 学生处分
|
||||
|
||||
与日常违纪扣分分开。固定种类和分值:警告 4、严重警告 5、记过 8、留校察看 10、开除学籍 0。开除学籍仍登记人次,不计入班级月扣分。其余分值写入 `xskh_discipline_record`,`violation_source=3`、状态生效,由班主任考核现有的班级月扣分汇总计入。
|
||||
|
||||
| 方法 | 路径 | 说明 |
|
||||
| --- | --- | --- |
|
||||
| GET | `/disciplineRecord/disciplineRecord/punishment/options` | 处分种类 |
|
||||
| POST | `/disciplineRecord/disciplineRecord/punishment` | 登记。必填学生、种类编码、原因;班级从学生信息带出 |
|
||||
| GET | `/disciplineRecord/disciplineRecord/punishment/summary` | 按种类、按班级汇总人次和扣分 |
|
||||
| POST | `/disciplineRecord/disciplineRecord/punishment/export` | 导出登记表 |
|
||||
| POST | `/disciplineRecord/disciplineRecord/punishment/exportSummary` | 导出汇总表 |
|
||||
|
||||
列表沿用 `/disciplineRecord/disciplineRecord/list`,筛选 `violationSource=3`。
|
||||
|
||||
上线时执行 `backend/script/sql/update/update_20261113_feedback_rectify.sql`,然后重启后端。已登录用户需要重新登录后才能看到新菜单。
|
||||
@@ -183,6 +183,7 @@
|
||||
| [班级教师关联管理API](./班级教师关联管理API.md) | 班主任辅导员关联关系 | ✅ 完成 | 2025-01-27 |
|
||||
| [班主任班级宿舍情况查看API](./班主任班级宿舍情况查看API.md) | 班主任只读查看本班宿舍违纪与点名 | ✅ 完成 | 2026-06-23 |
|
||||
| **[学生考核管理系统API](./学生考核管理系统API.md)** | **学生综合素质测评、违纪处分、奖励加分管理** | **✅ 完成** | **2025-01-27** |
|
||||
| [20261113教师反馈整改说明](./20261113教师反馈整改说明.md) | 假期留宿时间、点名批次、当天请假、学生处分 | ✅ 完成 | 2026-11-13 |
|
||||
| **[学生考核管理系统修改方案](./学生考核管理系统API修改方案.md)** | **基于标准化违纪处分等级的系统升级方案** | **📋 方案** | **2025-01-27** |
|
||||
| **[学生考核管理系统数据库修改影响分析](./学生考核管理系统数据库修改影响分析.md)** | **数据库升级脚本执行的详细影响分析** | **📊 分析** | **2025-01-27** |
|
||||
|
||||
@@ -8,12 +8,13 @@ export const listDormRollCall = (query) => {
|
||||
});
|
||||
};
|
||||
|
||||
/** 当天点名人数汇总:不传=全校,传 buildingId=本楼 */
|
||||
export const getTodayRollCallSummary = (buildingId) => {
|
||||
/** 当天点名人数汇总:按校区或楼栋,不传则不汇总全校 */
|
||||
export const getTodayRollCallSummary = (params) => {
|
||||
const query = typeof params === 'object' && params !== null ? params : params ? { buildingId: params } : {};
|
||||
return request({
|
||||
url: '/dormRollCall/dormRollCall/todaySummary',
|
||||
method: 'GET',
|
||||
params: buildingId ? { buildingId } : undefined
|
||||
params: query
|
||||
});
|
||||
};
|
||||
|
||||
@@ -31,10 +32,11 @@ export const delDormRollCall = (id) => {
|
||||
});
|
||||
};
|
||||
|
||||
export const generateBatchNo = () => {
|
||||
export const generateBatchNo = (campusId) => {
|
||||
return request({
|
||||
url: '/dormRollCall/dormRollCall/generateBatchNo',
|
||||
method: 'GET'
|
||||
method: 'GET',
|
||||
params: campusId ? { campusId } : undefined
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
@@ -309,6 +309,14 @@
|
||||
"navigationBarTextStyle": "white"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/xskh/punishment/index",
|
||||
"style": {
|
||||
"navigationBarTitleText": "学生处分",
|
||||
"navigationBarBackgroundColor": "#0051d9",
|
||||
"navigationBarTextStyle": "white"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/xskh/wjjlEntry/disciplineRecordForm",
|
||||
"style": {
|
||||
|
||||
@@ -305,6 +305,20 @@
|
||||
</template>
|
||||
</ServiceItem>
|
||||
|
||||
<ServiceItem
|
||||
v-if="hasPermi(['student:violation:entry'])"
|
||||
title="学生处分"
|
||||
@click="gotoPunishment"
|
||||
>
|
||||
<template #icon>
|
||||
<image
|
||||
src="/static/00125.png"
|
||||
mode="aspectFit"
|
||||
style="width: 24px; height: 24px"
|
||||
/>
|
||||
</template>
|
||||
</ServiceItem>
|
||||
|
||||
<ServiceItem
|
||||
v-if="hasPermi(['student:violation:entry'])"
|
||||
title="违纪记录录入"
|
||||
@@ -1296,6 +1310,12 @@ export default {
|
||||
});
|
||||
},
|
||||
|
||||
gotoPunishment() {
|
||||
uni.navigateTo({
|
||||
url: '/pages/xskh/punishment/index',
|
||||
});
|
||||
},
|
||||
|
||||
// 跳转到考核申请页面
|
||||
gotoAssessmentApply() {
|
||||
uni.navigateTo({
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
<view class="search-container">
|
||||
<u-search
|
||||
v-model="queryParams.flowName"
|
||||
placeholder="请输入流程定义名称"
|
||||
placeholder="流程名称 / 学生姓名 / 学号"
|
||||
:show-action="true"
|
||||
action-text="搜索"
|
||||
:animation="true"
|
||||
|
||||
@@ -326,9 +326,20 @@ export default {
|
||||
|
||||
async created() {
|
||||
await this.loadFlowStatusDict();
|
||||
// 重置滚动位置
|
||||
this.scrollTop = 0;
|
||||
await this.getList();
|
||||
this._taskWaitingReady = true;
|
||||
uni.$on('refreshTaskWaiting', this.handleQuery);
|
||||
},
|
||||
|
||||
onShow() {
|
||||
if (this._taskWaitingReady) {
|
||||
this.handleQuery();
|
||||
}
|
||||
},
|
||||
|
||||
beforeDestroy() {
|
||||
uni.$off('refreshTaskWaiting', this.handleQuery);
|
||||
},
|
||||
|
||||
methods: {
|
||||
|
||||
@@ -3404,10 +3404,17 @@ export default {
|
||||
|
||||
// 延迟执行后续操作,确保用户看到成功提示
|
||||
setTimeout(() => {
|
||||
// 发送事件通知请假列表页面刷新数据
|
||||
uni.$emit('refreshLeaveList');
|
||||
|
||||
// 无论是编辑模式还是新增模式,都跳转到请假列表页面
|
||||
if (this.routeParams.type === 'approval') {
|
||||
uni.$emit('refreshTaskWaiting');
|
||||
uni.navigateBack({
|
||||
delta: 1,
|
||||
fail: () => {
|
||||
uni.redirectTo({ url: '/pages/task/taskWaiting' });
|
||||
},
|
||||
});
|
||||
return;
|
||||
}
|
||||
uni.navigateTo({
|
||||
url: '/pages/xg/xsjcxx/xsqj/leave/index',
|
||||
});
|
||||
|
||||
@@ -29,11 +29,11 @@
|
||||
</view>
|
||||
</u-form-item>
|
||||
|
||||
<u-form-item label="开始时间" prop="applyStartDate" required>
|
||||
<u-form-item label="开始日期" prop="applyStartDate" required>
|
||||
<view @click="openDate('start')" style="width: 100%">
|
||||
<u-input
|
||||
v-model="form.applyStartDate"
|
||||
placeholder="请选择开始时间"
|
||||
placeholder="请选择开始日期"
|
||||
readonly
|
||||
border="none"
|
||||
suffix-icon="arrow-down"
|
||||
@@ -43,11 +43,11 @@
|
||||
</view>
|
||||
</u-form-item>
|
||||
|
||||
<u-form-item label="结束时间" prop="applyEndDate" required>
|
||||
<u-form-item label="结束日期" prop="applyEndDate" required>
|
||||
<view @click="openDate('end')" style="width: 100%">
|
||||
<u-input
|
||||
v-model="form.applyEndDate"
|
||||
placeholder="请选择结束时间"
|
||||
placeholder="最后一晚,次日早上8点结束"
|
||||
readonly
|
||||
border="none"
|
||||
suffix-icon="arrow-down"
|
||||
@@ -124,7 +124,7 @@
|
||||
<u-datetime-picker
|
||||
:show="showDatePicker"
|
||||
v-model="dateValue"
|
||||
mode="datetime"
|
||||
mode="date"
|
||||
@confirm="onDateConfirm"
|
||||
@cancel="showDatePicker = false"
|
||||
@close="showDatePicker = false"
|
||||
@@ -282,12 +282,7 @@ export default {
|
||||
pad(d.getMonth() + 1) +
|
||||
'-' +
|
||||
pad(d.getDate()) +
|
||||
' ' +
|
||||
pad(d.getHours()) +
|
||||
':' +
|
||||
pad(d.getMinutes()) +
|
||||
':' +
|
||||
pad(d.getSeconds());
|
||||
' 00:00:00';
|
||||
if (this.dateField === 'start') {
|
||||
this.form.applyStartDate = str;
|
||||
} else {
|
||||
|
||||
@@ -25,6 +25,17 @@
|
||||
@custom="refresh"
|
||||
@clear="refresh"
|
||||
></u-search>
|
||||
<u-search
|
||||
v-if="applyStatus === '1' || applyStatus === '2'"
|
||||
v-model="roomName"
|
||||
placeholder="寝室号,如 6501"
|
||||
:show-action="true"
|
||||
action-text="搜索"
|
||||
@search="refresh"
|
||||
@custom="refresh"
|
||||
@clear="refresh"
|
||||
style="margin-top: 12rpx"
|
||||
></u-search>
|
||||
</view>
|
||||
|
||||
<u-loading-page :loading="loading && list.length === 0" loading-text="加载中..."></u-loading-page>
|
||||
@@ -95,6 +106,7 @@ export default {
|
||||
tabIndex: 1,
|
||||
applyStatus: '1',
|
||||
studentName: '',
|
||||
roomName: '',
|
||||
statusTabs: [
|
||||
{ name: '全部', value: '' },
|
||||
{ name: '待审', value: '1' },
|
||||
@@ -154,7 +166,11 @@ export default {
|
||||
pageNum: this.pageNum,
|
||||
pageSize: this.pageSize,
|
||||
applyStatus: this.applyStatus || undefined,
|
||||
studentName: this.studentName || undefined
|
||||
studentName: this.studentName || undefined,
|
||||
roomName:
|
||||
this.applyStatus === '1' || this.applyStatus === '2'
|
||||
? this.roomName || undefined
|
||||
: undefined
|
||||
});
|
||||
const rows = res.rows || [];
|
||||
this.total = res.total || 0;
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
:custom-style="{ marginLeft: bed.isLeaveAuto ? '8rpx' : '0' }"
|
||||
></u-tag>
|
||||
</view>
|
||||
<view v-if="isLateReturn(bed)" class="late-return-text">{{ formatHm(bed.leaveEndTime) }}返寝</view>
|
||||
<view
|
||||
v-if="!bed.isLeaveAuto && !bed.isHolidayStayAuto"
|
||||
class="status-label"
|
||||
@@ -230,6 +231,7 @@ export default {
|
||||
holidayType: null,
|
||||
holidayStartDate: null,
|
||||
holidayEndDate: null,
|
||||
todayLeaveList: item.todayLeaveList || [],
|
||||
};
|
||||
|
||||
if (!bed.studentId) {
|
||||
@@ -274,10 +276,31 @@ export default {
|
||||
}
|
||||
},
|
||||
|
||||
isLateReturn(bed) {
|
||||
if (!bed || !bed.leaveEndTime) return false;
|
||||
const date = new Date(String(bed.leaveEndTime).replace(/-/g, '/'));
|
||||
if (Number.isNaN(date.getTime())) return false;
|
||||
const minutes = date.getHours() * 60 + date.getMinutes();
|
||||
return minutes >= 20 * 60 + 30 || minutes <= 5 * 60;
|
||||
},
|
||||
|
||||
formatHm(value) {
|
||||
const date = new Date(String(value).replace(/-/g, '/'));
|
||||
if (Number.isNaN(date.getTime())) return '';
|
||||
const pad = (n) => String(n).padStart(2, '0');
|
||||
return `${pad(date.getHours())}:${pad(date.getMinutes())}`;
|
||||
},
|
||||
|
||||
formatDetailTime(value) {
|
||||
if (!value) return '-';
|
||||
return String(value).replace('T', ' ').slice(0, 16);
|
||||
},
|
||||
|
||||
getBedCardClass(bed) {
|
||||
if (bed.isLeaveAuto && bed.isHolidayStayAuto) return 'bed-leave bed-holiday-stay-both';
|
||||
const late = this.isLateReturn(bed) && bed.isLeaveAuto ? ' bed-late-return' : '';
|
||||
if (bed.isLeaveAuto && bed.isHolidayStayAuto) return 'bed-leave bed-holiday-stay-both' + late;
|
||||
if (bed.rollCallStatus === '0') return 'bed-present';
|
||||
if (bed.rollCallStatus === '1') return 'bed-leave';
|
||||
if (bed.rollCallStatus === '1') return 'bed-leave' + late;
|
||||
if (bed.rollCallStatus === '4') return 'bed-holiday-stay';
|
||||
if (bed.rollCallStatus === '2') return 'bed-absent';
|
||||
if (bed.rollCallStatus === '3') return 'bed-empty';
|
||||
@@ -308,13 +331,25 @@ export default {
|
||||
|
||||
handleBedClick(bed) {
|
||||
if (bed.isLeaveAuto || bed.isHolidayStayAuto) {
|
||||
const tip =
|
||||
bed.isLeaveAuto && bed.isHolidayStayAuto
|
||||
? '该学生同时处于请假与假期留宿,不可修改'
|
||||
: bed.isLeaveAuto
|
||||
? '该学生处于请假状态,不可修改'
|
||||
: '该学生处于假期留宿状态,不可修改';
|
||||
uni.showToast({ title: tip, icon: 'none' });
|
||||
const lines = [];
|
||||
if (bed.isLeaveAuto) {
|
||||
lines.push(
|
||||
`请假:${this.formatDetailTime(bed.leaveStartTime)} 至 ${this.formatDetailTime(bed.leaveEndTime)}`,
|
||||
);
|
||||
if (this.isLateReturn(bed)) {
|
||||
lines.push(`预计 ${this.formatHm(bed.leaveEndTime)} 返寝`);
|
||||
}
|
||||
}
|
||||
if (bed.isHolidayStayAuto) {
|
||||
lines.push(
|
||||
`假期留宿:${this.formatDetailTime(bed.holidayStartDate)} 至 ${this.formatDetailTime(bed.holidayEndDate)}`,
|
||||
);
|
||||
}
|
||||
uni.showModal({
|
||||
title: bed.studentName || '点名明细',
|
||||
content: lines.join('\n'),
|
||||
showCancel: false,
|
||||
});
|
||||
return;
|
||||
}
|
||||
if (!bed.studentId) {
|
||||
@@ -425,6 +460,18 @@ export default {
|
||||
background-color: #e8f5e9;
|
||||
border-color: #67c23a;
|
||||
}
|
||||
.late-return-text {
|
||||
margin-top: 6rpx;
|
||||
font-size: 20rpx;
|
||||
color: #fa8c16;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.bed-card.bed-late-return {
|
||||
background: #fff7e6;
|
||||
border-color: #fa8c16;
|
||||
}
|
||||
|
||||
.bed-leave {
|
||||
background-color: #fff8e1;
|
||||
border-color: #e6a23c;
|
||||
|
||||
@@ -65,7 +65,7 @@
|
||||
<view class="summary-header">
|
||||
<view class="summary-title-wrap">
|
||||
<text class="summary-title">今日点名汇总</text>
|
||||
<text class="summary-scope">全校</text>
|
||||
<text class="summary-scope" @click="showCampusPicker = true">{{ selectedCampusName || '请选择校区' }}</text>
|
||||
</view>
|
||||
<text class="summary-date">{{ todayLabel }}</text>
|
||||
</view>
|
||||
@@ -202,14 +202,29 @@
|
||||
<view class="detail-row-sub" v-if="detailPopupType === 'leave' && row.leaveTypeName">
|
||||
请假类型:{{ row.leaveTypeName }}
|
||||
</view>
|
||||
<view class="detail-row-sub" v-if="detailPopupType === 'leave' && (row.leaveStartTime || row.leaveEndTime)">
|
||||
请假时间:{{ formatDetailTime(row.leaveStartTime) }} 至 {{ formatDetailTime(row.leaveEndTime) }}
|
||||
</view>
|
||||
<view class="detail-row-sub" v-if="detailPopupType === 'holidayStay' && row.holidayType">
|
||||
假期类型:{{ row.holidayType }}
|
||||
</view>
|
||||
<view class="detail-row-sub" v-if="detailPopupType === 'holidayStay'">
|
||||
留宿时间:{{ formatDetailTime(row.holidayStartDate) }} 至 {{ formatDetailTime(row.holidayEndDate) }}
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</view>
|
||||
</u-popup>
|
||||
|
||||
<u-picker
|
||||
:show="showCampusPicker"
|
||||
:columns="campusColumns"
|
||||
keyName="text"
|
||||
@confirm="handleCampusConfirm"
|
||||
@cancel="showCampusPicker = false"
|
||||
@close="showCampusPicker = false"
|
||||
></u-picker>
|
||||
|
||||
<!-- 悬浮点名按钮 -->
|
||||
<view class="fab-button" @click="handleAdd">
|
||||
<u-icon name="plus" size="24" color="#ffffff" />
|
||||
@@ -233,8 +248,12 @@ export default {
|
||||
pageNum: 1,
|
||||
pageSize: 20,
|
||||
batchNo: '',
|
||||
campusId: '',
|
||||
buildingId: '',
|
||||
},
|
||||
campusOptions: [],
|
||||
selectedCampusName: '',
|
||||
showCampusPicker: false,
|
||||
buildingOptions: [],
|
||||
selectedBuildingName: '',
|
||||
showBuildingPicker: false,
|
||||
@@ -267,6 +286,9 @@ export default {
|
||||
totalPages() {
|
||||
return Math.ceil(this.total / this.queryParams.pageSize);
|
||||
},
|
||||
campusColumns() {
|
||||
return [this.campusOptions.map((item) => ({ text: item.campusName, value: item.id }))];
|
||||
},
|
||||
todayLabel() {
|
||||
const now = new Date();
|
||||
const m = String(now.getMonth() + 1).padStart(2, '0');
|
||||
@@ -283,20 +305,69 @@ export default {
|
||||
},
|
||||
},
|
||||
onShow() {
|
||||
this.loadBuildingOptions();
|
||||
this.refreshPageData();
|
||||
this.loadCampusOptions();
|
||||
},
|
||||
methods: {
|
||||
/** 列表 + 全校汇总一起刷新 */
|
||||
/** 列表和当前校区汇总一起刷新 */
|
||||
refreshPageData() {
|
||||
this.getList();
|
||||
this.loadTodaySummary();
|
||||
},
|
||||
|
||||
async loadTodaySummary() {
|
||||
formatDetailTime(value) {
|
||||
if (!value) return '-';
|
||||
return String(value).replace('T', ' ').slice(0, 16);
|
||||
},
|
||||
|
||||
async loadCampusOptions() {
|
||||
try {
|
||||
// 图1:始终全校汇总,不按筛选楼栋收窄
|
||||
const res = await getTodayRollCallSummary();
|
||||
const res = await request({ url: '/xqxx/dormCampus/list', method: 'GET' });
|
||||
this.campusOptions = res.rows || [];
|
||||
const saved = uni.getStorageSync('ssdm_campus_id');
|
||||
const matched = this.campusOptions.find((item) => String(item.id) === String(saved));
|
||||
if (matched) {
|
||||
this.applyCampus(matched, false);
|
||||
} else if (!this.queryParams.campusId) {
|
||||
this.list = [];
|
||||
this.total = 0;
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('加载校区失败:', error);
|
||||
}
|
||||
},
|
||||
|
||||
applyCampus(campus, resetBuilding) {
|
||||
this.queryParams.campusId = campus.id;
|
||||
this.selectedCampusName = campus.campusName;
|
||||
uni.setStorageSync('ssdm_campus_id', campus.id);
|
||||
if (resetBuilding) {
|
||||
this.queryParams.buildingId = '';
|
||||
this.selectedBuildingName = '';
|
||||
this.queryParams.pageNum = 1;
|
||||
}
|
||||
this.loadBuildingOptions(campus.id);
|
||||
this.refreshPageData();
|
||||
},
|
||||
|
||||
handleCampusConfirm(e) {
|
||||
const selected = e && e.value && e.value[0];
|
||||
this.showCampusPicker = false;
|
||||
if (!selected) return;
|
||||
const campus = this.campusOptions.find((item) => String(item.id) === String(selected.value));
|
||||
if (campus) {
|
||||
this.applyCampus(campus, true);
|
||||
}
|
||||
},
|
||||
|
||||
async loadTodaySummary() {
|
||||
if (!this.queryParams.campusId) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
const res = await getTodayRollCallSummary({
|
||||
campusId: this.queryParams.campusId,
|
||||
buildingId: this.queryParams.buildingId || undefined,
|
||||
});
|
||||
if (res && res.code === 200 && res.data) {
|
||||
this.todaySummary = {
|
||||
totalStudentCount: res.data.totalStudentCount || 0,
|
||||
@@ -327,6 +398,11 @@ export default {
|
||||
},
|
||||
|
||||
async getList() {
|
||||
if (!this.queryParams.campusId) {
|
||||
this.list = [];
|
||||
this.total = 0;
|
||||
return;
|
||||
}
|
||||
this.pageLoading = true;
|
||||
try {
|
||||
const res = await listDormRollCall(this.queryParams);
|
||||
@@ -342,9 +418,17 @@ export default {
|
||||
}
|
||||
},
|
||||
|
||||
async loadBuildingOptions() {
|
||||
async loadBuildingOptions(campusId) {
|
||||
if (!campusId) {
|
||||
this.buildingOptions = [];
|
||||
return;
|
||||
}
|
||||
try {
|
||||
const res = await request({ url: '/sslxx/dormBuilding/list', method: 'GET' });
|
||||
const res = await request({
|
||||
url: '/sslxx/dormBuilding/list',
|
||||
method: 'GET',
|
||||
params: { campusId },
|
||||
});
|
||||
this.buildingOptions = res.rows || [];
|
||||
} catch (error) {
|
||||
console.error('加载宿舍楼选项失败:', error);
|
||||
@@ -357,7 +441,10 @@ export default {
|
||||
},
|
||||
|
||||
resetQuery() {
|
||||
this.queryParams = { pageNum: 1, pageSize: 20, batchNo: '', buildingId: '' };
|
||||
const campusId = this.queryParams.campusId;
|
||||
const campusName = this.selectedCampusName;
|
||||
this.queryParams = { pageNum: 1, pageSize: 20, batchNo: '', campusId, buildingId: '' };
|
||||
this.selectedCampusName = campusName;
|
||||
this.selectedBuildingName = '';
|
||||
this.refreshPageData();
|
||||
},
|
||||
|
||||
@@ -148,9 +148,15 @@
|
||||
<view class="detail-row-sub" v-if="detailPopupType === 'leave' && row.leaveTypeName">
|
||||
请假类型:{{ row.leaveTypeName }}
|
||||
</view>
|
||||
<view class="detail-row-sub" v-if="detailPopupType === 'leave'">
|
||||
请假时间:{{ formatDetailTime(row.leaveStartTime) }} 至 {{ formatDetailTime(row.leaveEndTime) }}
|
||||
</view>
|
||||
<view class="detail-row-sub" v-if="detailPopupType === 'holidayStay' && row.holidayType">
|
||||
假期类型:{{ row.holidayType }}
|
||||
</view>
|
||||
<view class="detail-row-sub" v-if="detailPopupType === 'holidayStay'">
|
||||
留宿时间:{{ formatDetailTime(row.holidayStartDate) }} 至 {{ formatDetailTime(row.holidayEndDate) }}
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</view>
|
||||
@@ -243,7 +249,6 @@ export default {
|
||||
try {
|
||||
this.pageLoading = true;
|
||||
await this.fetchCurrentUserInfo();
|
||||
await this.generateBatchNoInternal();
|
||||
await this.loadCampusOptions();
|
||||
} catch (error) {
|
||||
console.error('初始化页面失败:', error);
|
||||
@@ -267,8 +272,11 @@ export default {
|
||||
},
|
||||
|
||||
async generateBatchNoInternal() {
|
||||
if (!this.formData.campusId) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
const res = await generateBatchNo();
|
||||
const res = await generateBatchNo(this.formData.campusId);
|
||||
if (res && res.code === 200) {
|
||||
this.formData.batchNo = res.data || res.msg || '';
|
||||
}
|
||||
@@ -342,6 +350,11 @@ export default {
|
||||
}
|
||||
},
|
||||
|
||||
formatDetailTime(value) {
|
||||
if (!value) return '-';
|
||||
return String(value).replace('T', ' ').slice(0, 16);
|
||||
},
|
||||
|
||||
openBuildingDetail(type) {
|
||||
this.detailPopupType = type;
|
||||
if (type === 'leave') {
|
||||
@@ -372,7 +385,9 @@ export default {
|
||||
this.completedRooms = [];
|
||||
this.hasLoadedRooms = false;
|
||||
this.resetBuildingSummary();
|
||||
this.formData.batchNo = '';
|
||||
this.loadBuildingOptions(campus.id);
|
||||
this.generateBatchNoInternal();
|
||||
}
|
||||
}
|
||||
this.showCampusPicker = false;
|
||||
|
||||
@@ -46,6 +46,11 @@
|
||||
/>
|
||||
<text v-else class="deduction-score">{{ item.score }}分</text>
|
||||
<text class="deduction-range">({{ getDeductionMin(item) }}-{{ getDeductionMax(item) }}分)</text>
|
||||
<text
|
||||
v-if="getDeductionRemark(item.disciplineTypeId)"
|
||||
class="deduction-remind"
|
||||
@click="showDeductionRemark(item)"
|
||||
>提醒</text>
|
||||
<u-icon
|
||||
v-if="!isViewMode"
|
||||
name="close-circle"
|
||||
@@ -54,9 +59,13 @@
|
||||
@click="removeDeductionItem(index)"
|
||||
></u-icon>
|
||||
</view>
|
||||
<view v-if="getDeductionRemark(item.disciplineTypeId)" class="deduction-remark">
|
||||
<text>{{ getDeductionRemark(item.disciplineTypeId) }}</text>
|
||||
</view>
|
||||
<u-input
|
||||
v-if="!isViewMode"
|
||||
v-model="item.remark"
|
||||
placeholder="本项扣分说明(选填)"
|
||||
border="surround"
|
||||
maxlength="200"
|
||||
/>
|
||||
</view>
|
||||
<view class="deduction-total">
|
||||
合计扣分:<text class="total-value">{{ formData.totalScore }}</text> 分
|
||||
@@ -71,13 +80,16 @@
|
||||
</view>
|
||||
<scroll-view scroll-y class="deduction-popup-body">
|
||||
<u-checkbox-group v-model="tempSelectedTypeIds" placement="column">
|
||||
<u-checkbox
|
||||
v-for="item in disciplineTypeOptions"
|
||||
:key="item.id"
|
||||
:name="String(item.id)"
|
||||
:label="`${item.typeName}(${item.minScore || 0}分起)`"
|
||||
customStyle="margin-bottom: 12px;"
|
||||
></u-checkbox>
|
||||
<view v-for="group in groupedDisciplineTypes" :key="group.label">
|
||||
<text class="deduction-group-title">{{ group.label }}</text>
|
||||
<u-checkbox
|
||||
v-for="item in group.options"
|
||||
:key="item.id"
|
||||
:name="String(item.id)"
|
||||
:label="`${item.typeName}(${item.minScore || 0}分起)`"
|
||||
customStyle="margin-bottom: 12px;"
|
||||
></u-checkbox>
|
||||
</view>
|
||||
</u-checkbox-group>
|
||||
</scroll-view>
|
||||
</view>
|
||||
@@ -425,49 +437,27 @@
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 请假信息 -->
|
||||
<view v-if="getStudentLeave(student.studentId)" class="leave-section">
|
||||
<view v-if="getStudentLeaves(student.studentId).length" class="leave-section">
|
||||
<view class="leave-header">
|
||||
<text class="leave-title">请假信息</text>
|
||||
<u-tag text="请假中" type="warning" size="mini"></u-tag>
|
||||
<text class="leave-title">今日请假</text>
|
||||
</view>
|
||||
<view class="leave-info">
|
||||
<view
|
||||
v-for="(leave, leaveIndex) in getStudentLeaves(student.studentId)"
|
||||
:key="leave.id || leaveIndex"
|
||||
class="leave-info"
|
||||
>
|
||||
<view class="leave-item">
|
||||
<text class="leave-label">发起时间:</text>
|
||||
<text class="leave-value">
|
||||
{{
|
||||
formatDateTime(
|
||||
getStudentLeave(student.studentId) &&
|
||||
getStudentLeave(student.studentId).createTime,
|
||||
)
|
||||
}}
|
||||
</text>
|
||||
<text class="leave-label">状态:</text>
|
||||
<text class="leave-value">{{ leaveTagText(leave) }}</text>
|
||||
</view>
|
||||
<view class="leave-item">
|
||||
<text class="leave-label">请假类型:</text>
|
||||
<text class="leave-value">{{ leave.leaveTypeName || '-' }}</text>
|
||||
</view>
|
||||
<view class="leave-item">
|
||||
<text class="leave-label">请假时间:</text>
|
||||
<text class="leave-value">
|
||||
{{
|
||||
formatDateTime(
|
||||
getStudentLeave(student.studentId) &&
|
||||
getStudentLeave(student.studentId).startTime,
|
||||
)
|
||||
}}
|
||||
至
|
||||
{{
|
||||
formatDateTime(
|
||||
getStudentLeave(student.studentId) &&
|
||||
getStudentLeave(student.studentId).endTime,
|
||||
)
|
||||
}}
|
||||
</text>
|
||||
</view>
|
||||
<view class="leave-item">
|
||||
<text class="leave-label">请假类型:</text>
|
||||
<text class="leave-value">
|
||||
{{
|
||||
getStudentLeave(student.studentId) &&
|
||||
getStudentLeave(student.studentId).leaveTypeName
|
||||
}}
|
||||
{{ formatDateTime(leave.startTime) }} 至 {{ formatDateTime(leave.endTime) }}
|
||||
</text>
|
||||
</view>
|
||||
</view>
|
||||
@@ -744,6 +734,27 @@ export default {
|
||||
return name;
|
||||
},
|
||||
|
||||
groupedDisciplineTypes() {
|
||||
const order = ['卫生', '纪律', '重大违纪', '其他'];
|
||||
const buckets = {
|
||||
卫生: [],
|
||||
纪律: [],
|
||||
重大违纪: [],
|
||||
其他: [],
|
||||
};
|
||||
(this.disciplineTypeOptions || []).forEach((item) => {
|
||||
const text = item.remark || '';
|
||||
let label = '其他';
|
||||
if (text.indexOf('重大违纪') === 0) label = '重大违纪';
|
||||
else if (text.indexOf('卫生') === 0) label = '卫生';
|
||||
else if (text.indexOf('纪律') === 0) label = '纪律';
|
||||
buckets[label].push(item);
|
||||
});
|
||||
return order
|
||||
.filter((label) => buckets[label].length)
|
||||
.map((label) => ({ label, options: buckets[label] }));
|
||||
},
|
||||
|
||||
deductionSummaryDisplay() {
|
||||
if (!this.deductionItems.length) return '';
|
||||
return this.deductionItems.map((item) => item.disciplineTypeName).join('、');
|
||||
@@ -1064,7 +1075,7 @@ export default {
|
||||
try {
|
||||
const studentIds = this.roomStudents.map((s) => s.studentId).join(',');
|
||||
const res = await request({
|
||||
url: '/studentLeave/studentLeave/queryByCheckDate',
|
||||
url: '/studentLeave/studentLeave/queryByCheckDay',
|
||||
method: 'GET',
|
||||
params: {
|
||||
studentIds,
|
||||
@@ -1073,14 +1084,17 @@ export default {
|
||||
});
|
||||
|
||||
if (res.code === 200 && res.data) {
|
||||
const moment = this.resolveCheckMoment(this.checkInfo.checkDate);
|
||||
this.studentLeaves.clear();
|
||||
Object.keys(res.data).forEach((studentId) => {
|
||||
const normalizedId = normalizeStudentId(studentId);
|
||||
this.studentLeaves.set(normalizedId, res.data[studentId]);
|
||||
const raw = res.data[studentId];
|
||||
const list = Array.isArray(raw) ? raw : raw ? [raw] : [];
|
||||
this.studentLeaves.set(normalizedId, list);
|
||||
const student = this.roomStudents.find(
|
||||
(s) => normalizeStudentId(s.studentId) === normalizedId,
|
||||
);
|
||||
if (student) {
|
||||
if (student && list.some((leave) => this.leaveCoversMoment(leave, moment))) {
|
||||
student.attendance_status = '3';
|
||||
}
|
||||
});
|
||||
@@ -1601,6 +1615,7 @@ export default {
|
||||
disciplineTypeId: option.id,
|
||||
disciplineTypeName: option.typeName,
|
||||
score: existing ? existing.score : Number(option.minScore || 0),
|
||||
remark: existing ? existing.remark || '' : '',
|
||||
sortOrder: index + 1,
|
||||
});
|
||||
});
|
||||
@@ -1614,17 +1629,69 @@ export default {
|
||||
this.recalcDeductionTotal();
|
||||
},
|
||||
|
||||
snapHalfScore(score, min, max) {
|
||||
min = Number(min) || 0;
|
||||
max = Number(max);
|
||||
if (Number.isNaN(max)) max = 100;
|
||||
let value = Math.round(Number(score) * 2) / 2;
|
||||
if (Number.isNaN(value)) value = min;
|
||||
if (value < min) value = Math.ceil(min * 2) / 2;
|
||||
if (value > max) value = Math.floor(max * 2) / 2;
|
||||
if (value < min) value = min;
|
||||
if (value > max) value = max;
|
||||
return Number(value.toFixed(1));
|
||||
},
|
||||
|
||||
showDeductionRemark(item) {
|
||||
uni.showModal({
|
||||
title: item.disciplineTypeName || '扣分说明',
|
||||
content: this.getDeductionRemark(item.disciplineTypeId) || '暂无说明',
|
||||
showCancel: false,
|
||||
});
|
||||
},
|
||||
|
||||
parseLeaveTime(value) {
|
||||
if (!value) return null;
|
||||
const date = new Date(String(value).replace('T', ' ').replace(/-/g, '/'));
|
||||
return Number.isNaN(date.getTime()) ? null : date;
|
||||
},
|
||||
|
||||
resolveCheckMoment(checkDate) {
|
||||
const text = String(checkDate || '').replace('T', ' ').trim();
|
||||
const now = new Date();
|
||||
if (!text || text.length <= 10) {
|
||||
const ymd = `${now.getFullYear()}-${String(now.getMonth() + 1).padStart(2, '0')}-${String(now.getDate()).padStart(2, '0')}`;
|
||||
if (!text || text === ymd) return now;
|
||||
return this.parseLeaveTime(`${text} 12:00:00`) || now;
|
||||
}
|
||||
return this.parseLeaveTime(text) || now;
|
||||
},
|
||||
|
||||
leaveCoversMoment(leave, moment) {
|
||||
const start = this.parseLeaveTime(leave && leave.startTime);
|
||||
const end = this.parseLeaveTime(leave && leave.endTime);
|
||||
if (!start || !end) return false;
|
||||
return start.getTime() <= moment.getTime() && end.getTime() >= moment.getTime();
|
||||
},
|
||||
|
||||
leaveTagText(leave) {
|
||||
const moment = this.resolveCheckMoment(this.checkInfo && this.checkInfo.checkDate);
|
||||
if (this.leaveCoversMoment(leave, moment)) {
|
||||
const end = this.parseLeaveTime(leave && leave.endTime);
|
||||
if (end) {
|
||||
const minutes = end.getHours() * 60 + end.getMinutes();
|
||||
if (minutes >= 20 * 60 + 30 || minutes <= 5 * 60) return '晚归待返';
|
||||
}
|
||||
return '进行中';
|
||||
}
|
||||
const end = this.parseLeaveTime(leave && leave.endTime);
|
||||
if (end && end.getTime() < moment.getTime()) return '今日已结束';
|
||||
return '今日请假';
|
||||
},
|
||||
|
||||
handleDeductionScoreChange() {
|
||||
this.deductionItems.forEach((item) => {
|
||||
let score = parseFloat(item.score);
|
||||
if (isNaN(score)) {
|
||||
score = this.getDeductionMin(item);
|
||||
}
|
||||
const min = this.getDeductionMin(item);
|
||||
const max = this.getDeductionMax(item);
|
||||
if (score < min) score = min;
|
||||
if (score > max) score = max;
|
||||
item.score = score;
|
||||
item.score = this.snapHalfScore(item.score, this.getDeductionMin(item), this.getDeductionMax(item));
|
||||
});
|
||||
this.recalcDeductionTotal();
|
||||
if ((this.formData.totalScore || 0) > 100) {
|
||||
@@ -2363,8 +2430,14 @@ export default {
|
||||
},
|
||||
|
||||
// 获取学生请假信息
|
||||
getStudentLeaves(studentId) {
|
||||
const value = this.studentLeaves.get(normalizeStudentId(studentId));
|
||||
if (!value) return [];
|
||||
return Array.isArray(value) ? value : [value];
|
||||
},
|
||||
|
||||
getStudentLeave(studentId) {
|
||||
return this.studentLeaves.get(normalizeStudentId(studentId)) || null;
|
||||
return this.getStudentLeaves(studentId)[0] || null;
|
||||
},
|
||||
|
||||
// 格式化日期时间
|
||||
@@ -3153,6 +3226,20 @@ export default {
|
||||
color: #909399;
|
||||
}
|
||||
|
||||
.deduction-group-title {
|
||||
display: block;
|
||||
margin: 16rpx 0 8rpx;
|
||||
font-size: 26rpx;
|
||||
font-weight: 600;
|
||||
color: #303133;
|
||||
}
|
||||
|
||||
.deduction-remind {
|
||||
margin-left: 8rpx;
|
||||
color: #e6a23c;
|
||||
font-size: 24rpx;
|
||||
}
|
||||
|
||||
.deduction-remark {
|
||||
margin-top: 8rpx;
|
||||
font-size: 22rpx;
|
||||
|
||||
@@ -103,6 +103,11 @@
|
||||
<text class="score-range">
|
||||
({{ getViolationMin(item) }}-{{ getViolationMax(item) }}分)
|
||||
</text>
|
||||
<text
|
||||
v-if="getViolationRemark(item.disciplineTypeId)"
|
||||
class="deduction-remind"
|
||||
@click="showViolationRemark(item)"
|
||||
>提醒</text>
|
||||
<u-icon
|
||||
name="close-circle"
|
||||
color="#f56c6c"
|
||||
@@ -110,12 +115,12 @@
|
||||
@click="removeViolationItem(index)"
|
||||
></u-icon>
|
||||
</view>
|
||||
<view
|
||||
v-if="getViolationRemark(item.disciplineTypeId)"
|
||||
class="discipline-type-remark"
|
||||
>
|
||||
<text>类型说明:{{ getViolationRemark(item.disciplineTypeId) }}</text>
|
||||
</view>
|
||||
<u-input
|
||||
v-model="item.remark"
|
||||
placeholder="本项说明(选填)"
|
||||
border="surround"
|
||||
maxlength="200"
|
||||
/>
|
||||
</view>
|
||||
<view class="violation-item-total">
|
||||
合计扣分:<text class="total-value">{{ violationItemsTotalScore }}</text> 分
|
||||
@@ -138,13 +143,16 @@
|
||||
</view>
|
||||
<scroll-view scroll-y class="violation-type-popup-body">
|
||||
<u-checkbox-group v-model="tempSelectedTypeIds" placement="column">
|
||||
<u-checkbox
|
||||
v-for="item in allViolationTypes"
|
||||
:key="item.id"
|
||||
:name="String(item.id)"
|
||||
:label="getViolationTypeLabel(item)"
|
||||
customStyle="margin-bottom: 12px;"
|
||||
></u-checkbox>
|
||||
<view v-for="group in groupedViolationTypes" :key="group.label">
|
||||
<text class="deduction-group-title">{{ group.label }}</text>
|
||||
<u-checkbox
|
||||
v-for="item in group.options"
|
||||
:key="item.id"
|
||||
:name="String(item.id)"
|
||||
:label="getViolationTypeLabel(item)"
|
||||
customStyle="margin-bottom: 12px;"
|
||||
></u-checkbox>
|
||||
</view>
|
||||
</u-checkbox-group>
|
||||
</scroll-view>
|
||||
</view>
|
||||
@@ -527,6 +535,23 @@ export default {
|
||||
return !!this.violationData;
|
||||
},
|
||||
|
||||
groupedViolationTypes() {
|
||||
const order = ['卫生', '纪律', '重大违纪', '其他'];
|
||||
const buckets = { 卫生: [], 纪律: [], 重大违纪: [], 其他: [] };
|
||||
(this.allViolationTypes || []).forEach((item) => {
|
||||
const text = item.remark || '';
|
||||
let label = '其他';
|
||||
if (text.indexOf('重大违纪') === 0) label = '重大违纪';
|
||||
else if (text.indexOf('卫生') === 0) label = '卫生';
|
||||
else if (text.indexOf('纪律') === 0) label = '纪律';
|
||||
buckets[label].push(item);
|
||||
});
|
||||
return order.filter((label) => buckets[label].length).map((label) => ({
|
||||
label,
|
||||
options: buckets[label],
|
||||
}));
|
||||
},
|
||||
|
||||
violationSummaryDisplay() {
|
||||
if (!this.violationItems.length) return '';
|
||||
return this.violationItems.map((item) => item.disciplineTypeName).join('、');
|
||||
@@ -1134,6 +1159,7 @@ export default {
|
||||
scoreDeduction: existing
|
||||
? existing.scoreDeduction
|
||||
: parseFloat(option.minScore) || 0,
|
||||
remark: existing ? existing.remark || '' : '',
|
||||
});
|
||||
});
|
||||
this.violationItems = nextItems;
|
||||
@@ -1163,17 +1189,34 @@ export default {
|
||||
return option?.remark || '';
|
||||
},
|
||||
|
||||
snapHalfScore(score, min, max) {
|
||||
min = Number(min) || 0;
|
||||
max = Number(max);
|
||||
if (Number.isNaN(max)) max = 100;
|
||||
let value = Math.round(Number(score) * 2) / 2;
|
||||
if (Number.isNaN(value)) value = min;
|
||||
if (value < min) value = Math.ceil(min * 2) / 2;
|
||||
if (value > max) value = Math.floor(max * 2) / 2;
|
||||
if (value < min) value = min;
|
||||
if (value > max) value = max;
|
||||
return Number(value.toFixed(1));
|
||||
},
|
||||
|
||||
showViolationRemark(item) {
|
||||
uni.showModal({
|
||||
title: item.disciplineTypeName || '扣分说明',
|
||||
content: this.getViolationRemark(item.disciplineTypeId) || '暂无说明',
|
||||
showCancel: false,
|
||||
});
|
||||
},
|
||||
|
||||
handleViolationScoreChange() {
|
||||
this.violationItems.forEach((item) => {
|
||||
let score = parseFloat(item.scoreDeduction);
|
||||
if (isNaN(score)) {
|
||||
score = this.getViolationMin(item);
|
||||
}
|
||||
const min = this.getViolationMin(item);
|
||||
const max = this.getViolationMax(item);
|
||||
if (score < min) score = min;
|
||||
if (score > max) score = max;
|
||||
item.scoreDeduction = score;
|
||||
item.scoreDeduction = this.snapHalfScore(
|
||||
item.scoreDeduction,
|
||||
this.getViolationMin(item),
|
||||
this.getViolationMax(item),
|
||||
);
|
||||
});
|
||||
},
|
||||
|
||||
@@ -2096,6 +2139,9 @@ export default {
|
||||
disciplineTypeId: item.disciplineTypeId,
|
||||
disciplineTypeName: item.disciplineTypeName,
|
||||
scoreDeduction: item.scoreDeduction,
|
||||
disciplineContent: [sharedFields.disciplineContent, item.remark]
|
||||
.filter((text) => text && String(text).trim())
|
||||
.join(';'),
|
||||
}));
|
||||
this.$emit('confirm', records);
|
||||
} catch (error) {
|
||||
@@ -2238,6 +2284,20 @@ export default {
|
||||
}
|
||||
|
||||
// 违纪类型说明
|
||||
.deduction-group-title {
|
||||
display: block;
|
||||
margin: 16rpx 0 8rpx;
|
||||
font-size: 26rpx;
|
||||
font-weight: 600;
|
||||
color: #303133;
|
||||
}
|
||||
|
||||
.deduction-remind {
|
||||
margin-left: 8rpx;
|
||||
color: #e6a23c;
|
||||
font-size: 24rpx;
|
||||
}
|
||||
|
||||
.discipline-type-remark {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
|
||||
@@ -0,0 +1,255 @@
|
||||
<template>
|
||||
<view class="page">
|
||||
<u-navbar title="学生处分" :border-bottom="false" bg-color="#3c9cff" title-color="#fff">
|
||||
<view slot="left" @click="goBack">
|
||||
<u-icon name="arrow-left" color="#fff" size="22"></u-icon>
|
||||
</view>
|
||||
</u-navbar>
|
||||
|
||||
<view class="toolbar">
|
||||
<u-search v-model="keyword" placeholder="姓名或学号" :show-action="false" @search="reload" @clear="reload" />
|
||||
<u-button type="primary" size="small" @click="openCreate">登记处分</u-button>
|
||||
</view>
|
||||
|
||||
<view class="summary" v-if="summaryByType.length">
|
||||
<view v-for="item in summaryByType" :key="item.name" class="summary-item">
|
||||
<text>{{ item.name }}</text>
|
||||
<text>{{ item.count || 0 }}人次 / {{ item.score || 0 }}分</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view v-if="!list.length" class="empty">暂无处分记录</view>
|
||||
<view v-for="item in list" :key="item.id" class="card">
|
||||
<view class="card-title">{{ item.studentName }} {{ item.studentNo }}</view>
|
||||
<view class="card-line">{{ item.collegeName }} {{ item.className }}</view>
|
||||
<view class="card-line">{{ item.disciplineTypeName }} · 班级扣分 {{ item.scoreDeduction }} · {{ item.disciplineDate }}</view>
|
||||
<view class="card-line">{{ item.disciplineReason }}</view>
|
||||
</view>
|
||||
|
||||
<u-popup :show="showForm" mode="bottom" round="16" @close="showForm = false">
|
||||
<view class="form">
|
||||
<view class="form-title">登记学生处分</view>
|
||||
<u-input v-model="studentKeyword" placeholder="输入姓名或学号后点搜索" @confirm="searchStudents" />
|
||||
<u-button size="small" @click="searchStudents">搜索学生</u-button>
|
||||
<view v-for="item in studentOptions" :key="item.id" class="student-option" @click="chooseStudent(item)">
|
||||
<text :class="{ active: String(form.studentId) === String(item.id) }">
|
||||
{{ item.name }} {{ item.studentNo }} {{ item.className || '未分班' }}
|
||||
</text>
|
||||
</view>
|
||||
<view class="student-option" @click="showTypePicker = true">
|
||||
处分种类:{{ form.punishmentName || '请选择' }}
|
||||
</view>
|
||||
<u-input v-model="form.disciplineDate" placeholder="处分日期 yyyy-MM-dd" />
|
||||
<u-input v-model="form.disciplineReason" type="textarea" placeholder="处分原因" />
|
||||
<u-input v-model="form.disciplineContent" type="textarea" placeholder="备注(选填)" />
|
||||
<u-button type="primary" :loading="submitting" @click="submitForm">提交</u-button>
|
||||
</view>
|
||||
</u-popup>
|
||||
<u-picker :show="showTypePicker" :columns="typeColumns" keyName="text" @confirm="confirmType" @cancel="showTypePicker = false"></u-picker>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { request } from '@/common/request.js';
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
keyword: '',
|
||||
list: [],
|
||||
summaryByType: [],
|
||||
showForm: false,
|
||||
showTypePicker: false,
|
||||
submitting: false,
|
||||
studentKeyword: '',
|
||||
studentOptions: [],
|
||||
punishmentOptions: [],
|
||||
form: {
|
||||
studentId: '',
|
||||
punishmentCode: '',
|
||||
punishmentName: '',
|
||||
disciplineDate: '',
|
||||
disciplineReason: '',
|
||||
disciplineContent: '',
|
||||
},
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
typeColumns() {
|
||||
return [
|
||||
this.punishmentOptions.map((item) => ({
|
||||
text: item.countInClass ? `${item.name}(${item.score}分)` : `${item.name}(不计分)`,
|
||||
value: item.code,
|
||||
name: item.name,
|
||||
})),
|
||||
];
|
||||
},
|
||||
},
|
||||
onShow() {
|
||||
this.reload();
|
||||
this.loadOptions();
|
||||
},
|
||||
methods: {
|
||||
goBack() {
|
||||
uni.navigateBack();
|
||||
},
|
||||
today() {
|
||||
const now = new Date();
|
||||
const pad = (n) => String(n).padStart(2, '0');
|
||||
return `${now.getFullYear()}-${pad(now.getMonth() + 1)}-${pad(now.getDate())}`;
|
||||
},
|
||||
async loadOptions() {
|
||||
const res = await request({
|
||||
url: '/disciplineRecord/disciplineRecord/punishment/options',
|
||||
method: 'GET',
|
||||
});
|
||||
this.punishmentOptions = (res && res.data) || [];
|
||||
},
|
||||
async reload() {
|
||||
const params = {
|
||||
pageNum: 1,
|
||||
pageSize: 50,
|
||||
violationSource: '3',
|
||||
};
|
||||
if (/^\d+$/.test(this.keyword || '')) {
|
||||
params.studentNo = this.keyword;
|
||||
} else if (this.keyword) {
|
||||
params.studentName = this.keyword;
|
||||
}
|
||||
const res = await request({
|
||||
url: '/disciplineRecord/disciplineRecord/list',
|
||||
method: 'GET',
|
||||
params,
|
||||
});
|
||||
this.list = (res && res.rows) || [];
|
||||
const summary = await request({
|
||||
url: '/disciplineRecord/disciplineRecord/punishment/summary',
|
||||
method: 'GET',
|
||||
params: { violationSource: '3' },
|
||||
});
|
||||
this.summaryByType = (summary && summary.data && summary.data.byType) || [];
|
||||
},
|
||||
openCreate() {
|
||||
this.form = {
|
||||
studentId: '',
|
||||
punishmentCode: '',
|
||||
punishmentName: '',
|
||||
disciplineDate: this.today(),
|
||||
disciplineReason: '',
|
||||
disciplineContent: '',
|
||||
};
|
||||
this.studentKeyword = '';
|
||||
this.studentOptions = [];
|
||||
this.showForm = true;
|
||||
},
|
||||
async searchStudents() {
|
||||
if (!this.studentKeyword) return;
|
||||
const res = await request({
|
||||
url: '/disciplineRecord/disciplineRecord/studentOptions',
|
||||
method: 'GET',
|
||||
params: { keyword: this.studentKeyword },
|
||||
});
|
||||
this.studentOptions = (res && res.data) || [];
|
||||
},
|
||||
chooseStudent(item) {
|
||||
if (!item.classId) {
|
||||
uni.showToast({ title: '该学生未分配班级', icon: 'none' });
|
||||
return;
|
||||
}
|
||||
this.form.studentId = item.id;
|
||||
},
|
||||
confirmType(e) {
|
||||
const selected = e.value && e.value[0];
|
||||
if (selected) {
|
||||
this.form.punishmentCode = selected.value;
|
||||
this.form.punishmentName = selected.name;
|
||||
}
|
||||
this.showTypePicker = false;
|
||||
},
|
||||
async submitForm() {
|
||||
if (!this.form.studentId || !this.form.punishmentCode || !this.form.disciplineReason) {
|
||||
uni.showToast({ title: '请选择学生、种类并填写原因', icon: 'none' });
|
||||
return;
|
||||
}
|
||||
this.submitting = true;
|
||||
try {
|
||||
await request({
|
||||
url: '/disciplineRecord/disciplineRecord/punishment',
|
||||
method: 'POST',
|
||||
data: {
|
||||
studentId: this.form.studentId,
|
||||
punishmentCode: this.form.punishmentCode,
|
||||
disciplineDate: this.form.disciplineDate,
|
||||
disciplineReason: this.form.disciplineReason,
|
||||
disciplineContent: this.form.disciplineContent,
|
||||
},
|
||||
});
|
||||
uni.showToast({ title: '已登记', icon: 'success' });
|
||||
this.showForm = false;
|
||||
this.reload();
|
||||
} finally {
|
||||
this.submitting = false;
|
||||
}
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.page {
|
||||
min-height: 100vh;
|
||||
background: #f5f7fb;
|
||||
}
|
||||
.toolbar {
|
||||
display: flex;
|
||||
gap: 12rpx;
|
||||
align-items: center;
|
||||
padding: 20rpx;
|
||||
background: #fff;
|
||||
}
|
||||
.summary {
|
||||
margin: 20rpx;
|
||||
padding: 16rpx;
|
||||
background: #fff;
|
||||
border-radius: 12rpx;
|
||||
}
|
||||
.summary-item,
|
||||
.card-line,
|
||||
.card-title {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
margin-bottom: 8rpx;
|
||||
font-size: 26rpx;
|
||||
color: #606266;
|
||||
}
|
||||
.card {
|
||||
margin: 0 20rpx 16rpx;
|
||||
padding: 20rpx;
|
||||
background: #fff;
|
||||
border-radius: 12rpx;
|
||||
}
|
||||
.card-title {
|
||||
color: #303133;
|
||||
font-weight: 600;
|
||||
}
|
||||
.empty {
|
||||
padding: 80rpx;
|
||||
text-align: center;
|
||||
color: #909399;
|
||||
}
|
||||
.form {
|
||||
padding: 24rpx;
|
||||
}
|
||||
.form-title {
|
||||
margin-bottom: 16rpx;
|
||||
font-size: 32rpx;
|
||||
font-weight: 600;
|
||||
}
|
||||
.student-option {
|
||||
padding: 12rpx 0;
|
||||
font-size: 26rpx;
|
||||
}
|
||||
.active {
|
||||
color: #3c9cff;
|
||||
}
|
||||
</style>
|
||||
@@ -46,10 +46,11 @@ export const delDormRollCall = (id: string | number | Array<string | number>) =>
|
||||
});
|
||||
};
|
||||
|
||||
export const generateBatchNo = (): AxiosPromise<string> => {
|
||||
export const generateBatchNo = (campusId?: string | number): AxiosPromise<string> => {
|
||||
return request({
|
||||
url: '/dormRollCall/dormRollCall/generateBatchNo',
|
||||
method: 'get'
|
||||
method: 'get',
|
||||
params: campusId ? { campusId } : undefined
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
@@ -74,11 +74,36 @@ export const getStudentOptions = (keyword?: string): AxiosPromise<XskhStudentOpt
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* 查询当前登录学生的违纪处分记录列表
|
||||
* @param query
|
||||
* @returns {*}
|
||||
*/
|
||||
/** 学生处分种类,分值由服务端固定 */
|
||||
export const getPunishmentOptions = () => {
|
||||
return request({
|
||||
url: '/disciplineRecord/disciplineRecord/punishment/options',
|
||||
method: 'get'
|
||||
});
|
||||
};
|
||||
|
||||
export const addPunishment = (data: {
|
||||
studentId: string | number;
|
||||
punishmentCode: string;
|
||||
disciplineReason: string;
|
||||
disciplineContent?: string;
|
||||
disciplineDate?: string;
|
||||
}) => {
|
||||
return request({
|
||||
url: '/disciplineRecord/disciplineRecord/punishment',
|
||||
method: 'post',
|
||||
data
|
||||
});
|
||||
};
|
||||
|
||||
export const getPunishmentSummary = (query?: DisciplineRecordQuery) => {
|
||||
return request({
|
||||
url: '/disciplineRecord/disciplineRecord/punishment/summary',
|
||||
method: 'get',
|
||||
params: query
|
||||
});
|
||||
};
|
||||
|
||||
export const listMyDisciplineRecord = (query?: DisciplineRecordQuery): AxiosPromise<DisciplineRecordVO[]> => {
|
||||
return request({
|
||||
url: '/disciplineRecord/disciplineRecord/my',
|
||||
|
||||
@@ -96,6 +96,19 @@ export const constantRoutes: RouteRecordRaw[] = [
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
path: '/xskh/studentPunishment',
|
||||
component: Layout,
|
||||
hidden: true,
|
||||
children: [
|
||||
{
|
||||
path: '',
|
||||
component: () => import('@/views/xskh/studentPunishment/index.vue'),
|
||||
name: 'StudentPunishmentPage',
|
||||
meta: { title: '学生处分', icon: 'form' }
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
path: '/user',
|
||||
component: Layout,
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
<el-input v-model="queryParams.nodeName" placeholder="请输入任务名称" @keyup.enter="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item label="流程定义名称" label-width="100" prop="flowName">
|
||||
<el-input v-model="queryParams.flowName" placeholder="请输入流程定义名称" @keyup.enter="handleQuery" />
|
||||
<el-input v-model="queryParams.flowName" placeholder="流程名称 / 学生姓名 / 学号" @keyup.enter="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item label="流程定义编码" label-width="100" prop="flowCode">
|
||||
<el-input v-model="queryParams.flowCode" placeholder="请输入流程定义编码" @keyup.enter="handleQuery" />
|
||||
|
||||
+73
-26
@@ -253,32 +253,22 @@
|
||||
</el-row>
|
||||
</div>
|
||||
|
||||
<!-- 请假信息区域 -->
|
||||
<div class="leave-section" v-if="getStudentLeave(student.studentId)">
|
||||
<div class="leave-section" v-if="getStudentLeaves(student.studentId).length">
|
||||
<div class="leave-header">
|
||||
<span>请假信息</span>
|
||||
<div class="leave-header-actions">
|
||||
<el-button size="small" plain @click="viewLeaveProcess(student, getStudentLeave(student.studentId))" title="查看请假流程">
|
||||
查看流程
|
||||
</el-button>
|
||||
<el-tag type="warning" size="small">请假中</el-tag>
|
||||
</div>
|
||||
<span>今日请假</span>
|
||||
</div>
|
||||
<div class="leave-info">
|
||||
<div class="leave-item">
|
||||
<span class="leave-label">发起时间:</span>
|
||||
<span class="leave-value">{{ formatDateTime(getStudentLeave(student.studentId)?.createTime) }}</span>
|
||||
</div>
|
||||
<div class="leave-item">
|
||||
<span class="leave-label">请假时间:</span>
|
||||
<span class="leave-value"
|
||||
>{{ formatDateTime(getStudentLeave(student.studentId)?.startTime) }} 至
|
||||
{{ formatDateTime(getStudentLeave(student.studentId)?.endTime) }}</span
|
||||
>
|
||||
<div v-for="(leave, leaveIndex) in getStudentLeaves(student.studentId)" :key="leave.id || leaveIndex" class="leave-info">
|
||||
<div class="leave-header-actions">
|
||||
<el-button size="small" plain @click="viewLeaveProcess(student, leave)" title="查看请假流程">查看流程</el-button>
|
||||
<el-tag :type="leaveTagType(leave)" size="small">{{ leaveTagText(leave) }}</el-tag>
|
||||
</div>
|
||||
<div class="leave-item">
|
||||
<span class="leave-label">请假类型:</span>
|
||||
<span class="leave-value">{{ getStudentLeave(student.studentId)?.leaveTypeName }}</span>
|
||||
<span class="leave-value">{{ leave.leaveTypeName || '-' }}</span>
|
||||
</div>
|
||||
<div class="leave-item">
|
||||
<span class="leave-label">请假时间:</span>
|
||||
<span class="leave-value">{{ formatDateTime(leave.startTime) }} 至 {{ formatDateTime(leave.endTime) }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -772,14 +762,62 @@ const loadViolationRecords = async (prefetched?: any[] | null) => {
|
||||
}
|
||||
};
|
||||
|
||||
// 加载学生请假信息
|
||||
const parseLeaveTime = (value?: string) => {
|
||||
if (!value) return null;
|
||||
const date = new Date(String(value).replace('T', ' ').replace(/-/g, '/'));
|
||||
return Number.isNaN(date.getTime()) ? null : date;
|
||||
};
|
||||
|
||||
const resolveCheckMoment = (checkDate?: string) => {
|
||||
const text = String(checkDate || '').replace('T', ' ').trim();
|
||||
const now = new Date();
|
||||
if (!text || text.length <= 10) {
|
||||
const ymd = `${now.getFullYear()}-${String(now.getMonth() + 1).padStart(2, '0')}-${String(now.getDate()).padStart(2, '0')}`;
|
||||
if (!text || text === ymd) return now;
|
||||
return parseLeaveTime(`${text} 12:00:00`) || now;
|
||||
}
|
||||
return parseLeaveTime(text) || now;
|
||||
};
|
||||
|
||||
const leaveCoversMoment = (leave: any, moment: Date) => {
|
||||
const start = parseLeaveTime(leave?.startTime);
|
||||
const end = parseLeaveTime(leave?.endTime);
|
||||
if (!start || !end) return false;
|
||||
return start.getTime() <= moment.getTime() && end.getTime() >= moment.getTime();
|
||||
};
|
||||
|
||||
const isLateReturnLeave = (leave: any) => {
|
||||
const end = parseLeaveTime(leave?.endTime);
|
||||
if (!end) return false;
|
||||
const minutes = end.getHours() * 60 + end.getMinutes();
|
||||
return minutes >= 20 * 60 + 30 || minutes <= 5 * 60;
|
||||
};
|
||||
|
||||
const leaveTagText = (leave: any) => {
|
||||
const moment = resolveCheckMoment(hygieneForm.checkDate);
|
||||
if (leaveCoversMoment(leave, moment)) {
|
||||
return isLateReturnLeave(leave) ? '晚归待返' : '进行中';
|
||||
}
|
||||
const end = parseLeaveTime(leave?.endTime);
|
||||
if (end && end.getTime() < moment.getTime()) return '今日已结束';
|
||||
return '今日请假';
|
||||
};
|
||||
|
||||
const leaveTagType = (leave: any) => {
|
||||
const text = leaveTagText(leave);
|
||||
if (text === '晚归待返') return 'warning';
|
||||
if (text === '进行中') return 'danger';
|
||||
if (text === '今日已结束') return 'info';
|
||||
return 'primary';
|
||||
};
|
||||
|
||||
const loadStudentLeaves = async () => {
|
||||
if (!hygieneForm.checkDate || studentScores.value.length === 0) return;
|
||||
|
||||
try {
|
||||
const studentIds = studentScores.value.map((student) => student.studentId).join(',');
|
||||
const res = await request({
|
||||
url: '/studentLeave/studentLeave/queryByCheckDate',
|
||||
url: '/studentLeave/studentLeave/queryByCheckDay',
|
||||
method: 'get',
|
||||
params: {
|
||||
studentIds,
|
||||
@@ -788,12 +826,15 @@ const loadStudentLeaves = async () => {
|
||||
});
|
||||
|
||||
if (res.code === 200 && res.data) {
|
||||
const moment = resolveCheckMoment(hygieneForm.checkDate);
|
||||
studentLeaves.value.clear();
|
||||
Object.keys(res.data).forEach((studentId) => {
|
||||
const normalizedId = normalizeStudentId(studentId);
|
||||
studentLeaves.value.set(normalizedId, res.data[studentId]);
|
||||
const raw = res.data[studentId];
|
||||
const list = Array.isArray(raw) ? raw : raw ? [raw] : [];
|
||||
studentLeaves.value.set(normalizedId, list);
|
||||
const student = studentScores.value.find((s) => normalizeStudentId(s.studentId) === normalizedId);
|
||||
if (student) {
|
||||
if (student && list.some((leave) => leaveCoversMoment(leave, moment))) {
|
||||
student.attendanceStatus = '3';
|
||||
}
|
||||
});
|
||||
@@ -829,8 +870,14 @@ const syncStudentScoreFromViolations = (studentId?: string | number) => {
|
||||
};
|
||||
|
||||
// 获取学生的请假信息
|
||||
const getStudentLeaves = (studentId: string | number) => {
|
||||
const value = studentLeaves.value.get(normalizeStudentId(studentId));
|
||||
if (!value) return [];
|
||||
return Array.isArray(value) ? value : [value];
|
||||
};
|
||||
|
||||
const getStudentLeave = (studentId: string | number) => {
|
||||
return studentLeaves.value.get(normalizeStudentId(studentId)) || null;
|
||||
return getStudentLeaves(studentId)[0] || null;
|
||||
};
|
||||
|
||||
// 处理附件数据
|
||||
|
||||
+75
-27
@@ -211,32 +211,23 @@
|
||||
</el-row>
|
||||
</div>
|
||||
|
||||
<!-- 请假信息区域 -->
|
||||
<div class="leave-section" v-if="getStudentLeave(student.studentId)">
|
||||
<!-- 请假信息区域:当天全部已结束请假,进行中才标记出勤为请假 -->
|
||||
<div class="leave-section" v-if="getStudentLeaves(student.studentId).length">
|
||||
<div class="leave-header">
|
||||
<span>请假信息</span>
|
||||
<div class="leave-header-actions">
|
||||
<el-button size="small" @click="viewLeaveProcess(student, getStudentLeave(student.studentId))" title="查看请假流程">
|
||||
查看流程
|
||||
</el-button>
|
||||
<el-tag type="warning" size="small">请假中</el-tag>
|
||||
</div>
|
||||
<span>今日请假</span>
|
||||
</div>
|
||||
<div class="leave-info">
|
||||
<div class="leave-item">
|
||||
<span class="leave-label">发起时间:</span>
|
||||
<span class="leave-value">{{ formatDateTime(getStudentLeave(student.studentId)?.createTime) }}</span>
|
||||
</div>
|
||||
<div class="leave-item">
|
||||
<span class="leave-label">请假时间:</span>
|
||||
<span class="leave-value"
|
||||
>{{ formatDateTime(getStudentLeave(student.studentId)?.startTime) }} 至
|
||||
{{ formatDateTime(getStudentLeave(student.studentId)?.endTime) }}</span
|
||||
>
|
||||
<div v-for="(leave, leaveIndex) in getStudentLeaves(student.studentId)" :key="leave.id || leaveIndex" class="leave-info">
|
||||
<div class="leave-header-actions">
|
||||
<el-button size="small" @click="viewLeaveProcess(student, leave)" title="查看请假流程">查看流程</el-button>
|
||||
<el-tag :type="leaveTagType(leave)" size="small">{{ leaveTagText(leave) }}</el-tag>
|
||||
</div>
|
||||
<div class="leave-item">
|
||||
<span class="leave-label">请假类型:</span>
|
||||
<span class="leave-value">{{ getStudentLeave(student.studentId)?.leaveTypeName }}</span>
|
||||
<span class="leave-value">{{ leave.leaveTypeName || '-' }}</span>
|
||||
</div>
|
||||
<div class="leave-item">
|
||||
<span class="leave-label">请假时间:</span>
|
||||
<span class="leave-value">{{ formatDateTime(leave.startTime) }} 至 {{ formatDateTime(leave.endTime) }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -547,14 +538,63 @@ const loadRoomStudents = async () => {
|
||||
}
|
||||
};
|
||||
|
||||
// 加载学生请假信息
|
||||
const parseLeaveTime = (value?: string) => {
|
||||
if (!value) return null;
|
||||
const date = new Date(String(value).replace('T', ' ').replace(/-/g, '/'));
|
||||
return Number.isNaN(date.getTime()) ? null : date;
|
||||
};
|
||||
|
||||
const resolveCheckMoment = (checkDate?: string) => {
|
||||
const text = String(checkDate || '').replace('T', ' ').trim();
|
||||
const now = new Date();
|
||||
if (!text || text.length <= 10) {
|
||||
const ymd = `${now.getFullYear()}-${String(now.getMonth() + 1).padStart(2, '0')}-${String(now.getDate()).padStart(2, '0')}`;
|
||||
if (!text || text === ymd) return now;
|
||||
return parseLeaveTime(`${text} 12:00:00`) || now;
|
||||
}
|
||||
return parseLeaveTime(text) || now;
|
||||
};
|
||||
|
||||
const leaveCoversMoment = (leave: any, moment: Date) => {
|
||||
const start = parseLeaveTime(leave?.startTime);
|
||||
const end = parseLeaveTime(leave?.endTime);
|
||||
if (!start || !end) return false;
|
||||
return start.getTime() <= moment.getTime() && end.getTime() >= moment.getTime();
|
||||
};
|
||||
|
||||
const isLateReturnLeave = (leave: any) => {
|
||||
const end = parseLeaveTime(leave?.endTime);
|
||||
if (!end) return false;
|
||||
const minutes = end.getHours() * 60 + end.getMinutes();
|
||||
return minutes >= 20 * 60 + 30 || minutes <= 5 * 60;
|
||||
};
|
||||
|
||||
const leaveTagText = (leave: any) => {
|
||||
const moment = resolveCheckMoment(props.checkInfo?.checkDate);
|
||||
if (leaveCoversMoment(leave, moment)) {
|
||||
return isLateReturnLeave(leave) ? '晚归待返' : '进行中';
|
||||
}
|
||||
const end = parseLeaveTime(leave?.endTime);
|
||||
if (end && end.getTime() < moment.getTime()) return '今日已结束';
|
||||
return '今日请假';
|
||||
};
|
||||
|
||||
const leaveTagType = (leave: any) => {
|
||||
const text = leaveTagText(leave);
|
||||
if (text === '晚归待返') return 'warning';
|
||||
if (text === '进行中') return 'danger';
|
||||
if (text === '今日已结束') return 'info';
|
||||
return 'primary';
|
||||
};
|
||||
|
||||
// 加载学生当天请假,供教官查看;只有检查时刻仍在假期内才锁定出勤为请假
|
||||
const loadStudentLeaves = async () => {
|
||||
if (!props.checkInfo?.checkDate || roomStudents.value.length === 0) return;
|
||||
|
||||
try {
|
||||
const studentIds = roomStudents.value.map((student) => student.studentId).join(',');
|
||||
const res = await request({
|
||||
url: '/studentLeave/studentLeave/queryByCheckDate',
|
||||
url: '/studentLeave/studentLeave/queryByCheckDay',
|
||||
method: 'get',
|
||||
params: {
|
||||
studentIds,
|
||||
@@ -563,12 +603,15 @@ const loadStudentLeaves = async () => {
|
||||
});
|
||||
|
||||
if (res.code === 200 && res.data) {
|
||||
const moment = resolveCheckMoment(props.checkInfo.checkDate);
|
||||
studentLeaves.value.clear();
|
||||
Object.keys(res.data).forEach((studentId) => {
|
||||
const normalizedId = normalizeStudentId(studentId);
|
||||
studentLeaves.value.set(normalizedId, res.data[studentId]);
|
||||
const raw = res.data[studentId];
|
||||
const list = Array.isArray(raw) ? raw : raw ? [raw] : [];
|
||||
studentLeaves.value.set(normalizedId, list);
|
||||
const student = roomStudents.value.find((s) => normalizeStudentId(s.studentId) === normalizedId);
|
||||
if (student) {
|
||||
if (student && list.some((leave) => leaveCoversMoment(leave, moment))) {
|
||||
student.attendance_status = '3';
|
||||
}
|
||||
});
|
||||
@@ -602,9 +645,14 @@ const syncStudentScoreFromViolations = (studentId?: string | number) => {
|
||||
});
|
||||
};
|
||||
|
||||
// 获取学生的请假信息
|
||||
const getStudentLeaves = (studentId: string | number) => {
|
||||
const value = studentLeaves.value.get(normalizeStudentId(studentId));
|
||||
if (!value) return [];
|
||||
return Array.isArray(value) ? value : [value];
|
||||
};
|
||||
|
||||
const getStudentLeave = (studentId: string | number) => {
|
||||
return studentLeaves.value.get(normalizeStudentId(studentId)) || null;
|
||||
return getStudentLeaves(studentId)[0] || null;
|
||||
};
|
||||
|
||||
// 格式化日期时间
|
||||
|
||||
+60
-10
@@ -13,7 +13,9 @@
|
||||
style="width: 100%"
|
||||
@change="handleTypeSelectionChange"
|
||||
>
|
||||
<el-option v-for="item in options" :key="item.id" :label="formatOptionLabel(item)" :value="item.id" />
|
||||
<el-option-group v-for="group in groupedOptions" :key="group.label" :label="group.label">
|
||||
<el-option v-for="item in group.options" :key="item.id" :label="formatOptionLabel(item)" :value="item.id" />
|
||||
</el-option-group>
|
||||
</el-select>
|
||||
<div v-else-if="!items.length" class="empty-text">无扣分项</div>
|
||||
</el-form-item>
|
||||
@@ -26,19 +28,25 @@
|
||||
v-model="item.score"
|
||||
:min="getMinScore(item)"
|
||||
:max="getMaxScore(item)"
|
||||
:precision="2"
|
||||
:step="0.5"
|
||||
:precision="1"
|
||||
:disabled="disabled"
|
||||
controls-position="right"
|
||||
size="small"
|
||||
@change="handleScoreChange"
|
||||
@change="(value) => snapItemScore(item, value)"
|
||||
/>
|
||||
<span class="deduction-range">({{ getMinScore(item) }}-{{ getMaxScore(item) }}分)</span>
|
||||
<span class="deduction-range">({{ getMinScore(item) }}-{{ getMaxScore(item) }}分,0.5分一档)</span>
|
||||
<el-button v-if="getTypeRemark(item.disciplineTypeId)" link type="warning" @click="showTypeRemark(item)">提醒</el-button>
|
||||
<el-button v-if="!disabled" link type="danger" @click="removeItem(index)">删除</el-button>
|
||||
</div>
|
||||
<div v-if="getTypeRemark(item.disciplineTypeId)" class="deduction-remark">
|
||||
<el-icon class="remark-icon"><InfoFilled /></el-icon>
|
||||
<span>{{ getTypeRemark(item.disciplineTypeId) }}</span>
|
||||
</div>
|
||||
<el-input
|
||||
v-model="item.remark"
|
||||
:disabled="disabled"
|
||||
size="small"
|
||||
maxlength="200"
|
||||
placeholder="本项扣分说明(选填)"
|
||||
style="margin-top: 8px"
|
||||
/>
|
||||
</div>
|
||||
<div class="deduction-total">
|
||||
合计扣分:<strong>{{ totalScore }}</strong> 分
|
||||
@@ -50,8 +58,7 @@
|
||||
|
||||
<script setup lang="ts">
|
||||
import { computed, ref, watch } from 'vue';
|
||||
import { InfoFilled } from '@element-plus/icons-vue';
|
||||
import { ElMessage } from 'element-plus';
|
||||
import { ElMessage, ElMessageBox } from 'element-plus';
|
||||
import type { HygieneDeductionItem } from '@/api/xg/xgss/dormHygieneCheck/dormHygieneCheck/types';
|
||||
|
||||
interface DisciplineTypeOption {
|
||||
@@ -101,6 +108,37 @@ watch(
|
||||
{ deep: true, immediate: true }
|
||||
);
|
||||
|
||||
const GROUP_ORDER = ['卫生', '纪律', '重大违纪', '其他'];
|
||||
|
||||
const groupOf = (remark?: string) => {
|
||||
const text = remark || '';
|
||||
if (text.startsWith('重大违纪')) return '重大违纪';
|
||||
if (text.startsWith('卫生')) return '卫生';
|
||||
if (text.startsWith('纪律')) return '纪律';
|
||||
return '其他';
|
||||
};
|
||||
|
||||
const groupedOptions = computed(() => {
|
||||
const buckets = new Map<string, DisciplineTypeOption[]>(GROUP_ORDER.map((label) => [label, []]));
|
||||
(props.options || []).forEach((item) => {
|
||||
buckets.get(groupOf(item.remark))?.push(item);
|
||||
});
|
||||
return GROUP_ORDER.filter((label) => (buckets.get(label) || []).length > 0).map((label) => ({
|
||||
label,
|
||||
options: buckets.get(label) || []
|
||||
}));
|
||||
});
|
||||
|
||||
const snapHalf = (score: number | undefined, min: number, max: number) => {
|
||||
let value = Math.round(Number(score) * 2) / 2;
|
||||
if (Number.isNaN(value)) value = min;
|
||||
if (value < min) value = Math.ceil(min * 2) / 2;
|
||||
if (value > max) value = Math.floor(max * 2) / 2;
|
||||
if (value < min) value = min;
|
||||
if (value > max) value = max;
|
||||
return Number(value.toFixed(1));
|
||||
};
|
||||
|
||||
const formatOptionLabel = (item: DisciplineTypeOption) => {
|
||||
const min = item.minScore ?? 0;
|
||||
return `${item.typeName}(${min}分起)`;
|
||||
@@ -141,6 +179,7 @@ const handleTypeSelectionChange = (typeIds: Array<number | string>) => {
|
||||
score: existing?.score ?? Number(option.minScore ?? 0),
|
||||
minScore: Number(option.minScore ?? 0),
|
||||
maxScore: Number(option.maxScore ?? 100),
|
||||
remark: existing?.remark || '',
|
||||
sortOrder: index + 1
|
||||
});
|
||||
});
|
||||
@@ -151,6 +190,17 @@ const handleTypeSelectionChange = (typeIds: Array<number | string>) => {
|
||||
}
|
||||
};
|
||||
|
||||
const snapItemScore = (item: HygieneDeductionItem, value?: number) => {
|
||||
item.score = snapHalf(value, getMinScore(item), getMaxScore(item));
|
||||
handleScoreChange();
|
||||
};
|
||||
|
||||
const showTypeRemark = (item: HygieneDeductionItem) => {
|
||||
ElMessageBox.alert(getTypeRemark(item.disciplineTypeId) || '暂无说明', item.disciplineTypeName || '扣分说明', {
|
||||
confirmButtonText: '知道了'
|
||||
});
|
||||
};
|
||||
|
||||
const handleScoreChange = () => {
|
||||
if (totalScore.value > 100) {
|
||||
ElMessage.warning('合计扣分不能超过100分');
|
||||
|
||||
+99
-39
@@ -14,21 +14,23 @@
|
||||
<!-- 违纪类型选择:编辑模式单选 -->
|
||||
<el-form-item v-if="isEditMode" label="违纪类型" prop="disciplineTypeId" class="discipline-form-item">
|
||||
<el-select v-model="form.disciplineTypeId" placeholder="请选择违纪类型" style="width: 100%" @change="handleDisciplineTypeChange" filterable>
|
||||
<el-option
|
||||
v-for="item in allViolationTypes"
|
||||
:key="item.id"
|
||||
:label="getViolationTypeLabel(item)"
|
||||
:value="item.id"
|
||||
:disabled="item.status !== '0'"
|
||||
>
|
||||
<div class="violation-type-option">
|
||||
<span class="violation-type-name" :title="getViolationTypeLabel(item)">
|
||||
<span class="area-tag" :class="getAreaTypeClass(item.areaType)">{{ getAreaTypeText(item.areaType) }}</span>
|
||||
{{ getShortTypeName(item.typeName) }}
|
||||
</span>
|
||||
<span class="score-range">{{ item.minScore }}-{{ item.maxScore }}分</span>
|
||||
</div>
|
||||
</el-option>
|
||||
<el-option-group v-for="group in groupedViolationTypes" :key="'edit-' + group.label" :label="group.label">
|
||||
<el-option
|
||||
v-for="item in group.options"
|
||||
:key="item.id"
|
||||
:label="getViolationTypeLabel(item)"
|
||||
:value="item.id"
|
||||
:disabled="item.status !== '0'"
|
||||
>
|
||||
<div class="violation-type-option">
|
||||
<span class="violation-type-name" :title="getViolationTypeLabel(item)">
|
||||
<span class="area-tag" :class="getAreaTypeClass(item.areaType)">{{ getAreaTypeText(item.areaType) }}</span>
|
||||
{{ getShortTypeName(item.typeName) }}
|
||||
</span>
|
||||
<span class="score-range">{{ item.minScore }}-{{ item.maxScore }}分</span>
|
||||
</div>
|
||||
</el-option>
|
||||
</el-option-group>
|
||||
</el-select>
|
||||
|
||||
<div v-if="form.disciplineTypeId && selectedDisciplineTypeRemark" class="discipline-type-remark">
|
||||
@@ -51,21 +53,23 @@
|
||||
style="width: 100%"
|
||||
@change="handleTypeSelectionChange"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in allViolationTypes"
|
||||
:key="item.id"
|
||||
:label="getViolationTypeLabel(item)"
|
||||
:value="item.id"
|
||||
:disabled="item.status !== '0'"
|
||||
>
|
||||
<div class="violation-type-option">
|
||||
<span class="violation-type-name" :title="getViolationTypeLabel(item)">
|
||||
<span class="area-tag" :class="getAreaTypeClass(item.areaType)">{{ getAreaTypeText(item.areaType) }}</span>
|
||||
{{ getShortTypeName(item.typeName) }}
|
||||
</span>
|
||||
<span class="score-range">{{ item.minScore }}-{{ item.maxScore }}分</span>
|
||||
</div>
|
||||
</el-option>
|
||||
<el-option-group v-for="group in groupedViolationTypes" :key="'add-' + group.label" :label="group.label">
|
||||
<el-option
|
||||
v-for="item in group.options"
|
||||
:key="item.id"
|
||||
:label="getViolationTypeLabel(item)"
|
||||
:value="item.id"
|
||||
:disabled="item.status !== '0'"
|
||||
>
|
||||
<div class="violation-type-option">
|
||||
<span class="violation-type-name" :title="getViolationTypeLabel(item)">
|
||||
<span class="area-tag" :class="getAreaTypeClass(item.areaType)">{{ getAreaTypeText(item.areaType) }}</span>
|
||||
{{ getShortTypeName(item.typeName) }}
|
||||
</span>
|
||||
<span class="score-range">{{ item.minScore }}-{{ item.maxScore }}分</span>
|
||||
</div>
|
||||
</el-option>
|
||||
</el-option-group>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
@@ -77,17 +81,17 @@
|
||||
v-model="item.scoreDeduction"
|
||||
:min="getItemMinScore(item)"
|
||||
:max="getItemMaxScore(item)"
|
||||
:precision="2"
|
||||
:step="0.5"
|
||||
:precision="1"
|
||||
controls-position="right"
|
||||
size="small"
|
||||
@change="(value) => snapViolationScore(item, value)"
|
||||
/>
|
||||
<span class="score-range">({{ getItemMinScore(item) }}-{{ getItemMaxScore(item) }}分)</span>
|
||||
<el-button v-if="getItemRemark(item.disciplineTypeId)" link type="warning" @click="showViolationRemark(item)">提醒</el-button>
|
||||
<el-button link type="danger" @click="removeViolationItem(index)">删除</el-button>
|
||||
</div>
|
||||
<div v-if="getItemRemark(item.disciplineTypeId)" class="discipline-type-remark inline-remark">
|
||||
<el-icon class="remark-icon"><InfoFilled /></el-icon>
|
||||
<span class="remark-text">类型说明:{{ getItemRemark(item.disciplineTypeId) }}</span>
|
||||
</div>
|
||||
<el-input v-model="item.remark" size="small" maxlength="200" placeholder="本项说明(选填)" style="margin-top: 6px" />
|
||||
</div>
|
||||
<div class="violation-item-total">
|
||||
合计扣分:<strong>{{ violationItemsTotalScore }}</strong> 分
|
||||
@@ -111,7 +115,16 @@
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item v-if="isEditMode" label="扣分分值" prop="scoreDeduction">
|
||||
<el-input-number v-model="form.scoreDeduction" :precision="2" placeholder="请输入扣分" style="width: 100%" />
|
||||
<el-input-number
|
||||
v-model="form.scoreDeduction"
|
||||
:step="0.5"
|
||||
:precision="1"
|
||||
:min="currentTypeMinScore"
|
||||
:max="currentTypeMaxScore"
|
||||
placeholder="请输入扣分"
|
||||
style="width: 100%"
|
||||
@change="snapFormScore"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
@@ -221,7 +234,7 @@
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, reactive, computed, watch, onMounted, nextTick } from 'vue';
|
||||
import { ElMessage } from 'element-plus';
|
||||
import { ElMessage, ElMessageBox } from 'element-plus';
|
||||
import { Plus, InfoFilled, UploadFilled, Document, Loading, Download, Delete } from '@element-plus/icons-vue';
|
||||
// import ImagePreview from '@/components/ImagePreview/index.vue';
|
||||
import ImagePreview from '@/components/ImagePreview/index.vue';
|
||||
@@ -264,6 +277,7 @@ interface ViolationItem {
|
||||
disciplineTypeId: string | number;
|
||||
disciplineTypeName: string;
|
||||
scoreDeduction: number;
|
||||
remark?: string;
|
||||
}
|
||||
|
||||
const selectedTypeIds = ref<Array<string | number>>([]);
|
||||
@@ -396,6 +410,50 @@ const getItemMaxScore = (item: ViolationItem) => parseScore(getTypeOption(item.d
|
||||
|
||||
const getItemRemark = (typeId?: string | number) => getTypeOption(typeId)?.remark || '';
|
||||
|
||||
const violationGroupOf = (remark?: string) => {
|
||||
const text = remark || '';
|
||||
if (text.startsWith('重大违纪')) return '重大违纪';
|
||||
if (text.startsWith('卫生')) return '卫生';
|
||||
if (text.startsWith('纪律')) return '纪律';
|
||||
return '其他';
|
||||
};
|
||||
|
||||
const groupedViolationTypes = computed(() => {
|
||||
const order = ['卫生', '纪律', '重大违纪', '其他'];
|
||||
const buckets = new Map<string, any[]>(order.map((label) => [label, []]));
|
||||
allViolationTypes.value.forEach((item) => {
|
||||
buckets.get(violationGroupOf(item.remark))?.push(item);
|
||||
});
|
||||
return order.filter((label) => (buckets.get(label) || []).length > 0).map((label) => ({
|
||||
label,
|
||||
options: buckets.get(label) || []
|
||||
}));
|
||||
});
|
||||
|
||||
const snapHalfScore = (score: number | undefined, min: number, max: number) => {
|
||||
let value = Math.round(Number(score) * 2) / 2;
|
||||
if (Number.isNaN(value)) value = min;
|
||||
if (value < min) value = Math.ceil(min * 2) / 2;
|
||||
if (value > max) value = Math.floor(max * 2) / 2;
|
||||
if (value < min) value = min;
|
||||
if (value > max) value = max;
|
||||
return Number(value.toFixed(1));
|
||||
};
|
||||
|
||||
const snapViolationScore = (item: ViolationItem, value?: number) => {
|
||||
item.scoreDeduction = snapHalfScore(value, getItemMinScore(item), getItemMaxScore(item));
|
||||
};
|
||||
|
||||
const snapFormScore = (value?: number) => {
|
||||
form.scoreDeduction = snapHalfScore(value, currentTypeMinScore.value, currentTypeMaxScore.value);
|
||||
};
|
||||
|
||||
const showViolationRemark = (item: ViolationItem) => {
|
||||
ElMessageBox.alert(getItemRemark(item.disciplineTypeId) || '暂无说明', item.disciplineTypeName || '扣分说明', {
|
||||
confirmButtonText: '知道了'
|
||||
});
|
||||
};
|
||||
|
||||
const handleTypeSelectionChange = (typeIds: Array<string | number>) => {
|
||||
const currentMap = new Map(violationItems.value.map((item) => [String(item.disciplineTypeId), item]));
|
||||
const nextItems: ViolationItem[] = [];
|
||||
@@ -407,7 +465,8 @@ const handleTypeSelectionChange = (typeIds: Array<string | number>) => {
|
||||
nextItems.push({
|
||||
disciplineTypeId: option.id,
|
||||
disciplineTypeName: option.typeName,
|
||||
scoreDeduction: existing?.scoreDeduction ?? parseScore(option.minScore, 0)
|
||||
scoreDeduction: existing?.scoreDeduction ?? parseScore(option.minScore, 0),
|
||||
remark: existing?.remark || ''
|
||||
});
|
||||
});
|
||||
|
||||
@@ -865,7 +924,8 @@ const handleConfirm = async () => {
|
||||
...sharedFields,
|
||||
disciplineTypeId: item.disciplineTypeId,
|
||||
disciplineTypeName: item.disciplineTypeName,
|
||||
scoreDeduction: item.scoreDeduction
|
||||
scoreDeduction: item.scoreDeduction,
|
||||
disciplineContent: [sharedFields.disciplineContent, item.remark].filter((text) => text && String(text).trim()).join(';')
|
||||
}));
|
||||
emit('confirm', records);
|
||||
} catch (error) {
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
<!-- 只展示状态名,不展示请假类型(如「其他假」) -->
|
||||
<el-tag v-if="bed.leaveId" type="warning" size="small">请假</el-tag>
|
||||
<el-tag v-if="bed.holidayStayId" type="primary" size="small" style="margin-left: 4px">假期留宿</el-tag>
|
||||
<div v-if="isLateReturn(bed)" class="late-return-text">{{ formatHm(bed.leaveEndTime) }}返寝</div>
|
||||
</div>
|
||||
<div v-if="!bed.leaveId && !bed.holidayStayId" class="status-label">
|
||||
{{ getStatusLabel(bed) }}
|
||||
@@ -46,6 +47,7 @@
|
||||
<script setup lang="ts">
|
||||
import { ref, computed, watch, getCurrentInstance, ComponentInternalInstance, onMounted } from 'vue';
|
||||
import ElMessage from 'element-plus/es/components/message/index';
|
||||
import { ElMessageBox } from 'element-plus';
|
||||
import { submitRollCall } from '@/api/xg/xgss/dormRollCall/dormRollCall/index';
|
||||
import { DormRollCallDetailForm, DormRollCallForm } from '@/api/xg/xgss/dormRollCall/dormRollCall/types';
|
||||
import { getRoomStudents } from '@/api/xg/xgss/dormBedStudent/dormBedStudent/index';
|
||||
@@ -105,11 +107,33 @@ const summary = computed(() => {
|
||||
return { present, leave, holidayStay, absent, empty };
|
||||
});
|
||||
|
||||
const isLateReturn = (bed: BedItem) => {
|
||||
if (!bed?.leaveEndTime) return false;
|
||||
const date = new Date(String(bed.leaveEndTime).replace(/-/g, '/'));
|
||||
if (Number.isNaN(date.getTime())) return false;
|
||||
const minutes = date.getHours() * 60 + date.getMinutes();
|
||||
return minutes >= 20 * 60 + 30 || minutes <= 5 * 60;
|
||||
};
|
||||
|
||||
const formatHm = (value?: string) => {
|
||||
if (!value) return '';
|
||||
const date = new Date(String(value).replace(/-/g, '/'));
|
||||
if (Number.isNaN(date.getTime())) return '';
|
||||
const pad = (n: number) => String(n).padStart(2, '0');
|
||||
return `${pad(date.getHours())}:${pad(date.getMinutes())}`;
|
||||
};
|
||||
|
||||
const formatDetailTime = (value?: string) => {
|
||||
if (!value) return '-';
|
||||
return String(value).replace('T', ' ').slice(0, 16);
|
||||
};
|
||||
|
||||
const getBedCardClass = (bed: BedItem) => {
|
||||
if (bed.isLeaveAuto && bed.isHolidayStayAuto) return 'bed-leave';
|
||||
const late = bed.isLeaveAuto && isLateReturn(bed) ? ' bed-late-return' : '';
|
||||
if (bed.isLeaveAuto && bed.isHolidayStayAuto) return 'bed-leave bed-holiday-stay' + late;
|
||||
const status = bed.rollCallStatus;
|
||||
if (status === '0') return 'bed-present';
|
||||
if (status === '1') return 'bed-leave';
|
||||
if (status === '1') return 'bed-leave' + late;
|
||||
if (status === '4') return 'bed-holiday-stay';
|
||||
if (status === '2') return 'bed-absent';
|
||||
if (status === '3') return 'bed-empty';
|
||||
@@ -131,13 +155,20 @@ const getStatusLabel = (bed: BedItem | string) => {
|
||||
|
||||
const handleBedClick = (bed: BedItem) => {
|
||||
if (bed.isLeaveAuto || bed.isHolidayStayAuto) {
|
||||
ElMessage.info(
|
||||
bed.isLeaveAuto && bed.isHolidayStayAuto
|
||||
? '该学生同时处于请假与假期留宿,不可修改'
|
||||
: bed.isLeaveAuto
|
||||
? '该学生处于请假状态,不可修改'
|
||||
: '该学生处于假期留宿状态,不可修改'
|
||||
);
|
||||
const lines: string[] = [];
|
||||
if (bed.isLeaveAuto) {
|
||||
lines.push(`请假:${formatDetailTime(bed.leaveStartTime)} 至 ${formatDetailTime(bed.leaveEndTime)}`);
|
||||
if (isLateReturn(bed)) {
|
||||
lines.push(`预计 ${formatHm(bed.leaveEndTime)} 返寝`);
|
||||
}
|
||||
}
|
||||
if (bed.isHolidayStayAuto) {
|
||||
lines.push(`假期留宿:${formatDetailTime(bed.holidayStartDate)} 至 ${formatDetailTime(bed.holidayEndDate)}`);
|
||||
}
|
||||
ElMessageBox.alert(lines.join('<br/>'), bed.studentName || '点名明细', {
|
||||
confirmButtonText: '知道了',
|
||||
dangerouslyUseHTMLString: true
|
||||
});
|
||||
return;
|
||||
}
|
||||
if (!bed.studentId) {
|
||||
@@ -364,6 +395,18 @@ watch(() => props.visible, (val) => {
|
||||
border-color: #67c23a;
|
||||
}
|
||||
|
||||
.late-return-text {
|
||||
margin-top: 4px;
|
||||
color: #fa8c16;
|
||||
font-size: 12px;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.bed-card.bed-late-return {
|
||||
background: #fff7e6;
|
||||
border-color: #fa8c16;
|
||||
}
|
||||
|
||||
.bed-leave {
|
||||
background: #fff8e1;
|
||||
border-color: #e6a23c;
|
||||
|
||||
@@ -106,11 +106,22 @@ const loadCampusOptions = async () => {
|
||||
}
|
||||
};
|
||||
|
||||
const refreshBatchNo = async () => {
|
||||
if (!filterForm.campusId) {
|
||||
batchNo.value = '';
|
||||
return;
|
||||
}
|
||||
const batchRes = await generateBatchNo(filterForm.campusId);
|
||||
batchNo.value = batchRes.data;
|
||||
};
|
||||
|
||||
const handleCampusChange = async (val: string | number) => {
|
||||
filterForm.buildingId = undefined;
|
||||
buildingOptions.value = [];
|
||||
rooms.value = [];
|
||||
batchNo.value = '';
|
||||
if (val) {
|
||||
await refreshBatchNo();
|
||||
try {
|
||||
dormLoading.value = true;
|
||||
const res = await request({
|
||||
@@ -137,8 +148,11 @@ const loadRooms = async () => {
|
||||
loading.value = true;
|
||||
try {
|
||||
if (!batchNo.value) {
|
||||
const batchRes = await generateBatchNo();
|
||||
batchNo.value = batchRes.data;
|
||||
await refreshBatchNo();
|
||||
}
|
||||
if (!batchNo.value) {
|
||||
ElMessage.warning('请先选择校区');
|
||||
return;
|
||||
}
|
||||
const res = await getBuildingRoomsStatus(filterForm.buildingId, batchNo.value);
|
||||
rooms.value = res.data || [];
|
||||
|
||||
@@ -632,9 +632,9 @@
|
||||
<el-date-picker
|
||||
clearable
|
||||
v-model="form.applyStartDate"
|
||||
type="datetime"
|
||||
value-format="YYYY-MM-DD HH:mm:ss"
|
||||
placeholder="请选择留宿开始日期"
|
||||
type="date"
|
||||
value-format="YYYY-MM-DD"
|
||||
placeholder="开始日早上8点"
|
||||
style="width: 100%"
|
||||
>
|
||||
</el-date-picker>
|
||||
@@ -645,9 +645,9 @@
|
||||
<el-date-picker
|
||||
clearable
|
||||
v-model="form.applyEndDate"
|
||||
type="datetime"
|
||||
value-format="YYYY-MM-DD HH:mm:ss"
|
||||
placeholder="请选择留宿结束日期"
|
||||
type="date"
|
||||
value-format="YYYY-MM-DD"
|
||||
placeholder="最后一晚,次日早上8点结束"
|
||||
style="width: 100%"
|
||||
>
|
||||
</el-date-picker>
|
||||
@@ -880,7 +880,7 @@ const initFormData: HolidayStayForm = {
|
||||
bedId: undefined,
|
||||
bedName: undefined,
|
||||
holidayType: undefined,
|
||||
applyStartDate: new Date().toISOString().slice(0, 19).replace('T', ' '), // 默认当前日期时间
|
||||
applyStartDate: undefined,
|
||||
applyEndDate: undefined,
|
||||
stayReason: undefined,
|
||||
stayReasonType: 'other', // 默认其他原因
|
||||
@@ -1144,6 +1144,8 @@ const handleUpdate = async (row?: HolidayStayVO) => {
|
||||
const _id = row?.id || ids.value[0];
|
||||
const res = await getHolidayStay(_id);
|
||||
Object.assign(form.value, res.data);
|
||||
form.value.applyStartDate = toStayInputDate(form.value.applyStartDate, false);
|
||||
form.value.applyEndDate = toStayInputDate(form.value.applyEndDate, true);
|
||||
|
||||
// 确保当前学生信息在选项中(修复学生选择器显示问题)
|
||||
if (form.value.studentId && form.value.studentName && form.value.studentNo) {
|
||||
@@ -1192,6 +1194,22 @@ const handleUpdate = async (row?: HolidayStayVO) => {
|
||||
};
|
||||
|
||||
/** 提交按钮 */
|
||||
const toStayInputDate = (value?: string, isEnd = false) => {
|
||||
if (!value) return undefined;
|
||||
const date = new Date(String(value).replace(/-/g, '/'));
|
||||
if (Number.isNaN(date.getTime())) return String(value).slice(0, 10);
|
||||
if (isEnd && date.getHours() === 8 && date.getMinutes() === 0 && date.getSeconds() === 0) {
|
||||
date.setDate(date.getDate() - 1);
|
||||
}
|
||||
const pad = (n: number) => String(n).padStart(2, '0');
|
||||
return `${date.getFullYear()}-${pad(date.getMonth() + 1)}-${pad(date.getDate())}`;
|
||||
};
|
||||
|
||||
const toStayPayloadDate = (value?: string) => {
|
||||
if (!value) return value;
|
||||
return `${String(value).slice(0, 10)} 00:00:00`;
|
||||
};
|
||||
|
||||
const submitForm = () => {
|
||||
holidayStayFormRef.value?.validate(async (valid: boolean) => {
|
||||
if (valid) {
|
||||
@@ -1202,6 +1220,8 @@ const submitForm = () => {
|
||||
|
||||
// 将附件ID添加到表单数据中,处理成逗号分隔的字符串
|
||||
form.value.attachmentOssIds = attachmentOssIds.join(',');
|
||||
form.value.applyStartDate = toStayPayloadDate(form.value.applyStartDate);
|
||||
form.value.applyEndDate = toStayPayloadDate(form.value.applyEndDate);
|
||||
|
||||
if (form.value.id) {
|
||||
await updateHolidayStay(form.value).finally(() => (buttonLoading.value = false));
|
||||
|
||||
@@ -454,9 +454,9 @@
|
||||
<el-date-picker
|
||||
clearable
|
||||
v-model="form.applyStartDate"
|
||||
type="datetime"
|
||||
value-format="YYYY-MM-DD HH:mm:ss"
|
||||
placeholder="请选择留宿开始日期"
|
||||
type="date"
|
||||
value-format="YYYY-MM-DD"
|
||||
placeholder="开始日早上8点"
|
||||
style="width: 100%"
|
||||
>
|
||||
</el-date-picker>
|
||||
@@ -467,9 +467,9 @@
|
||||
<el-date-picker
|
||||
clearable
|
||||
v-model="form.applyEndDate"
|
||||
type="datetime"
|
||||
value-format="YYYY-MM-DD HH:mm:ss"
|
||||
placeholder="请选择留宿结束日期"
|
||||
type="date"
|
||||
value-format="YYYY-MM-DD"
|
||||
placeholder="最后一晚,次日早上8点结束"
|
||||
style="width: 100%"
|
||||
>
|
||||
</el-date-picker>
|
||||
@@ -711,7 +711,7 @@ const initFormData: HolidayStayForm = {
|
||||
bedId: undefined,
|
||||
bedName: undefined,
|
||||
holidayType: undefined,
|
||||
applyStartDate: new Date().toISOString().slice(0, 19).replace('T', ' '), // 默认当前日期时间
|
||||
applyStartDate: undefined,
|
||||
applyEndDate: undefined,
|
||||
stayReason: undefined,
|
||||
stayReasonType: 'other', // 默认其他原因
|
||||
@@ -883,6 +883,8 @@ const handleUpdate = async (row?: HolidayStayVO) => {
|
||||
const _id = row?.id || ids.value[0];
|
||||
const res = await getHolidayStay(_id);
|
||||
Object.assign(form.value, res.data);
|
||||
form.value.applyStartDate = toStayInputDate(form.value.applyStartDate, false);
|
||||
form.value.applyEndDate = toStayInputDate(form.value.applyEndDate, true);
|
||||
|
||||
// 确保当前学生信息在选项中(修复学生选择器显示问题)
|
||||
if (form.value.studentId && form.value.studentName && form.value.studentNo) {
|
||||
@@ -930,6 +932,22 @@ const handleUpdate = async (row?: HolidayStayVO) => {
|
||||
dialog.title = '修改假期留宿管理';
|
||||
};
|
||||
|
||||
const toStayInputDate = (value?: string, isEnd = false) => {
|
||||
if (!value) return undefined;
|
||||
const date = new Date(String(value).replace(/-/g, '/'));
|
||||
if (Number.isNaN(date.getTime())) return String(value).slice(0, 10);
|
||||
if (isEnd && date.getHours() === 8 && date.getMinutes() === 0 && date.getSeconds() === 0) {
|
||||
date.setDate(date.getDate() - 1);
|
||||
}
|
||||
const pad = (n: number) => String(n).padStart(2, '0');
|
||||
return `${date.getFullYear()}-${pad(date.getMonth() + 1)}-${pad(date.getDate())}`;
|
||||
};
|
||||
|
||||
const toStayPayloadDate = (value?: string) => {
|
||||
if (!value) return value;
|
||||
return `${String(value).slice(0, 10)} 00:00:00`;
|
||||
};
|
||||
|
||||
/** 提交按钮 */
|
||||
const submitForm = () => {
|
||||
holidayStayFormRef.value?.validate(async (valid: boolean) => {
|
||||
@@ -941,6 +959,8 @@ const submitForm = () => {
|
||||
|
||||
// 将附件ID添加到表单数据中,处理成逗号分隔的字符串
|
||||
form.value.attachmentOssIds = attachmentOssIds.join(',');
|
||||
form.value.applyStartDate = toStayPayloadDate(form.value.applyStartDate);
|
||||
form.value.applyEndDate = toStayPayloadDate(form.value.applyEndDate);
|
||||
|
||||
if (form.value.id) {
|
||||
await updateHolidayStay(form.value).finally(() => (buttonLoading.value = false));
|
||||
|
||||
@@ -48,6 +48,7 @@
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button type="primary" plain icon="Plus" @click="handleAdd" v-hasPermi="['disciplineRecord:disciplineRecord:add']">新增</el-button>
|
||||
<el-button type="warning" plain icon="Document" @click="goPunishment" v-hasPermi="['disciplineRecord:disciplineRecord:list']">学生处分</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
@@ -147,6 +148,7 @@
|
||||
|
||||
<script setup name="DisciplineRecord" lang="ts">
|
||||
import { ref, reactive, toRefs, onMounted, getCurrentInstance, ComponentInternalInstance } from 'vue';
|
||||
import { useRouter } from 'vue-router';
|
||||
import { listDisciplineRecord, delDisciplineRecord } from '@/api/xskh/disciplineRecord/disciplineRecord';
|
||||
import {
|
||||
DisciplineRecordVO,
|
||||
@@ -156,6 +158,7 @@ import {
|
||||
import DisciplineRecordForm from './DisciplineRecordForm.vue';
|
||||
|
||||
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
||||
const router = useRouter();
|
||||
const { student_discipline_status, xskh_violation_source } = toRefs<any>(proxy?.useDict('student_discipline_status', 'xskh_violation_source'));
|
||||
|
||||
const disciplineRecordList = ref<DisciplineRecordVO[]>([]);
|
||||
@@ -255,6 +258,10 @@ const handleSelectionChange = (selection: DisciplineRecordVO[]) => {
|
||||
};
|
||||
|
||||
/** 新增按钮操作 */
|
||||
const goPunishment = () => {
|
||||
router.push({ name: 'StudentPunishmentPage' });
|
||||
};
|
||||
|
||||
const handleAdd = () => {
|
||||
disciplineRecordFormRef.value?.openDialog(undefined, '新增');
|
||||
};
|
||||
|
||||
@@ -0,0 +1,316 @@
|
||||
<template>
|
||||
<div class="p-2 page-container">
|
||||
<el-card shadow="hover" class="mb-[10px]">
|
||||
<el-form :model="queryParams" label-width="80px">
|
||||
<el-row :gutter="16">
|
||||
<el-col :span="6">
|
||||
<el-form-item label="学号">
|
||||
<el-input v-model="queryParams.studentNo" clearable placeholder="学号" @keyup.enter="handleQuery" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="6">
|
||||
<el-form-item label="姓名">
|
||||
<el-input v-model="queryParams.studentName" clearable placeholder="姓名" @keyup.enter="handleQuery" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="6">
|
||||
<el-form-item label="学院">
|
||||
<el-input v-model="queryParams.collegeName" clearable placeholder="学院" @keyup.enter="handleQuery" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="6">
|
||||
<el-form-item label="班级">
|
||||
<el-input v-model="queryParams.className" clearable placeholder="班级" @keyup.enter="handleQuery" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="6">
|
||||
<el-form-item label="处分种类">
|
||||
<el-select v-model="queryParams.disciplineTypeName" clearable placeholder="全部" style="width: 100%">
|
||||
<el-option v-for="item in punishmentOptions" :key="item.code" :label="optionLabel(item)" :value="item.name" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="处分日期">
|
||||
<el-date-picker
|
||||
v-model="dateRange"
|
||||
type="daterange"
|
||||
value-format="YYYY-MM-DD"
|
||||
range-separator="至"
|
||||
start-placeholder="开始"
|
||||
end-placeholder="结束"
|
||||
style="width: 100%"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="10">
|
||||
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
|
||||
<el-button icon="Refresh" @click="resetQuery">重置</el-button>
|
||||
<el-button type="primary" plain icon="Plus" v-hasPermi="['disciplineRecord:disciplineRecord:add']" @click="openCreate">登记处分</el-button>
|
||||
<el-button type="warning" plain icon="Download" v-hasPermi="['disciplineRecord:disciplineRecord:export']" @click="handleExport">导出登记表</el-button>
|
||||
<el-button type="warning" plain icon="Download" v-hasPermi="['disciplineRecord:disciplineRecord:export']" @click="handleExportSummary">导出汇总表</el-button>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
</el-card>
|
||||
|
||||
<el-row :gutter="12" class="mb-[10px]">
|
||||
<el-col :span="12">
|
||||
<el-card shadow="never" header="按处分种类">
|
||||
<el-table :data="summary.byType" border size="small">
|
||||
<el-table-column prop="name" label="种类" />
|
||||
<el-table-column prop="count" label="人次" width="90" />
|
||||
<el-table-column prop="score" label="班级扣分" width="110" />
|
||||
</el-table>
|
||||
</el-card>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-card shadow="never" header="按班级">
|
||||
<el-table :data="summary.byClass" border size="small" max-height="280">
|
||||
<el-table-column prop="name" label="学院/班级" />
|
||||
<el-table-column prop="count" label="人次" width="90" />
|
||||
<el-table-column prop="score" label="班级扣分" width="110" />
|
||||
</el-table>
|
||||
</el-card>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-card shadow="never">
|
||||
<el-table v-loading="loading" :data="recordList" border>
|
||||
<el-table-column prop="studentNo" label="学号" width="130" />
|
||||
<el-table-column prop="studentName" label="姓名" width="100" />
|
||||
<el-table-column prop="collegeName" label="学院" min-width="140" />
|
||||
<el-table-column prop="className" label="班级" min-width="140" />
|
||||
<el-table-column prop="disciplineTypeName" label="处分种类" width="120" />
|
||||
<el-table-column prop="scoreDeduction" label="班级扣分" width="100" />
|
||||
<el-table-column prop="disciplineDate" label="处分日期" width="120" />
|
||||
<el-table-column prop="disciplineReason" label="原因" min-width="180" show-overflow-tooltip />
|
||||
</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 v-model="dialogVisible" title="登记学生处分" width="560px" append-to-body>
|
||||
<el-form ref="formRef" :model="form" :rules="rules" label-width="90px">
|
||||
<el-form-item label="学生" prop="studentId">
|
||||
<el-select
|
||||
v-model="form.studentId"
|
||||
filterable
|
||||
remote
|
||||
reserve-keyword
|
||||
placeholder="输入姓名或学号"
|
||||
:remote-method="searchStudents"
|
||||
:loading="studentLoading"
|
||||
style="width: 100%"
|
||||
@change="handleStudentChange"
|
||||
>
|
||||
<el-option v-for="item in studentOptions" :key="item.id" :label="studentLabel(item)" :value="item.id" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="班级">
|
||||
<el-input :model-value="selectedStudent ? `${selectedStudent.collegeName || ''} ${selectedStudent.className || ''}` : ''" disabled />
|
||||
</el-form-item>
|
||||
<el-form-item label="处分种类" prop="punishmentCode">
|
||||
<el-select v-model="form.punishmentCode" placeholder="请选择" style="width: 100%">
|
||||
<el-option v-for="item in punishmentOptions" :key="item.code" :label="optionLabel(item)" :value="item.code" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="处分日期" prop="disciplineDate">
|
||||
<el-date-picker v-model="form.disciplineDate" type="date" value-format="YYYY-MM-DD" style="width: 100%" />
|
||||
</el-form-item>
|
||||
<el-form-item label="处分原因" prop="disciplineReason">
|
||||
<el-input v-model="form.disciplineReason" type="textarea" :rows="3" maxlength="500" show-word-limit />
|
||||
</el-form-item>
|
||||
<el-form-item label="备注">
|
||||
<el-input v-model="form.disciplineContent" type="textarea" :rows="2" maxlength="500" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<el-button @click="dialogVisible = false">取消</el-button>
|
||||
<el-button type="primary" :loading="submitting" @click="submitForm">确定</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup name="StudentPunishmentPage" lang="ts">
|
||||
import { computed, getCurrentInstance, onMounted, reactive, ref } from 'vue';
|
||||
import { ElMessage } from 'element-plus';
|
||||
import { addPunishment, getPunishmentOptions, getPunishmentSummary, getStudentOptions, listDisciplineRecord } from '@/api/xskh/disciplineRecord/disciplineRecord';
|
||||
import type { DisciplineRecordVO, XskhStudentOptionVO } from '@/api/xskh/disciplineRecord/disciplineRecord/types';
|
||||
|
||||
interface PunishmentOption {
|
||||
code: string;
|
||||
name: string;
|
||||
score: number;
|
||||
countInClass: boolean;
|
||||
}
|
||||
|
||||
const { proxy } = getCurrentInstance() as any;
|
||||
|
||||
const loading = ref(false);
|
||||
const submitting = ref(false);
|
||||
const studentLoading = ref(false);
|
||||
const dialogVisible = ref(false);
|
||||
const total = ref(0);
|
||||
const recordList = ref<DisciplineRecordVO[]>([]);
|
||||
const punishmentOptions = ref<PunishmentOption[]>([]);
|
||||
const studentOptions = ref<XskhStudentOptionVO[]>([]);
|
||||
const dateRange = ref<string[]>([]);
|
||||
const formRef = ref();
|
||||
|
||||
const queryParams = reactive({
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
studentNo: '',
|
||||
studentName: '',
|
||||
collegeName: '',
|
||||
className: '',
|
||||
disciplineTypeName: '',
|
||||
violationSource: '3',
|
||||
beginDisciplineDate: undefined as string | undefined,
|
||||
endDisciplineDate: undefined as string | undefined
|
||||
});
|
||||
|
||||
const summary = reactive<{ byType: any[]; byClass: any[] }>({
|
||||
byType: [],
|
||||
byClass: []
|
||||
});
|
||||
|
||||
const form = reactive({
|
||||
studentId: undefined as string | number | undefined,
|
||||
punishmentCode: '',
|
||||
disciplineDate: '',
|
||||
disciplineReason: '',
|
||||
disciplineContent: ''
|
||||
});
|
||||
|
||||
const rules = {
|
||||
studentId: [{ required: true, message: '请选择学生', trigger: 'change' }],
|
||||
punishmentCode: [{ required: true, message: '请选择处分种类', trigger: 'change' }],
|
||||
disciplineDate: [{ required: true, message: '请选择处分日期', trigger: 'change' }],
|
||||
disciplineReason: [{ required: true, message: '请填写处分原因', trigger: 'blur' }]
|
||||
};
|
||||
|
||||
const selectedStudent = computed(() => studentOptions.value.find((item) => String(item.id) === String(form.studentId)));
|
||||
|
||||
const optionLabel = (item: PunishmentOption) => {
|
||||
if (!item.countInClass) return `${item.name}(不计班级扣分)`;
|
||||
return `${item.name}(${item.score}分)`;
|
||||
};
|
||||
|
||||
const studentLabel = (item: XskhStudentOptionVO) => `${item.name} ${item.studentNo} ${item.className || ''}`;
|
||||
|
||||
const buildQuery = () => {
|
||||
queryParams.beginDisciplineDate = dateRange.value?.[0];
|
||||
queryParams.endDisciplineDate = dateRange.value?.[1];
|
||||
return { ...queryParams };
|
||||
};
|
||||
|
||||
const getList = async () => {
|
||||
loading.value = true;
|
||||
try {
|
||||
const res: any = await listDisciplineRecord(buildQuery());
|
||||
recordList.value = res.rows || [];
|
||||
total.value = res.total || 0;
|
||||
} finally {
|
||||
loading.value = false;
|
||||
}
|
||||
};
|
||||
|
||||
const loadSummary = async () => {
|
||||
const res: any = await getPunishmentSummary(buildQuery());
|
||||
summary.byType = res.data?.byType || [];
|
||||
summary.byClass = res.data?.byClass || [];
|
||||
};
|
||||
|
||||
const handleQuery = () => {
|
||||
queryParams.pageNum = 1;
|
||||
getList();
|
||||
loadSummary();
|
||||
};
|
||||
|
||||
const resetQuery = () => {
|
||||
queryParams.studentNo = '';
|
||||
queryParams.studentName = '';
|
||||
queryParams.collegeName = '';
|
||||
queryParams.className = '';
|
||||
queryParams.disciplineTypeName = '';
|
||||
dateRange.value = [];
|
||||
handleQuery();
|
||||
};
|
||||
|
||||
const searchStudents = async (keyword: string) => {
|
||||
if (!keyword) {
|
||||
studentOptions.value = [];
|
||||
return;
|
||||
}
|
||||
studentLoading.value = true;
|
||||
try {
|
||||
const res: any = await getStudentOptions(keyword);
|
||||
studentOptions.value = res.data || [];
|
||||
} finally {
|
||||
studentLoading.value = false;
|
||||
}
|
||||
};
|
||||
|
||||
const handleStudentChange = () => {
|
||||
if (selectedStudent.value && !selectedStudent.value.classId) {
|
||||
ElMessage.warning('该学生未分配班级,无法登记处分');
|
||||
}
|
||||
};
|
||||
|
||||
const openCreate = () => {
|
||||
form.studentId = undefined;
|
||||
form.punishmentCode = punishmentOptions.value[0]?.code || '';
|
||||
const now = new Date();
|
||||
const pad = (n: number) => String(n).padStart(2, '0');
|
||||
form.disciplineDate = `${now.getFullYear()}-${pad(now.getMonth() + 1)}-${pad(now.getDate())}`;
|
||||
form.disciplineReason = '';
|
||||
form.disciplineContent = '';
|
||||
studentOptions.value = [];
|
||||
dialogVisible.value = true;
|
||||
};
|
||||
|
||||
const submitForm = async () => {
|
||||
await formRef.value?.validate();
|
||||
if (selectedStudent.value && !selectedStudent.value.classId) {
|
||||
ElMessage.warning('该学生未分配班级,无法登记处分');
|
||||
return;
|
||||
}
|
||||
submitting.value = true;
|
||||
try {
|
||||
await addPunishment({
|
||||
studentId: form.studentId as string | number,
|
||||
punishmentCode: form.punishmentCode,
|
||||
disciplineDate: form.disciplineDate,
|
||||
disciplineReason: form.disciplineReason,
|
||||
disciplineContent: form.disciplineContent
|
||||
});
|
||||
ElMessage.success('处分已登记,分值会计入班级月扣分');
|
||||
dialogVisible.value = false;
|
||||
handleQuery();
|
||||
} finally {
|
||||
submitting.value = false;
|
||||
}
|
||||
};
|
||||
|
||||
const handleExport = () => {
|
||||
proxy?.download('disciplineRecord/disciplineRecord/punishment/export', buildQuery(), `学生处分登记表_${Date.now()}.xlsx`);
|
||||
};
|
||||
|
||||
const handleExportSummary = () => {
|
||||
proxy?.download('disciplineRecord/disciplineRecord/punishment/exportSummary', buildQuery(), `学生处分汇总表_${Date.now()}.xlsx`);
|
||||
};
|
||||
|
||||
onMounted(async () => {
|
||||
const res: any = await getPunishmentOptions();
|
||||
punishmentOptions.value = res.data || [];
|
||||
handleQuery();
|
||||
});
|
||||
</script>
|
||||
Reference in new issue
Block a user