|
@@ -75,7 +75,14 @@
|
|
|
|
|
|
<el-table-column label="营业收入(净)" align="center" min-width="115px">
|
|
|
<template slot-scope="scope">
|
|
|
- <div style="display:flex;justify-content:center" :style="`${isAmountProp(scope.row.companyName) ? '' :getCurrentValueStyle(scope.row.msale_total, scope.row.total_tips)}`">
|
|
|
+ <div
|
|
|
+ style="display:flex;justify-content:center"
|
|
|
+ :style="`${
|
|
|
+ isAmountProp(scope.row.companyName)
|
|
|
+ ? getTotalValueStyle(scope.row, 'msale_total')
|
|
|
+ : getCurrentValueStyle(scope.row.msale_total, scope.row.total_tips)
|
|
|
+ }`"
|
|
|
+ >
|
|
|
{{
|
|
|
isAmountProp(scope.row.companyName)
|
|
|
? unit2TenThousand(calcAmount('msale_total', scope.row.companyNo), isTenThound)
|
|
@@ -87,7 +94,7 @@
|
|
|
|
|
|
<el-table-column label="营收完成%" align="center" min-width="85px">
|
|
|
<template slot-scope="scope">
|
|
|
- <div :style="`${isAmountProp(scope.row.companyName) ? '' : getCurrentRateStyle(scope.row.completion_rate)}`">
|
|
|
+ <div :style="`${isAmountProp(scope.row.companyName) ? getTotalRateStyle(scope.row,'completion_rate') : getCurrentRateStyle(scope.row.completion_rate)}`">
|
|
|
{{
|
|
|
isAmountProp(scope.row.companyName)
|
|
|
? calcAmountCompletionRate(scope.row.companyNo)
|
|
@@ -111,7 +118,7 @@
|
|
|
|
|
|
<el-table-column label="毛利完成" align="center" min-width="90px">
|
|
|
<template slot-scope="scope">
|
|
|
- <div :style="`${isAmountProp(scope.row.companyName) ? '' : getCurrentValueStyle(scope.row.gross_completion, scope.row.cost_tips)}`">
|
|
|
+ <div :style="`${isAmountProp(scope.row.companyName) ? getTotalValueStyle(scope.row,'gross_completion', true) : getCurrentValueStyle(scope.row.gross_completion, scope.row.cost_tips)}`">
|
|
|
{{ costField
|
|
|
? isAmountProp(scope.row.companyName) ? unit2TenThousand(calcAmount('gross_completion', scope.row.companyNo), isTenThound) : unit2TenThousand(scope.row.gross_completion, isTenThound)
|
|
|
: '***'
|
|
@@ -123,7 +130,7 @@
|
|
|
|
|
|
<el-table-column label="毛利完成%" align="center" min-width="85px">
|
|
|
<template slot-scope="scope">
|
|
|
- <div :style="isAmountProp(scope.row.companyName) ? '' : getCurrentRateStyle(scope.row.gross_completion_rate)">
|
|
|
+ <div :style="isAmountProp(scope.row.companyName) ? getTotalRateStyle(scope.row, 'gross_completion_rate') : getCurrentRateStyle(scope.row.gross_completion_rate)">
|
|
|
{{ isAmountProp(scope.row.companyName) ? calcAmountGrossCompletionRate(scope.row.companyNo) : scope.row.gross_completion_rate === '-' ? '-' : scope.row.gross_completion_rate + '%' }}
|
|
|
</div>
|
|
|
</template>
|
|
@@ -254,6 +261,39 @@ export default {
|
|
|
const gross_completion = this.calcAmount('gross_completion', companyNo)
|
|
|
return Number(multiplication(Number(division(gross_completion, cost_tips)).toFixed(2), 100)).toFixed(2) + '%'
|
|
|
},
|
|
|
+ getTotalValueStyle(row, prop, isCost = false){
|
|
|
+ const days = dayjs(this.daytime).daysInMonth();
|
|
|
+ const total_tips = this.calcAmount(isCost ? 'cost_tips' : 'total_tips', row.companyNo)
|
|
|
+ const current = this.calcAmount(prop, row.companyNo)
|
|
|
+ const oneDay = Number(division(total_tips, days)).toFixed(2);
|
|
|
+ const currentDay = dayjs(this.daytime).date();
|
|
|
+ const currentTotalTip = Number(multiplication(currentDay, oneDay)).toFixed(2);
|
|
|
+ return Number(currentTotalTip) > Number(current) ? 'color: red' : '';
|
|
|
+
|
|
|
+ },
|
|
|
+ getTotalRateStyle(row, prop) {
|
|
|
+ const days = dayjs(this.daytime).daysInMonth();
|
|
|
+ const oneDay = Number(division(100, days)).toFixed(2);
|
|
|
+ const currentDay = dayjs(this.daytime).date();
|
|
|
+ const currentTotalTip = Number(multiplication(currentDay, oneDay)).toFixed(2);
|
|
|
+ const current = this.calcAmount(prop,row.companyNo)
|
|
|
+ return Number(currentTotalTip) > Number(current) ? 'color:red' : ''
|
|
|
+
|
|
|
+ },
|
|
|
+ getCurrentRateStyle(current) {
|
|
|
+ const days = dayjs(this.daytime).daysInMonth();
|
|
|
+ const oneDay = Number(division(100, days)).toFixed(2);
|
|
|
+ const currentDay = dayjs(this.daytime).date();
|
|
|
+ const currentTotalTip = Number(multiplication(currentDay, oneDay)).toFixed(2);
|
|
|
+ return Number(currentTotalTip) > Number(current) ? 'color:red' : ''
|
|
|
+ },
|
|
|
+ getCurrentValueStyle(current, total = 0) {
|
|
|
+ const days = dayjs(this.daytime).daysInMonth();
|
|
|
+ const oneDay = Number(division(total, days)).toFixed(2);
|
|
|
+ const currentDay = dayjs(this.daytime).date();
|
|
|
+ const currentTotalTip = Number(multiplication(currentDay, oneDay)).toFixed(2);
|
|
|
+ return Number(currentTotalTip) > Number(current) ? 'color: red' : '';
|
|
|
+ },
|
|
|
calcAmountCompletionRate(companyNo){
|
|
|
const msale_total = this.calcAmount('msale_total', companyNo)
|
|
|
const total_tips = this.calcAmount('total_tips', companyNo)
|
|
@@ -303,6 +343,7 @@ export default {
|
|
|
|
|
|
|
|
|
return sourceData.reduce((prev, current) => {
|
|
|
+ if(!current) return 0
|
|
|
const value = Number(addition(prev,isNaN(current[prop]) ? 0 : current[prop]))
|
|
|
return value === 0 ? 0 : value.toFixed(2)
|
|
|
}, 0)
|
|
@@ -315,15 +356,7 @@ export default {
|
|
|
resolve(ylBusiness ? ylBusiness.children : [])
|
|
|
},
|
|
|
unit2TenThousand,
|
|
|
- getCurrentRateStyle(current) {
|
|
|
- const days = dayjs(this.daytime).daysInMonth();
|
|
|
- const oneDay = Number(division(100, days)).toFixed(2);
|
|
|
- const currentDay = dayjs(this.daytime).date();
|
|
|
- const currentTotalTip = Number(multiplication(currentDay, oneDay)).toFixed(2);
|
|
|
- return Number(currentTotalTip) > Number(current) ? 'color:red' : ''
|
|
|
- },
|
|
|
handleData(data){
|
|
|
- // console.log(JSON.parse(JSON.stringify(data.companyArr[0])))
|
|
|
let companyArr = []
|
|
|
data.companyArr.forEach(({
|
|
|
supplierName,
|
|
@@ -407,13 +440,7 @@ export default {
|
|
|
|
|
|
return companyArr
|
|
|
},
|
|
|
- getCurrentValueStyle(current, total = 0) {
|
|
|
- const days = dayjs(this.daytime).daysInMonth();
|
|
|
- const oneDay = Number(division(total, days)).toFixed(2);
|
|
|
- const currentDay = dayjs(this.daytime).date();
|
|
|
- const currentTotalTip = Number(multiplication(currentDay, oneDay)).toFixed(2);
|
|
|
- return Number(currentTotalTip) > Number(current) ? 'color: red' : '';
|
|
|
- },
|
|
|
+
|
|
|
setCellClassName({ column, row, columnIndex }) {
|
|
|
const { label } = column;
|
|
|
let base = ''
|
|
@@ -481,6 +508,7 @@ export default {
|
|
|
selfSupport.companyArr = this.handleData(selfSupport)
|
|
|
otherSupport.companyArr = this.handleData(otherSupport)
|
|
|
|
|
|
+
|
|
|
this.otherSupport = otherSupport
|
|
|
this.selfSupport = selfSupport
|
|
|
|
|
@@ -489,7 +517,7 @@ export default {
|
|
|
const companies = ['北京普润心堂商贸有限公司', '北京锦兴弘昌科技有限公司', '北京知事文化产业发展有限公司']
|
|
|
children = companies.map(companyName => {
|
|
|
return children.find(item => item.companyName === companyName)
|
|
|
- })
|
|
|
+ }).filter(item => item !== undefined)
|
|
|
|
|
|
|
|
|
this.selfSupport.companyArr = this.selfSupport.companyArr.filter(({companyNo}) => !this.composeCompanies.includes(companyNo))
|
|
@@ -497,23 +525,18 @@ export default {
|
|
|
this.selfSupport.companyArr = [
|
|
|
{
|
|
|
...amountData,
|
|
|
- // order_type: '自营订单',
|
|
|
companyNo: 'selfSupportOrderAmount',
|
|
|
companyName: '合计'
|
|
|
},
|
|
|
- {
|
|
|
+ ...(children.length === 0? [] : [{
|
|
|
...amountData,
|
|
|
companyNo: 'selfSupportOrderPR',
|
|
|
companyName: '普润',
|
|
|
children
|
|
|
- },
|
|
|
+ }]),
|
|
|
...this.selfSupport.companyArr
|
|
|
]
|
|
|
|
|
|
- this.lastSupportCompany = this.selfSupport.companyArr[this.selfSupport.companyArr.length -1].companyName
|
|
|
- const middle = Math.floor(this.selfSupport.companyArr.length / 2)
|
|
|
- this.selfSupport.companyArr[middle].order_type = '自营订单'
|
|
|
-
|
|
|
this.otherSupport.companyAmount = [
|
|
|
{
|
|
|
...amountData,
|
|
@@ -529,6 +552,25 @@ export default {
|
|
|
companyName: '合计'
|
|
|
}]
|
|
|
|
|
|
+
|
|
|
+ const zrIndex = this.selfSupport.companyArr.findIndex(({companyNo}) => companyNo === 'QS2206011103304501')
|
|
|
+ const hyIndex = this.selfSupport.companyArr.findIndex(({companyNo}) => companyNo === 'QS2203150147015222')
|
|
|
+ if(zrIndex !== -1 && hyIndex !== -1){
|
|
|
+ const temp = this.selfSupport.companyArr[zrIndex]
|
|
|
+ this.selfSupport.companyArr[zrIndex] = this.selfSupport.companyArr[hyIndex]
|
|
|
+ this.selfSupport.companyArr[hyIndex] = temp
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ if(this.selfSupport.companyArr.length === 1){
|
|
|
+ this.selfSupport.companyArr[0].order_type = '自营订单'
|
|
|
+ }else{
|
|
|
+ this.lastSupportCompany = this.selfSupport.companyArr[this.selfSupport.companyArr.length -1].companyName
|
|
|
+ const middle = Math.floor(this.selfSupport.companyArr.length / 2)
|
|
|
+ this.selfSupport.companyArr[middle].order_type = '自营订单'
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
// this.otherCompanise = sourceData.filter(({is_sup}) => is_sup === 1)
|
|
|
// sourceData = sourceData.filter(({companyNo}) => !this.composeCompanies.includes(companyNo) && this.notOtherCompanise.includes(companyNo))
|
|
|
// , hasChildren: true, children
|