Merge branch 'main' of https://gitee.com/hdka/fad_oa
This commit is contained in:
@@ -148,6 +148,7 @@ public class SysUser extends BaseEntity {
|
||||
|
||||
private Long laborCost;
|
||||
|
||||
@TableField(exist = false)
|
||||
private Double workTime;
|
||||
|
||||
|
||||
|
||||
@@ -99,22 +99,35 @@ public class SysOaCostController extends BaseController {
|
||||
|
||||
|
||||
|
||||
/**
|
||||
// /**
|
||||
// * 查询所有项目成本
|
||||
// */
|
||||
// @SaCheckPermission("oa:oaCost:list")
|
||||
// @GetMapping("/list")
|
||||
// public TableDataInfo<SysOaCostAllVo> AllList(@RequestParam(required = false) String projectName) {
|
||||
// return iSysOaCostService.AllList(projectName);
|
||||
// }
|
||||
|
||||
/**
|
||||
* 查询所有项目成本
|
||||
*/
|
||||
@SaCheckPermission("oa:oaCost:list")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<SysOaCostAllVo> AllList(@RequestParam(required = false) String projectName, @RequestParam(required = false)String createTime) {
|
||||
return iSysOaCostService.AllList(projectName, createTime);
|
||||
public TableDataInfo<SysOaCostAllVo> AllList(SysOaCostBo bo,PageQuery pageQuery) {
|
||||
return iSysOaCostService.calcProjectCostList(bo,pageQuery);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 查询详情
|
||||
*/
|
||||
@SaCheckPermission("oa:oaCost:list")
|
||||
@SaCheckPermission("oa:oaCost:query")
|
||||
@GetMapping("/{projectId}")
|
||||
public TableDataInfo<SysOaCostRow> getDetail(@NotNull(message = "项目id不能为空")
|
||||
public R<SysOaCostRow> getDetail(@NotNull(message = "项目id不能为空")
|
||||
@PathVariable Long projectId) {
|
||||
return iSysOaCostService.getDetail(projectId);
|
||||
return R.ok(iSysOaCostService.getDetail(projectId));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -69,5 +69,10 @@ public class SysOaCostBo extends BaseEntity {
|
||||
*/
|
||||
private Long claimId;
|
||||
|
||||
/**
|
||||
* 项目名称
|
||||
*/
|
||||
private String projectName;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@@ -12,6 +13,7 @@ import java.util.Date;
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class SysOaCostAllVo {
|
||||
|
||||
private Long projectId;
|
||||
@@ -41,4 +43,6 @@ public class SysOaCostAllVo {
|
||||
|
||||
private Long financeId;
|
||||
|
||||
private Double peopleDay;
|
||||
|
||||
}
|
||||
|
||||
@@ -8,13 +8,27 @@ import lombok.NoArgsConstructor;
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class SysOaCostList {
|
||||
private Long costId;
|
||||
private Double cost;
|
||||
/**
|
||||
* userCostList
|
||||
*/
|
||||
private Long userId;
|
||||
private Object userVo;
|
||||
private String nickName;
|
||||
private Double laborCost;
|
||||
private Double attendanceNum;
|
||||
|
||||
/**
|
||||
* materialList
|
||||
*/
|
||||
private Long materialId;
|
||||
private Object materialVo;
|
||||
private String name;
|
||||
private Double price;
|
||||
private Long amount;
|
||||
|
||||
/**
|
||||
* claimList
|
||||
*/
|
||||
private Long claimId;
|
||||
private Object claimVo;
|
||||
private Integer costType;
|
||||
// private String nickName; 申请人姓名
|
||||
private Double cost;
|
||||
private String remark;
|
||||
}
|
||||
|
||||
@@ -7,8 +7,10 @@ import com.ruoyi.oa.domain.SysOaClaim;
|
||||
import com.ruoyi.oa.domain.vo.SysOaClaimVo;
|
||||
import com.ruoyi.common.core.mapper.BaseMapperPlus;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 差旅费报销Mapper接口
|
||||
@@ -25,4 +27,7 @@ public interface SysOaClaimMapper extends BaseMapperPlus<SysOaClaimMapper, SysOa
|
||||
SysOaClaimVo selectSysOaClaimVoByProcInsId(String procInsId);
|
||||
|
||||
Double getClaimCost(Long claimId);
|
||||
|
||||
@Select("select * from sys_oa_claim where project_id = #{projectId} and del_flag = 0")
|
||||
List<SysOaClaim> List(@Param("projectId") Long projectId);
|
||||
}
|
||||
|
||||
@@ -29,4 +29,8 @@ public interface SysOaOutWarehouseMapper extends BaseMapperPlus<SysOaOutWarehous
|
||||
* 获取分页的Total值
|
||||
*/
|
||||
Long defineQueryTotal(@Param(value = "bo") SysOaOutWarehouseBo bo, @Param(value = "page") PageQuery pageQuery);
|
||||
|
||||
|
||||
@Select("select * from sys_oa_out_warehouse where project_id = #{projectId} and del_flag = 0")
|
||||
List<SysOaOutWarehouse> List(@Param("projectId") Long projectId);
|
||||
}
|
||||
|
||||
@@ -4,9 +4,12 @@ import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Constants;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.ruoyi.common.core.domain.PageQuery;
|
||||
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||
import com.ruoyi.oa.domain.SysOaOutWarehouse;
|
||||
import com.ruoyi.oa.domain.SysOaProject;
|
||||
import com.ruoyi.oa.domain.bo.SysOaProjectBo;
|
||||
import com.ruoyi.oa.domain.vo.SysOaCostAllVo;
|
||||
import com.ruoyi.oa.domain.vo.SysOaOutWarehouseListVo;
|
||||
import com.ruoyi.oa.domain.vo.SysOaProjectVo;
|
||||
import com.ruoyi.common.core.mapper.BaseMapperPlus;
|
||||
@@ -31,4 +34,7 @@ public interface SysOaProjectMapper extends BaseMapperPlus<SysOaProjectMapper, S
|
||||
List<SysOaProjectVo> getProjectDataByMonthAndDate(@Param("firstDay") Date firstDay, @Param("lastDay") Date lastDay);
|
||||
|
||||
|
||||
|
||||
Page<SysOaCostAllVo> selectListToCost(@Param("page") Page<SysOaProject> page,@Param(Constants.WRAPPER) QueryWrapper<SysOaProjectBo> queryWrapper);
|
||||
|
||||
}
|
||||
|
||||
@@ -7,7 +7,6 @@ import com.ruoyi.oa.domain.bo.SysOaCostBo;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.core.domain.PageQuery;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
@@ -57,8 +56,16 @@ public interface ISysOaCostService {
|
||||
/**
|
||||
* 查询详情
|
||||
*/
|
||||
TableDataInfo<SysOaCostRow> getDetail(Long projectId);
|
||||
SysOaCostRow getDetail(Long projectId);
|
||||
|
||||
|
||||
/**
|
||||
* 项目成本分析改进
|
||||
*
|
||||
* @param bo
|
||||
* @param pageQuery
|
||||
* @return
|
||||
*/
|
||||
TableDataInfo<SysOaCostAllVo> calcProjectCostList(SysOaCostBo bo, PageQuery pageQuery);
|
||||
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.ruoyi.oa.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||
import com.ruoyi.common.exception.ServiceException;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
@@ -9,20 +10,21 @@ import com.ruoyi.common.core.domain.PageQuery;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.ruoyi.oa.domain.SysOaAttendance;
|
||||
import com.ruoyi.oa.domain.SysOaProject;
|
||||
import com.ruoyi.oa.domain.*;
|
||||
import com.ruoyi.oa.domain.bo.SysOaProjectBo;
|
||||
import com.ruoyi.oa.domain.vo.*;
|
||||
import com.ruoyi.oa.mapper.*;
|
||||
import com.ruoyi.system.mapper.SysUserMapper;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.ruoyi.oa.domain.bo.SysOaCostBo;
|
||||
import com.ruoyi.oa.domain.SysOaCost;
|
||||
import com.ruoyi.oa.service.ISysOaCostService;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
@@ -44,8 +46,11 @@ public class SysOaCostServiceImpl implements ISysOaCostService {
|
||||
|
||||
private final SysOaWarehouseMapper warehouseMapper;
|
||||
|
||||
private final SysOaOutWarehouseMapper outWarehouseMapper;
|
||||
|
||||
private final SysOaAttendanceMapper attendanceMapper;
|
||||
|
||||
private final SysOaProjectMapper projectMapper;
|
||||
|
||||
/**
|
||||
* 查询项目成本分析
|
||||
@@ -138,120 +143,200 @@ public class SysOaCostServiceImpl implements ISysOaCostService {
|
||||
*/
|
||||
|
||||
@Override
|
||||
public TableDataInfo<SysOaCostAllVo> AllList(String projectName, String createTime) { // 包括每个项目的成本分析,每个都有这几种类型,即每个项目返回几列数据
|
||||
|
||||
|
||||
List<SysOaCostAll> alls = baseMapper.AllList(projectName,createTime);
|
||||
log.info("alls:{}",alls);
|
||||
List<SysOaCostAllVo> allVos = new java.util.ArrayList<>(Collections.emptyList());
|
||||
if (alls.isEmpty()) return TableDataInfo.build(allVos);
|
||||
for (SysOaCostAll all : alls) {
|
||||
SysOaCostAllVo allVo = BeanUtil.toBean(all, SysOaCostAllVo.class);
|
||||
log.info("allVo:{}", allVo);
|
||||
|
||||
if (allVo.getCostType() == null) allVo.setCost(0.0);
|
||||
// 车间用工
|
||||
else {if (allVo.getCostType() == 1) { //根据出勤,计算人天数
|
||||
Double days = attendanceMapper.getAttendanceDay(allVo.getUserId(), allVo.getProjectId());
|
||||
Long laborCost = userMapper.selectUserById(allVo.getUserId()).getLaborCost();
|
||||
if (days == null || laborCost == null) allVo.setUserCost(0.0);
|
||||
else allVo.setUserCost(days * laborCost);
|
||||
} else if (allVo.getCostType() == 2) { // 差旅花费 差旅花费 = 该项目下的所有差旅费用
|
||||
allVo.setClaimCost(claimMapper.getClaimCost(allVo.getClaimId()));
|
||||
|
||||
} else if (allVo.getCostType() == 3) { // 库房物料 物料花费 =物料价格*数量
|
||||
SysOaWarehouseVo warehouseVo = warehouseMapper.selectVoById(allVo.getMaterialId());
|
||||
if (warehouseVo == null) allVo.setMaterialCost(0.0);
|
||||
else allVo.setMaterialCost(warehouseVo.getInventory() * warehouseVo.getPrice());
|
||||
|
||||
} else if (allVo.getCostType() == 4) { // 其他
|
||||
|
||||
|
||||
} else if (allVo.getCostType() == 5) { // 接待
|
||||
|
||||
}}
|
||||
allVos.add(allVo);
|
||||
|
||||
public TableDataInfo<SysOaCostAllVo> AllList(String projectName, String createTime) {
|
||||
LambdaQueryWrapper<SysOaProject> lqw = Wrappers.lambdaQuery(SysOaProject.class);
|
||||
if (StringUtils.isNotBlank(projectName)) {
|
||||
lqw.like(SysOaProject::getProjectName, projectName);
|
||||
}
|
||||
List<SysOaProject> projects = projectMapper.selectList(lqw);
|
||||
if (projects.isEmpty()) {
|
||||
return TableDataInfo.build();
|
||||
}
|
||||
List<SysOaCostAllVo> sysOaCostAllVos = new ArrayList<>();
|
||||
|
||||
// 假设原始数据列表为 allVos
|
||||
List<SysOaCostAllVo> resVos = allVos.stream()
|
||||
.collect(Collectors.groupingBy(SysOaCostAllVo::getProjectId))
|
||||
.values().stream()
|
||||
.map(group -> {
|
||||
Double userCostSum = group.stream().mapToDouble(x -> Optional.ofNullable((Double)x.getUserCost()).orElse(0.0)).sum();
|
||||
for (SysOaProject project : projects) {
|
||||
SysOaCostAllVo sysOaCostAllVo = new SysOaCostAllVo();
|
||||
Long projectId = project.getProjectId();
|
||||
sysOaCostAllVo.setProjectId(projectId);
|
||||
// 2、 查询所有项目对应的物料
|
||||
List<SysOaOutWarehouse> outWarehouses = outWarehouseMapper.List(projectId);
|
||||
Double materialCost = 0.0;
|
||||
if (!outWarehouses.isEmpty()) {
|
||||
Map<Long, SysOaWarehouse> warehouseMap = warehouseMapper.selectList(Wrappers.lambdaQuery(SysOaWarehouse.class)).stream().collect(Collectors.toMap(SysOaWarehouse::getId, Function.identity()));
|
||||
materialCost = outWarehouses.stream().map(v -> {
|
||||
Long warehouseId = v.getWarehouseId();
|
||||
BigDecimal amount = BigDecimal.valueOf(v.getAmount());
|
||||
SysOaWarehouse warehouse = warehouseMap.get(warehouseId);
|
||||
if (warehouse == null) {
|
||||
return BigDecimal.ZERO;
|
||||
}
|
||||
BigDecimal price = BigDecimal.valueOf(warehouse.getPrice());
|
||||
return amount.multiply(price);
|
||||
}).reduce(BigDecimal.ZERO, BigDecimal::add).doubleValue();
|
||||
}
|
||||
sysOaCostAllVo.setMaterialCost(materialCost);
|
||||
// 3、 查询所有项目对应的工资费用
|
||||
LambdaQueryWrapper<SysOaAttendance> lqw2 = Wrappers.lambdaQuery(SysOaAttendance.class);
|
||||
lqw2.eq(SysOaAttendance::getProjectId, projectId);
|
||||
List<SysOaAttendance> attendances = attendanceMapper.selectList(lqw2);
|
||||
Double userCost = 0.0;
|
||||
if (!attendances.isEmpty()) {
|
||||
// 分组出每个用户的天数
|
||||
Map<Long, Double> daynumMap = attendances.stream().collect(Collectors.groupingBy(
|
||||
SysOaAttendance::getUserId,
|
||||
Collectors.summingDouble(attendance -> {
|
||||
double attendanceDay = Optional.ofNullable(attendance.getAttendanceDay()).orElse(0L);
|
||||
double dayLength = Optional.ofNullable(attendance.getDayLength()).orElse(0.0);
|
||||
double hour = Optional.ofNullable(attendance.getHour()).orElse(0.0);
|
||||
return (attendanceDay * dayLength * 9 + hour)/9;
|
||||
})
|
||||
));
|
||||
// 获取user表中的劳务费用
|
||||
List<SysUser> users = userMapper.selectList(Wrappers.lambdaQuery(SysUser.class));
|
||||
Map<Long, SysUser> userMap = users.stream().collect(Collectors.toMap(SysUser::getUserId, Function.identity()));
|
||||
// 计算用工总价
|
||||
userCost = attendances.stream().map(v -> {
|
||||
Long userId = v.getUserId();
|
||||
SysUser user = userMap.get(userId);
|
||||
if (user == null) {
|
||||
return BigDecimal.ZERO;
|
||||
}
|
||||
Long laborCost = Optional.ofNullable(user.getLaborCost()).orElse(0L);
|
||||
Double daynum = daynumMap.getOrDefault(userId, 0.0);
|
||||
BigDecimal laborCostBigDecimal = BigDecimal.valueOf(laborCost);
|
||||
BigDecimal daynumBigDecimal = BigDecimal.valueOf(daynum);
|
||||
return laborCostBigDecimal.multiply(daynumBigDecimal);
|
||||
}).reduce(BigDecimal.ZERO, BigDecimal::add).doubleValue();
|
||||
}
|
||||
sysOaCostAllVo.setUserCost(userCost);
|
||||
// 4、 查询所有项目对应的差旅费用
|
||||
List<SysOaClaim> claims = claimMapper.List(projectId);
|
||||
Double claimCost = 0.0;
|
||||
if (!claims.isEmpty()) {
|
||||
claimCost = claims.stream().map(v -> BigDecimal.valueOf(v.getCost())).reduce(BigDecimal.ZERO, BigDecimal::add).doubleValue();
|
||||
}
|
||||
sysOaCostAllVo.setClaimCost(claimCost);
|
||||
|
||||
Double claimCostSum = group.stream().mapToDouble(x -> Optional.ofNullable((Double)x.getUserCost()).orElse(0.0)).sum();
|
||||
Double materialCostSum = group.stream().mapToDouble(x -> Optional.ofNullable((Double)x.getUserCost()).orElse(0.0)).sum();
|
||||
Double totalCost = userCostSum + claimCostSum + materialCostSum;
|
||||
|
||||
return new SysOaCostAllVo(
|
||||
group.get(0).getProjectId(),
|
||||
group.get(0).getProjectName(),
|
||||
totalCost,
|
||||
null,
|
||||
"汇总数据", // 备注
|
||||
null,
|
||||
null, // materialId
|
||||
materialCostSum,
|
||||
null, // userId
|
||||
userCostSum,
|
||||
null, // claimId
|
||||
claimCostSum,
|
||||
null// financeId
|
||||
);
|
||||
})
|
||||
.collect(Collectors.toList());
|
||||
|
||||
|
||||
return TableDataInfo.build(resVos);
|
||||
// 5、 设置总费用
|
||||
sysOaCostAllVo.setCost(materialCost + userCost + claimCost);
|
||||
// 6、 将 sysOaCostAllVo 添加到 sysOaCostAllVos 中
|
||||
sysOaCostAllVos.add(sysOaCostAllVo);
|
||||
}
|
||||
return TableDataInfo.build(sysOaCostAllVos);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查询详情
|
||||
*/
|
||||
@Override
|
||||
public TableDataInfo<SysOaCostRow> getDetail(Long projectId) {
|
||||
// log.info("查询projectId = {}", projectId);
|
||||
// LambdaQueryWrapper<SysOaCost> lqw = Wrappers.lambdaQuery(SysOaCost.class);
|
||||
// lqw.eq(SysOaCost::getProjectId,projectId);
|
||||
// List<SysOaCost> costs = baseMapper.selectList(lqw);
|
||||
List<SysOaCost> costs = baseMapper.getListByProjectId(projectId);
|
||||
// log.info("查询costs = {}", costs);
|
||||
|
||||
if (costs.isEmpty()) {
|
||||
return TableDataInfo.build();
|
||||
}
|
||||
public SysOaCostRow getDetail(Long projectId) {
|
||||
SysOaCostRow sysOaCostRow = new SysOaCostRow();
|
||||
sysOaCostRow.setUserCostList(new ArrayList<>());
|
||||
sysOaCostRow.setMaterialList(new ArrayList<>());
|
||||
sysOaCostRow.setClaimList(new ArrayList<>());
|
||||
sysOaCostRow.setOtherList(new ArrayList<>());
|
||||
for(SysOaCost cost : costs) {
|
||||
SysOaCostList sysOaCostList = BeanUtil.toBean(cost,SysOaCostList.class);
|
||||
log.info("查询cost = {}", cost);
|
||||
log.info("sysOaCostList = {}", sysOaCostList);
|
||||
|
||||
if(cost.getCostType() == 1) {
|
||||
// log.info("查询useVo = {}", userMapper.selectUserById(cost.getUserId()));
|
||||
sysOaCostList.setUserVo(userMapper.selectUserById(cost.getUserId()));
|
||||
sysOaCostRow.getUserCostList().add(sysOaCostList);
|
||||
} else if(cost.getCostType() == 2) {
|
||||
// log.info("查询claimMapperVo = {}", claimMapper.selectSysOaClaimVoById(cost.getClaimId()));
|
||||
sysOaCostList.setClaimVo(claimMapper.selectSysOaClaimVoById(cost.getClaimId()));
|
||||
sysOaCostRow.getClaimList().add(sysOaCostList);
|
||||
} else if(cost.getCostType() == 3) {
|
||||
// log.info("查询warehouseMapperVo = {}",warehouseMapper.selectVoById(cost.getMaterialId()));
|
||||
sysOaCostList.setMaterialVo(warehouseMapper.selectVoById(cost.getMaterialId()));
|
||||
sysOaCostRow.getMaterialList().add(sysOaCostList);
|
||||
} else{
|
||||
sysOaCostRow.getOtherList().add(sysOaCostList);
|
||||
List<SysOaCostList> UserCostList = new ArrayList<>();
|
||||
List<SysOaCostList> MaterialList = new ArrayList<>();
|
||||
List<SysOaCostList> ClaimList = new ArrayList<>();
|
||||
List<SysOaCostList> OtherList = new ArrayList<>();
|
||||
// 1、 查询项目信息
|
||||
SysOaProject project = projectMapper.selectById(projectId);
|
||||
if (project == null) {
|
||||
throw new ServiceException("项目信息不存在,项目ID: " + projectId);
|
||||
}
|
||||
// 2、 查询项目对应的每个人的工资详情
|
||||
LambdaQueryWrapper<SysOaAttendance> lqw = Wrappers.lambdaQuery(SysOaAttendance.class);
|
||||
lqw.eq(SysOaAttendance::getProjectId, projectId);
|
||||
// 查询出该项目下每个用户的工作情况
|
||||
List<SysOaAttendance> attendances = attendanceMapper.selectList(lqw);
|
||||
if (!attendances.isEmpty()) {
|
||||
// 查询出该项目下每个用户的工作天数
|
||||
// 分组出每个用户的天数
|
||||
// 按用户 ID 分组,并计算每个用户的 attendance_day * day_length * 9 + hour 的总和
|
||||
Map<Long, Double> daynumMap = attendances.stream()
|
||||
.collect(Collectors.groupingBy(
|
||||
SysOaAttendance::getUserId, // 按用户 ID 分组
|
||||
Collectors.summingDouble(attendance ->
|
||||
(attendance.getDayLength() * 9 + attendance.getHour())/9
|
||||
)
|
||||
));
|
||||
|
||||
|
||||
List<SysUser> users = userMapper.selectList(Wrappers.lambdaQuery(SysUser.class));
|
||||
Map<Long, SysUser> userMap = users.stream().collect(Collectors.toMap(SysUser::getUserId, Function.identity()));
|
||||
// 获取user表中的人力成本
|
||||
|
||||
// attendances 遍历,去重获取每个用户的userid
|
||||
Set<Long> userIds = daynumMap.keySet();
|
||||
for (Long userId : userIds) {
|
||||
SysUser user = userMap.get(userId);
|
||||
if (user == null) {
|
||||
continue;
|
||||
}
|
||||
SysOaCostList sysOaCostList = new SysOaCostList();
|
||||
double dayNum = daynumMap.get(userId) == null ? 0.0 : daynumMap.get(userId);
|
||||
BigDecimal dayNumBigDecimal = new BigDecimal(dayNum);
|
||||
long laborCost = user.getLaborCost() == null ? 0L : user.getLaborCost();
|
||||
sysOaCostList.setUserId(userId);
|
||||
sysOaCostList.setNickName(user.getNickName());
|
||||
sysOaCostList.setLaborCost(dayNumBigDecimal.multiply(BigDecimal.valueOf(laborCost)).setScale(1, RoundingMode.HALF_UP).doubleValue());
|
||||
sysOaCostList.setAttendanceNum(dayNumBigDecimal.setScale(1, RoundingMode.HALF_UP).doubleValue());
|
||||
UserCostList.add(sysOaCostList);
|
||||
}
|
||||
|
||||
}
|
||||
// log.info("sysOaCostRow = {}", sysOaCostRow);
|
||||
List<SysOaCostRow> rows = new java.util.ArrayList<>(Collections.singletonList(sysOaCostRow));
|
||||
return TableDataInfo.build(rows);
|
||||
// 3、 查询项目对应的物料详情
|
||||
LambdaQueryWrapper<SysOaOutWarehouse> lqw1 = Wrappers.lambdaQuery(SysOaOutWarehouse.class);
|
||||
lqw1.eq(SysOaOutWarehouse::getProjectId, projectId);
|
||||
List<SysOaOutWarehouse> outWarehouses = outWarehouseMapper.selectList(lqw1);
|
||||
//log.info("查询项目对应的物料详情:{}", outWarehouses);
|
||||
if (!outWarehouses.isEmpty()) {
|
||||
Map<Long, SysOaWarehouse> warehouseMap = warehouseMapper.selectList(Wrappers.lambdaQuery(SysOaWarehouse.class)).stream().collect(Collectors.toMap(SysOaWarehouse::getId, Function.identity()));
|
||||
|
||||
//log.info("查询项目对应的物料详情:{}", warehouseMap);
|
||||
for (SysOaOutWarehouse outWarehouse : outWarehouses) {
|
||||
SysOaWarehouse warehouse = warehouseMap.get(outWarehouse.getWarehouseId());
|
||||
SysOaCostList sysOaCostList = new SysOaCostList();
|
||||
sysOaCostList.setMaterialId(outWarehouse.getWarehouseId());
|
||||
sysOaCostList.setName(warehouse.getName());
|
||||
sysOaCostList.setPrice(warehouse.getPrice());
|
||||
sysOaCostList.setAmount(outWarehouse.getAmount());
|
||||
MaterialList.add(sysOaCostList);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 4、 查询项目对应的差旅详情
|
||||
LambdaQueryWrapper<SysOaClaim> lqw2 = Wrappers.lambdaQuery(SysOaClaim.class);
|
||||
lqw2.eq(SysOaClaim::getProjectId, projectId);
|
||||
List<SysOaClaimVo> claims = claimMapper.selectVoList(lqw2);
|
||||
Map<Long, SysOaClaimVo> claimMap = claims.stream().collect(Collectors.toMap(SysOaClaimVo::getClaimId, Function.identity()));
|
||||
Set<Long> claimIds = claimMap.keySet();
|
||||
if (!claims.isEmpty()) {
|
||||
for (Long claimId : claimIds) {
|
||||
SysOaCostList sysOaCostList = new SysOaCostList();
|
||||
SysOaClaimVo claim = claimMap.get(claimId);
|
||||
sysOaCostList.setClaimId(claim.getClaimId());
|
||||
sysOaCostList.setNickName(userMapper.selectUserById(claim.getUserId()).getNickName());
|
||||
sysOaCostList.setCost(claim.getCost());
|
||||
sysOaCostList.setRemark(claim.getRemark());
|
||||
ClaimList.add(sysOaCostList);
|
||||
}
|
||||
}
|
||||
sysOaCostRow.setUserCostList(UserCostList);
|
||||
sysOaCostRow.setMaterialList(MaterialList);
|
||||
sysOaCostRow.setClaimList(ClaimList);
|
||||
sysOaCostRow.setOtherList(OtherList);
|
||||
return sysOaCostRow;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public TableDataInfo<SysOaCostAllVo> calcProjectCostList(SysOaCostBo bo, PageQuery pageQuery) {
|
||||
// 查询所有的项目拿到项目之后分别计算他们的各种成本联查四表
|
||||
QueryWrapper<SysOaProjectBo> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.like(bo.getProjectName()!=null,"sop.project_name", bo.getProjectName());
|
||||
queryWrapper.orderByDesc("sop.create_time");
|
||||
Page<SysOaCostAllVo> sysOaCostAllVos = projectMapper.selectListToCost(pageQuery.build(),queryWrapper);
|
||||
// 查询user laborCost 查attendance 拿签到
|
||||
return TableDataInfo.build(sysOaCostAllVos);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -115,6 +115,39 @@
|
||||
and soa.del_flag = '0'
|
||||
group by sop.project_id,create_time
|
||||
</select>
|
||||
<select id="selectListToCost" resultType="com.ruoyi.oa.domain.vo.SysOaCostAllVo">
|
||||
SELECT
|
||||
sop.project_name,sop.project_num,sop.project_id,
|
||||
|
||||
(
|
||||
SELECT COALESCE(SUM(soc.cost),0)
|
||||
FROM sys_oa_claim soc
|
||||
WHERE soc.project_id = sop.project_id
|
||||
) AS claimCost,
|
||||
|
||||
(
|
||||
SELECT COALESCE(SUM(soow.amount * sow.price),0)
|
||||
FROM sys_oa_out_warehouse soow
|
||||
JOIN sys_oa_warehouse sow ON soow.id = sow.id
|
||||
WHERE soow.project_id = sop.project_id
|
||||
) AS materialCost,
|
||||
|
||||
(
|
||||
SELECT COALESCE(ROUND(SUM((soa.day_length * 9 + soa.hour) / 9),1), 0)
|
||||
FROM sys_oa_attendance soa
|
||||
WHERE soa.project_id = sop.project_id
|
||||
) AS peopleDay,
|
||||
|
||||
(
|
||||
SELECT COALESCE(SUM(ROUND((soa.day_length * 9 + soa.hour) / 9, 1) * su.labor_cost),0)
|
||||
FROM sys_oa_attendance soa
|
||||
JOIN sys_user su ON soa.user_id = su.user_id
|
||||
WHERE soa.project_id = sop.project_id
|
||||
) AS userCost
|
||||
FROM sys_oa_project sop
|
||||
${ew.getCustomSqlSegment}
|
||||
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
||||
|
||||
@@ -22,7 +22,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</resultMap>
|
||||
|
||||
<select id="selectVoByIdAndXml" resultMap="SysOaWarehouseResult" parameterType="Long">
|
||||
select id, inventory, model, unit, name, brand, specifications, remark, create_time, create_by, update_time, update_by, del_flag from sys_oa_warehouse where id = #{id}
|
||||
select id, inventory, model, unit, name, brand, specifications, remark, create_time, create_by, update_time, update_by, del_flag
|
||||
from sys_oa_warehouse
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
@@ -95,13 +95,14 @@ export function delFinance(financeId) {
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @returns 获取进出账管理列表
|
||||
*/
|
||||
export function getCostDetailList() {
|
||||
export function getCostDetailList(query) {
|
||||
return request({
|
||||
url: '/oa/cost/list',
|
||||
method: 'get'
|
||||
method: 'get',
|
||||
params:query
|
||||
})
|
||||
}
|
||||
|
||||
@@ -117,9 +118,9 @@ export function getCostDetailById(costId) {
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param {*} data 创建成本详情
|
||||
* @returns
|
||||
* @returns
|
||||
*/
|
||||
export function createCostDetail(data) {
|
||||
return request({
|
||||
@@ -130,13 +131,13 @@ export function createCostDetail(data) {
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param {*} costId 删除成本详情
|
||||
* @returns
|
||||
* @returns
|
||||
*/
|
||||
export function deleteCostDetail(costId) {
|
||||
return request({
|
||||
url: `/oa/cost/${costId}`,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -106,3 +106,11 @@ export function numberToCNY(money) {
|
||||
}
|
||||
return chineseStr;
|
||||
}
|
||||
|
||||
|
||||
export function formatNumberToWan(num) {
|
||||
if (num === 0) return 0;
|
||||
const wanNum = num / 10000;
|
||||
const roundedNum = Math.round(wanNum * 100) / 100; // 保留两位小数,四舍五入
|
||||
return roundedNum;
|
||||
}
|
||||
|
||||
@@ -1,83 +1,49 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
|
||||
<!-- <el-form-item label="项目名" prop="projectId">-->
|
||||
<!-- <el-input-->
|
||||
<!-- v-model="queryParams.projectId"-->
|
||||
<!-- placeholder="请输入项目名"-->
|
||||
<!-- clearable-->
|
||||
<!-- @keyup.enter.native="handleQuery"-->
|
||||
<!-- />-->
|
||||
<!-- </el-form-item>-->
|
||||
<el-form-item>
|
||||
<!-- <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>-->
|
||||
<el-form-item label="项目名" prop="projectName">
|
||||
<el-input
|
||||
v-model="queryParams.projectName"
|
||||
placeholder="请输入项目名"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
||||
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="primary"
|
||||
plain
|
||||
icon="el-icon-plus"
|
||||
size="mini"
|
||||
@click="handleAdd"
|
||||
v-hasPermi="['oa:oaOutWarehouse:add']"
|
||||
>新增
|
||||
</el-button>
|
||||
</el-col>
|
||||
<!-- <el-col :span="1.5">
|
||||
<el-button
|
||||
type="danger"
|
||||
plain
|
||||
icon="el-icon-delete"
|
||||
size="mini"
|
||||
:disabled="multiple"
|
||||
@click="handleDelete"
|
||||
v-hasPermi="['oa:oaOutWarehouse:remove']"
|
||||
>删除
|
||||
</el-button>
|
||||
</el-col> -->
|
||||
<!-- <el-col :span="1.5">
|
||||
<el-button
|
||||
type="warning"
|
||||
plain
|
||||
icon="el-icon-download"
|
||||
size="mini"
|
||||
@click="handleExport"
|
||||
v-hasPermi="['oa:oaOutWarehouse:export']"
|
||||
>导出
|
||||
</el-button>
|
||||
</el-col> -->
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<el-table v-loading="loading" :data="costList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center"/>
|
||||
<el-table-column label="索引" align="center" type="index"/>
|
||||
<el-table-column label="项目编号" align="center" prop="projectId"/>
|
||||
<el-table-column label="序号" align="center" type="index"/>
|
||||
<el-table-column label="项目名" align="center" prop="projectName"/>
|
||||
<el-table-column label="成本" align="center" prop="cost"/>
|
||||
<el-table-column label="成本类型" align="center" prop="costType"/>
|
||||
<el-table-column label="备注" align="center" prop="remark"/>
|
||||
|
||||
<!-- <el-table-column label="备注" align="center" prop="remark">
|
||||
<el-table-column label="人力花费" align="center" prop="userCost">
|
||||
<template slot-scope="scope">
|
||||
<div v-if="scope.row.projectName!==null">
|
||||
<el-tooltip class="item" effect="dark" :content="'点击查看'+scope.row.projectName+'的出库情况'" placement="bottom">
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
@click="handleSearch(scope.row)"
|
||||
> {{ scope.row.projectName }}
|
||||
</el-button>
|
||||
</el-tooltip>
|
||||
</div>
|
||||
<div v-else>未关联项目</div>
|
||||
<div>{{formatNumberToWan(scope.row.userCost)}}万元</div>
|
||||
</template>
|
||||
</el-table-column> -->
|
||||
<el-table-column label="创建时间" align="center" prop="createTime"/>
|
||||
</el-table-column>
|
||||
<el-table-column label="人天计算" align="center" prop="peopleDay"/>
|
||||
<el-table-column label="报销花费" align="center" prop="claimCost">
|
||||
<template slot-scope="scope">
|
||||
<div>{{formatNumberToWan(scope.row.claimCost)}}万元</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="物料花费" align="center" prop="materialCost">
|
||||
<template slot-scope="scope">
|
||||
<div>{{formatNumberToWan(scope.row.materialCost)}}万元</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="综合成本" align="center" prop="cost">
|
||||
<template slot-scope="scope">
|
||||
<div>{{formatNumberToWan(scope.row.materialCost+scope.row.userCost+scope.row.claimCost)}}万元</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<template slot-scope="scope">
|
||||
<el-button
|
||||
@@ -205,88 +171,44 @@
|
||||
</el-descriptions> -->
|
||||
|
||||
<el-tabs v-model="activeName" type="card">
|
||||
<el-tab-pane label="claim成本" name="claim">
|
||||
<el-tab-pane label="报销花费详情" name="claim">
|
||||
<el-table v-loading="loading" :data="detailData.claimList">
|
||||
<el-table-column type="selection" width="55" align="center"/>
|
||||
<el-table-column label="索引" align="center" type="index"/>
|
||||
<el-table-column label="成本" align="center" prop="cost"/>
|
||||
<!-- <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<el-table-column label="花费" align="center" prop="cost">
|
||||
<template slot-scope="scope">
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-delete"
|
||||
@click="handleDelete(scope.row)"
|
||||
>删除
|
||||
</el-button>
|
||||
<div>{{scope.row.cost}}元</div>
|
||||
</template>
|
||||
</el-table-column> -->
|
||||
</el-table-column>
|
||||
<el-table-column label="申请人" align="center" prop="nickName"/>
|
||||
<el-table-column label="备注" align="center" prop="remark"/>
|
||||
</el-table>
|
||||
</el-tab-pane>
|
||||
<el-tab-pane label="material成本" name="material">
|
||||
<el-tab-pane label="物料花费详情" name="material">
|
||||
<el-table v-loading="loading" :data="detailData.materialList">
|
||||
<el-table-column type="selection" width="55" align="center"/>
|
||||
<el-table-column label="索引" align="center" type="index"/>
|
||||
<el-table-column label="成本" align="center" prop="cost"/>
|
||||
<el-table-column label="材料品牌" align="center" prop="materialVo.brand"/>
|
||||
|
||||
<el-table-column label="材料型号" align="center" prop="materialVo.model"/>
|
||||
<el-table-column label="材料名称" align="center" prop="materialVo.name"/>
|
||||
<el-table-column label="材料库存" align="center" prop="materialVo.inventory"/>
|
||||
<el-table-column label="材料单价" align="center" prop="materialVo.price"/>
|
||||
<el-table-column label="材料单位" align="center" prop="materialVo.unit"/>
|
||||
<el-table-column label="材料规格" align="center" prop="materialVo.specifications"/>
|
||||
|
||||
<!-- <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<el-table-column label="材料编号" align="center" prop="materialId"/>
|
||||
<el-table-column label="材料单价" align="center" prop="price">
|
||||
<template slot-scope="scope">
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-delete"
|
||||
@click="handleDelete(scope.row)"
|
||||
>删除
|
||||
</el-button>
|
||||
<div>{{scope.row.price}}元</div>
|
||||
</template>
|
||||
</el-table-column> -->
|
||||
</el-table-column>
|
||||
<el-table-column label="物料名" align="center" prop="name"/>
|
||||
<el-table-column label="出库数量" align="center" prop="amount"/>
|
||||
</el-table>
|
||||
</el-tab-pane>
|
||||
<el-tab-pane label="other成本" name="other">
|
||||
<el-table :data="detailData.otherList">
|
||||
<el-table-column type="selection" width="55" align="center"/>
|
||||
<el-table-column label="索引" align="center" type="index"/>
|
||||
<el-table-column label="成本" align="center" prop="cost"/>
|
||||
|
||||
<!-- <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<template slot-scope="scope">
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-delete"
|
||||
@click="handleDelete(scope.row)"
|
||||
>删除
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column> -->
|
||||
</el-table>
|
||||
</el-tab-pane>
|
||||
<el-tab-pane label="user成本" name="user">
|
||||
<el-tab-pane label="人力成本" name="user">
|
||||
<el-table :data="detailData.userCostList">
|
||||
<el-table-column type="selection" width="55" align="center"/>
|
||||
<el-table-column label="索引" align="center" type="index"/>
|
||||
<el-table-column label="成本" align="center" prop="cost"/>
|
||||
<el-table-column label="人员名称" align="center" prop="userVo.userName"/>
|
||||
|
||||
<!-- <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<el-table-column label="人员名称" align="center" prop="nickName"/>
|
||||
<el-table-column label="人员成本" align="center" prop="laborCost">
|
||||
<template slot-scope="scope">
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-delete"
|
||||
@click="handleDelete(scope.row)"
|
||||
>删除
|
||||
</el-button>
|
||||
<div>{{scope.row.laborCost}}元</div>
|
||||
</template>
|
||||
</el-table-column> -->
|
||||
</el-table-column>
|
||||
<el-table-column label="人天计算" align="center" prop="attendanceNum"/>
|
||||
</el-table>
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
@@ -298,35 +220,6 @@
|
||||
<!-- 添加或修改仓库出库对话框 -->
|
||||
<el-dialog :title="title" :visible.sync="open" width="800px" append-to-body>
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
||||
<!-- <el-form-item
|
||||
label="绑定项目"
|
||||
>
|
||||
<el-radio-group v-model="projectFlag" :disabled="drawer">
|
||||
<el-radio :label="true">是</el-radio>
|
||||
<el-radio :label="false">否</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
v-if="projectFlag&&!drawer"
|
||||
prop="projectId"
|
||||
label="项目名"
|
||||
>
|
||||
<el-select v-model="form.projectId" placeholder="请选择项目">
|
||||
<el-option
|
||||
v-for="item in projectList"
|
||||
:key="item.projectId"
|
||||
:label="item.projectName"
|
||||
:value="item.projectId">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item
|
||||
v-if="drawer"
|
||||
label="项目名"
|
||||
>
|
||||
<el-input :value="selectedProject.projectName" disabled></el-input>
|
||||
</el-form-item> -->
|
||||
<el-form-item label="项目ID">
|
||||
<el-input v-model="form.projectId"></el-input>
|
||||
</el-form-item>
|
||||
@@ -347,58 +240,6 @@
|
||||
v-model="form.remark">
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
|
||||
<!-- <el-form-item
|
||||
v-for="(item, index) in form.outWareHouseList"
|
||||
:label="'出库物料' + (index+1)"
|
||||
:key="item.warehouseId"
|
||||
:prop="'outWareHouseList.' + index + '.warehouseId'"
|
||||
>
|
||||
<el-row>
|
||||
<el-col :span="8">物料名</el-col>
|
||||
<el-col :span="4">当前库存</el-col>
|
||||
<el-col :span="8">出库数量</el-col>
|
||||
<el-col :span="4">操作</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
|
||||
<el-col :span="8">
|
||||
<el-select
|
||||
v-model="item.warehouseId"
|
||||
filterable
|
||||
remote
|
||||
reserve-keyword
|
||||
@change="(e)=>handleGetInventory(e,index)"
|
||||
placeholder="请输入关键词"
|
||||
:remote-method="remoteMethod"
|
||||
:loading="loading">
|
||||
<el-option
|
||||
v-for="item in oaWarehouseList"
|
||||
:key="item.id"
|
||||
:label="item.name"
|
||||
:value="item.id">
|
||||
<span style="">{{ item.name }}</span>
|
||||
<span style="color: #8492a6; font-size: 13px" v-if="item.model!==undefined">-{{ item.model }}</span>
|
||||
<span style="color: #8492a6; font-size: 13px" v-if="item.brand!==undefined">-{{ item.brand }}</span>
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-col>
|
||||
<el-col :span="3">
|
||||
<el-tag type="info" v-if="item.inventory===undefined">请选择物料</el-tag>
|
||||
<el-tag type="info" v-else>{{ item.inventory }}</el-tag>
|
||||
</el-col>
|
||||
<el-col :span="6">
|
||||
<el-input-number v-model="item.amount" :min="1" :max="item.inventory"></el-input-number>
|
||||
</el-col>
|
||||
<el-col :span="6" style="display: flex;justify-content: center" >
|
||||
<el-button @click.prevent="removeDomain(item)">删除</el-button>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form-item> -->
|
||||
<!-- <el-form-item>
|
||||
<el-button @click="addDomain">新增成本</el-button>
|
||||
<el-button @click="reset()">重置</el-button>
|
||||
</el-form-item> -->
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button :loading="buttonLoading" type="primary" @click="submitForm">确 定</el-button>
|
||||
@@ -425,11 +266,14 @@
|
||||
<el-table v-loading="loading" :data="oaOutWarehouseList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center"/>
|
||||
<el-table-column label="序号" align="center" type="index"/>
|
||||
<el-table-column label="出库单" align="center" prop="id"/>
|
||||
<el-table-column label="物料名" align="center" prop="warehouseName"/>
|
||||
<el-table-column label="物料名" align="center" prop="name"/>
|
||||
<el-table-column label="出库数量" align="center" prop="amount"/>
|
||||
<el-table-column label="出库时间" align="center" prop="createTime"/>
|
||||
<el-table-column label="备注" align="center" prop="remark"/>
|
||||
<el-table-column label="物料单价" align="center" prop="price"/>
|
||||
<el-table-column label="总计花费" align="center" prop="remark">
|
||||
<template slot-scope="scope">
|
||||
<div>{{scope.row.amount*scope.row.price}}</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<template slot-scope="scope">
|
||||
<el-button
|
||||
@@ -452,6 +296,7 @@
|
||||
import {listProject} from "@/api/oa/project";
|
||||
import {listByMultiQuery, listOaWarehouse} from "../../../api/oa/oaWarehouse";
|
||||
import { createCostDetail, getCostDetailById, getCostDetailList } from "../../../api/oa/finance";
|
||||
import {formatNumberToWan} from "../../../utils/currencyFormatter";
|
||||
|
||||
export default {
|
||||
name: "OaOutWarehouse",
|
||||
@@ -532,12 +377,13 @@ export default {
|
||||
this.getList();
|
||||
},
|
||||
methods: {
|
||||
formatNumberToWan,
|
||||
/** 查询仓库出库列表 */
|
||||
getList() {
|
||||
this.loading = true;
|
||||
|
||||
getCostDetailList().then(res => {
|
||||
console.log(res.rows)
|
||||
getCostDetailList(this.queryParams).then(res => {
|
||||
console.log(res)
|
||||
this.costList = res.rows
|
||||
this.total = res.total
|
||||
this.loading = false
|
||||
@@ -734,32 +580,10 @@ export default {
|
||||
})
|
||||
},
|
||||
|
||||
// 查看出库详情
|
||||
handleSearch(item) {
|
||||
this.loading = true
|
||||
this.searchItem = item;
|
||||
this.form.projectId = item.projectId;
|
||||
this.selectedProject = item;
|
||||
queryOutWarehouseByProjectId(item.projectId).then(response => {
|
||||
this.oaOutWarehouseList = response.rows;
|
||||
this.drawer = true;
|
||||
this.loading = false;
|
||||
})
|
||||
},
|
||||
|
||||
// 查看出库单独条目详情
|
||||
showDetail(row){
|
||||
// getOaOutWarehouse(row.id).then(response => {
|
||||
// console.log(response.data);
|
||||
// this.outDetail = response.data;
|
||||
|
||||
// this.projectDetail = response.data.project;
|
||||
// this.warehouseDetail = response.data.warehouse;
|
||||
// })
|
||||
// this.detail=true;
|
||||
getCostDetailById(row.projectId).then(response => {
|
||||
console.log(response.rows[0]);
|
||||
this.detailData = response.rows[0];
|
||||
this.detailData = response.data;
|
||||
this.detail=true;
|
||||
})
|
||||
}
|
||||
|
||||
@@ -1,9 +1,17 @@
|
||||
<template>
|
||||
<el-form ref="form" :model="formData" label-width="80px">
|
||||
<el-form-item label="类型">
|
||||
<el-input v-model="formData.type" />
|
||||
<el-select v-model="formData.type">
|
||||
<el-option label="其他" :value="0" />
|
||||
<el-option label="旷工" :value="3" />
|
||||
<el-option label="请假" :value="1" />
|
||||
<el-option label="迟到" :value="4" />
|
||||
<el-option label="早退" :value="6" />
|
||||
<el-option label="未打卡" :value="5" />
|
||||
<el-option label="出差" :value="2" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
|
||||
<el-form-item label="奖惩标记">
|
||||
<el-select v-model="formData.flag">
|
||||
<el-option label="奖励" :value="1" />
|
||||
@@ -18,11 +26,11 @@
|
||||
<el-form-item label="日期" prop="signTime">
|
||||
<el-date-picker v-model="formData.signTime" type="date" format="yyyy-MM-DD" placeholder="选择日期" />
|
||||
</el-form-item>
|
||||
|
||||
|
||||
<el-form-item label="备注" prop="reason">
|
||||
<el-input v-model="formData.reason" type="textarea" />
|
||||
</el-form-item>
|
||||
|
||||
|
||||
<div class="dialog-footer">
|
||||
<el-button @click="handleCancel">取消</el-button>
|
||||
<el-button type="primary" @click="submit">确认创建</el-button>
|
||||
@@ -49,7 +57,7 @@ export default {
|
||||
if (valid) {
|
||||
this.$emit('submit', this.formData)
|
||||
this.resetForm();
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
@@ -69,4 +77,4 @@ export default {
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</script>
|
||||
|
||||
@@ -4,12 +4,11 @@
|
||||
:data="tableData"
|
||||
v-loading="loading"
|
||||
@selection-change="$emit('selection-change', $event)"
|
||||
|
||||
>
|
||||
<el-table-column type="selection" width="55" />
|
||||
<el-table-column prop="nickName" label="姓名" />
|
||||
<el-table-column prop="realSalary" label="实发工资" />
|
||||
<el-table-column prop="baseSalary" label="基本工资" />
|
||||
<el-table-column prop="baseSalary" label="基本工资" />
|
||||
<el-table-column prop="payTime" label="发薪日期" />
|
||||
<el-table-column label="操作" width="180">
|
||||
<template slot-scope="{ row }">
|
||||
@@ -49,4 +48,4 @@ export default {
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</script>
|
||||
|
||||
@@ -2,11 +2,6 @@
|
||||
<div class="salary-container">
|
||||
<!-- 操作工具栏 -->
|
||||
<el-row class="operation-bar">
|
||||
<el-col :span="12">
|
||||
<!-- <el-button type="primary" @click="openDialog('add')">新增</el-button> -->
|
||||
<!-- <el-button :disabled="selectedRows.length === 0" @click="handleBatchDelete">批量删除</el-button> -->
|
||||
<!-- <el-button @click="handleExport">导出</el-button> -->
|
||||
</el-col>
|
||||
<el-col :span="12" class="text-right">
|
||||
<el-date-picker
|
||||
v-model="currentMonth"
|
||||
@@ -29,12 +24,12 @@
|
||||
@page-change="handlePageChange"
|
||||
/>
|
||||
</el-tab-pane>
|
||||
|
||||
|
||||
<el-tab-pane label="工人工资" name="worker">
|
||||
<salary-table
|
||||
:data="tableData"
|
||||
:loading="loading"
|
||||
:pagination="pagination"
|
||||
:pagination="pagination"
|
||||
@selection-change="handleSelection"
|
||||
@delete="handleDelete"
|
||||
@page-change="handlePageChange"
|
||||
@@ -52,7 +47,7 @@
|
||||
<el-table :data="salaryDetails">
|
||||
<el-table-column label="奖惩标记" prop="flag">
|
||||
<template slot-scope="scope">
|
||||
<el-tag
|
||||
<el-tag
|
||||
:type="scope.row.flag === 1 ? 'success' : 'danger'"
|
||||
disable-transitions
|
||||
>
|
||||
@@ -112,12 +107,12 @@ export default {
|
||||
this.fetchData()
|
||||
},
|
||||
methods: {
|
||||
getDefaultMonth() {
|
||||
getDefaultMonth() {
|
||||
const d = new Date()
|
||||
return `${d.getFullYear()}-${String(d.getMonth() + 1).padStart(2, '0')}`
|
||||
},
|
||||
|
||||
async fetchData() {
|
||||
async fetchData() {
|
||||
this.loading = true
|
||||
try {
|
||||
const params = {
|
||||
@@ -171,10 +166,10 @@ export default {
|
||||
getSalaryItemDetail(id).then(res => {
|
||||
this.salaryDetails = res.rows;
|
||||
})
|
||||
},
|
||||
},
|
||||
|
||||
async handleSubmit(formData) {
|
||||
console.log(formData);
|
||||
console.log(formData);
|
||||
const result = await createSalaryItem({
|
||||
...formData,
|
||||
salaryId: this.currentEditData.salaryId
|
||||
@@ -206,4 +201,4 @@ export default {
|
||||
.text-right {
|
||||
text-align: right;
|
||||
}
|
||||
</style>
|
||||
</style>
|
||||
|
||||
@@ -92,10 +92,10 @@
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-drawer title="文件管理"
|
||||
:visible.sync="showFile"
|
||||
size="800px"
|
||||
direction="rtl"
|
||||
<el-drawer :title="`${user.nickName} - 文件管理`"
|
||||
:visible.sync="fileDrawerVisible"
|
||||
size="800px"
|
||||
direction="rtl"
|
||||
append-to-body>
|
||||
<UserFileManager
|
||||
:user-id="user.userId"
|
||||
|
||||
Reference in New Issue
Block a user