Commit 111505f8 authored by tianhongyang's avatar tianhongyang

fix

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