健身卡
This commit is contained in:
+116
@@ -0,0 +1,116 @@
|
|||||||
|
package com.budwk.app.zhgh.dayofficework.exerciseCard.controller;
|
||||||
|
|
||||||
|
import cn.dev33.satoken.annotation.SaCheckLogin;
|
||||||
|
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||||
|
import cn.dev33.satoken.annotation.SaMode;
|
||||||
|
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.base.service.BaseService;
|
||||||
|
import com.budwk.app.web.commons.auth.utils.AuthUtil;
|
||||||
|
import com.budwk.app.web.commons.auth.utils.SecurityUtil;
|
||||||
|
import com.budwk.app.zhgh.dayofficework.exerciseCard.model.ExerciseCard;
|
||||||
|
import com.budwk.app.zhgh.dayofficework.exerciseCard.service.ExerciseCardService;
|
||||||
|
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.lang.Strings;
|
||||||
|
import org.nutz.mvc.annotation.At;
|
||||||
|
import org.nutz.mvc.annotation.Ok;
|
||||||
|
import org.nutz.mvc.annotation.Param;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author : hongqiwei
|
||||||
|
* @description :
|
||||||
|
* @createDate : 2025/10/13 15:00
|
||||||
|
*/
|
||||||
|
|
||||||
|
@IocBean
|
||||||
|
@At("/platform/exerciseCard/apply")
|
||||||
|
@Api("健身卡-信息填报")
|
||||||
|
@Ok("json:full")
|
||||||
|
@Slf4j
|
||||||
|
public class ExerciseCardApplyController {
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
private Dao dao;
|
||||||
|
@Inject
|
||||||
|
private BaseService baseService;
|
||||||
|
@Inject
|
||||||
|
private ExerciseCardService exerciseCardService;
|
||||||
|
|
||||||
|
@At("/index")
|
||||||
|
@Ok("beetl:/platform/zhgh/dayofficework/exerciseCard/apply/index.html")
|
||||||
|
@SaCheckPermission("exerciseCard.apply")
|
||||||
|
public void index() {
|
||||||
|
}
|
||||||
|
|
||||||
|
@At
|
||||||
|
@ApiOperation("保存申请")
|
||||||
|
@SaCheckPermission(value = {"exerciseCard.apply", "h5.exerciseCard.apply"}, mode = SaMode.OR)
|
||||||
|
@SLog(tag = "健身卡-信息填报", msg = "保存信息填报")
|
||||||
|
public Result save(@Param("data") ExerciseCard exerciseCard) {
|
||||||
|
if (StrUtil.isBlank(exerciseCard.getId())) exerciseCard.setApplyTime(new Date());
|
||||||
|
dao.insertOrUpdate(exerciseCard);
|
||||||
|
return Result.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
@At
|
||||||
|
@SaCheckLogin
|
||||||
|
public Result findOne(String id) {
|
||||||
|
return Result.success(baseService.dao().fetch(ExerciseCard.class, id));
|
||||||
|
}
|
||||||
|
|
||||||
|
@At
|
||||||
|
@ApiOperation("获取受助人")
|
||||||
|
@SaCheckPermission("exerciseCard.apply")
|
||||||
|
public Result queryUsers(String key){
|
||||||
|
Sql sql = Sqls.create("""
|
||||||
|
SELECT
|
||||||
|
id,
|
||||||
|
loginname,
|
||||||
|
username,
|
||||||
|
birthday,
|
||||||
|
mobile,
|
||||||
|
sex,
|
||||||
|
unitName,
|
||||||
|
unionName,
|
||||||
|
unionId,
|
||||||
|
unitId
|
||||||
|
FROM
|
||||||
|
`vw_user`
|
||||||
|
$condition
|
||||||
|
""");
|
||||||
|
Cnd cnd = Cnd.NEW();
|
||||||
|
|
||||||
|
if (!AuthUtil.hasRoleOr(RoleConstant.SYSADMIN.name(), RoleConstant.SCHOOL_UNION_ADMIN.name())) {
|
||||||
|
if (AuthUtil.hasRoleOr(RoleConstant.BRANCH_UNION_CHAIRMAN.name(), RoleConstant.BRANCH_UNION_ADMIN.name(), RoleConstant.BRANCH_UNION_OPERATOR.name())) {
|
||||||
|
cnd.and("unionId", "=", SecurityUtil.getUnionId());
|
||||||
|
} else {
|
||||||
|
cnd.and("id", "=", SecurityUtil.getUserId());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (Strings.isNotBlank(key)) {
|
||||||
|
SqlExpressionGroup group = new SqlExpressionGroup();
|
||||||
|
group.orLike("username", key);
|
||||||
|
group.orLike("loginname", key);
|
||||||
|
cnd.and(group);
|
||||||
|
}
|
||||||
|
sql.setCondition(cnd);
|
||||||
|
Pagination pagination = exerciseCardService.listPageMap(1, 10, sql);
|
||||||
|
return Result.success().addData(pagination.getList());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
+145
@@ -0,0 +1,145 @@
|
|||||||
|
package com.budwk.app.zhgh.dayofficework.exerciseCard.controller;
|
||||||
|
|
||||||
|
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||||
|
import cn.dev33.satoken.annotation.SaMode;
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import com.alibaba.excel.EasyExcel;
|
||||||
|
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.zhgh.dayofficework.exerciseCard.service.ExerciseCardService;
|
||||||
|
import com.budwk.app.zhgh.dayofficework.exerciseCard.vo.ExercisePeopleImportVo;
|
||||||
|
import com.budwk.app.zhgh.staffbenefit.maternityLeave.service.MaternityLeaveService;
|
||||||
|
import com.budwk.app.zhgh.staffmanage.member.vo.MemberImportVo;
|
||||||
|
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.Dao;
|
||||||
|
import org.nutz.dao.Sqls;
|
||||||
|
import org.nutz.dao.sql.Sql;
|
||||||
|
import org.nutz.dao.util.cri.SqlExpressionGroup;
|
||||||
|
import org.nutz.ioc.aop.Aop;
|
||||||
|
import org.nutz.ioc.loader.annotation.Inject;
|
||||||
|
import org.nutz.ioc.loader.annotation.IocBean;
|
||||||
|
import org.nutz.lang.Lang;
|
||||||
|
import org.nutz.lang.util.NutMap;
|
||||||
|
import org.nutz.mvc.annotation.AdaptBy;
|
||||||
|
import org.nutz.mvc.annotation.At;
|
||||||
|
import org.nutz.mvc.annotation.Ok;
|
||||||
|
import org.nutz.mvc.annotation.Param;
|
||||||
|
import org.nutz.mvc.upload.TempFile;
|
||||||
|
import org.nutz.mvc.upload.UploadAdaptor;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.net.URLEncoder;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author : hongqiwei
|
||||||
|
* @description :
|
||||||
|
* @createDate : 2025/10/13 15:11
|
||||||
|
*/
|
||||||
|
|
||||||
|
@IocBean
|
||||||
|
@At("/platform/exerciseCard/query")
|
||||||
|
@Api("查询条件")
|
||||||
|
@Ok("json:full")
|
||||||
|
@Slf4j
|
||||||
|
public class ExerciseCardQueryController {
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
private Dao dao;
|
||||||
|
@Inject
|
||||||
|
private ExerciseCardService exerciseCardService;
|
||||||
|
|
||||||
|
@At("/index")
|
||||||
|
@Ok("beetl:/platform/zhgh/dayofficework/exerciseCard/query/index.html")
|
||||||
|
@SaCheckPermission("exerciseCard.query")
|
||||||
|
public void index() {
|
||||||
|
}
|
||||||
|
|
||||||
|
@At
|
||||||
|
@ApiOperation("分页查询")
|
||||||
|
@SaCheckPermission(value = {"exerciseCard.query", "h5.exerciseCard.query"}, mode = SaMode.OR)
|
||||||
|
public Result pageData(PageForm pageForm,
|
||||||
|
Integer year,
|
||||||
|
String unionId,
|
||||||
|
String unitId,
|
||||||
|
String searchKeyword,
|
||||||
|
String sex) {
|
||||||
|
Cnd cnd = Cnd.NEW();
|
||||||
|
// 年度查询条件
|
||||||
|
cnd.andEX("year(applyTime)", "=", year);
|
||||||
|
|
||||||
|
// 姓名和工号查询条件
|
||||||
|
if (StrUtil.isNotBlank(searchKeyword)) {
|
||||||
|
SqlExpressionGroup seg = new SqlExpressionGroup();
|
||||||
|
seg.orLike("userName", "%" + searchKeyword + "%");
|
||||||
|
seg.orLike("loginName", "%" + searchKeyword + "%");
|
||||||
|
cnd.and(seg);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 工会、单位名称查询条件
|
||||||
|
cnd.andEX("unionId", "=", unionId);
|
||||||
|
cnd.andEX("unitId", "=", unitId);
|
||||||
|
|
||||||
|
// 性别查询条件
|
||||||
|
cnd.andEX("sex", "=", sex);
|
||||||
|
|
||||||
|
cnd.desc("applyTime");
|
||||||
|
Pagination pagination = exerciseCardService.listPage(pageForm.getPageNumber(), pageForm.getPageSize(), cnd);
|
||||||
|
return Result.success(pagination);
|
||||||
|
}
|
||||||
|
@At
|
||||||
|
@ApiOperation("删除")
|
||||||
|
@Aop(TransAop.READ_COMMITTED)
|
||||||
|
@SaCheckPermission(value = {"exerciseCard.query", "h5.exerciseCard.query"}, mode = SaMode.OR)
|
||||||
|
@SLog( tag = "删除工会报销", msg = "删除工会报销")
|
||||||
|
public Result delete(@Param("id") String id) {
|
||||||
|
exerciseCardService.delete(id);
|
||||||
|
return Result.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
@At
|
||||||
|
@Ok("void")
|
||||||
|
@ApiOperation("导入模板下载")
|
||||||
|
@SaCheckPermission("exerciseCard.query")
|
||||||
|
public void downloadTemplate(HttpServletResponse response) {
|
||||||
|
try {
|
||||||
|
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
|
||||||
|
response.setCharacterEncoding("utf-8");
|
||||||
|
String fileName = URLEncoder.encode("人员导入模版", "UTF-8").replaceAll("\\+", "%20");
|
||||||
|
response.setHeader("Content-disposition", "attachment;filename*=utf-8''" + fileName + ".xlsx");
|
||||||
|
EasyExcel.write(response.getOutputStream(), ExercisePeopleImportVo.class)
|
||||||
|
.sheet("人员导入模版")
|
||||||
|
.doWrite(ArrayList::new);
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new RuntimeException("导出失败");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@At
|
||||||
|
@Aop(TransAop.READ_COMMITTED)
|
||||||
|
@ApiOperation("导入人员")
|
||||||
|
@SaCheckPermission("exerciseCard.query")
|
||||||
|
@AdaptBy(type = UploadAdaptor.class, args = {"ioc:fileUpload"})
|
||||||
|
public Result importData(TempFile file, Boolean isFlag) {
|
||||||
|
try {
|
||||||
|
System.out.println(isFlag);
|
||||||
|
NutMap nutMap = exerciseCardService.handlingMemberImport(file, isFlag);
|
||||||
|
if (Lang.isNotEmpty(nutMap)) {
|
||||||
|
return Result.success(nutMap);
|
||||||
|
}
|
||||||
|
return Result.success("导入成功");
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
return Result.error();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,99 @@
|
|||||||
|
package com.budwk.app.zhgh.dayofficework.exerciseCard.model;
|
||||||
|
|
||||||
|
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 org.nutz.dao.interceptor.annotation.PrevInsert;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author : hongqiwei
|
||||||
|
* @description :
|
||||||
|
* @createDate : 2025/10/13 14:39
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@Table("exercise_card")
|
||||||
|
@TableMeta("{'mysql-charset':'utf8mb4'}")
|
||||||
|
@Comment("健身卡")
|
||||||
|
public class ExerciseCard extends BaseModel implements Serializable {
|
||||||
|
|
||||||
|
@Name
|
||||||
|
@Comment("id")
|
||||||
|
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||||
|
@PrevInsert(uu32 = true)
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
@Column
|
||||||
|
@ColDefine(type = ColType.VARCHAR,width = 32)
|
||||||
|
@Comment("userId")
|
||||||
|
private String userId;
|
||||||
|
|
||||||
|
@Column
|
||||||
|
@ColDefine(type = ColType.VARCHAR,width = 32)
|
||||||
|
@Comment("姓名")
|
||||||
|
private String userName;
|
||||||
|
|
||||||
|
@Column
|
||||||
|
@ColDefine(type = ColType.VARCHAR,width = 32)
|
||||||
|
@Comment("性别")
|
||||||
|
private String sex;
|
||||||
|
|
||||||
|
@Column
|
||||||
|
@ColDefine(type = ColType.DATE)
|
||||||
|
@Comment("出生年月")
|
||||||
|
private Date birthday;
|
||||||
|
|
||||||
|
@Column
|
||||||
|
@ColDefine(type = ColType.VARCHAR,width = 32)
|
||||||
|
@Comment("工号")
|
||||||
|
private String loginName;
|
||||||
|
|
||||||
|
@Column
|
||||||
|
@ColDefine(type = ColType.VARCHAR,width = 32)
|
||||||
|
@Comment("所在工会Id")
|
||||||
|
private String unionId;
|
||||||
|
|
||||||
|
@Column
|
||||||
|
@ColDefine(type = ColType.VARCHAR,width = 50)
|
||||||
|
@Comment("所在工会")
|
||||||
|
private String unionName;
|
||||||
|
|
||||||
|
@Column
|
||||||
|
@ColDefine(type = ColType.VARCHAR,width = 32)
|
||||||
|
@Comment("所在单位Id")
|
||||||
|
private String unitId;
|
||||||
|
|
||||||
|
@Column
|
||||||
|
@ColDefine(type = ColType.VARCHAR,width = 50)
|
||||||
|
@Comment("所在单位")
|
||||||
|
private String unitName;
|
||||||
|
|
||||||
|
@Column
|
||||||
|
@Comment("初始额度")
|
||||||
|
@ColDefine(type = ColType.FLOAT, width = 10, precision = 2)
|
||||||
|
private Double initMoney;
|
||||||
|
|
||||||
|
@Column
|
||||||
|
@Comment("当前额度")
|
||||||
|
@ColDefine(type = ColType.FLOAT, width = 10, precision = 2)
|
||||||
|
private Double money;
|
||||||
|
|
||||||
|
@Column
|
||||||
|
@Comment("健身卡使用情况记录")
|
||||||
|
@ColDefine(type = ColType.MYSQL_JSON)
|
||||||
|
private List<JSONObject> usages;
|
||||||
|
|
||||||
|
@Column
|
||||||
|
@ColDefine(type = ColType.DATETIME)
|
||||||
|
@Comment("录入时间")
|
||||||
|
private Date applyTime;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
+16
@@ -0,0 +1,16 @@
|
|||||||
|
package com.budwk.app.zhgh.dayofficework.exerciseCard.service;
|
||||||
|
|
||||||
|
import com.budwk.app.base.service.BaseService;
|
||||||
|
import com.budwk.app.zhgh.dayofficework.exerciseCard.model.ExerciseCard;
|
||||||
|
import org.nutz.lang.util.NutMap;
|
||||||
|
import org.nutz.mvc.upload.TempFile;
|
||||||
|
|
||||||
|
|
||||||
|
public interface ExerciseCardService extends BaseService<ExerciseCard> {
|
||||||
|
/**
|
||||||
|
* 导入会员数据处理
|
||||||
|
* @param file 文件
|
||||||
|
* @param isFlag 是否清空更新
|
||||||
|
*/
|
||||||
|
NutMap handlingMemberImport(TempFile file, Boolean isFlag);
|
||||||
|
}
|
||||||
+178
@@ -0,0 +1,178 @@
|
|||||||
|
package com.budwk.app.zhgh.dayofficework.exerciseCard.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.date.DateUtil;
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import cn.hutool.json.JSONUtil;
|
||||||
|
import com.budwk.app.base.service.impl.BaseServiceImpl;
|
||||||
|
import com.budwk.app.base.utils.EasyExcelUtil;
|
||||||
|
import com.budwk.app.base.utils.ManyAddOrRenewUtil;
|
||||||
|
import com.budwk.app.sys.models.Sys_user;
|
||||||
|
import com.budwk.app.zhgh.dayofficework.exerciseCard.model.ExerciseCard;
|
||||||
|
import com.budwk.app.zhgh.dayofficework.exerciseCard.service.ExerciseCardService;
|
||||||
|
import com.budwk.app.zhgh.dayofficework.exerciseCard.vo.ExercisePeopleImportVo;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.poi.ss.formula.functions.T;
|
||||||
|
import org.nutz.aop.interceptor.ioc.TransAop;
|
||||||
|
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.aop.Aop;
|
||||||
|
import org.nutz.ioc.loader.annotation.Inject;
|
||||||
|
import org.nutz.ioc.loader.annotation.IocBean;
|
||||||
|
import org.nutz.lang.Lang;
|
||||||
|
import org.nutz.lang.random.R;
|
||||||
|
import org.nutz.lang.util.NutMap;
|
||||||
|
import org.nutz.mvc.upload.TempFile;
|
||||||
|
import org.nutz.dao.entity.Record;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author : hongqiwei
|
||||||
|
* @description :
|
||||||
|
* @createDate : 2025/10/13 15:19
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
@IocBean(args = {"refer:dao"})
|
||||||
|
public class ExerciseCardServiceImpl extends BaseServiceImpl<ExerciseCard> implements ExerciseCardService {
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
private ManyAddOrRenewUtil manyAddOrRenewUtil;
|
||||||
|
|
||||||
|
public ExerciseCardServiceImpl(Dao dao) {super(dao);}
|
||||||
|
|
||||||
|
@Aop(TransAop.READ_COMMITTED)
|
||||||
|
@Override
|
||||||
|
public NutMap handlingMemberImport(TempFile file, Boolean isFlag) {
|
||||||
|
List<T> ts = EasyExcelUtil.syncReadModel(file.getFile(), ExercisePeopleImportVo.class, 0, 1);
|
||||||
|
List<ExercisePeopleImportVo> list = JSONUtil.parseArray(JSONUtil.toJsonStr(ts)).toList(ExercisePeopleImportVo.class);
|
||||||
|
|
||||||
|
// 获取系统用户
|
||||||
|
Cnd cnd = Cnd.NEW();
|
||||||
|
List<Sys_user> dataUserList = dao().query(Sys_user.class, cnd);
|
||||||
|
Map<String, Sys_user> userMap = dataUserList.stream().collect(Collectors.toMap(Sys_user::getLoginname, v -> v));
|
||||||
|
|
||||||
|
Sql vwUserSql = Sqls.create("""
|
||||||
|
SELECT
|
||||||
|
id,
|
||||||
|
loginname,
|
||||||
|
username,
|
||||||
|
birthday,
|
||||||
|
mobile,
|
||||||
|
sex,
|
||||||
|
unitName,
|
||||||
|
unionName,
|
||||||
|
unionId,
|
||||||
|
unitId
|
||||||
|
FROM
|
||||||
|
`vw_user`
|
||||||
|
""");
|
||||||
|
vwUserSql.setCallback(Sqls.callback.records());
|
||||||
|
dao().execute(vwUserSql);
|
||||||
|
List<Record> vwUserList = vwUserSql.getList(Record.class);
|
||||||
|
Map<String, Record> vwUserMap = vwUserList.stream().collect(Collectors.toMap(r -> r.getString("loginname"), r -> r));
|
||||||
|
|
||||||
|
List<ExerciseCard> exerciseCardList = new ArrayList<>();
|
||||||
|
List<Sys_user> insertOrUpdateUserList = new ArrayList<>();
|
||||||
|
|
||||||
|
//返回错误记录
|
||||||
|
List<ExercisePeopleImportVo> errorInfos = new ArrayList<>();
|
||||||
|
|
||||||
|
for (ExercisePeopleImportVo v : list) {
|
||||||
|
if (StrUtil.isNotBlank(v.getLoginName())) {
|
||||||
|
v.setLoginName(v.getLoginName().trim());
|
||||||
|
} else {
|
||||||
|
v.setErrorInfo("工号不能为空!");
|
||||||
|
errorInfos.add(v);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
//判断是否在系统中
|
||||||
|
Sys_user user = userMap.get(v.getLoginName());
|
||||||
|
|
||||||
|
if (user == null) {
|
||||||
|
v.setErrorInfo("该人员没有录入系统中!");
|
||||||
|
errorInfos.add(v);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
//设置excel列的数据
|
||||||
|
user.setUsername(v.getUsername());
|
||||||
|
if (StrUtil.isNotBlank(v.getSex())) {
|
||||||
|
user.setSex(v.getSex());
|
||||||
|
}
|
||||||
|
|
||||||
|
insertOrUpdateUserList.add(user);
|
||||||
|
|
||||||
|
// 创建运动卡记录并设置用户详细信息
|
||||||
|
ExerciseCard exerciseCard = new ExerciseCard();
|
||||||
|
exerciseCard.setId(R.UU32());
|
||||||
|
|
||||||
|
// 根据工号查询vw_user视图,设置人员信息
|
||||||
|
Record vwUser = vwUserMap.get(v.getLoginName());
|
||||||
|
if (vwUser != null) {
|
||||||
|
exerciseCard.setUserId(vwUser.getString("id"));
|
||||||
|
exerciseCard.setBirthday(DateUtil.parse(vwUser.getString("birthday"), "yyyy-MM-dd"));
|
||||||
|
exerciseCard.setUnionId(vwUser.getString("unionId"));
|
||||||
|
exerciseCard.setUnitId(vwUser.getString("unitId"));
|
||||||
|
exerciseCard.setSex(vwUser.getString("sex"));
|
||||||
|
exerciseCard.setUnionName(vwUser.getString("unionName"));
|
||||||
|
exerciseCard.setUnitName(vwUser.getString("unitName"));
|
||||||
|
}
|
||||||
|
|
||||||
|
// 设置其他基本信息
|
||||||
|
exerciseCard.setLoginName(v.getLoginName());
|
||||||
|
exerciseCard.setUserName(v.getUsername());
|
||||||
|
exerciseCard.setApplyTime(new Date()); // 设置当前时间为申请时间
|
||||||
|
|
||||||
|
// 设置额度信息
|
||||||
|
if (v.getInitMoney() != null) {
|
||||||
|
try {
|
||||||
|
exerciseCard.setInitMoney(Double.valueOf(v.getInitMoney()));
|
||||||
|
} catch (NumberFormatException e) {
|
||||||
|
v.setErrorInfo("初始额度格式错误!");
|
||||||
|
errorInfos.add(v);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (v.getMoney() != null) {
|
||||||
|
try {
|
||||||
|
exerciseCard.setMoney(Double.valueOf(v.getMoney()));
|
||||||
|
} catch (NumberFormatException e) {
|
||||||
|
v.setErrorInfo("当前额度格式错误!");
|
||||||
|
errorInfos.add(v);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
exerciseCardList.add(exerciseCard);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Lang.isNotEmpty(insertOrUpdateUserList)) {
|
||||||
|
manyAddOrRenewUtil.asyncExecuteInsertOrUpdate(insertOrUpdateUserList,200);
|
||||||
|
|
||||||
|
// 批量保存运动卡记录
|
||||||
|
if (Lang.isNotEmpty(exerciseCardList)) {
|
||||||
|
manyAddOrRenewUtil.asyncExecuteInsert(exerciseCardList,200);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//如果有错误数据就返回给前端
|
||||||
|
if (Lang.isNotEmpty(errorInfos)) {
|
||||||
|
NutMap nutMap = NutMap.NEW();
|
||||||
|
nutMap.setv("totalCount", list.size());
|
||||||
|
nutMap.setv("successCount", Math.max(list.size() - errorInfos.size(), 0));
|
||||||
|
nutMap.setv("errorCount", errorInfos.size());
|
||||||
|
nutMap.setv("errorList", errorInfos.stream().map(v -> {
|
||||||
|
return NutMap.NEW().addv("工号", v.getLoginName()).addv("姓名", v.getUsername()).addv("错误原因", v.getErrorInfo());
|
||||||
|
}).collect(Collectors.toList()));
|
||||||
|
return nutMap;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
+50
@@ -0,0 +1,50 @@
|
|||||||
|
package com.budwk.app.zhgh.dayofficework.exerciseCard.vo;
|
||||||
|
|
||||||
|
import com.alibaba.excel.annotation.ExcelIgnore;
|
||||||
|
import com.alibaba.excel.annotation.ExcelProperty;
|
||||||
|
import com.alibaba.excel.annotation.write.style.ColumnWidth;
|
||||||
|
import com.alibaba.excel.annotation.write.style.ContentRowHeight;
|
||||||
|
import com.alibaba.excel.annotation.write.style.HeadRowHeight;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @version 1.0
|
||||||
|
* @Author hongqiwei
|
||||||
|
* @name:ExercisePeopleImportVo
|
||||||
|
* @Date 2025/10/14 10:04
|
||||||
|
* @注释
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode
|
||||||
|
@ContentRowHeight(20) // 内容行高
|
||||||
|
@HeadRowHeight(20) // 表头行高
|
||||||
|
@ColumnWidth(25) //列宽
|
||||||
|
public class ExercisePeopleImportVo {
|
||||||
|
|
||||||
|
@ExcelProperty("工号")
|
||||||
|
private String loginName;
|
||||||
|
|
||||||
|
@ExcelProperty("姓名")
|
||||||
|
private String username;
|
||||||
|
|
||||||
|
@ExcelProperty("性别")
|
||||||
|
private String sex;
|
||||||
|
|
||||||
|
@ExcelProperty("工会")
|
||||||
|
private String unionName;
|
||||||
|
|
||||||
|
@ExcelProperty("单位")
|
||||||
|
private String unitName;
|
||||||
|
|
||||||
|
@ExcelProperty("初始额度")
|
||||||
|
private Double initMoney;
|
||||||
|
|
||||||
|
@ExcelProperty("当前额度")
|
||||||
|
private Double money;
|
||||||
|
|
||||||
|
|
||||||
|
@ExcelIgnore
|
||||||
|
private String errorInfo;
|
||||||
|
|
||||||
|
}
|
||||||
+1
-1
@@ -67,7 +67,7 @@ public class MaternityLeaveCollectController {
|
|||||||
|
|
||||||
@At
|
@At
|
||||||
@ApiOperation("分页查询")
|
@ApiOperation("分页查询")
|
||||||
@SaCheckPermission(value = {"unionReimburse.collect", "h5.unionReimburse.collect"}, mode = SaMode.OR)
|
@SaCheckPermission(value = {"maternityLeave.collect", "h5.maternityLeave.collect"}, mode = SaMode.OR)
|
||||||
public Result pageData(PageForm pageForm,
|
public Result pageData(PageForm pageForm,
|
||||||
Integer year,
|
Integer year,
|
||||||
String unionId,
|
String unionId,
|
||||||
|
|||||||
+3
-1
@@ -49,7 +49,7 @@ layout("/layouts/platform.html"){
|
|||||||
<el-option
|
<el-option
|
||||||
v-for="item in clubList"
|
v-for="item in clubList"
|
||||||
:key="item.id"
|
:key="item.id"
|
||||||
:label="item.name"
|
:label="item.clubName"
|
||||||
:value="item.id">
|
:value="item.id">
|
||||||
</el-option>
|
</el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
@@ -317,6 +317,8 @@ layout("/layouts/platform.html"){
|
|||||||
},
|
},
|
||||||
async created() {
|
async created() {
|
||||||
this.init()
|
this.init()
|
||||||
|
//社团查询
|
||||||
|
this.$businessTool.listCLubByRole().then((res) => (this.clubList = res))
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -0,0 +1,325 @@
|
|||||||
|
<!--#
|
||||||
|
layout("/layouts/platform.html"){
|
||||||
|
#-->
|
||||||
|
<div id="app" v-cloak>
|
||||||
|
<el-card shadow="never">
|
||||||
|
<h3 style="color: var(--color-primary)" slot="header">信息填报</h3>
|
||||||
|
<el-form :model="formData" ref="formRef" :rules="formRules" label-width="0" label-suffix=":" class="flow-task-form">
|
||||||
|
<el-descriptions :column="3" border>
|
||||||
|
<el-descriptions-item label="职工姓名">
|
||||||
|
<el-form-item prop="userId">
|
||||||
|
<el-select :remote-method="queryUsers"
|
||||||
|
@change="userChange"
|
||||||
|
clearable
|
||||||
|
filterable
|
||||||
|
remote
|
||||||
|
placeholder="输入工号或者姓名查找"
|
||||||
|
style="width: 100%"
|
||||||
|
v-model="selectedUserId">
|
||||||
|
<el-option :key="o.id"
|
||||||
|
:label="o.username+'('+o.loginname+')'"
|
||||||
|
:value="o.id"
|
||||||
|
v-for="o in userList"></el-option>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="工号">
|
||||||
|
<el-form-item prop="loginName">
|
||||||
|
<el-input v-model="formData.loginName" readonly size="small"></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="性别">
|
||||||
|
<el-form-item prop="sex">
|
||||||
|
<el-input v-model="formData.sex" readonly size="small"></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
</el-descriptions-item>
|
||||||
|
|
||||||
|
<el-descriptions-item label="出生年月">
|
||||||
|
<el-form-item prop="birthday">
|
||||||
|
<el-input :value="formatDate(formData.birthday)" readonly size="small"></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="工会">
|
||||||
|
<el-form-item prop="unionName">
|
||||||
|
<el-input v-model="formData.unionName" readonly size="small"></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="单位">
|
||||||
|
<el-form-item prop="unitName">
|
||||||
|
<el-input v-model="formData.unitName" readonly size="small"></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
</el-descriptions-item>
|
||||||
|
|
||||||
|
<el-descriptions-item label="初始额度">
|
||||||
|
<el-form-item prop="initMoney">
|
||||||
|
<el-input v-model="formData.initMoney" readonly size="small"></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="剩余额度" :span="2">
|
||||||
|
<el-form-item prop="money">
|
||||||
|
<el-input v-model="formData.money" readonly size="small"></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
</el-descriptions-item>
|
||||||
|
|
||||||
|
<el-descriptions-item label="健身卡使用情况记录" :span="3">
|
||||||
|
<el-form-item prop="usages">
|
||||||
|
<el-table :data="formData.usages" border size="small">
|
||||||
|
<el-table-column label="使用时间" prop="useTime" >
|
||||||
|
<template slot-scope="{row}">
|
||||||
|
<el-date-picker
|
||||||
|
v-model="row.useTime"
|
||||||
|
type="datetime"
|
||||||
|
value-format="yyyy-MM-dd HH:mm:ss"
|
||||||
|
placeholder="请选择使用时间"
|
||||||
|
style="width: 100%">
|
||||||
|
</el-date-picker>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="使用地点" prop="place">
|
||||||
|
<template slot-scope="{row}">
|
||||||
|
<el-input v-model="row.place" maxlength="100"
|
||||||
|
placeholder="请输入使用地点"></el-input>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="使用项目" prop="project">
|
||||||
|
<template slot-scope="{row}">
|
||||||
|
<el-input v-model="row.project" maxlength="100" placeholder="请输入使用项目"></el-input>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="花费额度" prop="useMoney" >
|
||||||
|
<template slot-scope="{row}">
|
||||||
|
<el-input v-model="row.useMoney" maxlength="10" placeholder="请输入花费额度"></el-input>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="操作" width="100">
|
||||||
|
<template slot="header">
|
||||||
|
<el-button type="primary" size="mini" @click="addUsage">添加</el-button>
|
||||||
|
</template>
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-button
|
||||||
|
type="danger"
|
||||||
|
icon="el-icon-delete"
|
||||||
|
size="mini"
|
||||||
|
@click="removeUsage(scope.$index)">
|
||||||
|
</el-button>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
</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: [],
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
bizId: GetQueryString("bizId"),
|
||||||
|
formData: {
|
||||||
|
usages: []
|
||||||
|
},
|
||||||
|
userList: [],
|
||||||
|
selectedUserId: '',
|
||||||
|
formRules: {
|
||||||
|
userId: [{ required: true, message: '请选择职工', trigger: 'change' }],
|
||||||
|
userName: [{ required: true, message: '职工姓名不能为空', trigger: 'blur' }],
|
||||||
|
sex: [{ required: true, message: '性别不能为空', trigger: 'blur' }],
|
||||||
|
birthday: [{ required: true, message: '出生年月不能为空', trigger: 'blur' }],
|
||||||
|
unionName: [{ required: true, message: '工会单位不能为空', trigger: 'blur' }],
|
||||||
|
unitName: [{ required: true, message: '单位不能为空', trigger: 'blur' }],
|
||||||
|
initMoney: [{ required: true, message: '初始额度不能为空', trigger: 'blur' }],
|
||||||
|
},
|
||||||
|
}
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
// 监听formData.usages的变化,实时计算剩余额度
|
||||||
|
'formData.usages': {
|
||||||
|
handler(newVal) {
|
||||||
|
this.calculateRemainingMoney();
|
||||||
|
},
|
||||||
|
deep: true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
methods: {
|
||||||
|
// 添加使用记录方法
|
||||||
|
addUsage() {
|
||||||
|
if (!this.formData.usages) {
|
||||||
|
this.$set(this.formData, 'usages', []);
|
||||||
|
}
|
||||||
|
this.formData.usages.push({
|
||||||
|
useTime: '',
|
||||||
|
place: '',
|
||||||
|
project: '',
|
||||||
|
useMoney: ''
|
||||||
|
});
|
||||||
|
},
|
||||||
|
// 删除使用记录方法
|
||||||
|
removeUsage(index) {
|
||||||
|
if (this.formData.usages && this.formData.usages.length > 0) {
|
||||||
|
this.formData.usages.splice(index, 1);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
// 计算剩余额度
|
||||||
|
calculateRemainingMoney() {
|
||||||
|
if (this.formData.initMoney) {
|
||||||
|
const totalUsed = this.formData.usages.reduce((sum, usage) => {
|
||||||
|
const useMoney = parseFloat(usage.useMoney) || 0;
|
||||||
|
return sum + useMoney;
|
||||||
|
}, 0);
|
||||||
|
this.$set(this.formData, 'money', this.formData.initMoney - totalUsed);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// 检查额度是否足够
|
||||||
|
checkBalance() {
|
||||||
|
if (this.formData.money < 0) {
|
||||||
|
this.$message.error('余额不足!');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
},
|
||||||
|
// 查询用户
|
||||||
|
queryUsers(key) {
|
||||||
|
if (!key) return;
|
||||||
|
this.$axios.get("/platform/exerciseCard/apply/queryUsers", {
|
||||||
|
params: { key }
|
||||||
|
}).then(res => {
|
||||||
|
if (res.code === 0) {
|
||||||
|
this.userList = res.data;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
// 用户选择变化
|
||||||
|
userChange(userId) {
|
||||||
|
const user = this.userList.find(item => item.id === userId);
|
||||||
|
this.selectedUserId = userId;
|
||||||
|
if (user) {
|
||||||
|
this.$set(this.formData, 'userId', user.id);
|
||||||
|
this.$set(this.formData, 'userName', user.username);
|
||||||
|
this.$set(this.formData, 'loginName', user.loginname);
|
||||||
|
this.$set(this.formData, 'sex', user.sex);
|
||||||
|
this.$set(this.formData, 'unitId', user.unitId);
|
||||||
|
this.$set(this.formData, 'unitName', user.unitName);
|
||||||
|
this.$set(this.formData, 'unionId', user.unionId);
|
||||||
|
this.$set(this.formData, 'unionName', user.unionName);
|
||||||
|
this.$set(this.formData, 'birthday', user.birthday);
|
||||||
|
this.$set(this.formData, 'initMoney', 300);
|
||||||
|
this.$set(this.formData, 'money', 300);
|
||||||
|
} else {
|
||||||
|
// 清空表单数据
|
||||||
|
this.$set(this.formData, 'userId', null);
|
||||||
|
this.$set(this.formData, 'userName', null);
|
||||||
|
this.$set(this.formData, 'loginName', null);
|
||||||
|
this.$set(this.formData, 'sex', null);
|
||||||
|
this.$set(this.formData, 'unitId', null);
|
||||||
|
this.$set(this.formData, 'unitName', null);
|
||||||
|
this.$set(this.formData, 'unionId', null);
|
||||||
|
this.$set(this.formData, 'unionName', null);
|
||||||
|
this.$set(this.formData, 'birthday', null);
|
||||||
|
this.$set(this.formData, 'initMoney', null);
|
||||||
|
this.$set(this.formData, 'money', null);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
// 添加日期格式化方法
|
||||||
|
formatDate(date) {
|
||||||
|
if (!date) return '';
|
||||||
|
// 如果已经是 yyyy-MM-dd 格式,直接返回
|
||||||
|
if (typeof date === 'string' && /^\d{4}-\d{2}-\d{2}/.test(date)) {
|
||||||
|
// 如果包含时间,只取日期部分
|
||||||
|
if (date.length > 10) {
|
||||||
|
return date.substring(0, 10);
|
||||||
|
}
|
||||||
|
return date;
|
||||||
|
}
|
||||||
|
// 否则转换为 yyyy-MM-dd 格式
|
||||||
|
try {
|
||||||
|
const d = new Date(date);
|
||||||
|
if (isNaN(d.getTime())) {
|
||||||
|
return date;
|
||||||
|
}
|
||||||
|
const year = d.getFullYear();
|
||||||
|
const month = String(d.getMonth() + 1).padStart(2, '0');
|
||||||
|
const day = String(d.getDate()).padStart(2, '0');
|
||||||
|
return year + '-' + month + '-' + day;
|
||||||
|
} catch (e) {
|
||||||
|
return date;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
// 保存
|
||||||
|
onSave() {
|
||||||
|
if (!this.checkBalance()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.$confirm("您确定保存吗?", "提示", {
|
||||||
|
confirmButtonText: "确定",
|
||||||
|
cancelButtonText: "取消",
|
||||||
|
type: "warning"
|
||||||
|
}).then(() => {
|
||||||
|
this.$axios.post('/platform/exerciseCard/apply/save', {data: JSON.stringify(this.formData)}).then(res => {
|
||||||
|
if (res.code === 0) {
|
||||||
|
this.$message.success(res.msg)
|
||||||
|
commonUtil.pjaxPush('/platform/exerciseCard/query/index')
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
// 提交验证
|
||||||
|
validateBeforeSubmit() {
|
||||||
|
return new Promise((resolve) => {
|
||||||
|
this.$refs.formRef.validate((valid) => {
|
||||||
|
if (valid) {
|
||||||
|
resolve(true);
|
||||||
|
} else {
|
||||||
|
this.$message.error('请完善表单信息并勾选申报理由');
|
||||||
|
resolve(false);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
async findOne(id) {
|
||||||
|
const resp = await $.get('/platform/exerciseCard/apply/findOne', {id})
|
||||||
|
if (resp.code === 0) {
|
||||||
|
return resp.data
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
init() {
|
||||||
|
if (this.bizId) {
|
||||||
|
this.findOne(this.bizId).then(async data => {
|
||||||
|
this.formData = data || {}
|
||||||
|
// 设置选中的用户ID
|
||||||
|
if (data && data.userId) {
|
||||||
|
this.selectedUserId = data.userId;
|
||||||
|
if (data.loginName) {
|
||||||
|
this.queryUsers(data.loginName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
this.init();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<!--#
|
||||||
|
}
|
||||||
|
#-->
|
||||||
@@ -0,0 +1,85 @@
|
|||||||
|
const EXERCISECARD_INFO = {
|
||||||
|
template: /*language=HTML*/ `
|
||||||
|
<div>
|
||||||
|
<table-tool label="人员信息"></table-tool>
|
||||||
|
<el-descriptions :column="3" border class="flow-task-form">
|
||||||
|
<el-descriptions-item label="工号">{{viewData.loginName}}</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="职工姓名">{{viewData.userName}}</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="性别">{{viewData.sex}}</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="出生年月">{{formatDate(viewData.birthday)}}</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="工会">{{viewData.unionName}}</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="单位">{{viewData.unitName}}</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="初始额度">{{viewData.initMoney}}</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="当前额度" :span="2">{{viewData.money}}</el-descriptions-item>
|
||||||
|
|
||||||
|
<el-descriptions-item label="健身卡使用情况记录" :span="3">
|
||||||
|
<el-table :data="viewData.usages" border size="small">
|
||||||
|
<el-table-column label="使用时间" prop="useTime"></el-table-column>
|
||||||
|
<el-table-column label="使用地点" prop="place"></el-table-column>
|
||||||
|
<el-table-column label="使用项目" prop="project"></el-table-column>
|
||||||
|
<el-table-column label="花费额度" prop="useMoney"></el-table-column>
|
||||||
|
</el-table>
|
||||||
|
</el-descriptions-item>
|
||||||
|
</el-descriptions>
|
||||||
|
<slot></slot>
|
||||||
|
</div>
|
||||||
|
`,
|
||||||
|
store,
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
visible: false,
|
||||||
|
viewData: {
|
||||||
|
usages: [] // 初始化使用记录数组
|
||||||
|
},
|
||||||
|
doneTasks: [],
|
||||||
|
row: null
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
// 添加日期格式化方法
|
||||||
|
formatDate(date) {
|
||||||
|
if (!date) return '';
|
||||||
|
// 如果已经是 yyyy-MM-dd 格式,直接返回
|
||||||
|
if (typeof date === 'string' && /^\d{4}-\d{2}-\d{2}/.test(date)) {
|
||||||
|
// 如果包含时间,只取日期部分
|
||||||
|
if (date.length > 10) {
|
||||||
|
return date.substring(0, 10);
|
||||||
|
}
|
||||||
|
return date;
|
||||||
|
}
|
||||||
|
// 否则转换为 yyyy-MM-dd 格式
|
||||||
|
try {
|
||||||
|
const d = new Date(date);
|
||||||
|
if (isNaN(d.getTime())) {
|
||||||
|
return date;
|
||||||
|
}
|
||||||
|
const year = d.getFullYear();
|
||||||
|
const month = String(d.getMonth() + 1).padStart(2, '0');
|
||||||
|
const day = String(d.getDate()).padStart(2, '0');
|
||||||
|
return year + '-' + month + '-' + day;
|
||||||
|
} catch (e) {
|
||||||
|
return date;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
// 打开
|
||||||
|
onOpen(row) {
|
||||||
|
this.row = row
|
||||||
|
this.visible = true
|
||||||
|
this.getInfo()
|
||||||
|
},
|
||||||
|
|
||||||
|
// 获取申请信息
|
||||||
|
getInfo() {
|
||||||
|
this.$axios.post('/platform/exerciseCard/apply/findOne', {id: this.row.id}).then((res) => {
|
||||||
|
if (res.code === 0) {
|
||||||
|
this.viewData = res.data || {}
|
||||||
|
// 确保usages字段存在
|
||||||
|
if (!this.viewData.usages) {
|
||||||
|
this.$set(this.viewData, 'usages', [])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,153 @@
|
|||||||
|
<!--#
|
||||||
|
layout("/layouts/platform.html"){
|
||||||
|
#-->
|
||||||
|
<div id="app">
|
||||||
|
<guava ref="guava">
|
||||||
|
<el-card shadow="never">
|
||||||
|
<search @search="doSearch">
|
||||||
|
<search-item label="年度">
|
||||||
|
<el-date-picker v-model="pageForm.year" type="year" value-format="yyyy" placeholder="年度"
|
||||||
|
style="width: 100%"></el-date-picker>
|
||||||
|
</search-item>
|
||||||
|
<search-item label="姓名/工号">
|
||||||
|
<el-input placeholder="请输入姓名或工号查询" clearable v-model="pageForm.searchKeyword"></el-input>
|
||||||
|
</search-item>
|
||||||
|
<search-item label="性别">
|
||||||
|
<el-select v-model="pageForm.sex" placeholder="请选择性别" clearable style="width: 100%">
|
||||||
|
<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" @change="doSearch" style="width: 100%"
|
||||||
|
placeholder="请选择分工会" clearable>
|
||||||
|
<el-option v-for="item in unionOptions"
|
||||||
|
:value="item.id"
|
||||||
|
:key="item.id"
|
||||||
|
:label="item.name"
|
||||||
|
></el-option>
|
||||||
|
</el-select>
|
||||||
|
</search-item>
|
||||||
|
<search-item label="单位">
|
||||||
|
<el-select v-model="pageForm.unitId" @change="doSearch" style="width: 100%"
|
||||||
|
placeholder="请选择单位" clearable>
|
||||||
|
<el-option v-for="item in unitOptions"
|
||||||
|
:value="item.id"
|
||||||
|
:key="item.id"
|
||||||
|
:label="item.name"
|
||||||
|
></el-option>
|
||||||
|
</el-select>
|
||||||
|
</search-item>
|
||||||
|
</search>
|
||||||
|
</el-card>
|
||||||
|
<el-card shadow="never">
|
||||||
|
<table-tool>
|
||||||
|
<el-button type="primary" size="small" icon="el-icon-upload2" @click="openImport">导入人员</el-button>
|
||||||
|
</table-tool>
|
||||||
|
<el-table :data="tableData" @sort-change="pageOrder" style="width: 100%">
|
||||||
|
<el-table-column type="index" width="50px" label="序号" :index="indexMethod"></el-table-column>
|
||||||
|
<el-table-column prop="loginName" label="工号"></el-table-column>
|
||||||
|
<el-table-column prop="userName" label="职工姓名"></el-table-column>
|
||||||
|
<el-table-column prop="sex" label="性别"></el-table-column>
|
||||||
|
<el-table-column prop="unionName" label="所属工会"></el-table-column>
|
||||||
|
<el-table-column prop="unitName" label="所属单位"></el-table-column>
|
||||||
|
<el-table-column prop="initMoney" label="初始额度"></el-table-column>
|
||||||
|
<el-table-column prop="money" label="剩余额度"></el-table-column>
|
||||||
|
<el-table-column prop="applyTime" label="录入时间"></el-table-column>
|
||||||
|
|
||||||
|
<el-table-column label="操作" fixed="right" width="300px">
|
||||||
|
<template slot-scope="{row}">
|
||||||
|
<el-button @click="onView(row)" size="mini" type="primary">查看</el-button>
|
||||||
|
<el-button @click="onEdit(row)" size="mini" type="primary">编辑</el-button>
|
||||||
|
<el-button v-if="$auth.hasRole('SYSADMIN')" @click="onDelete(row.id)" size="mini" type="danger">删除</el-button>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
|
||||||
|
<el-dialog title="人员导入" :visible.sync="importDialog" width="50%" :close-on-click-modal="false" :close-on-press-escape="false">
|
||||||
|
<file-import
|
||||||
|
ref="viewImport"
|
||||||
|
temp_url="/platform/exerciseCard/query/downloadTemplate"
|
||||||
|
post_url="/platform/exerciseCard/query/importData"
|
||||||
|
@flush="successImport"
|
||||||
|
></file-import>
|
||||||
|
</el-dialog>
|
||||||
|
<!--#include("/layouts/pagination.html"){}#-->
|
||||||
|
</el-card>
|
||||||
|
<template #view>
|
||||||
|
<exercise-card-info ref="exerciseCardInfoRef"></exercise-card-info>
|
||||||
|
</template>
|
||||||
|
</guava>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<script>
|
||||||
|
<!--#include('../common/info.js'){}#-->
|
||||||
|
new Vue({
|
||||||
|
el: "#app",
|
||||||
|
store,
|
||||||
|
//分页数据
|
||||||
|
mixins: [initTableMixins],
|
||||||
|
components: {
|
||||||
|
"exercise-card-info": EXERCISECARD_INFO
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
pageDataUrl: "/platform/exerciseCard/query/pageData",
|
||||||
|
unionOptions: [],
|
||||||
|
unitOptions: [],
|
||||||
|
userOptions: [],
|
||||||
|
importDialog: false,
|
||||||
|
checkedFields: []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
components: {
|
||||||
|
"exercise-card-info": EXERCISECARD_INFO,
|
||||||
|
"file-import": httpVueLoader("/components/plugins/sysImport/index.vue?v=" + new Date().getTime())
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
openImport() {
|
||||||
|
this.importDialog = true
|
||||||
|
},
|
||||||
|
successImport() {
|
||||||
|
this.importDialog = false
|
||||||
|
this.pageData()
|
||||||
|
},
|
||||||
|
onView(row) {
|
||||||
|
this.$refs.guava.view(()=>{
|
||||||
|
this.$refs.exerciseCardInfoRef.onOpen(row)
|
||||||
|
})
|
||||||
|
},
|
||||||
|
onEdit(row) {
|
||||||
|
commonUtil.pjaxPush('/platform/exerciseCard/apply/index', { bizId: row.id})
|
||||||
|
},
|
||||||
|
onDelete(id) {
|
||||||
|
this.$confirm("您确定要删除吗?", "提示", {
|
||||||
|
confirmButtonText: "确定",
|
||||||
|
cancelButtonText: "取消",
|
||||||
|
type: "warning"
|
||||||
|
}).then(() => {
|
||||||
|
this.$axios.post("/platform/exerciseCard/query/delete", {id}).then((res) => {
|
||||||
|
if (res.code === 0) {
|
||||||
|
this.$message.success(res.msg)
|
||||||
|
this.pageData()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
this.pageData()
|
||||||
|
//工会查询
|
||||||
|
this.$businessTool.listUnion().then((res) => (this.unionOptions = res))
|
||||||
|
//单位查询
|
||||||
|
this.$businessTool.listUnit().then((res) => (this.unitOptions = res))
|
||||||
|
}
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<!--#
|
||||||
|
}
|
||||||
|
#-->
|
||||||
+1
-1
@@ -5,7 +5,7 @@ layout("/layouts/platform.html"){
|
|||||||
<guava ref="guava">
|
<guava ref="guava">
|
||||||
<template>
|
<template>
|
||||||
<el-card shadow="never">
|
<el-card shadow="never">
|
||||||
<snaker-start slot="header" label="省级互助保障" define_key="SJHZBZ" ></snaker-start>
|
<h3 style="color: var(--color-primary)" slot="header">省级互助保障</h3>
|
||||||
<el-form :model="formData" ref="formRef" :rules="formRules" label-width="140px" label-position="right"
|
<el-form :model="formData" ref="formRef" :rules="formRules" label-width="140px" label-position="right"
|
||||||
label-suffix=":">
|
label-suffix=":">
|
||||||
<el-row :gutter="20">
|
<el-row :gutter="20">
|
||||||
|
|||||||
@@ -1,10 +1,6 @@
|
|||||||
const userInfo = {
|
const userInfo = {
|
||||||
template: /*language=HTML*/ `
|
template: /*language=HTML*/ `
|
||||||
<div>
|
<div>
|
||||||
<div class="process-title">
|
|
||||||
申请信息
|
|
||||||
<el-link type="primary" @click="openChart">点击查看流程图</el-link>
|
|
||||||
</div>
|
|
||||||
<table-tool label="人员信息"></table-tool>
|
<table-tool label="人员信息"></table-tool>
|
||||||
<el-descriptions :column="2" border class="flow-task-form">
|
<el-descriptions :column="2" border class="flow-task-form">
|
||||||
<el-descriptions-item label="所属事项">{{viewData.projectName}}</el-descriptions-item>
|
<el-descriptions-item label="所属事项">{{viewData.projectName}}</el-descriptions-item>
|
||||||
|
|||||||
@@ -1,10 +1,7 @@
|
|||||||
const childManageInfo = {
|
const childManageInfo = {
|
||||||
template: /*language=HTML*/ `
|
template: /*language=HTML*/ `
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<div class="process-title">
|
<table-tool label="子女信息"></table-tool>
|
||||||
子女信息
|
|
||||||
</div>
|
|
||||||
<el-descriptions :column="3" border>
|
<el-descriptions :column="3" border>
|
||||||
<el-descriptions-item label="就读年级">
|
<el-descriptions-item label="就读年级">
|
||||||
<dict-tag :options="dict.type.CHILD_MANAGE_GRADE"
|
<dict-tag :options="dict.type.CHILD_MANAGE_GRADE"
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ layout("/layouts/platform.html"){
|
|||||||
|
|
||||||
<div id="app" v-cloak>
|
<div id="app" v-cloak>
|
||||||
<el-card shadow="never">
|
<el-card shadow="never">
|
||||||
<snaker-start slot="header" label="信息填报" define_key="XXTB"></snaker-start>
|
<h3 style="color: var(--color-primary)" slot="header">信息填报</h3>
|
||||||
<el-form :model="formData" ref="formRef" :rules="formRules" label-width="0" label-suffix=":"
|
<el-form :model="formData" ref="formRef" :rules="formRules" label-width="0" label-suffix=":"
|
||||||
class="flow-task-form">
|
class="flow-task-form">
|
||||||
<table-tool label="子女信息"></table-tool>
|
<table-tool label="子女信息"></table-tool>
|
||||||
|
|||||||
Reference in New Issue
Block a user