|
@@ -60,16 +60,16 @@
|
|
|
<a-spin :spinning="spinning" tip="Loading...">
|
|
|
<!-- 列表 -->
|
|
|
<s-table
|
|
|
- class="sTable fixPagination"
|
|
|
+ class="sTable"
|
|
|
ref="table"
|
|
|
size="small"
|
|
|
:rowKey="(record) => record.no"
|
|
|
rowKeyName="no"
|
|
|
:rowClassName="(record, index) => record.category.indexOf('合计') >= 0 ? 'garyBg-row':''"
|
|
|
- :style="{ height: tableHeight+70+'px' }"
|
|
|
+ :style="{ height: tableHeight+'px' }"
|
|
|
:columns="columns"
|
|
|
:data="loadData"
|
|
|
- :scroll="{ y: tableHeight-120}"
|
|
|
+ :scroll="{ y: tableHeight}"
|
|
|
:defaultLoadData="false"
|
|
|
:showPagination="false"
|
|
|
bordered>
|
|
@@ -90,6 +90,18 @@ import dealerSubareaScopeList from '@/views/common/dealerSubareaScopeList.vue'
|
|
|
import getDate from '@/libs/getDate'
|
|
|
// 接口
|
|
|
import { manageAnalysisReportQuery, manageAnalysisReportExport } from '@/api/reportData'
|
|
|
+const renderContent = (value, row, index) => {
|
|
|
+ const text = (value || value == 0) || '--'
|
|
|
+ const obj = {
|
|
|
+ children: text,
|
|
|
+ attrs: {}
|
|
|
+ }
|
|
|
+
|
|
|
+ if (row.category == 'a') {
|
|
|
+ obj.attrs.colSpan = 0
|
|
|
+ }
|
|
|
+ return obj
|
|
|
+}
|
|
|
export default {
|
|
|
name: 'RegionTypeBusinessReportList',
|
|
|
mixins: [commonMixin],
|
|
@@ -120,18 +132,24 @@ export default {
|
|
|
this.spinning = true
|
|
|
const { beginDate, endDate, dealerName, provinceName } = this.queryParam
|
|
|
const params = Object.assign(parameter, { beginDate, endDate, dealerName, provinceName })
|
|
|
- // 获取列表数据 有分页
|
|
|
+ // 获取列表数据
|
|
|
return manageAnalysisReportQuery(params).then(res => {
|
|
|
let data
|
|
|
+ const ret = []
|
|
|
if (res.status == 200) {
|
|
|
data = res.data
|
|
|
- res.data.map((item, i) => {
|
|
|
- item.no = i + 1
|
|
|
- })
|
|
|
- this.disabled = false
|
|
|
+ // 计算表格序号
|
|
|
+ for (var i = 0; i < data.length; i++) {
|
|
|
+ data[i].no = i + 1
|
|
|
+ ret.push(data[i])
|
|
|
+ if (data[i].category.indexOf('合计') >= 0) {
|
|
|
+ ret.push({ no: 'hj-' + data[i].no, 'category': 'a' })
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
+ this.disabled = false
|
|
|
this.spinning = false
|
|
|
- return data
|
|
|
+ return { list: ret, count: 0 }
|
|
|
})
|
|
|
}
|
|
|
}
|
|
@@ -150,14 +168,28 @@ export default {
|
|
|
computed: {
|
|
|
columns () {
|
|
|
const arr = [
|
|
|
- { title: '类别', dataIndex: 'category', width: '15%', align: 'right', customRender: function (text) { return (text || text == 0) || '--' } },
|
|
|
- { title: '成本', dataIndex: 'cost', width: '10%', align: 'center', customRender: function (text) { return (text || text == 0) || '--' } },
|
|
|
- { title: '销售额', dataIndex: 'amount', width: '10%', align: 'center', customRender: function (text) { return (text || text == 0) || '--' } },
|
|
|
- { title: '毛利', dataIndex: 'gross', width: '10%', align: 'center', customRender: function (text) { return (text || text == 0) || '--' } },
|
|
|
- { title: '毛利率', dataIndex: 'grossMargin', width: '10%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
|
|
|
- { title: '促销费用', dataIndex: 'promo', width: '10%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
|
|
|
- { title: '减促销费用的毛利', dataIndex: 'removePromoGross', width: '15%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
|
|
|
- { title: '促销费用占比', dataIndex: 'promoRatio', width: '15%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } }
|
|
|
+ { title: '类别',
|
|
|
+ dataIndex: 'category',
|
|
|
+ width: '15%',
|
|
|
+ align: 'center',
|
|
|
+ customRender: (text, row, index) => {
|
|
|
+ if (row.category != 'a') {
|
|
|
+ return row.category.indexOf('合计') < 0 ? <a-button type="link" class="button-default">{text}</a-button> : (<a-button type="link" class="button-default" style="font-weight:bold;">{text}</a-button>)
|
|
|
+ }
|
|
|
+ return {
|
|
|
+ children: <span style="display:block;height:6px;background:#fff;"></span>,
|
|
|
+ attrs: {
|
|
|
+ colSpan: 8
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } },
|
|
|
+ { 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 },
|
|
|
+ { title: '毛利率', dataIndex: 'grossMargin', width: '10%', align: 'right', customRender: renderContent },
|
|
|
+ { title: '促销费用', dataIndex: 'promo', width: '10%', align: 'right', customRender: renderContent },
|
|
|
+ { title: '减促销费用的毛利', dataIndex: 'removePromoGross', width: '15%', align: 'right', customRender: renderContent },
|
|
|
+ { title: '促销费用占比', dataIndex: 'promoRatio', width: '15%', align: 'right', customRender: renderContent }
|
|
|
]
|
|
|
return arr
|
|
|
}
|
|
@@ -249,7 +281,7 @@ export default {
|
|
|
// 计算表格高度
|
|
|
setTableH () {
|
|
|
const tableSearchH = this.$refs.tableSearch.offsetHeight
|
|
|
- this.tableHeight = window.innerHeight - tableSearchH - 280
|
|
|
+ this.tableHeight = window.innerHeight - tableSearchH - 160
|
|
|
}
|
|
|
},
|
|
|
mounted () {
|