Merge remote-tracking branch 'origin/main'

This commit is contained in:
2026-04-30 09:23:12 +08:00
9 changed files with 809 additions and 328 deletions
@@ -8,11 +8,9 @@ import com.budwk.app.base.service.BaseService;
import com.budwk.app.bpm.enums.BpmProcessInstanceStatusEnum;
import com.budwk.app.bpm.enums.BpmProcessTaskStatusEnum;
import com.budwk.app.flow.enums.ProcessInstanceStateEnum;
import com.budwk.app.sys.models.Sys_role;
import com.budwk.app.sys.models.Sys_user_role;
import com.budwk.app.sys.services.SysRoleService;
import com.budwk.app.web.commons.auth.utils.AuthUtil;
import com.budwk.app.web.commons.auth.utils.SecurityUtil;
import com.budwk.app.zhgh.club.model.ClubUser;
import com.budwk.app.zhgh.club.model.SysClub;
import com.budwk.app.zhgh.club.service.SysClubService;
import org.nutz.dao.Cnd;
@@ -38,8 +36,6 @@ public class ClubCommonController {
@Inject
private SysClubService sysClubService;
@Inject
private SysRoleService sysRoleService;
@At
@SaCheckLogin
@@ -62,9 +58,9 @@ public class ClubCommonController {
public Result listClubByRole() {
Cnd cnd = Cnd.NEW();
if (!AuthUtil.hasRoleOr(RoleConstant.SYSADMIN.name(), RoleConstant.SCHOOL_UNION_ADMIN.name())) {
Sys_role sysRole = sysRoleService.getByCode(RoleConstant.CLUB_PRESIDENT);
List<Sys_user_role> userRoles = sysClubService.dao().query(Sys_user_role.class, Cnd.where("userId", "=", SecurityUtil.getUserId()).and("roleId", "=", sysRole.getId()));
List<String> myClubId = userRoles.stream().map(Sys_user_role::getClubId).toList();
// 报销申请只允许选择当前用户已加入的协会,避免看到未加入的协会数据。
List<ClubUser> clubUsers = sysClubService.dao().query(ClubUser.class, Cnd.where("userId", "=", SecurityUtil.getUserId()));
List<String> myClubId = clubUsers.stream().map(ClubUser::getClubId).distinct().toList();
cnd.and("c.id", "in", myClubId);
}
cnd.and("inst.state","=",ProcessInstanceStateEnum.FINISHED.getCode());
@@ -1,6 +1,7 @@
package com.budwk.app.zhgh.dayofficework.outlay.outlayManage.service.impl;
import com.budwk.app.base.service.impl.BaseServiceImpl;
import com.budwk.app.zhgh.dayofficework.outlay.outlayManage.club.model.OutlayManageClub;
import com.budwk.app.zhgh.dayofficework.outlay.outlayManage.model.OutlayUseDetail;
import com.budwk.app.zhgh.dayofficework.outlay.outlayManage.school.model.OutlayManageSchool;
import com.budwk.app.zhgh.dayofficework.outlay.outlayManage.service.OutlayUseDetailService;
@@ -21,49 +22,65 @@ public class OutlayUseDetailServiceImpl extends BaseServiceImpl<OutlayUseDetail>
@Override
public void doDeleteDetail(String id, String outlayType) {
//更新预算表的金额
updateOutlayManage(id, null,outlayType,false);
//更新完删除
// 先回滚对应预算的已使用额度,再删除详情记录。
updateOutlayManage(id, null, outlayType, false);
delete(id);
}
@Override
public void doEditDetail(OutlayUseDetail outlayUseDetail,String outlayType) {
updateOutlayManage(outlayUseDetail.getId(), outlayUseDetail,outlayType,true);
public void doEditDetail(OutlayUseDetail outlayUseDetail, String outlayType) {
// 编辑详情时需要先回退旧金额,再叠加新金额,保证预算台账准确。
updateOutlayManage(outlayUseDetail.getId(), outlayUseDetail, outlayType, true);
update(outlayUseDetail);
}
/**
* 更新预算表
* 同步预算主表的已使用额度,保证校工会、分工会、协会三类台账口径一致。
*
* @param id
* @param outlayType
* @param id 详情主键
* @param outlayUseDetail 编辑后的详情对象,删除场景可为空
* @param outlayType 预算类型:school/union/club
* @param isEdit 是否为编辑场景
*/
private void updateOutlayManage(String id, OutlayUseDetail outlayUseDetail,String outlayType,Boolean isEdit) {
//找到是哪一条的预算详情
private void updateOutlayManage(String id, OutlayUseDetail outlayUseDetail, String outlayType, Boolean isEdit) {
OutlayUseDetail detail = fetch(id);
//拿到预算详情的调整金额
if (outlayType.equals("school")) {
//找到预算分配的记录
if (detail == null) {
return;
}
if ("school".equals(outlayType)) {
OutlayManageSchool manageSchool = dao().fetch(OutlayManageSchool.class, detail.getOutlayManageId());
if (manageSchool == null) {
return;
}
manageSchool.setUsedQuota(manageSchool.getUsedQuota().subtract(detail.getAdjustMoney()));
if (isEdit){
//如果是修改,就先减去原来的值在加上现在新的值
if (Boolean.TRUE.equals(isEdit) && outlayUseDetail != null) {
manageSchool.setUsedQuota(manageSchool.getUsedQuota().add(outlayUseDetail.getAdjustMoney()));
}
update(manageSchool);
} else if (outlayType.equals("union")) {
return;
}
if ("union".equals(outlayType)) {
OutlayManageUnion manageUnion = dao().fetch(OutlayManageUnion.class, detail.getOutlayManageId());
if (manageUnion == null) {
return;
}
manageUnion.setUsedQuota(manageUnion.getUsedQuota().subtract(detail.getAdjustMoney()));
if (isEdit){
//如果是修改,就先减去原来的值在加上现在新的值
if (Boolean.TRUE.equals(isEdit) && outlayUseDetail != null) {
manageUnion.setUsedQuota(manageUnion.getUsedQuota().add(outlayUseDetail.getAdjustMoney()));
}
update(manageUnion);
return;
}
if ("club".equals(outlayType)) {
OutlayManageClub manageClub = dao().fetch(OutlayManageClub.class, detail.getOutlayManageId());
if (manageClub == null) {
return;
}
manageClub.setUsedQuota(manageClub.getUsedQuota().subtract(detail.getAdjustMoney()));
if (Boolean.TRUE.equals(isEdit) && outlayUseDetail != null) {
manageClub.setUsedQuota(manageClub.getUsedQuota().add(outlayUseDetail.getAdjustMoney()));
}
update(manageClub);
}
}
}
@@ -259,7 +259,14 @@ public class UnionReimburseApplyController {
return Result.success(value);
}
// 如果没有找到该社团的经费记录,返回0
return Result.success(0.0);
// 协会在年度预算分配之后才创建时,不会自动生成当年预算记录,这里给出明确提示。
return Result.error("该协会本年度未生成预算记录,请先在协会预算分配中补分配");
}
@At
@ApiOperation("统一查询经费余额")
@SaCheckPermission(value = {"unionReimburse.apply", "h5.unionReimburse.apply"}, mode = SaMode.OR)
public Result getBudgetBalance(String reimburseFundSource, String clubId) {
return unionReimburseService.getBudgetBalance(reimburseFundSource, clubId);
}
}
@@ -15,7 +15,6 @@ 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;
@@ -27,18 +26,15 @@ import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok;
import org.nutz.mvc.annotation.Param;
import java.util.Date;
import java.util.List;
@IocBean
@At("/platform/unionReimburse/review")
@Ok("json:full")
@Api("审核报销")
@Api("工会报销审核")
@Slf4j
public class UnionReimburseReviewController {
@Inject
private Dao dao;
@Inject
private UnionReimburseService unionReimburseService;
@@ -98,42 +94,34 @@ public class UnionReimburseReviewController {
}
@At
@ApiOperation("审核")
@ApiOperation("审核报销")
@Aop(TransAop.READ_COMMITTED)
@SaCheckPermission(value = {"unionReimburse.review", "h5.unionReimburse.review"}, mode = SaMode.OR)
@SLog(tag = "审核工会报销", msg = "审核工会报销")
@SLog(tag = "工会报销审核", msg = "审核工会报销")
public Result reviewTask(@Param("data") UnionReimburse unionReimburse, String submitType) {
if (submitType == null || !List.of("3", "4", "5").contains(submitType)) {
return Result.error("无效的审核操作类型");
}
UnionReimburse dbRecord = dao.fetch(UnionReimburse.class, unionReimburse.getId());
if (dbRecord == null) {
return Result.error("记录不存在");
}
dbRecord.setReviewTime(new Date());
dbRecord.setStateId(Integer.parseInt(submitType));
dbRecord.setReviewOpinion(unionReimburse.getReviewOpinion());
dao.update(dbRecord);
return Result.success();
return unionReimburseService.reviewApply(unionReimburse.getId(), unionReimburse.getReviewOpinion(), Integer.parseInt(submitType));
}
@At
@ApiOperation("一键审核")
@Aop(TransAop.READ_COMMITTED)
@SaCheckPermission(value = {"unionReimburse.review", "h5.unionReimburse.review"}, mode = SaMode.OR)
@SLog(tag = "一键审核", msg = "一键审核")
@SLog(tag = "工会报销审核", msg = "一键审核工会报销")
public Result allReview() {
try {
List<UnionReimburse> reimbursements = unionReimburseService.query(Cnd.where("stateId", "=", 2));
for (UnionReimburse reimbursement : reimbursements) {
reimbursement.setStateId(3);
reimbursement.setReviewTime(new Date());
reimbursement.setReviewOpinion("通过");
dao.update(reimbursement);
Result result = unionReimburseService.reviewApply(reimbursement.getId(), "通过", 3);
if (result.getCode() != 0) {
return result;
}
}
return Result.success("一键审核完成,共处理 " + reimbursements.size() + " 条记录");
return Result.success("一键审核完成,共处理" + reimbursements.size() + "条记录");
} catch (Exception e) {
log.error("一键审核失败");
log.error("一键审核失败", e);
return Result.error("一键审核失败: " + e.getMessage());
}
}
@@ -1,7 +1,7 @@
package com.budwk.app.zhgh.dayofficework.unionReimburse.service;
import com.budwk.app.base.service.BaseService;
import com.budwk.app.base.result.Result;
import com.budwk.app.base.service.BaseService;
import com.budwk.app.zhgh.dayofficework.unionReimburse.model.UnionReimburse;
import com.budwk.app.zhgh.dayofficework.unionReimburse.param.UnionReimbursePageForm;
import com.budwk.app.zhgh.dayofficework.unionReimburse.vo.UnionReimburseBankHistoryVO;
@@ -9,7 +9,7 @@ import org.nutz.dao.sql.Sql;
import java.util.List;
public interface UnionReimburseService extends BaseService<UnionReimburse> {
public interface UnionReimburseService extends BaseService<UnionReimburse> {
Sql getSql(UnionReimbursePageForm pageForm);
@@ -19,7 +19,7 @@ public interface UnionReimburseService extends BaseService<UnionReimburse> {
Result saveApply(UnionReimburse unionReimburse, int stateId);
/**
* 查询申请表单详情,补齐发票明细回显数据。
* 查询申请表单详情,补齐发票明细回显数据。
*/
UnionReimburse getApplyForm(String id);
@@ -34,8 +34,17 @@ public interface UnionReimburseService extends BaseService<UnionReimburse> {
Result checkInvoiceDuplicate(String invoiceNo, String reimburseId);
/**
* 识别单张发票文件,并在需要时调用腾讯云验真接口补齐票面信息。
* 识别单张发票文件,并在需要时调用验真接口补齐票面信息。
*/
Result recognizeInvoice(String fileId, Boolean verifySwitch);
/**
* 查询报销可用经费余额,同时校验是否已分配以及协会归属权限。
*/
Result getBudgetBalance(String reimburseFundSource, String clubId);
/**
* 审核报销,审核通过时扣减对应预算并新增预算使用详情。
*/
Result reviewApply(String reimburseId, String reviewOpinion, int submitType);
}
@@ -8,6 +8,11 @@ import com.budwk.app.base.result.Result;
import com.budwk.app.base.service.impl.BaseServiceImpl;
import com.budwk.app.sys.models.Sys_file;
import com.budwk.app.sys.services.SysFileService;
import com.budwk.app.zhgh.club.model.ClubUser;
import com.budwk.app.zhgh.dayofficework.outlay.outlayManage.club.model.OutlayManageClub;
import com.budwk.app.zhgh.dayofficework.outlay.outlayManage.model.OutlayUseDetail;
import com.budwk.app.zhgh.dayofficework.outlay.outlayManage.school.model.OutlayManageSchool;
import com.budwk.app.zhgh.dayofficework.outlay.outlayManage.union.model.OutlayManageUnion;
import com.budwk.app.zhgh.dayofficework.unionReimburse.model.UnionReimburse;
import com.budwk.app.zhgh.dayofficework.unionReimburse.model.UnionReimburseInvoiceDetail;
import com.budwk.app.zhgh.dayofficework.unionReimburse.param.UnionReimbursePageForm;
@@ -123,6 +128,10 @@ public class UnionReimburseServiceImpl extends BaseServiceImpl<UnionReimburse> i
if (validateResult != null) {
return validateResult;
}
Result fundValidateResult = validateFundSourceBeforeSubmit(unionReimburse);
if (fundValidateResult != null) {
return fundValidateResult;
}
Result duplicateResult = validateInvoiceDuplicate(unionReimburse);
if (duplicateResult != null) {
return duplicateResult;
@@ -232,8 +241,80 @@ public class UnionReimburseServiceImpl extends BaseServiceImpl<UnionReimburse> i
}
/**
* 统一规整发票明细中的文本和金额,避免空格、空数组等脏数据进入库表
* 按经费来源统一查询当前可用余额,未分配或权限不匹配时直接拦截
*/
@Override
public Result getBudgetBalance(String reimburseFundSource, String clubId) {
if (StrUtil.isBlank(reimburseFundSource)) {
return Result.error("请选择经费来源");
}
if ("UNION_REIMBURSE_FUND_SOURCE_1".equals(reimburseFundSource)) {
OutlayManageSchool outlayManageSchool = dao().fetch(OutlayManageSchool.class,
Cnd.where("year", "=", DateUtil.thisYear()));
if (outlayManageSchool == null) {
return Result.error("校工会经费未分配");
}
return Result.success(formatMoney(outlayManageSchool.getTotalQuota().subtract(outlayManageSchool.getUsedQuota())));
}
if ("UNION_REIMBURSE_FUND_SOURCE_2".equals(reimburseFundSource)) {
OutlayManageUnion outlayManageUnion = dao().fetch(OutlayManageUnion.class,
Cnd.where("unionId", "=", SecurityUtil.getUnionId()).and("year", "=", DateUtil.thisYear()));
if (outlayManageUnion == null) {
return Result.error("分工会经费未分配");
}
return Result.success(formatMoney(outlayManageUnion.getTotalQuota().subtract(outlayManageUnion.getUsedQuota())));
}
if ("UNION_REIMBURSE_FUND_SOURCE_3".equals(reimburseFundSource)) {
if (StrUtil.isBlank(clubId)) {
return Result.error("请选择协会");
}
List<String> myClubIds = getCurrentUserClubIds();
if (!isAdmin() && !myClubIds.contains(clubId)) {
return Result.error("当前用户无权使用该协会经费");
}
OutlayManageClub outlayManageClub = dao().fetch(OutlayManageClub.class,
Cnd.where("clubId", "=", clubId).and("year", "=", DateUtil.thisYear()));
if (outlayManageClub == null) {
return Result.error("该协会本年度未生成预算记录,请先在协会预算分配中补分配");
}
return Result.success(formatMoney(outlayManageClub.getTotalQuota().subtract(outlayManageClub.getUsedQuota())));
}
return Result.error("不支持的经费来源");
}
/**
* 审核通过时统一校验余额、扣减预算并写入预算使用详情,避免控制器分散业务逻辑。
*/
@Override
public Result reviewApply(String reimburseId, String reviewOpinion, int submitType) {
if (!List.of(3, 4, 5).contains(submitType)) {
return Result.error("无效的审核操作类型");
}
UnionReimburse dbRecord = this.fetch(reimburseId);
if (dbRecord == null) {
return Result.error("记录不存在");
}
if (submitType == 3) {
// 已通过的单据再次触发通过时直接返回,避免重复扣减预算。
if (Integer.valueOf(3).equals(dbRecord.getStateId())) {
return Result.success();
}
Result validateResult = validateFundSourceBeforeSubmit(dbRecord);
if (validateResult != null) {
return validateResult;
}
Result deductResult = deductBudgetAndSaveUseDetail(dbRecord);
if (deductResult != null && deductResult.getCode() != 0) {
return deductResult;
}
}
dbRecord.setReviewTime(new Date());
dbRecord.setStateId(submitType);
dbRecord.setReviewOpinion(reviewOpinion);
dao().update(dbRecord);
return Result.success();
}
private void normalizeInvoiceDetails(UnionReimburse unionReimburse) {
if (unionReimburse.getInvoiceDetails() == null) {
unionReimburse.setInvoiceDetails(new ArrayList<>());
@@ -289,15 +370,15 @@ public class UnionReimburseServiceImpl extends BaseServiceImpl<UnionReimburse> i
if (!isValidContact(unionReimburse.getMobile())) {
return Result.error("请输入正确的联系方式");
}
if (StrUtil.isBlank(unionReimburse.getBankUserName())) {
return Result.error("请填写户名");
}
if (StrUtil.isBlank(unionReimburse.getBankCardNumber())) {
return Result.error("请填写银行账号");
}
if (StrUtil.isBlank(unionReimburse.getBankOfDeposit())) {
return Result.error("请填写开户行");
}
// if (StrUtil.isBlank(unionReimburse.getBankUserName())) {
// return Result.error("请填写户名");
// }
// if (StrUtil.isBlank(unionReimburse.getBankCardNumber())) {
// return Result.error("请填写银行账号");
// }
// if (StrUtil.isBlank(unionReimburse.getBankOfDeposit())) {
// return Result.error("请填写开户行");
// }
if (StrUtil.isBlank(unionReimburse.getPaymentNotes())) {
return Result.error("请填写支付内容");
}
@@ -342,8 +423,159 @@ public class UnionReimburseServiceImpl extends BaseServiceImpl<UnionReimburse> i
}
/**
* 同次提交和历史记录都要拦截重复发票,避免重复报销
* 提交和审核前统一校验预算是否已分配、余额是否充足
*/
private Result validateFundSourceBeforeSubmit(UnionReimburse unionReimburse) {
Result balanceResult = getBudgetBalance(unionReimburse.getReimburseFundSource(), unionReimburse.getClubId());
if (balanceResult == null || balanceResult.getCode() != 0) {
return balanceResult == null ? Result.error("经费余额校验失败") : balanceResult;
}
BigDecimal applyMoney = getApplyMoney(unionReimburse);
if (applyMoney.compareTo(BigDecimal.ZERO) <= 0) {
return Result.error("报销金额必须大于0");
}
BigDecimal balance = new BigDecimal(String.valueOf(balanceResult.getData()));
if (balance.compareTo(applyMoney) < 0) {
return Result.error("经费余额不足,当前余额:" + formatMoney(balance));
}
unionReimburse.setFundBalance(balance.doubleValue());
return null;
}
/**
* 审核通过后按经费来源扣减预算,并补写预算使用详情,便于后续台账追踪。
*/
private Result deductBudgetAndSaveUseDetail(UnionReimburse unionReimburse) {
BigDecimal applyMoney = getApplyMoney(unionReimburse);
String reimburseFundSource = unionReimburse.getReimburseFundSource();
if ("UNION_REIMBURSE_FUND_SOURCE_1".equals(reimburseFundSource)) {
OutlayManageSchool outlayManageSchool = dao().fetch(OutlayManageSchool.class,
Cnd.where("year", "=", DateUtil.thisYear()));
if (outlayManageSchool == null) {
return Result.error("校工会经费未分配");
}
if (outlayManageSchool.getTotalQuota().subtract(outlayManageSchool.getUsedQuota()).compareTo(applyMoney) < 0) {
return Result.error("校工会经费余额不足");
}
outlayManageSchool.setUsedQuota(outlayManageSchool.getUsedQuota().add(applyMoney));
dao().updateIgnoreNull(outlayManageSchool);
insertUseDetail(unionReimburse, outlayManageSchool.getId(), applyMoney);
return Result.success();
}
if ("UNION_REIMBURSE_FUND_SOURCE_2".equals(reimburseFundSource)) {
OutlayManageUnion outlayManageUnion = dao().fetch(OutlayManageUnion.class,
Cnd.where("unionId", "=", unionReimburse.getUnionId()).and("year", "=", DateUtil.thisYear()));
if (outlayManageUnion == null) {
return Result.error("分工会经费未分配");
}
if (outlayManageUnion.getTotalQuota().subtract(outlayManageUnion.getUsedQuota()).compareTo(applyMoney) < 0) {
return Result.error("分工会经费余额不足");
}
outlayManageUnion.setUsedQuota(outlayManageUnion.getUsedQuota().add(applyMoney));
dao().updateIgnoreNull(outlayManageUnion);
insertUseDetail(unionReimburse, outlayManageUnion.getId(), applyMoney);
return Result.success();
}
if ("UNION_REIMBURSE_FUND_SOURCE_3".equals(reimburseFundSource)) {
OutlayManageClub outlayManageClub = dao().fetch(OutlayManageClub.class,
Cnd.where("clubId", "=", unionReimburse.getClubId()).and("year", "=", DateUtil.thisYear()));
if (outlayManageClub == null) {
return Result.error("该协会本年度未生成预算记录,请先在协会预算分配中补分配");
}
if (outlayManageClub.getTotalQuota().subtract(outlayManageClub.getUsedQuota()).compareTo(applyMoney) < 0) {
return Result.error("协会经费余额不足");
}
outlayManageClub.setUsedQuota(outlayManageClub.getUsedQuota().add(applyMoney));
dao().updateIgnoreNull(outlayManageClub);
insertUseDetail(unionReimburse, outlayManageClub.getId(), applyMoney);
return Result.success();
}
return Result.error("不支持的经费来源");
}
/**
* 一张报销单只写入一条预算使用详情,避免重复通过或重复点击造成重复明细。
*/
private void insertUseDetail(UnionReimburse unionReimburse, String outlayManageId, BigDecimal applyMoney) {
OutlayUseDetail oldDetail = dao().fetch(OutlayUseDetail.class, Cnd.where("outlayReimburseId", "=", unionReimburse.getId()));
if (oldDetail != null) {
return;
}
OutlayUseDetail detail = new OutlayUseDetail();
detail.setOutlayManageId(outlayManageId);
detail.setOutlayReimburseId(unionReimburse.getId());
detail.setAdjustMoney(applyMoney);
detail.setAdjustReason(StrUtil.blankToDefault(unionReimburse.getPaymentNotes(), getReimburseProjectName(unionReimburse.getReimburseProject())));
detail.setAdjustUserId(SecurityUtil.getUserId());
detail.setAdjustUserName(SecurityUtil.getUserUsername());
detail.setAdjustLoginName(SecurityUtil.getUserLoginname());
detail.setProjectName(buildUseDetailProjectName(unionReimburse));
detail.setActivityNumber(unionReimburse.getActivityNumber());
detail.setActivityTime(buildUseDetailTime(unionReimburse));
dao().insert(detail);
}
private BigDecimal getApplyMoney(UnionReimburse unionReimburse) {
Double money = "UNION_REIMBURSE_PROJECT_1".equals(unionReimburse.getReimburseProject())
? unionReimburse.getCondolenceMoney() : unionReimburse.getMoney();
return BigDecimal.valueOf(money == null ? 0D : money).setScale(2, RoundingMode.HALF_UP);
}
private String buildUseDetailProjectName(UnionReimburse unionReimburse) {
if (StrUtil.isNotBlank(unionReimburse.getActivityName())) {
return unionReimburse.getActivityName();
}
if (StrUtil.isNotBlank(unionReimburse.getCondolenceUserName())) {
return getReimburseProjectName(unionReimburse.getReimburseProject()) + "-" + unionReimburse.getCondolenceUserName();
}
return StrUtil.blankToDefault(unionReimburse.getDocumentNo(), getReimburseProjectName(unionReimburse.getReimburseProject()));
}
private String buildUseDetailTime(UnionReimburse unionReimburse) {
if (unionReimburse.getActivityTime() != null) {
return DateUtil.formatDate(unionReimburse.getActivityTime());
}
if (unionReimburse.getCondolenceTime() != null) {
return DateUtil.formatDate(unionReimburse.getCondolenceTime());
}
if (unionReimburse.getCreateTime() != null) {
return DateUtil.formatDate(unionReimburse.getCreateTime());
}
return "";
}
private String getReimburseProjectName(String reimburseProject) {
if ("UNION_REIMBURSE_PROJECT_1".equals(reimburseProject)) {
return "慰问申请";
}
if ("UNION_REIMBURSE_PROJECT_2".equals(reimburseProject)) {
return "文体活动申请";
}
if ("UNION_REIMBURSE_PROJECT_3".equals(reimburseProject)) {
return "日常活动申请";
}
if ("UNION_REIMBURSE_PROJECT_4".equals(reimburseProject)) {
return "专项活动申请";
}
return "报销申请";
}
private Double formatMoney(BigDecimal money) {
return money == null ? 0D : money.setScale(2, RoundingMode.HALF_UP).doubleValue();
}
private List<String> getCurrentUserClubIds() {
if (isAdmin()) {
return new ArrayList<>();
}
List<ClubUser> clubUsers = dao().query(ClubUser.class, Cnd.where("userId", "=", SecurityUtil.getUserId()));
return clubUsers.stream()
.map(ClubUser::getClubId)
.filter(StrUtil::isNotBlank)
.distinct()
.collect(Collectors.toList());
}
private Result validateInvoiceDuplicate(UnionReimburse unionReimburse) {
Map<String, List<Integer>> currentInvoiceMap = new LinkedHashMap<>();
List<UnionReimburseInvoiceDetail> details = unionReimburse.getInvoiceDetails();
@@ -38,7 +38,7 @@ layout("/layouts/platform.html"){
<div class="search-item-label">活动项目</div>
<div class="search-item-option">
<el-select v-model="pageForm.eventId" placeholder="请选择活动项目" filterable clearable
style="width: 100%" @change="doSearchS">
style="width: 100%" @change="doSearch">
<el-option
v-for="item in events"
:key="item.eventId"
@@ -49,6 +49,51 @@ layout("/layouts/platform.html"){
</div>
</div>
<div class="search-item">
<div class="search-item-label">男子女子</div>
<div class="search-item-option">
<el-select v-model="pageForm.isMenWomen" placeholder="请选择男子女子" clearable
style="width: 100%" @change="doSearch">
<el-option
v-for="item in menWomenList"
:key="item.id"
:label="item.name"
:value="item.id">
</el-option>
</el-select>
</div>
</div>
<div class="search-item">
<div class="search-item-label">项目类型</div>
<div class="search-item-option">
<el-select v-model="pageForm.projectType" placeholder="请选择项目类型" clearable
style="width: 100%" @change="doSearch">
<el-option
v-for="item in projectTypeList"
:key="item.id"
:label="item.name"
:value="item.id">
</el-option>
</el-select>
</div>
</div>
<div class="search-item">
<div class="search-item-label">比赛组别</div>
<div class="search-item-option">
<el-select v-model="pageForm.competitionCategory" placeholder="请选择比赛组别" filterable clearable
style="width: 100%" @change="doSearch">
<el-option
v-for="item in groupList"
:key="item.id"
:label="item.name"
:value="item.id">
</el-option>
</el-select>
</div>
</div>
</div>
</el-card>
@@ -125,7 +170,7 @@ layout("/layouts/platform.html"){
</template>
<template #edit_func>
<el-button type="primary" @click="openAdd" v-if="awardsMode==1">临时获奖人员添加</el-button>
<el-button type="primary" @click="openAdd">临时获奖人员添加</el-button>
<el-button type="primary" @click="doAdd">确 定</el-button>
</template>
@@ -431,11 +476,14 @@ layout("/layouts/platform.html"){
return {
userOptions: [],
groupList: [
{value: 1, name: "甲组"},
{value: 2, name: "乙组"},
{value: 3, name: "丙组"},
{value: 4, name: "丁组"}
groupList: [],
menWomenList: [
{id: 1, name: "男子"},
{id: 2, name: "女子"}
],
projectTypeList: [
{id: "1", name: "单项"},
{id: "2", name: "团体"}
],
dialogVisible: false,
viewData: [],
@@ -465,7 +513,9 @@ layout("/layouts/platform.html"){
{name: "第八名", id: 8}],
sexList: [{sex: "男", id: 1}, {sex: "女", id: 2}],
pageForm: {
isMenWomen: [],
isMenWomen: "",
projectType: "",
competitionCategory: "",
year: new Date().getFullYear() + "",
},
formRules: {
@@ -511,7 +561,7 @@ layout("/layouts/platform.html"){
},
async unitChange() {
const unit = this.unitOptions.find(v => v.id === this.formData.unitId)
this.$set(this.formData, "unionId", unit.id)
this.$set(this.formData, "unionId", unit.unionId)
this.$set(this.formData, "unionname", unit.unionName)
this.$set(this.formData, "unitname", unit.name)
},
@@ -545,8 +595,14 @@ layout("/layouts/platform.html"){
pageForm.identity = JSON.stringify(this.formData.identity)
const resp = await this.$axios.post(loc() + "/doAddUser", pageForm)
if (resp.code === 0) {
await this.userChange()
this.userDetailsChange()
if (this.awardsMode == 2) {
this.unionList = await this.getUnionList({activityId: this.activityId, eventId: this.eventId})
this.userData = await this.getUnionData({activityId: this.activityId, eventId: this.eventId})
await this.unionDetailsChange()
} else {
await this.userChange()
this.userDetailsChange()
}
this.dialogVisible = false
} else {
this.notifyWarning(resp.msg)
@@ -554,21 +610,24 @@ layout("/layouts/platform.html"){
}
})
},
async yearChange() {
yearChange() {
this.activityList = []
this.events = []
this.$set(this.pageForm, "activityId", "")
this.$set(this.pageForm, "eventId", "")
const {data} = await this.$axios.post("/platform/activity/score/statistics/getActivitys", {year: this.pageForm.year})
this.activityList = data
if (data.length > 0) {
this.pageForm.activityId = this.activityList[0].id
}
await this.doSearchS()
this.$axios.post("/platform/activity/score/statistics/getActivitys", {year: this.pageForm.year}).then((res) => {
const data = res.data
this.activityList = data
if (data.length > 0) {
this.pageForm.activityId = this.activityList[0].id
}
this.doSearchS()
})
},
async changeActivit() {
const resp = await this.$axios.post("/platform/activity/apply/getEvents", {activityId: this.pageForm.activityId})
this.events = resp.data
changeActivit() {
return this.$axios.post("/platform/activity/apply/getEvents", {activityId: this.pageForm.activityId}).then((resp) => {
this.events = resp.data
})
},
async doAdd() {
@@ -802,25 +861,34 @@ layout("/layouts/platform.html"){
},
async getActivitys() {
const {data} = await this.$axios.post("/platform/activity/score/statistics/getActivitys", {year: this.pageForm.year})
return data;
getActivitys() {
return this.$axios.post("/platform/activity/score/statistics/getActivitys", {year: this.pageForm.year}).then((res) => {
return res.data
})
},
async doSearchS() {
this.doSearch()
await this.changeActivit()
focusGroup() {
this.$axios.post("/platform/activity/basic/event/focusGroup").then((resp) => {
if (resp.code === 0) {
this.groupList = resp.data
} else {
this.notifyWarning(resp.msg)
}
})
},
doSearchS() {
this.$set(this.pageForm, "eventId", "")
this.changeActivit().then(() => {
this.doSearch()
})
},
doSearch() {
this.pageForm.pageNumber = 1
this.pageData()
},
pageData() {
this.tabLoading = true
this.tableLoading = true
const pageForm = clone(this.pageForm)
pageForm.isMenWomen = JSON.stringify(pageForm.isMenWomen)
this.$axios.post("/platform/activity/results/input/pageData", pageForm).then(resp => {
this.tabLoading = false
if (resp.code == 0) {
this.tableData = resp.data.list;
this.pageForm.totalCount = resp.data.totalCount;
@@ -830,20 +898,16 @@ layout("/layouts/platform.html"){
type: 'error'
});
}
}).finally(() => {
this.tableLoading = false
})
},
},
async created() {
created() {
this.focusGroup()
this.yearChange()
// this.pageData()
this.activityList = await this.getActivitys()
if (this.activityList.length) {
this.pageForm.activityId = this.activityList[0].id
}
await this.changeActivit()
this.pageData()
}
})
</script>
@@ -51,8 +51,66 @@ layout("/layouts/platform.html"){
<el-tabs class="reimbursement-tabs" v-model="activeTabName">
<el-tab-pane label="申请基本信息" name="basic">
<el-descriptions :column="2" border>
<el-descriptions-item label="经办人">{{formData.userName}}</el-descriptions-item>
<el-descriptions-item label="经费来源" span="2">
<el-form-item label="经费来源" prop="reimburseFundSource">
<el-radio-group v-model="formData.reimburseFundSource" size="medium" @change="selectFundSource">
<el-radio v-if="$auth.hasPermission('unionReimburse.xgh')"
label="UNION_REIMBURSE_FUND_SOURCE_1"
border>校工会经费</el-radio>
<el-radio v-if="$auth.hasPermission('unionReimburse.fgh')"
label="UNION_REIMBURSE_FUND_SOURCE_2"
border>分工会经费</el-radio>
<el-radio v-if="$auth.hasPermission('unionReimburse.club')"
label="UNION_REIMBURSE_FUND_SOURCE_3"
border>协会经费</el-radio>
</el-radio-group>
<!-- <span class="invoice-summary-tip" v-if="fundBalanceText">余额:{{fundBalanceText}}</span>-->
</el-form-item>
</el-descriptions-item>
<el-descriptions-item label="报销项目" :span="2">
<el-form-item label="报销项目" prop="reimburseProject">
<el-radio-group v-model="formData.reimburseProject" size="medium" @change="handleReimburseProjectChange">
<el-radio :label="item.code" border v-for="item in reimburseProjectList">
{{item.name}}
</el-radio>
</el-radio-group>
</el-form-item>
</el-descriptions-item>
<el-descriptions-item label="支付方式">
<el-form-item label="支付方式" prop="paymentWay">
<el-radio-group v-model="formData.paymentWay" size="medium">
<el-radio :label="item.code" border v-for="item in dict.type.UNION_REIMBURSE_PAYMENT_WAY">
{{item.name}}
</el-radio>
</el-radio-group>
</el-form-item>
</el-descriptions-item>
<el-descriptions-item label="工号">{{formData.loginName}}</el-descriptions-item>
<el-descriptions-item label="经办人">{{formData.userName}}</el-descriptions-item>
<el-descriptions-item label="所属协会" v-if="formData.reimburseFundSource === 'UNION_REIMBURSE_FUND_SOURCE_3'">
<el-form-item label="所属协会" prop="clubId">
<el-select clearable
placeholder="请选择协会"
style="width: 100%;"
v-model="formData.clubId"
@change="clubChange">
<el-option
:key="item.id"
:label="item.clubName"
:value="item.id"
v-for="item in clubOptions">
</el-option>
</el-select>
</el-form-item>
</el-descriptions-item>
<el-descriptions-item label="余额" v-if="formData.reimburseFundSource">
<el-form-item label="余额">
<el-input :value="fundBalanceText" readonly></el-input>
</el-form-item>
</el-descriptions-item>
<!-- <el-descriptions-item label="报销类别">-->
<!-- <el-form-item label="报销类别" prop="reimburseType">-->
<!-- <el-radio-group v-model="formData.reimburseType" size="medium">-->
@@ -62,24 +120,8 @@ layout("/layouts/platform.html"){
<!-- </el-radio-group>-->
<!-- </el-form-item>-->
<!-- </el-descriptions-item>-->
<el-descriptions-item label="报销项目" span="2">
<el-form-item label="报销项目" prop="reimburseProject">
<el-radio-group v-model="formData.reimburseProject" size="medium" @change="handleReimburseProjectChange">
<el-radio :label="item.code" border v-for="item in reimburseProjectList">
{{item.name}}
</el-radio>
</el-radio-group>
</el-form-item>
</el-descriptions-item>
<el-descriptions-item label="支付方式">
<el-form-item label="支付方式" prop="paymentWay">
<el-radio-group v-model="formData.paymentWay" size="medium">
<el-radio :label="item.code" border v-for="item in dict.type.UNION_REIMBURSE_PAYMENT_WAY">
{{item.name}}
</el-radio>
</el-radio-group>
</el-form-item>
</el-descriptions-item>
<!-- <el-descriptions-item label="报销经费来源" span="2">
@@ -304,15 +346,6 @@ layout("/layouts/platform.html"){
</el-form-item>
</el-descriptions-item>
<el-descriptions-item label="活动类型" v-if="formData.reimburseProject === 'UNION_REIMBURSE_PROJECT_2'">
<el-form-item label="活动类型" prop="activityType">
<el-select v-model="formData.activityType" placeholder="请选择活动类型" style="width: 100%">
<el-option label="分工会活动" value="分工会活动"></el-option>
<el-option label="校工会活动" value="校工会活动"></el-option>
<el-option label="社团(社团)活动" value="社团(社团)活动"></el-option>
</el-select>
</el-form-item>
</el-descriptions-item>
<el-descriptions-item label="活动人数" v-if="formData.reimburseProject !== 'UNION_REIMBURSE_PROJECT_1'">
<el-form-item label="活动人数" prop="activityNumber">
<el-input v-model="formData.activityNumber" placeholder="请输入活动人数" type="text"></el-input>
@@ -437,6 +470,8 @@ layout("/layouts/platform.html"){
</el-form-item>
</el-descriptions-item>
<el-descriptions-item :span="2" v-if="formData.reimburseProject === 'UNION_REIMBURSE_PROJECT_1'" style="display: none;">
</el-descriptions-item>
<el-descriptions-item label="参加随行人员" :span="2"
v-if="formData.reimburseProject === 'UNION_REIMBURSE_PROJECT_1'">
@@ -457,6 +492,8 @@ layout("/layouts/platform.html"){
type="textarea" :autosize="{ minRows: 4, maxRows: 8}"></el-input>
</el-form-item>
</el-descriptions-item>
<el-descriptions-item :span="2" v-if="formData.reimburseProject !== 'UNION_REIMBURSE_PROJECT_1' && formData.reimburseFundSource === 'UNION_REIMBURSE_FUND_SOURCE_3'" style="display: none;">
</el-descriptions-item>
<el-descriptions-item :span="2">
<template slot="label">
附件
@@ -714,7 +751,6 @@ layout("/layouts/platform.html"){
condolenceMoney: [{required: true, message: "请输入慰问金额", trigger: ["change", "blur"]}],
participants: [{required: true, message: "请填写参与随行人员", trigger: ["change", "blur"]}],
payer: [{required: true, message: "请选择付款人", trigger: ["change", "blur"]}],
activityType: [{required: true, message: "请选择活动类型", trigger: ["change", "blur"]}],
activityPlace: [{required: true, message: "请输入活动地点", trigger: ["change", "blur"]}],
activityTime: [{required: true, message: "请选择活动时间", trigger: ["change", "blur"]}],
activityNumber: [{required: true, message: "请输入活动人数", trigger: ["change", "blur"]}]
@@ -733,6 +769,7 @@ layout("/layouts/platform.html"){
reimburseProjectList: [],
reimburseProjects: [],
clubOptions: [],
fundBalanceText: '',
budgetTypeOption: [],
payerOptions: []
}
@@ -953,6 +990,7 @@ layout("/layouts/platform.html"){
this.$set(this.formData, "money", null)
} else {
this.rebuildInvoiceSummary()
this.normalizeFundBalance()
}
},
openInvoiceDialog(mode, row, index) {
@@ -1200,9 +1238,14 @@ layout("/layouts/platform.html"){
// this.$set(this.formData, "way", this.chooseType.way)
// }
// },
normalizeFundBalance() {
const fundBalance = Number(this.formData.fundBalance)
this.$set(this.formData, "fundBalance", Number.isNaN(fundBalance) ? null : fundBalance)
},
// 保存
onSave() {
this.rebuildInvoiceSummary()
this.normalizeFundBalance()
this.$confirm("您确定保存吗?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
@@ -1221,11 +1264,17 @@ layout("/layouts/platform.html"){
return new Promise((resolve) => {
this.$refs.formRef.validate((valid) => {
if (valid) {
if (this.formData.reimburseFundSource === "UNION_REIMBURSE_FUND_SOURCE_3" && !this.formData.clubId) {
this.$message.warning("请选择协会")
resolve(false)
return
}
if (!this.validateInvoiceDetailsBeforeSubmit()) {
this.$set(this, "activeTabName", "invoice")
resolve(false)
return
}
this.normalizeFundBalance()
this.rebuildInvoiceSummary()
resolve(true)
} else {
@@ -1298,68 +1347,71 @@ layout("/layouts/platform.html"){
const project = this.descOptions.find(item => item.reimburseProject === projectCode);
return project ? project.fileDesc : '';
},
//经费来源查询
reimburseFundSourceChange() {
// 检查是否有选择经费来源
if (!this.formData.reimburseFundSource) {
this.$set(this.formData, "fundBalance", "")
return
selectFundSource(code) {
this.$set(this.formData, "reimburseFundSource", code)
if (code !== "UNION_REIMBURSE_FUND_SOURCE_3") {
this.$set(this.formData, "clubId", null)
this.$set(this.formData, "clubName", null)
} else if (this.clubOptions.length === 1) {
this.$set(this.formData, "clubId", this.clubOptions[0].id)
this.$set(this.formData, "clubName", this.clubOptions[0].clubName)
}
// 如果是社团经费来源,但没有选择具体社团,则不查询
if (this.formData.reimburseFundSource === "UNION_REIMBURSE_FUND_SOURCE_3" && !this.formData.clubId) {
this.$set(this.formData, "fundBalance", "")
return
}
// 定义API映射关系
const apiMap = {
"UNION_REIMBURSE_FUND_SOURCE_1": {
url: "/platform/unionReimburse/apply/getSchoolBudget"
},
"UNION_REIMBURSE_FUND_SOURCE_2": {
url: "/platform/unionReimburse/apply/getUnionBalance"
},
"UNION_REIMBURSE_FUND_SOURCE_3": {
url: "/platform/unionReimburse/apply/getClubBudget"
this.reimburseFundSourceChange()
},
clubChange() {
if (this.formData.clubId) {
const selectedClub = this.clubOptions.find(club => club.id === this.formData.clubId)
if (selectedClub) {
this.$set(this.formData, "clubName", selectedClub.clubName)
}
this.reimburseFundSourceChange()
return
}
this.$set(this.formData, "clubName", null)
this.$set(this.formData, "fundBalance", null)
this.fundBalanceText = "请选择协会"
},
// 经费来源查询
reimburseFundSourceChange() {
if (!this.formData.reimburseFundSource) {
this.$set(this.formData, "fundBalance", null)
this.fundBalanceText = ""
return
}
if (this.formData.reimburseFundSource === "UNION_REIMBURSE_FUND_SOURCE_3" && !this.formData.clubId) {
this.$set(this.formData, "fundBalance", null)
this.fundBalanceText = ""
return
}
const fundSource = this.formData.reimburseFundSource
const apiInfo = apiMap[fundSource]
// 如果没有匹配的API,清空经费余额并返回
if (!apiInfo) {
this.$set(this.formData, "fundBalance", "")
if (!fundSource) {
this.$set(this.formData, "fundBalance", null)
this.fundBalanceText = ""
return
}
// 构造请求参数
const params = {
reimburseFundSource: fundSource
}
// 如果是社团经费,需要传递社团ID
if (fundSource === "UNION_REIMBURSE_FUND_SOURCE_3" && this.formData.clubId) {
params.clubId = this.formData.clubId
}
// 显示加载状态
this.$set(this.formData, "fundBalance", "查询中...")
// 发送请求
this.$axios.post(apiInfo.url, params)
this.$set(this.formData, "fundBalance", null)
this.fundBalanceText = "查询中..."
this.$axios.post("/platform/unionReimburse/apply/getBudgetBalance", params)
.then(response => {
if (response.code === 0) {
// 显示经费余额(只显示数字,不显示"元")
this.$set(this.formData, "fundBalance", response.data || "0.00")
this.$set(this.formData, "fundBalance", response.data || 0)
this.fundBalanceText = (response.data || 0).toString()
} else {
this.$set(this.formData, "fundBalance", "查询失败")
this.$set(this.formData, "fundBalance", null)
this.fundBalanceText = response.msg || "查询失败"
this.$message.warning(this.fundBalanceText)
}
})
.catch(error => {
console.error("经费余额查询失败:", error)
this.$set(this.formData, "fundBalance", "查询失败")
this.$set(this.formData, "fundBalance", null)
this.fundBalanceText = "查询失败"
this.$message.error("经费余额查询失败")
})
},
@@ -1433,7 +1485,16 @@ layout("/layouts/platform.html"){
this.queryFileDesc()
this.queryCondolenceType()
//社团查询
this.$businessTool.listCLubByRole().then((res) => (this.clubOptions = res))
this.$businessTool.listClubByRole().then((res) => {
this.$set(this, "clubOptions", res || [])
if (res && res.length === 1 && !this.formData.clubId) {
this.$set(this.formData, "clubId", res[0].id)
this.$set(this.formData, "clubName", res[0].clubName)
}
if (this.formData.reimburseFundSource) {
this.reimburseFundSourceChange()
}
})
}
})
</script>
@@ -5,168 +5,248 @@ const unionReimburseInfo = {
申请信息
<el-link type="primary" @click="openChart">点击查看流程图</el-link>
</div>
<el-descriptions :column="2" border class="flow-task-form">
<el-descriptions-item label="经办人">{{viewData.userName}}</el-descriptions-item>
<el-descriptions-item label="工号">{{viewData.loginName}}</el-descriptions-item>
<el-descriptions-item label="单位">{{viewData.unitName}}</el-descriptions-item>
<el-descriptions-item label="工会">{{viewData.unionName}}</el-descriptions-item>
<el-descriptions-item label="报销项目">
<span v-if="viewData.reimburseProject === 'UNION_REIMBURSE_PROJECT_1'">慰问</span>
<span v-else-if="viewData.reimburseProject === 'UNION_REIMBURSE_PROJECT_2'">文体活动</span>
<span v-else-if="viewData.reimburseProject === 'UNION_REIMBURSE_PROJECT_3'">日常活动</span>
<span v-else-if="viewData.reimburseProject === 'UNION_REIMBURSE_PROJECT_4'">专项活动</span>
<span v-else>{{ viewData.reimburseProject }}</span>
</el-descriptions-item>
<el-tabs v-model="activeTabName" style="margin-top: 10px;">
<el-tab-pane label="申请基本信息" name="basic">
<el-descriptions :column="2" border class="flow-task-form">
<el-descriptions-item label="经费来源" :span="2">
<dict-tag :options="dict.type.UNION_REIMBURSE_FUND_SOURCE"
:value="viewData.reimburseFundSource">
</dict-tag>
</el-descriptions-item>
<el-descriptions-item label="支付方式">
<dict-tag :options="dict.type.UNION_REIMBURSE_PAYMENT_WAY"
:value="viewData.paymentWay">
</dict-tag>
</el-descriptions-item>
<el-descriptions-item label="报销项目" :span="2">
<dict-tag :options="dict.type.UNION_REIMBURSE_PROJECT"
:value="viewData.reimburseProject">
</dict-tag>
</el-descriptions-item>
<el-descriptions-item label="联系方式">{{viewData.mobile}}</el-descriptions-item>
<el-descriptions-item label="支付方式">
<dict-tag :options="dict.type.UNION_REIMBURSE_PAYMENT_WAY"
:value="viewData.paymentWay">
</dict-tag>
</el-descriptions-item>
<el-descriptions-item label="付款人" v-if="viewData.paymentWay === 'UNION_REIMBURSE_PAYMENT_WAY_2'">
<span>{{ viewData.payerName }}</span>
</el-descriptions-item>
<el-descriptions-item label="工号">{{viewData.loginName}}</el-descriptions-item>
<el-descriptions-item label="经办人">{{viewData.userName}}</el-descriptions-item>
<el-descriptions-item label="单位">{{viewData.unitName}}</el-descriptions-item>
<el-descriptions-item label="工会">{{viewData.unionName}}</el-descriptions-item>
<el-descriptions-item label="开户行" v-if="viewData.paymentWay === 'UNION_REIMBURSE_PAYMENT_WAY_2'">
<span>{{ viewData.bankOfDeposit }}</span>
</el-descriptions-item>
<el-descriptions-item label="所属协会" v-if="viewData.reimburseFundSource === 'UNION_REIMBURSE_FUND_SOURCE_3'">
<span>{{ viewData.clubName }}</span>
</el-descriptions-item>
<el-descriptions-item label="银行卡号" v-if="viewData.paymentWay === 'UNION_REIMBURSE_PAYMENT_WAY_2'">
<span>{{ viewData.bankCardNumber }}</span>
</el-descriptions-item>
<el-descriptions-item label="余额" v-if="viewData.reimburseFundSource">
<span>{{ formatMoney(viewData.fundBalance) }}</span>
</el-descriptions-item>
<!-- 慰问相关字段 -->
<el-descriptions-item label="慰问对象" v-if="viewData.reimburseProject === 'UNION_REIMBURSE_PROJECT_1'">
<span>{{ viewData.condolenceUserName }}{{ viewData.condolenceLoginName }})({{ viewData.condolenceUnitName }}</span>
</el-descriptions-item>
<el-descriptions-item label="联系方式">
<span>{{ viewData.mobile }}</span>
</el-descriptions-item>
<el-descriptions-item label="性别" v-if="viewData.reimburseProject === 'UNION_REIMBURSE_PROJECT_1'">
<span>{{ viewData.condolenceSex }}</span>
</el-descriptions-item>
<el-descriptions-item label="付款人" v-if="viewData.paymentWay === 'UNION_REIMBURSE_PAYMENT_WAY_2'">
<span>{{ viewData.payerName }}</span>
</el-descriptions-item>
<el-descriptions-item label="生日" v-if="viewData.reimburseProject === 'UNION_REIMBURSE_PROJECT_1'">
<span>{{ viewData.condolenceBirthday && $moment(viewData.condolenceBirthday).isValid() ? $moment(viewData.condolenceBirthday).format('YYYY-MM-DD') : '' }}</span>
</el-descriptions-item>
<el-descriptions-item label="户名" v-if="viewData.paymentWay === 'UNION_REIMBURSE_PAYMENT_WAY_2'">
<span>{{ viewData.bankUserName }}</span>
</el-descriptions-item>
<el-descriptions-item label="身份证号" v-if="viewData.reimburseProject === 'UNION_REIMBURSE_PROJECT_1'">
<span>{{ viewData.condolenceIdCard }}</span>
</el-descriptions-item>
<el-descriptions-item label="开户行" v-if="viewData.paymentWay === 'UNION_REIMBURSE_PAYMENT_WAY_2'">
<span>{{ viewData.bankOfDeposit }}</span>
</el-descriptions-item>
<el-descriptions-item label="联系方式" v-if="viewData.reimburseProject === 'UNION_REIMBURSE_PROJECT_1'">
<span>{{ viewData.condolenceMobile }}</span>
</el-descriptions-item>
<el-descriptions-item label="银行卡号" v-if="viewData.paymentWay === 'UNION_REIMBURSE_PAYMENT_WAY_2'">
<span>{{ viewData.bankCardNumber }}</span>
</el-descriptions-item>
<el-descriptions-item label="慰问类型" v-if="viewData.reimburseProject === 'UNION_REIMBURSE_PROJECT_1'">
<span>{{ viewData.typeName }}</span>
</el-descriptions-item>
<el-descriptions-item label="慰问对象" v-if="viewData.reimburseProject === 'UNION_REIMBURSE_PROJECT_1'">
<span>{{ viewData.condolenceUserName }}{{ viewData.condolenceLoginName }})({{ viewData.condolenceUnitName }}</span>
</el-descriptions-item>
<el-descriptions-item label="慰问方式" v-if="viewData.reimburseProject === 'UNION_REIMBURSE_PROJECT_1'">
<span>{{ viewData.way }}</span>
</el-descriptions-item>
<el-descriptions-item label="性别" v-if="viewData.reimburseProject === 'UNION_REIMBURSE_PROJECT_1'">
<span>{{ viewData.condolenceSex }}</span>
</el-descriptions-item>
<el-descriptions-item label="慰问金额" v-if="viewData.reimburseProject === 'UNION_REIMBURSE_PROJECT_1'">
<span>{{ viewData.condolenceMoney }}</span>
</el-descriptions-item>
<el-descriptions-item label="实际报销金额" v-if="viewData.reimburseProject === 'UNION_REIMBURSE_PROJECT_1'">
<span>{{ viewData.realMoney }}</span>
</el-descriptions-item>
<el-descriptions-item label="生日" v-if="viewData.reimburseProject === 'UNION_REIMBURSE_PROJECT_1'">
<span>{{ viewData.condolenceBirthday && $moment(viewData.condolenceBirthday).isValid() ? $moment(viewData.condolenceBirthday).format('YYYY-MM-DD') : '' }}</span>
</el-descriptions-item>
<!-- 活动相关字段 -->
<el-descriptions-item label="活动名称" v-if="viewData.reimburseProject !== 'UNION_REIMBURSE_PROJECT_1'">
<span>{{ viewData.activityName }}</span>
</el-descriptions-item>
<el-descriptions-item label="身份证号" v-if="viewData.reimburseProject === 'UNION_REIMBURSE_PROJECT_1'">
<span>{{ viewData.condolenceIdCard }}</span>
</el-descriptions-item>
<el-descriptions-item label="活动类型" v-if="viewData.reimburseProject === 'UNION_REIMBURSE_PROJECT_2'">
<span>{{ viewData.activityType }}</span>
</el-descriptions-item>
<el-descriptions-item label="联系方式" v-if="viewData.reimburseProject === 'UNION_REIMBURSE_PROJECT_1'">
<span>{{ viewData.condolenceMobile }}</span>
</el-descriptions-item>
<el-descriptions-item label="活动人数" v-if="viewData.reimburseProject !== 'UNION_REIMBURSE_PROJECT_1'">
<span>{{ viewData.activityNumber }}</span>
</el-descriptions-item>
<el-descriptions-item label="慰问类型" v-if="viewData.reimburseProject === 'UNION_REIMBURSE_PROJECT_1'">
<span>{{ viewData.typeName }}</span>
</el-descriptions-item>
<el-descriptions-item label="活动地点" v-if="viewData.reimburseProject !== 'UNION_REIMBURSE_PROJECT_1'">
<span>{{ viewData.activityPlace }}</span>
</el-descriptions-item>
<el-descriptions-item label="慰问方式" v-if="viewData.reimburseProject === 'UNION_REIMBURSE_PROJECT_1'">
<span>{{ viewData.way }}</span>
</el-descriptions-item>
<el-descriptions-item label="报销金额" v-if="viewData.reimburseProject !== 'UNION_REIMBURSE_PROJECT_1'">
<span>{{ viewData.money }}</span>
</el-descriptions-item>
<el-descriptions-item label="慰问金额" v-if="viewData.reimburseProject === 'UNION_REIMBURSE_PROJECT_1'">
<span>{{ formatMoney(viewData.condolenceMoney) }}</span>
</el-descriptions-item>
<el-descriptions-item label="实际报销金额" v-if="viewData.reimburseProject !== 'UNION_REIMBURSE_PROJECT_1'">
<span>{{ viewData.realMoney }}</span>
</el-descriptions-item>
<el-descriptions-item label="实际报销金额" v-if="viewData.reimburseProject === 'UNION_REIMBURSE_PROJECT_1' && viewData.realMoney != null">
<span>{{ formatMoney(viewData.realMoney) }}</span>
</el-descriptions-item>
<el-descriptions-item label="活动时间" v-if="viewData.reimburseProject !== 'UNION_REIMBURSE_PROJECT_1'">
<span>{{ viewData.activityTime | dateFormat }}</span>
</el-descriptions-item>
<el-descriptions-item label="活动名称" v-if="viewData.reimburseProject !== 'UNION_REIMBURSE_PROJECT_1'">
<span>{{ viewData.activityName }}</span>
</el-descriptions-item>
<el-descriptions-item label="发票张数">
<span>{{ viewData.invoiceNumber }}</span>
</el-descriptions-item>
<el-descriptions-item label="活动人数" v-if="viewData.reimburseProject !== 'UNION_REIMBURSE_PROJECT_1'">
<span>{{ viewData.activityNumber }}</span>
</el-descriptions-item>
<el-descriptions-item label="慰问时间" v-if="viewData.reimburseProject === 'UNION_REIMBURSE_PROJECT_1'">
<span>{{ viewData.condolenceTime | dateFormat }}</span>
</el-descriptions-item>
<el-descriptions-item label="活动地点" v-if="viewData.reimburseProject !== 'UNION_REIMBURSE_PROJECT_1'">
<span>{{ viewData.activityPlace }}</span>
</el-descriptions-item>
<el-descriptions-item label="结婚时间" v-if="viewData.condolenceTypeId === 'cf4ce7af322d464f8f86d818fcc00203'">
<span>{{ viewData.marryTime | dateFormat }}</span>
</el-descriptions-item>
<el-descriptions-item label="报销金额" v-if="viewData.reimburseProject !== 'UNION_REIMBURSE_PROJECT_1'">
<span>{{ formatMoney(viewData.money) }}</span>
</el-descriptions-item>
<el-descriptions-item label="生育时间" v-if="viewData.condolenceTypeId === 'c90cb10dce6542e99ae271bee6fe8cc0'">
<span>{{ viewData.fertilityTime | dateFormat }}</span>
</el-descriptions-item>
<el-descriptions-item label="实际报销金额" v-if="viewData.reimburseProject !== 'UNION_REIMBURSE_PROJECT_1' && viewData.realMoney != null">
<span>{{ formatMoney(viewData.realMoney) }}</span>
</el-descriptions-item>
<el-descriptions-item label="住院病由" v-if="viewData.condolenceTypeId === '4e316737e71047e0b01aea78524c1416'">
<span>{{ viewData.hospitalCausation }}</span>
</el-descriptions-item>
<el-descriptions-item label="活动时间" v-if="viewData.reimburseProject !== 'UNION_REIMBURSE_PROJECT_1'">
<span>{{ viewData.activityTime | dateFormat }}</span>
</el-descriptions-item>
<el-descriptions-item label="住院时间" v-if="viewData.condolenceTypeId === '4e316737e71047e0b01aea78524c1416'">
<span v-if="viewData.hospitalizationStartTime && viewData.hospitalizationEndTime">
{{ $moment(viewData.hospitalizationStartTime).format('YYYY-MM-DD') }} 至 {{ $moment(viewData.hospitalizationEndTime).format('YYYY-MM-DD') }}
</span>
<span v-else>暂无住院时间</span>
</el-descriptions-item>
<el-descriptions-item label="慰问时间" v-if="viewData.reimburseProject === 'UNION_REIMBURSE_PROJECT_1'">
<span>{{ viewData.condolenceTime | dateFormat }}</span>
</el-descriptions-item>
<el-descriptions-item label="入住医院" v-if="viewData.condolenceTypeId === '4e316737e71047e0b01aea78524c1416'">
<span>{{ viewData.hospital }}</span>
</el-descriptions-item>
<el-descriptions-item label="结婚时间" v-if="viewData.condolenceTypeId === 'cf4ce7af322d464f8f86d818fcc00203'">
<span>{{ viewData.marryTime | dateFormat }}</span>
</el-descriptions-item>
<el-descriptions-item label="当年次数" v-if="viewData.condolenceTypeId === '4e316737e71047e0b01aea78524c1416'">
<span>{{ viewData.hospitalCount }}</span>
</el-descriptions-item>
<el-descriptions-item label="生育时间" v-if="viewData.condolenceTypeId === 'c90cb10dce6542e99ae271bee6fe8cc0'">
<span>{{ viewData.fertilityTime | dateFormat }}</span>
</el-descriptions-item>
<el-descriptions-item label="去逝时间" v-if="viewData.condolenceTypeId === '60f03a87b62b4823855814afdbf5672a'">
<span>{{ viewData.deathTime | dateFormat }}</span>
</el-descriptions-item>
<el-descriptions-item label="住院病由" v-if="viewData.condolenceTypeId === '4e316737e71047e0b01aea78524c1416'">
<span>{{ viewData.hospitalCausation }}</span>
</el-descriptions-item>
<el-descriptions-item label="与被慰问人关系" v-if="viewData.condolenceTypeId === '60f03a87b62b4823855814afdbf5672a'">
<span>{{ viewData.condolenceRelationship }}</span>
</el-descriptions-item>
<el-descriptions-item label="住院时间" v-if="viewData.condolenceTypeId === '4e316737e71047e0b01aea78524c1416'">
<span v-if="viewData.hospitalizationStartTime && viewData.hospitalizationEndTime">
{{ $moment(viewData.hospitalizationStartTime).format('YYYY-MM-DD') }} 至 {{ $moment(viewData.hospitalizationEndTime).format('YYYY-MM-DD') }}
</span>
<span v-else>暂无住院时间</span>
</el-descriptions-item>
<el-descriptions-item label="参加随行人员" :span="2"
v-if="viewData.reimburseProject === 'UNION_REIMBURSE_PROJECT_1'">
<span>{{ viewData.participants }}</span>
</el-descriptions-item>
<el-descriptions-item label="入住医院" v-if="viewData.condolenceTypeId === '4e316737e71047e0b01aea78524c1416'">
<span>{{ viewData.hospital }}</span>
</el-descriptions-item>
<el-descriptions-item label="报销事由" :span="2">
<span>{{ viewData.paymentNotes }}</span>
</el-descriptions-item>
<el-descriptions-item label="当年次数" v-if="viewData.condolenceTypeId === '4e316737e71047e0b01aea78524c1416'">
<span>{{ viewData.hospitalCount }}</span>
</el-descriptions-item>
<el-descriptions-item label="备注" :span="2">
<span>{{ viewData.notes }}</span>
</el-descriptions-item>
<el-descriptions-item label="去逝时间" v-if="viewData.condolenceTypeId === '60f03a87b62b4823855814afdbf5672a'">
<span>{{ viewData.deathTime | dateFormat }}</span>
</el-descriptions-item>
<el-descriptions-item label="附件" :span="2">
<file-preview v-if="viewData.files && viewData.files.length > 0" :files="viewData.files"
complete_result></file-preview>
<span v-else>暂无附件</span>
</el-descriptions-item>
</el-descriptions>
<el-descriptions-item label="与被慰问人关系" v-if="viewData.condolenceTypeId === '60f03a87b62b4823855814afdbf5672a'">
<span>{{ viewData.condolenceRelationship }}</span>
</el-descriptions-item>
<el-descriptions-item label="参加随行人员" :span="2"
v-if="viewData.reimburseProject === 'UNION_REIMBURSE_PROJECT_1'">
<span>{{ viewData.participants }}</span>
</el-descriptions-item>
<el-descriptions-item label="报销事由" :span="2" v-if="viewData.reimburseProject === 'UNION_REIMBURSE_PROJECT_1'">
<span>{{ viewData.paymentNotes }}</span>
</el-descriptions-item>
<el-descriptions-item label="备注" :span="2" v-if="viewData.reimburseProject === 'UNION_REIMBURSE_PROJECT_1'">
<span>{{ viewData.notes }}</span>
</el-descriptions-item>
<el-descriptions-item label="附件" :span="2">
<file-preview v-if="viewData.files && viewData.files.length > 0"
:files="viewData.files"
complete_result></file-preview>
<span v-else>暂无附件</span>
</el-descriptions-item>
</el-descriptions>
</el-tab-pane>
<el-tab-pane label="发票信息" name="invoice" v-if="showInvoiceTab">
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="报销金额" label-width="100px">
<el-input :value="formatMoney(viewData.money)" readonly></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="发票张数" label-width="100px">
<el-input :value="viewData.invoiceNumber" readonly></el-input>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="支付内容" label-width="100px">
<el-input :autosize="{ minRows: 4, maxRows: 8}"
:value="viewData.paymentNotes"
readonly
type="textarea"></el-input>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="备注" label-width="100px">
<el-input :autosize="{ minRows: 3, maxRows: 6}"
:value="viewData.notes"
readonly
type="textarea"></el-input>
</el-form-item>
</el-col>
<el-col :span="24">
<div style="display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap;">
<div>
<div style="font-size: 14px; color: #1867b0; font-weight: 600;">发票明细列表</div>
<div style="margin-top: 8px; font-size: 12px; color: #909399;">
查看页按申请页结构展示发票明细,仅用于查看,不提供编辑操作。
</div>
</div>
</div>
<el-table :data="viewData.invoiceDetails" border empty-text="暂无发票明细">
<el-table-column align="center" label="序号" type="index" width="70"></el-table-column>
<el-table-column label="文件名称" min-width="220">
<template slot-scope="scope">
<file-preview v-if="scope.row.invoiceFiles && scope.row.invoiceFiles.length > 0"
:files="scope.row.invoiceFiles"
complete_result></file-preview>
<span v-else>未上传</span>
</template>
</el-table-column>
<el-table-column label="发票号码" min-width="140" prop="invoiceNo"></el-table-column>
<el-table-column align="right" label="发票金额" min-width="110">
<template slot-scope="scope">
<span>{{ formatMoney(scope.row.invoiceAmount) }}</span>
</template>
</el-table-column>
<el-table-column label="销售方信息名称" min-width="180" prop="sellerName"></el-table-column>
<el-table-column label="项目名称" min-width="180" prop="itemName"></el-table-column>
<el-table-column label="备注" min-width="150" prop="remark"></el-table-column>
</el-table>
</el-col>
</el-row>
</el-tab-pane>
</el-tabs>
<template>
<div class="mt10" v-if="viewData.reviewTime">
@@ -181,13 +261,13 @@ const unionReimburseInfo = {
<span v-else-if="viewData.stateId == 4" style="color: #f56c6c;">拒绝</span>
<span v-else-if="viewData.stateId == 5" style="color: #409eff;">退回</span>
<span v-else style="color: #409eff;">{{ viewData.stateId }}</span>
</el-descriptions-item>
</el-descriptions-item>
<el-descriptions-item label="审核意见">{{ viewData.reviewOpinion }}</el-descriptions-item>
</el-descriptions>
</div>
</template>
<slot></slot>
<slot></slot>
<snaker-chart ref="snakerChartRef"></snaker-chart>
</div>
`,
@@ -201,42 +281,69 @@ const unionReimburseInfo = {
},
data() {
return {
activeTabName: "basic",
visible: false,
viewData: {},
viewData: {
files: [],
invoiceDetails: []
},
typeName: '',
row: null
}
},
computed: {
showInvoiceTab() {
return this.viewData.reimburseProject !== "UNION_REIMBURSE_PROJECT_1"
}
},
methods: {
// 打开
onOpen(row) {
this.row = row
this.visible = true
this.activeTabName = "basic"
this.getInfo()
},
// 获取申请信息
getInfo() {
this.$axios.post('/platform/unionReimburse/apply/info', {id: this.row.id}).then((res) => {
if (res.code === 0) {
this.viewData = res.data
this.viewData = this.buildViewData(res.data)
this.typeName = res.data.typeName || ''
}
})
},
// // 获取已办任务审批记录
// getDoneTasks() {
// this.$axios.post("/flow/common/doneTasks", {bizId: this.row.id}).then((res) => {
// if (res.code === 0) {
// this.doneTasks = res.data
// }
// })
// },
//
// // 查看流程图
// openChart(){
// this.$refs.snakerChartRef.onOpenFull(this.row.instanceProcessDefineId,this.row.instanceId)
// }
// 查看页面需要给附件和发票明细补默认值,避免空数据时组件渲染异常。
buildViewData(data) {
const viewData = Object.assign({
files: [],
invoiceDetails: []
}, data || {})
if (!Array.isArray(viewData.files)) {
viewData.files = []
}
if (!Array.isArray(viewData.invoiceDetails)) {
viewData.invoiceDetails = []
}
return viewData
},
// 查看页金额统一保留两位小数,和申请页展示口径保持一致。
formatMoney(value) {
if (value === null || value === undefined || value === "") {
return ""
}
const numberValue = Number(value)
if (Number.isNaN(numberValue)) {
return value
}
return numberValue.toFixed(2)
},
// 查看流程图
openChart() {
if (!this.row || !this.$refs.snakerChartRef) {
return
}
this.$refs.snakerChartRef.onOpenFull(this.row.instanceProcessDefineId, this.row.instanceId)
}
}
}