Commit f9e9329c authored by tanyang's avatar tanyang

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

parents eed7b175 df73e992
......@@ -69,19 +69,20 @@ public class CbSummaryActualListVo extends BaseEntity {
/**
* 本月费用(含税)
*/
private BigDecimal taxInclusiveExpense;
private Double taxInclusiveExpense;
/**
* 本月费用(不含税)
*/
private BigDecimal taxExclusiveExpense;
private Double taxExclusiveExpense;
/**
* 截至本月费用(含税)
*/
private BigDecimal taxInclusiveExpenseTotal;
private Double taxInclusiveExpenseTotal;
/**
* 截至本月费用(不含税)
*/
private BigDecimal taxExclusiveExpenseTotal;
private Double taxExclusiveExpenseTotal;
/**
* 费用日期
*/
......
......@@ -331,15 +331,15 @@ public class CbSummaryServiceImpl extends ServiceImpl<CbSummaryMapper, CbSummary
}
//截至本月费用汇总
Map<String, BigDecimal> parentTotal = cbSummaryActualMapper.getTotal(cbSummaryActualListVo.getId(), bo.getExpenseDate());
cbSummaryActualListVo.setTaxExclusiveExpenseTotal(parentTotal.get("taxExclusiveExpenseTotal"));
cbSummaryActualListVo.setTaxInclusiveExpenseTotal(parentTotal.get("taxInclusiveExpenseTotal"));
cbSummaryActualListVo.setTaxExclusiveExpenseTotal(parentTotal.get("taxExclusiveExpenseTotal").doubleValue());
cbSummaryActualListVo.setTaxInclusiveExpenseTotal(parentTotal.get("taxInclusiveExpenseTotal").doubleValue());
List<CbSummaryActualListVo> childrenList = baseMapper.getByParentId(bo.getId(), bo.getExpenseDate());
//截至本月费用汇总
childrenList.parallelStream().forEach(children -> {
Map<String, BigDecimal> total = cbSummaryActualMapper.getTotal(children.getId(), bo.getExpenseDate());
children.setTaxExclusiveExpenseTotal(total.get("taxExclusiveExpenseTotal"));
children.setTaxInclusiveExpenseTotal(total.get("taxInclusiveExpenseTotal"));
children.setTaxExclusiveExpenseTotal(total.get("taxExclusiveExpenseTotal").doubleValue());
children.setTaxInclusiveExpenseTotal(total.get("taxInclusiveExpenseTotal").doubleValue());
});
if (CollectionUtil.isNotEmpty(childrenList)) {
cbSummaryActualListVo.setHasChildren(1);
......@@ -391,8 +391,8 @@ public class CbSummaryServiceImpl extends ServiceImpl<CbSummaryMapper, CbSummary
children.setChildren(getProjectSumList(childBo));
//截至本月费用汇总
Map<String, BigDecimal> total = cbSummaryActualMapper.getTotal(children.getId(), bo.getExpenseDate());
children.setTaxExclusiveExpenseTotal(total.get("taxExclusiveExpenseTotal"));
children.setTaxInclusiveExpenseTotal(total.get("taxInclusiveExpenseTotal"));
children.setTaxExclusiveExpenseTotal(total.get("taxExclusiveExpenseTotal").doubleValue());
children.setTaxInclusiveExpenseTotal(total.get("taxInclusiveExpenseTotal").doubleValue());
});
return childrenList;
......@@ -533,8 +533,8 @@ public class CbSummaryServiceImpl extends ServiceImpl<CbSummaryMapper, CbSummary
//截至本月费用汇总
resultList.forEach(cbSummaryActualListVo -> {
Map<String, BigDecimal> total = cbSummaryActualMapper.getTotal(cbSummaryActualListVo.getId(), bo.getExpenseDate());
cbSummaryActualListVo.setTaxExclusiveExpenseTotal(total.get("taxExclusiveExpenseTotal"));
cbSummaryActualListVo.setTaxInclusiveExpenseTotal(total.get("taxInclusiveExpenseTotal"));
cbSummaryActualListVo.setTaxExclusiveExpenseTotal(total.get("taxExclusiveExpenseTotal").doubleValue());
cbSummaryActualListVo.setTaxInclusiveExpenseTotal(total.get("taxInclusiveExpenseTotal").doubleValue());
});
return resultList;
}
......
......@@ -377,3 +377,40 @@ export const getFieldExpensesOtherListApi = (params = {}) => request({
method: "get",
params
});
// 成本汇总
/**
* 成本汇总左侧一级菜单
* @param {*} params
* @returns
*/
export const getCostSummaryMenuTreeApi = (params = {}) => request({
url: "/cbSummary/cbNameList",
method: "get",
params
});
/**
* 成本汇总已添加成本月份
* @param {*} params
* @returns
*/
export const getCostSummaryMonthListApi = (params = {}) => request({
url: "/cbSummary/expenseDateList",
method: "get",
params
});
/**
* 获取成本汇总数据列表
* @param {*} params
* @returns
*/
export const getCostSummaryListApi = (params = {}) => request({
url: "/cbSummary/list",
method: "get",
params
});
......@@ -360,7 +360,7 @@ li {
}
.is-scrolling-left + .el-table__fixed,
.is-scrolling-middle + .el-table__fixed,
.is-scrolling-right + .el-table__fixed,.el-table__fixed-right {
.is-scrolling-right + .el-table__fixed {
box-shadow: 2px 0 8px -7px #202020;
height: auto !important;
bottom: 16px !important;
......@@ -374,14 +374,14 @@ li {
.el-table__body-wrapper {
&::-webkit-scrollbar {
width: 16px; //竖轴宽度
height: 6px; //横轴宽度
height: 16px; //横轴宽度
}
&::-webkit-scrollbar-track {
background-color: #f3f4f5;
border-radius: 0;
}
&::-webkit-scrollbar-thumb {
background: rgba(0,0,0,.2);
background-color: rgba(0,0,0,.2);
border: 4px solid #f3f4f5;
border-radius: 10px;
}
......@@ -438,7 +438,7 @@ li {
}
}
.el-scrollbar {
height: 6px;
height: 16px;
.el-scrollbar__bar.is-horizontal {
height: 8px;
}
......@@ -529,7 +529,7 @@ li {
border-radius: 0;
}
&::-webkit-scrollbar-thumb {
background: rgba(0,0,0,.2);
background-color: rgba(0,0,0,.2);
border: 4px solid #f3f4f5;
border-radius: 10px;
}
......@@ -553,7 +553,6 @@ li {
background: #dcebff;
}
.el-table__fixed {
//bottom:0 !important;
.el-table__body {
padding-bottom: 16px;
}
......@@ -582,7 +581,7 @@ li {
background: rgba(0,0,0,.2);
border: 4px solid #f3f4f5;
&:hover {
background: #7d7d7d;
// background: #7d7d7d;
}
}
.el-scrollbar {
......@@ -687,7 +686,7 @@ li {
border-radius: 0;
}
&::-webkit-scrollbar-thumb {
background: rgba(0,0,0,.2);
background-color: rgba(0,0,0,.2);
border: 4px solid #f3f4f5;
border-radius: 10px;
}
......@@ -978,3 +977,109 @@ li {
.el-tooltip__popper {
max-width: 70%;
}
//表格样式
.meafixed-table{
width: 100%;
padding: 16px 0;
.el-table {
width: 100%;
height: 100%;
font-size: 14px;
color: #232323;
.el-table-horizontal-scrollbar{
display: none !important;
}
.el-table__fixed-right-patch{
background: rgb(240, 243, 250);
}
th {
height: 40px;
padding: 9px 0px;
}
td {
padding: 9px 0px;
.cell {
color: #232323;
}
}
.cell {
padding-right: 12px;
padding-left: 12px;
line-height: 21px;
font-size: 14px;
font-weight: 400;
}
thead {
color: rgba(35, 35, 35, 0.7);
}
.is-scrolling-left + .el-table__fixed,
.is-scrolling-middle + .el-table__fixed,
.is-scrolling-right + .el-table__fixed {
box-shadow: 2px 0 8px -7px #202020;
height: auto !important;
bottom: 16px !important;
}
.el-table__body tr.current-row > td.el-table__cell {
background: none;
}
.el-table__body-wrapper {
&::-webkit-scrollbar {
width: 16px; //竖轴宽度
height: 16px; //横轴宽度
}
&::-webkit-scrollbar-track {
background-color: #f3f4f5;
border-radius: 0;
}
&::-webkit-scrollbar-thumb {
background-color: rgba(0,0,0,.2);
border: 4px solid #f3f4f5;
border-radius: 10px;
&:hover{
background: rgb(125,125,125);
}
}
&::-webkit-scrollbar-corner {
background: #f3f4f5;
/*border-left: 1px solid #E0EAF2;*/
}
tr {
&.current-row > td {
background-color: initial;
}
&:nth-child(2n) {
background: #f8fbff;
}
}
tr:hover > td.el-table__cell {
background: #dcebff;
}
}
.el-table__body tr.hover-row > td.el-table__cell {
background: #dcebff;
}
.el-table__fixed,.el-table__fixed-right {
bottom:16px !important;
.el-table__body {
padding-bottom: 16px;
}
tr:nth-child(2n) {
background-color: #f8fbff;
}
}
.el-scrollbar {
height: 16px;
.el-scrollbar__bar.is-horizontal {
height: 8px;
}
.el-scrollbar__thumb {
background: rgba(0,0,0,.2);
&:hover {
background: #7d7d7d;
}
}
}
}
}
<template>
<div class="table-list-com-ins"
<div class="custom-table-list-com-ins"
:class="{'is-empty-table' : !tableDataTotal,'no-pagination' : !hasQueryParams,'auto-max-height' : maxHeight,'has-y-Scroll' : maxHeight && hasYScroll}"
:style="maxBodyFixedStyle">
<div class="table-item">
<el-table v-if="tableDataTotal>0" class="custom-table" v-loading="tableLoading" :data="tableData" element-loading-text="Loading"
<div class="custom-table-item">
<el-table v-if="tableDataTotal>0" class="custom-table" v-loading="comTableLoading" :data="tableData" element-loading-text="加载中"
ref="customTableRef" border fit highlight-current-row :default-sort="defaultSort?defaultSort:{}" @sort-change="sortChange"
@selection-change="selectionChange" :cell-class-name="cellClassName" :cell-style="cellStyle" :row-class-name="rowClassName"
:row-style="rowStyle" :height="height" :maxHeight="comMaxHeight" v-sticky-header="stickyHeader">
<el-table-column type="selection" :width="needSelection.width ? needSelection.width : '38px'" v-if="needSelection.flag"
:fixed="needSelection.fixed" :align="needSelection.align" :show-overflow-tooltip="needSelection.showOverflowTooltip">
</el-table-column>
<el-table-column type="index" v-if="isIndex" label="序号" :width="flexWidth(tableData)" align="left" :fixed="indexFixed" :resizable="false">
<template slot-scope="scope">{{pagingHandler(hasQueryParams,queryParams,scope)}}</template>
</el-table-column>
@selection-change="selectionChange" @expand-change="expandChange" :cell-class-name="cellClassName" :cell-style="cellStyle"
:row-class-name="rowClassName" :row-style="rowStyle" :row-key="rowKey" :lazy="lazy" :load="loadFn" :tree-props="treeOptions"
:default-expand-all="defaultExpandAll" :indent="indent" :height="height" :maxHeight="comMaxHeight" v-sticky-header="stickyHeader">
<!-- 列二次封装 -->
<template v-for="(item,index) of formColum">
......@@ -57,20 +52,6 @@ export default {
maxHeight: {
type: [Boolean, Number]
},
isIndex: {
type: Boolean,
default: false
},
needSelection: {
type: Object,
default: () => ({
flag: false,
width: "39px",
fixed: false,
align: "left",
showOverflowTooltip: false
})
},
cellClassName: {
type: Function,
default: () => { }
......@@ -87,6 +68,39 @@ export default {
type: Function,
default: () => { }
},
rowKey: {
type: [String, Number],
default: "id"
},
// 是否树形结构懒加载
lazy: {
type: Boolean,
default: false
},
// 懒加载函数
loadFn: {
type: Function,
default: () => { }
},
// 懒加载配置字段映射
treeOptions: {
type: Object,
default: () => ({})
},
// 树形结构默认展开行
defaultExpandAll: {
type: Boolean,
default: false
},
// 树形结构展示事件
expandChange: {
type: Function,
default: () => { }
},
indent: {
type: Number,
default: 16
},
// 吸顶偏移量
stickyHeader: {
type: Object,
......@@ -147,7 +161,8 @@ export default {
headerLastBlockHeight: 0,
hasYScroll: false,
observer: null,
resizeTimer: null
resizeTimer: null,
comTableLoading: this.tableLoading
};
},
watch: {
......@@ -166,6 +181,11 @@ export default {
},
immediate: true,
deep: true
},
tableLoading: {
handler(newValue) {
this.comTableLoading = newValue;
}
}
},
computed: {
......@@ -300,10 +320,10 @@ export default {
</script>
<style lang="scss" scoped>
.table-list-com-ins {
.custom-table-list-com-ins {
/* 空数据样式 */
&.is-empty-table {
.table-item {
.custom-table-item {
max-height: unset;
height: 100%;
}
......@@ -312,7 +332,7 @@ export default {
/* maxHeight自适应样式 */
&.auto-max-height {
height: 100%;
::v-deep .table-item {
::v-deep .custom-table-item {
// 原滚动条为6px 现在多10px
.el-table {
/* 右侧fixed列 */
......@@ -350,7 +370,7 @@ export default {
// 是否存在Y轴滚动条
&.has-y-Scroll {
::v-deep .table-item {
::v-deep .custom-table-item {
.el-table {
/* 右侧fixed列 */
.el-table__fixed-right {
......@@ -366,12 +386,12 @@ export default {
/* 不需要分页 或没有分页参数 */
&.no-pagination {
::v-deep .table-item {
::v-deep .custom-table-item {
max-height: 100%;
}
}
::v-deep .table-item {
::v-deep .custom-table-item {
width: 100%;
max-height: calc(100% - 40px);
......@@ -428,6 +448,154 @@ export default {
}
.el-table {
width: 100%;
height: auto;
font-size: 14px;
color: #232323;
.cell {
padding-right: 12px;
padding-left: 12px;
line-height: 21px;
font-size: 12px;
font-weight: 400;
}
th {
height: 40px;
padding: 9px 0px;
.cell {
color: rgba(35, 35, 35, 0.8);
}
}
td {
padding: 9px 0px;
.cell {
color: #232323;
}
}
.sort-caret.ascending {
border-bottom-color: rgba(0, 129, 255, 0.5);
}
.ascending .sort-caret.ascending {
border-bottom-color: #0081ff;
}
.sort-caret.descending {
border-top-color: rgba(0, 129, 255, 0.5);
}
.descending .sort-caret.descending {
border-top-color: #0081ff;
}
.el-table__header-wrapper {
box-sizing: border-box;
th {
background: #f0f3fa;
}
}
.el-table__fixed-header-wrapper {
th {
background: #f0f3fa;
}
}
.el-table__body tr.current-row > td.el-table__cell {
background: none;
}
.caret-wrapper {
width: 10px;
}
.el-table__body-wrapper {
&::-webkit-scrollbar {
width: 16px; //竖轴宽度
height: 16px; //横轴宽度
}
&::-webkit-scrollbar-track {
background-color: #f3f4f5;
border-radius: 0;
}
&::-webkit-scrollbar-thumb {
background: rgba(0, 0, 0, 0.2);
border: 4px solid #f3f4f5;
border-radius: 10px;
}
&::-webkit-scrollbar-corner {
background: #f3f4f5;
}
tr {
&.current-row > td {
background-color: initial;
}
&:nth-child(2n) {
background: #f8fbff;
}
}
tr:hover > td.el-table__cell {
background: #dcebff;
}
}
.el-table__body tr.hover-row > td.el-table__cell {
background: #dcebff;
}
.el-table__fixed {
.el-table__body {
padding-bottom: 16px;
}
tr:nth-child(2n) {
background-color: #f8fbff;
}
}
::-webkit-scrollbar-track-piece {
//滚动条凹槽的颜色,还可以设置边框属性
background-color: #f3f4f5;
height: 16px;
padding: 0 4px;
}
//滚动条的宽度
::-webkit-scrollbar {
width: 8px;
height: 16px;
background-color: #f3f4f5;
border-radius: 6px;
}
//滚动条的滑块
::-webkit-scrollbar-thumb {
border-radius: 8px;
height: 8px;
margin: 0 4px;
background: rgba(0, 0, 0, 0.2);
border: 4px solid #f3f4f5;
&:hover {
background: #7d7d7d;
}
}
.el-scrollbar {
height: 16px;
.el-scrollbar__bar.is-horizontal {
height: 8px;
}
.el-scrollbar__thumb {
background: rgba(0, 0, 0, 0.2);
&:hover {
background: #566380;
}
}
}
&.custom-table {
.el-table__body-wrapper {
/* 滚动条在最左侧时 */
......
......@@ -72,5 +72,19 @@ export default {
height: calc(100%);
}
}
.title_wrap{
padding: 20px;
background-color: #FFFFFF;
border-bottom: 1px solid #e0e0e0;
}
.enterprise_title{
border-left: 2px solid #445781;
padding-left: 8px;
font-size: 16px;
height: 16px;
line-height: 16px;
font-weight: 700;
color: #232323;
}
}
</style>
......@@ -67,5 +67,19 @@ export default {
height: calc(100%);
}
}
.title_wrap{
padding: 20px;
background-color: #FFFFFF;
border-bottom: 1px solid #e0e0e0;
}
.enterprise_title{
border-left: 2px solid #445781;
padding-left: 8px;
font-size: 16px;
height: 16px;
line-height: 16px;
font-weight: 700;
color: #232323;
}
}
</style>
<template>
<div class="cost-summary-container">
<!-- 按项目汇总 成本汇总切换 -->
<div class="category-type-container">
<div class="category-list-item" v-for="(type,index) of categoryList" :key="type.value"
:class="{'is-current-category' : currentCategory == type.value}" @click.stop="currentCategoryChange(type.value)">{{type.label}}</div>
</div>
<!-- 成本菜单以及列表 -->
<div class="cost-summary-content-container">
<!-- 左侧菜单 -->
<div class="left-side-menu">
<project-side-menu ref="projectSideMenu" :menuTree="menuTreeList" :menuOptions="menuOptions" :unique-opened="false"
:default-active="currentNodeValue" @select="menuSelect">
<template slot="成本汇总-1">
<img src="@/assets/images/projectCostLedger/icon_cost_detail_8.svg" alt="">
<div class="project-sub-menu-title-text">成本汇总</div>
</template>
</project-side-menu>
</div>
<!-- 右侧列表 -->
<div class="right-table-list-container">
<div class="project-table-list-header">
<div class="project-table-list-haeder-left">
<el-select v-model="expenseDate" placeholder="请选择年月" class="project-month-select-options" clearable @change="monthChange">
<el-option v-for="item in monthList" :key="item.expenseDate" :label="item.label" :value="item.expenseDate">
</el-option>
</el-select>
</div>
<div class="project-table-list-haeder-right">
</div>
</div>
<!-- 数据列表部分 -->
<div class="project-feedsummary-list-container">
<dsk-skeleton v-if="tableLoading"></dsk-skeleton>
<el-form :model="dataForm" ref="costSummaryForm" :show-message="false" v-else-if="!tableLoading" class="feed-summary-form">
<custom-table ref="costSummaryTable" :tableData="dataForm.tableDataList" :formColum="formColum" :max-height="true" :row-key="rowKey"
:lazy="true" :load-fn="tableLazyLoad" :tree-options="treeOptions" :default-expand-all="false" :indent="8" :tableDataTotal="total"
:paging="false" :cell-class-name="cellClassName">
</custom-table>
</el-form>
</div>
</div>
</div>
</div>
</template>
<script>
import ProjectSideMenu from "@/views/projectCostLedger/detail/components/ProjectSideMenu";
import DskSkeleton from "@/components/DskSkeleton";
import CustomTable from "@/components/CustomTable";
import { getCostSummaryMenuTreeApi, getCostSummaryMonthListApi, getCostSummaryListApi } from "@/api/projectCostLedger";
import { v4 } from 'uuid';
import dayjs from "dayjs";
import { cloneDeep } from "lodash-es";
import { add } from "@/utils/decimal";
// 可编辑字段
const editPropNames = [
"taxInclusiveExpense",
"taxExclusiveExpense",
];
export default {
name: "costSummary",
props: {
// 项目ID
projectId: {
type: String,
required: true,
default: ""
},
// 详情信息
projectDetailInfo: {
type: Object,
default: () => ({})
}
},
watch: {
projectDetailInfo: {
handler(newValue) {
this.comProjectDetailInfo = newValue ? cloneDeep(newValue) : {};
this.init(this.comProjectDetailInfo);
},
deep: true,
},
projectId: {
handler(newValue) {
this.comProjectId = newValue;
}
},
expenseDate: {
handler(newValue, oldValue) {
this.oldExpenseDate = newValue;
}
}
},
components: {
ProjectSideMenu,
DskSkeleton,
CustomTable
},
data() {
return {
// 当前分类 1 按项目汇总 2 成本汇总
currentCategory: 1,
categoryList: [
{
label: "按项目汇总",
value: 1
},
{
label: "成本科目汇总",
value: 2
},
],
menuOptions: {
nodeName: "cbName",
nodeValue: "id",
},
comProjectDetailInfo: this.projectDetailInfo ? cloneDeep(this.projectDetailInfo) : {},
comProjectId: this.projectId,
menuTreeList: [],
// 加载数据列表
tableLoading: true,
total: 0,
// 列表表头
formColum: [
{ label: '序号', prop: "number", minWidth: "53", uid: v4() },
{ label: '名称', prop: "cbName", width: "303", uid: v4(), showOverflowTooltip: true },
],
monthList: [],
rowKey: "id",
// 列表懒加载配置
treeOptions: {
children: "children",
hasChildren: "hasChildren"
},
// 源数据月份
originMonthList: [],
dataForm: {
// 数据列表源数据
tableDataList: [],
},
// 当前查询的数据月份
expenseDate: "",
// 历史查询月份
oldExpenseDate: "",
// 当前选中子菜单的父类名称
currentParentName: "",
// 当前选中的成本科目
currentNodeValue: "",
// 源数据列表
originTableDataList: [],
// 填写成本弹窗
showAddActualCost: false,
// 填写成本 编辑状态
addActualCostEditStatus: false,
// 当前选择的成本年份
selectActualCostTime: "",
};
},
//可访问data属性
created() {
this.init(this.comProjectDetailInfo);
},
//计算集
computed: {
},
//方法集
methods: {
cellClassName({ row, column, rowIndex, columnIndex }) {
// console.log(column);
if (columnIndex == 0) {
return "number-index-td";
} else {
const { property } = column;
if (editPropNames.includes(property)) {
return `can-edit-column-${property}`;
}
}
return "";
},
getNowMonth() {
return dayjs(new Date().valueOf()).format("YYYYMM");
},
// 返回当前月是否在server month集合中
includeNowMonth(time) {
return this.originMonthList.includes(time);
},
currentCategoryChange(category) {
if (category == this.currentCategory) return;
this.currentCategory = category;
},
async init(detail = {}, resetDate = "") {
try {
this.resetEditStatus();
const { projectId, cbStage } = detail;
if (!projectId) return;
const params = {
projectId,
cbStage,
cbType: this.currentCategory
};
await this.getCostSummaryMenuTree(params);
await this.getCostSummaryMonthList(params);
await this.initDefaultSetting(resetDate);
} catch (error) {
console.log(error);
} finally {
this.tableLoading = false;
}
},
async initDefaultSetting(resetDate = "") {
try {
await this.$nextTick();
const first = this.$refs["projectSideMenu"].getFirstLevelWithDeepId();
const menus = this.$refs["projectSideMenu"].getResultMenuList();
const defaultCurrent = this.findMenuNode(menus, first);
// 默认选中结构劳务分包
if (defaultCurrent) {
this.currentNodeValue = defaultCurrent.nodeValue;
const parentName = defaultCurrent.parent ? this.getCurrentType(defaultCurrent.parent) : defaultCurrent.nodeName;
if (parentName) this.currentParentName = parentName;
const params = this.createRequestConditions(resetDate);
await this.getCostSummaryList(params);
}
} catch (error) {
console.log(error);
}
},
getCurrentType(parent) {
if (parent.level == 2) {
return parent.nodeName;
}
if (parent.parent) {
return this.getCurrentType(parent.parent);
}
},
findMenuNode(tree, nodeValue, targetName = "nodeValue") {
for (const item of tree) {
if (item[targetName] == nodeValue) return item;
if (item.children instanceof Array) {
const result = this.findMenuNode(item.children, nodeValue, targetName);
if (result) return result;
}
}
},
// 创建查询条件
createRequestConditions(resetDate = "") {
const { projectId, cbStage } = this.comProjectDetailInfo;
const params = {
projectId,
cbStage
};
params["id"] = this.currentNodeValue;
params["cbType"] = this.currentCategory;
// 判断当月是否存在于server返回month集合中 有传入的重置时间 采用重置时间
const _now = this.getNowMonth();
if (resetDate && this.includeNowMonth(resetDate)) {
params["expenseDate"] = resetDate;
} else if (this.includeNowMonth(_now)) {
params["expenseDate"] = _now;
}
return params;
},
async getCostSummaryMenuTree(params) {
try {
const result = await getCostSummaryMenuTreeApi(params);
if (result.code == 200 && result.data instanceof Array) {
const _tempArray = result.data;
const _tempMenu = {
id: 0,
cbName: this.currentCategory == 1 ? "成本汇总" : "房建类成本科目",
children: _tempArray
};
this.menuTreeList = [_tempMenu];
}
} catch (error) {
}
},
async getCostSummaryMonthList(params) {
try {
const monthList = await getCostSummaryMonthListApi(params);
if (monthList.code == 200 && monthList.data instanceof Array) {
const data = monthList.data;
this.originMonthList = cloneDeep(data);
const _now = this.getNowMonth();
this.expenseDate = _now;
// 默认以当前月数据为准 若不包含当前月 需要手动push数据
if (!data.includes(_now)) {
data.push({
expenseDate: _now,
isLock: 0
});
}
// 年月排序
let _tempMonthList = this.monthsSort(data);
_tempMonthList = _tempMonthList.map(item => {
return {
label: dayjs(item.expenseDate).format("YYYY年MM月"),
expenseDate: item.expenseDate,
isLock: item.isLock
};
});
this.monthList = _tempMonthList;
}
} catch (error) {
}
},
monthChange(month) {
// 当前月
const _now = this.getNowMonth();
// 请求列表参数
const params = this.createRequestConditions();
// 清空了年月 默认选中当前月
if (!month) {
this.expenseDate = _now;
// 如果命中的旧月份 等于当前月 且 不处于编辑状态 说明清空的是默认查询月 不调用接口
if (this.oldExpenseDate == _now && !this.addActualCostEditStatus) return;
} else {
// 正常选择
params["expenseDate"] = month;
}
this.resetEditStatus();
// 获取列表数据
this.getCostSummaryList(params);
},
monthsSort(monthList) {
const sortResult = monthList.sort((before, after) => {
const _before = Object.prototype.toString.call(before) == "[object Object]" ? before["expenseDate"] : before;
const _after = Object.prototype.toString.call(before) == "[object Object]" ? after["expenseDate"] : after;
return parseInt(_after) - parseInt(_before);
});
return sortResult;
},
async getCostSummaryList(params = {}) {
try {
this.tableLoading = true;
const list = await getCostSummaryListApi(params);
if (list.code == 200 && list.data instanceof Array) {
let _temp = list.data;
const _mapList = new Map();
// 如果有长度循环处理字段
if (_temp.length) {
_temp = _temp.map(item => {
if (!item.hasChildren) {
item.hasChildren = false;
} else {
// 有children
item.hasChildren = true;
if (item?.children?.length) {
item.children = item.children.map(childItem => {
childItem.hasChildren = childItem.hasChildren ? true : false;
return childItem;
});
}
};
// 储存将子级储存到map 主动调用展开菜单
item.hasChildren ? _mapList.set(item.id, item.children ? cloneDeep(item.children) : []) : null;
delete item.children;
return item;
});
}
console.log(_temp);
this.$set(this.dataForm, "tableDataList", cloneDeep(_temp));
this.originTableDataList = cloneDeep(_temp);
this.total = _temp.length;
this.tableLoading = false;
await this.$nextTick();
const tableIns = this.$refs["costSummaryTable"].$refs["customTableRef"];
if (tableIns) {
_mapList.forEach((child, id) => {
// 打开一级目录
this.customResolve(id, child, tableIns);
});
}
}
} catch (error) {
this.tableLoading = false;
console.log(error);
}
},
// 模拟 resolve 懒加载
customResolve(id, child, tableIns) {
let children = child;
let newKey = id;
let treeNodeMap = tableIns.store.states.lazyTreeNodeMap;
let treeData = tableIns.store.states.treeData;
//treeData 添加父子关系和状态
let childrenids = Array.from(children).map(item => item.id);
let metaInfo = {
children: childrenids,
display: true,
expanded: true,
lazy: true,
level: "",
loaded: true,
loading: false
};
this.$set(treeData, newKey, metaInfo);
//lazyTreeNodeMap中 添加数据
this.$set(treeNodeMap, newKey, children);
console.log(treeData, "treeData");
console.log(treeNodeMap, "treeNodeMap");
},
async getCostSummaryListLazy(params = {}) {
try {
const list = await getCostSummaryListApi(params);
if (list.code == 200 && list.data instanceof Array) {
let _temp = list.data?.length ? list.data[0] : {};
_temp = _temp.children?.length ? _temp.children : [];
// 如果有长度循环处理字段
if (_temp.length) {
_temp = _temp.map(item => {
if (!item.hasChildren) {
item.hasChildren = false;
} else {
item.hasChildren = true;
};
return item;
});
}
return _temp;
}
} catch (error) {
console.log(error);
}
},
// 列表懒加载
async tableLazyLoad(row, treeNode, resolve) {
try {
const { id } = row;
const { cbType, expenseDate } = this.createRequestConditions();
const params = {
id,
cbType
};
expenseDate ? params["expenseDate"] = expenseDate : null;
const _lazyResult = await this.getCostSummaryListLazy(params);
resolve(_lazyResult ? _lazyResult : null);
} catch (error) {
}
},
// 编辑状态下 进行了其它操作
resetEditStatus() {
// 当前需要编辑或者新增的成本年份
const _selectActualCostTime = this.selectActualCostTime;
this.addActualCostEditStatus = false;
this.selectActualCostTime = "";
/**
* 判断 当前需要编辑 或者新增的成本年份是否存在于server返回的month数组中 不存在则删除 该月份 然后 选中当前月
* 默认本月
*/
if (!_selectActualCostTime) return;
if (!this.originMonthList.includes(_selectActualCostTime) && _selectActualCostTime != this.getNowMonth()) {
const index = this.monthList.findIndex(item => item.value == _selectActualCostTime);
if (index != -1) {
this.monthList.splice(index, 1);
this.expenseDate = this.getNowMonth();
}
}
},
async menuSelect(currentId, currentTemp) {
this.resetEditStatus();
this.currentNodeValue = currentId;
const parentName = currentTemp.parent ? this.getCurrentType(currentTemp.parent) : currentId;
if (parentName) this.currentParentName = parentName;
const params = this.createRequestConditions(this.expenseDate);
this.getCostSummaryList(params);
},
},
}
</script>
<style lang="scss" scoped>
.cost-summary-container {
width: 100%;
height: 100%;
overflow: hidden;
.category-type-container {
height: 64px;
width: 100%;
display: flex;
align-items: center;
padding: 16px;
box-sizing: border-box;
border-bottom: 1px solid #eeeeee;
background: #fff;
.category-list-item {
height: 32px;
padding: 0px 20px;
color: #303133;
font-size: 12px;
font-weight: 400;
border-radius: 4px;
border: 1px solid #dcdfe6;
box-sizing: border-box;
display: flex;
justify-content: center;
align-items: center;
cursor: pointer;
transition: all 0.3s;
&:nth-of-type(2n - 1) {
border-right: unset !important;
border-top-right-radius: 0px;
border-bottom-right-radius: 0px;
}
&:nth-of-type(2n) {
border-left: unset !important;
border-top-left-radius: 0px;
border-bottom-left-radius: 0px;
}
&.is-current-category {
color: #fff;
border: 1px solid #0081ff;
background: #0081ff;
}
}
}
.cost-summary-content-container {
width: 100%;
height: calc(100% - 64px);
display: flex;
align-items: center;
overflow: hidden;
.left-side-menu {
width: 220px;
min-width: 220px;
height: 100%;
}
.right-table-list-container {
width: calc(100% - 220px);
height: 100%;
box-sizing: border-box;
background: #fff;
padding: 16px;
::v-deep .project-table-list-header {
margin-bottom: 16px;
display: flex;
align-items: center;
justify-content: space-between;
.project-table-list-haeder-left {
display: flex;
align-items: center;
.project-month-select-options {
width: 140px;
.el-input__inner {
height: 32px;
line-height: 32px;
padding: 0px 12px;
border-radius: 2px;
border-color: #dcdfe6;
font-size: 14px;
color: #232323;
font-weight: 350;
}
.el-input__suffix {
right: 12px;
.el-input__icon {
line-height: 32px;
width: auto;
}
}
.el-input__prefix {
display: none;
}
}
}
.project-table-list-haeder-right {
display: flex;
align-items: center;
.actual-cost-btn,
.unit-conversion-btn {
height: 32px;
display: flex;
align-items: center;
justify-content: center;
padding: 0px 12px;
background-color: #0081ff;
border-color: #0081ff;
border-radius: 4px;
color: #fff;
font-size: 14px;
font-weight: 350;
margin-right: 16px;
}
}
}
.project-feedsummary-list-container {
position: relative;
width: 100%;
height: calc(100% - 48px);
overflow: auto;
.feed-summary-form {
height: 100%;
}
.dsk-skeleton-outer-container {
padding: 0px;
height: 100%;
}
::v-deep .custom-table-list-com-ins {
.custom-table-item {
.el-table {
th {
height: 40px;
}
.cell {
font-size: 14px;
font-weight: 350;
}
.number-index-td {
.cell {
display: flex;
align-items: center;
.el-table__expand-icon {
margin-right: 5px;
}
}
}
.inner-edit-input-item {
margin-bottom: 0px;
.el-form-item__content {
line-height: 32px;
}
&.is-error {
.el-input__inner {
&:focus {
border-color: #ff4949;
}
}
}
.el-input__inner {
line-height: 32px;
height: 32px;
border-radius: 2px;
padding-left: 8px;
&:focus {
border-color: #0081ff;
}
}
.el-input__clear {
line-height: 32px;
}
}
}
}
}
.project-action-field-bar {
display: flex;
align-items: center;
.push-project-use {
color: #0081ff;
font-size: 14px;
font-weight: 350;
cursor: pointer;
&.is-emty-quantities {
cursor: not-allowed;
color: rgba(35, 35, 35, 0.4);
}
}
}
}
}
}
}
</style>
......@@ -850,8 +850,8 @@ export default {
height: 100%;
}
::v-deep .table-list-com-ins {
.table-item {
::v-deep .custom-table-list-com-ins {
.custom-table-item {
.el-table {
th {
height: 40px;
......
......@@ -466,8 +466,8 @@ export default {
height: 100%;
}
::v-deep .table-list-com-ins {
.table-item {
::v-deep .custom-table-list-com-ins {
.custom-table-item {
.el-table {
th {
height: 40px;
......
......@@ -20,9 +20,10 @@
<el-button v-if="!isall && isinput" type="primary" size="small" @click="addinputs">保存</el-button>
</div>
<!--汇总-->
<div class="table-item" v-if="isall">
<div class="meafixed-table" v-if="isall">
<el-table element-loading-text="Loading" :data="tableData" row-key="id" v-horizontal-scroll="'hover'" default-expand-all :max-height="tableHeight"
:tree-props="{children: 'children', hasChildren: 'hasChildren'}" border highlight-current-row :cell-class-name="tored" :header-cell-class-name="tored">
:tree-props="{children: 'children', hasChildren: 'hasChildren'}" border highlight-current-row :cell-class-name="tored" :header-cell-class-name="tored"
:header-cell-style="{ background:'#f0f3fa',color: 'rgba(35,35,35,0.8)'}">
<el-table-column label="序号" width="60" align="left" type="index"></el-table-column>
<el-table-column label="名称" width="220" prop="expenseName">
<template slot-scope="scope">{{scope.row.expenseName || '--'}}</template>
......@@ -39,9 +40,12 @@
</el-table>
</div>
<!--单条-->
<div class="table-item" v-else>
<el-table element-loading-text="Loading" ref="edittable" :data="tableData" row-key="id" v-horizontal-scroll="'hover'" default-expand-all :max-height="tableHeight"
:tree-props="{children: 'children', hasChildren: 'hasChildren'}" border highlight-current-row :cell-class-name="tored1" :header-cell-class-name="tored1">
<div class="meafixed-table" v-else>
<el-table element-loading-text="Loading" ref="edittable" :data="tableData" row-key="id"
:header-cell-style="{ background:'#f0f3fa',color: 'rgba(35,35,35,0.8)'}"
v-horizontal-scroll="'hover'" :max-height="tableHeight"
:tree-props="{children: 'children', hasChildren: 'hasChildren'}" border highlight-current-row
:cell-class-name="tored1" :header-cell-class-name="tored1">
<el-table-column label="序号" width="60" align="left" type="index" fixed="left"></el-table-column>
<el-table-column label="清单内容" width="130" prop="itemContent" fixed="left">
<template slot-scope="scope">{{scope.row.itemContent || '--'}}</template>
......@@ -91,8 +95,10 @@
<el-table-column label="本月成本发生比例" width="150" prop="monthCostRate">
<template slot-scope="scope">
<template v-if="isinput"><el-input v-model="scope.row.monthCostRate "></el-input></template>
<template v-else>{{scope.row.monthCostRate || '--'}}</template>
<template v-if="isinput">
<el-input v-model="scope.row.monthCostRate "></el-input>
</template>
<template v-else>{{scope.row.monthCostRate?scope.row.monthCostRate+'%':'--'}}</template>
</template>
</el-table-column>
<el-table-column label="成本合价" width="130" prop="costEffective">
......@@ -100,7 +106,9 @@
</el-table-column>
<el-table-column label="本月工程量" width="130" prop="projectVolume">
<template slot-scope="scope">
<template v-if="isinput"><el-input v-model="scope.row.projectVolume "></el-input></template>
<template v-if="isinput">
<el-input v-model="scope.row.projectVolume "></el-input>
</template>
<template v-else>{{scope.row.projectVolume || '--'}}</template>
</template>
</el-table-column>
......@@ -115,7 +123,7 @@
<template slot-scope="scope">{{scope.row.remarks || '--'}}</template>
</el-table-column>
<el-table-column label="是否推送" width="130">
<template slot-scope="scope">{{scope.row.pushTime?"是":"否"}}</template>
<template slot-scope="scope">{{scope.row.pushTime?'是':'否'}}</template>
</el-table-column>
<el-table-column label="操作" width="130" fixed="right">
<template slot-scope="scope">
......@@ -185,18 +193,19 @@
</div>
</template>
<script>
import ProjectSideMenu from '@/views/projectCostLedger/detail/components/ProjectSideMenu';
import {
import ProjectSideMenu from '@/views/projectCostLedger/detail/components/ProjectSideMenu'
import {
getActualMonthsApi,
getCostMeasureslist,
getMeasureslist,
getSummarydata,
projectVolume,
pushProjectvolume,
getActualMonthsApi,saveBatch
} from '@/api/projectCostLedger';
import { cloneDeep } from "lodash-es";
saveBatch
} from '@/api/projectCostLedger'
import { cloneDeep } from 'lodash-es'
export default {
export default {
name: "MeasureItems",
props: {
// 项目ID
......@@ -264,6 +273,7 @@ export default {
//可访问data属性
created() {
this.init(this.comProjectId);
// this.createResizeObserver();
},
//计算集
computed: {
......@@ -271,6 +281,30 @@ export default {
},
//方法集
methods: {
getGDT(){
let gdt = document.querySelector('.el-table__body-wrapper')
let w1 = document.querySelector('.el-table__fixed-right-patch')
let w2 = document.querySelector('.el-table__fixed-right')
if(gdt){
let outheight = gdt.scrollHeight
let inheight = gdt.clientHeight
if(outheight>inheight){
if (w1) {
w1.setAttribute('style', `width: 16px;height:40px`)
}
if (w2) {
w2.setAttribute('style', `right: 16px;width:130px`)
}
}else{
if (w1) {
w1.setAttribute('style', `width: 0;height:40px`)
}
if (w2) {
w2.setAttribute('style', `right: 0;width:130px`)
}
}
}
},
tored({column}){
if(column.property=='quantity'){
return 'tored'
......@@ -342,6 +376,12 @@ export default {
const res = await getCostMeasureslist(param);
this.tableData = res.data;
this.isinput = false
// await this.$nextTick()
this.$nextTick(()=>{
setTimeout(()=>{
this.getGDT()
},500)
})
},
async init(detail = '') {
try {
......@@ -421,8 +461,10 @@ export default {
addinputs(){
let tables = JSON.parse(JSON.stringify(this.tableData))
tables.forEach(item=>{
item.planMeasureId = item.id
item.id = item.actualId
item.month = this.expenseDate
item.monthCostRate = item.monthCostRate?parseInt(item.monthCostRate.replace('%','')):null
})
saveBatch(JSON.stringify(tables)).then(res=>{
if(res.code == 200){
......@@ -481,12 +523,6 @@ export default {
height: 100%;
background: #fff;
padding: 16px;
.table-item {
margin-top: 16px;
}
::v-deep .el-scrollbar.el-table-horizontal-scrollbar {
display: none !important;
}
}
}
.search {
......
......@@ -29,6 +29,9 @@
<!-- 现场经费 -->
<field-expenses v-if="current == 'fieldExpenses'" :project-id="projectId" :project-detail-info="detailInfo"></field-expenses>
<!-- 成本汇总 -->
<cost-summary v-if="current == 'cost'" :project-id="projectId" :project-detail-info="detailInfo"></cost-summary>
</div>
</div>
</div>
......@@ -50,6 +53,8 @@ import OtherProjects from "@/views/projectCostLedger/detail/components/OtherProj
import ProfitLoss from "@/views/projectCostLedger/detail/components/ProfitLoss";
// 现场经费
import FieldExpenses from "@/views/projectCostLedger/detail/components/FieldExpenses";
// 成本汇总
import CostSummary from "@/views/projectCostLedger/detail/components/CostSummary";
import { v4 } from "uuid";
import { cloneDeep } from "lodash-es";
import { getProjectDetailApi } from "@/api/projectCostLedger";
......@@ -64,7 +69,8 @@ export default {
OtherProjects,
ProfitLoss,
MeasureItems,
FieldExpenses
FieldExpenses,
CostSummary
},
data() {
return {
......
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