|
@@ -91,18 +91,21 @@ import getDate from '@/libs/getDate'
|
|
|
// 接口
|
|
|
import { manageAnalysisReportQuery, manageAnalysisReportExport } from '@/api/reportData'
|
|
|
const strongRow = []
|
|
|
+const redRow = []
|
|
|
const renderContent = (value, row, index) => {
|
|
|
- const ret = value || value == 0 ? value : '--'
|
|
|
+ const ret = value || value == 0 ? value : ''
|
|
|
const retVal = ret == 0 ? '0.00' : ret
|
|
|
- if (strongRow.indexOf(index) >= 0) {
|
|
|
+ const isStrong = strongRow.indexOf(index) >= 0
|
|
|
+ const isRed = redRow.indexOf(index) >= 0
|
|
|
+ if (isStrong || isRed) {
|
|
|
return {
|
|
|
- children: retVal,
|
|
|
+ children: retVal == '--' ? '' : retVal,
|
|
|
attrs: {
|
|
|
style: 'font-weight: bold;color:red;font-size:14px;'
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- return retVal
|
|
|
+ return retVal == '--' ? '' : retVal
|
|
|
}
|
|
|
export default {
|
|
|
name: 'RegionTypeBusinessReportList',
|
|
@@ -143,12 +146,21 @@ export default {
|
|
|
// 计算表格序号
|
|
|
for (var i = 0; i < data.length; i++) {
|
|
|
data[i].no = i + 1
|
|
|
- data[i].grossMargin = data[i].grossMargin ? data[i].grossMargin + '%' : '0.00%'
|
|
|
- data[i].promoRatio = data[i].promoRatio ? data[i].promoRatio + '%' : '0.00%'
|
|
|
+ const isqml = data[i].category === '全品类'
|
|
|
+ data[i].grossMargin = (data[i].grossMargin || data[i].grossMargin == 0) && data[i].amount ? data[i].grossMargin.toFixed(2) + '%' : '--'
|
|
|
+ data[i].promoRatio = (data[i].promoRatio || data[i].promoRatio == 0) && data[i].amount ? data[i].promoRatio.toFixed(2) + '%' : '--'
|
|
|
+ data[i].cost = data[i].cost ? data[i].cost.toFixed(2) : (isqml ? '--' : '0.00')
|
|
|
+ data[i].amount = data[i].amount ? data[i].amount.toFixed(2) : (isqml ? '--' : '0.00')
|
|
|
+ data[i].gross = data[i].gross ? data[i].gross.toFixed(2) : (isqml ? '--' : '0.00')
|
|
|
+ data[i].promo = data[i].promo || data[i].promo == 0 ? data[i].promo.toFixed(2) : (isqml ? '--' : '0.00')
|
|
|
+ data[i].removePromoGross = data[i].removePromoGross ? data[i].removePromoGross.toFixed(2) : (isqml ? '--' : '0.00')
|
|
|
|
|
|
if (data[i].category.indexOf('合计') >= 0) {
|
|
|
strongRow.push(i)
|
|
|
}
|
|
|
+ if (data[i].category == '全品类(含NGK)' || data[i].category == '箭牌喇叭' || data[i].category == '轮胎') {
|
|
|
+ redRow.push(i)
|
|
|
+ }
|
|
|
ret.push(data[i])
|
|
|
}
|
|
|
}
|
|
@@ -175,17 +187,23 @@ export default {
|
|
|
const arr = [
|
|
|
{ title: '类别',
|
|
|
dataIndex: 'category',
|
|
|
- width: '25%',
|
|
|
+ width: '15%',
|
|
|
align: 'center',
|
|
|
customRender: (text, row, index) => {
|
|
|
- return row.category.indexOf('合计') < 0 ? <a-button type="link" class="button-default">{text}</a-button> : (<a-button type="link" class="button-error" style="font-weight:bold;font-size:14px;">{text}</a-button>)
|
|
|
- } },
|
|
|
- { title: '成本', dataIndex: 'cost', width: '10%', align: 'right', customRender: renderContent },
|
|
|
- { title: '销售额', dataIndex: 'amount', width: '10%', align: 'right', customRender: renderContent },
|
|
|
- { title: '毛利', dataIndex: 'gross', width: '10%', align: 'right', customRender: renderContent },
|
|
|
+ const isStrong = row.category.indexOf('合计') >= 0
|
|
|
+ const isRed = row.category == '全品类(含NGK)' || row.category == '箭牌喇叭' || row.category == '轮胎'
|
|
|
+ if (isStrong || isRed) {
|
|
|
+ return <a-button size="small" type="link" class="button-error" style="font-weight:bold;font-size:14px;">{text}</a-button>
|
|
|
+ }
|
|
|
+ return <a-button size="small" type="link" class="button-default">{text}</a-button>
|
|
|
+ }
|
|
|
+ },
|
|
|
+ { title: '成本', dataIndex: 'cost', width: '10%', align: 'center', customRender: renderContent },
|
|
|
+ { title: '销售额', dataIndex: 'amount', width: '10%', align: 'center', customRender: renderContent },
|
|
|
+ { title: '毛利', dataIndex: 'gross', width: '10%', align: 'center', customRender: renderContent },
|
|
|
{ title: '毛利率', dataIndex: 'grossMargin', width: '10%', align: 'center', customRender: renderContent },
|
|
|
- { title: '促销费用', dataIndex: 'promo', width: '10%', align: 'right', customRender: renderContent },
|
|
|
- { title: '减促销费用的毛利', dataIndex: 'removePromoGross', width: '10%', align: 'right', customRender: renderContent },
|
|
|
+ { title: '促销费用', dataIndex: 'promo', width: '10%', align: 'center', customRender: renderContent },
|
|
|
+ { title: '减促销费用的毛利', dataIndex: 'removePromoGross', width: '10%', align: 'center', customRender: renderContent },
|
|
|
{ title: '促销费用占比', dataIndex: 'promoRatio', width: '10%', align: 'center', customRender: renderContent }
|
|
|
]
|
|
|
return arr
|