Commit b3fc1193 authored by lcl's avatar lcl

Merge branch 'V20231129-中建一局二公司' of http://192.168.60.201/root/dsk-operate-sys...

Merge branch 'V20231129-中建一局二公司' of http://192.168.60.201/root/dsk-operate-sys into V20231129-中建一局二公司
parents 8688d1a0 cf194c3d
......@@ -188,6 +188,7 @@ tenant:
- f_ads_bsi_kpi_proj_two
- cb_summary
- cb_summary_actual
- cb_summary_actual_lock
- cb_cost_measure
- cb_cost_measure_actual
- cb_direct_expense
......
......@@ -7,6 +7,7 @@ import com.dsk.common.core.domain.R;
import com.dsk.common.utils.poi.ExcelUtil;
import com.dsk.cscec.domain.bo.CbSummaryActualBo;
import com.dsk.cscec.domain.bo.CbSummaryActualListBo;
import com.dsk.cscec.domain.bo.CbSummaryActualLockBo;
import com.dsk.cscec.domain.bo.CbSummaryBo;
import com.dsk.cscec.domain.vo.CbSummaryActualListVo;
import com.dsk.cscec.domain.vo.CbSummaryCostAccountExportVo;
......@@ -64,10 +65,20 @@ public class CbSummaryController extends BaseController {
* @return
*/
@GetMapping("/expenseDateList")
public R<List<String>> getExpenseDateList(@Validated CbSummaryBo bo) {
public R<List<Map<String,Object>>> getExpenseDateList(@Validated CbSummaryBo bo) {
return R.ok(cbSummaryService.getExpenseDateList(bo));
}
/**
* 已锁定月份
* @param bo
* @return
*/
@GetMapping("/expenseDateList/locked")
public R<List<String>> getLockedList(@Validated CbSummaryBo bo) {
return R.ok(cbSummaryService.getLockedList(bo));
}
/**
* 编辑成本
*
......@@ -79,9 +90,25 @@ public class CbSummaryController extends BaseController {
return cbSummaryService.insertOrUpdateActual(boList) == true ? R.ok() : R.fail();
}
//锁定成本前提示未填项(按一级大类)
/**
* 锁定成本前提示未填项(按一级大类)
* @param bo
* @return
*/
@GetMapping("/getUnfilled")
public R getUnfilled(CbSummaryActualLockBo bo){
return cbSummaryService.getUnfilled(bo);
}
//锁定成本
/**
* 按月份锁定成本
* @param bo
* @return
*/
@PostMapping("/lockActual")
public R lockActual(@RequestBody CbSummaryActualLockBo bo) {
return cbSummaryService.lockActual(bo) == true ? R.ok() : R.fail();
}
/**
* 导出excel-按月导出所有
......@@ -89,7 +116,7 @@ public class CbSummaryController extends BaseController {
* @param response
*/
@PostMapping("/export")
public void export(CbSummaryActualListBo bo, HttpServletResponse response) {
public void export(@RequestBody CbSummaryActualListBo bo, HttpServletResponse response) {
List<CbSummaryActualListVo> actualListVoList = cbSummaryService.getAll(bo);
if(bo.getCbType()==1){
List<CbSummaryProjectExportVo> list = BeanUtil.copyToList(actualListVoList,CbSummaryProjectExportVo.class);
......
package com.dsk.cscec.domain;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import lombok.Data;
import java.io.Serializable;
......@@ -83,6 +84,7 @@ public class CbSummary implements Serializable {
/**
* 删除状态(0:否、2:是)
*/
@TableLogic
private Integer delFlag;
/**
* 成本类型(1项目汇总,2成本科目汇总)
......
......@@ -40,7 +40,7 @@ public class CbSummaryActual implements Serializable {
/**
* 是否锁定(0否,1是)
*/
private Integer lockStatus;
// private Integer lockStatus;
/**
* 创建时间
*/
......
package com.dsk.cscec.domain;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import lombok.Data;
import java.util.Date;
import java.io.Serializable;
/**
* 成本汇总-每月成本锁定(CbSummaryActualLock)实体类
*
* @author makejava
* @since 2024-02-19
*/
@Data
public class CbSummaryActualLock implements Serializable {
private static final long serialVersionUID = 849892917534518164L;
/**
* 主键id
*/
@TableId(value = "id")
private Long id;
/**
* 项目id
*/
private Long projectId;
/**
* 费用日期
*/
private String expenseDate;
/**
* 成本类型(1项目汇总,2成本科目汇总)
*/
private Integer cbType;
/**
* 创建时间
*/
private Date createTime;
/**
* 删除状态(0:否、2:是)
*/
@TableLogic
private Integer delFlag;
}
......@@ -15,6 +15,10 @@ public class CbSummaryActualListBo extends BaseEntity {
* 主键id
*/
private Long id;
/**
* 项目id
*/
private Long projectId;
/**
* 成本阶段( 0:标前成本、1:标后成本、2:转固成本)
*/
......
package com.dsk.cscec.domain.bo;
import com.dsk.common.core.domain.BaseEntity;
import lombok.Data;
/**
* 成本汇总-每月成本锁定(CbSummaryActualLock)bo
*
* @author cyf
* @since 2024-02-19
*/
@Data
public class CbSummaryActualLockBo extends BaseEntity {
/**
* 项目id
*/
private Long projectId;
/**
* 费用日期
*/
private String expenseDate;
/**
* 成本类型(1项目汇总,2成本科目汇总)
*/
private Integer cbType;
}
......@@ -26,6 +26,10 @@ public class CbSummaryActualListVo extends BaseEntity {
* 成本阶段( 0:标前成本、1:标后成本、2:转固成本)
*/
private Integer cbStage;
/**
* 层级
*/
private Integer level;
/**
* 序号
*/
......@@ -82,10 +86,6 @@ public class CbSummaryActualListVo extends BaseEntity {
* 费用日期
*/
private String expenseDate;
/**
* 是否锁定(0否,1是)
*/
private Integer lockStatus;
private List<CbSummaryActualListVo> children;
}
package com.dsk.cscec.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.dsk.cscec.domain.CbSummaryActualLock;
import com.dsk.cscec.domain.bo.CbSummaryBo;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 成本汇总-每月成本锁定(CbSummaryActualLock)表数据库访问层
*
* @author makejava
* @since 2024-02-19
*/
public interface CbSummaryActualLockMapper extends BaseMapper<CbSummaryActualLock> {
/**
* 获取已锁定成本月份
*
* @param bo
* @return
*/
List<String> getLockedList(@Param("bo") CbSummaryBo bo);
}
......@@ -4,7 +4,9 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.dsk.cscec.domain.CbSummaryActual;
import org.apache.ibatis.annotations.Param;
import java.math.BigDecimal;
import java.util.List;
import java.util.Map;
/**
* 成本汇总-每月费用(CbSummaryActual)表数据库访问层
......@@ -21,4 +23,11 @@ public interface CbSummaryActualMapper extends BaseMapper<CbSummaryActual> {
*/
int insertOrUpdateBatch(@Param("entities") List<CbSummaryActual> entities);
/**
* 截至本月费用
* @param cbSummaryId
* @param expenseDate
* @return
*/
Map<String, BigDecimal> getTotal(@Param("cbSummaryId") Long cbSummaryId, @Param("expenseDate") String expenseDate);
}
......@@ -23,6 +23,14 @@ public interface CbSummaryMapper extends BaseMapper<CbSummary> {
CbSummaryActualListVo getById(@Param("id") Long id, @Param("expenseDate") String expenseDate);
/**
* 根据ids获取实际成本
* @param entities
* @param expenseDate
* @return
*/
List<CbSummaryActualListVo> getByIds(@Param("entities") List<CbSummary> entities, @Param("expenseDate") String expenseDate);
/**
* 根据月份获取所有项目汇总数据
*
......@@ -45,7 +53,7 @@ public interface CbSummaryMapper extends BaseMapper<CbSummary> {
* @param bo
* @return
*/
List<String> getExpenseDateList(@Param("bo") CbSummaryBo bo);
List<Map<String,Object>> getExpenseDateList(@Param("bo") CbSummaryBo bo);
/**
* 根据level获取名称/成本科目
......
package com.dsk.cscec.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.dsk.common.core.domain.R;
import com.dsk.cscec.domain.CbSummary;
import com.dsk.cscec.domain.bo.CbSummaryActualBo;
import com.dsk.cscec.domain.bo.CbSummaryActualListBo;
import com.dsk.cscec.domain.bo.CbSummaryActualLockBo;
import com.dsk.cscec.domain.bo.CbSummaryBo;
import com.dsk.cscec.domain.vo.CbSummaryActualListVo;
......@@ -44,7 +46,15 @@ public interface CbSummaryService extends IService<CbSummary> {
* @param bo
* @return
*/
List<String> getExpenseDateList(CbSummaryBo bo);
List<Map<String,Object>> getExpenseDateList(CbSummaryBo bo);
/**
* 获取已锁定成本月份
*
* @param bo
* @return
*/
List<String> getLockedList(CbSummaryBo bo);
/**
* 新增/更新每月费用
......@@ -54,6 +64,20 @@ public interface CbSummaryService extends IService<CbSummary> {
*/
boolean insertOrUpdateActual(List<CbSummaryActualBo> boList);
/**
* 获取未填写成本一级大类
* @param bo
* @return
*/
R getUnfilled(CbSummaryActualLockBo bo);
/**
* 锁定成本
* @param bo
* @return
*/
boolean lockActual(CbSummaryActualLockBo bo);
/**
* 导出列表获取
* @param bo
......
......@@ -7,20 +7,16 @@ import cn.hutool.core.lang.Assert;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.dsk.common.core.domain.R;
import com.dsk.common.exception.ServiceException;
import com.dsk.cscec.constant.CbProjectConstants;
import com.dsk.cscec.domain.CbProjectFile;
import com.dsk.cscec.domain.CbProjectRecord;
import com.dsk.cscec.domain.CbSummary;
import com.dsk.cscec.domain.CbSummaryActual;
import com.dsk.cscec.domain.*;
import com.dsk.cscec.domain.bo.CbSummaryActualBo;
import com.dsk.cscec.domain.bo.CbSummaryActualListBo;
import com.dsk.cscec.domain.bo.CbSummaryActualLockBo;
import com.dsk.cscec.domain.bo.CbSummaryBo;
import com.dsk.cscec.domain.vo.CbSummaryActualListVo;
import com.dsk.cscec.mapper.CbProjectFileMapper;
import com.dsk.cscec.mapper.CbProjectRecordMapper;
import com.dsk.cscec.mapper.CbSummaryActualMapper;
import com.dsk.cscec.mapper.CbSummaryMapper;
import com.dsk.cscec.mapper.*;
import com.dsk.cscec.service.CbSummaryService;
import jodd.util.StringUtil;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -28,6 +24,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
......@@ -50,6 +47,9 @@ public class CbSummaryServiceImpl extends ServiceImpl<CbSummaryMapper, CbSummary
@Autowired
private CbProjectRecordMapper cbProjectRecordMapper;
@Autowired
private CbSummaryActualLockMapper cbSummaryActualLockMapper;
@Override
public void importCbProject(Long projectId, Integer cbStage) {
//获取文件信息
......@@ -96,33 +96,43 @@ public class CbSummaryServiceImpl extends ServiceImpl<CbSummaryMapper, CbSummary
@Override
public List<CbSummaryActualListVo> getActualList(CbSummaryActualListBo bo) {
Assert.notNull(bo.getId(),"id不能为空");
Assert.notNull(bo.getCbType(),"成本类型不能为空");
Assert.notNull(bo.getId(), "id不能为空");
Assert.notNull(bo.getCbType(), "成本类型不能为空");
if (StringUtil.isBlank(bo.getExpenseDate())) {
//默认当前月
bo.setExpenseDate(DatePattern.SIMPLE_MONTH_FORMAT.format(new Date()));
}
CbSummary cbSummary = baseMapper.selectById(bo.getId());
if (ObjectUtil.isEmpty(cbSummary)) {
//当前父级数据
CbSummaryActualListVo cbSummaryActualListVo = baseMapper.getById(bo.getId(), bo.getExpenseDate());
if (ObjectUtil.isEmpty(cbSummaryActualListVo)) {
return null;
}
//截至本月费用汇总
Map<String, BigDecimal> parentTotal = cbSummaryActualMapper.getTotal(cbSummaryActualListVo.getId(), bo.getExpenseDate());
cbSummaryActualListVo.setTaxExclusiveExpenseTotal(parentTotal.get("taxExclusiveExpenseTotal"));
cbSummaryActualListVo.setTaxInclusiveExpenseTotal(parentTotal.get("taxInclusiveExpenseTotal"));
List<CbSummaryActualListVo> childrenList = baseMapper.getByParentId(bo.getId(), bo.getExpenseDate());
if (0 == cbSummary.getLevel() && 1 == bo.getCbType()) {
//项目汇总
//截至本月费用汇总
childrenList.forEach(children -> {
Map<String, BigDecimal> total = cbSummaryActualMapper.getTotal(children.getId(), bo.getExpenseDate());
children.setTaxExclusiveExpenseTotal(total.get("taxExclusiveExpenseTotal"));
children.setTaxInclusiveExpenseTotal(total.get("taxInclusiveExpenseTotal"));
});
if (0 == cbSummaryActualListVo.getLevel() && 1 == bo.getCbType()) {
//项目汇总一级列表
return childrenList;
}else if(0 == cbSummary.getLevel() && 2 == bo.getCbType()) {
//成本科目汇总
CbSummaryActualListVo cbSummaryActualListVo = baseMapper.getById(bo.getId(), bo.getExpenseDate());
} else if (0 == cbSummaryActualListVo.getLevel() && 2 == bo.getCbType()) {
//成本科目汇总一级列表
cbSummaryActualListVo.setChildren(childrenList);
List<CbSummaryActualListVo> list = new ArrayList<>();
list.add(cbSummaryActualListVo);
return list;
}else {
} else {
//递归列表
childrenList = getProjectSumList(bo);
CbSummaryActualListVo cbSummaryActualListVo = baseMapper.getById(bo.getId(),bo.getExpenseDate());
cbSummaryActualListVo.setChildren(childrenList);
List<CbSummaryActualListVo> list = new ArrayList<>();
......@@ -133,7 +143,7 @@ public class CbSummaryServiceImpl extends ServiceImpl<CbSummaryMapper, CbSummary
}
/**
* 成本汇总列表
* 成本汇总递归列表
*
* @param bo
* @return
......@@ -146,6 +156,10 @@ public class CbSummaryServiceImpl extends ServiceImpl<CbSummaryMapper, CbSummary
childBo.setId(children.getId());
childBo.setExpenseDate(bo.getExpenseDate());
children.setChildren(getProjectSumList(childBo));
//截至本月费用汇总
Map<String, BigDecimal> total = cbSummaryActualMapper.getTotal(children.getId(), bo.getExpenseDate());
children.setTaxExclusiveExpenseTotal(total.get("taxExclusiveExpenseTotal"));
children.setTaxInclusiveExpenseTotal(total.get("taxInclusiveExpenseTotal"));
});
return childrenList;
......@@ -153,50 +167,142 @@ public class CbSummaryServiceImpl extends ServiceImpl<CbSummaryMapper, CbSummary
}
@Override
public List<String> getExpenseDateList(CbSummaryBo bo) {
Assert.notNull(bo.getProjectId(),"项目id不能为空");
Assert.notNull(bo.getCbStage(),"成本阶段不能为空");
Assert.notNull(bo.getCbType(),"成本类型不能为空");
public List<Map<String, Object>> getExpenseDateList(CbSummaryBo bo) {
Assert.notNull(bo.getProjectId(), "项目id不能为空");
// Assert.notNull(bo.getCbStage(),"成本阶段不能为空");
Assert.notNull(bo.getCbType(), "成本类型不能为空");
return baseMapper.getExpenseDateList(bo);
}
@Override
public List<String> getLockedList(CbSummaryBo bo) {
Assert.notNull(bo.getProjectId(), "项目id不能为空");
Assert.notNull(bo.getCbType(), "成本类型不能为空");
return cbSummaryActualLockMapper.getLockedList(bo);
}
@Override
@Transactional(rollbackFor = Exception.class)
public boolean insertOrUpdateActual(List<CbSummaryActualBo> boList) {
if (CollectionUtil.isEmpty(boList)) {
return false;
}
boList.forEach(bo->{
Assert.notNull(bo.getCbSummaryId(),"成本汇总id不能为空");
Assert.notNull(bo.getExpenseDate(),"费用日期不能为空");
boList.forEach(bo -> {
Assert.notNull(bo.getCbSummaryId(), "成本汇总id不能为空");
Assert.notNull(bo.getExpenseDate(), "费用日期不能为空");
});
List<CbSummaryActual> actualList = BeanUtil.copyToList(boList, CbSummaryActual.class);
//todo
// throw new ServiceException("当前成本已锁定,不允许编辑!");
CbSummary cbSummary = baseMapper.selectById(boList.get(0).getCbSummaryId());
Assert.isFalse(ObjectUtil.isNull(cbSummary), "成本汇总数据不存在!");
String expenseDate = boList.get(0).getExpenseDate();
boolean exists = cbSummaryActualLockMapper.exists(
new LambdaQueryWrapper<CbSummaryActualLock>()
.eq(CbSummaryActualLock::getProjectId, cbSummary.getProjectId())
.eq(CbSummaryActualLock::getExpenseDate, expenseDate)
.eq(CbSummaryActualLock::getCbType, cbSummary.getCbType())
);
Assert.isFalse(exists, "该月成本已锁定");
List<CbSummaryActual> actualList = BeanUtil.copyToList(boList, CbSummaryActual.class);
return cbSummaryActualMapper.insertOrUpdateBatch(actualList) > 0;
}
@Override
public R getUnfilled(CbSummaryActualLockBo bo) {
Assert.notNull(bo.getCbType(), "成本类型不能为空");
Assert.notNull(bo.getProjectId(), "项目id不能为空");
Assert.notBlank(bo.getExpenseDate(), "费用日期不能为空");
StringBuilder unfilled = new StringBuilder();
//获取一级大类成本id
List<CbSummary> firstList = baseMapper.selectList(
new LambdaQueryWrapper<CbSummary>()
.eq(CbSummary::getProjectId, bo.getProjectId())
.eq(CbSummary::getLevel, 1)
.eq(CbSummary::getCbType, bo.getCbType())
.orderByAsc(CbSummary::getSort)
);
firstList.forEach(firstCb -> {
//获取大类下的所有子级id
List<CbSummary> allList = new ArrayList<>();
allList.add(firstCb);
allList.addAll(getAllChild(firstCb.getId(), new ArrayList<>()));
//根据子级id查询是否填写实际成本
List<CbSummaryActualListVo> vos = baseMapper.getByIds(allList, bo.getExpenseDate());
if (CollectionUtil.isEmpty(vos)) {
unfilled.append(firstCb.getCbName()).append("、");
}
});
if (unfilled.length() > 0) {
unfilled.deleteCharAt(unfilled.lastIndexOf("、"));
unfilled.append(" 未填写成本,是否继续锁定?");
return R.fail(unfilled.toString());
} else {
return R.ok();
}
}
private List<CbSummary> getAllChild(Long id, List<CbSummary> resultList) {
List<CbSummary> childList = baseMapper.selectList(
new LambdaQueryWrapper<CbSummary>()
.eq(CbSummary::getParentId, id)
);
if (CollectionUtil.isNotEmpty(childList)) {
resultList.addAll(childList);
childList.forEach(child -> {
getAllChild(child.getId(), resultList);
});
}
return resultList;
}
@Override
public boolean lockActual(CbSummaryActualLockBo bo) {
Assert.notNull(bo.getCbType(), "成本类型不能为空");
Assert.notNull(bo.getProjectId(), "项目id不能为空");
Assert.notBlank(bo.getExpenseDate(), "费用日期不能为空");
boolean exists = cbSummaryActualLockMapper.exists(
new LambdaQueryWrapper<CbSummaryActualLock>()
.eq(CbSummaryActualLock::getProjectId, bo.getProjectId())
.eq(CbSummaryActualLock::getExpenseDate, bo.getExpenseDate())
.eq(CbSummaryActualLock::getCbType, bo.getCbType())
);
Assert.isFalse(exists, "该月成本已锁定,请勿重复操作!");
CbSummaryActualLock lock = BeanUtil.copyProperties(bo, CbSummaryActualLock.class);
return cbSummaryActualLockMapper.insert(lock) > 0;
}
@Override
public List<CbSummaryActualListVo> getAll(CbSummaryActualListBo bo) {
Assert.notNull(bo.getId(), "项目id不能为空");
Assert.notNull(bo.getProjectId(), "项目id不能为空");
Assert.notNull(bo.getCbType(), "成本类型不能为空");
Assert.notNull(bo.getExpenseDate(), "费用日期不能为空");
//获取项目成本阶段
CbProjectRecord cbProjectRecord = cbProjectRecordMapper.selectById(bo.getId());
CbProjectRecord cbProjectRecord = cbProjectRecordMapper.selectById(bo.getProjectId());
if (ObjectUtil.isNull(cbProjectRecord)) {
throw new ServiceException("当前项目不存在");
}
bo.setCbStage(cbProjectRecord.getCbStage());
// bo.setCbStage(cbProjectRecord.getCbStage());
List<CbSummaryActualListVo> resultList = new ArrayList<>();
if (bo.getCbType() == 1) {
return baseMapper.getProjectAll(bo);
resultList = baseMapper.getProjectAll(bo);
} else {
return baseMapper.getCostAccountAll(bo);
resultList = baseMapper.getCostAccountAll(bo);
}
//todo 截至本月费用汇总
//截至本月费用汇总
resultList.forEach(cbSummaryActualListVo -> {
Map<String, BigDecimal> total = cbSummaryActualMapper.getTotal(cbSummaryActualListVo.getId(), bo.getExpenseDate());
cbSummaryActualListVo.setTaxExclusiveExpenseTotal(total.get("taxExclusiveExpenseTotal"));
cbSummaryActualListVo.setTaxInclusiveExpenseTotal(total.get("taxInclusiveExpenseTotal"));
});
return resultList;
}
}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.dsk.cscec.mapper.CbSummaryActualLockMapper">
<resultMap type="com.dsk.cscec.domain.CbSummaryActualLock" id="CbSummaryActualLockMap">
<result property="id" column="id" jdbcType="INTEGER"/>
<result property="projectId" column="project_id" jdbcType="INTEGER"/>
<result property="expenseDate" column="expense_date" jdbcType="VARCHAR"/>
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
<result property="delFlag" column="del_flag" jdbcType="INTEGER"/>
</resultMap>
<sql id="baseColumn">
id, project_id, expense_date, create_time, del_flag
</sql>
<select id="getLockedList" resultType="java.lang.String">
select csal.expense_date
from cb_summary_actual_lock csal
where
csal.project_id = #{bo.projectId}
and csal.cb_type = #{bo.cbType}
and csal.del_flag = 0
order by csal.expense_date desc
</select>
</mapper>
......@@ -8,13 +8,13 @@
<result property="taxInclusiveExpense" column="tax_inclusive_expense" jdbcType="NUMERIC"/>
<result property="taxExclusiveExpense" column="tax_exclusive_expense" jdbcType="NUMERIC"/>
<result property="expenseDate" column="expense_date" jdbcType="VARCHAR"/>
<result property="lockStatus" column="lock_status" jdbcType="INTEGER"/>
<!-- <result property="lockStatus" column="lock_status" jdbcType="INTEGER"/>-->
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
<result property="delFlag" column="del_flag" jdbcType="INTEGER"/>
</resultMap>
<sql id="baseColumn">
id, cb_summary_id, tax_inclusive_expense, tax_exclusive_expense, expense_date, lock_status, create_time, del_flag
id, cb_summary_id, tax_inclusive_expense, tax_exclusive_expense, expense_date, create_time, del_flag
</sql>
<insert id="insertOrUpdateBatch" keyProperty="id" useGeneratedKeys="true">
......@@ -27,5 +27,16 @@
cb_summary_id = values(cb_summary_id) , tax_inclusive_expense = values(tax_inclusive_expense) ,
tax_exclusive_expense = values(tax_exclusive_expense) , expense_date = values(expense_date)
</insert>
<select id="getTotal" resultType="map">
select ifnull(sum(csa.tax_inclusive_expense),0) taxInclusiveExpenseTotal,
ifnull(sum(csa.tax_exclusive_expense),0) taxExclusiveExpenseTotal
from cb_summary_actual csa
<where>
csa.cb_summary_id = #{cbSummaryId}
and csa.expense_date &lt;= #{expenseDate}
and csa.del_flag = 0
</where>
</select>
</mapper>
......@@ -50,15 +50,32 @@
</where>
</select>
<select id="getByIds" resultType="com.dsk.cscec.domain.vo.CbSummaryActualListVo">
select csu.*,csa.id actualId,csa.tax_inclusive_expense,csa.tax_exclusive_expense,csa.expense_date
from cb_summary csu
left join cb_summary_actual csa on csu.id = csa.cb_summary_id
<where>
csa.expense_date = #{expenseDate}
and csa.del_flag = 0
and csu.del_flag = 0
and csu.id in
<foreach collection="entities" item="entity" separator="," open="(" close=")">
#{entity.id}
</foreach>
</where>
</select>
<select id="getProjectAll" resultType="com.dsk.cscec.domain.vo.CbSummaryActualListVo">
select
<include refid="baseColumn"></include>,
csa.tax_inclusive_expense,csa.tax_exclusive_expense
csa.id actualId,csa.tax_inclusive_expense,csa.tax_exclusive_expense
from cb_summary csu
left join cb_summary_actual csa on csu.id = csa.cb_summary_id and csa.expense_date = #{expenseDate} AND csa.del_flag = 0
left join cb_summary_actual csa on csu.id = csa.cb_summary_id and csa.expense_date = #{bo.expenseDate} AND csa.del_flag = 0
<where>
csu.project_id = #{bo.id}
and csu.cb_stage = #{bo.cbStage}
csu.project_id = #{bo.projectId}
<if test="bo.cbStage != null">
and csu.cb_stage = #{bo.cbStage}
</if>
and csu.cb_type = #{bo.cbType}
and csu.del_flag = 0
and csu.level != 0
......@@ -69,30 +86,33 @@
<select id="getCostAccountAll" resultType="com.dsk.cscec.domain.vo.CbSummaryActualListVo">
select
<include refid="baseColumn"></include>,
csa.tax_inclusive_expense,csa.tax_exclusive_expense
csa.id actualId,csa.tax_inclusive_expense,csa.tax_exclusive_expense
from cb_summary csu
left join cb_summary_actual csa on csu.id = csa.cb_summary_id and csa.expense_date = #{expenseDate} AND csa.del_flag = 0
left join cb_summary_actual csa on csu.id = csa.cb_summary_id and csa.expense_date = #{bo.expenseDate} AND csa.del_flag = 0
<where>
csu.project_id = #{bo.projectId}
and csu.cb_stage = #{bo.cbStage}
<if test="bo.cbStage != null">
and csu.cb_stage = #{bo.cbStage}
</if>
and csu.cb_type = #{bo.cbType}
and csu.del_flag = 0
</where>
order by csu.sort
</select>
<select id="getExpenseDateList" resultType="string">
select csa.expense_date
<select id="getExpenseDateList" resultType="map">
select csa.expense_date expenseDate,
if(csal.id is null,0,1) as isLock
from cb_summary_actual csa
left join cb_summary csu on csu.id = csa.cb_summary_id
left join cb_summary_actual_lock csal on csal.project_id = csu.project_id and csal.expense_date = csa.expense_date and csal.del_flag = 0
where
csu.project_id = #{bo.projectId}
and csu.cb_stage = #{bo.cbStage}
and csu.cb_type = #{bo.cbType}
and csu.del_flag = 0
and csa.del_flag = 0
group by csa.expense_date
order by csa.expense_date asc
order by csa.expense_date desc
</select>
<select id="selectByLevel" resultType="map">
......
......@@ -15,6 +15,22 @@ export function addProject (data) {
data:data,
})
}
//修改项目
export function editProjectInfo (data) {
return request({
url: '/cbProjectRecord/editProjectInfo',
method: 'PUT',
data:data,
})
}
//新增新阶段项目
export function addNewStageProject (data) {
return request({
url: '/cbProjectRecord/addNewStageProject',
method: 'POST',
data:data,
})
}
//获取当前项目文件上传
export function getProjectFileUploadDetail (projectId) {
return request({
......@@ -30,3 +46,35 @@ export function getDraftDialogList (projectId) {
method: 'get',
})
}
//上传文件
export function uploadCbProjectFile (data) {
return request({
url: '/cbProjectFile/uploadCbProjectFile',
method: 'post',
data
})
}
//删除文件
export function deleteCbProjectFile (fileId) {
return request({
url: '/cbProjectFile/deleteCbProjectFile/'+fileId,
method: 'Delete',
})
}
//删除草稿
export function deleteDraft (projectId) {
return request({
url: '/cbProjectRecord/deleteDraft/'+projectId,
method: 'Delete',
})
}
//查询当前项目可删除成本阶段
export function getProjectCbStageNotDraft (relatedId) {
return request({
url: '/cbProjectRecord/getProjectCbStageNotDraft/'+relatedId,
method: 'get',
})
}
......@@ -16,12 +16,12 @@
<el-input v-model="formdata.customerName" placeholder="请输入IPM项目编码" clearable></el-input>
</el-form-item>
<el-form-item label="成本阶段">
<el-select v-model="formdata.customerClass" multiple placeholder="请选择" :collapse-tags="true" clearable>
<el-select v-model="formdata.customerClass" placeholder="请选择" :collapse-tags="true" clearable>
<el-option v-for="(item,index) in cbStagelist" :label="item.dictLabel" :value="item.dictValue" :key="index"></el-option>
</el-select>
</el-form-item>
<el-form-item label="项目状态">
<el-select v-model="formdata.customerClass" multiple placeholder="请选择" :collapse-tags="true" clearable>
<el-select v-model="formdata.customerClass" placeholder="请选择" :collapse-tags="true" clearable>
<el-option v-for="(item,index) in ztStagelist" :label="item.dictLabel" :value="item.dictValue" :key="index"></el-option>
</el-select>
</el-form-item>
......@@ -64,19 +64,19 @@
<el-table-column label="工程名称" width="416" :resizable="false">
<template slot-scope="scope">
<div style="display:flex;align-items:center">
<el-tooltip placement="top" v-if="scope.row.customerText.length>20">
<div slot="content">{{scope.row.customerText}}</div>
<div class="renling">
<router-link v-if="scope.row.companyId" :to="`/enterprise/${encodeStr(scope.row.companyId)}?path=cooperationRecord&companyName=${scope.row.customerName}`" tag="a"
class="wordprimary" v-html="scope.row.customerName"></router-link>
<span v-else v-html="scope.row.customerName"></span>
</div>
</el-tooltip>
<div class="renling" v-else>
<router-link v-if="scope.row.companyId" :to="`/enterprise/${encodeStr(scope.row.companyId)}?path=cooperationRecord&companyName=${scope.row.customerName}`" tag="a"
class="wordprimary" v-html="scope.row.customerName"></router-link>
<span v-else v-html="scope.row.customerName"></span>
</div>
<!--<el-tooltip placement="top" v-if="scope.row.customerText.length>20">-->
<!--<div slot="content">{{scope.row.customerText}}</div>-->
<!--<div class="renling">-->
<!--<router-link v-if="scope.row.companyId" :to="`/enterprise/${encodeStr(scope.row.companyId)}?path=cooperationRecord&companyName=${scope.row.customerName}`" tag="a"-->
<!--class="wordprimary" v-html="scope.row.customerName"></router-link>-->
<!--<span v-else v-html="scope.row.customerName"></span>-->
<!--</div>-->
<!--</el-tooltip>-->
<!--<div class="renling" v-else>-->
<!--<router-link v-if="scope.row.companyId" :to="`/enterprise/${encodeStr(scope.row.companyId)}?path=cooperationRecord&companyName=${scope.row.customerName}`" tag="a"-->
<!--class="wordprimary" v-html="scope.row.customerName"></router-link>-->
<!--<span v-else v-html="scope.row.customerName"></span>-->
<!--</div>-->
</div>
</template>
......@@ -107,9 +107,9 @@
</el-table-column>
<el-table-column label="操作" min-width="256" :resizable="false" fixed="right">
<template slot-scope="scope">
<span class="wordprimary tabs" @click="goAccess(scope.row)">修改项目信息</span>
<span class="wordprimary tabs" @click="goAssessment(scope.row)">查看导入进度</span>
<span class="worddel tabs" @click="goDisposal(scope.row)">删除</span>
<span class="wordprimary tabs" @click="editpro(scope.row)">修改项目信息</span>
<span class="wordprimary tabs" @click="detailpro(scope.row)">查看导入进度</span>
<span class="worddel tabs" @click="deleetpro(scope.row)">删除</span>
</template>
</el-table-column>
</el-table>
......@@ -121,6 +121,24 @@
</el-pagination>
</div>
</div>
<el-dialog title="删除项目" :visible.sync="deletevisible" width="480px" custom-class='dialog-supplier'>
<el-divider></el-divider>
<div class="protypes">
<div class="ck" v-if="typenum>1">项目台账共有3个阶段</div>
<div class="ck" v-else>是否删除此项目?删除后无法返回。</div>
<div class="ck"><el-checkbox :indeterminate="indeterminate" v-model="checkAll" @change="handleCheckAllChange">删除全部</el-checkbox></div>
<el-checkbox-group v-model="checkds" @change="handleCheck">
<div class="ck" v-for="(item,index) in allchecks">
<el-checkbox :key="index" :label="item.label">{{item.text}}</el-checkbox>
</div>
</el-checkbox-group>
</div>
<el-divider></el-divider>
<div style="padding: 16px 20px 24px;text-align: right">
<el-button size="small" @click="deletevisible = false">取消</el-button>
<el-button type="primary" size="small" @click="getDelete">确定删除</el-button>
</div>
</el-dialog>
<el-dialog
class="pro-news"
:visible.sync="dialogVisible"
......@@ -141,19 +159,22 @@
<el-input type="text" placeholder="请输入文件名称" v-model="queryParam.projectFileName"></el-input>
</el-form-item>
<el-form-item label="成本阶段" class="row" prop="cbStage">
<el-select placeholder="请选择成本阶段" v-model="queryParam.cbStage">
<el-checkbox v-model="ischeck" v-if="isedit" class="checkcb"></el-checkbox>
<el-select placeholder="请选择成本阶段" v-model="queryParam.cbStage" :disabled="!ischeck">
<el-option v-for="(item,index) in cbStagelist" :label="item.dictLabel" :value="item.dictValue" :key="index"></el-option>
</el-select>
</el-form-item>
</el-form >
<div class="popbot">
<div class="btn btn_cancel h32" @click="dialogVisible = false">取消</div>
<div class="btn btn_primary h32" @click="insertPro" :class="{'btn_disabled':!queryParam.cbStage}" :disabled="!queryParam.cbStage">下一步,导入数据</div>
<div class="btn btn_primary h32" v-if="isedit && !ischeck" @click="savepro">保存</div>
<div class="btn btn_primary h32" v-if="isedit && ischeck" @click="changepro">下一步,导入数据</div>
<div class="btn btn_primary h32" v-if="!isedit && !ischeck" @click="insertPro" :class="{'btn_disabled':!queryParam.cbStage}" :disabled="!queryParam.cbStage">下一步,导入数据</div>
</div>
</el-dialog>
</div>
<proupload v-if="isupload" :uploadData=uploadData></proupload>
<proupload v-if="isupload" :uploadData="uploadData" :cbStagelist="cbStagelist" :prodetail="prodetail" @closeupload="colsepro"></proupload>
<el-dialog title="草稿箱" :visible.sync="cgxVisible" width="960px" custom-class='dialog-supplier'>
<el-divider></el-divider>
......@@ -176,7 +197,7 @@
</el-table-column>
<el-table-column label="成本阶段" width="105px">
<template slot-scope="scope">
<div v-for="item in cbStagelist">
<div v-for="(item,index) in cbStagelist" :key="index+11">
<span v-if="scope.row.cbStage == item.dictValue">{{item.dictLabel}}</span>
</div>
</template>
......@@ -189,14 +210,14 @@
<el-table-column label="操作">
<template slot-scope="scope">
<span class="wordprimary" @click="jxbj(scope.row)">继续编辑</span>
<span class="worddel">删除</span>
<span class="worddel" @click="deletecg(scope.row.id)">删除</span>
</template>
</el-table-column>
</el-table>
</div>
<div class="pagination clearfix" v-show="total>formdata.pageSize">
<el-pagination background :page-size="formdata.pageSize" :current-page.sync="formdata.pageNum"
@current-change="handleCurrentChange" layout="prev, pager, next"
<div class="pagination clearfix" v-show="total>cgPagesize">
<el-pagination background :page-size="cgPagesize" :current-page.sync="cgPagenum"
@current-change="getCGXlist" layout="prev, pager, next"
:total="cgxtotal">
</el-pagination>
</div>
......@@ -206,7 +227,14 @@
</template>
<script>
import '@/assets/styles/public.scss'
import { checkProjectCodeExist,addProject,getDraftDialogList } from '@/api/projectCostLedger/index'
import {
addNewStageProject,
addProject,
checkProjectCodeExist,
deleteDraft,
editProjectInfo,
getDraftDialogList,getProjectCbStageNotDraft
} from '@/api/projectCostLedger/index'
import { getDicts } from '@/api/system/dict/data'
import proupload from '@/views/projectCostLedger/upload/index'
import skeleton from '@/views/project/projectList/component/skeleton'
......@@ -216,6 +244,7 @@
components:{proupload,skeleton},
data() {
return {
typenum:2,
formdata:{},
isSkeleton:false,
total:10,
......@@ -235,12 +264,24 @@
cbStage:[{ required: true, message: '请选择成本阶段!', trigger: 'blur' },],
},
isupload:false,
tableData:[],
tableData:[{}],
cgxVisible:false,
cgxSkeleton:false,
cgxtotal:0,
cgxlist:[],
uploadData:{},//新增项目返回的数据
uploadData:{
cbStage:0,
},//新增项目返回的数据
cgPagesize:10,
cgPagenum:1,
prodetail:false,
isedit:false,//是否修改项目
ischeck:false,//是否可选
deletevisible:false,
indeterminate:false,//半选状态
checkAll:false,
checkds:[],
allchecks:[],//可以用的项目阶段
};
},
//可访问data属性
......@@ -256,6 +297,8 @@
})
//获取草稿箱
this.getCGXlist()
//获取列表
this.getlist()
},
//计算集
computed: {
......@@ -263,7 +306,79 @@
},
//方法集
methods: {
getlist(){
},
handleCheckAllChange(val){
this.checkAll = val
this.checkds = []
if(val == true){
this.allchecks.forEach(item=>{
this.checkds.push(item.label)
})
}
this.indeterminate = false
},
handleCheck(){
if(this.checkds.length == this.typenum){
this.checkAll = true
}else{
this.checkAll = false
}
this.indeterminate = this.checkds.length > 0 && this.checkds.length < this.typenum
},
//修改项目
editpro(row){
this.isedit = true
this.ischeck = false
this.prodetail = false
this.dialogVisible = true
this.queryParam = {}
this.queryParam = [...this.queryParam,...row]
this.protitle = '修改项目信息'
},
//查看进度
detailpro(row){
this.uploadData = row
this.uploadData.id = this.uploadData.projectId
this.prodetail = true
},
//删除项目
deleetpro(row){
this.deletevisible = true
this.prodetail = false
getProjectCbStageNotDraft(row.relatedId).then(res=>{
let list = res.data
let cb = this.cbStagelist
let datas = []
list.forEach(item =>{
cb.for(i=>{
if(item.dictValue == i){
let arr = {'label':i,'text':item.dictLabel}
datas.push(arr)
}
})
})
this.allchecks = datas
this.typenum = list.length
this.checkds = []
})
},
getDelete(){
// this.checkds 勾选了要删除的数据
this.getlist()
},
//返回列表
colsepro(){
this.isupload = false
this.getCGXlist()
this.getlist()
},
addPro(){
this.ischeck = true
this.isedit = false
this.dialogVisible = true
this.queryParam = {
projectName: '',//项目名称
......@@ -276,7 +391,8 @@
},
getSearch(){
this.formdata.pageNum = 1
// this.customerAll()
this.getlist()
},
getipmProjectNo(){
//点击且校验了当前编码有数据才获取
......@@ -315,10 +431,25 @@
}
})
},
//修改项目
savepro(){
editProjectInfo(JSON.stringify(this.queryParam)).then(res=>{
if(res.code == 200){
this.dialogVisible = false
this.getlist()
}
})
},
//修改阶段
changepro(){
addNewStageProject(JSON.parse(JSON.stringify(this.queryParam))).then(res=>{
this.uploadData = res.data
this.uploadData.id = this.uploadData.projectId
this.isupload = true
})
},
//继续编辑
jxbj(data){
console.log(this.cgxlist)
console.log(data)
this.uploadData = data
this.isupload = true
this.cgxVisible = false
......@@ -339,18 +470,47 @@
return "enterprise-name-row";
},
getcgx(){
this.getCGXlist()
this.cgxVisible = true
if(this.cgxtotal>0){
this.getCGXlist(1)
this.cgxVisible = true
}
},
getCGXlist(){
getCGXlist(page){
this.cgxSkeleton = true
getDraftDialogList().then(res=>{
this.cgxtotal = res.data.length
this.cgxlist = res.data
this.cgPagenum = page
let param = {
pageSize: this.cgPagesize,
pageNum: this.cgPagenum
}
getDraftDialogList(param).then(res=>{
this.cgxtotal = res.total
this.cgxlist = res.rows
this.cgPagenum = res.currentPage
this.cgxSkeleton = false
})
}
},
deletecg(id){
this.$confirm('是否确定删除此项目,删除后无法找回。', '提示', {
confirmButtonText: '确定删除',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
deleteDraft(id).then(res=>{
if(res.code == 200){
this.$message({
type: 'success',
message: '删除成功!'
});
this.getCGXlist(1)
}
})
}).catch(() => {
this.$message({
type: 'info',
message: '已取消删除'
});
});
},
},
}
</script>
......@@ -455,7 +615,10 @@
.row {
margin-bottom: 16px;
position: relative;
.checkcb{
position: absolute;
left: -100px;
}
.el-form-item__label {
font-weight: 400;
opacity: 0.8;
......@@ -575,8 +738,29 @@
padding: 0;
}
}
.wordprimary{
margin-left: 12px;
}
.worddel{
color: #FA5351;
padding-left: 12px;
cursor: pointer;
}
.pagination{
padding-top: 16px;
text-align: right;
}
.protypes{
padding: 24px 20px;
.ck{
margin-bottom: 12px;
height: 22px;
font-size: 14px;
color: rgba(35,35,35,0.8);
line-height: 22px;
&:last-child{
margin-bottom: 0;
}
}
}
</style>
<template>
<div class="project-cost-ledger-inner">
<el-upload
ref="uploadpro"
class="upload-demo"
:multiple="true"
accept=".xls,.xlsx"
action=""
drag
:auto-upload="false"
:on-change="handleFileListChange"
:headers="headers">
</el-upload>
<div class="pro-upload">
<div class="title_wrap i">
<div class="title-small"><span>项目成本台账 <i class="el-icon-arrow-right"></i> </span>导入项目</div>
......@@ -11,7 +23,7 @@
<el-form :model="formdata" label-width="82px" :rules="rules" label-position="right" :inline="true">
<el-row>
<el-form-item label="项目名称">
<el-input v-model="formdata.customerName" disabled placeholder="请输入工程名称" clearable></el-input>
<el-input v-model="formdata.projectName" disabled placeholder="请输入工程名称" clearable></el-input>
</el-form-item>
<el-form-item label="IPM项目编码" label-width="100px">
<el-input v-model="formdata.ipmProjectNo" disabled placeholder="请输入IPM项目编码" clearable></el-input>
......@@ -20,7 +32,7 @@
<el-input v-model="formdata.projectFileName" disabled placeholder="请输入文件名称" clearable></el-input>
</el-form-item>
<el-form-item label="成本阶段" prop="cbStage">
<el-select v-model="formdata.cbStage" disabled multiple placeholder="请选择" :collapse-tags="true"
<el-select v-model="formdata.cbStage" disabled placeholder="请选择" :collapse-tags="true"
clearable>
<el-option v-for="(item,index) in cbStagelist" :label="item.dictLabel" :value="item.dictValue"
:key="index"></el-option>
......@@ -39,152 +51,168 @@
<el-row>
<el-form-item label="直接费成本" prop="zjfcb">
<div class="filelist">
<div class="fileli">
<div class="fileli" v-for="(item,index) in directExpense">
<div>
<img src="../../../assets/images/icon_wrapper.png">
<div class="name">宝安中学(集团)初中部改扩建工程施工总承包(二次公告)-加固修缮工程.xls</div>
<div class="prostatus i1">解析成功</div>
<div class="cz">
<div>重新上传</div>
<div>删除</div>
<div class="name">{{item.fileName}}</div>
<template v-if="item.fileParseStatus">
<div class="prostatus i2" v-if="item.fileParseStatus == 1">解析中</div>
<div class="prostatus i1" v-if="item.fileParseStatus == 2">解析成功</div>
<div class="prostatus i3" v-if="item.fileParseStatus == 3">解析失败</div>
</template>
<div class="cz" v-if="item.fileParseStatus != 1">
<div v-if="item.fileParseStatus != 3"><a :href="item.fileOssUrl">下载</a></div>
<div v-if="item.fileParseStatus == 3 && prodetail == false">重新上传</div>
<div class="i" @click="deletefille(item.id)" v-if="prodetail == false">删除</div>
</div>
</div>
<div class="wrong">
失败原因:解析失败的原因展示
</div>
</div>
<div class="fileli">
<div>
<img src="../../../assets/images/icon_wrapper.png">
<div class="name">宝安中学(集团)初中部改扩建工程施工总承包(二次公告)-加固修缮工程.xls</div>
<div class="prostatus i2">解析中</div>
<div class="cz">
<div>重新上传</div>
<div>删除</div>
</div>
</div>
</div>
<div class="fileli">
<div>
<img src="../../../assets/images/icon_wrapper.png">
<div class="name">宝安中学(集团)初中部改扩建工程施工总承包(二次公告)-加固修缮工程.xls</div>
<div class="prostatus i3">解析失败</div>
<div class="cz">
<div>重新上传</div>
<div>删除</div>
</div>
<div class="wrong" v-if="item.fileParseStatus&&item.fileParseStatus == 3">
失败原因:{{item.failRemark||'--'}}
</div>
</div>
</div>
<div class="upload">
<el-upload
class="upload-demo"
action="https://jsonplaceholder.typicode.com/posts/"
:on-preview="handlePreview"
:on-remove="handleRemove"
:before-remove="beforeRemove"
multiple
:limit="3"
:on-exceed="handleExceed"
:file-list="fileList">
<el-button class="uploadpro"><img src="../../../assets/images/tips-plus.png">上传文件</el-button>
<!--<div slot="tip" class="el-upload__tip">只能上传jpg/png文件,且不超过500kb</div>-->
</el-upload>
<el-button class="uploadpro" @click="uplpro(0)"><img src="../../../assets/images/tips-plus.png">上传文件</el-button>
</div>
</el-form-item>
</el-row>
<el-row>
<el-form-item label="工料汇总" prop="glhz">
<div class="filelist">
<div class="fileli" v-for="(item,index) in quantitySummary">
<div>
<img src="../../../assets/images/icon_wrapper.png">
<div class="name">{{item.fileName}}</div>
<template v-if="item.fileParseStatus">
<div class="prostatus i2" v-if="item.fileParseStatus == 1">解析中</div>
<div class="prostatus i1" v-if="item.fileParseStatus == 2">解析成功</div>
<div class="prostatus i3" v-if="item.fileParseStatus == 3">解析失败</div>
</template>
<div class="cz" v-if="item.fileParseStatus != 1">
<div v-if="item.fileParseStatus != 3"><a :href="item.fileOssUrl">下载</a></div>
<div v-if="item.fileParseStatus == 3 && prodetail == false">重新上传</div>
<div class="i" @click="deletefille(item.id)" v-if="prodetail == false">删除</div>
</div>
</div>
<div class="wrong" v-if="item.fileParseStatus&&item.fileParseStatus == 3">
失败原因:{{item.failRemark||'--'}}
</div>
</div>
</div>
<div class="upload">
<el-upload
class="upload-demo"
action="https://jsonplaceholder.typicode.com/posts/"
:on-preview="handlePreview"
:on-remove="handleRemove"
:before-remove="beforeRemove"
multiple
:limit="3"
:on-exceed="handleExceed"
:file-list="fileList">
<el-button class="uploadpro"><img src="../../../assets/images/tips-plus.png">上传文件</el-button>
<!--<div slot="tip" class="el-upload__tip">只能上传jpg/png文件,且不超过500kb</div>-->
</el-upload>
<el-button class="uploadpro" @click="uplpro(1)"><img src="../../../assets/images/tips-plus.png">上传文件</el-button>
</div>
</el-form-item>
</el-row>
<el-row>
<el-form-item label="措施项目" prop="csxm">
<div class="filelist">
<div class="fileli" v-for="(item,index) in measureProject">
<div>
<img src="../../../assets/images/icon_wrapper.png">
<div class="name">{{item.fileName}}</div>
<template v-if="item.fileParseStatus">
<div class="prostatus i2" v-if="item.fileParseStatus == 1">解析中</div>
<div class="prostatus i1" v-if="item.fileParseStatus == 2">解析成功</div>
<div class="prostatus i3" v-if="item.fileParseStatus == 3">解析失败</div>
</template>
<div class="cz" v-if="item.fileParseStatus != 1">
<div v-if="item.fileParseStatus != 3"><a :href="item.fileOssUrl">下载</a></div>
<div v-if="item.fileParseStatus == 3 && prodetail == false">重新上传</div>
<div class="i" @click="deletefille(item.id)" v-if="prodetail == false">删除</div>
</div>
</div>
<div class="wrong" v-if="item.fileParseStatus&&item.fileParseStatus == 3">
失败原因:{{item.failRemark||'--'}}
</div>
</div>
</div>
<div class="upload">
<el-upload
class="upload-demo"
action="https://jsonplaceholder.typicode.com/posts/"
:on-preview="handlePreview"
:on-remove="handleRemove"
:before-remove="beforeRemove"
multiple
:limit="3"
:on-exceed="handleExceed"
:file-list="fileList">
<el-button class="uploadpro"><img src="../../../assets/images/tips-plus.png">上传文件</el-button>
<!--<div slot="tip" class="el-upload__tip">只能上传jpg/png文件,且不超过500kb</div>-->
</el-upload>
<el-button class="uploadpro" @click="uplpro(2)"><img src="../../../assets/images/tips-plus.png">上传文件</el-button>
</div>
</el-form-item>
</el-row>
<el-row>
<el-form-item label="其他项目" prop="qtxm">
<div class="filelist">
<div class="fileli" v-for="(item,index) in otherProject">
<div>
<img src="../../../assets/images/icon_wrapper.png">
<div class="name">{{item.fileName}}</div>
<template v-if="item.fileParseStatus">
<div class="prostatus i2" v-if="item.fileParseStatus == 1">解析中</div>
<div class="prostatus i1" v-if="item.fileParseStatus == 2">解析成功</div>
<div class="prostatus i3" v-if="item.fileParseStatus == 3">解析失败</div>
</template>
<div class="cz" v-if="item.fileParseStatus != 1">
<div v-if="item.fileParseStatus != 3"><a :href="item.fileOssUrl">下载</a></div>
<div v-if="item.fileParseStatus == 3 && prodetail == false">重新上传</div>
<div class="i" @click="deletefille(item.id)" v-if="prodetail == false">删除</div>
</div>
</div>
<div class="wrong" v-if="item.fileParseStatus&&item.fileParseStatus == 3">
失败原因:{{item.failRemark||'--'}}
</div>
</div>
</div>
<div class="upload">
<el-upload
class="upload-demo"
action="https://jsonplaceholder.typicode.com/posts/"
:on-preview="handlePreview"
:on-remove="handleRemove"
:before-remove="beforeRemove"
multiple
:limit="3"
:on-exceed="handleExceed"
:file-list="fileList">
<el-button class="uploadpro"><img src="../../../assets/images/tips-plus.png">上传文件</el-button>
<!--<div slot="tip" class="el-upload__tip">只能上传jpg/png文件,且不超过500kb</div>-->
</el-upload>
<el-button class="uploadpro" @click="uplpro(3)"><img src="../../../assets/images/tips-plus.png">上传文件</el-button>
</div>
</el-form-item>
</el-row>
<el-row>
<el-form-item label="现场经费" prop="xcjf">
<div class="filelist">
<div class="fileli" v-for="(item,index) in sceneExpense">
<div>
<img src="../../../assets/images/icon_wrapper.png">
<div class="name">{{item.fileName}}</div>
<template v-if="item.fileParseStatus">
<div class="prostatus i2" v-if="item.fileParseStatus == 1">解析中</div>
<div class="prostatus i1" v-if="item.fileParseStatus == 2">解析成功</div>
<div class="prostatus i3" v-if="item.fileParseStatus == 3">解析失败</div>
</template>
<div class="cz" v-if="item.fileParseStatus != 1">
<div v-if="item.fileParseStatus != 3"><a :href="item.fileOssUrl">下载</a></div>
<div v-if="item.fileParseStatus == 3 && prodetail == false">重新上传</div>
<div class="i" @click="deletefille(item.id)" v-if="prodetail == false">删除</div>
</div>
</div>
<div class="wrong" v-if="item.fileParseStatus&&item.fileParseStatus == 3">
失败原因:{{item.failRemark||'--'}}
</div>
</div>
</div>
<div class="upload">
<el-upload
class="upload-demo"
action="https://jsonplaceholder.typicode.com/posts/"
:on-preview="handlePreview"
:on-remove="handleRemove"
:before-remove="beforeRemove"
multiple
:limit="3"
:on-exceed="handleExceed"
:file-list="fileList">
<el-button class="uploadpro"><img src="../../../assets/images/tips-plus.png">上传文件</el-button>
<!--<div slot="tip" class="el-upload__tip">只能上传jpg/png文件,且不超过500kb</div>-->
</el-upload>
<el-button class="uploadpro" @click="uplpro(4)"><img src="../../../assets/images/tips-plus.png">上传文件</el-button>
</div>
</el-form-item>
</el-row>
<el-row>
<el-form-item label="成本汇总" prop="cbhz">
<div class="filelist">
<div class="fileli" v-for="(item,index) in cbSummary">
<div>
<img src="../../../assets/images/icon_wrapper.png">
<div class="name">{{item.fileName}}</div>
<template v-if="item.fileParseStatus">
<div class="prostatus i2" v-if="item.fileParseStatus == 1">解析中</div>
<div class="prostatus i1" v-if="item.fileParseStatus == 2">解析成功</div>
<div class="prostatus i3" v-if="item.fileParseStatus == 3">解析失败</div>
</template>
<div class="cz" v-if="item.fileParseStatus != 1">
<div v-if="item.fileParseStatus != 3"><a :href="item.fileOssUrl">下载</a></div>
<div v-if="item.fileParseStatus == 3 && prodetail == false">重新上传</div>
<div class="i" @click="deletefille(item.id)" v-if="prodetail == false">删除</div>
</div>
</div>
<div class="wrong" v-if="item.fileParseStatus&&item.fileParseStatus == 3">
失败原因:{{item.failRemark||'--'}}
</div>
</div>
</div>
<div class="upload">
<el-upload
class="upload-demo"
action="https://jsonplaceholder.typicode.com/posts/"
:on-preview="handlePreview"
:on-remove="handleRemove"
:before-remove="beforeRemove"
multiple
:limit="3"
:on-exceed="handleExceed"
:file-list="fileList">
<el-button class="uploadpro"><img src="../../../assets/images/tips-plus.png">上传文件</el-button>
<!--<div slot="tip" class="el-upload__tip">只能上传jpg/png文件,且不超过500kb</div>-->
</el-upload>
<el-button class="uploadpro" @click="uplpro(5)"><img src="../../../assets/images/tips-plus.png">上传文件</el-button>
</div>
</el-form-item>
</el-row>
......@@ -193,7 +221,7 @@
<el-divider></el-divider>
<div class="pro-btns">
<el-button type="primary" size="small" >导入数据</el-button>
<el-button size="small">返回</el-button>
<el-button size="small" @click="goback">返回</el-button>
</div>
</div>
......@@ -201,18 +229,25 @@
</template>
<script>
import { getDicts } from '@/api/system/dict/data'
import { getProjectFileUploadDetail } from '@/api/projectCostLedger/index'
import { getToken } from '@/utils/auth'
// import { getDicts } from '@/api/system/dict/data'
import { deleteCbProjectFile, getProjectFileUploadDetail, uploadCbProjectFile } from '@/api/projectCostLedger/index'
export default {
name: 'upload',
props:{uploadData:null},
props: {
uploadData: Object,
cbStagelist: Array,
prodetail: Boolean,//是否是查看 true 不可编辑 false 可编辑
},
data(){
return{
formdata:{
cbStage:null,
cbStage:"",
},
headers: {
Authorization: "Bearer " + getToken(),
},
cbStagelist:[],
rules:{
cbStage:[{ required: true, message: '请选择成本阶段!', trigger: 'blur' },],
},
......@@ -225,57 +260,127 @@
xcjf:[{ required: true, trigger: 'blur' },],
cbhz:[{ required: true, trigger: 'blur' },],
},
fileList:[],
//各个类型数据集
directExpense:[],
quantitySummary:[],
measureProject:[],
otherProject:[],
sceneExpense:[],
cbSummary:[],
uploadtype:0,//上传的版块类型
}
},
created() {
//成本阶段
getDicts('pro_cbstage').then(res => {
this.cbStagelist = res.data
})
getProjectFileUploadDetail(this.uploadData.id).then(res=>{
if(res.code == 200){
if(res.data){
this.directExpense=res.data.directExpense
this.quantitySummary=res.data.quantitySummary
this.measureProject=res.data.measureProject
this.otherProject=res.data.otherProject
this.sceneExpense=res.data.sceneExpense
this.cbSummary=res.data.cbSummary
}else{
this.directExpense=[]
this.quantitySummary=[]
this.measureProject=[]
this.otherProject=[]
this.sceneExpense=[]
this.cbSummary=[]
}
}
})
this.formdata = this.uploadData
console.log(this.uploadData)
this.formdata = JSON.parse(JSON.stringify(this.uploadData))
this.formdata.cbStage = this.formdata.cbStage.toString()
this.getDetail()
},
methods:{
handleRemove(file, fileList) {
console.log(file, fileList);
goback(){
this.$emit('closeupload')
},
handlePreview(file) {
console.log(file);
getDetail(){
this.directExpense=[]
this.quantitySummary=[]
this.measureProject=[]
this.otherProject=[]
this.sceneExpense=[]
this.cbSummary=[]
getProjectFileUploadDetail(this.uploadData.id).then(res=>{
if(res.code == 200){
if(res.data){
this.directExpense = [...this.directExpense,...res.data.directExpense]
this.quantitySummary = [...this.quantitySummary,...res.data.quantitySummary]
this.measureProject = [...this.measureProject,...res.data.measureProject]
this.otherProject = [...this.otherProject,...res.data.otherProject]
this.sceneExpense = [...this.sceneExpense,...res.data.sceneExpense]
this.cbSummary = [...this.cbSummary,...res.data.cbSummary]
}
}
})
},
handleExceed(files, fileList) {
this.$message.warning(`当前限制选择 3 个文件,本次选择了 ${files.length} 个文件,共选择了 ${files.length + fileList.length} 个文件`);
uplpro(type){
if(!this.prodetail){
this.uploadtype = type
this.$refs.uploadpro.$el.querySelector('input').click()
}
},
deletefille(id){
this.$confirm('此操作将永久删除该文件, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
deleteCbProjectFile(id).then(res=>{
if(res.code == 200){
this.$message({
type: 'success',
message: '删除成功!'
});
this.getDetail()
}
})
}).catch(() => {
this.$message({
type: 'info',
message: '已取消删除'
});
});
},
handleFileListChange(file, fileList) {
var testmsg = file.name.substring(file.name.lastIndexOf(".") + 1);
const extension = testmsg === "xlsx";
const extension1 = testmsg === "xls";
if (!extension && !extension1 ) {
this.$message({
message: "上传文件只能是.xls,.xlsx格式!",
type: "warning",
});
return false;
}
const isLt2M = file.size / 1024 / 1024 < 10
if (!isLt2M) {
this.$refs.upload.clearFiles()
this.$message({
message: '上传文件大小不能超过 10MB!',
type: 'warning'
})
return false
}
const formdata = new FormData()
formdata.append("file",new File([file.raw],encodeURIComponent(file.name)))
formdata.append("projectId",this.formdata.id)
formdata.append("cbType",this.uploadtype)
uploadCbProjectFile(formdata).then(res=>{
if(res.code == 200){
let data = res.data
data.id = data.fileId
switch (this.uploadtype) {
case 0:
this.directExpense.push(data)
break;
case 1:
this.quantitySummary.push(data)
break;
case 2:
this.measureProject.push(data)
break;
case 3:
this.otherProject.push(data)
break;
case 4:
this.sceneExpense.push(data)
break;
case 5:
this.cbSummary.push(data)
break;
default:
break
}
}
})
},
beforeRemove(file, fileList) {
return this.$confirm(`确定移除 ${ file.name }?`);
}
}
}
</script>
......@@ -389,7 +494,7 @@
margin-left: 12px;
color: #0081FF;
display: inline-block;
&:last-child{
&.i{
color: #FF3C3C;
}
}
......@@ -445,5 +550,9 @@
margin-left: 12px;
}
}
.upload-demo{
opacity: 0;
position: absolute;
z-index: -9999;
}
</style>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment