Commit 6a66d8d6 authored by Administrator's avatar Administrator

Merge remote-tracking branch 'origin/V20231129-中建一局二公司' into V20231129-中建一局二公司

parents 9efe0df4 6e4c71a9
......@@ -54,7 +54,7 @@ public class DataAnalysisComponent {
if (ObjectUtils.isEmpty(fileList)) return;
//文件处理
for (CbProjectFile file : fileList) {
if (file.getDelFlag() == 0) {
// if (file.getDelFlag() == 0) {
//文件下载
InputStream inputStream = ossService.downFileIO(file.getFileOssId());
......@@ -80,7 +80,7 @@ public class DataAnalysisComponent {
item.setCbProjectFileId(file.getId());
}).collect(Collectors.toList());
if (quantitySummaryList.isEmpty()) {
throw new ServiceException("表格中不存在有效数据数据!");
throw new ServiceException("表格中不存在有效数据!");
}
transactionTemplate.execute(status -> {
try {
......@@ -115,10 +115,10 @@ public class DataAnalysisComponent {
}
return Boolean.TRUE;
});
} else {
quantitySummaryService.remove(Wrappers.<CbQuantitySummary>lambdaQuery().eq(CbQuantitySummary::getCbProjectFileId, file.getId()));
projectFileService.removeById(file);
}
// } else {
// quantitySummaryService.remove(Wrappers.<CbQuantitySummary>lambdaQuery().eq(CbQuantitySummary::getCbProjectFileId, file.getId()));
// projectFileService.removeById(file);
// }
}
}
}
package com.dsk.cscec.controller;
import com.dsk.common.core.controller.BaseController;
import com.dsk.common.core.domain.R;
import com.dsk.common.helper.LoginHelper;
import com.dsk.cscec.domain.CbProjectExpenseSummary;
import com.dsk.cscec.service.CbProjectExpenseSummaryService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import javax.validation.constraints.NotNull;
import java.util.List;
import java.util.Objects;
/**
* 项目费用汇总表(CbProjectExpenseSummary)表控制层
*
* @author sxk
* @since 2024-02-22 09:59:28
*/
@RestController
@RequestMapping("CbProjectExpenseSummary")
public class CbProjectExpenseSummaryController extends BaseController {
/**
* 服务对象
*/
@Resource
private CbProjectExpenseSummaryService baseService;
/**
* 现场经费汇总数据解析
*/
@GetMapping("/parseCbSceneExpenseData/{projectId}")
public R<Void> parseCbSceneExpenseData(@PathVariable Long projectId) throws Exception {
String username = Objects.requireNonNull(LoginHelper.getLoginUser()).getUsername();
baseService.parseSceneExpenseSummaryData(projectId, 1, username);
return R.ok();
}
/**
* 获取现场经费汇总数据
*/
@GetMapping("/getCbSceneExpenseSummaryData/{projectId}")
public R<List<CbProjectExpenseSummary>> getCbSceneExpenseSummaryData(@NotNull(message = "项目ID不能为空") @PathVariable Long projectId) {
return R.ok(baseService.getCbSceneExpenseSummaryData(projectId));
}
}
......@@ -7,6 +7,7 @@ import com.dsk.common.core.domain.R;
import com.dsk.common.core.page.TableDataInfo;
import com.dsk.cscec.domain.CbProjectRecord;
import com.dsk.cscec.domain.bo.*;
import com.dsk.cscec.domain.vo.CbProjectCbStageNotDraftVo;
import com.dsk.cscec.domain.vo.CbProjectRecordSearchVo;
import com.dsk.cscec.service.CbProjectRecordService;
import com.dsk.cscec.service.IDProjectService;
......@@ -108,7 +109,7 @@ public class CbProjectRecordController extends BaseController {
* 即查询当前项目非草稿的成本阶段
*/
@GetMapping("/getProjectCbStageNotDraft/{relatedId}")
public R<List<Integer>> getProjectCbStageNotDraft(@PathVariable Long relatedId) {
public R<List<CbProjectCbStageNotDraftVo>> getProjectCbStageNotDraft(@PathVariable Long relatedId) {
return R.ok(baseService.getProjectCbStageNotDraft(relatedId));
}
......
package com.dsk.cscec.domain;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.util.Date;
import com.baomidou.mybatisplus.annotation.*;
import com.dsk.common.annotation.Excel;
import lombok.Data;
import java.util.Date;
/**
* 项目费用汇总表
*/
* 项目费用汇总表
*/
@Data
@TableName(value = "cb_project_expense_summary")
public class CbProjectExpenseSummary {
......@@ -25,6 +24,11 @@ public class CbProjectExpenseSummary {
@TableField(value = "project_id")
private Long projectId;
/**
* 项目文件ID
*/
private Long projectFileId;
/**
* 成本阶段(0:标前成本、1:标后成本、2:转固成本)
*/
......@@ -34,11 +38,11 @@ public class CbProjectExpenseSummary {
/**
* 序号
*/
@TableField(value = "`number`")
@TableField(value = "number")
private String number;
/**
* 数据类型(0:现场经费、1:其他费用)
* 数据类型(2:措施项目、3:其他项目、4:现场经费)
*/
@TableField(value = "data_type")
private Integer dataType;
......@@ -47,24 +51,28 @@ public class CbProjectExpenseSummary {
* 名称
*/
@TableField(value = "expense_name")
@Excel(name = "名称")
private String expenseName;
/**
* 数值
*/
@TableField(value = "expense_value")
@Excel(name = "数值")
private String expenseValue;
/**
* 占比
*/
@TableField(value = "proportion")
@Excel(name = "占比")
private String proportion;
/**
* 删除状态(0:否、2:是)
*/
@TableField(value = "del_flag")
@TableLogic(value = "0", delval = "2")
private Integer delFlag;
/**
......
package com.dsk.cscec.domain.vo;
import lombok.Data;
/**
* @author sxk
* @date 2024.02.26
* @time 15:27
*/
@Data
public class CbProjectCbStageNotDraftVo {
/**
* 项目ID
*/
private Long id;
/**
* 成本阶段(0:标前成本、1:标后成本、2:转固成本)
*/
private Integer cbStage;
}
......@@ -2,6 +2,7 @@ package com.dsk.cscec.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.dsk.cscec.domain.CbProjectFile;
import com.dsk.cscec.domain.vo.CbSceneExpenseMenuVo;
import org.apache.ibatis.annotations.Param;
import java.util.List;
......@@ -13,8 +14,18 @@ import java.util.List;
* @since 2024-02-05 14:01:03
*/
public interface CbProjectFileMapper extends BaseMapper<CbProjectFile> {
/**
* 获取现场经费菜单
*
* @param projectId 项目ID
* @return 该项目在项目文件表中所有解析完成的现场经费文件名
*/
List<CbSceneExpenseMenuVo> getSceneExpenseMenuFromFile(@Param("projectId") Long projectId,
@Param("deleteFlagExist") Integer deleteFlagExist,
@Param("cbTypeSceneExpense") Integer cbTypeSceneExpense,
@Param("projectFileStatusParseSuccess") Integer projectFileStatusParseSuccess);
List<CbProjectFile> selectAnalysisList(@Param("projectId") Long projectId,@Param("cbType") Integer cbType,@Param("cbStage") Integer cbStage);
List<CbProjectFile> selectAnalysisList(@Param("projectId") Long projectId, @Param("cbType") Integer cbType, @Param("cbStage") Integer cbStage);
int removeById(@Param("id") Long id);
}
......
package com.dsk.cscec.service;
import com.dsk.cscec.domain.CbProjectExpenseSummary;
import com.baomidou.mybatisplus.extension.service.IService;
public interface CbProjectExpenseSummaryService extends IService<CbProjectExpenseSummary>{
import com.dsk.cscec.domain.CbProjectExpenseSummary;
import java.util.List;
public interface CbProjectExpenseSummaryService extends IService<CbProjectExpenseSummary> {
/**
* 现场经费汇总数据解析
*
* @param projectId 项目ID
* @param cbStage 成本阶段
* @param username 用户名
*/
void parseSceneExpenseSummaryData(Long projectId, Integer cbStage,String username) throws Exception;
/**
* 获取现场经费汇总数据
*
* @param projectId 项目ID
* @return 现场经费汇总数据
*/
List<CbProjectExpenseSummary> getCbSceneExpenseSummaryData(Long projectId);
}
......@@ -5,6 +5,7 @@ import com.dsk.common.core.domain.PageQuery;
import com.dsk.common.core.page.TableDataInfo;
import com.dsk.cscec.domain.CbProjectRecord;
import com.dsk.cscec.domain.bo.*;
import com.dsk.cscec.domain.vo.CbProjectCbStageNotDraftVo;
import com.dsk.cscec.domain.vo.CbProjectRecordSearchVo;
import java.util.List;
......@@ -78,7 +79,7 @@ public interface CbProjectRecordService extends IService<CbProjectRecord> {
* @param relatedId 关联ID
* @return 已有数据的成本阶段
*/
List<Integer> getProjectCbStageNotDraft(Long relatedId);
List<CbProjectCbStageNotDraftVo> getProjectCbStageNotDraft(Long relatedId);
/**
* 批量删除项目
......
package com.dsk.cscec.service.impl;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
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.excel.ExcelUtils;
import com.dsk.common.utils.StringUtils;
import com.dsk.cscec.constant.CbProjectConstants;
import com.dsk.cscec.domain.CbProjectExpenseSummary;
import com.dsk.cscec.domain.CbProjectFile;
import com.dsk.cscec.domain.CbProjectRecord;
import com.dsk.cscec.mapper.CbProjectExpenseSummaryMapper;
import com.dsk.cscec.mapper.CbProjectFileMapper;
import com.dsk.cscec.mapper.CbProjectRecordMapper;
import com.dsk.cscec.service.CbProjectExpenseSummaryService;
import com.dsk.system.service.ISysOssService;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import org.springframework.transaction.support.TransactionTemplate;
import javax.annotation.Resource;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;
@Service
public class CbProjectExpenseSummaryServiceImpl extends ServiceImpl<CbProjectExpenseSummaryMapper, CbProjectExpenseSummary> implements CbProjectExpenseSummaryService{
public class CbProjectExpenseSummaryServiceImpl extends ServiceImpl<CbProjectExpenseSummaryMapper, CbProjectExpenseSummary> implements CbProjectExpenseSummaryService {
@Resource
private CbProjectExpenseSummaryMapper baseMapper;
@Resource
private CbProjectRecordMapper projectRecordMapper;
@Resource
private CbProjectFileMapper projectFileMapper;
@Resource
private ISysOssService ossService;
@Resource
private TransactionTemplate transactionTemplate;
/**
* 现场经费汇总数据解析
*
* @param projectId 项目ID
* @param cbStage 成本阶段
* @param username 用户名
*/
@Override
@Async
public void parseSceneExpenseSummaryData(Long projectId, Integer cbStage, String username) throws Exception {
//查找该项目下所有相关文件
List<CbProjectFile> projectFileList = projectFileMapper.selectAnalysisList(projectId, CbProjectConstants.CB_TYPE_SCENE_EXPENSE, cbStage);
//待解析文件
List<CbProjectFile> waitParseList = new ArrayList<>();
//提取现场经费汇总文件,原则上该文件仅有1个
projectFileList.forEach(projectFile -> {
if (CbProjectConstants.CB_TYPE_SCENE_EXPENSE_NAME.equals(projectFile.getFileName().substring(0, projectFile.getFileName().lastIndexOf(".")))) {
//待解析文件
waitParseList.add(projectFile);
}
});
//处理待解析文件
for (CbProjectFile projectFile : waitParseList) {
if (ObjectUtil.isNull(projectFile)) {
continue;
}
//文件下载
InputStream inputStream = ossService.downFileIO(projectFile.getFileOssId());
if (ObjectUtil.isNull(inputStream)) {
projectFile.setFileParseStatus(CbProjectConstants.PROJECT_FILE_STATUS_PARSE_FAIL);
projectFile.setFailRemark("文件数据不存在");
projectFileMapper.updateById(projectFile);
continue;
}
//解析数据
List<CbProjectExpenseSummary> importList = new ExcelUtils<>(CbProjectExpenseSummary.class).importExcelAllSheet(inputStream, 0);
if (importList.isEmpty()) {
projectFile.setFileParseStatus(CbProjectConstants.PROJECT_FILE_STATUS_PARSE_FAIL);
projectFile.setFailRemark("表格中不存在待导入数据!");
projectFileMapper.updateById(projectFile);
continue;
}
//筛选有效数据
List<CbProjectExpenseSummary> summaryList = importList.stream().parallel()
//筛选名称列不为空数据
.filter(item -> StringUtils.isNotBlank(item.getExpenseName()))
.peek(item -> {
item.setProjectId(projectId);
item.setProjectFileId(projectFile.getId());
item.setCbStage(projectFile.getCbStage());
item.setDataType(CbProjectConstants.CB_TYPE_SCENE_EXPENSE);
item.setCreateBy(username);
item.setCreateTime(new Date());
})
.collect(Collectors.toList());
if (summaryList.size() != importList.size()) {
projectFile.setFileParseStatus(CbProjectConstants.PROJECT_FILE_STATUS_PARSE_FAIL);
projectFile.setFailRemark("表格中存在\"名称\"列为空数据!");
projectFileMapper.updateById(projectFile);
continue;
}
transactionTemplate.execute(status -> {
try {
//批量插入数据
CbProjectExpenseSummaryServiceImpl impl = new CbProjectExpenseSummaryServiceImpl();
Assert.isTrue(impl.saveBatch(summaryList), "数据插入失败");
//更新文件状态
projectFile.setFileParseStatus(CbProjectConstants.PROJECT_FILE_STATUS_PARSE_SUCCESS);
Assert.isTrue(projectFileMapper.updateById(projectFile) > 0, "解析成功后文件状态更新失败");
} catch (Exception e) {
status.setRollbackOnly();
projectFile.setFileParseStatus(CbProjectConstants.PROJECT_FILE_STATUS_PARSE_FAIL);
projectFile.setFailRemark(e.getMessage());
projectFileMapper.updateById(projectFile);
}
return Boolean.TRUE;
});
}
}
/**
* 获取现场经费汇总数据
*
* @param projectId 项目ID
* @return 现场经费汇总数据
*/
@Override
public List<CbProjectExpenseSummary> getCbSceneExpenseSummaryData(Long projectId) {
//校验项目是否存在
this.checkProjectExist(projectId);
return baseMapper.selectList(new LambdaQueryWrapper<CbProjectExpenseSummary>()
.eq(CbProjectExpenseSummary::getProjectId, projectId)
.eq(CbProjectExpenseSummary::getDataType, CbProjectConstants.CB_TYPE_SCENE_EXPENSE));
}
/**
* 校验项目是否存在
*
* @param projectId 项目ID
* @return 项目实体
*/
private CbProjectRecord checkProjectExist(Long projectId) {
CbProjectRecord projectRecord = projectRecordMapper.selectById(projectId);
Assert.notNull(projectRecord, "该项目不存在");
return projectRecord;
}
}
......@@ -18,6 +18,7 @@ import com.dsk.cscec.constant.CbProjectConstants;
import com.dsk.cscec.domain.CbProjectFile;
import com.dsk.cscec.domain.CbProjectRecord;
import com.dsk.cscec.domain.bo.*;
import com.dsk.cscec.domain.vo.CbProjectCbStageNotDraftVo;
import com.dsk.cscec.domain.vo.CbProjectRecordSearchVo;
import com.dsk.cscec.mapper.CbProjectFileMapper;
import com.dsk.cscec.mapper.CbProjectRecordMapper;
......@@ -126,14 +127,13 @@ public class CbProjectRecordServiceImpl extends ServiceImpl<CbProjectRecordMappe
//工料汇总
CbProjectBaseBo projectBaseBo = new CbProjectBaseBo();
projectBaseBo.setProjectId(projectId);
projectBaseBo.setCbStage(cbStage);
dataAnalysisComponent.quantitySummaryDataAnalysis(projectBaseBo);
//措施项目
//其他项目
projectOtherService.projectOtherDataAnalysis(projectBaseBo);
//现场经费
projectExpenseSummaryService.parseSceneExpenseData(projectId,cbStage,username);
projectExpenseSummaryService.parseSceneExpenseSummaryData(projectId, cbStage, username);
//成本汇总
cbSummaryService.importCbSummary(projectId);
}
......@@ -308,11 +308,11 @@ public class CbProjectRecordServiceImpl extends ServiceImpl<CbProjectRecordMappe
* @return 已有数据的成本阶段
*/
@Override
public List<Integer> getProjectCbStageNotDraft(Long relatedId) {
public List<CbProjectCbStageNotDraftVo> getProjectCbStageNotDraft(Long relatedId) {
//通过关联ID校验项目是否存在
List<CbProjectRecord> projectRecordList = this.checkRelatedIdExist(relatedId);
ArrayList<Integer> cbStageList = new ArrayList<>();
ArrayList<CbProjectCbStageNotDraftVo> cbStageList = new ArrayList<>();
projectRecordList.forEach(projectRecord -> {
//文件状态为解析成功or解析失败即为有数据
......@@ -323,7 +323,7 @@ public class CbProjectRecordServiceImpl extends ServiceImpl<CbProjectRecordMappe
.eq(CbProjectFile::getFileParseStatus, CbProjectConstants.PROJECT_FILE_STATUS_PARSE_SUCCESS)
.or()
.eq(CbProjectFile::getFileParseStatus, CbProjectConstants.PROJECT_FILE_STATUS_PARSE_FAIL))) {
cbStageList.add(projectRecord.getCbStage());
cbStageList.add(BeanUtil.toBean(projectRecord, CbProjectCbStageNotDraftVo.class));
}
});
return cbStageList;
......
<?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.CbProjectFileMapper">
<!--获取现场经费菜单-->
<select id="getSceneExpenseMenuFromFile" resultType="com.dsk.cscec.domain.vo.CbSceneExpenseMenuVo">
select cpf.id as fileId,
cpf.file_name as menuName
from cb_project_file cpf
where cpf.project_id = #{projectId}
and cpf.del_flag = #{deleteFlagExist}
and cpf.cb_type = #{cbTypeSceneExpense}
and cpf.file_parse_status = #{projectFileStatusParseSuccess};
</select>
<select id="selectAnalysisList" resultType="com.dsk.cscec.domain.CbProjectFile">
SELECT
id, project_id, cb_stage, cb_type, file_name, file_oss_id, file_oss_url, file_parse_status, fail_remark,
del_flag, create_by, create_time, update_by, update_time
id, project_id, cb_stage, cb_type, file_name, file_oss_id, file_oss_url, file_parse_status, fail_remark,
del_flag, create_by, create_time, update_by, update_time
FROM cb_project_file
WHERE ((del_flag = 0 and file_parse_status in (1,3)) or del_flag = 1)
WHERE (del_flag = 0 and file_parse_status in (1,3)
and project_id=#{projectId}
<if test="cbStage != null">
and cb_stage =#{cbStage}
</if>
and cb_type = #{cbType}
and cb_type = #{cbType})
</select>
<update id="removeById">
......
......@@ -3,8 +3,42 @@
<mapper namespace="com.dsk.cscec.mapper.CbProjectRecordMapper">
<!--获取项目台账列表-->
<select id="selectPageProjectRecordList" resultType="com.dsk.cscec.domain.vo.CbProjectRecordSearchVo">
select
cpr.id,
<!-- select-->
<!-- cpr.id,-->
<!-- cpr.related_id,-->
<!-- cpr.project_name,-->
<!-- cpr.cb_stage,-->
<!-- cpr.project_file_status,-->
<!-- cpr.ipm_project_no,-->
<!-- cpr.is_get_project_detail,-->
<!-- cpr.project_file_name,-->
<!-- cpr.create_time-->
<!-- from cb_project_record cpr-->
<!-- left join cb_project_record cprr-->
<!-- on cpr.related_id = cprr.related_id-->
<!-- and cpr.cb_stage &lt; cprr.cb_stage-->
<!-- where-->
<!-- cprr.cb_stage is null-->
<!-- and-->
<!-- cpr.del_flag=#{deleteFlagExist}-->
<!-- <if test="searchBo.projectName != null and searchBo.projectName != ''">-->
<!-- and cpr.project_name like concat('%',#{searchBo.projectName},'%')-->
<!-- </if>-->
<!-- <if test="searchBo.ipmProjectNo != null and searchBo.ipmProjectNo != ''">-->
<!-- and cpr.ipm_project_no = #{searchBo.ipmProjectNo}-->
<!-- </if>-->
<!-- <if test="searchBo.cbStage != null">-->
<!-- and cpr.cb_stage = #{searchBo.cbStage}-->
<!-- </if>-->
<!-- <if test="searchBo.projectFileStatus != null">-->
<!-- and project_file_status = #{searchBo.projectFileStatus}-->
<!-- </if>-->
<!-- and-->
<!-- cpr.project_file_status != #{projectFileStatusPreparing}-->
<!-- order by cpr.create_time desc-->
select a.*
from (
select DISTINCT cpr.id,
cpr.related_id,
cpr.project_name,
cpr.cb_stage,
......@@ -14,13 +48,7 @@
cpr.project_file_name,
cpr.create_time
from cb_project_record cpr
left join cb_project_record cprr
on cpr.related_id = cprr.related_id
and cpr.cb_stage &lt; cprr.cb_stage
where
cprr.cb_stage is null
and
cpr.del_flag=#{deleteFlagExist}
where cpr.del_flag=#{deleteFlagExist}
<if test="searchBo.projectName != null and searchBo.projectName != ''">
and cpr.project_name like concat('%',#{searchBo.projectName},'%')
</if>
......@@ -35,7 +63,9 @@
</if>
and
cpr.project_file_status != #{projectFileStatusPreparing}
order by cpr.create_time desc
order by cpr.cb_stage desc) a
group by a.related_id
order by a.create_time desc
</select>
<!--获取草稿弹窗列表-->
......
......@@ -2,8 +2,8 @@ import request from '@/utils/request';
/**
* 获取项目详情
* @param {*} params
* @returns
* @param {*} params
* @returns
*/
export const getProjectDetailApi = (params = {}) => request({
url: "",
......@@ -34,6 +34,13 @@ export function editProjectInfo(data) {
data: data,
});
}
//删除项目
export function batchDeleteProject(ids) {
return request({
url: '/cbProjectRecord/batchDeleteProject/'+ids,
method: 'Delete',
});
}
//新增新阶段项目
export function addNewStageProject(data) {
return request({
......@@ -90,12 +97,29 @@ export function getProjectCbStageNotDraft(relatedId) {
});
}
//查询当前项目可删除成本阶段
export function getProjectList(data) {
return request({
url: '/cbProjectRecord/getProjectList',
method: 'get',
params:data
});
}
//盈亏分析对比 左侧菜单
export const getProfitLossMenuTreeApi = (params = {}) => request({
url: "/cbSummary/cbNameList",
method: "get",
params
})
// 工料汇总
/**
* 获取供料汇总左侧菜单
* @param {*} params
* @returns
* @param {*} params
* @returns
*/
export const getFeedSummaryMenuTreeApi = (params = {}) => request({
url: "/cb/quantity/summary/subjectTree",
......
......@@ -1064,17 +1064,13 @@ export function findAncestors(data, targetId, idKey = "id", childrenKey = "child
export function addTreeLevel(tree, startLevel = 1, removeEmptyChildren = true) {
if (tree instanceof Array && tree?.length) {
tree.forEach(node => {
addTreeLevel(node, startLevel, removeEmptyChildren);
node["level"] = startLevel;
if (node?.children) {
addTreeLevel(node.children, startLevel + 1, removeEmptyChildren);
removeEmptyChildren && !node.children?.length ? delete node.children : null;
}
});
} else if (Object.prototype.toString.call(tree) == "[object Object]") {
tree["level"] = startLevel;
if (tree?.children) {
addTreeLevel(tree.children, startLevel + 1, removeEmptyChildren);
removeEmptyChildren && !tree.children?.length ? delete tree.children : null;
}
}
return tree;
}
......@@ -1086,15 +1082,11 @@ export function addTreeLevel(tree, startLevel = 1, removeEmptyChildren = true) {
export function addNodeParent(tree, parent = null) {
if (tree instanceof Array && tree?.length) {
tree.forEach(node => {
addNodeParent(node, parent);
node["parent"] = parent ? parent : JSON.parse(JSON.stringify(parent));
if (node.children instanceof Array && node.children.length) {
addNodeParent(node.children, node);
}
});
} else if (Object.prototype.toString.call(tree) == "[object Object]") {
tree["parent"] = JSON.parse(JSON.stringify(parent));
if (tree?.children?.length) {
addNodeParent(tree.children, tree);
}
}
return tree;
}
\ No newline at end of file
<template>
<div class="otherProjects-container">
<div class="otherProjects-cont">
<div class="left">
<div class="left-menu">
</div>
</div>
<!--<div class="right-table">-->
<!--<div class="table-item">-->
<!--<tables-->
<!--v-if="!isSkeleton"-->
<!--:tableLoading="tableLoading"-->
<!--:tableData="tableData"-->
<!--:forData="forData1"-->
<!--:MaxPage=500-->
<!--:tableDataTotal="tableDataTotal"-->
<!--:queryParams="queryParams"-->
<!--@handle-current-change="handleCurrentChange"-->
<!--@sort-change="sortChange"-->
<!--&gt;-->
<!--<template slot="number" slot-scope="scope">-->
<!--<div>{{scope.row.number || '&#45;&#45;'}}</div>-->
<!--</template>-->
<!--<template slot="proportion" slot-scope="scope">-->
<!--<div>{{scope.row.proportion || '&#45;&#45;'}}{{scope.row.proportion ? '%':''}}</div>-->
<!--</template>-->
<!--</tables>-->
<!--</div>-->
<!--</div>-->
</div>
</div>
</template>
<script>
import Tables from "../../../../component/Tables"
import {getProfitLossMenuTreeApi} from '@/api/projectCostLedger/index'
export default {
name: "ProfitLoss",
props:{
// 项目ID
projectId: {
type: String,
required: true,
default: ""
},
// // 详情信息
// projectDetailInfo: {
// type: Object,
// default: () => ({})
// }
},
watch: {
// projectDetailInfo: {
// handler(newValue) {
// this.comProjectDetailInfo = newValue ? newValue : {};
// this.init(this.comProjectDetailInfo);
// },
// deep: true,
// immediate: true
// },
// projectId: {
// handler(newValue) {
// this.comProjectId = newValue;
// },
// immediate: true
// }
},
components: {
Tables,
},
data() {
return {
menuOptions: {
nodeName: "name",
nodeValue: "name",
},
comProjectDetailInfo: {},
comProjectId: "",
defaultActive: "",
menuTreeList: [
// {
// nodeName: "房建类成本科目",
// id: "1",
// children: [
// {
// nodeName: "劳务分包工程",
// id: "1-1",
// children: [
// {
// nodeName: "主体工程-结构劳务",
// id: "1-1-1",
// children: [
// {
// nodeName: "结构劳务分包",
// id: "1-1-1-1",
// }
// ]
// },
// {
// nodeName: "二次结构及粗装修劳务",
// id: "1-2-1",
// children: [
// {
// nodeName: "二次机构及粗装修劳务",
// id: "1-2-1",
// }
// ]
// },
// {
// nodeName: "拆除、修缮、清理、改造劳...",
// id: "1-3-1",
// children: [
// {
// nodeName: "拆除、修缮、清理、改造劳...",
// id: "1-3-1",
// }
// ]
// }
// ]
// },
// {
// nodeName: "专业分包工程",
// id: "2-1",
// },
// {
// nodeName: "实体工程材料(土建)",
// id: "3-1",
// },
// {
// nodeName: "其他直接费成本",
// id: "4-1",
// },
// ]
// },
// {
// nodeName: "未归类项目",
// id: "2",
// children: []
// }
]
}
},
//可访问data属性
created() {
console.log(this.projectId)
this.init()
},
//计算集
computed: {
},
async init(detail = {}) {
let cbStage = 1
try {
const { projectId, cbStage } = detail;
if (!projectId) return;
await this.getProfitLossMenuTree({
projectId,
cbStage
});
} catch (error) {
}
},
async getProfitLossMenuTree(params) {
try {
const result = await getProfitLossMenuTreeApi(params);
if (result.code == 200) {
const _tempArray = result.data;
this.menuTreeList = _tempArray;
}
} catch (error) {
}
},
}
</script>
<style lang="scss" scoped>
.otherProjects-container {
width: 100%;
box-sizing: border-box;
background: #ffffff;
height: 100%;
align-items: center;
.otherProjects-cont{
display: flex;
width: 100%;
height: 100%;
}
.left{
width: 220px;
height: 100%;
.left-menu{
width: 100%;
height: 100%;
border-right: 1px solid #eeeeee;
overflow: auto;
}
white-space: nowrap; /* 不换行 */
overflow: hidden; /* 超出部分隐藏 */
text-overflow: ellipsis; /* 显示省略号 */
}
.right-table{
width: calc(100% - 220px);
padding: 16px;
}
}
</style>
......@@ -120,12 +120,11 @@ export default {
// 合并默认配置
const _options = this.mergeMenuOptions(JSON.parse(JSON.stringify(this.menuOptions)));
this.tempMenuOptions = _options;
console.log(this.tempMenuOptions);
// 映射配置
// const resultData = this.mapDataByMenuOptions(JSON.parse(JSON.stringify(this.comMenuTree)), _options);
// if (resultData) {
// this.tempMenuTree = resultData;
// }
const resultData = this.mapDataByMenuOptions(JSON.parse(JSON.stringify(this.comMenuTree)), _options);
if (resultData) {
this.tempMenuTree = resultData;
}
}
},
mergeMenuOptions(options) {
......@@ -188,6 +187,7 @@ export default {
// 添加层级
const levelResult = addTreeLevel(mapedData);
const parentResult = addNodeParent(levelResult);
console.log(parentResult);
return parentResult;
}
}
......
......@@ -20,6 +20,9 @@
<!-- 其他项目 -->
<other-projects v-if="current == 'otherItems'"></other-projects>
<!-- 盈亏分析对比 -->
<profit-Loss v-if="current == 'profitAndLoss'" :project-id="projectID"></profit-Loss>
</div>
</div>
</div>
......@@ -35,6 +38,8 @@ import DirectCost from "@/views/projectCostLedger/detail/components/DirectCost";
import FeedSummary from "@/views/projectCostLedger/detail/components/FeedSummary";
// 其他项目
import OtherProjects from "@/views/projectCostLedger/detail/components/OtherProjects";
// 盈亏分析对比
import ProfitLoss from "@/views/projectCostLedger/detail/components/ProfitLoss";
import { v4 } from "uuid";
import { cloneDeep } from "lodash-es";
import { getProjectDetailApi } from "@/api/projectCostLedger";
......@@ -46,7 +51,8 @@ export default {
FeedSummary,
EngineeringInformation,
DirectCost,
OtherProjects
OtherProjects,
ProfitLoss
},
data() {
return {
......
......@@ -47,7 +47,7 @@
</div>
</div>
<div class="upload-project">
<el-form :model="uploaddata" label-width="200px" :rules="uprules" label-position="right" :inline="true">
<el-form :model="uploaddata" label-width="200px" :rules="uprules" ref="ruleForm" label-position="right" :inline="true" :show-message="false">
<el-row>
<el-form-item label="直接费成本" prop="zjfcb">
<div class="filelist">
......@@ -220,11 +220,23 @@
</div>
<el-divider></el-divider>
<div class="pro-btns">
<el-button type="primary" size="small" >导入数据</el-button>
<el-button type="primary" size="small" @click="importdata">导入数据</el-button>
<el-button size="small" @click="goback">返回</el-button>
</div>
</div>
<el-dialog title="提示" :visible.sync="visible" width="480px" custom-class='dialog-supplier'>
<el-divider></el-divider>
<div class="protypes">
<div class="ck" v-if="issub">解析成本数据过程需3~10分钟,稍后可到项目列表查看导入结果。</div>
<div class="ck" v-else>请将各阶段成本数据全部上传后,再次点击导入数据按钮。</div>
</div>
<el-divider></el-divider>
<div style="padding: 16px 20px 24px;text-align: right">
<el-button type="primary" size="small" @click="goback" v-if="issub">返回项目列表</el-button>
<el-button type="primary" size="small" @click="visible = false" v-else>我知道了</el-button>
</div>
</el-dialog>
</div>
</template>
......@@ -269,6 +281,8 @@
sceneExpense:[],
cbSummary:[],
uploadtype:0,//上传的版块类型
visible:false,
issub:false,//已填完数据可以开始解析
}
},
created() {
......@@ -277,7 +291,18 @@
this.getDetail()
},
methods:{
importdata(){
this.visible = true
this.$refs['ruleForm'].validate((valid) => {
if (valid) {
this.issub = true
} else {
this.issub = false
}
});
},
goback(){
this.visible = false
this.$emit('closeupload')
},
getDetail(){
......@@ -386,6 +411,17 @@
</script>
<style scoped lang="scss">
.protypes{
padding: 24px 20px;
height: 120px;
.ck {
margin-bottom: 12px;
height: 22px;
font-size: 14px;
color: rgba(35, 35, 35, 0.8);
line-height: 22px;
}
}
.title-small{
font-size: 12px;
line-height: 24px;
......
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