提交代码
This commit is contained in:
1 parent
826f6101f7
commit
29e8981cc6
14 files changed
+2680
-5
No files matched your search
+113
@@ -0,0 +1,113 @@
|
||||
package org.dromara.xskh.controller;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import jakarta.validation.constraints.*;
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.dromara.common.idempotent.annotation.RepeatSubmit;
|
||||
import org.dromara.common.log.annotation.Log;
|
||||
import org.dromara.common.web.core.BaseController;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import org.dromara.common.core.domain.R;
|
||||
import org.dromara.common.core.validate.AddGroup;
|
||||
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.bo.XskhDisciplineRecordBo;
|
||||
import org.dromara.xskh.domain.vo.XskhStudentOptionVo;
|
||||
import org.dromara.xskh.service.IXskhDisciplineRecordService;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 学生违纪处分记录
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2025-01-03
|
||||
*/
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/disciplineRecord/disciplineRecord")
|
||||
public class XskhDisciplineRecordController extends BaseController {
|
||||
|
||||
private final IXskhDisciplineRecordService xskhDisciplineRecordService;
|
||||
|
||||
/**
|
||||
* 查询学生违纪处分记录列表
|
||||
*/
|
||||
@SaCheckPermission("disciplineRecord:disciplineRecord:list")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<XskhDisciplineRecordVo> list(XskhDisciplineRecordBo bo, PageQuery pageQuery) {
|
||||
return xskhDisciplineRecordService.queryPageList(bo, pageQuery);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出学生违纪处分记录列表
|
||||
*/
|
||||
@SaCheckPermission("disciplineRecord:disciplineRecord:export")
|
||||
@Log(title = "学生违纪处分记录", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(XskhDisciplineRecordBo bo, HttpServletResponse response) {
|
||||
List<XskhDisciplineRecordVo> list = xskhDisciplineRecordService.queryList(bo);
|
||||
ExcelUtil.exportExcel(list, "学生违纪处分记录", XskhDisciplineRecordVo.class, response);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取学生违纪处分记录详细信息
|
||||
*
|
||||
* @param id 主键
|
||||
*/
|
||||
@SaCheckPermission("disciplineRecord:disciplineRecord:query")
|
||||
@GetMapping("/{id}")
|
||||
public R<XskhDisciplineRecordVo> getInfo(@NotNull(message = "主键不能为空") @PathVariable Long id) {
|
||||
return R.ok(xskhDisciplineRecordService.queryById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增学生违纪处分记录
|
||||
*/
|
||||
@SaCheckPermission("disciplineRecord:disciplineRecord:add")
|
||||
@Log(title = "学生违纪处分记录", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit()
|
||||
@PostMapping()
|
||||
public R<Void> add(@Validated(AddGroup.class) @RequestBody XskhDisciplineRecordBo bo) {
|
||||
return toAjax(xskhDisciplineRecordService.insertByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改学生违纪处分记录
|
||||
*/
|
||||
@SaCheckPermission("disciplineRecord:disciplineRecord:edit")
|
||||
@Log(title = "学生违纪处分记录", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit()
|
||||
@PutMapping()
|
||||
public R<Void> edit(@Validated(EditGroup.class) @RequestBody XskhDisciplineRecordBo bo) {
|
||||
return toAjax(xskhDisciplineRecordService.updateByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除学生违纪处分记录
|
||||
*
|
||||
* @param ids 主键串
|
||||
*/
|
||||
@SaCheckPermission("disciplineRecord:disciplineRecord:remove")
|
||||
@Log(title = "学生违纪处分记录", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public R<Void> remove(@NotEmpty(message = "主键不能为空") @PathVariable Long[] ids) {
|
||||
return toAjax(xskhDisciplineRecordService.deleteWithValidByIds(List.of(ids), true));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询学生选项列表(用于下拉框)
|
||||
*/
|
||||
@SaCheckPermission("disciplineRecord:disciplineRecord:query")
|
||||
@GetMapping("/studentOptions")
|
||||
public R<List<XskhStudentOptionVo>> getStudentOptions(@RequestParam(required = false) String keyword) {
|
||||
return R.ok(xskhDisciplineRecordService.getStudentOptions(keyword));
|
||||
}
|
||||
}
|
||||
+118
@@ -0,0 +1,118 @@
|
||||
package org.dromara.xskh.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.dromara.common.tenant.core.TenantEntity;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 学生违纪处分记录对象 xskh_discipline_record
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2025-01-03
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName("xskh_discipline_record")
|
||||
public class XskhDisciplineRecord extends TenantEntity {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键ID
|
||||
*/
|
||||
@TableId(value = "id")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 学生ID
|
||||
*/
|
||||
private Long studentId;
|
||||
|
||||
/**
|
||||
* 学号
|
||||
*/
|
||||
private String studentNo;
|
||||
|
||||
/**
|
||||
* 学生姓名
|
||||
*/
|
||||
private String studentName;
|
||||
|
||||
/**
|
||||
* 学院ID
|
||||
*/
|
||||
private Long collegeId;
|
||||
|
||||
/**
|
||||
* 学院名称
|
||||
*/
|
||||
private String collegeName;
|
||||
|
||||
/**
|
||||
* 专业ID
|
||||
*/
|
||||
private Long majorId;
|
||||
|
||||
/**
|
||||
* 专业名称
|
||||
*/
|
||||
private String majorName;
|
||||
|
||||
/**
|
||||
* 班级ID
|
||||
*/
|
||||
private Long classId;
|
||||
|
||||
/**
|
||||
* 班级名称
|
||||
*/
|
||||
private String className;
|
||||
|
||||
/**
|
||||
* 违纪处分类型ID
|
||||
*/
|
||||
private Long disciplineTypeId;
|
||||
|
||||
/**
|
||||
* 违纪处分类型名称
|
||||
*/
|
||||
private String disciplineTypeName;
|
||||
|
||||
/**
|
||||
* 违纪处分日期
|
||||
*/
|
||||
private LocalDate disciplineDate;
|
||||
|
||||
/**
|
||||
* 违纪处分原因
|
||||
*/
|
||||
private String disciplineReason;
|
||||
|
||||
/**
|
||||
* 违纪处分内容
|
||||
*/
|
||||
private String disciplineContent;
|
||||
|
||||
/**
|
||||
* 扣分分值
|
||||
*/
|
||||
private BigDecimal scoreDeduction;
|
||||
|
||||
/**
|
||||
* 状态(1-生效 2-已撤销)
|
||||
*/
|
||||
private String status;
|
||||
|
||||
/**
|
||||
* 附件OSS ID列表,逗号分隔
|
||||
*/
|
||||
private String attachmentOssIds;
|
||||
|
||||
}
|
||||
+136
@@ -0,0 +1,136 @@
|
||||
package org.dromara.xskh.domain.bo;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.github.linpeilie.annotations.AutoMapper;
|
||||
import jakarta.validation.constraints.*;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.dromara.common.core.validate.AddGroup;
|
||||
import org.dromara.common.core.validate.EditGroup;
|
||||
import org.dromara.common.mybatis.core.domain.BaseEntity;
|
||||
import org.dromara.xskh.domain.XskhDisciplineRecord;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 学生违纪处分记录业务对象 xskh_discipline_record
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2025-01-03
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@AutoMapper(target = XskhDisciplineRecord.class, reverseConvertGenerate = false)
|
||||
public class XskhDisciplineRecordBo extends BaseEntity {
|
||||
|
||||
/**
|
||||
* 主键ID
|
||||
*/
|
||||
@NotNull(message = "主键ID不能为空", groups = { EditGroup.class })
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 学生ID
|
||||
*/
|
||||
@NotNull(message = "学生ID不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private Long studentId;
|
||||
|
||||
/**
|
||||
* 学号
|
||||
*/
|
||||
@NotBlank(message = "学号不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private String studentNo;
|
||||
|
||||
/**
|
||||
* 学生姓名
|
||||
*/
|
||||
@NotBlank(message = "学生姓名不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private String studentName;
|
||||
|
||||
/**
|
||||
* 学院ID
|
||||
*/
|
||||
@NotNull(message = "学院ID不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private Long collegeId;
|
||||
|
||||
/**
|
||||
* 学院名称
|
||||
*/
|
||||
@NotBlank(message = "学院名称不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private String collegeName;
|
||||
|
||||
/**
|
||||
* 专业ID
|
||||
*/
|
||||
@NotNull(message = "专业ID不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private Long majorId;
|
||||
|
||||
/**
|
||||
* 专业名称
|
||||
*/
|
||||
@NotBlank(message = "专业名称不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private String majorName;
|
||||
|
||||
/**
|
||||
* 班级ID
|
||||
*/
|
||||
@NotNull(message = "班级ID不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private Long classId;
|
||||
|
||||
/**
|
||||
* 班级名称
|
||||
*/
|
||||
@NotBlank(message = "班级名称不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private String className;
|
||||
|
||||
/**
|
||||
* 违纪处分类型ID
|
||||
*/
|
||||
@NotNull(message = "违纪处分类型ID不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private Long disciplineTypeId;
|
||||
|
||||
/**
|
||||
* 违纪处分类型名称
|
||||
*/
|
||||
@NotBlank(message = "违纪处分类型名称不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private String disciplineTypeName;
|
||||
|
||||
/**
|
||||
* 违纪处分日期
|
||||
*/
|
||||
@NotNull(message = "违纪处分日期不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
private LocalDate disciplineDate;
|
||||
|
||||
/**
|
||||
* 违纪处分原因
|
||||
*/
|
||||
@NotBlank(message = "违纪处分原因不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private String disciplineReason;
|
||||
|
||||
/**
|
||||
* 违纪处分内容
|
||||
*/
|
||||
private String disciplineContent;
|
||||
|
||||
/**
|
||||
* 扣分分值
|
||||
*/
|
||||
@DecimalMin(value = "0.00", message = "扣分分值不能为负数", groups = { AddGroup.class, EditGroup.class })
|
||||
@Digits(integer = 3, fraction = 2, message = "扣分分值格式不正确,最多支持3位整数和2位小数", groups = { AddGroup.class,
|
||||
EditGroup.class })
|
||||
private BigDecimal scoreDeduction;
|
||||
|
||||
/**
|
||||
* 状态(1-生效 2-已撤销)
|
||||
*/
|
||||
private String status;
|
||||
|
||||
/**
|
||||
* 附件OSS ID列表,逗号分隔
|
||||
*/
|
||||
private String attachmentOssIds;
|
||||
|
||||
}
|
||||
+163
@@ -0,0 +1,163 @@
|
||||
package org.dromara.xskh.domain.vo;
|
||||
|
||||
import org.dromara.xskh.domain.XskhDisciplineType;
|
||||
import cn.idev.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import cn.idev.excel.annotation.ExcelProperty;
|
||||
import org.dromara.common.excel.annotation.ExcelDictFormat;
|
||||
import org.dromara.common.excel.convert.ExcelDictConvert;
|
||||
import io.github.linpeilie.annotations.AutoMapper;
|
||||
import lombok.Data;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import org.dromara.xskh.domain.XskhDisciplineRecord;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 学生违纪处分记录视图对象 xskh_discipline_record
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2025-01-03
|
||||
*/
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
@AutoMapper(target = XskhDisciplineRecord.class)
|
||||
public class XskhDisciplineRecordVo implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键ID
|
||||
*/
|
||||
@ExcelProperty(value = "主键ID")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 学生ID
|
||||
*/
|
||||
@ExcelProperty(value = "学生ID")
|
||||
private Long studentId;
|
||||
|
||||
/**
|
||||
* 学号
|
||||
*/
|
||||
@ExcelProperty(value = "学号")
|
||||
private String studentNo;
|
||||
|
||||
/**
|
||||
* 学生姓名
|
||||
*/
|
||||
@ExcelProperty(value = "学生姓名")
|
||||
private String studentName;
|
||||
|
||||
/**
|
||||
* 学院ID
|
||||
*/
|
||||
@ExcelProperty(value = "学院ID")
|
||||
private Long collegeId;
|
||||
|
||||
/**
|
||||
* 学院名称
|
||||
*/
|
||||
@ExcelProperty(value = "学院名称")
|
||||
private String collegeName;
|
||||
|
||||
/**
|
||||
* 专业ID
|
||||
*/
|
||||
@ExcelProperty(value = "专业ID")
|
||||
private Long majorId;
|
||||
|
||||
/**
|
||||
* 专业名称
|
||||
*/
|
||||
@ExcelProperty(value = "专业名称")
|
||||
private String majorName;
|
||||
|
||||
/**
|
||||
* 班级ID
|
||||
*/
|
||||
@ExcelProperty(value = "班级ID")
|
||||
private Long classId;
|
||||
|
||||
/**
|
||||
* 班级名称
|
||||
*/
|
||||
@ExcelProperty(value = "班级名称")
|
||||
private String className;
|
||||
|
||||
/**
|
||||
* 违纪处分类型ID
|
||||
*/
|
||||
@ExcelProperty(value = "违纪处分类型ID")
|
||||
private Long disciplineTypeId;
|
||||
|
||||
/**
|
||||
* 违纪处分类型名称
|
||||
*/
|
||||
@ExcelProperty(value = "违纪处分类型名称")
|
||||
private String disciplineTypeName;
|
||||
|
||||
/**
|
||||
* 违纪处分日期
|
||||
*/
|
||||
@ExcelProperty(value = "违纪处分日期")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
private LocalDate disciplineDate;
|
||||
|
||||
/**
|
||||
* 违纪处分原因
|
||||
*/
|
||||
@ExcelProperty(value = "违纪处分原因")
|
||||
private String disciplineReason;
|
||||
|
||||
/**
|
||||
* 违纪处分内容
|
||||
*/
|
||||
@ExcelProperty(value = "违纪处分内容")
|
||||
private String disciplineContent;
|
||||
|
||||
/**
|
||||
* 扣分分值
|
||||
*/
|
||||
@ExcelProperty(value = "扣分分值")
|
||||
private BigDecimal scoreDeduction;
|
||||
|
||||
/**
|
||||
* 状态(1-生效 2-已撤销)
|
||||
*/
|
||||
@ExcelProperty(value = "状态", converter = ExcelDictConvert.class)
|
||||
@ExcelDictFormat(dictType = "student_discipline_status")
|
||||
private String status;
|
||||
/**
|
||||
* 附件OSS ID列表,逗号分隔
|
||||
*/
|
||||
private String attachmentOssIds;
|
||||
|
||||
/**
|
||||
* 创建者
|
||||
*/
|
||||
private Long createBy;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 更新者
|
||||
*/
|
||||
private Long updateBy;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date updateTime;
|
||||
|
||||
}
|
||||
+65
@@ -0,0 +1,65 @@
|
||||
package org.dromara.xskh.domain.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 学生考核-学生选项视图对象,用于下拉框选择
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2025-01-03
|
||||
*/
|
||||
@Data
|
||||
public class XskhStudentOptionVo implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 学生ID
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 学号
|
||||
*/
|
||||
private String studentNo;
|
||||
|
||||
/**
|
||||
* 学生姓名
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 学院ID
|
||||
*/
|
||||
private Long collegeId;
|
||||
|
||||
/**
|
||||
* 学院名称
|
||||
*/
|
||||
private String collegeName;
|
||||
|
||||
/**
|
||||
* 专业ID
|
||||
*/
|
||||
private Long majorId;
|
||||
|
||||
/**
|
||||
* 专业名称
|
||||
*/
|
||||
private String majorName;
|
||||
|
||||
/**
|
||||
* 班级ID
|
||||
*/
|
||||
private Long classId;
|
||||
|
||||
/**
|
||||
* 班级名称
|
||||
*/
|
||||
private String className;
|
||||
|
||||
}
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
package org.dromara.xskh.mapper;
|
||||
|
||||
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
|
||||
import org.dromara.xskh.domain.XskhDisciplineRecord;
|
||||
import org.dromara.xskh.domain.vo.XskhDisciplineRecordVo;
|
||||
import org.dromara.xskh.domain.vo.XskhStudentOptionVo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 学生违纪处分记录Mapper接口
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2025-01-03
|
||||
*/
|
||||
public interface XskhDisciplineRecordMapper extends BaseMapperPlus<XskhDisciplineRecord, XskhDisciplineRecordVo> {
|
||||
|
||||
/**
|
||||
* 查询学生选项列表(用于下拉框)
|
||||
*
|
||||
* @param keyword 搜索关键词(学号或姓名)
|
||||
* @return 学生选项列表
|
||||
*/
|
||||
List<XskhStudentOptionVo> selectStudentOptions(String keyword);
|
||||
|
||||
}
|
||||
+54
@@ -0,0 +1,54 @@
|
||||
package org.dromara.xskh.service;
|
||||
|
||||
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.XskhStudentOptionVo;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 学生违纪处分记录Service接口
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2025-01-03
|
||||
*/
|
||||
public interface IXskhDisciplineRecordService {
|
||||
|
||||
/**
|
||||
* 查询学生违纪处分记录
|
||||
*/
|
||||
XskhDisciplineRecordVo queryById(Long id);
|
||||
|
||||
/**
|
||||
* 查询学生违纪处分记录列表
|
||||
*/
|
||||
TableDataInfo<XskhDisciplineRecordVo> queryPageList(XskhDisciplineRecordBo bo, PageQuery pageQuery);
|
||||
|
||||
/**
|
||||
* 查询学生违纪处分记录列表
|
||||
*/
|
||||
List<XskhDisciplineRecordVo> queryList(XskhDisciplineRecordBo bo);
|
||||
|
||||
/**
|
||||
* 新增学生违纪处分记录
|
||||
*/
|
||||
Boolean insertByBo(XskhDisciplineRecordBo bo);
|
||||
|
||||
/**
|
||||
* 修改学生违纪处分记录
|
||||
*/
|
||||
Boolean updateByBo(XskhDisciplineRecordBo bo);
|
||||
|
||||
/**
|
||||
* 校验并批量删除学生违纪处分记录信息
|
||||
*/
|
||||
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||
|
||||
/**
|
||||
* 查询学生选项列表(用于下拉框)
|
||||
*/
|
||||
List<XskhStudentOptionVo> getStudentOptions(String keyword);
|
||||
}
|
||||
+146
@@ -0,0 +1,146 @@
|
||||
package org.dromara.xskh.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
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.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.xskh.domain.XskhDisciplineRecord;
|
||||
import org.dromara.xskh.domain.bo.XskhDisciplineRecordBo;
|
||||
import org.dromara.xskh.domain.vo.XskhDisciplineRecordVo;
|
||||
import org.dromara.xskh.domain.vo.XskhStudentOptionVo;
|
||||
import org.dromara.xskh.mapper.XskhDisciplineRecordMapper;
|
||||
import org.dromara.xskh.service.IXskhDisciplineRecordService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 学生违纪处分记录Service业务层处理
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2025-01-03
|
||||
*/
|
||||
@RequiredArgsConstructor
|
||||
@Service
|
||||
public class XskhDisciplineRecordServiceImpl implements IXskhDisciplineRecordService {
|
||||
|
||||
private final XskhDisciplineRecordMapper baseMapper;
|
||||
|
||||
/**
|
||||
* 查询学生违纪处分记录
|
||||
*/
|
||||
@Override
|
||||
public XskhDisciplineRecordVo queryById(Long id) {
|
||||
return baseMapper.selectVoById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询学生违纪处分记录列表
|
||||
*/
|
||||
@Override
|
||||
public TableDataInfo<XskhDisciplineRecordVo> queryPageList(XskhDisciplineRecordBo bo, PageQuery pageQuery) {
|
||||
LambdaQueryWrapper<XskhDisciplineRecord> lqw = buildQueryWrapper(bo);
|
||||
Page<XskhDisciplineRecordVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
||||
return TableDataInfo.build(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询学生违纪处分记录列表
|
||||
*/
|
||||
@Override
|
||||
public List<XskhDisciplineRecordVo> queryList(XskhDisciplineRecordBo bo) {
|
||||
LambdaQueryWrapper<XskhDisciplineRecord> lqw = buildQueryWrapper(bo);
|
||||
return baseMapper.selectVoList(lqw);
|
||||
}
|
||||
|
||||
private LambdaQueryWrapper<XskhDisciplineRecord> buildQueryWrapper(XskhDisciplineRecordBo bo) {
|
||||
Map<String, Object> params = bo.getParams();
|
||||
LambdaQueryWrapper<XskhDisciplineRecord> lqw = Wrappers.lambdaQuery();
|
||||
lqw.eq(bo.getStudentId() != null, XskhDisciplineRecord::getStudentId, bo.getStudentId());
|
||||
lqw.like(StringUtils.isNotBlank(bo.getStudentNo()), XskhDisciplineRecord::getStudentNo, bo.getStudentNo());
|
||||
lqw.like(StringUtils.isNotBlank(bo.getStudentName()), XskhDisciplineRecord::getStudentName,
|
||||
bo.getStudentName());
|
||||
lqw.eq(bo.getCollegeId() != null, XskhDisciplineRecord::getCollegeId, bo.getCollegeId());
|
||||
lqw.like(StringUtils.isNotBlank(bo.getCollegeName()), XskhDisciplineRecord::getCollegeName,
|
||||
bo.getCollegeName());
|
||||
lqw.eq(bo.getMajorId() != null, XskhDisciplineRecord::getMajorId, bo.getMajorId());
|
||||
lqw.like(StringUtils.isNotBlank(bo.getMajorName()), XskhDisciplineRecord::getMajorName, bo.getMajorName());
|
||||
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,
|
||||
bo.getDisciplineTypeName());
|
||||
lqw.eq(bo.getDisciplineDate() != null, XskhDisciplineRecord::getDisciplineDate, bo.getDisciplineDate());
|
||||
lqw.like(StringUtils.isNotBlank(bo.getDisciplineReason()), XskhDisciplineRecord::getDisciplineReason,
|
||||
bo.getDisciplineReason());
|
||||
lqw.like(StringUtils.isNotBlank(bo.getDisciplineContent()), XskhDisciplineRecord::getDisciplineContent,
|
||||
bo.getDisciplineContent());
|
||||
lqw.eq(bo.getScoreDeduction() != null, XskhDisciplineRecord::getScoreDeduction, bo.getScoreDeduction());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getStatus()), XskhDisciplineRecord::getStatus, bo.getStatus());
|
||||
lqw.orderByDesc(XskhDisciplineRecord::getCreateTime);
|
||||
return lqw;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增学生违纪处分记录
|
||||
*/
|
||||
@Override
|
||||
public Boolean insertByBo(XskhDisciplineRecordBo bo) {
|
||||
XskhDisciplineRecord add = MapstructUtils.convert(bo, XskhDisciplineRecord.class);
|
||||
validEntityBeforeSave(add);
|
||||
|
||||
// 设置默认值
|
||||
if (StringUtils.isBlank(add.getStatus())) {
|
||||
add.setStatus("1"); // 默认生效
|
||||
}
|
||||
|
||||
boolean flag = baseMapper.insert(add) > 0;
|
||||
if (flag) {
|
||||
bo.setId(add.getId());
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改学生违纪处分记录
|
||||
*/
|
||||
@Override
|
||||
public Boolean updateByBo(XskhDisciplineRecordBo bo) {
|
||||
XskhDisciplineRecord update = MapstructUtils.convert(bo, XskhDisciplineRecord.class);
|
||||
validEntityBeforeSave(update);
|
||||
return baseMapper.updateById(update) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存前的数据校验
|
||||
*/
|
||||
private void validEntityBeforeSave(XskhDisciplineRecord entity) {
|
||||
// TODO 做一些数据校验,如唯一约束
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除学生违纪处分记录
|
||||
*/
|
||||
@Override
|
||||
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
||||
if (isValid) {
|
||||
// TODO 做一些业务上的校验,判断是否需要校验
|
||||
}
|
||||
return baseMapper.deleteBatchIds(ids) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询学生选项列表(用于下拉框)
|
||||
*/
|
||||
@Override
|
||||
public List<XskhStudentOptionVo> getStudentOptions(String keyword) {
|
||||
return baseMapper.selectStudentOptions(keyword);
|
||||
}
|
||||
}
|
||||
+70
@@ -0,0 +1,70 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="org.dromara.xskh.mapper.XskhDisciplineRecordMapper">
|
||||
|
||||
<resultMap type="XskhDisciplineRecord" id="XskhDisciplineRecordResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="studentId" column="student_id" />
|
||||
<result property="studentNo" column="student_no" />
|
||||
<result property="studentName" column="student_name" />
|
||||
<result property="collegeId" column="college_id" />
|
||||
<result property="collegeName" column="college_name" />
|
||||
<result property="majorId" column="major_id" />
|
||||
<result property="majorName" column="major_name" />
|
||||
<result property="classId" column="class_id" />
|
||||
<result property="className" column="class_name" />
|
||||
<result property="disciplineTypeId" column="discipline_type_id" />
|
||||
<result property="disciplineTypeName" column="discipline_type_name" />
|
||||
<result property="disciplineDate" column="discipline_date" />
|
||||
<result property="disciplineReason" column="discipline_reason" />
|
||||
<result property="disciplineContent" column="discipline_content" />
|
||||
<result property="scoreDeduction" column="score_deduction" />
|
||||
<result property="status" column="status" />
|
||||
<result property="approvalStatus" column="approval_status" />
|
||||
<result property="approvalBy" column="approval_by" />
|
||||
<result property="approvalTime" column="approval_time" />
|
||||
<result property="approvalRemark" column="approval_remark" />
|
||||
<result property="attachmentOssIds" column="attachment_oss_ids" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="createDept" column="create_dept" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
<result property="deleted" column="deleted" />
|
||||
<result property="tenantId" column="tenant_id" />
|
||||
</resultMap>
|
||||
|
||||
<resultMap type="XskhStudentOptionVo" id="StudentOptionResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="studentNo" column="student_no" />
|
||||
<result property="name" column="name" />
|
||||
<result property="collegeId" column="college_id" />
|
||||
<result property="collegeName" column="college_name" />
|
||||
<result property="majorId" column="major_id" />
|
||||
<result property="majorName" column="major_name" />
|
||||
<result property="classId" column="class_id" />
|
||||
<result property="className" column="class_name" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectXskhDisciplineRecordVo">
|
||||
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, approval_status, approval_by, approval_time, approval_remark, attachment_oss_ids, create_by, create_time, create_dept, update_by, update_time, deleted, tenant_id from xskh_discipline_record
|
||||
</sql>
|
||||
|
||||
<select id="selectStudentOptions" parameterType="String" 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 student_status = 1
|
||||
<if test="keyword != null and keyword != ''">
|
||||
and (student_no like concat('%', #{keyword}, '%')
|
||||
or name like concat('%', #{keyword}, '%'))
|
||||
</if>
|
||||
order by student_no
|
||||
limit 50
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@@ -42,15 +42,12 @@ CREATE TABLE `xskh_discipline_record` (
|
||||
`class_name` varchar(100) NOT NULL COMMENT '班级名称',
|
||||
`discipline_type_id` bigint(20) NOT NULL COMMENT '违纪处分类型ID',
|
||||
`discipline_type_name` varchar(100) NOT NULL COMMENT '违纪处分类型名称',
|
||||
`discipline_date` date NOT NULL COMMENT '违纪处分日期',
|
||||
`discipline_date` DATETIME NOT NULL COMMENT '违纪处分日期',
|
||||
`discipline_reason` varchar(500) NOT NULL COMMENT '违纪处分原因',
|
||||
`discipline_content` varchar(500) DEFAULT NULL COMMENT '违纪处分内容',
|
||||
`score_deduction` decimal(5,2) DEFAULT 0.00 COMMENT '扣分分值',
|
||||
`status` char(1) DEFAULT '1' COMMENT '状态(1-生效 2-已撤销)',
|
||||
`approval_status` char(1) DEFAULT '1' COMMENT '审批状态(1-已审批 2-审批中)',
|
||||
`approval_by` bigint(20) DEFAULT NULL COMMENT '审批人ID',
|
||||
`approval_time` datetime DEFAULT NULL COMMENT '审批时间',
|
||||
`approval_remark` varchar(500) DEFAULT NULL COMMENT '审批备注',
|
||||
`attachment_oss_ids` varchar(1000) DEFAULT NULL COMMENT '附件OSS文件ID,多个用逗号分隔(申请材料、证明文件等)',
|
||||
`create_by` bigint(20) DEFAULT NULL COMMENT '创建者',
|
||||
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
|
||||
`create_dept` bigint(20) DEFAULT NULL COMMENT '创建部门',
|
||||
|
||||
@@ -0,0 +1,75 @@
|
||||
import request from '@/utils/request';
|
||||
import { AxiosPromise } from 'axios';
|
||||
import { DisciplineRecordVO, DisciplineRecordForm, DisciplineRecordQuery, XskhStudentOptionVO } from './disciplineRecord/types';
|
||||
|
||||
/**
|
||||
* 查询学生违纪处分记录列表
|
||||
* @param query
|
||||
* @returns {*}
|
||||
*/
|
||||
|
||||
export const listDisciplineRecord = (query?: DisciplineRecordQuery): AxiosPromise<DisciplineRecordVO[]> => {
|
||||
return request({
|
||||
url: '/disciplineRecord/disciplineRecord/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* 查询学生违纪处分记录详细
|
||||
* @param id
|
||||
*/
|
||||
export const getDisciplineRecord = (id: string | number): AxiosPromise<DisciplineRecordVO> => {
|
||||
return request({
|
||||
url: '/disciplineRecord/disciplineRecord/' + id,
|
||||
method: 'get'
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* 新增学生违纪处分记录
|
||||
* @param data
|
||||
*/
|
||||
export const addDisciplineRecord = (data: DisciplineRecordForm) => {
|
||||
return request({
|
||||
url: '/disciplineRecord/disciplineRecord',
|
||||
method: 'post',
|
||||
data: data
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* 修改学生违纪处分记录
|
||||
* @param data
|
||||
*/
|
||||
export const updateDisciplineRecord = (data: DisciplineRecordForm) => {
|
||||
return request({
|
||||
url: '/disciplineRecord/disciplineRecord',
|
||||
method: 'put',
|
||||
data: data
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* 删除学生违纪处分记录
|
||||
* @param id
|
||||
*/
|
||||
export const delDisciplineRecord = (id: string | number | Array<string | number>) => {
|
||||
return request({
|
||||
url: '/disciplineRecord/disciplineRecord/' + id,
|
||||
method: 'delete'
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* 查询学生选项列表(用于下拉框)
|
||||
* @param keyword
|
||||
*/
|
||||
export const getStudentOptions = (keyword?: string): AxiosPromise<XskhStudentOptionVO[]> => {
|
||||
return request({
|
||||
url: '/disciplineRecord/disciplineRecord/studentOptions',
|
||||
method: 'get',
|
||||
params: { keyword }
|
||||
});
|
||||
};
|
||||
@@ -0,0 +1,403 @@
|
||||
import { PageQuery } from '@/types/base';
|
||||
|
||||
export interface DisciplineRecordVO {
|
||||
/**
|
||||
* 主键ID
|
||||
*/
|
||||
id: string | number;
|
||||
|
||||
/**
|
||||
* 学生ID
|
||||
*/
|
||||
studentId: string | number;
|
||||
|
||||
/**
|
||||
* 学号
|
||||
*/
|
||||
studentNo: string;
|
||||
|
||||
/**
|
||||
* 学生姓名
|
||||
*/
|
||||
studentName: string;
|
||||
|
||||
/**
|
||||
* 学院ID
|
||||
*/
|
||||
collegeId: string | number;
|
||||
|
||||
/**
|
||||
* 学院名称
|
||||
*/
|
||||
collegeName: string;
|
||||
|
||||
/**
|
||||
* 专业ID
|
||||
*/
|
||||
majorId: string | number;
|
||||
|
||||
/**
|
||||
* 专业名称
|
||||
*/
|
||||
majorName: string;
|
||||
|
||||
/**
|
||||
* 班级ID
|
||||
*/
|
||||
classId: string | number;
|
||||
|
||||
/**
|
||||
* 班级名称
|
||||
*/
|
||||
className: string;
|
||||
|
||||
/**
|
||||
* 违纪处分类型ID
|
||||
*/
|
||||
disciplineTypeId: string | number;
|
||||
|
||||
/**
|
||||
* 违纪处分类型名称
|
||||
*/
|
||||
disciplineTypeName: string;
|
||||
|
||||
/**
|
||||
* 违纪处分日期
|
||||
*/
|
||||
disciplineDate: string;
|
||||
|
||||
/**
|
||||
* 违纪处分原因
|
||||
*/
|
||||
disciplineReason: string;
|
||||
|
||||
/**
|
||||
* 违纪处分内容
|
||||
*/
|
||||
disciplineContent: string;
|
||||
|
||||
/**
|
||||
* 扣分分值
|
||||
*/
|
||||
scoreDeduction: number;
|
||||
|
||||
/**
|
||||
* 状态(1-生效 2-已撤销)
|
||||
*/
|
||||
status: string;
|
||||
|
||||
/**
|
||||
* 审批状态(1-已审批 2-审批中)
|
||||
*/
|
||||
approvalStatus: string;
|
||||
|
||||
/**
|
||||
* 审批人ID
|
||||
*/
|
||||
approvalBy: string | number;
|
||||
|
||||
/**
|
||||
* 审批时间
|
||||
*/
|
||||
approvalTime: string;
|
||||
|
||||
/**
|
||||
* 审批备注
|
||||
*/
|
||||
approvalRemark: string;
|
||||
|
||||
/**
|
||||
* 附件OSS ID列表,逗号分隔
|
||||
*/
|
||||
attachmentOssIds: string;
|
||||
|
||||
/**
|
||||
* 创建者
|
||||
*/
|
||||
createBy: string | number;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
createTime: string;
|
||||
|
||||
/**
|
||||
* 更新者
|
||||
*/
|
||||
updateBy: string | number;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
updateTime: string;
|
||||
}
|
||||
|
||||
export interface DisciplineRecordForm {
|
||||
/**
|
||||
* 主键ID
|
||||
*/
|
||||
id?: string | number;
|
||||
|
||||
/**
|
||||
* 学生ID
|
||||
*/
|
||||
studentId?: string | number;
|
||||
|
||||
/**
|
||||
* 学号
|
||||
*/
|
||||
studentNo?: string;
|
||||
|
||||
/**
|
||||
* 学生姓名
|
||||
*/
|
||||
studentName?: string;
|
||||
|
||||
/**
|
||||
* 学院ID
|
||||
*/
|
||||
collegeId?: string | number;
|
||||
|
||||
/**
|
||||
* 学院名称
|
||||
*/
|
||||
collegeName?: string;
|
||||
|
||||
/**
|
||||
* 专业ID
|
||||
*/
|
||||
majorId?: string | number;
|
||||
|
||||
/**
|
||||
* 专业名称
|
||||
*/
|
||||
majorName?: string;
|
||||
|
||||
/**
|
||||
* 班级ID
|
||||
*/
|
||||
classId?: string | number;
|
||||
|
||||
/**
|
||||
* 班级名称
|
||||
*/
|
||||
className?: string;
|
||||
|
||||
/**
|
||||
* 违纪处分类型ID
|
||||
*/
|
||||
disciplineTypeId?: string | number;
|
||||
|
||||
/**
|
||||
* 违纪处分类型名称
|
||||
*/
|
||||
disciplineTypeName?: string;
|
||||
|
||||
/**
|
||||
* 违纪处分日期
|
||||
*/
|
||||
disciplineDate?: string;
|
||||
|
||||
/**
|
||||
* 违纪处分原因
|
||||
*/
|
||||
disciplineReason?: string;
|
||||
|
||||
/**
|
||||
* 违纪处分内容
|
||||
*/
|
||||
disciplineContent?: string;
|
||||
|
||||
/**
|
||||
* 扣分分值
|
||||
*/
|
||||
scoreDeduction?: number;
|
||||
|
||||
/**
|
||||
* 状态(1-生效 2-已撤销)
|
||||
*/
|
||||
status?: string;
|
||||
|
||||
/**
|
||||
* 审批状态(1-已审批 2-审批中)
|
||||
*/
|
||||
approvalStatus?: string;
|
||||
|
||||
/**
|
||||
* 审批人ID
|
||||
*/
|
||||
approvalBy?: string | number;
|
||||
|
||||
/**
|
||||
* 审批时间
|
||||
*/
|
||||
approvalTime?: string;
|
||||
|
||||
/**
|
||||
* 审批备注
|
||||
*/
|
||||
approvalRemark?: string;
|
||||
|
||||
/**
|
||||
* 附件OSS ID列表,逗号分隔
|
||||
*/
|
||||
attachmentOssIds?: string;
|
||||
}
|
||||
|
||||
export interface DisciplineRecordQuery extends PageQuery {
|
||||
|
||||
/**
|
||||
* 学生ID
|
||||
*/
|
||||
studentId?: string | number;
|
||||
|
||||
/**
|
||||
* 学号
|
||||
*/
|
||||
studentNo?: string;
|
||||
|
||||
/**
|
||||
* 学生姓名
|
||||
*/
|
||||
studentName?: string;
|
||||
|
||||
/**
|
||||
* 学院ID
|
||||
*/
|
||||
collegeId?: string | number;
|
||||
|
||||
/**
|
||||
* 学院名称
|
||||
*/
|
||||
collegeName?: string;
|
||||
|
||||
/**
|
||||
* 专业ID
|
||||
*/
|
||||
majorId?: string | number;
|
||||
|
||||
/**
|
||||
* 专业名称
|
||||
*/
|
||||
majorName?: string;
|
||||
|
||||
/**
|
||||
* 班级ID
|
||||
*/
|
||||
classId?: string | number;
|
||||
|
||||
/**
|
||||
* 班级名称
|
||||
*/
|
||||
className?: string;
|
||||
|
||||
/**
|
||||
* 违纪处分类型ID
|
||||
*/
|
||||
disciplineTypeId?: string | number;
|
||||
|
||||
/**
|
||||
* 违纪处分类型名称
|
||||
*/
|
||||
disciplineTypeName?: string;
|
||||
|
||||
/**
|
||||
* 违纪处分日期
|
||||
*/
|
||||
disciplineDate?: string;
|
||||
|
||||
/**
|
||||
* 违纪处分原因
|
||||
*/
|
||||
disciplineReason?: string;
|
||||
|
||||
/**
|
||||
* 违纪处分内容
|
||||
*/
|
||||
disciplineContent?: string;
|
||||
|
||||
/**
|
||||
* 扣分分值
|
||||
*/
|
||||
scoreDeduction?: number;
|
||||
|
||||
/**
|
||||
* 状态(1-生效 2-已撤销)
|
||||
*/
|
||||
status?: string;
|
||||
|
||||
/**
|
||||
* 审批状态(1-已审批 2-审批中)
|
||||
*/
|
||||
approvalStatus?: string;
|
||||
|
||||
/**
|
||||
* 审批人ID
|
||||
*/
|
||||
approvalBy?: string | number;
|
||||
|
||||
/**
|
||||
* 审批时间
|
||||
*/
|
||||
approvalTime?: string;
|
||||
|
||||
/**
|
||||
* 审批备注
|
||||
*/
|
||||
approvalRemark?: string;
|
||||
|
||||
/**
|
||||
* 日期范围参数
|
||||
*/
|
||||
params?: any;
|
||||
}
|
||||
|
||||
/**
|
||||
* 学生考核-学生选项
|
||||
*/
|
||||
export interface XskhStudentOptionVO {
|
||||
/**
|
||||
* 学生ID
|
||||
*/
|
||||
id: string | number;
|
||||
|
||||
/**
|
||||
* 学号
|
||||
*/
|
||||
studentNo: string;
|
||||
|
||||
/**
|
||||
* 学生姓名
|
||||
*/
|
||||
name: string;
|
||||
|
||||
/**
|
||||
* 学院ID
|
||||
*/
|
||||
collegeId: string | number;
|
||||
|
||||
/**
|
||||
* 学院名称
|
||||
*/
|
||||
collegeName: string;
|
||||
|
||||
/**
|
||||
* 专业ID
|
||||
*/
|
||||
majorId: string | number;
|
||||
|
||||
/**
|
||||
* 专业名称
|
||||
*/
|
||||
majorName: string;
|
||||
|
||||
/**
|
||||
* 班级ID
|
||||
*/
|
||||
classId: string | number;
|
||||
|
||||
/**
|
||||
* 班级名称
|
||||
*/
|
||||
className: string;
|
||||
}
|
||||
@@ -0,0 +1,988 @@
|
||||
<template>
|
||||
<el-dialog :title="dialog.title" v-model="dialog.visible" width="1000px" append-to-body destroy-on-close>
|
||||
<el-form ref="disciplineRecordFormRef" :model="form" :rules="rules" label-width="120px" :disabled="dialog.title === '查看'">
|
||||
<el-row :gutter="20">
|
||||
<!-- 左列:学生选择和违纪处分信息 -->
|
||||
<el-col :span="12">
|
||||
<el-form-item label="学生选择" prop="studentId" v-if="dialog.title !== '查看'">
|
||||
<el-select
|
||||
v-model="form.studentId"
|
||||
placeholder="请输入学号或姓名搜索学生"
|
||||
filterable
|
||||
remote
|
||||
:remote-method="remoteSearchStudents"
|
||||
:loading="studentLoading"
|
||||
clearable
|
||||
@change="handleStudentChange"
|
||||
style="width: 100%"
|
||||
>
|
||||
<el-option v-for="student in studentOptions" :key="student.id" :label="`${student.name} (${student.studentNo})`" :value="student.id">
|
||||
<div class="student-option">
|
||||
<div class="student-main">
|
||||
<span class="student-name">{{ student.name }}</span>
|
||||
<span class="student-no">{{ student.studentNo }}</span>
|
||||
</div>
|
||||
<div class="student-info" v-if="student.collegeName || student.majorName || student.className">
|
||||
<span v-if="student.collegeName" class="info-item">{{ student.collegeName }}</span>
|
||||
<span v-if="student.majorName" class="info-item">{{ student.majorName }}</span>
|
||||
<span v-if="student.className" class="info-item">{{ student.className }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<!-- 查看模式下直接显示学生姓名 -->
|
||||
<el-form-item label="学生姓名" v-else>
|
||||
<div class="student-display">
|
||||
<span class="student-name-text">{{ form.studentName }}</span>
|
||||
<span class="student-no-text" v-if="form.studentNo">({{ form.studentNo }})</span>
|
||||
</div>
|
||||
</el-form-item>
|
||||
<el-form-item label="违纪处分类型" prop="disciplineTypeId">
|
||||
<el-select
|
||||
v-model="form.disciplineTypeId"
|
||||
placeholder="请选择违纪处分类型"
|
||||
filterable
|
||||
clearable
|
||||
@change="handleDisciplineTypeChange"
|
||||
style="width: 100%"
|
||||
>
|
||||
<el-option v-for="type in disciplineTypeOptions" :key="type.id" :label="type.typeName" :value="type.id" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="违纪处分日期" prop="disciplineDate">
|
||||
<el-date-picker
|
||||
v-model="form.disciplineDate"
|
||||
type="date"
|
||||
placeholder="请选择违纪处分日期"
|
||||
style="width: 100%"
|
||||
value-format="YYYY-MM-DD"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="扣分分值" prop="scoreDeduction">
|
||||
<el-input-number
|
||||
v-model="form.scoreDeduction"
|
||||
:min="0"
|
||||
:max="999"
|
||||
:precision="2"
|
||||
:step="1"
|
||||
placeholder="请输入扣分分值"
|
||||
style="width: 100%"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="状态" prop="status">
|
||||
<el-radio-group v-model="form.status">
|
||||
<el-radio v-for="dict in student_discipline_status" :key="dict.value" :value="dict.value">{{ dict.label }}</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<!-- 右列:学生基本信息 -->
|
||||
<el-col :span="12">
|
||||
<el-form-item label="学号" prop="studentNo">
|
||||
<el-input v-model="form.studentNo" placeholder="选择学生后自动填充" disabled />
|
||||
</el-form-item>
|
||||
<el-form-item label="学生姓名" prop="studentName">
|
||||
<el-input v-model="form.studentName" placeholder="选择学生后自动填充" disabled />
|
||||
</el-form-item>
|
||||
<el-form-item label="学院名称" prop="collegeName">
|
||||
<el-input v-model="form.collegeName" placeholder="选择学生后自动填充" disabled />
|
||||
</el-form-item>
|
||||
<el-form-item label="专业名称" prop="majorName">
|
||||
<el-input v-model="form.majorName" placeholder="选择学生后自动填充" disabled />
|
||||
</el-form-item>
|
||||
<el-form-item label="班级名称" prop="className">
|
||||
<el-input v-model="form.className" placeholder="选择学生后自动填充" disabled />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<!-- 完整宽度的字段 -->
|
||||
<el-row>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="违纪处分原因" prop="disciplineReason">
|
||||
<el-input v-model="form.disciplineReason" type="textarea" placeholder="请输入违纪处分原因" :rows="3" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-row>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="违纪处分内容" prop="disciplineContent">
|
||||
<el-input v-model="form.disciplineContent" type="textarea" placeholder="请输入违纪处分内容" :rows="3" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<!-- 附件上传区域 -->
|
||||
<el-row>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="上传附件" v-if="dialog.title !== '查看'">
|
||||
<div class="attachment-upload-container">
|
||||
<el-upload
|
||||
:file-list="attachmentList"
|
||||
class="upload-demo"
|
||||
drag
|
||||
list-type="picture-card"
|
||||
:on-preview="handleFilePreview"
|
||||
:action="uploadAction"
|
||||
:headers="uploadHeaders"
|
||||
:data="uploadData"
|
||||
:auto-upload="true"
|
||||
:before-upload="handleBeforeUpload"
|
||||
:on-success="handleUploadSuccess"
|
||||
:on-error="handleUploadError"
|
||||
:on-remove="handleRemoveAttachmentConfirm"
|
||||
:on-change="handleFileChange"
|
||||
multiple
|
||||
:limit="15"
|
||||
:show-file-list="true"
|
||||
accept="image/*,video/*,.pdf,.doc,.docx,.txt"
|
||||
>
|
||||
<template #tip>
|
||||
<div class="el-upload__tip">
|
||||
支持图片、视频、PDF、Word文档等格式,单个文件大小不超过10MB,最多上传15个文件。
|
||||
<span class="el-upload__tip" v-if="!form.id" style="color: #ff0000">(新增时文件会立即上传,保存违纪记录后自动关联)</span>
|
||||
<span class="el-upload__tip" v-else style="color: #ff0000">(编辑时文件会立即上传并关联到当前违纪记录)</span>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<!-- 调整拖拽上传图标与文字在同一行、居中对齐 -->
|
||||
<div class="el-upload-dragger1">
|
||||
<el-icon class="el-icon--upload"><upload-filled /></el-icon>
|
||||
<div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
|
||||
</div>
|
||||
|
||||
<!-- 自定义文件卡片缩略图(含文件名) -->
|
||||
<template #file="{ file }">
|
||||
<div class="upload-file-card">
|
||||
<!-- 缩略图区域 -->
|
||||
<div class="upload-file-thumb">
|
||||
<image-preview v-if="isImageFile(file) && file.url" :src="getFileOssId(file)" class="upload-thumb-image" :isOssId="true" />
|
||||
<div v-else class="upload-file-placeholder">
|
||||
<el-icon><Document /></el-icon>
|
||||
<span class="file-ext">{{ getFileExt(file.name) }}</span>
|
||||
</div>
|
||||
<!-- loading 遮罩只在上传中显示 -->
|
||||
<div v-if="file.status === 'uploading'" class="upload-file-loading">
|
||||
<el-icon class="is-loading"><Loading /></el-icon>
|
||||
<span class="loading-text">上传中...</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 文件名称 -->
|
||||
<div class="upload-file-name" :title="file.name">
|
||||
{{ getShortFileName(file.name) }}
|
||||
</div>
|
||||
|
||||
<!-- 操作按钮区域 - 固定在文件名下方 -->
|
||||
<div class="upload-file-card-actions" v-if="file.status && file.status !== 'ready'">
|
||||
<el-button-group size="small">
|
||||
<el-button type="success" @click.stop="handleDownloadAttachment(file)" title="下载" :disabled="file.status !== 'success'">
|
||||
<el-icon><Download /></el-icon>
|
||||
</el-button>
|
||||
<el-button type="danger" @click.stop="handleRemoveAttachmentConfirm(file)" title="删除">
|
||||
<el-icon><Delete /></el-icon>
|
||||
</el-button>
|
||||
</el-button-group>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</el-upload>
|
||||
</div>
|
||||
</el-form-item>
|
||||
<!-- 查看模式下的附件展示 -->
|
||||
<el-form-item label="附件" v-else-if="dialog.title === '查看' && attachmentList.length > 0">
|
||||
<div class="attachment-upload-container">
|
||||
<div class="upload-demo">
|
||||
<div class="attachment-view-grid">
|
||||
<div v-for="file in attachmentList" :key="file.uid" class="upload-file-card">
|
||||
<!-- 缩略图区域 -->
|
||||
<div class="upload-file-thumb">
|
||||
<image-preview v-if="isImageFile(file) && file.url" :src="getFileOssId(file)" class="upload-thumb-image" :isOssId="true" />
|
||||
<div v-else class="upload-file-placeholder">
|
||||
<el-icon><Document /></el-icon>
|
||||
<span class="file-ext">{{ getFileExt(file.name) }}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 文件名称 -->
|
||||
<div class="upload-file-name" :title="file.name">
|
||||
{{ getShortFileName(file.name) }}
|
||||
</div>
|
||||
|
||||
<!-- 操作按钮区域 - 查看模式只显示下载按钮 -->
|
||||
<div class="upload-file-card-actions">
|
||||
<el-button type="success" size="small" @click.stop="handleDownloadAttachment(file)" title="下载">
|
||||
<el-icon><Download /></el-icon>
|
||||
</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
|
||||
<template #footer v-if="dialog.title !== '查看'">
|
||||
<div class="dialog-footer">
|
||||
<el-button :loading="buttonLoading" type="primary" @click="submitForm">确 定</el-button>
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script setup name="DisciplineRecordForm" lang="ts">
|
||||
import { ref, reactive, computed, toRefs, getCurrentInstance } from 'vue';
|
||||
import { UploadFilled, Document, Loading, Download, Delete } from '@element-plus/icons-vue';
|
||||
import { ElMessage, ElMessageBox, ElLoading, FormInstance } from 'element-plus';
|
||||
import { getToken } from '@/utils/auth';
|
||||
import { globalHeaders } from '@/utils/request';
|
||||
import ImagePreview from '@/components/ImagePreview/index.vue';
|
||||
import request from '@/utils/request';
|
||||
import { getDisciplineRecord, addDisciplineRecord, updateDisciplineRecord, getStudentOptions } from '@/api/xskh/disciplineRecord/disciplineRecord';
|
||||
import { listDisciplineType } from '@/api/xskh/disciplineType/disciplineType';
|
||||
import { DisciplineRecordForm as DisciplineRecordFormType, XskhStudentOptionVO } from '@/api/xskh/disciplineRecord/disciplineRecord/types';
|
||||
import { DisciplineTypeVO } from '@/api/xskh/disciplineType/disciplineType/types';
|
||||
|
||||
interface Props {}
|
||||
|
||||
const emit = defineEmits(['success']);
|
||||
|
||||
// 使用getCurrentInstance获取上下文
|
||||
const { proxy } = getCurrentInstance() as any;
|
||||
const { student_discipline_status } = toRefs<any>(proxy?.useDict('student_discipline_status'));
|
||||
|
||||
const disciplineRecordFormRef = ref<FormInstance>();
|
||||
const buttonLoading = ref(false);
|
||||
|
||||
// 学生选择器相关状态
|
||||
const studentOptions = ref<XskhStudentOptionVO[]>([]);
|
||||
const studentLoading = ref(false);
|
||||
|
||||
// 违纪处分类型选项
|
||||
const disciplineTypeOptions = ref<DisciplineTypeVO[]>([]);
|
||||
|
||||
// 附件上传相关状态
|
||||
const attachmentList = ref<any[]>([]);
|
||||
|
||||
const dialog = reactive({
|
||||
visible: false,
|
||||
title: ''
|
||||
});
|
||||
|
||||
const initFormData: DisciplineRecordFormType = {
|
||||
id: undefined,
|
||||
studentId: undefined,
|
||||
studentNo: undefined,
|
||||
studentName: undefined,
|
||||
collegeId: undefined,
|
||||
collegeName: undefined,
|
||||
majorId: undefined,
|
||||
majorName: undefined,
|
||||
classId: undefined,
|
||||
className: undefined,
|
||||
disciplineTypeId: undefined,
|
||||
disciplineTypeName: undefined,
|
||||
disciplineDate: new Date().toISOString().split('T')[0], // 默认当前日期
|
||||
disciplineReason: undefined,
|
||||
disciplineContent: undefined,
|
||||
scoreDeduction: undefined,
|
||||
status: '1', // 默认生效
|
||||
approvalStatus: undefined,
|
||||
approvalBy: undefined,
|
||||
approvalTime: undefined,
|
||||
approvalRemark: undefined,
|
||||
attachmentOssIds: undefined
|
||||
};
|
||||
|
||||
const form = ref<DisciplineRecordFormType>({ ...initFormData });
|
||||
|
||||
const rules = reactive({
|
||||
studentId: [{ required: true, message: '学生不能为空', trigger: 'change' }],
|
||||
disciplineTypeId: [{ required: true, message: '违纪处分类型不能为空', trigger: 'change' }],
|
||||
disciplineDate: [{ required: true, message: '违纪处分日期不能为空', trigger: 'blur' }],
|
||||
disciplineReason: [{ required: true, message: '违纪处分原因不能为空', trigger: 'blur' }],
|
||||
scoreDeduction: [
|
||||
{ required: true, message: '扣分分值不能为空', trigger: 'blur' },
|
||||
{
|
||||
validator: (rule: any, value: any, callback: any) => {
|
||||
if (value === undefined || value === null || value === '') {
|
||||
callback(new Error('扣分分值不能为空'));
|
||||
} else {
|
||||
const num = Number(value);
|
||||
if (isNaN(num)) {
|
||||
callback(new Error('扣分分值必须是数字'));
|
||||
} else if (num < 0 || num > 999) {
|
||||
callback(new Error('扣分分值必须在0-999之间'));
|
||||
} else {
|
||||
callback();
|
||||
}
|
||||
}
|
||||
},
|
||||
trigger: 'blur'
|
||||
}
|
||||
],
|
||||
status: [{ required: true, message: '状态不能为空', trigger: 'change' }]
|
||||
});
|
||||
|
||||
// 上传相关配置
|
||||
const uploadAction = computed(() => {
|
||||
return import.meta.env.VITE_APP_BASE_API + '/resource/oss/upload';
|
||||
});
|
||||
|
||||
const uploadHeaders = computed(() => {
|
||||
return {
|
||||
'Authorization': `Bearer ${getToken() || ''}`,
|
||||
'clientid': import.meta.env.VITE_APP_CLIENT_ID || 'e5cd7e4891bf95d1d19206ce24a7b32e'
|
||||
};
|
||||
});
|
||||
|
||||
const uploadData = computed(() => {
|
||||
return {
|
||||
bizType: 'discipline_record_attachment'
|
||||
};
|
||||
});
|
||||
|
||||
/** 打开弹窗 */
|
||||
const openDialog = async (id?: string | number, title?: string) => {
|
||||
dialog.visible = true;
|
||||
dialog.title = title || '新增';
|
||||
resetForm();
|
||||
|
||||
// 加载违纪处分类型选项
|
||||
await loadDisciplineTypes();
|
||||
|
||||
if (id) {
|
||||
// 编辑/查看模式
|
||||
const res = await getDisciplineRecord(id);
|
||||
Object.assign(form.value, res.data);
|
||||
|
||||
// 确保scoreDeduction为数字类型
|
||||
if (form.value.scoreDeduction !== undefined && form.value.scoreDeduction !== null) {
|
||||
form.value.scoreDeduction = Number(form.value.scoreDeduction);
|
||||
}
|
||||
|
||||
// 处理附件数据
|
||||
await handleAttachmentData();
|
||||
}
|
||||
};
|
||||
|
||||
/** 重置表单 */
|
||||
const resetForm = () => {
|
||||
form.value = { ...initFormData };
|
||||
attachmentList.value = [];
|
||||
disciplineRecordFormRef.value?.resetFields();
|
||||
};
|
||||
|
||||
/** 取消按钮 */
|
||||
const cancel = () => {
|
||||
dialog.visible = false;
|
||||
resetForm();
|
||||
};
|
||||
|
||||
/** 提交按钮 */
|
||||
const submitForm = () => {
|
||||
disciplineRecordFormRef.value?.validate(async (valid: boolean) => {
|
||||
if (valid) {
|
||||
buttonLoading.value = true;
|
||||
|
||||
// 处理附件数据
|
||||
const attachmentOssIds = attachmentList.value.filter((file: any) => file.status === 'success' && file.ossId).map((file: any) => file.ossId);
|
||||
form.value.attachmentOssIds = attachmentOssIds.join(',');
|
||||
|
||||
if (form.value.id) {
|
||||
await updateDisciplineRecord(form.value).finally(() => (buttonLoading.value = false));
|
||||
} else {
|
||||
await addDisciplineRecord(form.value).finally(() => (buttonLoading.value = false));
|
||||
}
|
||||
proxy?.$modal.msgSuccess('操作成功');
|
||||
dialog.visible = false;
|
||||
emit('success');
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/** 远程搜索学生 */
|
||||
const remoteSearchStudents = async (query: string) => {
|
||||
studentLoading.value = true;
|
||||
try {
|
||||
const res = await getStudentOptions(query.trim());
|
||||
studentOptions.value = res.data || [];
|
||||
} catch (error) {
|
||||
console.error('搜索学生失败:', error);
|
||||
studentOptions.value = [];
|
||||
} finally {
|
||||
studentLoading.value = false;
|
||||
}
|
||||
};
|
||||
|
||||
/** 学生选择处理 */
|
||||
const handleStudentChange = (studentId: string | number) => {
|
||||
if (!studentId) {
|
||||
// 清空学生相关信息
|
||||
form.value.studentNo = undefined;
|
||||
form.value.studentName = undefined;
|
||||
form.value.collegeName = undefined;
|
||||
form.value.majorName = undefined;
|
||||
form.value.className = undefined;
|
||||
form.value.collegeId = undefined;
|
||||
form.value.majorId = undefined;
|
||||
form.value.classId = undefined;
|
||||
return;
|
||||
}
|
||||
|
||||
const selectedStudent = studentOptions.value.find((student) => student.id === studentId);
|
||||
if (selectedStudent) {
|
||||
form.value.studentId = selectedStudent.id;
|
||||
form.value.studentNo = selectedStudent.studentNo;
|
||||
form.value.studentName = selectedStudent.name;
|
||||
form.value.collegeId = selectedStudent.collegeId;
|
||||
form.value.collegeName = selectedStudent.collegeName;
|
||||
form.value.majorId = selectedStudent.majorId;
|
||||
form.value.majorName = selectedStudent.majorName;
|
||||
form.value.classId = selectedStudent.classId;
|
||||
form.value.className = selectedStudent.className;
|
||||
}
|
||||
};
|
||||
|
||||
/** 加载违纪处分类型 */
|
||||
const loadDisciplineTypes = async () => {
|
||||
try {
|
||||
const res = await listDisciplineType({ pageNum: 1, pageSize: 1000 });
|
||||
disciplineTypeOptions.value = res.data?.rows || res.rows || [];
|
||||
} catch (error) {
|
||||
console.error('加载违纪处分类型失败:', error);
|
||||
}
|
||||
};
|
||||
|
||||
/** 违纪处分类型选择处理 */
|
||||
const handleDisciplineTypeChange = (typeId: string | number) => {
|
||||
if (!typeId) {
|
||||
form.value.disciplineTypeName = undefined;
|
||||
return;
|
||||
}
|
||||
|
||||
const selectedType = disciplineTypeOptions.value.find((type) => type.id === typeId);
|
||||
if (selectedType) {
|
||||
form.value.disciplineTypeName = selectedType.typeName;
|
||||
}
|
||||
};
|
||||
|
||||
// 文件处理相关方法(从dormViolation界面复制)
|
||||
const isImageFile = (file: any) => {
|
||||
const imageTypes = ['image/jpeg', 'image/png', 'image/gif', 'image/bmp', 'image/webp'];
|
||||
return imageTypes.includes(file.raw?.type) || (file.url && /\.(jpg|jpeg|png|gif|bmp|webp)$/i.test(file.name));
|
||||
};
|
||||
|
||||
const getFileOssId = (file: any) => {
|
||||
return file.ossId || '';
|
||||
};
|
||||
|
||||
const getFileExt = (fileName: string) => {
|
||||
const ext = fileName.split('.').pop()?.toUpperCase();
|
||||
return ext || 'FILE';
|
||||
};
|
||||
|
||||
const getShortFileName = (fileName: string) => {
|
||||
if (!fileName) return '';
|
||||
|
||||
const lastDotIndex = fileName.lastIndexOf('.');
|
||||
if (lastDotIndex === -1) {
|
||||
return fileName.length > 12 ? fileName.substring(0, 12) + '...' : fileName;
|
||||
}
|
||||
|
||||
const name = fileName.substring(0, lastDotIndex);
|
||||
const ext = fileName.substring(lastDotIndex);
|
||||
|
||||
if (name.length <= 8) {
|
||||
return fileName;
|
||||
}
|
||||
|
||||
return name.substring(0, 8) + '...' + ext;
|
||||
};
|
||||
|
||||
const handleFilePreview = (file: any) => {
|
||||
if (isImageFile(file)) {
|
||||
window.open(file.url);
|
||||
} else {
|
||||
handleDownloadAttachment(file);
|
||||
}
|
||||
};
|
||||
|
||||
const handleBeforeUpload = (file: any) => {
|
||||
const isValidType = /\.(jpg|jpeg|png|gif|bmp|webp|pdf|doc|docx|txt|mp4|avi|mov)$/i.test(file.name);
|
||||
const isLt10M = file.size / 1024 / 1024 < 10;
|
||||
|
||||
if (!isValidType) {
|
||||
ElMessage.error('上传文件格式不正确!');
|
||||
return false;
|
||||
}
|
||||
if (!isLt10M) {
|
||||
ElMessage.error('上传文件大小不能超过 10MB!');
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
||||
const handleUploadSuccess = (response: any, file: any) => {
|
||||
if (response.code === 200) {
|
||||
file.url = response.data.url;
|
||||
file.ossId = response.data.ossId;
|
||||
ElMessage.success('文件上传成功');
|
||||
} else {
|
||||
ElMessage.error(response.msg || '文件上传失败');
|
||||
}
|
||||
};
|
||||
|
||||
const handleUploadError = (error: any, file: any) => {
|
||||
console.error('文件上传失败:', error);
|
||||
ElMessage.error('文件上传失败');
|
||||
};
|
||||
|
||||
const handleFileChange = (file: any, fileList: any) => {
|
||||
attachmentList.value = fileList;
|
||||
};
|
||||
|
||||
const handleRemoveAttachmentConfirm = (file: any) => {
|
||||
ElMessageBox.confirm('确定要删除这个文件吗?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
})
|
||||
.then(() => {
|
||||
handleRemoveAttachment(file);
|
||||
})
|
||||
.catch(() => {});
|
||||
};
|
||||
|
||||
const handleRemoveAttachment = (file: any) => {
|
||||
const index = attachmentList.value.findIndex((item: any) => item.uid === file.uid);
|
||||
if (index > -1) {
|
||||
attachmentList.value.splice(index, 1);
|
||||
ElMessage.success('文件删除成功');
|
||||
}
|
||||
};
|
||||
|
||||
const handleDownloadAttachment = async (file: any) => {
|
||||
// 下载文件逻辑(参考dormViolation界面)
|
||||
let downloadUrl = '';
|
||||
let fileName = file.name || 'attachment';
|
||||
|
||||
if (file.response && file.response.data && file.response.data.filePath) {
|
||||
downloadUrl = file.response.data.filePath;
|
||||
fileName = file.response.data.fileName || fileName;
|
||||
} else if (file.ossId) {
|
||||
downloadUrl = file.ossId;
|
||||
} else if (file.raw) {
|
||||
const link = document.createElement('a');
|
||||
link.href = URL.createObjectURL(file.raw);
|
||||
link.download = fileName;
|
||||
link.style.display = 'none';
|
||||
document.body.appendChild(link);
|
||||
link.click();
|
||||
document.body.removeChild(link);
|
||||
URL.revokeObjectURL(link.href);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!downloadUrl) {
|
||||
ElMessage.error('无法获取文件下载地址');
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
const loading = ElLoading.service({
|
||||
text: '正在下载文件...',
|
||||
target: document.body
|
||||
});
|
||||
|
||||
const response = await request({
|
||||
url: '/resource/oss/download/' + downloadUrl,
|
||||
method: 'get',
|
||||
responseType: 'blob',
|
||||
timeout: 300000
|
||||
});
|
||||
|
||||
if (!response) {
|
||||
throw new Error('响应数据为空');
|
||||
}
|
||||
|
||||
let blobData: Blob;
|
||||
if (response instanceof Blob) {
|
||||
blobData = response;
|
||||
} else if (response.data instanceof Blob) {
|
||||
blobData = response.data;
|
||||
} else {
|
||||
throw new Error('无效的响应数据格式');
|
||||
}
|
||||
|
||||
const url = window.URL.createObjectURL(blobData);
|
||||
const link = document.createElement('a');
|
||||
link.href = url;
|
||||
link.download = fileName;
|
||||
link.style.display = 'none';
|
||||
document.body.appendChild(link);
|
||||
link.click();
|
||||
document.body.removeChild(link);
|
||||
window.URL.revokeObjectURL(url);
|
||||
loading?.close();
|
||||
} catch (error) {
|
||||
console.error('下载文件失败:', error);
|
||||
ElMessage.error('下载文件失败,请稍后重试');
|
||||
}
|
||||
};
|
||||
|
||||
const handleAttachmentData = async () => {
|
||||
try {
|
||||
if (!form.value.attachmentOssIds || !form.value.attachmentOssIds.toString().trim()) {
|
||||
attachmentList.value = [];
|
||||
return;
|
||||
}
|
||||
|
||||
const ossIdsArray = form.value.attachmentOssIds
|
||||
.toString()
|
||||
.split(',')
|
||||
.map((id) => id.trim())
|
||||
.filter((id) => id);
|
||||
|
||||
if (ossIdsArray.length === 0) {
|
||||
attachmentList.value = [];
|
||||
return;
|
||||
}
|
||||
|
||||
const response = await request({
|
||||
url: `/resource/oss/listByIds/${ossIdsArray.join(',')}`,
|
||||
method: 'get'
|
||||
});
|
||||
|
||||
if (response.code === 200 && response.data) {
|
||||
const attachmentFiles = response.data.map((item: any, index: number) => ({
|
||||
uid: `existing_${index}_${Date.now()}`,
|
||||
name: item.originalName || `附件${index + 1}`,
|
||||
url: item.url,
|
||||
ossId: item.ossId,
|
||||
status: 'success',
|
||||
response: {
|
||||
code: 200,
|
||||
data: {
|
||||
url: item.url,
|
||||
ossId: item.ossId
|
||||
}
|
||||
}
|
||||
}));
|
||||
|
||||
attachmentList.value = attachmentFiles;
|
||||
} else {
|
||||
attachmentList.value = [];
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('处理附件数据失败:', error);
|
||||
attachmentList.value = [];
|
||||
}
|
||||
};
|
||||
|
||||
// 暴露方法给父组件使用
|
||||
defineExpose({
|
||||
openDialog
|
||||
});
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.student-option {
|
||||
padding: 2px 0;
|
||||
min-height: 32px;
|
||||
}
|
||||
|
||||
.student-main {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
margin-bottom: 1px;
|
||||
}
|
||||
|
||||
.student-name {
|
||||
font-weight: 500;
|
||||
color: #303133;
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.student-no {
|
||||
font-size: 11px;
|
||||
color: #606266;
|
||||
padding: 0px 3px;
|
||||
border-radius: 2px;
|
||||
}
|
||||
|
||||
.student-info {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 4px;
|
||||
font-size: 11px;
|
||||
color: #909399;
|
||||
margin-top: 1px;
|
||||
}
|
||||
|
||||
.info-item:not(:last-child)::after {
|
||||
content: '·';
|
||||
margin-left: 6px;
|
||||
color: #c0c4cc;
|
||||
}
|
||||
|
||||
/* 附件上传容器样式 */
|
||||
.attachment-upload-container {
|
||||
width: 100%;
|
||||
max-height: calc(100vh - 650px);
|
||||
min-height: 200px;
|
||||
overflow-y: auto;
|
||||
padding-right: 8px;
|
||||
border: 1px solid #e4e7ed;
|
||||
border-radius: 6px;
|
||||
background: #fafafa;
|
||||
}
|
||||
|
||||
/* 附件上传区域内容样式 */
|
||||
.attachment-upload-container .upload-demo {
|
||||
padding: 12px;
|
||||
min-height: 180px;
|
||||
}
|
||||
|
||||
.attachment-upload-container .upload-demo .el-upload {
|
||||
border-radius: 6px;
|
||||
cursor: pointer;
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
transition: all 0.3s;
|
||||
}
|
||||
|
||||
.attachment-upload-container .upload-demo .el-upload:hover {
|
||||
border-color: #409eff;
|
||||
}
|
||||
|
||||
.attachment-upload-container .upload-demo .el-upload__tip {
|
||||
font-size: 12px;
|
||||
color: #000000;
|
||||
margin-top: 7px;
|
||||
}
|
||||
|
||||
/* 调整拖拽上传图标与文字在同一行、居中对齐 */
|
||||
.attachment-upload-container .upload-demo .el-upload-dragger1 {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 15px;
|
||||
padding: 0px !important;
|
||||
}
|
||||
|
||||
.attachment-upload-container .upload-demo .el-upload-dragger1 .el-icon--upload {
|
||||
margin: 0;
|
||||
padding: 0px !important;
|
||||
}
|
||||
|
||||
/* 文件卡片占位封面样式 */
|
||||
.attachment-upload-container .upload-demo .upload-file-placeholder {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
color: #909399;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.attachment-upload-container .upload-demo .upload-file-placeholder .el-icon {
|
||||
font-size: 28px;
|
||||
margin-bottom: 4px;
|
||||
}
|
||||
|
||||
.attachment-upload-container .upload-demo .upload-file-placeholder .file-ext {
|
||||
font-size: 12px;
|
||||
text-transform: uppercase;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
/* 让附件卡片一行展示 5 个 */
|
||||
.attachment-upload-container :deep(.el-upload-list--picture-card) {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(5, 1fr);
|
||||
gap: 9px;
|
||||
margin-top: 12px;
|
||||
padding-bottom: 16px;
|
||||
}
|
||||
|
||||
/* 确保卡片宽度自适应 */
|
||||
.attachment-upload-container :deep(.el-upload-list--picture-card) .el-upload-list__item {
|
||||
margin: 0;
|
||||
height: 180px !important;
|
||||
width: 100% !important;
|
||||
}
|
||||
|
||||
:deep(.el-upload-dragger) {
|
||||
border: 0px !important;
|
||||
padding: 0px !important;
|
||||
}
|
||||
|
||||
:deep(.el-upload-dragger) .el-upload-dragger1 {
|
||||
border: 0px !important;
|
||||
padding: 0px !important;
|
||||
}
|
||||
|
||||
/* 文件卡片样式 */
|
||||
.upload-file-card {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
border-radius: 6px;
|
||||
overflow: hidden;
|
||||
background: #fff;
|
||||
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
|
||||
transition: all 0.3s;
|
||||
}
|
||||
|
||||
.upload-file-card:hover {
|
||||
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
|
||||
}
|
||||
|
||||
.upload-file-thumb {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
height: 110px;
|
||||
background: #f5f5f5;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.upload-thumb-image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: cover;
|
||||
}
|
||||
|
||||
.upload-file-loading {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
/* background: rgba(255, 255, 255, 0.9); */
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
z-index: 10;
|
||||
}
|
||||
|
||||
.loading-text {
|
||||
margin-top: 8px;
|
||||
font-size: 12px;
|
||||
color: #606266;
|
||||
}
|
||||
|
||||
.upload-file-name {
|
||||
padding: 6px 8px;
|
||||
font-size: 11px;
|
||||
color: #303133;
|
||||
text-align: center;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
background: #fafafa;
|
||||
border-top: 1px solid #f0f0f0;
|
||||
line-height: 1.2;
|
||||
height: 32px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
word-break: break-all;
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
.upload-file-card-actions {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
padding: 6px 8px;
|
||||
background: #fafafa;
|
||||
border-top: 1px solid #f0f0f0;
|
||||
transition: all 0.3s;
|
||||
height: 38px;
|
||||
}
|
||||
|
||||
.upload-file-card-actions .el-button-group {
|
||||
background: transparent;
|
||||
border-radius: 4px;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.upload-file-card-actions .el-button {
|
||||
padding: 4px 8px;
|
||||
border: 1px solid #e0e0e0;
|
||||
background: #fff;
|
||||
font-size: 12px;
|
||||
margin: 0 2px;
|
||||
border-radius: 3px;
|
||||
transition: all 0.3s;
|
||||
}
|
||||
|
||||
.upload-file-card-actions .el-button:hover {
|
||||
background: #f5f5f5;
|
||||
border-color: #409eff;
|
||||
}
|
||||
|
||||
.upload-file-card-actions .el-button.is-disabled {
|
||||
opacity: 0.5;
|
||||
cursor: not-allowed;
|
||||
background: #f5f5f5;
|
||||
}
|
||||
|
||||
/* 查看模式下的学生信息显示 */
|
||||
.student-display {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
padding: 8px 12px;
|
||||
background: #f8f9fa;
|
||||
border: 1px solid #e4e7ed;
|
||||
border-radius: 4px;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.student-name-text {
|
||||
font-weight: 500;
|
||||
color: #303133;
|
||||
}
|
||||
|
||||
.student-no-text {
|
||||
color: #606266;
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
/* 查看模式下的附件网格展示 */
|
||||
.attachment-view-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(5, 1fr);
|
||||
gap: 9px;
|
||||
margin-top: 12px;
|
||||
padding-bottom: 16px;
|
||||
}
|
||||
|
||||
.attachment-view-container {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.attachment-item {
|
||||
padding: 5px 10px;
|
||||
background: #f5f7fa;
|
||||
border-radius: 4px;
|
||||
border: 1px solid #e4e7ed;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,321 @@
|
||||
<template>
|
||||
<div class="p-2 page-container">
|
||||
<transition :enter-active-class="proxy?.animate.searchAnimate.enter" :leave-active-class="proxy?.animate.searchAnimate.leave">
|
||||
<div v-show="showSearch" class="mb-[10px]">
|
||||
<el-card shadow="hover">
|
||||
<el-form ref="queryFormRef" :model="queryParams">
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="8">
|
||||
<el-form-item label="学号" prop="studentNo">
|
||||
<el-input v-model="queryParams.studentNo" placeholder="请输入学号" clearable @keyup.enter="handleQuery" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="学生姓名" prop="studentName">
|
||||
<el-input v-model="queryParams.studentName" placeholder="请输入学生姓名" clearable @keyup.enter="handleQuery" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="状态" prop="status">
|
||||
<el-select v-model="queryParams.status" placeholder="请选择状态" clearable>
|
||||
<el-option v-for="dict in student_discipline_status" :key="dict.value" :label="dict.label" :value="dict.value" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="24" class="search-btn-container">
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
|
||||
<el-button icon="Refresh" @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
</el-card>
|
||||
</div>
|
||||
</transition>
|
||||
|
||||
<el-card shadow="never">
|
||||
<template #header>
|
||||
<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-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="success"
|
||||
plain
|
||||
icon="Edit"
|
||||
:disabled="single"
|
||||
@click="handleUpdate()"
|
||||
v-hasPermi="['disciplineRecord:disciplineRecord:edit']"
|
||||
>修改</el-button
|
||||
>
|
||||
</el-col>
|
||||
<!-- <el-col :span="1.5">
|
||||
<el-button
|
||||
type="danger"
|
||||
plain
|
||||
icon="Delete"
|
||||
:disabled="multiple"
|
||||
@click="handleDelete()"
|
||||
v-hasPermi="['disciplineRecord:disciplineRecord:remove']"
|
||||
>删除</el-button
|
||||
>
|
||||
</el-col> -->
|
||||
<!-- <el-col :span="1.5">
|
||||
<el-button type="warning" plain icon="Download" @click="handleExport" v-hasPermi="['disciplineRecord:disciplineRecord:export']"
|
||||
>导出</el-button
|
||||
>
|
||||
</el-col> -->
|
||||
<right-toolbar :showSearch="showSearch" @update:showSearch="showSearch = $event" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
</template>
|
||||
|
||||
<el-table v-loading="loading" border :data="disciplineRecordList" @selection-change="handleSelectionChange" class="full-width-table">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="学号" align="center" prop="studentNo" min-width="120" />
|
||||
<el-table-column label="学生姓名" align="center" prop="studentName" min-width="100" />
|
||||
<el-table-column label="学院名称" align="center" prop="collegeName" min-width="140" show-overflow-tooltip />
|
||||
<el-table-column label="专业名称" align="center" prop="majorName" min-width="140" show-overflow-tooltip />
|
||||
<el-table-column label="班级名称" align="center" prop="className" min-width="120" show-overflow-tooltip />
|
||||
<el-table-column label="违纪处分类型" align="center" prop="disciplineTypeName" min-width="140" show-overflow-tooltip />
|
||||
<el-table-column label="违纪处分日期" align="center" prop="disciplineDate" min-width="130" />
|
||||
<el-table-column label="扣分分值" align="center" prop="scoreDeduction" min-width="100">
|
||||
<template #default="scope">
|
||||
<span>{{ scope.row.scoreDeduction ? parseFloat(scope.row.scoreDeduction).toFixed(2) : '0.00' }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="状态" align="center" prop="status" min-width="80">
|
||||
<template #default="scope">
|
||||
<dict-tag :options="student_discipline_status" :value="scope.row.status" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" fixed="right" width="180">
|
||||
<template #default="scope">
|
||||
<el-tooltip content="查看" placement="top">
|
||||
<el-button
|
||||
link
|
||||
type="primary"
|
||||
icon="View"
|
||||
@click="handleView(scope.row)"
|
||||
v-hasPermi="['disciplineRecord:disciplineRecord:query']"
|
||||
></el-button>
|
||||
</el-tooltip>
|
||||
<el-tooltip content="修改" placement="top">
|
||||
<el-button
|
||||
link
|
||||
type="primary"
|
||||
icon="Edit"
|
||||
@click="handleUpdate(scope.row)"
|
||||
v-hasPermi="['disciplineRecord:disciplineRecord:edit']"
|
||||
></el-button>
|
||||
</el-tooltip>
|
||||
<el-tooltip content="删除" placement="top">
|
||||
<el-button
|
||||
link
|
||||
type="danger"
|
||||
icon="Delete"
|
||||
@click="handleDelete(scope.row)"
|
||||
v-hasPermi="['disciplineRecord:disciplineRecord:remove']"
|
||||
></el-button>
|
||||
</el-tooltip>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize" @pagination="getList" />
|
||||
</el-card>
|
||||
|
||||
<!-- 添加或修改学生违纪处分记录对话框 -->
|
||||
<DisciplineRecordForm ref="disciplineRecordFormRef" @success="handleSuccess" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup name="DisciplineRecord" lang="ts">
|
||||
import { ref, reactive, toRefs, onMounted, getCurrentInstance, ComponentInternalInstance } from 'vue';
|
||||
import { listDisciplineRecord, delDisciplineRecord } from '@/api/xskh/disciplineRecord/disciplineRecord';
|
||||
import {
|
||||
DisciplineRecordVO,
|
||||
DisciplineRecordQuery,
|
||||
DisciplineRecordForm as DisciplineRecordFormType
|
||||
} from '@/api/xskh/disciplineRecord/disciplineRecord/types';
|
||||
import DisciplineRecordForm from './DisciplineRecordForm.vue';
|
||||
|
||||
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
||||
const { student_discipline_status } = toRefs<any>(proxy?.useDict('student_discipline_status'));
|
||||
|
||||
const disciplineRecordList = ref<DisciplineRecordVO[]>([]);
|
||||
const loading = ref(true);
|
||||
const showSearch = ref(true);
|
||||
const ids = ref<Array<string | number>>([]);
|
||||
const single = ref(true);
|
||||
const multiple = ref(true);
|
||||
const total = ref(0);
|
||||
|
||||
const queryFormRef = ref<ElFormInstance>();
|
||||
const disciplineRecordFormRef = ref<ComponentRef<typeof DisciplineRecordForm>>();
|
||||
|
||||
const initFormData: DisciplineRecordForm = {
|
||||
id: undefined,
|
||||
studentId: undefined,
|
||||
studentNo: undefined,
|
||||
studentName: undefined,
|
||||
collegeId: undefined,
|
||||
collegeName: undefined,
|
||||
majorId: undefined,
|
||||
majorName: undefined,
|
||||
classId: undefined,
|
||||
className: undefined,
|
||||
disciplineTypeId: undefined,
|
||||
disciplineTypeName: undefined,
|
||||
disciplineDate: undefined,
|
||||
disciplineReason: undefined,
|
||||
disciplineContent: undefined,
|
||||
scoreDeduction: undefined,
|
||||
status: undefined,
|
||||
approvalStatus: undefined,
|
||||
approvalBy: undefined,
|
||||
approvalTime: undefined,
|
||||
approvalRemark: undefined,
|
||||
attachmentOssIds: undefined
|
||||
};
|
||||
|
||||
const data = reactive<PageData<DisciplineRecordForm, DisciplineRecordQuery>>({
|
||||
form: { ...initFormData },
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
studentId: undefined,
|
||||
studentNo: undefined,
|
||||
studentName: undefined,
|
||||
collegeId: undefined,
|
||||
collegeName: undefined,
|
||||
majorId: undefined,
|
||||
majorName: undefined,
|
||||
classId: undefined,
|
||||
className: undefined,
|
||||
disciplineTypeId: undefined,
|
||||
disciplineTypeName: undefined,
|
||||
disciplineDate: undefined,
|
||||
disciplineReason: undefined,
|
||||
disciplineContent: undefined,
|
||||
scoreDeduction: undefined,
|
||||
status: undefined,
|
||||
approvalStatus: undefined,
|
||||
approvalBy: undefined,
|
||||
approvalTime: undefined,
|
||||
approvalRemark: undefined,
|
||||
params: {}
|
||||
}
|
||||
});
|
||||
|
||||
const { queryParams, form } = toRefs(data);
|
||||
|
||||
/** 查询学生违纪处分记录列表 */
|
||||
const getList = async () => {
|
||||
loading.value = true;
|
||||
const res = await listDisciplineRecord(queryParams.value);
|
||||
disciplineRecordList.value = res.rows;
|
||||
total.value = res.total;
|
||||
loading.value = false;
|
||||
};
|
||||
|
||||
/** 搜索按钮操作 */
|
||||
const handleQuery = () => {
|
||||
queryParams.value.pageNum = 1;
|
||||
getList();
|
||||
};
|
||||
|
||||
/** 重置按钮操作 */
|
||||
const resetQuery = () => {
|
||||
queryFormRef.value?.resetFields();
|
||||
handleQuery();
|
||||
};
|
||||
|
||||
/** 多选框选中数据 */
|
||||
const handleSelectionChange = (selection: DisciplineRecordVO[]) => {
|
||||
ids.value = selection.map((item) => item.id);
|
||||
single.value = selection.length != 1;
|
||||
multiple.value = !selection.length;
|
||||
};
|
||||
|
||||
/** 新增按钮操作 */
|
||||
const handleAdd = () => {
|
||||
disciplineRecordFormRef.value?.openDialog(undefined, '新增');
|
||||
};
|
||||
|
||||
/** 查看按钮操作 */
|
||||
const handleView = (row: DisciplineRecordVO) => {
|
||||
disciplineRecordFormRef.value?.openDialog(row.id, '查看');
|
||||
};
|
||||
|
||||
/** 修改按钮操作 */
|
||||
const handleUpdate = (row?: DisciplineRecordVO) => {
|
||||
const id = row?.id || ids.value[0];
|
||||
disciplineRecordFormRef.value?.openDialog(id, '修改');
|
||||
};
|
||||
|
||||
/** 提交成功回调 */
|
||||
const handleSuccess = () => {
|
||||
getList();
|
||||
};
|
||||
|
||||
/** 删除按钮操作 */
|
||||
const handleDelete = async (row?: DisciplineRecordVO) => {
|
||||
const _ids = row?.id || ids.value;
|
||||
await proxy?.$modal.confirm('是否确认删除学生违纪处分记录编号为"' + _ids + '"的数据项?').finally(() => (loading.value = false));
|
||||
await delDisciplineRecord(_ids);
|
||||
proxy?.$modal.msgSuccess('删除成功');
|
||||
await getList();
|
||||
};
|
||||
|
||||
/** 导出按钮操作 */
|
||||
const handleExport = () => {
|
||||
proxy?.download(
|
||||
'disciplineRecord/disciplineRecord/export',
|
||||
{
|
||||
...queryParams.value
|
||||
},
|
||||
`disciplineRecord_${new Date().getTime()}.xlsx`
|
||||
);
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
getList();
|
||||
});
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
/* 页面容器样式 */
|
||||
.page-container {
|
||||
padding: 8px;
|
||||
}
|
||||
|
||||
/* 搜索按钮容器样式 */
|
||||
.search-btn-container {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
margin-top: 10px;
|
||||
|
||||
.el-form-item {
|
||||
margin-bottom: 0 !important;
|
||||
}
|
||||
}
|
||||
|
||||
/* 表格全宽样式 */
|
||||
.full-width-table {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
/* 确保表格容器充满宽度 */
|
||||
:deep(.el-table) {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
/* 表格内容区域充满宽度 */
|
||||
:deep(.el-table__body-wrapper) {
|
||||
width: 100%;
|
||||
}
|
||||
</style>
|
||||
Reference in new issue
Block a user