Browse Source

20241022

java8
qiezi 1 year ago
parent
commit
91b63ce625
  1. 55
      src/views/modules/quote/detail/breakdownCost.vue

55
src/views/modules/quote/detail/breakdownCost.vue

@ -346,9 +346,16 @@ export default {
queryQuoteDetailReportOverall(params).then(({data})=>{ queryQuoteDetailReportOverall(params).then(({data})=>{
if (data && data.code === 0){ if (data && data.code === 0){
this.dataList = data.rows; this.dataList = data.rows;
if (this.dataList.length === 0){
this.subtotalCostStd = 0
this.subtotalCostQuote = 0
}
}else { }else {
this.$message.warning(data.msg) this.$message.warning(data.msg)
} }
this.$nextTick(()=>{
this.handleQueryQuoteDetailReportRM();
})
this.queryLoading = false; this.queryLoading = false;
}).catch((error)=>{ }).catch((error)=>{
this.$message.error(error) this.$message.error(error)
@ -391,10 +398,10 @@ export default {
}, 0); }, 0);
sums[index] = new Decimal(sums[index]).toFixed(6) sums[index] = new Decimal(sums[index]).toFixed(6)
if (column.property ==='subtotalCostQuote'){ if (column.property ==='subtotalCostQuote'){
this.subtotalCostQuote = sums[index]?sums[index]:0
this.subtotalCostQuote = new Decimal(sums[index]?sums[index]:0).toNumber()
} }
if (column.property ==='subtotalCostStd'){ if (column.property ==='subtotalCostStd'){
this.subtotalCostStd = sums[index]?sums[index]:0
this.subtotalCostStd = new Decimal(sums[index]?sums[index]:0).toNumber()
} }
if (column.property === 'subPercentageQuote' || column.property ==='subPercentageStd'){ if (column.property === 'subPercentageQuote' || column.property ==='subPercentageStd'){
sums[index] = new Decimal(sums[index] * 100).toFixed(2) + '%' sums[index] = new Decimal(sums[index] * 100).toFixed(2) + '%'
@ -404,16 +411,54 @@ export default {
} }
}); });
return sums; return sums;
},
getRmSummaries(param) {
const { columns, data } = param;
const sums = [];
let totalCostStd = 0;
let totalCostQuote = 0;
columns.forEach((column, index) => {
if (index === 0) {
sums[index] = 'RM total cost';
return;
} }
const values = data.map(item => Number(item[column.property]));
console.log(values)
if (!values.every(value => isNaN(value))) {
sums[index] = values.reduce((prev, curr) => {
const value = Number(curr);
if (!isNaN(value)) {
return prev + curr;
} else {
return prev;
}
}, 0);
sums[index] = new Decimal(sums[index]).toFixed(6)
if (column.property === 'percentageOfRmStd' || column.property === 'percentageOfRmQuote'){
sums[index] = new Decimal(sums[index] * 100).toFixed(2) + '%'
}else if (column.property === 'rmCostStandard'){
totalCostStd = new Decimal(sums[index]).toNumber()
}else if (column.property === 'rmCostQuote'){
totalCostQuote = new Decimal(sums[index]).toNumber()
}else if (column.property === 'totalCostStd'){
sums[index] = new Decimal(totalCostStd / this.subtotalCostStd * 100).toFixed(0) + '%'
}else if (column.property === 'totalCostQuote'){
sums[index] = new Decimal(totalCostQuote / this.subtotalCostQuote * 100).toFixed(0) + '%'
}
} else {
sums[index] = 'N/A';
}
});
return sums;
},
}, },
watch:{ watch:{
quoteDetail(newVal,oldVal){ quoteDetail(newVal,oldVal){
if (newVal){ if (newVal){
this.queryLoading = true; this.queryLoading = true;
this.handleQueryQuoteDetailReportOverall(); this.handleQueryQuoteDetailReportOverall();
this.handleQueryQuoteDetailReportRM();
}
} }
},
} }
} }
</script> </script>
@ -445,7 +490,7 @@ export default {
</el-table> </el-table>
</el-col> </el-col>
<el-col :span="10"> <el-col :span="10">
<el-table :data="dataListRm" :height="height" border>
<el-table :key="dataListRm.length" :data="dataListRm" :height="height" border show-summary :summary-method="getRmSummaries">
<el-table-column <el-table-column
v-for="(item,index) in dataRmColumns" :key="index" v-for="(item,index) in dataRmColumns" :key="index"
:sortable="item.columnSortable" :sortable="item.columnSortable"

Loading…
Cancel
Save