Browse Source

Merge branch 'develop_yh13' of http://git.chelingzhu.com/jianguan-web/jg-ocs-html into develop_yh13

lilei 2 years ago
parent
commit
f510df3222
1 changed files with 24 additions and 49 deletions
  1. 24 49
      src/views/reportData/regionTypeSalesReport/list.vue

+ 24 - 49
src/views/reportData/regionTypeSalesReport/list.vue

@@ -83,7 +83,7 @@ import Area from '@/views/common/area.js'
 import subarea from '@/views/common/subarea.js'
 import { hdExportExcel } from '@/libs/exportExcel'
 import reportModal from '@/views/common/reportModal.vue'
-import { realReportSalesByProvince, realReportSalesByProvinceExport, realReportSalesBySubArea, realReportSalesBySubAreaExport } from '@/api/reportData.js'
+import { realReportSalesByProvince, realReportSalesByProvinceExport, subareaAreaReportTitle, subareaReportTitle, realReportSalesBySubArea, realReportSalesBySubAreaExport } from '@/api/reportData.js'
 export default {
   name: 'RegionTypeSalesReportList',
   mixins: [commonMixin],
@@ -96,6 +96,8 @@ export default {
       activeKey: 0,
       advanced: true, // 高级搜索 展开/关闭
       showExport: false,
+      columns: [],
+      totalData: null,
       queryParam: {
         time: [],
         beginDate: '',
@@ -132,48 +134,6 @@ export default {
       }
     }
   },
-  computed: {
-    columns () {
-      const _this = this
-      const arr = [
-        { title: '区域', dataIndex: 'subareaArea.subareaName', width: 50, align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '分区', dataIndex: 'subareaArea.subareaAreaName', width: 50, align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '销售状态', dataIndex: 'salesStatus', width: 50, align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '箭牌滤清器', dataIndex: 'jpLqqAmount', width: 50, align: 'center', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
-        { title: '冠牌滤清器', dataIndex: 'gpLqqAmount', width: 50, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
-        { title: '滤清器合计', dataIndex: 'lqqAmount', width: 50, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
-        { title: '箭牌雨刮片', dataIndex: 'jpYgpAmount', width: 50, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
-        { title: '冠牌雨刮片', dataIndex: 'gpYgpAmount', width: 50, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
-        { title: '雨刮片合计', dataIndex: 'ygpAmount', width: 50, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
-        { title: '箭牌刹车片', dataIndex: 'jpScpAmount', width: 50, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
-        { title: '箭牌感应线', dataIndex: 'jpGyxAmount', width: 50, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
-        { title: '冠牌刹车片', dataIndex: 'gpScpAmount', width: 50, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
-        { title: 'TBU刹车片', dataIndex: 'tbuScpAmount', width: 50, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
-        { title: 'TBU刹车油', dataIndex: 'tbuScyAmount', width: 50, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
-        { title: 'TBU感应线', dataIndex: 'tbuGyxAmount', width: 50, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
-        { title: '刹车片合计', dataIndex: 'scpAmount', width: 50, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
-        { title: 'TBU-P', dataIndex: 'tbupAmount', align: 'right', width: 50, customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
-        { title: '德路斯机油', dataIndex: 'dlsJyAmount', width: 50, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
-        { title: '德路斯刹车油', dataIndex: 'dlsScyAmount', width: 50, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
-        { title: '德路斯变速箱油', dataIndex: 'dlsBsxyAmount', width: 50, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
-        { title: '德路斯汽车养护产品', dataIndex: 'dlsQcyhAmount', width: 50, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
-        { title: '德路斯合计', dataIndex: 'dlsAmount', width: 50, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
-        { title: '稳升点火线圈', dataIndex: 'wsDhxqAmount', width: 50, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
-        { title: '稳升灯泡', dataIndex: 'wsDpAmount', width: 50, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
-        { title: '稳升合计', dataIndex: 'wsAmount', width: 50, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
-        { title: '汇箭', dataIndex: 'hjAmount', width: 50, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
-        { title: '布瑞斯', dataIndex: 'brsAmount', width: 50, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
-        { title: '箭牌喇叭', dataIndex: 'jpLbAmount', width: 50, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
-        { title: '品牌合计', dataIndex: 'ppAmount', width: 70, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
-        { title: 'NGK', dataIndex: 'ngkAmount', width: 50, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
-        { title: '品牌+NGK总合计', dataIndex: 'ppAndNgkAmount', width: 80, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } }
-      ]
-      if (this.activeKey == 0) {
-        arr.splice(1, 0, { title: '省份', dataIndex: 'dealerProvinceName', width: 50, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } })
-      }
-      return arr
-    }
-  },
   methods: {
     callback (key) {
       this.activeKey = key
@@ -202,7 +162,7 @@ export default {
         }
       })
     },
-    subareaChange(val){
+    subareaChange (val) {
       this.queryParam.subareaSn = val[0] ? val[0] : undefined
       this.queryParam.subareaAreaSn = val[1] ? val[1] : undefined
     },
@@ -242,9 +202,28 @@ export default {
         }
       })
     },
+    // 获取表头
+    async getTableTitle () {
+      const _this = this
+      const titUrl = _this.activeKey == 0 ? subareaAreaReportTitle : subareaReportTitle
+      const tableTitle = await titUrl().then(res => res.data)
+      this.columns = tableTitle.list
+      this.columns.map(item => {
+        let mw = 40
+        if (item.customRender == 'amount') {
+          mw = 15
+          item.customRender = function (text) { return (text || text == 0) ? _this.toThousands(text) : '--' }
+        }
+        const w = item.title.length * mw
+        const tw = w <= 80 && item.customRender != 'amount' ? w * 2 : (w >= 360 ? 200 : w)
+        item.width = tw + 'px'
+        this.tableWidth = this.tableWidth + tw
+      })
+      this.resetSearchForm()
+    },
     pageInit () {
       this.activeKey = 0
-      this.resetSearchForm()
+      this.getTableTitle()
     }
   },
   mounted () {
@@ -263,7 +242,3 @@ export default {
   }
 }
 </script>
-
-<style style="less">
-
-</style>