26 changed files with 172 additions and 147 deletions
@@ -57,6 +57,8 @@ public class SysV4ServController {
$condition $condition
"""); """);
Cnd cnd = Cnd.NEW(); Cnd cnd = Cnd.NEW();
// 先取每个流程的最新定义,再判断是否启用,避免最新版本停用后回退展示旧版本。
cnd.and("t.state", "=", 1);
if (StrUtil.isNotBlank(keyword)) { if (StrUtil.isNotBlank(keyword)) {
cnd.where().andLike("t.disPlayName", keyword); cnd.where().andLike("t.disPlayName", keyword);
} }
@@ -620,6 +620,27 @@ public class ActivitySportsApplyUserServiceImpl extends BaseServiceImpl<Activity
continue; continue;
} }
// 以系统人员档案为准校验男女分组,不能用 Excel 性别绕过限制;校验失败时保留已有报名。
Integer isMenWomen = activityEvent.getIsMenWomen();
if (Integer.valueOf(1).equals(isMenWomen) || Integer.valueOf(2).equals(isMenWomen)) {
String sex = normalizeText(sysUser.getSex());
boolean male = "男".equals(sex) || "男性".equals(sex);
boolean female = "女".equals(sex) || "女性".equals(sex);
String errorMessage = null;
if (!male && !female) {
errorMessage = "系统人员档案性别为空或无法识别,请维护后重新导入";
} else if (Integer.valueOf(1).equals(isMenWomen) && !male) {
errorMessage = "该项目为男子组,系统人员档案性别为女,不能报名";
} else if (Integer.valueOf(2).equals(isMenWomen) && !female) {
errorMessage = "该项目为女子组,系统人员档案性别为男,不能报名";
}
if (errorMessage != null) {
importTemp.setNotes(errorMessage);
errorList.add(importTemp);
continue;
}
}
activitySchoolApply.setEventId(schoolEvent.getEventId()); activitySchoolApply.setEventId(schoolEvent.getEventId());
activitySchoolApply.setAwardsMode(activityEvent.getProjectType()); activitySchoolApply.setAwardsMode(activityEvent.getProjectType());
if ("2".equals(activityEvent.getProjectType())) { if ("2".equals(activityEvent.getProjectType())) {
@@ -14,8 +14,6 @@ import com.budwk.app.base.utils.PageUtil;
import com.budwk.app.flow.entity.ProcessInstance; import com.budwk.app.flow.entity.ProcessInstance;
import com.budwk.app.flow.enums.ProcessInstanceStateEnum; import com.budwk.app.flow.enums.ProcessInstanceStateEnum;
import com.budwk.app.sys.param.SysMsgSummaryPageForm; import com.budwk.app.sys.param.SysMsgSummaryPageForm;
import com.budwk.app.web.commons.auth.utils.AuthUtil;
import com.budwk.app.web.commons.auth.utils.SecurityUtil;
import com.budwk.app.zhgh.staffbenefit.condolence.model.Condolence; import com.budwk.app.zhgh.staffbenefit.condolence.model.Condolence;
import com.budwk.app.zhgh.staffbenefit.condolence.service.CondolenceService; import com.budwk.app.zhgh.staffbenefit.condolence.service.CondolenceService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
@@ -98,7 +96,6 @@ public class CondolenceReadController {
cnd.andEX("YEAR(info.createTime)", "=", year); cnd.andEX("YEAR(info.createTime)", "=", year);
cnd.andEX("info.applyUnionId", "=", unionId); cnd.andEX("info.applyUnionId", "=", unionId);
cnd.andEX("info.applyUnitId", "=", unitId); cnd.andEX("info.applyUnitId", "=", unitId);
applyReadScope(cnd, "info");
if (StrUtil.isNotBlank(pageForm.getSearchKeyword())) { if (StrUtil.isNotBlank(pageForm.getSearchKeyword())) {
SqlExpressionGroup seg = new SqlExpressionGroup(); SqlExpressionGroup seg = new SqlExpressionGroup();
@@ -145,7 +142,6 @@ public class CondolenceReadController {
cnd.andEX("YEAR(con.createTime)", "=", year); cnd.andEX("YEAR(con.createTime)", "=", year);
cnd.andEX("con.applyUnionId", "=", unionId); cnd.andEX("con.applyUnionId", "=", unionId);
cnd.andEX("con.applyUnitId", "=", unitId); cnd.andEX("con.applyUnitId", "=", unitId);
applyReadScope(cnd, "con");
if (StrUtil.isNotBlank(pageForm.getSearchKeyword())) { if (StrUtil.isNotBlank(pageForm.getSearchKeyword())) {
SqlExpressionGroup seg = new SqlExpressionGroup(); SqlExpressionGroup seg = new SqlExpressionGroup();
seg.or("con.helpUserName", "like", "%" + pageForm.getSearchKeyword() + "%"); seg.or("con.helpUserName", "like", "%" + pageForm.getSearchKeyword() + "%");
@@ -170,21 +166,4 @@ public class CondolenceReadController {
Workbook workbook = ExcelExportUtil.exportExcel(exportParams, exportEntities, list); Workbook workbook = ExcelExportUtil.exportExcel(exportParams, exportEntities, list);
CommonDownloadUtil.download("申报人汇总.xlsx", workbook, response); CommonDownloadUtil.download("申报人汇总.xlsx", workbook, response);
} }
private void applyReadScope(Cnd cnd, String alias) {
if (AuthUtil.hasPermission("all_school")) {
return;
}
if (AuthUtil.hasPermission("branch_union")) {
String unionId = SecurityUtil.getUnionId();
if (StrUtil.isNotBlank(unionId)) {
cnd.and(alias + ".applyUnionId", "=", unionId);
return;
}
} else if (AuthUtil.hasPermission("self")) {
cnd.and(alias + ".createdBy", "=", SecurityUtil.getUserId());
return;
}
cnd.and("1", "=", 0);
}
} }
@@ -112,7 +112,7 @@ public class DifficultHelpApplyController {
@SaCheckPermission("member.apply.submit") @SaCheckPermission("member.apply.submit")
@SLog(tag = "困难补助申请", msg = "保存申请,填写人: ${args[0].proxyUserName}") @SLog(tag = "困难补助申请", msg = "保存申请,填写人: ${args[0].proxyUserName}")
public Result save(@Param("data") DifficultHelpInfo difficultHelpInfo) { public Result save(@Param("data") DifficultHelpInfo difficultHelpInfo) {
difficultHelpCommonService.validateApplyUser(difficultHelpInfo, false); difficultHelpCommonService.validateApplyUser(difficultHelpInfo);
difficultHelpInfo.setApplyTime(ObjectUtil.defaultIfNull(difficultHelpInfo.getApplyTime(), new Date())); difficultHelpInfo.setApplyTime(ObjectUtil.defaultIfNull(difficultHelpInfo.getApplyTime(), new Date()));
difficultHelpCommonService.refreshApplyCount(difficultHelpInfo); difficultHelpCommonService.refreshApplyCount(difficultHelpInfo);
if (difficultHelpCommonService.hasAppliedInYear(difficultHelpInfo.getUserId(), difficultHelpInfo.getApplyTime(), difficultHelpInfo.getId())) { if (difficultHelpCommonService.hasAppliedInYear(difficultHelpInfo.getUserId(), difficultHelpInfo.getApplyTime(), difficultHelpInfo.getId())) {
@@ -21,8 +21,6 @@ public interface DifficultHelpCommonService extends BaseService<DifficultHelpInf
void validateApplyUser(DifficultHelpInfo difficultHelpInfo); void validateApplyUser(DifficultHelpInfo difficultHelpInfo);
void validateApplyUser(DifficultHelpInfo difficultHelpInfo, boolean requireApplyMoney);
/** /**
* 导入实际金额数据处理 * 导入实际金额数据处理
* @param file 文件 * @param file 文件
@@ -56,11 +56,6 @@ public class DifficultHelpCommonServiceImpl extends BaseServiceImpl<DifficultHel
@Override @Override
public void validateApplyUser(DifficultHelpInfo difficultHelpInfo) { public void validateApplyUser(DifficultHelpInfo difficultHelpInfo) {
validateApplyUser(difficultHelpInfo, true);
}
@Override
public void validateApplyUser(DifficultHelpInfo difficultHelpInfo, boolean requireApplyMoney) {
if (difficultHelpInfo == null || StrUtil.isBlank(difficultHelpInfo.getUserId())) { if (difficultHelpInfo == null || StrUtil.isBlank(difficultHelpInfo.getUserId())) {
throw new BaseException("请选择受助人"); throw new BaseException("请选择受助人");
} }
@@ -70,9 +65,8 @@ public class DifficultHelpCommonServiceImpl extends BaseServiceImpl<DifficultHel
throw new BaseException("只能查看他人代为申请的记录,不能修改或提交"); throw new BaseException("只能查看他人代为申请的记录,不能修改或提交");
} }
} }
if ((requireApplyMoney || difficultHelpInfo.getApplyMoney() != null) if (difficultHelpInfo.getApplyMoney() == null || !Double.isFinite(difficultHelpInfo.getApplyMoney())
&& (difficultHelpInfo.getApplyMoney() == null || !Double.isFinite(difficultHelpInfo.getApplyMoney()) || difficultHelpInfo.getApplyMoney() <= 0) {
|| difficultHelpInfo.getApplyMoney() <= 0)) {
throw new BaseException("请填写大于零的申请金额"); throw new BaseException("请填写大于零的申请金额");
} }
if (difficultHelpInfo.getUserId().equals(SecurityUtil.getUserId())) { if (difficultHelpInfo.getUserId().equals(SecurityUtil.getUserId())) {
@@ -83,7 +83,7 @@ public class SpecialCondolenceApplyController {
public Result save(@Param("data") SpecialCondolence specialcondolence) { public Result save(@Param("data") SpecialCondolence specialcondolence) {
if(StrUtil.isBlank(specialcondolence.getId())) specialcondolence.setCreateTime(DateUtil.now()); if(StrUtil.isBlank(specialcondolence.getId())) specialcondolence.setCreateTime(DateUtil.now());
prepareApplication(specialcondolence); prepareApplication(specialcondolence);
specialcondolenceService.saveDraftApplication(specialcondolence); specialcondolenceService.saveApplication(specialcondolence);
return Result.success(); return Result.success();
} }
@@ -213,20 +213,23 @@ public class SpecialCondolenceApplyController {
for (int r = 1; r <= sheet.getLastRowNum(); r++) { for (int r = 1; r <= sheet.getLastRowNum(); r++) {
org.apache.poi.ss.usermodel.Row excelRow = sheet.getRow(r); org.apache.poi.ss.usermodel.Row excelRow = sheet.getRow(r);
if (excelRow == null) continue; if (excelRow == null) continue;
String prefix = "慰问对象" + (result.size() + 1) + " ";
cn.hutool.json.JSONObject row = new cn.hutool.json.JSONObject(); cn.hutool.json.JSONObject row = new cn.hutool.json.JSONObject();
boolean empty = true; boolean empty = true;
for (int c = 0; c < fields.length; c++) { for (int c = 0; c < fields.length; c++) {
org.apache.poi.ss.usermodel.Cell cell = excelRow.getCell(c); org.apache.poi.ss.usermodel.Cell cell = excelRow.getCell(c);
String value = formatter.formatCellValue(cell).trim(); String value = formatter.formatCellValue(cell).trim();
if (c != 1 && cell != null && cell.getCellType() == org.apache.poi.ss.usermodel.CellType.FORMULA) throw new com.budwk.app.base.exception.BaseException(prefix + "不支持公式,请填写实际值"); if (c != 1 && cell != null && cell.getCellType() == org.apache.poi.ss.usermodel.CellType.FORMULA) throw new com.budwk.app.base.exception.BaseException("第" + (r + 1) + "行不支持公式,请填写实际值");
if ((c == 2 || c == 5) && cell != null && cell.getCellType() == org.apache.poi.ss.usermodel.CellType.NUMERIC) throw new com.budwk.app.base.exception.BaseException(prefix + "工号、身份证和收款账户请使用文本格式,避免数字失真"); if ((c == 2 || c == 5) && cell != null && cell.getCellType() == org.apache.poi.ss.usermodel.CellType.NUMERIC) throw new com.budwk.app.base.exception.BaseException("第" + (r + 1) + "行工号、身份证和收款账户请使用文本格式,避免数字失真");
row.set(fields[c], value); row.set(fields[c], value);
empty = empty && value.isEmpty(); empty = empty && value.isEmpty();
} }
if (empty) continue; if (empty) continue;
if (!com.budwk.app.zhgh.staffbenefit.specialcondolence.service.SpecialCondolenceRecipients.validIdCard(row.getStr("idCard"))) throw new com.budwk.app.base.exception.BaseException(prefix + "身份证号码格式不正确"); for (int c = 0; c < fields.length; c++) {
if (!row.getStr("bankCardNumber").matches("[0-9]{6,30}")) throw new com.budwk.app.base.exception.BaseException(prefix + "收款账户格式不正确"); if (c != 1 && row.getStr(fields[c]).isEmpty()) throw new com.budwk.app.base.exception.BaseException("第" + (r + 1) + "行:请填写" + headers[c]);
}
if (!com.budwk.app.zhgh.staffbenefit.specialcondolence.service.SpecialCondolenceRecipients.validIdCard(row.getStr("idCard"))) throw new com.budwk.app.base.exception.BaseException("第" + (r + 1) + "行身份证号码格式不正确");
if (!row.getStr("bankCardNumber").matches("[0-9]{6,30}")) throw new com.budwk.app.base.exception.BaseException("第" + (r + 1) + "行收款账户格式不正确");
com.budwk.app.zhgh.staffbenefit.specialcondolence.service.SpecialCondolenceRecipients.resolveUser(row, dao, "第" + (r + 1) + "行:");
result.add(row); result.add(row);
} }
} }
@@ -71,7 +71,6 @@ public class SpecialCondolenceReadController {
Sql sql = Sqls.create(""" Sql sql = Sqls.create("""
SELECT SELECT
info.*, info.*,
(SELECT COUNT(*) FROM special_condolence_recipient recipient WHERE recipient.applyId = info.id AND recipient.delFlag = false) AS recipientCount,
ins.id AS instanceId, ins.id AS instanceId,
type.name as typeName, type.name as typeName,
ins.state instanceState, ins.state instanceState,
@@ -32,7 +32,7 @@ public final class SpecialCondolenceRecipients {
row.set("type", info.getType()); row.set("type", info.getType());
row.set("money", info.getPerMoney().toPlainString()); row.set("money", info.getPerMoney().toPlainString());
row.set("occurTime", info.getOccurTime()); row.set("occurTime", info.getOccurTime());
if (cn.hutool.core.util.StrUtil.isNotBlank(row.getStr("helpUserId"))) resolveUser(row, dao, prefix); resolveUser(row, dao, prefix);
String[] fields = {"helpUserName", "type", "idCard", "bankOfDeposit", "bankUserName", "bankCardNumber", "money", "occurTime"}; String[] fields = {"helpUserName", "type", "idCard", "bankOfDeposit", "bankUserName", "bankCardNumber", "money", "occurTime"};
for (String field : fields) { for (String field : fields) {
String value = row.getStr(field); String value = row.getStr(field);
@@ -80,27 +80,24 @@ public final class SpecialCondolenceRecipients {
if (cn.hutool.core.util.StrUtil.isNotBlank(userId)) { if (cn.hutool.core.util.StrUtil.isNotBlank(userId)) {
user = dao.fetch(com.budwk.app.sys.views.View_user.class, org.nutz.dao.Cnd.where("id", "=", userId)); user = dao.fetch(com.budwk.app.sys.views.View_user.class, org.nutz.dao.Cnd.where("id", "=", userId));
} else { } else {
org.nutz.dao.Cnd identity = org.nutz.dao.Cnd.where("unionId", "=", unionId)
.and("idCard", "=", row.getStr("idCard")).and("username", "=", row.getStr("helpUserName"));
java.util.List<com.budwk.app.sys.views.View_user> dispatched = dao.query(com.budwk.app.sys.views.View_user.class,
identity.and("personType", "=", "劳务派遣人员"));
if (dispatched.size() > 1) throw new BaseException(prefix + "劳务派遣人员身份重复,请核对档案");
if (dispatched.size() == 1) {
user = dispatched.get(0);
} else {
if (cn.hutool.core.util.StrUtil.isBlank(row.getStr("helpLoginName"))) throw new BaseException(prefix + "普通人员必须填写工号");
java.util.List<com.budwk.app.sys.views.View_user> users = dao.query(com.budwk.app.sys.views.View_user.class, java.util.List<com.budwk.app.sys.views.View_user> users = dao.query(com.budwk.app.sys.views.View_user.class,
org.nutz.dao.Cnd.where("idCard", "=", row.getStr("idCard")) org.nutz.dao.Cnd.where("unionId", "=", unionId).and("loginname", "=", row.getStr("helpLoginName"))
.and("username", "=", row.getStr("helpUserName"))); .and("username", "=", row.getStr("helpUserName")).and("idCard", "=", row.getStr("idCard")));
if (users.isEmpty()) throw new BaseException(prefix + "姓名、身份证与人员档案不匹配"); if (users.size() != 1) throw new BaseException(prefix + "工号、姓名、身份证不匹配或不属于申请人本工会");
java.util.List<com.budwk.app.sys.views.View_user> members = users.stream() user = users.get(0);
.filter(member -> java.util.Objects.equals(member.getUnionId(), unionId))
.collect(java.util.stream.Collectors.toList());
if (members.isEmpty()) throw new BaseException(prefix + "只能选择申请人本工会人员");
String loginName = row.getStr("helpLoginName");
if (cn.hutool.core.util.StrUtil.isNotBlank(loginName)) {
members = members.stream().filter(member -> "劳务派遣人员".equals(member.getPersonType())
|| java.util.Objects.equals(member.getLoginname(), loginName))
.collect(java.util.stream.Collectors.toList());
} }
if (members.isEmpty()) throw new BaseException(prefix + "工号与慰问对象不一致");
if (members.size() > 1) throw new BaseException(prefix + "人员身份重复,请核对档案");
user = members.get(0);
} }
if (user == null) throw new BaseException(prefix + "慰问对象不存在"); if (user == null) throw new BaseException(prefix + "慰问对象不存在");
if (!java.util.Objects.equals(user.getUnionId(), unionId)) throw new BaseException(prefix + "只能选择申请人本工会人员"); if (!java.util.Objects.equals(user.getUnionId(), unionId)) throw new BaseException(prefix + "只能选择申请人本工会人员");
if (!"劳务派遣人员".equals(user.getPersonType()) && cn.hutool.core.util.StrUtil.isBlank(row.getStr("helpLoginName"))) throw new BaseException(prefix + "普通人员必须填写工号");
if (!"劳务派遣人员".equals(user.getPersonType()) && (cn.hutool.core.util.StrUtil.isBlank(row.getStr("helpLoginName")) || !java.util.Objects.equals(user.getLoginname(), row.getStr("helpLoginName")))) throw new BaseException(prefix + "工号与慰问对象不一致"); if (!"劳务派遣人员".equals(user.getPersonType()) && (cn.hutool.core.util.StrUtil.isBlank(row.getStr("helpLoginName")) || !java.util.Objects.equals(user.getLoginname(), row.getStr("helpLoginName")))) throw new BaseException(prefix + "工号与慰问对象不一致");
if (cn.hutool.core.util.StrUtil.isNotBlank(user.getIdCard()) && !user.getIdCard().equalsIgnoreCase(row.getStr("idCard"))) throw new BaseException(prefix + "身份证号码与所选人员不一致"); if (cn.hutool.core.util.StrUtil.isNotBlank(user.getIdCard()) && !user.getIdCard().equalsIgnoreCase(row.getStr("idCard"))) throw new BaseException(prefix + "身份证号码与所选人员不一致");
row.set("helpUserId", user.getId()); row.set("helpUserId", user.getId());
@@ -12,7 +12,6 @@ import com.budwk.app.zhgh.staffbenefit.specialcondolence.model.SpecialCondolence
*/ */
public interface SpecialCondolenceService extends BaseService<SpecialCondolence> { public interface SpecialCondolenceService extends BaseService<SpecialCondolence> {
void saveApplication(SpecialCondolence info); void saveApplication(SpecialCondolence info);
void saveDraftApplication(SpecialCondolence info);
SpecialCondolence loadApplication(String id); SpecialCondolence loadApplication(String id);
void deleteApplication(String id); void deleteApplication(String id);
} }
@@ -3,7 +3,6 @@ package com.budwk.app.zhgh.staffbenefit.specialcondolence.service.impl;
import com.budwk.app.base.service.impl.BaseServiceImpl; import com.budwk.app.base.service.impl.BaseServiceImpl;
import com.budwk.app.zhgh.staffbenefit.specialcondolence.model.SpecialCondolenceRecipient; import com.budwk.app.zhgh.staffbenefit.specialcondolence.model.SpecialCondolenceRecipient;
import com.budwk.app.zhgh.staffbenefit.specialcondolence.service.SpecialCondolenceRecipients; import com.budwk.app.zhgh.staffbenefit.specialcondolence.service.SpecialCondolenceRecipients;
import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONObject; import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil; import cn.hutool.json.JSONUtil;
import org.nutz.ioc.aop.Aop; import org.nutz.ioc.aop.Aop;
@@ -36,28 +35,6 @@ public class SpecialCondolenceServiceImpl extends BaseServiceImpl<SpecialCondole
@Aop(TransAop.READ_COMMITTED) @Aop(TransAop.READ_COMMITTED)
public void saveApplication(SpecialCondolence info) { public void saveApplication(SpecialCondolence info) {
SpecialCondolenceRecipients.prepare(info, dao()); SpecialCondolenceRecipients.prepare(info, dao());
persistApplication(info);
}
@Override
@Aop(TransAop.READ_COMMITTED)
public void saveDraftApplication(SpecialCondolence info) {
if (info.getRecipients() == null) info.setRecipients(new ArrayList<>());
info.getRecipients().removeIf(row -> row == null || java.util.stream.Stream.of(
"helpUserId", "helpUserName", "helpLoginName", "idCard", "bankOfDeposit", "bankUserName", "bankCardNumber")
.allMatch(field -> StrUtil.isBlank(row.getStr(field))));
for (JSONObject row : info.getRecipients()) {
row.set("type", info.getType());
row.set("typeCode", info.getTypeCode());
row.set("way", info.getWay());
row.set("money", info.getPerMoney());
row.set("occurTime", info.getOccurTime());
}
info.setMoney(info.getPerMoney() == null ? null : info.getPerMoney().multiply(BigDecimal.valueOf(info.getRecipients().size())).doubleValue());
persistApplication(info);
}
private void persistApplication(SpecialCondolence info) {
dao().insertOrUpdate(info); dao().insertOrUpdate(info);
dao().clear(SpecialCondolenceRecipient.class, dao().clear(SpecialCondolenceRecipient.class,
Cnd.where("applyId", "=", info.getId())); Cnd.where("applyId", "=", info.getId()));
@@ -65,20 +42,20 @@ public class SpecialCondolenceServiceImpl extends BaseServiceImpl<SpecialCondole
for (JSONObject row : info.getRecipients()) { for (JSONObject row : info.getRecipients()) {
SpecialCondolenceRecipient person = new SpecialCondolenceRecipient(); SpecialCondolenceRecipient person = new SpecialCondolenceRecipient();
person.setApplyId(info.getId()); person.setApplyId(info.getId());
person.setHelpUserName(row.getStr("helpUserName", "")); person.setHelpUserName(row.getStr("helpUserName"));
person.setHelpUserId(row.getStr("helpUserId", "")); person.setHelpUserId(row.getStr("helpUserId"));
person.setHelpLoginName(row.getStr("helpLoginName")); person.setHelpLoginName(row.getStr("helpLoginName"));
person.setPersonType(row.getStr("personType")); person.setPersonType(row.getStr("personType"));
person.setType(row.getStr("type", "")); person.setType(row.getStr("type"));
person.setTypeName(row.getStr("typeName")); person.setTypeName(row.getStr("typeName"));
person.setTypeCode(row.getStr("typeCode")); person.setTypeCode(row.getStr("typeCode"));
person.setWay(row.getStr("way")); person.setWay(row.getStr("way"));
person.setIdCard(row.getStr("idCard", "")); person.setIdCard(row.getStr("idCard"));
person.setBankOfDeposit(row.getStr("bankOfDeposit", "")); person.setBankOfDeposit(row.getStr("bankOfDeposit"));
person.setBankUserName(row.getStr("bankUserName", "")); person.setBankUserName(row.getStr("bankUserName"));
person.setBankCardNumber(row.getStr("bankCardNumber", "")); person.setBankCardNumber(row.getStr("bankCardNumber"));
person.setMoney(row.getBigDecimal("money", BigDecimal.ZERO)); person.setMoney(new BigDecimal(row.getStr("money")));
person.setOccurTime(row.getStr("occurTime", "")); person.setOccurTime(row.getStr("occurTime"));
person.setSortNum(sort++); person.setSortNum(sort++);
dao().insert(person); dao().insert(person);
} }
@@ -1,6 +1,5 @@
package com.budwk.app.zhgh.welfare.service.impl; package com.budwk.app.zhgh.welfare.service.impl;
import cn.afterturn.easypoi.entity.ImageEntity;
import cn.afterturn.easypoi.excel.ExcelExportUtil; import cn.afterturn.easypoi.excel.ExcelExportUtil;
import cn.afterturn.easypoi.excel.entity.ExportParams; import cn.afterturn.easypoi.excel.entity.ExportParams;
import cn.afterturn.easypoi.excel.entity.enmus.ExcelType; import cn.afterturn.easypoi.excel.entity.enmus.ExcelType;
@@ -23,8 +22,12 @@ import com.budwk.app.zhgh.welfare.model.WelfareProjectSubjectOption;
import com.budwk.app.zhgh.welfare.param.WelfareSelectionSituationPageForm; import com.budwk.app.zhgh.welfare.param.WelfareSelectionSituationPageForm;
import com.budwk.app.zhgh.welfare.service.WelfareSelectionSituationService; import com.budwk.app.zhgh.welfare.service.WelfareSelectionSituationService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.poi.hssf.usermodel.HSSFWorkbook; import org.apache.poi.ss.usermodel.ClientAnchor;
import org.apache.poi.ss.usermodel.Drawing;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook; import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.nutz.dao.Cnd; import org.nutz.dao.Cnd;
import org.nutz.dao.Dao; import org.nutz.dao.Dao;
import org.nutz.dao.Sqls; import org.nutz.dao.Sqls;
@@ -246,7 +249,8 @@ public class WelfareSelectionSituationServiceImpl extends BaseServiceImpl<Welfar
byte[] userSignBytes = SysFileMinIoUtil.getFileBytes(file.getBucket(), file.getStoragePath()); byte[] userSignBytes = SysFileMinIoUtil.getFileBytes(file.getBucket(), file.getStoragePath());
map.put("userSign", userSignBytes); map.put("userSign", userSignBytes);
}catch (Exception e){ }catch (Exception e){
e.printStackTrace(); // 下载失败时不把原文件地址写入签字单元格。
map.put("userSign", null);
log.error("下载图片失败", e); log.error("下载图片失败", e);
} }
} }
@@ -268,21 +272,66 @@ public class WelfareSelectionSituationServiceImpl extends BaseServiceImpl<Welfar
optionList.forEach(option -> { optionList.forEach(option -> {
entities.add(new ExcelExportEntity(option.getOptionName(), option.getOptionName(), 20)); entities.add(new ExcelExportEntity(option.getOptionName(), option.getOptionName(), 20));
}); });
// 签字列先按空白文本导出,图片另行写入,避开 EasyPOI 对 Map 图片字段的反射。
ExcelExportEntity userSignEntity = new ExcelExportEntity("签字", "userSign", 20); ExcelExportEntity userSignEntity = new ExcelExportEntity("签字", "userSign", 20);
userSignEntity.setType(2);
userSignEntity.setExportImageType(2);
entities.add(userSignEntity); entities.add(userSignEntity);
// 导出 // 导出
Workbook workbook = new HSSFWorkbook(); Workbook workbook = new XSSFWorkbook();
listMap.forEach((k, v) -> { listMap.forEach((k, v) -> {
List<byte[]> signatures = new ArrayList<>();
v.forEach(row -> {
Object signature = row.remove("userSign");
signatures.add(signature instanceof byte[] ? (byte[]) signature : null);
});
ExcelExportService service = new ExcelExportService(); ExcelExportService service = new ExcelExportService();
ExportParams exportParams = new ExportParams(); ExportParams exportParams = new ExportParams();
exportParams.setSheetName(k); exportParams.setSheetName(k);
exportParams.setType(ExcelType.HSSF); exportParams.setType(ExcelType.XSSF);
int firstSheet = workbook.getNumberOfSheets();
service.createSheetForMap(workbook, exportParams, entities, v); service.createSheetForMap(workbook, exportParams, entities, v);
// 无标题、单层列头的数据从第二行开始;按新增 Sheet 顺序兼容 EasyPOI 自动拆表。
int signatureIndex = 0;
for (int sheetIndex = firstSheet; sheetIndex < workbook.getNumberOfSheets(); sheetIndex++) {
Sheet sheet = workbook.getSheetAt(sheetIndex);
Drawing<?> drawing = sheet.createDrawingPatriarch();
for (int rowIndex = 1; rowIndex <= sheet.getLastRowNum() && signatureIndex < signatures.size(); rowIndex++) {
byte[] signature = signatures.get(signatureIndex++);
if (signature != null && signature.length > 0) {
insertReceiveSignature(workbook, sheet, drawing, rowIndex, entities.size() - 1, signature);
}
}
}
}); });
CommonDownloadUtil.download("领取表.xls", workbook, response); CommonDownloadUtil.download("领取表.xlsx", workbook, response);
}
/**
* 将签字字节数组写入领取表指定单元格。行列索引从 0 开始,图片统一转为 PNG;
* 无法解码的图片仅记录日志并保留空白签字格,不中断其他人员的导出。
*/
private void insertReceiveSignature(Workbook workbook, Sheet sheet, Drawing<?> drawing,
int rowIndex, int columnIndex, byte[] signature) {
try (ByteArrayInputStream input = new ByteArrayInputStream(signature);
ByteArrayOutputStream output = new ByteArrayOutputStream()) {
BufferedImage image = ImageIO.read(input);
if (image == null) {
log.warn("领取表签字图片无法识别,Sheet={},行={}", sheet.getSheetName(), rowIndex + 1);
return;
}
ImageIO.write(image, "png", output);
Row row = sheet.getRow(rowIndex);
row.setHeightInPoints(Math.max(row.getHeightInPoints(), 50));
ClientAnchor anchor = workbook.getCreationHelper().createClientAnchor();
anchor.setCol1(columnIndex);
anchor.setCol2(columnIndex + 1);
anchor.setRow1(rowIndex);
anchor.setRow2(rowIndex + 1);
anchor.setAnchorType(ClientAnchor.AnchorType.MOVE_AND_RESIZE);
drawing.createPicture(anchor, workbook.addPicture(output.toByteArray(), Workbook.PICTURE_TYPE_PNG));
} catch (Exception e) {
log.error("领取表签字图片写入失败,Sheet={},行={}", sheet.getSheetName(), rowIndex + 1, e);
}
} }
} }
@@ -1,7 +0,0 @@
INSERT INTO sys_menu (id, parentId, path, name, aliasName, type, href, target, icon, showit, disabled, permission, note, location, hasChildren, createdBy, createdAt, updatedBy, updatedAt, delFlag, processKey, platform, moduleId, isQuickEntry, picIcon, initialPinyinName, isRecommendApp, isRecommendService) VALUES ('184d56fd537041caa2bde800d0d32436', '90bf20d9065e4e11864952ea18544c25', '009000040003', '个人范围', null, 'data', null, null, null, false, false, 'self', null, 1027, false, '17a7f8ad3ee947b4a26175049a9c253d', 1793418331288, '17a7f8ad3ee947b4a26175049a9c253d', 1793418331288, false, null, 'PC', null, false, null, null, false, false);
INSERT INTO sys_menu (id, parentId, path, name, aliasName, type, href, target, icon, showit, disabled, permission, note, location, hasChildren, createdBy, createdAt, updatedBy, updatedAt, delFlag, processKey, platform, moduleId, isQuickEntry, picIcon, initialPinyinName, isRecommendApp, isRecommendService) VALUES ('df87d83ed3184019b3872139c15b53ec', '90bf20d9065e4e11864952ea18544c25', '009000040002', '分工会范围', null, 'data', null, null, null, false, false, 'branch_union', null, 1026, false, '17a7f8ad3ee947b4a26175049a9c253d', 1793418331286, '17a7f8ad3ee947b4a26175049a9c253d', 1793418331286, false, null, 'PC', null, false, null, null, false, false);
INSERT INTO sys_menu (id, parentId, path, name, aliasName, type, href, target, icon, showit, disabled, permission, note, location, hasChildren, createdBy, createdAt, updatedBy, updatedAt, delFlag, processKey, platform, moduleId, isQuickEntry, picIcon, initialPinyinName, isRecommendApp, isRecommendService) VALUES ('f2a75d2494724978b5325075815808c9', '90bf20d9065e4e11864952ea18544c25', '009000040001', '全校范围', null, 'data', null, null, null, false, false, 'all_school', null, 1025, false, '17a7f8ad3ee947b4a26175049a9c253d', 1793418331280, '17a7f8ad3ee947b4a26175049a9c253d', 1793418331280, false, null, 'PC', null, false, null, null, false, false);
INSERT INTO sys_role_menu (roleId, menuId) VALUES ('fd753e8a8c5a404e8e00ef8e0b0c69da', 'df87d83ed3184019b3872139c15b53ec');
INSERT INTO sys_role_menu (roleId, menuId) VALUES ('494ac71eb8b44d0e99e19b7fde6bd469', 'f2a75d2494724978b5325075815808c9');
INSERT INTO sys_role_menu (roleId, menuId) VALUES ('6aece46b946e4fb9ac4cb15c0cd8c3e6', 'f2a75d2494724978b5325075815808c9');
INSERT INTO sys_role_menu (roleId, menuId) VALUES ('b3854469e6f44901b22bb791cb538431', 'f2a75d2494724978b5325075815808c9');
@@ -124,7 +124,10 @@
#v4-home-app .todo-center .el-tabs__nav { display: flex; width: 100%; border-color: #e9eff6; border-radius: 6px 6px 0 0; } #v4-home-app .todo-center .el-tabs__nav { display: flex; width: 100%; border-color: #e9eff6; border-radius: 6px 6px 0 0; }
#v4-home-app .todo-center .el-tabs__item { flex: 1; min-width: 0; padding: 0 7px; font-size: 12px; height: 36px; line-height: 36px; text-align: center; } #v4-home-app .todo-center .el-tabs__item { flex: 1; min-width: 0; padding: 0 7px; font-size: 12px; height: 36px; line-height: 36px; text-align: center; }
#v4-home-app .todo-center .el-tabs__item.is-active { border-bottom: 2px solid #1687f5; color: #1687f5; } #v4-home-app .todo-center .el-tabs__item.is-active { border-bottom: 2px solid #1687f5; color: #1687f5; }
#v4-home-app .portal-task-list { display: flex; flex-direction: column; justify-content: space-evenly; flex: 1; min-height: 180px; } /* 任务从标签栏下方依次排列,避免单条记录被剩余高度推到中间。 */
#v4-home-app .portal-task-list { display: flex; flex-direction: column; justify-content: flex-start; flex: 1; min-height: 180px; }
/* 空数据提示独立占满列表区域,保留居中展示。 */
#v4-home-app .portal-task-list > .portal-empty { flex: 1; }
#v4-home-app .portal-task-row { display: flex; gap: 10px; align-items: center; padding: 8px 6px; border-bottom: 1px solid #eef3f8; } #v4-home-app .portal-task-row { display: flex; gap: 10px; align-items: center; padding: 8px 6px; border-bottom: 1px solid #eef3f8; }
#v4-home-app .portal-task-row:last-child { border-bottom: 0; } #v4-home-app .portal-task-row:last-child { border-bottom: 0; }
#v4-home-app .portal-task-row:hover { background: #f7fbff; } #v4-home-app .portal-task-row:hover { background: #f7fbff; }
@@ -181,7 +181,7 @@ layout("/layouts/v4/baseLayout.html"){
</style> </style>
<link rel="stylesheet" href="${base!}/assets/platform/css/home-portal.css?v=20261030-1" /> <link rel="stylesheet" href="${base!}/assets/platform/css/home-portal.css?v=20261102-1" />
<!-- 登录资料仅在 HTML 属性中输出并转义;放在 Vue 挂载区域外,避免名称被当作模板表达式解析。 --> <!-- 登录资料仅在 HTML 属性中输出并转义;放在 Vue 挂载区域外,避免名称被当作模板表达式解析。 -->
<div id="v4-home-profile-data" hidden <div id="v4-home-profile-data" hidden
@@ -1050,7 +1050,14 @@ const ACTIVITY_CULTURE_APPLY_ACTIVITY = {
if (code === 0) { if (code === 0) {
if (data.userId) { if (data.userId) {
const user = await this.queryUserByIds([data.userId]) const user = await this.queryUserByIds([data.userId])
// 历史模板的负责人可能已删除;清空失效选择并继续回填,避免空数组中断整个表单。
if (Array.isArray(user) && user.length > 0 && user[0].loginname) {
await this.remoteMethod(user[0].loginname) await this.remoteMethod(user[0].loginname)
} else {
this.$set(data, "userId", null)
this.userList = []
this.$message.warning("原负责人已不存在,请重新选择负责人")
}
} }
if (data.goods) data.goods = JSON.parse(data.goods) if (data.goods) data.goods = JSON.parse(data.goods)
if (data.billFiles && data.billFiles.length > 0) data.billFiles = JSON.parse(data.billFiles) if (data.billFiles && data.billFiles.length > 0) data.billFiles = JSON.parse(data.billFiles)
@@ -379,7 +379,9 @@ layout("/layouts/platform.html"){
callback(valid ? undefined : new Error('申请金额须大于零,最多保留两位小数')) callback(valid ? undefined : new Error('申请金额须大于零,最多保留两位小数'))
}, },
// 保存 // 保存
onSave() { async onSave() {
const valid = await this.$refs.formRef.validate().catch(() => false)
if (!valid) return
this.$confirm("您确定保存吗?", "提示", { this.$confirm("您确定保存吗?", "提示", {
confirmButtonText: "确定", confirmButtonText: "确定",
cancelButtonText: "取消", cancelButtonText: "取消",
@@ -7,7 +7,7 @@
</el-descriptions-item> </el-descriptions-item>
<el-descriptions-item label="慰问金额" :span="2"> <el-descriptions-item label="慰问金额" :span="2">
<el-form-item label="慰问金额" prop="perMoney" :rules="recipientRules.money"> <el-form-item label="慰问金额" prop="perMoney" :rules="recipientRules.money">
<el-input v-model="formData.perMoney" readonly style="width:100%" placeholder="根据慰问类型自动带出"></el-input> <el-input-number v-model="formData.perMoney" :precision="2" :min="0" :max="10000" :controls="false" style="width:100%" placeholder="每人慰问金额(元)"></el-input-number>
</el-form-item> </el-form-item>
</el-descriptions-item> </el-descriptions-item>
<el-descriptions-item label="慰问时间" :span="2"> <el-descriptions-item label="慰问时间" :span="2">
@@ -51,7 +51,7 @@ layout("/layouts/platform.html"){
</el-descriptions-item> </el-descriptions-item>
<el-descriptions-item label="签字" :span="6"> <el-descriptions-item label="签字" :span="6">
<el-form-item prop="signature" label="签字" class="special-condolence-signature-item"> <el-form-item prop="signature" label="签字">
<pc-signature v-model="formData.signature"></pc-signature> <pc-signature v-model="formData.signature"></pc-signature>
</el-form-item> </el-form-item>
</el-descriptions-item> </el-descriptions-item>
@@ -205,6 +205,8 @@ layout("/layouts/platform.html"){
} }
}, },
onSave() { onSave() {
this.$refs.formRef.validate((valid, invalidFields) => {
if (!valid) { this.showInvalidApplicationTab(invalidFields); return }
this.$confirm("您确定保存吗?", "提示", { this.$confirm("您确定保存吗?", "提示", {
confirmButtonText: "确定", confirmButtonText: "确定",
cancelButtonText: "取消", cancelButtonText: "取消",
@@ -217,23 +219,11 @@ layout("/layouts/platform.html"){
} }
}) })
}) })
}, })
async validateApplication(callback) {
const form = this.$refs.formRef
const fields = form.fields.filter(field => field.prop && !field.prop.startsWith('recipients'))
const results = await Promise.all(fields.map(field => new Promise(resolve => {
field.validate('', message => resolve(!message))
})))
if (results.some(valid => !valid)) {
this.activeApplicationTab = 'form'
this.$message.error('请完善基础信息的必填信息')
return
}
if (!this.ensureApplicationRecipients()) return
form.validate(callback)
}, },
onSubmit() { onSubmit() {
this.validateApplication((valid, invalidFields) => { if (!this.ensureApplicationRecipients()) return
this.$refs.formRef.validate((valid, invalidFields) => {
if (!valid) { this.showInvalidApplicationTab(invalidFields); return } if (!valid) { this.showInvalidApplicationTab(invalidFields); return }
if (valid) { if (valid) {
this.$confirm("您确定要提交吗?", "提示", { this.$confirm("您确定要提交吗?", "提示", {
@@ -254,7 +244,8 @@ layout("/layouts/platform.html"){
}) })
}, },
onFinishTask() { onFinishTask() {
this.validateApplication((valid, invalidFields) => { if (!this.ensureApplicationRecipients()) return
this.$refs.formRef.validate((valid, invalidFields) => {
if (!valid) { this.showInvalidApplicationTab(invalidFields); return } if (!valid) { this.showInvalidApplicationTab(invalidFields); return }
if (valid) { if (valid) {
this.$confirm("您确定要提交吗?", "提示", { this.$confirm("您确定要提交吗?", "提示", {
@@ -284,7 +275,7 @@ layout("/layouts/platform.html"){
this.selectQueryUser(this.formData.helpLoginName, this.helpUserOptions) this.selectQueryUser(this.formData.helpLoginName, this.helpUserOptions)
this.selectQueryUser(this.formData.certifierLoginName, this.certifierUserOptions) this.selectQueryUser(this.formData.certifierLoginName, this.certifierUserOptions)
this.selectQueryUser(this.formData.handlerLoginName, this.handlerUserOptions) this.selectQueryUser(this.formData.handlerLoginName, this.handlerUserOptions)
this.chooseType = this.typeOptions.find(o => o.id === this.formData.type) || {} this.chooseType = this.typeOptions.find(o => o.id === this.formData.type)
} }
}) })
} else { } else {
@@ -65,5 +65,3 @@
.special-condolence-apply .flow-task-form .el-form-item__error { color: #f56c6c !important; } .special-condolence-apply .flow-task-form .el-form-item__error { color: #f56c6c !important; }
.special-condolence-apply .el-form-item.is-error .el-input__inner, .special-condolence-apply .el-form-item.is-error .el-input__inner,
.special-condolence-apply .el-form-item.is-error .el-textarea__inner { border-color: #f56c6c; } .special-condolence-apply .el-form-item.is-error .el-textarea__inner { border-color: #f56c6c; }
.special-condolence-apply .flow-task-form .special-condolence-signature-item .el-form-item__error { position: static; padding-top: 6px; line-height: 20px; white-space: normal; }
@@ -8,8 +8,8 @@
<el-form-item prop="recipients" label-width="0" class="special-condolence-table-item"> <el-form-item prop="recipients" label-width="0" class="special-condolence-table-item">
<el-table ref="recipientTableRef" :data="formData.recipients" border stripe size="small" max-height="520" empty-text="暂无慰问对象,点击新增或从 Excel 导入"> <el-table ref="recipientTableRef" :data="formData.recipients" border stripe size="small" max-height="520" empty-text="暂无慰问对象,点击新增或从 Excel 导入">
<el-table-column type="index" label="序号" width="55" align="center" fixed="left"></el-table-column> <el-table-column type="index" label="序号" width="55" align="center" fixed="left"></el-table-column>
<el-table-column label="慰问对象" width="200" fixed="left"><template slot-scope="s"><el-form-item :prop="'recipients.' + s.$index + (s.row.helpUserId ? '.helpUserId' : '.helpUserName')" :rules="recipientRules.helpUserId"><el-input v-if="!s.row.helpUserId && s.row.helpUserName" size="small" :value="s.row.helpUserName" readonly></el-input><user-select v-else size="small" v-model="s.row.helpUserId" api="/platform/special_condolence/apply/listUser" api_input_key_name="keyword" :option_list="recipientOptions(s.row)" :option_label_func="item => item.userName + '(' + (item.loginName || '') + ')'" @selected="(user, id) => recipientUserChange(s.row, s.$index, id, user)"></user-select></el-form-item></template></el-table-column> <el-table-column label="慰问对象" width="200" fixed="left"><template slot-scope="s"><el-form-item :prop="'recipients.' + s.$index + '.helpUserId'" :rules="recipientRules.helpUserId"><user-select size="small" v-model="s.row.helpUserId" api="/platform/special_condolence/apply/listUser" api_input_key_name="keyword" :option_list="recipientOptions(s.row)" :option_label_func="item => item.userName + '(' + (item.loginName || '') + ')'" @selected="(user, id) => recipientUserChange(s.row, s.$index, id, user)"></user-select></el-form-item></template></el-table-column>
<el-table-column label="工号" min-width="150"><template slot-scope="s"><el-form-item :prop="'recipients.' + s.$index + '.helpLoginName'" :rules="[{ validator: (rule, value, cb) => cb(!s.row.helpUserId || s.row.personType === '劳务派遣人员' || value ? undefined : new Error('普通人员工号不能为空')), trigger: 'change' }]"><el-input size="small" v-model="s.row.helpLoginName" readonly placeholder="选人后带出,劳务派遣可空"></el-input></el-form-item></template></el-table-column> <el-table-column label="工号" min-width="150"><template slot-scope="s"><el-form-item :prop="'recipients.' + s.$index + '.helpLoginName'" :rules="[{ validator: (rule, value, cb) => cb(s.row.personType === '劳务派遣人员' || value ? undefined : new Error('普通人员工号不能为空')), trigger: 'change' }]"><el-input size="small" v-model="s.row.helpLoginName" readonly placeholder="选人后带出,劳务派遣可空"></el-input></el-form-item></template></el-table-column>
<el-table-column label="身份证号码" min-width="205"><template slot-scope="s"><el-form-item :prop="'recipients.' + s.$index + '.idCard'" :rules="recipientRules.idCard"><el-input size="small" v-model="s.row.idCard" maxlength="18" placeholder="请输入18位身份证号"></el-input></el-form-item></template></el-table-column> <el-table-column label="身份证号码" min-width="205"><template slot-scope="s"><el-form-item :prop="'recipients.' + s.$index + '.idCard'" :rules="recipientRules.idCard"><el-input size="small" v-model="s.row.idCard" maxlength="18" placeholder="请输入18位身份证号"></el-input></el-form-item></template></el-table-column>
<el-table-column label="开户行" min-width="190"><template slot-scope="s"><el-form-item :prop="'recipients.' + s.$index + '.bankOfDeposit'" :rules="recipientRules.bankOfDeposit"><el-input size="small" v-model="s.row.bankOfDeposit" maxlength="100" placeholder="请输入开户银行及支行"></el-input></el-form-item></template></el-table-column> <el-table-column label="开户行" min-width="190"><template slot-scope="s"><el-form-item :prop="'recipients.' + s.$index + '.bankOfDeposit'" :rules="recipientRules.bankOfDeposit"><el-input size="small" v-model="s.row.bankOfDeposit" maxlength="100" placeholder="请输入开户银行及支行"></el-input></el-form-item></template></el-table-column>
<el-table-column label="户名" min-width="140"><template slot-scope="s"><el-form-item :prop="'recipients.' + s.$index + '.bankUserName'" :rules="recipientRules.bankUserName"><el-input size="small" v-model="s.row.bankUserName" maxlength="100" placeholder="请输入账户户名"></el-input></el-form-item></template></el-table-column> <el-table-column label="户名" min-width="140"><template slot-scope="s"><el-form-item :prop="'recipients.' + s.$index + '.bankUserName'" :rules="recipientRules.bankUserName"><el-input size="small" v-model="s.row.bankUserName" maxlength="100" placeholder="请输入账户户名"></el-input></el-form-item></template></el-table-column>
@@ -34,7 +34,7 @@ const specialCondolenceRecipients = {
}, },
ensureApplicationRecipients() { ensureApplicationRecipients() {
const rows = this.formData.recipients const rows = this.formData.recipients
if (!Array.isArray(rows) || rows.length === 0 || rows.some(row => !row || !String(row.helpUserId || row.helpUserName || '').trim())) { if (!Array.isArray(rows) || rows.length === 0 || rows.some(row => !row || !String(row.helpUserId || '').trim())) {
this.activeApplicationTab = 'recipients' this.activeApplicationTab = 'recipients'
this.notifyRecipientError('请先选择慰问对象,并填写完整信息') this.notifyRecipientError('请先选择慰问对象,并填写完整信息')
return false return false
@@ -95,18 +95,15 @@ const specialCondolenceRecipients = {
try { try {
const data = new FormData() const data = new FormData()
data.append('file', request.file) data.append('file', request.file)
const response = await axios.post('/platform/special_condolence/apply/importRecipients', data, { const result = await this.$axios.post('/platform/special_condolence/apply/importRecipients', data)
headers: { 'x-requested-with': 'XMLHttpRequest' }
})
const result = response.data
if (result.code === 0) { if (result.code === 0) {
const rows = this.formData.recipients.filter(r => r.helpUserName || r.type || r.idCard || r.bankCardNumber || r.bankUserName || r.bankOfDeposit || r.money) const rows = this.formData.recipients.filter(r => r.helpUserName || r.type || r.idCard || r.bankCardNumber || r.bankUserName || r.bankOfDeposit || r.money)
this.$set(this.formData, 'recipients', rows.concat(result.data)) this.$set(this.formData, 'recipients', rows.concat(result.data))
this.importVisible = false this.importVisible = false
this.$message.success('导入成功,共' + result.data.length + '人') this.$message.success('导入成功,共' + result.data.length + '人')
} else this.$message.error('导入失败:' + (result.msg || '请检查文件内容后重试')) } else this.$message.error(result.msg || '导入失败')
} catch (error) { } catch (error) {
this.$message.error('导入失败:' + (error.response?.data?.msg || error.msg || '请检查文件内容后重试')) this.$message.error('导入失败,请检查文件内容后重试')
} finally { } finally {
this.importLoading = false this.importLoading = false
} }
@@ -110,7 +110,7 @@ layout("/layouts/platform.html"){
{prop: 'applyUnionName', label: '所属工会'}, {prop: 'applyUnionName', label: '所属工会'},
{prop: 'applyUnitName', label: '所属单位'}, {prop: 'applyUnitName', label: '所属单位'},
{prop: 'typeName', label: '慰问类型'}, {prop: 'typeName', label: '慰问类型'},
{prop: 'recipientCount', label: '慰问人数'}, {prop: 'taskName', label: '当前节点'},
{prop: 'instanceState', label: '流程状态'}, {prop: 'instanceState', label: '流程状态'},
], ],
unionList: [], unionList: [],
@@ -82,6 +82,7 @@ layout("/layouts/platform.html"){
</el-popover> </el-popover>
</table-tool> </table-tool>
<el-table <el-table
ref="memberTableRef"
:data="tableData" :data="tableData"
style="width: 100%" style="width: 100%"
stripe stripe
@@ -102,12 +103,12 @@ layout("/layouts/platform.html"){
<el-table-column <el-table-column
align="center" align="center"
header-align="center" header-align="center"
v-for="column in tableColumns" v-for="column in showColumns"
:key="column.prop"
show-overflow-tooltip show-overflow-tooltip
v-if="checkedFields.includes(column.prop)"
:label="column.label" :label="column.label"
:prop="column.prop" :prop="column.prop"
:width="column.width" :min-width="column.width || 120"
:fixed="column.fixed" :fixed="column.fixed"
:sortable="column.sortable" :sortable="column.sortable"
> >
@@ -268,6 +269,16 @@ layout("/layouts/platform.html"){
this.checkedFields = all.filter(p => !this.checkedFields.includes(p)); this.checkedFields = all.filter(p => !this.checkedFields.includes(p));
} }
}, },
watch: {
checkedFields() {
// 可见列更新后重新计算列宽,保证右侧固定操作列与表头、数据行对齐。
this.$nextTick(() => {
if (this.$refs.memberTableRef) {
this.$refs.memberTableRef.doLayout()
}
})
}
},
computed: { computed: {
showColumns() { showColumns() {
return this.tableColumns.filter(c => this.checkedFields.includes(c.prop)); return this.tableColumns.filter(c => this.checkedFields.includes(c.prop));
@@ -379,6 +379,9 @@ layout("/layouts/platform_h5.html"){
v-model="formData.bankOfDeposit" v-model="formData.bankOfDeposit"
label="开户行" label="开户行"
maxlength="20" maxlength="20"
type="textarea"
rows="4"
autosize
placeholder="请填写开户行" placeholder="请填写开户行"
:rules="[{ required: true }]" :rules="[{ required: true }]"
required required
@@ -197,7 +197,7 @@ layout("/layouts/platform_h5.html"){
<van-field :value="chooseType.name || formData.typeName" name="type" label="慰问类型" readonly clickable is-link required placeholder="请选择慰问类型" :rules="[{ validator: () => !!formData.type, message: '请选择慰问类型' }]" @click="showTypePickerClick"></van-field> <van-field :value="chooseType.name || formData.typeName" name="type" label="慰问类型" readonly clickable is-link required placeholder="请选择慰问类型" :rules="[{ validator: () => !!formData.type, message: '请选择慰问类型' }]" @click="showTypePickerClick"></van-field>
<van-popup v-model="showTypePicker" position="bottom" round get-container="body"><van-picker :columns="typeColumns" :default-index="typeDefaultIndex" show-toolbar @confirm="onTypeConfirm" @cancel="showTypePicker = false"></van-picker></van-popup> <van-popup v-model="showTypePicker" position="bottom" round get-container="body"><van-picker :columns="typeColumns" :default-index="typeDefaultIndex" show-toolbar @confirm="onTypeConfirm" @cancel="showTypePicker = false"></van-picker></van-popup>
<van-field v-model="formData.perMoney" name="perMoney" label="慰问金额" type="number" readonly required :rules="[{ validator: validateMoney, message: '金额须大于0且不超过10000元,最多两位小数' }]"></van-field> <van-field v-model="formData.perMoney" name="perMoney" label="每人金额" type="number" required :rules="[{ validator: validateMoney, message: '金额须大于0且不超过10000元,最多两位小数' }]"></van-field>
<van-field v-model="formData.occurTime" name="occurTime" label="慰问时间" readonly clickable is-link placeholder="请选择慰问时间" required :rules="[{ validator: value => $moment(value, 'YYYY-MM-DD', true).isValid(), message: '请选择有效慰问时间' }]" @click="showTimePickerClick"></van-field> <van-field v-model="formData.occurTime" name="occurTime" label="慰问时间" readonly clickable is-link placeholder="请选择慰问时间" required :rules="[{ validator: value => $moment(value, 'YYYY-MM-DD', true).isValid(), message: '请选择有效慰问时间' }]" @click="showTimePickerClick"></van-field>
<van-popup v-model="showTimePicker" position="bottom" round get-container="body"><van-datetime-picker v-if="showTimePicker" v-model="formData.occurDate" type="date" :min-date="minDate" :max-date="maxDate" title="请选择慰问时间" @confirm="confirmOccurTime" @cancel="showTimePicker = false"></van-datetime-picker></van-popup> <van-popup v-model="showTimePicker" position="bottom" round get-container="body"><van-datetime-picker v-if="showTimePicker" v-model="formData.occurDate" type="date" :min-date="minDate" :max-date="maxDate" title="请选择慰问时间" @confirm="confirmOccurTime" @cancel="showTimePicker = false"></van-datetime-picker></van-popup>
<van-field <van-field
@@ -258,7 +258,7 @@ layout("/layouts/platform_h5.html"){
<div v-for="(person, index) in formData.recipients" :key="index"> <div v-for="(person, index) in formData.recipients" :key="index">
<van-cell :title="'慰问对象 ' + (index + 1)" :title-style="{ fontWeight: 'bold' }"><van-button native-type="button" size="mini" @click="formData.recipients.splice(index, 1)">删除</van-button></van-cell> <van-cell :title="'慰问对象 ' + (index + 1)" :title-style="{ fontWeight: 'bold' }"><van-button native-type="button" size="mini" @click="formData.recipients.splice(index, 1)">删除</van-button></van-cell>
<h5-user-select v-model="person.helpUserId" :display-name="person.helpUserName" api="/platform/special_condolence/apply/listUser" label="慰问对象" placeholder="点击选择本工会人员" required :name="'recipients.' + index + '.helpUserId'" :rules="mobileRecipientRules('helpUserId', person)" @selected="(user, id) => recipientUserChange(person, index, id, user)"></h5-user-select> <h5-user-select v-model="person.helpUserId" :display-name="person.helpUserName" api="/platform/special_condolence/apply/listUser" label="慰问对象" placeholder="点击选择本工会人员" required :name="'recipients.' + index + '.helpUserId'" :rules="mobileRecipientRules('helpUserId', person)" @selected="(user, id) => recipientUserChange(person, index, id, user)"></h5-user-select>
<van-field v-model="person.helpLoginName" label="工号" readonly placeholder="选人后带出,劳务派遣可空" :required="!!person.helpUserId && person.personType !== '劳务派遣人员'" :name="'recipients.' + index + '.helpLoginName'" :rules="mobileRecipientRules('helpLoginName', person)"></van-field> <van-field v-model="person.helpLoginName" label="工号" readonly placeholder="选人后带出,劳务派遣可空" :required="person.personType !== '劳务派遣人员'" :name="'recipients.' + index + '.helpLoginName'" :rules="mobileRecipientRules('helpLoginName', person)"></van-field>
<van-field v-model="person.idCard" label="身份证号码" maxlength="18" required :name="'recipients.' + index + '.idCard'" :rules="mobileRecipientRules('idCard', person)"></van-field> <van-field v-model="person.idCard" label="身份证号码" maxlength="18" required :name="'recipients.' + index + '.idCard'" :rules="mobileRecipientRules('idCard', person)"></van-field>
<van-field v-model="person.bankOfDeposit" label="开户行" maxlength="100" required :name="'recipients.' + index + '.bankOfDeposit'" :rules="mobileRecipientRules('bankOfDeposit', person)"></van-field> <van-field v-model="person.bankOfDeposit" label="开户行" maxlength="100" required :name="'recipients.' + index + '.bankOfDeposit'" :rules="mobileRecipientRules('bankOfDeposit', person)"></van-field>
<van-field v-model="person.bankUserName" label="户名" maxlength="100" required :name="'recipients.' + index + '.bankUserName'" :rules="mobileRecipientRules('bankUserName', person)"></van-field> <van-field v-model="person.bankUserName" label="户名" maxlength="100" required :name="'recipients.' + index + '.bankUserName'" :rules="mobileRecipientRules('bankUserName', person)"></van-field>
@@ -340,8 +340,8 @@ layout("/layouts/platform_h5.html"){
}, },
mobileRecipientRules(field, person) { mobileRecipientRules(field, person) {
const names = { helpUserId: '慰问对象', helpLoginName: '工号', idCard: '身份证号码', bankOfDeposit: '开户行', bankUserName: '户名', bankCardNumber: '收款账户' } const names = { helpUserId: '慰问对象', helpLoginName: '工号', idCard: '身份证号码', bankOfDeposit: '开户行', bankUserName: '户名', bankCardNumber: '收款账户' }
if (field === 'helpLoginName') return [{ validator: value => !person.helpUserId || person.personType === '劳务派遣人员' || !!String(value || '').trim(), message: '请完善慰问对象信息(工号不能为空)' }] if (field === 'helpLoginName') return [{ validator: value => person.personType === '劳务派遣人员' || !!String(value || '').trim(), message: '普通人员工号不能为空' }]
if (field === 'helpUserId') return [{ validator: () => !!(person.helpUserId || person.helpUserName), message: '请选择慰问对象' }] if (field === 'helpUserId') return [{ validator: () => !!person.helpUserId, message: '请选择慰问对象' }]
const rules = [{ validator: value => !!String(value || '').trim(), message: '请填写' + names[field] }] const rules = [{ validator: value => !!String(value || '').trim(), message: '请填写' + names[field] }]
if (field === 'idCard') rules.push({ validator: value => this.validRecipientIdCard(value), message: '身份证号码不正确' }) if (field === 'idCard') rules.push({ validator: value => this.validRecipientIdCard(value), message: '身份证号码不正确' })
if (field === 'bankCardNumber') rules.push({ pattern: /^[0-9]{6,30}$/, message: '收款账户须为6至30位数字' }) if (field === 'bankCardNumber') rules.push({ pattern: /^[0-9]{6,30}$/, message: '收款账户须为6至30位数字' })
@@ -464,6 +464,7 @@ layout("/layouts/platform_h5.html"){
this.showTypePicker = false this.showTypePicker = false
}, },
onSave() { onSave() {
this.$refs.formRef.validate().then(() => {
this.$dialog.confirm({ this.$dialog.confirm({
title: "提示", title: "提示",
message: "您确定保存吗?" message: "您确定保存吗?"
@@ -475,6 +476,7 @@ layout("/layouts/platform_h5.html"){
} }
}) })
}) })
}).catch(errors => this.showInvalidApplicationTab(errors))
}, },
async onSubmit() { async onSubmit() {
this.$refs.formRef.validate().then(() => { this.$refs.formRef.validate().then(() => {