子女信息管理
This commit is contained in:
+1
@@ -99,6 +99,7 @@ public class UnionReimburseMineController {
|
||||
cnd.and("info.userName", "like", "%" + userName + "%");
|
||||
}
|
||||
cnd.desc("info.createTime");
|
||||
cnd.and("info.userId", "=", SecurityUtil.getUserId());
|
||||
sql.setCondition(cnd);
|
||||
Pagination<NutMap> pagination = unionReimburseService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
return Result.success(pagination);
|
||||
|
||||
+202
@@ -0,0 +1,202 @@
|
||||
package com.budwk.app.zhgh.user.childManage.controller;
|
||||
|
||||
|
||||
import cn.afterturn.easypoi.excel.ExcelExportUtil;
|
||||
import cn.afterturn.easypoi.excel.entity.ExportParams;
|
||||
import cn.afterturn.easypoi.excel.entity.enmus.ExcelType;
|
||||
import cn.afterturn.easypoi.excel.entity.params.ExcelExportEntity;
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import com.budwk.app.base.annotation.SLog;
|
||||
import com.budwk.app.base.page.Pagination;
|
||||
import com.budwk.app.base.param.PageForm;
|
||||
import com.budwk.app.base.result.Result;
|
||||
import com.budwk.app.sys.models.Sys_dict;
|
||||
import com.budwk.app.sys.services.SysDictService;
|
||||
import com.budwk.app.web.commons.auth.utils.SecurityUtil;
|
||||
import com.budwk.app.zhgh.enrollmentRegistration.vo.EnrollmentRegistrationPageForm;
|
||||
import com.budwk.app.zhgh.user.childManage.models.ChildManage;
|
||||
import com.budwk.app.zhgh.user.childManage.service.ChildManageService;
|
||||
import com.budwk.app.zhgh.user.childManage.vo.ChildManagePageForm;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
import org.nutz.aop.interceptor.ioc.TransAop;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.ioc.aop.Aop;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.net.URLEncoder;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@IocBean
|
||||
@At("/platform/childManage/manage")
|
||||
@Ok("json:full")
|
||||
@Slf4j
|
||||
@Api("子女信息管理")
|
||||
public class ChildManageManageController {
|
||||
|
||||
@Inject
|
||||
private ChildManageService childManageService;
|
||||
@Inject
|
||||
private SysDictService sysDictService;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/zhgh/user/childManage/manage/index.html")
|
||||
@SaCheckPermission
|
||||
public void index() {}
|
||||
|
||||
@At
|
||||
@ApiOperation("分页查询")
|
||||
@SaCheckPermission("childManage.manage")
|
||||
public Result pageData(PageForm pageForm,
|
||||
Integer year,
|
||||
String searchName,
|
||||
String searchKeyword,
|
||||
String childrenSex,
|
||||
String unionId,
|
||||
String unitId,
|
||||
String childrenGrade) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
info.*
|
||||
FROM
|
||||
child_manage info
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
// 模糊查询
|
||||
if (searchName != null && !searchName.isEmpty() && searchKeyword != null && !searchKeyword.isEmpty()) {
|
||||
switch (searchName) {
|
||||
case "info.childrenName":
|
||||
cnd.and("info.childrenName", "like", "%" + searchKeyword + "%");
|
||||
break;
|
||||
case "info.guardianUserName": // 合并后的监护人查询
|
||||
cnd.and(Cnd.exps("info.guardianUserName1", "like", "%" + searchKeyword + "%")
|
||||
.or("info.guardianUserName2", "like", "%" + searchKeyword + "%"));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// 工会筛选 (查询两个监护人的工会)
|
||||
if (unionId != null && !unionId.isEmpty()) {
|
||||
cnd.and(Cnd.exps("info.guardianUnionId1", "=", unionId)
|
||||
.or("info.guardianUnionId2", "=", unionId));
|
||||
}
|
||||
// 所属单位筛选 (查询两个监护人的单位)
|
||||
if (unitId != null && !unitId.isEmpty()) {
|
||||
cnd.and(Cnd.exps("info.guardianUnitId1", "=", unitId)
|
||||
.or("info.guardianUnitId2", "=", unitId));
|
||||
}
|
||||
|
||||
cnd.andEX("YEAR(info.applyTime)", "=", year);
|
||||
cnd.andEX("info.childrenSex", "=", childrenSex);
|
||||
cnd.andEX("info.childrenGrade", "=", childrenGrade);
|
||||
sql.setCondition(cnd);
|
||||
Pagination pagination = childManageService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
return Result.success(pagination);
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("删除子女信息")
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
@SaCheckPermission("childManage.manage")
|
||||
@SLog(tag = "子女信息-我的填报", msg = "删除id: ${args[0]}")
|
||||
public Result doDelete(String id) {
|
||||
childManageService.dao().delete(ChildManage.class, id);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@At
|
||||
@Ok("void")
|
||||
@SaCheckPermission("childManage.manage")
|
||||
public void doExportExcel(@Param("data") ChildManagePageForm pageForm, HttpServletResponse response) {
|
||||
try {
|
||||
Sql sql = childManageService.getSql(pageForm);
|
||||
List<NutMap> map = childManageService.listMap(sql);
|
||||
|
||||
List<Sys_dict> dictList = sysDictService.getSubListByCode("CHILD_MANAGE_GRADE");
|
||||
|
||||
map.forEach(item -> {
|
||||
// 年龄计算
|
||||
String birthday = item.getString("childrenBirthday");
|
||||
if (birthday != null && !birthday.isEmpty()) {
|
||||
item.put("age", calculateAge(birthday));
|
||||
}
|
||||
Sys_dict dict = dictList.stream().filter(sys_dict -> sys_dict.getCode().equals(item.getString("childrenGrade"))).findFirst().orElse(null);
|
||||
item.put("childrenGrade", dict.getName());
|
||||
});
|
||||
|
||||
List<ExcelExportEntity> entityList = new ArrayList<>();
|
||||
ExcelExportEntity no = new ExcelExportEntity("序号", "no", 10);
|
||||
no.setFormat("isAddIndex");
|
||||
entityList.add(no);
|
||||
|
||||
entityList.add(new ExcelExportEntity("年级", "childrenGrade", 20));
|
||||
entityList.add(new ExcelExportEntity("子女姓名", "childrenName", 20));
|
||||
entityList.add(new ExcelExportEntity("性别", "childrenSex", 20));
|
||||
entityList.add(new ExcelExportEntity("出生日期", "childrenBirthday", 20));
|
||||
entityList.add(new ExcelExportEntity("年龄", "age", 20));
|
||||
entityList.add(new ExcelExportEntity("就读学校", "childrenCurrentSchool", 20));
|
||||
entityList.add(new ExcelExportEntity("监护人1", "guardianUserName1", 20));
|
||||
entityList.add(new ExcelExportEntity("手机号码", "guardianMobile1", 20));
|
||||
entityList.add(new ExcelExportEntity("所在单位", "guardianUnitName1", 20));
|
||||
entityList.add(new ExcelExportEntity("监护人2", "guardianUserName2", 20));
|
||||
entityList.add(new ExcelExportEntity("手机号码", "guardianMobile2", 20));
|
||||
entityList.add(new ExcelExportEntity("所在单位", "guardianUnitName2", 20));
|
||||
|
||||
|
||||
response.setContentType("application/octet-stream");
|
||||
response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode("子女信息管理汇总.xlsx", "UTF-8"));
|
||||
ExportParams exportParams = new ExportParams();
|
||||
exportParams.setType(ExcelType.XSSF);
|
||||
Workbook workbook = ExcelExportUtil.exportExcel(exportParams, entityList, map);
|
||||
workbook.write(response.getOutputStream());
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 计算年龄
|
||||
* @param birthday 出生日期
|
||||
* @return 年龄
|
||||
*/
|
||||
private String calculateAge(String birthday) {
|
||||
if (birthday == null || birthday.isEmpty()) {
|
||||
return "";
|
||||
}
|
||||
|
||||
try {
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
||||
Date birthDate = sdf.parse(birthday);
|
||||
Calendar birthCal = Calendar.getInstance();
|
||||
birthCal.setTime(birthDate);
|
||||
|
||||
Calendar today = Calendar.getInstance();
|
||||
int age = today.get(Calendar.YEAR) - birthCal.get(Calendar.YEAR);
|
||||
|
||||
// 检查是否还没过生日
|
||||
if (today.get(Calendar.DAY_OF_YEAR) < birthCal.get(Calendar.DAY_OF_YEAR)) {
|
||||
age--;
|
||||
}
|
||||
|
||||
return String.valueOf(age >= 0 ? age : 0);
|
||||
} catch (Exception e) {
|
||||
log.error("计算年龄失败", e);
|
||||
return "";
|
||||
}
|
||||
}
|
||||
}
|
||||
+74
@@ -0,0 +1,74 @@
|
||||
package com.budwk.app.zhgh.user.childManage.controller;
|
||||
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import com.budwk.app.base.annotation.SLog;
|
||||
import com.budwk.app.base.page.Pagination;
|
||||
import com.budwk.app.base.param.PageForm;
|
||||
import com.budwk.app.base.result.Result;
|
||||
import com.budwk.app.web.commons.auth.utils.SecurityUtil;
|
||||
import com.budwk.app.zhgh.enrollmentRegistration.model.EnrollmentRegistration;
|
||||
import com.budwk.app.zhgh.user.childManage.models.ChildManage;
|
||||
import com.budwk.app.zhgh.user.childManage.service.ChildManageService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nutz.aop.interceptor.ioc.TransAop;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.ioc.aop.Aop;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
|
||||
@IocBean
|
||||
@At("/platform/childManage/mine")
|
||||
@Ok("json:full")
|
||||
@Slf4j
|
||||
@Api("子女信息管理我的")
|
||||
public class ChildManageMineController {
|
||||
|
||||
@Inject
|
||||
private ChildManageService childManageService;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/zhgh/user/childManage/mine/index.html")
|
||||
@SaCheckPermission
|
||||
public void index() {}
|
||||
|
||||
@At
|
||||
@ApiOperation("分页查询")
|
||||
@SaCheckPermission("childManage.mine")
|
||||
public Result pageData(PageForm pageForm, Integer year) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
info.*
|
||||
FROM
|
||||
child_manage info
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.andEX("YEAR(info.applyTime)", "=", year);
|
||||
// 使用 or 条件查询两个监护人字段
|
||||
cnd.and(Cnd.exps("info.guardianUserId1", "=", SecurityUtil.getUserId())
|
||||
.or("info.guardianUserId2", "=", SecurityUtil.getUserId()));
|
||||
sql.setCondition(cnd);
|
||||
Pagination pagination = childManageService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
return Result.success(pagination);
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ApiOperation("删除子女信息")
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
@SaCheckPermission("childManage.mine")
|
||||
@SLog(tag = "子女信息-我的填报", msg = "删除id: ${args[0]}")
|
||||
public Result doDelete(String id) {
|
||||
childManageService.dao().delete(ChildManage.class, id);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+120
@@ -0,0 +1,120 @@
|
||||
package com.budwk.app.zhgh.user.childManage.controller;
|
||||
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckLogin;
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.budwk.app.base.annotation.SLog;
|
||||
import com.budwk.app.base.constant.RoleConstant;
|
||||
import com.budwk.app.base.page.Pagination;
|
||||
import com.budwk.app.base.result.Result;
|
||||
import com.budwk.app.sys.views.View_user;
|
||||
import com.budwk.app.web.commons.auth.utils.AuthUtil;
|
||||
import com.budwk.app.web.commons.auth.utils.SecurityUtil;
|
||||
import com.budwk.app.zhgh.enrollmentRegistration.model.EnrollmentRegistration;
|
||||
import com.budwk.app.zhgh.user.childManage.models.ChildManage;
|
||||
import com.budwk.app.zhgh.user.childManage.service.ChildManageService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.dao.util.cri.SqlExpressionGroup;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
|
||||
@IocBean
|
||||
@At("/platform/childManage/write")
|
||||
@Ok("json:full")
|
||||
@Slf4j
|
||||
@Api("子女信息管理信息填写")
|
||||
public class ChildManageWriteController {
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
@Inject
|
||||
private ChildManageService childManageService;
|
||||
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/zhgh/user/childManage/write/index.html")
|
||||
@SaCheckPermission
|
||||
public void index() {}
|
||||
|
||||
@At
|
||||
@ApiOperation("保存子女信息")
|
||||
@SaCheckPermission("childManage.write")
|
||||
@SLog(tag = "子女信息管理-信息填写", msg = "保存子女信息")
|
||||
public Result save(@Param("data") ChildManage childManage) {
|
||||
if(StrUtil.isBlank(childManage.getId())) childManage.setApplyTime(DateUtil.now());
|
||||
dao.insertOrUpdate(childManage);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("查询用户")
|
||||
@SaCheckPermission("childManage.write")
|
||||
@SLog(tag = "查询用户", msg = "查询用户")
|
||||
public Object listUser(String keyword) {
|
||||
Sql sql = Sqls.create("""
|
||||
select
|
||||
id,
|
||||
username as userName,
|
||||
loginname as loginName,
|
||||
sex,
|
||||
mobile,
|
||||
technicalTitle,
|
||||
IFNULL(unitname, '暂无') as unitName,
|
||||
unitid as unitId,
|
||||
unionid as unionId,
|
||||
unionname as unionName
|
||||
from
|
||||
vw_user
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
if (StrUtil.isNotBlank(keyword)) {
|
||||
SqlExpressionGroup seg = new SqlExpressionGroup();
|
||||
seg.or(View_user::getLoginname, "like", "%" + keyword + "%");
|
||||
seg.or(View_user::getUsername, "like", "%" + keyword + "%");
|
||||
cnd.and(seg);
|
||||
}
|
||||
if(!AuthUtil.hasRoleOr(RoleConstant.SYSADMIN.name(), RoleConstant.SCHOOL_UNION_ADMIN.name())) {
|
||||
if(AuthUtil.hasRoleOr(RoleConstant.BRANCH_UNION_ADMIN.name(), RoleConstant.BRANCH_UNION_CHAIRMAN.name())) {
|
||||
cnd.and(View_user::getUnionId, "=", SecurityUtil.getUnionId());
|
||||
} else {
|
||||
cnd.and(View_user::getId, "=", SecurityUtil.getUserId());
|
||||
}
|
||||
|
||||
}
|
||||
sql.setCondition(cnd);
|
||||
Pagination pagination = childManageService.listPageMap(1, 50, sql);
|
||||
return Result.success(pagination.getList());
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckLogin
|
||||
@ApiOperation("查询身份证是否重复")
|
||||
public Result getIsRepeatByIdCard(String idCard, String id) {
|
||||
int count = childManageService.dao().count(ChildManage.class,
|
||||
Cnd.where(ChildManage::getChildrenIdCard, "=", idCard)
|
||||
.and("YEAR(applyTime)", "=", DateUtil.thisYear())
|
||||
.andEX(ChildManage::getId, "!=", id));
|
||||
|
||||
|
||||
return Result.success(count);
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckLogin
|
||||
public Result findOne(String id) {
|
||||
return Result.success(childManageService.dao().fetch(ChildManage.class, id));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,186 @@
|
||||
package com.budwk.app.zhgh.user.childManage.models;
|
||||
|
||||
|
||||
import cn.hutool.json.JSONObject;
|
||||
import com.budwk.app.base.model.BaseModel;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @ClassName ChildManage
|
||||
* @Author hongqiwei
|
||||
* @Date 2025/8/30 10:23
|
||||
* @Version 1.0
|
||||
* @Description TODO
|
||||
*/
|
||||
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Table("child_manage")
|
||||
@TableMeta("{'mysql-charset':'utf8mb4'}")
|
||||
@Comment("子女信息管理")
|
||||
public class ChildManage extends BaseModel implements Serializable {
|
||||
|
||||
|
||||
@Column
|
||||
@Name
|
||||
@Comment("id")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@Prev(els = {@EL("uuid()")})
|
||||
private String id;
|
||||
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR,width = 32)
|
||||
@Comment("guardianUserId1")
|
||||
private String guardianUserId1;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR,width = 30)
|
||||
@Comment("监护人1(教工)姓名")
|
||||
private String guardianUserName1;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR,width = 30)
|
||||
@Comment("工号")
|
||||
private String guardianLoginName1;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR,width = 32)
|
||||
@Comment("所在工会Id")
|
||||
private String guardianUnionId1;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR,width = 50)
|
||||
@Comment("所在工会")
|
||||
private String guardianUnionName1;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR,width = 30)
|
||||
@Comment("手机号码")
|
||||
private String guardianMobile1;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR,width = 32)
|
||||
@Comment("所在单位Id")
|
||||
private String guardianUnitId1;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR,width = 50)
|
||||
@Comment("所在单位")
|
||||
private String guardianUnitName1;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR,width = 32)
|
||||
@Comment("guardianUserId2")
|
||||
private String guardianUserId2;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR,width = 30)
|
||||
@Comment("监护人2(教工)姓名")
|
||||
private String guardianUserName2;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR,width = 30)
|
||||
@Comment("工号")
|
||||
private String guardianLoginName2;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR,width = 32)
|
||||
@Comment("所在工会Id")
|
||||
private String guardianUnionId2;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR,width = 50)
|
||||
@Comment("所在工会")
|
||||
private String guardianUnionName2;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR,width = 30)
|
||||
@Comment("手机号码")
|
||||
private String guardianMobile2;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR,width = 32)
|
||||
@Comment("所在单位Id")
|
||||
private String guardianUnitId2;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR,width = 50)
|
||||
@Comment("所在单位")
|
||||
private String guardianUnitName2;
|
||||
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR,width = 30)
|
||||
@Comment("子女姓名")
|
||||
private String childrenName;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR,width = 30)
|
||||
@Comment("就读年级")
|
||||
private String childrenGrade;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR,width = 30)
|
||||
@Comment("入学年份")
|
||||
private String childrenYear;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR,width = 30)
|
||||
@Comment("身份证号")
|
||||
private String childrenIdCard;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR,width = 30)
|
||||
@Comment("出身年月")
|
||||
private String childrenBirthday;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR,width = 30)
|
||||
@Comment("性别")
|
||||
private String childrenSex;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR,width = 30)
|
||||
@Comment("国籍")
|
||||
private String childrenCountry;
|
||||
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR,width = 50)
|
||||
@Comment("现就读学校")
|
||||
private String childrenCurrentSchool;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR,width = 50)
|
||||
@Comment("中考总成绩")
|
||||
private String childrenMiddleScore;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR,width = 50)
|
||||
@Comment("学科组合")
|
||||
private String childrenSubjectCombination;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR,width = 100)
|
||||
@Comment("子女户籍所在地")
|
||||
private String childrenHuKouAddress;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR,width = 200)
|
||||
@Comment("备注")
|
||||
private String note;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR,width = 50)
|
||||
@Comment("填写时间")
|
||||
private String applyTime;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
package com.budwk.app.zhgh.user.childManage.service;
|
||||
|
||||
import com.budwk.app.base.service.BaseService;
|
||||
import com.budwk.app.zhgh.user.childManage.models.ChildManage;
|
||||
import com.budwk.app.zhgh.user.childManage.vo.ChildManagePageForm;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
|
||||
public interface ChildManageService extends BaseService<ChildManage> {
|
||||
Sql getSql(ChildManagePageForm pageForm);
|
||||
}
|
||||
+62
@@ -0,0 +1,62 @@
|
||||
package com.budwk.app.zhgh.user.childManage.service.impl;
|
||||
|
||||
import com.budwk.app.base.service.impl.BaseServiceImpl;
|
||||
import com.budwk.app.zhgh.user.childManage.models.ChildManage;
|
||||
import com.budwk.app.zhgh.user.childManage.service.ChildManageService;
|
||||
import com.budwk.app.zhgh.user.childManage.vo.ChildManagePageForm;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
|
||||
|
||||
@Slf4j
|
||||
@IocBean(args = {"refer:dao"})
|
||||
public class ChildManageServiceImpl extends BaseServiceImpl<ChildManage> implements ChildManageService {
|
||||
|
||||
public ChildManageServiceImpl(Dao dao) {
|
||||
super(dao);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Sql getSql(ChildManagePageForm pageForm) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
info.*
|
||||
FROM
|
||||
child_manage info
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
// 模糊查询
|
||||
if (pageForm.getSearchName() != null && !pageForm.getSearchName().isEmpty() && pageForm.getSearchKeyword() != null && !pageForm.getSearchKeyword().isEmpty()) {
|
||||
switch (pageForm.getSearchName()) {
|
||||
case "info.childrenName":
|
||||
cnd.and("info.childrenName", "like", "%" + pageForm.getSearchKeyword() + "%");
|
||||
break;
|
||||
case "info.guardianUserName": // 合并后的监护人查询
|
||||
cnd.and(Cnd.exps("info.guardianUserName1", "like", "%" + pageForm.getSearchKeyword() + "%")
|
||||
.or("info.guardianUserName2", "like", "%" + pageForm.getSearchKeyword() + "%"));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// 工会筛选 (查询两个监护人的工会)
|
||||
if (pageForm.getUnionId() != null && !pageForm.getUnionId().isEmpty()) {
|
||||
cnd.and(Cnd.exps("info.guardianUnionId1", "=", pageForm.getUnionId())
|
||||
.or("info.guardianUnionId2", "=", pageForm.getUnionId()));
|
||||
}
|
||||
// 所属单位筛选 (查询两个监护人的单位)
|
||||
if (pageForm.getUnitId() != null && !pageForm.getUnitId().isEmpty()) {
|
||||
cnd.and(Cnd.exps("info.guardianUnitId1", "=", pageForm.getUnitId())
|
||||
.or("info.guardianUnitId2", "=", pageForm.getUnitId()));
|
||||
}
|
||||
|
||||
cnd.andEX("YEAR(info.applyTime)", "=", pageForm.getYear());
|
||||
cnd.andEX("info.childrenGrade", "=", pageForm.getChildrenGrade());
|
||||
sql.setCondition(cnd);
|
||||
return sql;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package com.budwk.app.zhgh.user.childManage.vo;
|
||||
import com.budwk.app.base.param.PageForm;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class ChildManagePageForm extends PageForm {
|
||||
|
||||
private Integer year;
|
||||
private String unionId;
|
||||
private String unitId;
|
||||
private String childrenGrade;
|
||||
private String searchName;
|
||||
private String searchKeyword;
|
||||
}
|
||||
@@ -303,11 +303,14 @@ layout("/layouts/platform.html"){
|
||||
},
|
||||
//查询慰问对象
|
||||
selectQueryUser(keyword, options) {
|
||||
options.length = 0
|
||||
this.$axios.post("/platform/UnionReimburse/apply/listUser", {keyword: keyword}).then((res) => {
|
||||
if (res.code === 0) {
|
||||
options.push(...res.data)
|
||||
}
|
||||
return new Promise((resolve) => {
|
||||
options.length = 0
|
||||
this.$axios.post("/platform/UnionReimburse/apply/listUser", {keyword: keyword}).then((res) => {
|
||||
if (res.code === 0) {
|
||||
options.push(...res.data)
|
||||
}
|
||||
resolve()
|
||||
})
|
||||
})
|
||||
},
|
||||
userChange(val) {
|
||||
@@ -403,31 +406,6 @@ layout("/layouts/platform.html"){
|
||||
})
|
||||
})
|
||||
},
|
||||
// 初始化
|
||||
async init() {
|
||||
this.reimburseProjectList = await this.$businessTool.getDictOptions("UNION_REIMBURSE_PROJECT")
|
||||
if (this.bizId) {
|
||||
this.$axios.post("/platform/unionReimburse/apply/info", {id: this.bizId}).then((res) => {
|
||||
if (res.code === 0) {
|
||||
this.formData = res.data
|
||||
this.selectQueryUser(this.formData.loginName, this.userOptions)
|
||||
this.chooseType = this.typeOptions.find(o => o.id === this.formData.type)
|
||||
}
|
||||
})
|
||||
} else {
|
||||
const { username, loginname, id, unit, union, mobile } = this.$store.state.user
|
||||
this.formData = {
|
||||
userName: username,
|
||||
loginName: loginname,
|
||||
unitId: unit?.id,
|
||||
unitName: unit?.name,
|
||||
unionId: union?.id,
|
||||
unionName: union?.name,
|
||||
reimburseType: "UNION_REIMBURSE_TYPE_1",
|
||||
mobile: mobile
|
||||
}
|
||||
}
|
||||
},
|
||||
//慰问类型查询
|
||||
queryCondolenceType() {
|
||||
this.$axios.post("/platform/unionReimburse/apply/queryCondolenceType")
|
||||
@@ -499,8 +477,50 @@ layout("/layouts/platform.html"){
|
||||
this.$set(this.formData, 'fundBalance', '查询失败');
|
||||
this.$message.error("经费余额查询失败");
|
||||
});
|
||||
}
|
||||
|
||||
},
|
||||
// 初始化
|
||||
async init() {
|
||||
this.reimburseProjectList = await this.$businessTool.getDictOptions("UNION_REIMBURSE_PROJECT")
|
||||
if (this.bizId) {
|
||||
this.$axios.post("/platform/unionReimburse/apply/info", {id: this.bizId}).then(async (res) => {
|
||||
if (res.code === 0) {
|
||||
this.formData = res.data
|
||||
// 确保在加载用户列表后再设置默认值
|
||||
await this.selectQueryUser('', this.userOptions)
|
||||
// 如果有慰问对象ID,确保userOptions中有对应数据
|
||||
if (this.formData.condolenceId) {
|
||||
// 检查userOptions中是否已存在该用户
|
||||
const existingUser = this.userOptions.find(user => user.id === this.formData.condolenceId);
|
||||
if (!existingUser && this.formData.condolenceName) {
|
||||
// 如果不存在但有名称信息,则手动添加
|
||||
this.userOptions.unshift({
|
||||
id: this.formData.condolenceId,
|
||||
userName: this.formData.condolenceName,
|
||||
mobile: this.formData.condolenceMobile || '',
|
||||
loginName: this.formData.condolenceLoginName || '',
|
||||
unitName: this.formData.condolenceUnitName || '',
|
||||
sex: this.formData.condolenceSex || ''
|
||||
});
|
||||
}
|
||||
}
|
||||
this.chooseType = this.typeOptions.find(o => o.id === this.formData.type)
|
||||
}
|
||||
})
|
||||
} else {
|
||||
const { username, loginname, id, unit, union, mobile } = this.$store.state.user
|
||||
this.formData = {
|
||||
userName: username,
|
||||
loginName: loginname,
|
||||
unitId: unit?.id,
|
||||
unitName: unit?.name,
|
||||
unionId: union?.id,
|
||||
unionName: union?.name,
|
||||
reimburseType: "UNION_REIMBURSE_TYPE_1",
|
||||
mobile: mobile,
|
||||
userId: id,
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
created() {
|
||||
this.queryCondolenceType()
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
const childManageInfo = {
|
||||
template: /*language=HTML*/ `
|
||||
|
||||
<div>
|
||||
<div class="process-title">
|
||||
子女信息
|
||||
</div>
|
||||
<el-descriptions :column="3" border>
|
||||
<el-descriptions-item label="就读年级">
|
||||
<dict-tag :options="dict.type.CHILD_MANAGE_GRADE"
|
||||
:value="viewData.childrenGrade">
|
||||
</dict-tag></el-descriptions-item>
|
||||
<el-descriptions-item label="入学年份">{{viewData.childrenYear}}</el-descriptions-item>
|
||||
<el-descriptions-item label="姓名">{{viewData.childrenName}}</el-descriptions-item>
|
||||
<el-descriptions-item label="身份证号">{{viewData.childrenIdCard}}</el-descriptions-item>
|
||||
<el-descriptions-item label="出生日期">{{viewData.childrenBirthday}}</el-descriptions-item>
|
||||
<el-descriptions-item label="性别">{{viewData.childrenSex}}</el-descriptions-item>
|
||||
<el-descriptions-item label="国籍">{{viewData.childrenCountry}}</el-descriptions-item>
|
||||
<el-descriptions-item label="就读学校">{{viewData.childrenCurrentSchool}}</el-descriptions-item>
|
||||
<el-descriptions-item label="中考总成绩">{{viewData.childrenMiddleScore}}</el-descriptions-item>
|
||||
<el-descriptions-item label="学科组合">{{viewData.childrenSubjectCombination}}</el-descriptions-item>
|
||||
<el-descriptions-item label="户籍所在地" :span="2">{{viewData.childrenHuKouAddress}}</el-descriptions-item>
|
||||
<el-descriptions-item label="监护人1">{{viewData.guardianUserName1}}</el-descriptions-item>
|
||||
<el-descriptions-item label="联系电话">{{viewData.guardianMobile1}}</el-descriptions-item>
|
||||
<el-descriptions-item label="工作单位">{{viewData.guardianUnitName1}}</el-descriptions-item>
|
||||
<el-descriptions-item label="监护人2">{{viewData.guardianUserName2}}</el-descriptions-item>
|
||||
<el-descriptions-item label="联系电话">{{viewData.guardianMobile2}}</el-descriptions-item>
|
||||
<el-descriptions-item label="工作单位">{{viewData.guardianUnitName2}}</el-descriptions-item>
|
||||
<el-descriptions-item label="备注">{{viewData.note}}</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
<slot></slot>
|
||||
|
||||
</div>
|
||||
`,
|
||||
dicts: ["CHILD_MANAGE_GRADE"],
|
||||
data() {
|
||||
return {
|
||||
viewData: {},
|
||||
row: null
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
// 打开
|
||||
onOpen(row) {
|
||||
this.row = row
|
||||
this.getInfo()
|
||||
},
|
||||
// 获取申请信息
|
||||
getInfo() {
|
||||
this.$axios.post('/platform/childManage/write/findOne', {id: this.row.id}).then((res) => {
|
||||
if (res.code === 0) {
|
||||
this.viewData = res.data
|
||||
}
|
||||
})
|
||||
},
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,228 @@
|
||||
<!--#
|
||||
layout("/layouts/platform.html"){
|
||||
#-->
|
||||
|
||||
|
||||
<div id="app">
|
||||
<guava ref="guava">
|
||||
<el-card shadow="never">
|
||||
<search @search="doSearch">
|
||||
<search-item label="年度">
|
||||
<el-date-picker
|
||||
@change="doSearch"
|
||||
placeholder="选择年"
|
||||
style="width: 100%"
|
||||
type="year"
|
||||
v-model="pageForm.year"
|
||||
value-format="yyyy">
|
||||
</el-date-picker>
|
||||
</search-item>
|
||||
<search-item label="就读年级">
|
||||
<el-select clearable placeholder="请选择就读年级"
|
||||
style="width: 100%;"
|
||||
v-model="pageForm.childrenGrade">
|
||||
<el-option :label="item.name" :value="item.code"
|
||||
v-for="item in dict.type.CHILD_MANAGE_GRADE"></el-option>
|
||||
</el-select>
|
||||
</search-item>
|
||||
<search-item label="模糊查询">
|
||||
<el-input @keyup.enter.native="doSearch" clearable
|
||||
placeholder="请输入内容"
|
||||
v-model="pageForm.searchKeyword">
|
||||
<el-select placeholder="查询类型" slot="prepend"
|
||||
style="width: 100px;"
|
||||
v-model="pageForm.searchName">
|
||||
<el-option label="子女姓名" value="info.childrenName"></el-option>
|
||||
<el-option label="监护人" value="info.guardianUserName"></el-option>
|
||||
</el-select>
|
||||
</el-input>
|
||||
</search-item>
|
||||
<search-item label="性别">
|
||||
<el-select clearable placeholder="请选择性别"
|
||||
style="width: 100%;"
|
||||
v-model="pageForm.childrenSex">
|
||||
<el-option label="男" value="男"></el-option>
|
||||
<el-option label="女" value="女"></el-option>
|
||||
</el-select>
|
||||
</search-item>
|
||||
<search-item label="所属工会">
|
||||
<el-select v-model="pageForm.unionId" placeholder="请选择分工会" clearable style="width: 100%"
|
||||
@change="flushUnits" @clear="flushUnits">
|
||||
<el-option v-for="item in unionOptions" :key="item.id" :label="item.name"
|
||||
:value="item.id"></el-option>
|
||||
</el-select>
|
||||
</search-item>
|
||||
<search-item label="所属单位">
|
||||
<el-select placeholder="所属单位" style="width: 100%" v-model="pageForm.unitId" clearable
|
||||
filterable>
|
||||
<el-option v-for="item in unitOptions" :label="item.name" :value="item.id"></el-option>
|
||||
</el-select>
|
||||
</search-item>
|
||||
</search>
|
||||
</el-card>
|
||||
<el-card shadow="never">
|
||||
<table-tool label="统计列表">
|
||||
<el-button @click="doExportExcel" size="mini" type="primary">导出汇总名单
|
||||
</el-button>
|
||||
</table-tool>
|
||||
<!-- 添加横向滚动容器 -->
|
||||
<div class="table-container">
|
||||
<el-table :data="tableData" @sort-change="pageOrder" style="width: 2000px">
|
||||
<el-table-column type="index" width="60" label="序号" :index="indexMethod"></el-table-column>
|
||||
<el-table-column prop="childrenGrade" label="年级" width="100">
|
||||
<template slot-scope="{row}">
|
||||
<dict-tag :options="dict.type.CHILD_MANAGE_GRADE"
|
||||
:value="row.childrenGrade">
|
||||
</dict-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="childrenYear" label="入学年份" width="100"></el-table-column>
|
||||
<el-table-column prop="childrenName" label="子女姓名" width="120"></el-table-column>
|
||||
<el-table-column prop="childrenSex" label="性别" width="80"></el-table-column>
|
||||
<el-table-column prop="childrenBirthday" label="出生日期" width="120"></el-table-column>
|
||||
<el-table-column prop="childrenBirthday" label="年龄" width="80">
|
||||
<template v-slot="scope">
|
||||
<span>{{ calculateAge(scope.row.childrenBirthday) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="childrenCurrentSchool" label="就读学校" width="150"></el-table-column>
|
||||
<el-table-column prop="guardianUserName1" label="监护人1" width="120"></el-table-column>
|
||||
<el-table-column prop="guardianMobile1" label="手机号码" width="120"></el-table-column>
|
||||
<el-table-column prop="guardianUnitName1" label="所在单位" width="150"></el-table-column>
|
||||
<el-table-column prop="guardianUserName2" label="监护人2" width="120"></el-table-column>
|
||||
<el-table-column prop="guardianMobile2" label="手机号码" width="120"></el-table-column>
|
||||
<el-table-column prop="guardianUnitName2" label="所在单位" width="150"></el-table-column>
|
||||
|
||||
<el-table-column align="center" fixed="right" header-align="center" label="操作" width="250">
|
||||
<template scope="{row}">
|
||||
<el-button @click="openView(row)" size="mini" type="primary">
|
||||
查看
|
||||
</el-button>
|
||||
<el-button @click="openEdit(row)" size="mini" type="primary">
|
||||
编辑
|
||||
</el-button>
|
||||
<el-button @click="doDelete(row.id)" size="mini" type="danger">
|
||||
删除
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
<!--#include("/layouts/pagination.html"){}#-->
|
||||
</el-card>
|
||||
|
||||
|
||||
<template #view>
|
||||
<child-manage-info ref="childManageInfoRef">
|
||||
</child-manage-info>
|
||||
</template>
|
||||
</guava>
|
||||
</div>
|
||||
<script>
|
||||
<!--#include('../info.js'){}#-->
|
||||
new Vue({
|
||||
el: "#app",
|
||||
store,
|
||||
dicts: ["CHILD_MANAGE_GRADE", "CHILD_MANAGE_GRADE"],
|
||||
mixins: [initTableMixins],
|
||||
components: {
|
||||
"child-manage-info": childManageInfo
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
pageDataUrl: "/platform/childManage/manage/pageData",
|
||||
pageForm: {
|
||||
year: moment().format("YYYY"),
|
||||
},
|
||||
unionOptions: [],
|
||||
unitOptions: []
|
||||
}
|
||||
|
||||
},
|
||||
methods: {
|
||||
openView(row) {
|
||||
this.$refs.guava.view(() => {
|
||||
this.$refs.childManageInfoRef.onOpen(row)
|
||||
})
|
||||
},
|
||||
async flushUnits() {
|
||||
this.$set(this.pageForm, "unitId", null)
|
||||
this.units = []
|
||||
if (this.pageForm.unionId) {
|
||||
this.units = await this.$businessTool.listUnit(this.pageForm.unionId)
|
||||
}
|
||||
},
|
||||
calculateAge(birthday) {
|
||||
console.log('Birthday:', birthday);
|
||||
if (!birthday) return '';
|
||||
const birthDate = new Date(birthday);
|
||||
if (isNaN(birthDate.getTime())) {
|
||||
console.log('Invalid date:', birthday);
|
||||
return '';
|
||||
}
|
||||
const today = new Date();
|
||||
let age = today.getFullYear() - birthDate.getFullYear();
|
||||
const monthDiff = today.getMonth() - birthDate.getMonth();
|
||||
|
||||
if (monthDiff < 0 || (monthDiff === 0 && today.getDate() < birthDate.getDate())) {
|
||||
age--;
|
||||
}
|
||||
|
||||
console.log('Calculated age:', age);
|
||||
return age >= 0 ? age : '未出生';
|
||||
},
|
||||
openEdit(row) {
|
||||
window.location.href = '/platform/childManage/write?bizId=' + row.id + '&manage=1'
|
||||
},
|
||||
doDelete(id) {
|
||||
this.$confirm("您确定要删除吗?", "提示", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning"
|
||||
}).then(() => {
|
||||
this.$axios.post("/platform/childManage/manage/doDelete", {id: id}).then((res) => {
|
||||
if (res.code === 0) {
|
||||
this.$message.success(res.msg)
|
||||
this.pageData()
|
||||
}
|
||||
})
|
||||
})
|
||||
},
|
||||
doExportExcel() {
|
||||
this.$downLoad("/platform/childManage/manage/doExportExcel", {
|
||||
data: JSON.stringify(this.pageForm)
|
||||
})
|
||||
},
|
||||
},
|
||||
async created() {
|
||||
this.pageData()
|
||||
this.unionOptions = await this.$businessTool.listUnion()
|
||||
this.unitOptions = await this.$businessTool.listUnit()
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.table-container {
|
||||
overflow-x: auto;
|
||||
overflow-y: visible;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
/* 确保操作列在滚动时保持固定 */
|
||||
.el-table .el-table__fixed-right {
|
||||
height: 100% !important;
|
||||
background-color: #fff;
|
||||
z-index: 10;
|
||||
}
|
||||
|
||||
/* 设置表格单元格的最小宽度 */
|
||||
.el-table .el-table__body td {
|
||||
min-width: 60px;
|
||||
}
|
||||
</style>
|
||||
|
||||
|
||||
<!--#
|
||||
}
|
||||
#-->
|
||||
@@ -0,0 +1,173 @@
|
||||
<!--#
|
||||
layout("/layouts/platform.html"){
|
||||
#-->
|
||||
|
||||
<div id="app">
|
||||
<guava ref="guava">
|
||||
<el-card shadow="never">
|
||||
<search @search="doSearch">
|
||||
<search-item label="年度">
|
||||
<el-date-picker
|
||||
@change="doSearch"
|
||||
placeholder="选择年"
|
||||
style="width: 100%"
|
||||
type="year"
|
||||
v-model="pageForm.year"
|
||||
value-format="yyyy">
|
||||
</el-date-picker>
|
||||
</search-item>
|
||||
</search>
|
||||
</el-card>
|
||||
<el-card class="mt10" shadow="never">
|
||||
<table-tool label="填报列表">
|
||||
</table-tool>
|
||||
<!-- 添加一个带有横向滚动的容器 -->
|
||||
<div class="table-container">
|
||||
<el-table :data="tableData" @sort-change="pageOrder" style="width: 2000px">
|
||||
<el-table-column type="index" width="60" label="序号" :index="indexMethod"></el-table-column>
|
||||
<el-table-column prop="childrenGrade" label="年级" width="100">
|
||||
<template slot-scope="{row}">
|
||||
<dict-tag :options="dict.type.CHILD_MANAGE_GRADE"
|
||||
:value="row.childrenGrade">
|
||||
</dict-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="childrenYear" label="入学年份" width="100"></el-table-column>
|
||||
<el-table-column prop="childrenName" label="子女姓名" width="120"></el-table-column>
|
||||
<el-table-column prop="childrenSex" label="性别" width="80"></el-table-column>
|
||||
<el-table-column prop="childrenBirthday" label="出生日期" width="120"></el-table-column>
|
||||
<el-table-column prop="childrenBirthday" label="年龄" width="80">
|
||||
<template v-slot="scope">
|
||||
<span>{{ calculateAge(scope.row.childrenBirthday) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="childrenCurrentSchool" label="就读学校" width="150"></el-table-column>
|
||||
<el-table-column prop="guardianUserName1" label="监护人1" width="120"></el-table-column>
|
||||
<el-table-column prop="guardianMobile1" label="手机号码" width="120"></el-table-column>
|
||||
<el-table-column prop="guardianUnitName1" label="所在单位" width="150"></el-table-column>
|
||||
<el-table-column prop="guardianUserName2" label="监护人2" width="120"></el-table-column>
|
||||
<el-table-column prop="guardianMobile2" label="手机号码" width="120"></el-table-column>
|
||||
<el-table-column prop="guardianUnitName2" label="所在单位" width="150"></el-table-column>
|
||||
|
||||
<el-table-column align="center" fixed="right" header-align="center" label="操作" width="250">
|
||||
<template scope="{row}">
|
||||
<el-button @click="openView(row)" size="mini" type="primary">
|
||||
查看
|
||||
</el-button>
|
||||
<el-button @click="openEdit(row)" size="mini" type="primary">
|
||||
编辑
|
||||
</el-button>
|
||||
<el-button @click="doDelete(row.id)" size="mini" type="danger">
|
||||
删除
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
<!--#include("/layouts/pagination.html"){}#-->
|
||||
</el-card>
|
||||
|
||||
|
||||
|
||||
<template #view>
|
||||
<child-manage-info ref="childManageInfoRef">
|
||||
</child-manage-info>
|
||||
</template>
|
||||
</guava>
|
||||
</div>
|
||||
<script>
|
||||
<!--#include('../info.js'){}#-->
|
||||
new Vue({
|
||||
el: "#app",
|
||||
store,
|
||||
dicts: ["CHILD_MANAGE_GRADE"],
|
||||
mixins: [initTableMixins],
|
||||
components: {
|
||||
"child-manage-info": childManageInfo
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
pageDataUrl: "/platform/childManage/mine/pageData",
|
||||
pageForm: {
|
||||
year: moment().format("YYYY"),
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
openView(row) {
|
||||
this.$refs.guava.view(()=>{
|
||||
this.$refs.childManageInfoRef.onOpen(row)
|
||||
})
|
||||
},
|
||||
calculateAge(birthday) {
|
||||
console.log('Birthday:', birthday);
|
||||
if (!birthday) return '';
|
||||
const birthDate = new Date(birthday);
|
||||
if (isNaN(birthDate.getTime())) {
|
||||
console.log('Invalid date:', birthday);
|
||||
return '';
|
||||
}
|
||||
const today = new Date();
|
||||
let age = today.getFullYear() - birthDate.getFullYear();
|
||||
const monthDiff = today.getMonth() - birthDate.getMonth();
|
||||
|
||||
if (monthDiff < 0 || (monthDiff === 0 && today.getDate() < birthDate.getDate())) {
|
||||
age--;
|
||||
}
|
||||
|
||||
console.log('Calculated age:', age);
|
||||
return age >= 0 ? age : '未出生';
|
||||
},
|
||||
openEdit(row) {
|
||||
window.location.href = '/platform/childManage/write?bizId=' + row.id
|
||||
},
|
||||
doDelete(id) {
|
||||
this.$confirm("您确定要删除吗?", "提示", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning"
|
||||
}).then(() => {
|
||||
this.$axios.post("/platform/childManage/mine/doDelete", {id: id}).then((res) => {
|
||||
if (res.code === 0) {
|
||||
this.$message.success(res.msg)
|
||||
this.pageData()
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
},
|
||||
async created() {
|
||||
this.pageData()
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.table-container {
|
||||
overflow-x: auto;
|
||||
overflow-y: visible;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
/* 确保操作列在滚动时保持固定 */
|
||||
.el-table .el-table__fixed-right {
|
||||
height: 100% !important;
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
/* 设置表格单元格的最小宽度 */
|
||||
.el-table .el-table__body td {
|
||||
min-width: 60px;
|
||||
}
|
||||
|
||||
/* 确保固定列显示在最上层 */
|
||||
.el-table__fixed-right {
|
||||
z-index: 10;
|
||||
}
|
||||
</style>
|
||||
|
||||
|
||||
|
||||
<!--#
|
||||
}
|
||||
#-->
|
||||
@@ -0,0 +1,358 @@
|
||||
<!--#
|
||||
layout("/layouts/platform.html"){
|
||||
#-->
|
||||
|
||||
<div id="app" v-cloak>
|
||||
<el-card shadow="never">
|
||||
<snaker-start slot="header" label="信息填报" define_key="XXTB"></snaker-start>
|
||||
<el-form :model="formData" ref="formRef" :rules="formRules" label-width="0" label-suffix=":"
|
||||
class="flow-task-form">
|
||||
<table-tool label="子女信息"></table-tool>
|
||||
<el-descriptions :column="2" border>
|
||||
<el-descriptions-item label="就读年级">
|
||||
<el-form-item prop="childRelationship">
|
||||
<el-select clearable placeholder="请选择就读年级"
|
||||
style="width: 100%;"
|
||||
v-model="formData.childrenGrade">
|
||||
<el-option :label="item.name" :value="item.code"
|
||||
v-for="item in dict.type.CHILD_MANAGE_GRADE"></el-option>
|
||||
</el-select>
|
||||
</el-form-item></el-descriptions-item>
|
||||
<el-descriptions-item label="入学年份">
|
||||
<el-form-item prop="childrenBirthday">
|
||||
<el-date-picker
|
||||
v-model="formData.childrenYear"
|
||||
type="year"
|
||||
placeholder="请选择入学年份"
|
||||
style="width: 100%;"
|
||||
value-format="yyyy">
|
||||
</el-date-picker>
|
||||
</el-form-item></el-descriptions-item>
|
||||
<el-descriptions-item label="姓名">
|
||||
<el-form-item prop="childrenName">
|
||||
<el-input v-model="formData.childrenName" placeholder="请输入子女姓名"
|
||||
maxlength="30"></el-input>
|
||||
</el-form-item></el-descriptions-item>
|
||||
<el-descriptions-item label="身份证号">
|
||||
<el-form-item prop="childrenIdCard">
|
||||
<el-input v-model="formData.childrenIdCard" placeholder="请输入身份证号"
|
||||
maxlength="19">
|
||||
<el-button slot="append" icon="el-icon-search" @click="getIsRepeatByIdCard"></el-button>
|
||||
</el-input>
|
||||
</el-form-item></el-descriptions-item>
|
||||
<el-descriptions-item label="出生日期">
|
||||
<el-form-item prop="childrenBirthday">
|
||||
<el-date-picker
|
||||
v-model="formData.childrenBirthday"
|
||||
type="date"
|
||||
placeholder="请选择子女出生年月"
|
||||
style="width: 100%;"
|
||||
value-format="yyyy-MM-dd">
|
||||
</el-date-picker>
|
||||
</el-form-item></el-descriptions-item>
|
||||
<el-descriptions-item label="性别">
|
||||
<el-form-item prop="childrenSex">
|
||||
<el-select clearable placeholder="请选择性别"
|
||||
style="width: 100%;"
|
||||
v-model="formData.childrenSex">
|
||||
<el-option label="男" value="男"></el-option>
|
||||
<el-option label="女" value="女"></el-option>
|
||||
</el-select>
|
||||
</el-form-item></el-descriptions-item>
|
||||
<el-descriptions-item label="国籍">
|
||||
<el-form-item prop="childrenCountry">
|
||||
<el-input v-model="formData.childrenCountry" placeholder="请输入子女国籍"
|
||||
maxlength="30"></el-input>
|
||||
</el-form-item></el-descriptions-item>
|
||||
<el-descriptions-item label="就读学校">
|
||||
<el-form-item prop="childrenCurrentSchool">
|
||||
<el-input v-model="formData.childrenCurrentSchool" placeholder="请输入现就读学校"
|
||||
maxlength="30"></el-input>
|
||||
</el-form-item></el-descriptions-item>
|
||||
<el-descriptions-item label="中考总成绩">
|
||||
<el-form-item prop="childrenMiddleScore">
|
||||
<el-input v-model="formData.childrenMiddleScore" placeholder="请输入中考总成绩"
|
||||
maxlength="30"></el-input>
|
||||
</el-form-item></el-descriptions-item></el-descriptions-item>
|
||||
<el-descriptions-item label="学科组合">
|
||||
<el-form-item prop="childrenSubjectCombination">
|
||||
<el-input v-model="formData.childrenSubjectCombination" placeholder="请输入学科组合"
|
||||
maxlength="30"></el-input>
|
||||
</el-form-item></el-descriptions-item></el-descriptions-item>
|
||||
<el-descriptions-item label="户籍所在地">
|
||||
<el-form-item prop="childrenHuKouAddress">
|
||||
<el-input v-model="formData.childrenHuKouAddress" placeholder="请输入户籍所在地"
|
||||
maxlength="30"></el-input>
|
||||
</el-form-item></el-descriptions-item>
|
||||
</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
<table-tool label="监护人信息"></table-tool>
|
||||
<el-descriptions :column="2" border>
|
||||
<el-descriptions-item label="监护人1">
|
||||
<el-form-item label="监护人1" prop="guardianUserName1">
|
||||
<el-select
|
||||
style="width: 100%"
|
||||
v-model="formData.guardianUserName1"
|
||||
filterable
|
||||
clearable
|
||||
remote
|
||||
reserve-keyword
|
||||
placeholder="请输入姓名或工号查询"
|
||||
:remote-method="createRemoteMethod(userOptions)"
|
||||
@change="handleFatherChange"
|
||||
@clear="clearUserInfo"
|
||||
allow-create
|
||||
default-first-option>
|
||||
<el-option
|
||||
v-for="item in userOptions"
|
||||
:key="item.id"
|
||||
:label="item.userName+'('+item.loginName+')'+'('+item.unitName+')'+'('+item.sex+')'"
|
||||
:value="item.id">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item></el-descriptions-item>
|
||||
<el-descriptions-item label="工号" >
|
||||
<el-form-item prop="guardianLoginName1">{{formData.guardianLoginName1}}
|
||||
</el-form-item>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="手机号码">
|
||||
<el-form-item prop="guardianMobile1">
|
||||
<el-input v-model="formData.guardianMobile1" placeholder="请输入手机号码" maxlength="30"></el-input>
|
||||
</el-form-item>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="所在单位">
|
||||
<el-form-item prop="unitName1">
|
||||
<el-input v-model="formData.guardianUnitName1" placeholder="请输入所在单位" maxlength="100"></el-input>
|
||||
</el-form-item>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="监护人2">
|
||||
<el-form-item label="监护人2" prop="guardianUserName2">
|
||||
<el-select
|
||||
style="width: 100%"
|
||||
v-model="formData.guardianUserName2"
|
||||
filterable
|
||||
clearable
|
||||
remote
|
||||
reserve-keyword
|
||||
placeholder="请输入姓名或工号查询"
|
||||
:remote-method="createRemoteMethod(userOptions2)"
|
||||
@change="handleMotherChange"
|
||||
@clear="clearUserInfo2"
|
||||
allow-create
|
||||
default-first-option>
|
||||
<el-option
|
||||
v-for="item in userOptions2"
|
||||
:key="item.id"
|
||||
:label="item.userName+'('+item.loginName+')'+'('+item.unitName+')'+'('+item.sex+')'"
|
||||
:value="item.id">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="工号">
|
||||
<el-form-item prop="guardianLoginName2">{{formData.guardianLoginName2}}
|
||||
</el-form-item>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="手机号码">
|
||||
<el-form-item prop="guardianMobile2">
|
||||
<el-input v-model="formData.guardianMobile2" placeholder="请输入手机号码" maxlength="30"></el-input>
|
||||
</el-form-item>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="所在单位">
|
||||
<el-form-item prop="guardianUnitName2">
|
||||
<el-input v-model="formData.guardianUnitName2" placeholder="请输入所在单位" maxlength="100"></el-input>
|
||||
</el-form-item>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="备注">
|
||||
<el-form-item prop="note">
|
||||
<el-input v-model="formData.note" placeholder="请填写备注"
|
||||
maxlength="50"></el-input>
|
||||
</el-form-item></el-descriptions-item>
|
||||
</el-descriptions>
|
||||
</el-form>
|
||||
<el-row type="flex" justify="end" class="mt20">
|
||||
<el-button type="primary" plain @click="onSave">保存</el-button>
|
||||
</el-row>
|
||||
</el-card>
|
||||
</div>
|
||||
|
||||
|
||||
<script>
|
||||
new Vue({
|
||||
el: '#app',
|
||||
store,
|
||||
dicts: ["CHILD_MANAGE_GRADE"],
|
||||
data() {
|
||||
return {
|
||||
bizId: GetQueryString("bizId"),
|
||||
formData: {},
|
||||
userOptions: [],
|
||||
userOptions2: [], // 添加母亲的用户选项
|
||||
formRules: {
|
||||
},
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
clearUserInfo() {
|
||||
// 清空监护人1相关信息
|
||||
this.$set(this.formData, "guardianUserName1", "")
|
||||
this.$set(this.formData, "guardianLoginName1", "")
|
||||
this.$set(this.formData, "guardianMobile1", "")
|
||||
this.$set(this.formData, "guardianUnitName1", "")
|
||||
},
|
||||
|
||||
clearUserInfo2() {
|
||||
// 清空监护人2相关信息
|
||||
this.$set(this.formData, "guardianUserName2", "")
|
||||
this.$set(this.formData, "guardianLoginName2", "")
|
||||
this.$set(this.formData, "guardianMobile2", "")
|
||||
this.$set(this.formData, "guardianUnitName2", "")
|
||||
},
|
||||
|
||||
createRemoteMethod(options) {
|
||||
return (keyword) => {
|
||||
this.selectQueryUser(keyword, options)
|
||||
}
|
||||
},
|
||||
|
||||
// 查询监护人对象
|
||||
selectQueryUser(keyword, options) {
|
||||
options.length = 0
|
||||
this.$axios.post("/platform/childManage/write/listUser", {keyword: keyword}).then((res) => {
|
||||
if (res.code === 0) {
|
||||
options.push(...res.data)
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
// 监护人1选择变化处理(支持手动输入)
|
||||
handleFatherChange(val) {
|
||||
// 先查找是否是选择的用户
|
||||
const user = this.userOptions.find(o => o.userName === val || o.id === val);
|
||||
if (user) {
|
||||
// 如果是选择的用户,保存完整信息
|
||||
this.$set(this.formData, "guardianUserName1", user.userName);
|
||||
this.$set(this.formData, "guardianUserId1", user.id);
|
||||
this.$set(this.formData, "guardianLoginName1", user.loginName);
|
||||
this.$set(this.formData, "guardianUnionId1", user.unionId);
|
||||
this.$set(this.formData, "guardianUnionName1", user.unionName);
|
||||
this.$set(this.formData, "guardianMobile1", user.mobile);
|
||||
this.$set(this.formData, "guardianUnitId1", user.unitId);
|
||||
this.$set(this.formData, "guardianUnitName1", user.unitName);
|
||||
} else {
|
||||
// 如果是手动输入的姓名,只设置姓名,其他字段清空
|
||||
this.$set(this.formData, "guardianUserName1", val || "")
|
||||
this.$set(this.formData, "guardianUserId1", "")
|
||||
this.$set(this.formData, "guardianLoginName1", "")
|
||||
this.$set(this.formData, "guardianUnionId1", "")
|
||||
this.$set(this.formData, "guardianUnionName1", "")
|
||||
this.$set(this.formData, "guardianMobile1", "")
|
||||
this.$set(this.formData, "guardianUnitId1", "")
|
||||
this.$set(this.formData, "guardianUnitName1", "")
|
||||
}
|
||||
},
|
||||
|
||||
// 监护人2选择变化处理(支持手动输入)
|
||||
handleMotherChange(val) {
|
||||
// 先查找是否是选择的用户
|
||||
const user = this.userOptions2.find(o => o.userName === val || o.id === val);
|
||||
if (user) {
|
||||
// 如果是选择的用户,保存完整信息
|
||||
this.$set(this.formData, "guardianUserId2", user.id);
|
||||
this.$set(this.formData, "guardianUserName2", user.userName);
|
||||
this.$set(this.formData, "guardianLoginName2", user.loginName);
|
||||
this.$set(this.formData, "guardianUnionId2", user.unionId);
|
||||
this.$set(this.formData, "guardianUnionName2", user.unionName);
|
||||
this.$set(this.formData, "guardianMobile2", user.mobile);
|
||||
this.$set(this.formData, "guardianUnitId2", user.unitId);
|
||||
this.$set(this.formData, "guardianUnitName2", user.unitName);
|
||||
} else {
|
||||
// 如果是手动输入的姓名,只设置姓名,其他字段清空
|
||||
this.$set(this.formData, "guardianUserName2", val || "")
|
||||
this.$set(this.formData, "guardianUserId2", "")
|
||||
this.$set(this.formData, "guardianLoginName2", "")
|
||||
this.$set(this.formData, "guardianUnionId2", "")
|
||||
this.$set(this.formData, "guardianUnionName2", "")
|
||||
this.$set(this.formData, "guardianMobile2", "")
|
||||
this.$set(this.formData, "guardianUnitId2", "")
|
||||
this.$set(this.formData, "guardianUnitName2", "")
|
||||
}
|
||||
},
|
||||
|
||||
async getIsRepeatByIdCard() {
|
||||
if (!this.formData.childrenIdCard) {
|
||||
this.$message.error("请填写子女身份证号码")
|
||||
return
|
||||
}
|
||||
const res = await this.$axios.post('/platform/childManage/write/getIsRepeatByIdCard', {
|
||||
idCard: this.formData.childrenIdCard,
|
||||
id: this.formData.id
|
||||
})
|
||||
if (res.code === 0) {
|
||||
if (res.data > 0) {
|
||||
this.$message.error("该身份证在本年度已填报!")
|
||||
return true
|
||||
} else {
|
||||
this.$message.success("该身份证在本年度暂未填报!")
|
||||
return false
|
||||
}
|
||||
}
|
||||
},
|
||||
// 保存方法
|
||||
onSave() {
|
||||
this.$confirm("您确定保存吗?", "提示", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning"
|
||||
}).then(() => {
|
||||
this.$axios.post('/platform/childManage/write/save', {data: JSON.stringify(this.formData)}).then(res => {
|
||||
if (res.code === 0) {
|
||||
this.$message.success(res.msg)
|
||||
if (GetQueryString('manage') === '1') {
|
||||
window.location.href = '/platform/childManage/manage'
|
||||
}else {
|
||||
window.location.href = '/platform/childManage/mine'
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
},
|
||||
async findOne(id) {
|
||||
const resp = await $.get('/platform/childManage/write/findOne', {id})
|
||||
if (resp.code === 0) {
|
||||
return resp.data
|
||||
}
|
||||
},
|
||||
|
||||
init() {
|
||||
if (this.bizId) {
|
||||
this.findOne(this.bizId).then(async data => {
|
||||
this.formData = data
|
||||
})
|
||||
} else {
|
||||
const {id, username, loginname, mobile, union, unit} = this.$store.state.user
|
||||
this.formData = {
|
||||
userId: id,
|
||||
userName: username,
|
||||
loginName: loginname,
|
||||
unitName: unit.name,
|
||||
unitId: unit.id,
|
||||
unionName: union.name,
|
||||
unionId: union.id,
|
||||
mobile: mobile,
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.init()
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
<!--#
|
||||
}
|
||||
#-->
|
||||
Reference in New Issue
Block a user