Commit 111505f8 authored by tianhongyang's avatar tianhongyang

fix

parent 03aac2a8
......@@ -39,7 +39,7 @@
<table-list-com :tableData="tableDataList" :formColum="formColum" v-else-if="!tableLoading" :maxHeight="true" :tableDataTotal="total"
:paging="false">
<template slot="action-field-bar" slot-scope="scope">
<div class="project-action-field-bar" v-if="scope.row.id">
<div class="project-action-field-bar" v-if="scope.row.id == '0'">
<span class="push-project">推送工程量</span>
</div>
<span v-else>-</span>
......@@ -155,7 +155,19 @@ export default {
currentNodeName: "",
// 数据列表
tableDataList: [],
statisticsParentName: ["劳务分包工程", "专业分包工程"]
statisticsParentName: ["劳务分包工程", "专业分包工程"],
// 需要统计的字段名
statisticsPropNames: [
"guidePrice",
"bidUnitPrice",
"unitPriceDifference",
"quantity",
"combinedPrice",
"combinedPriceTax",
"quantities",
"totalQuantities",
"purchaseUnitPrice"
]
};
},
//可访问data属性
......@@ -239,7 +251,7 @@ export default {
const _temp = list.data;
// 计算总和
if (this.hasTarget) {
const row = this.countRowParams(_temp);
const row = this.countRowParams(_temp, this.statisticsPropNames);
}
this.tableDataList = _temp;
this.total = _temp.length;
......@@ -250,15 +262,27 @@ export default {
this.tableLoading = false;
}
},
countRowParams(arraylist = []) {
countRowParams(arraylist = [], statisticsPropNames) {
if (arraylist.length) {
const _template = {};
const _temp = cloneDeep(arraylist[0]);
const keys = Object.keys(_temp);
// 映射key
for (const key of keys) {
if (key == "id") {
_template[key] = "0";
continue;
}
_template[key] = "";
}
console.log(_template);
// 循环统计 需要统计的列 总数
for (const prop of statisticsPropNames) {
const sum = arraylist.reduce((pre, current, index) => {
const before = Object.prototype.toString.call(pre) == "[object Object]" ? pre[prop] : parseFloat(pre) ? pre : 0;
const after = Object.prototype.toString.call(current) == "[object Object]" ? current[prop] : parseFloat(current) ? current : 0;
}, 0);
}
}
},
async getFeedSummaryMenuTree(params) {
......@@ -285,12 +309,17 @@ export default {
if (!data.includes(_now)) {
data.push(_now);
}
this.monthList = data.map(item => {
// 年月排序
let _tempMonthList = data.sort((before, after) => {
return parseInt(after) - parseInt(before);
});
_tempMonthList = _tempMonthList.map(item => {
return {
label: dayjs(item).format("YYYY年MM月"),
value: item
};
});
this.monthList = _tempMonthList;
}
} catch (error) {
......
......@@ -251,7 +251,7 @@
this.select(result.data[0].id)
}
} catch (error) {
console.log(error)
}
},
changetime(val){
......
......@@ -113,6 +113,7 @@ export default {
{
name: "盈亏分析对比",
value: "profitAndLoss",
cbType: 1,
id: v4()
}
],
......@@ -208,7 +209,7 @@ export default {
},
setCbType(current) {
if (!current) {
delete this.detailInfo["cbType"];
this.$delete(this.detailInfo, "cbType");
return;
}
const _temp = this.getCurrentTab(current);
......
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