chenrui 2 éve
szülő
commit
8fb0a787e6

+ 27 - 10
src/api/reportData.js

@@ -26,9 +26,18 @@ export const salesReportReturnBillCount = (params) => {
     method: 'post'
   })
 }
-//  开单退货报表
+
+// 获取开单退货表头
+export const salesReturnReportTitle = (params) => {
+  return axios({
+    url: '/report/salesReturnReport/reportTitle',
+    data: params,
+    method: 'get'
+  })
+}
+//  开单退货报表 列表
 export const salesReportReturnList = (params) => {
-  const url = `/report/salesReturnBillReport/returnQueryPage/${params.pageNo}/${params.pageSize}`
+  const url = `/report/salesReturnReport/reportPage/${params.pageNo}/${params.pageSize}`
   delete params.pageNo
   delete params.pageSize
   return axios({
@@ -40,7 +49,7 @@ export const salesReportReturnList = (params) => {
 //  开单退货报表  合计
 export const salesReportReturnCount = (params) => {
   return axios({
-    url: '/report/salesReturnBillReport/returnQuerySum',
+    url: '/report/salesReturnReport/reportCount',
     data: params,
     method: 'post'
   })
@@ -189,7 +198,7 @@ export const salesReturnDetailExport = (params) => {
 // 开单销售单 导出
 export const salesSlipExport = (params) => {
   return axios({
-    url: '/report/salesBillReport/export',
+    url: '/report/salesKdxxd/reportExport',
     data: params,
     method: 'post',
     responseType: 'blob'
@@ -207,7 +216,7 @@ export const returnSlipExport = (params) => {
 // 开单销售 导出
 export const salesAmountExport = (params) => {
   return axios({
-    url: '/report/salesBillReport/queryGroupByBuyerExportExcel',
+    url: '/report/salesKdxx/reportExport',
     data: params,
     method: 'post',
     responseType: 'blob'
@@ -225,7 +234,7 @@ export const actualSalesExport = (params) => {
 // 开单退货 导出
 export const billingReturnExport = (params) => {
   return axios({
-    url: '/report/salesReturnBillReport/returnExportExcel',
+    url: '/report/salesReturnReport/reportExport',
     data: params,
     method: 'post',
     responseType: 'blob'
@@ -408,9 +417,17 @@ export const reportAllocateDbjdReportExport = (params) => {
     responseType: 'blob'
   })
 }
-//  退货交单报表
+// 获取退货交单报表 表头
+export const returnDocReportTitle = (params) => {
+  return axios({
+    url: '/report/returnDocReport/reportTitle',
+    data: params,
+    method: 'get'
+  })
+}
+//  退货交单报表 列表
 export const reportSalesReturnThjdReportList = (params) => {
-  const url = `/report/salesReturnBillReport/thjd/queryPage/${params.pageNo}/${params.pageSize}`
+  const url = `/report/returnDocReport/reportPage/${params.pageNo}/${params.pageSize}`
   delete params.pageNo
   delete params.pageSize
   return axios({
@@ -422,7 +439,7 @@ export const reportSalesReturnThjdReportList = (params) => {
 //  退货交单报表  合计
 export const reportSalesReturnThjdReportCount = (params) => {
   return axios({
-    url: '/report/salesReturnBillReport/thjd/querySum',
+    url: '/report/returnDocReport/reportCount',
     data: params,
     method: 'post'
   })
@@ -430,7 +447,7 @@ export const reportSalesReturnThjdReportCount = (params) => {
 // 退货交单报表 导出
 export const reportSalesReturnThjdReportExport = (params) => {
   return axios({
-    url: '/report/salesReturnBillReport/thjd/export',
+    url: '/report/returnDocReport/reportExport',
     data: params,
     method: 'post',
     responseType: 'blob'

+ 20 - 4
src/api/salesBillReport.js

@@ -9,9 +9,25 @@ export const salesDetailExport = (params) => {
     responseType: 'blob'
   })
 }
+// 获取开单销售dan报表 表头
+export const salesKdxxdReportTitle = (params) => {
+  return axios({
+    url: '/report/salesKdxxd/reportTitle',
+    data: params,
+    method: 'get'
+  })
+}
+// 获取开单销售报表 表头
+export const salesKdxxReportTitle = (params) => {
+  return axios({
+    url: '/report/salesKdxx/reportTitle',
+    data: params,
+    method: 'get'
+  })
+}
 //  开单销售单报表   列表  有分页
 export const salesBillReportList = (params) => {
-  const url = `/report/salesBillReport/queryPage/${params.pageNo}/${params.pageSize}`
+  const url = `/report/salesKdxxd/reportPage/${params.pageNo}/${params.pageSize}`
   delete params.pageNo
   delete params.pageSize
   return axios({
@@ -23,7 +39,7 @@ export const salesBillReportList = (params) => {
 
 //  开单销售报表   列表  有分页
 export const salesBillReportGroupByBuyerList = (params) => {
-  const url = `/report/salesBillReport/queryPageGroupByBuyer/${params.pageNo}/${params.pageSize}`
+  const url = `/report/salesKdxx/reportPage/${params.pageNo}/${params.pageSize}`
   delete params.pageNo
   delete params.pageSize
   return axios({
@@ -36,7 +52,7 @@ export const salesBillReportGroupByBuyerList = (params) => {
 //  开单销售单报表合计
 export const salesBillReportCount = (params) => {
   return axios({
-    url: '/report/salesBillReport/totalSaleAmount',
+    url: '/report/salesKdxxd/reportCount',
     data: params,
     method: 'post'
   })
@@ -45,7 +61,7 @@ export const salesBillReportCount = (params) => {
 //  开单销售报表合计
 export const salesBillReportCountByBuyer = (params) => {
   return axios({
-    url: '/report/salesBillReport/totalGroupByBuyer',
+    url: '/report/salesKdxx/reportCount',
     data: params,
     method: 'post'
   })

+ 1 - 1
src/views/reportData/billingBackReport/list.vue

@@ -60,7 +60,7 @@
         :showPagination="false"
         :scroll="{ x: 1550 }"
         bordered>
-        <template slot="footer">
+        <template slot="footer" v-if="countLabel.length>0">
           <a-row>
             <a-col span="2">合计:</a-col>
             <a-col span="22">

+ 2 - 2
src/views/reportData/billingOrderReport/list.vue

@@ -58,14 +58,14 @@
         ref="table"
         size="small"
         :defaultLoadData="false"
-        :rowKey="(record,index) => record.no"
+        :rowKey="(record) => record.no"
         :rowKeyName="no"
         :columns="columns"
         :data="loadData"
         :showPagination="false"
         :scroll="{ x: 1550 }"
         bordered>
-        <template slot="footer">
+        <template slot="footer" v-if="countLabel.length>0">
           <a-row>
             <a-col span="2">合计:</a-col>
             <a-col span="22">

+ 33 - 216
src/views/reportData/billingReturnReport/list.vue

@@ -41,7 +41,7 @@
             <template v-if="advanced">
               <a-col :md="6" :sm="24">
                 <a-form-model-item label="地区">
-                    <AreaList id="billingReturnReportList-areaList" changeOnSelect ref="areaList" @change="areaChange" defValKey="id"></AreaList>
+                  <AreaList id="billingReturnReportList-areaList" changeOnSelect ref="areaList" @change="areaChange" defValKey="id"></AreaList>
                 </a-form-model-item>
               </a-col>
             </template>
@@ -70,40 +70,21 @@
         class="sTable"
         ref="table"
         size="small"
-        :rowKey="(record) => record.id"
+        :rowKey="(record) => record.no"
+        :rowKeyName="no"
         :columns="columns"
         :data="loadData"
         :scroll="{ x: 2250, y: tableHeight }"
         :defaultLoadData="false"
         bordered>
-        <template slot="footer">
+        <template slot="footer" v-if="countLabel.length>0">
           <a-row>
             <a-col span="2">合计:</a-col>
             <a-col span="22">
               <a-row>
-                <a-col span="4">箭牌滤清器:{{ (totalData && (totalData.jpLqqAmount || totalData.jpLqqAmount==0)) ? totalData.jpLqqAmount : '--' }}</a-col>
-                <a-col span="4">箭牌雨刮片:{{ (totalData && (totalData.jpYgpAmount || totalData.jpYgpAmount==0)) ? totalData.jpYgpAmount : '--' }}</a-col>
-                <a-col span="4">箭牌喇叭:{{ (totalData && (totalData.jpLbAmount || totalData.jpLbAmount==0)) ? totalData.jpLbAmount : '--' }}</a-col>
-                <a-col span="4">箭牌刹车片:{{ (totalData && (totalData.jpScpAmount || totalData.jpScpAmount==0)) ? totalData.jpScpAmount : '--' }}</a-col>
-                <a-col span="4">箭牌感应线:{{ (totalData && (totalData.jpGyxAmount || totalData.jpGyxAmount==0)) ? totalData.jpGyxAmount : '--' }}</a-col>
-                <a-col span="4">冠牌滤清器:{{ (totalData && (totalData.gpLqqAmount || totalData.gpLqqAmount==0)) ? totalData.gpLqqAmount : '--' }}</a-col>
-                <a-col span="4">冠牌雨刮片:{{ (totalData && (totalData.gpYgpAmount || totalData.gpYgpAmount==0)) ? totalData.gpYgpAmount : '--' }}</a-col>
-                <a-col span="4">冠牌刹车片:{{ (totalData && (totalData.gpScpAmount || totalData.gpScpAmount==0)) ? totalData.gpScpAmount : '--' }}</a-col>
-                <a-col span="4">汇箭:{{ (totalData && (totalData.hjAmount || totalData.hjAmount==0)) ? totalData.hjAmount : '--' }}</a-col>
-                <a-col span="4">德路斯:{{ (totalData && (totalData.dlsAmount || totalData.dlsAmount==0)) ? totalData.dlsAmount : '--' }}</a-col>
-                <a-col span="4">稳升:{{ (totalData && (totalData.wsAmount || totalData.wsAmount==0)) ? totalData.wsAmount : '--' }}</a-col>
-                <a-col span="4">TBU:{{ (totalData && (totalData.tbuAmount || totalData.tbuAmount==0)) ? totalData.tbuAmount : '--' }}</a-col>
-                <a-col span="4">TBU-P:{{ (totalData && (totalData.tbupAmount || totalData.tbupAmount==0)) ? totalData.tbupAmount : '--' }}</a-col>
-                <a-col span="4">布瑞斯:{{ (totalData && (totalData.brsAmount || totalData.brsAmount==0)) ? totalData.brsAmount : '--' }}</a-col>
-                <a-col span="4">NGK:{{ (totalData && (totalData.ngkAmount || totalData.ngkAmount==0)) ? totalData.ngkAmount : '--' }}</a-col>
-                <a-col span="4">飞利浦:{{ (totalData && (totalData.flpAmount || totalData.flpAmount==0)) ? totalData.flpAmount : '--' }}</a-col>
-                <a-col span="4">车仆:{{ (totalData && (totalData.cpAmount || totalData.cpAmount==0)) ? totalData.cpAmount : '--' }}</a-col>
-                <a-col span="4">瓦尔塔:{{ (totalData && (totalData.wetAmount || totalData.wetAmount==0)) ? totalData.wetAmount : '--' }}</a-col>
-                <a-col span="4">雷贝斯托:{{ (totalData && (totalData.lbstAmount || totalData.lbstAmount==0)) ? totalData.lbstAmount : '--' }}</a-col>
-                <a-col span="4">德尔福:{{ (totalData && (totalData.defAmount || totalData.defAmount==0)) ? totalData.defAmount : '--' }}</a-col>
-                <a-col span="4">巴诺德:{{ (totalData && (totalData.bndAmount || totalData.bndAmount==0)) ? totalData.bndAmount : '--' }}</a-col>
-                <a-col span="6">开单退货合计金额:{{ (totalData && (totalData.totalAmount || totalData.totalAmount==0)) ? toThousands(totalData.totalAmount) : '--' }}</a-col>
-                <!-- <a-col span="6" v-if="$hasPermissions('B_isShowPrice')">开单退货合计金额:{{ (totalData && (totalData.totalAmount || totalData.totalAmount==0)) ? toThousands(totalData.totalAmount) : '--' }}</a-col> -->
+                <a-col span="4" v-for="item in countLabel" :key="item.key">
+                  {{ item.title }}:{{ totalData?(totalData[item.dataIndex]||totalData[item.dataIndex]==0)?toThousands(totalData[item.dataIndex]):'--':'--' }}
+                </a-col>
               </a-row>
             </a-col>
           </a-row>
@@ -125,7 +106,7 @@ import subarea from '@/views/common/subarea.js'
 import reportModal from '@/views/common/reportModal.vue'
 import AreaList from '@/views/common/areaList.js'
 import { hdExportExcel } from '@/libs/exportExcel'
-import { salesReportReturnList, salesReportReturnCount, billingReturnExport } from '@/api/reportData'
+import { salesReportReturnList, salesReportReturnCount, billingReturnExport, salesReturnReportTitle } from '@/api/reportData'
 export default {
   name: 'BillingReturnReportList',
   mixins: [commonMixin],
@@ -180,194 +161,11 @@ export default {
         })
       },
       productType: [],
+      columns: [],
+      countLabel: [],
       totalData: null
     }
   },
-  computed: {
-    columns () {
-      const _this = this
-      const arr = [
-        { title: '区域', dataIndex: 'dealer.subareaNameSet', width: 120, align: 'center', customRender: function (text) { return (text && text.length > 0) ? text.join('/') : '--' } },
-        { title: '省份', dataIndex: 'dealer.provinceName', width: 90, align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '客户名称', dataIndex: 'dealer.dealerName', width: 120, align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
-        { title: '客户级别', dataIndex: 'dealer.dealerLevelDictValue', width: 120, align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '品牌',
-          align: 'center',
-          children: [
-            {
-              title: '箭牌',
-              align: 'center',
-              children: [
-                {
-                  title: '滤清器',
-                  dataIndex: 'jpLqqAmount',
-                  align: 'center',
-                  width: 80,
-                  customRender: function (text) { return (text || text == 0) ? ('¥' + text) : '--' }
-                },
-                {
-                  title: '雨刮片',
-                  dataIndex: 'jpYgpAmount',
-                  align: 'center',
-                  width: 80,
-                  customRender: function (text) { return (text || text == 0) ? ('¥' + text) : '--' }
-                },
-                {
-                  title: '喇叭',
-                  dataIndex: 'jpLbAmount',
-                  align: 'center',
-                  width: 80,
-                  customRender: function (text) { return (text || text == 0) ? ('¥' + text) : '--' }
-                },
-                {
-                  title: '刹车片',
-                  dataIndex: 'jpScpAmount',
-                  align: 'center',
-                  width: 80,
-                  customRender: function (text) { return (text || text == 0) ? ('¥' + text) : '--' }
-                },
-                {
-                  title: '感应线',
-                  dataIndex: 'jpGyxAmount',
-                  align: 'center',
-                  width: 80,
-                  customRender: function (text) { return (text || text == 0) ? ('¥' + text) : '--' }
-                }
-              ]
-            },
-            {
-              title: '冠牌',
-              align: 'center',
-              children: [
-                {
-                  title: '滤清器',
-                  dataIndex: 'gpLqqAmount',
-                  align: 'center',
-                  width: 80,
-                  customRender: function (text) { return (text || text == 0) ? ('¥' + text) : '--' }
-                },
-                {
-                  title: '雨刮片',
-                  dataIndex: 'gpYgpAmount',
-                  align: 'center',
-                  width: 80,
-                  customRender: function (text) { return (text || text == 0) ? ('¥' + text) : '--' }
-                },
-                {
-                  title: '刹车片',
-                  dataIndex: 'gpScpAmount',
-                  align: 'center',
-                  width: 80,
-                  customRender: function (text) { return (text || text == 0) ? ('¥' + text) : '--' }
-                }
-              ]
-            },
-            {
-              title: '汇箭',
-              dataIndex: 'hjAmount',
-              align: 'center',
-              width: 80,
-              customRender: function (text) { return (text || text == 0) ? ('¥' + text) : '--' }
-            },
-            {
-              title: '德路斯',
-              dataIndex: 'dlsAmount',
-              align: 'center',
-              width: 80,
-              customRender: function (text) { return (text || text == 0) ? ('¥' + text) : '--' }
-            },
-            {
-              title: '稳升',
-              dataIndex: 'wsAmount',
-              align: 'center',
-              width: 80,
-              customRender: function (text) { return (text || text == 0) ? ('¥' + text) : '--' }
-            },
-            {
-              title: 'TBU',
-              dataIndex: 'tbuAmount',
-              align: 'center',
-              width: 80,
-              customRender: function (text) { return (text || text == 0) ? ('¥' + text) : '--' }
-            },
-            {
-              title: 'TBU-P',
-              dataIndex: 'tbupAmount',
-              align: 'center',
-              width: 80,
-              customRender: function (text) { return (text || text == 0) ? ('¥' + text) : '--' }
-            },
-            {
-              title: '布瑞斯',
-              dataIndex: 'brsAmount',
-              align: 'center',
-              width: 80,
-              customRender: function (text) { return (text || text == 0) ? ('¥' + text) : '--' }
-            }
-          ]
-        },
-        { title: '代理品牌',
-          align: 'center',
-          children: [
-            {
-              title: 'NGK',
-              dataIndex: 'ngkAmount',
-              align: 'center',
-              width: 80,
-              customRender: function (text) { return (text || text == 0) ? ('¥' + text) : '--' }
-            },
-            {
-              title: '飞利浦',
-              dataIndex: 'flpAmount',
-              align: 'center',
-              width: 80,
-              customRender: function (text) { return (text || text == 0) ? ('¥' + text) : '--' }
-            },
-            {
-              title: '车仆',
-              dataIndex: 'cpAmount',
-              align: 'center',
-              width: 80,
-              customRender: function (text) { return (text || text == 0) ? ('¥' + text) : '--' }
-            },
-            {
-              title: '瓦尔塔',
-              dataIndex: 'wetAmount',
-              align: 'center',
-              width: 80,
-              customRender: function (text) { return (text || text == 0) ? ('¥' + text) : '--' }
-            },
-            {
-              title: '雷贝斯托',
-              dataIndex: 'lbstAmount',
-              align: 'center',
-              width: 80,
-              customRender: function (text) { return (text || text == 0) ? ('¥' + text) : '--' }
-            },
-            {
-              title: '德尔福',
-              dataIndex: 'defAmount',
-              align: 'center',
-              width: 80,
-              customRender: function (text) { return (text || text == 0) ? ('¥' + text) : '--' }
-            },
-            {
-              title: '巴诺德',
-              dataIndex: 'bndAmount',
-              align: 'center',
-              width: 80,
-              customRender: function (text) { return (text || text == 0) ? ('¥' + text) : '--' }
-            }
-          ]
-        }
-        // { title: '开单退货合计金额', width: 90, dataIndex: 'totalAmount', align: 'center', customRender: function (text) { return (text || text == 0) ? ('¥' + text) : '--' } }
-      ]
-      // if (this.$hasPermissions('B_isShowPrice')) { //  售价权限
-      arr.splice(arr.length, 0, { title: '开单退货合计金额', width: 90, dataIndex: 'totalAmount', align: 'right', customRender: function (text) { return (text || text == 0) ? _this.toThousands(text) : '--' } })
-      // }
-      return arr
-    }
-  },
   methods: {
     //  导出
     handleExport () {
@@ -405,7 +203,7 @@ export default {
         if (valid) {
           _this.$refs.table.refresh(true)
         } else {
-          _this.$message.error("请选择退货时间")
+          _this.$message.error('请选择退货时间')
           return false
         }
       })
@@ -446,21 +244,40 @@ export default {
       this.$refs.ruleForm.resetFields()
       this.$refs.table.clearTable()
     },
-    areaChange(val){
+    areaChange (val) {
       this.queryParam.provinceSn = val[0] ? val[0] : ''
       this.queryParam.citySn = val[1] ? val[1] : ''
       this.queryParam.districtSn = val[2] ? val[2] : ''
     },
+    // 获取表头
+    async getTableTitle () {
+      const _this = this
+      const tableTitle = await salesReturnReportTitle().then(res => res.data)
+      this.columns = tableTitle.list
+      this.countLabel = tableTitle.count
+      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()
+    }
   },
   mounted () {
     if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
-      this.resetSearchForm()
+      this.getTableTitle()
     }
   },
   activated () {
     // 如果是新页签打开,则重置当前页面
     if (this.$store.state.app.isNewTab) {
-      this.resetSearchForm()
+      this.getTableTitle()
     }
   },
   beforeRouteEnter (to, from, next) {

+ 33 - 253
src/views/reportData/returnGoodsPresentation/list.vue

@@ -46,7 +46,7 @@
               </a-col>
               <a-col :md="6" :sm="24">
                 <a-form-model-item label="地区">
-                    <AreaList id="returnGoodsPresentationList-areaList" changeOnSelect ref="areaList" @change="areaChange" defValKey="id"></AreaList>
+                  <AreaList id="returnGoodsPresentationList-areaList" changeOnSelect ref="areaList" @change="areaChange" defValKey="id"></AreaList>
                 </a-form-model-item>
               </a-col>
             </template>
@@ -76,42 +76,20 @@
         ref="table"
         size="small"
         :defaultLoadData="false"
-        :rowKey="(record) => record.id"
+        :rowKey="(record) => record.no"
+        :rowKeyName="no"
         :columns="columns"
         :data="loadData"
         :scroll="{ x: 2370 }"
         bordered>
-        <template slot="footer">
+        <template slot="footer" v-if="countLabel.length>0">
           <a-row>
             <a-col span="2">合计:</a-col>
             <a-col span="22">
               <a-row>
-                <a-col span="4">箭牌滤清器:{{ (totalData && (totalData.jpLqqAmount || totalData.jpLqqAmount==0)) ? toThousands(totalData.jpLqqAmount) : '--' }}</a-col>
-                <a-col span="4">箭牌变速箱滤清器:{{ (totalData && (totalData.jpBsxLqqAmount || totalData.jpBsxLqqAmount==0)) ? toThousands(totalData.jpBsxLqqAmount) : '--' }}</a-col>
-                <a-col span="4">箭牌雨刮片:{{ (totalData && (totalData.jpYgpAmount || totalData.jpYgpAmount==0)) ? toThousands(totalData.jpYgpAmount) : '--' }}</a-col>
-                <a-col span="4">箭牌喇叭:{{ (totalData && (totalData.jpLbAmount || totalData.jpLbAmount==0)) ? toThousands(totalData.jpLbAmount) : '--' }}</a-col>
-                <a-col span="4">箭牌刹车片:{{ (totalData && (totalData.jpScpAmount || totalData.jpScpAmount==0)) ? toThousands(totalData.jpScpAmount) : '--' }}</a-col>
-                <a-col span="4">箭牌感应线:{{ (totalData && (totalData.jpGyxAmount || totalData.jpGyxAmount==0)) ? toThousands(totalData.jpGyxAmount) : '--' }}</a-col>
-                <a-col span="4">冠牌滤清器:{{ (totalData && (totalData.gpLqqAmount || totalData.gpLqqAmount==0)) ? toThousands(totalData.gpLqqAmount) : '--' }}</a-col>
-                <a-col span="4">冠牌雨刮片:{{ (totalData && (totalData.gpYgpAmount || totalData.gpYgpAmount==0)) ? toThousands(totalData.gpYgpAmount) : '--' }}</a-col>
-                <a-col span="4">冠牌刹车片:{{ (totalData && (totalData.gpScpAmount || totalData.gpScpAmount==0)) ? toThousands(totalData.gpScpAmount) : '--' }}</a-col>
-                <a-col span="4">稳升点火线圈:{{ (totalData && (totalData.wsDhxqAmount || totalData.wsDhxqAmount==0)) ? toThousands(totalData.wsDhxqAmount) : '--' }}</a-col>
-                <a-col span="4">稳升灯泡:{{ (totalData && (totalData.wsDpAmount || totalData.wsDpAmount==0)) ? toThousands(totalData.wsDpAmount) : '--' }}</a-col>
-                <a-col span="4">汇箭:{{ (totalData && (totalData.hjAmount || totalData.hjAmount==0)) ? toThousands(totalData.hjAmount) : '--' }}</a-col>
-                <a-col span="4">德路斯:{{ (totalData && (totalData.dlsAmount || totalData.dlsAmount==0)) ? toThousands(totalData.dlsAmount) : '--' }}</a-col>
-                <a-col span="4">TBU刹车片:{{ (totalData && (totalData.tbuScpAmount || totalData.tbuScpAmount==0)) ? toThousands(totalData.tbuScpAmount) : '--' }}</a-col>
-                <a-col span="4">TBU刹车油:{{ (totalData && (totalData.tbuScyAmount || totalData.tbuScyAmount==0)) ? toThousands(totalData.tbuScyAmount) : '--' }}</a-col>
-                <a-col span="4">TBU-P:{{ (totalData && (totalData.tbupAmount || totalData.tbupAmount==0)) ? toThousands(totalData.tbupAmount) : '--' }}</a-col>
-                <a-col span="4">布瑞斯:{{ (totalData && (totalData.brsAmount || totalData.brsAmount==0)) ? toThousands(totalData.brsAmount) : '--' }}</a-col>
-                <a-col span="4">NGK:{{ (totalData && (totalData.ngkAmount || totalData.ngkAmount==0)) ? toThousands(totalData.ngkAmount) : '--' }}</a-col>
-                <a-col span="4">飞利浦:{{ (totalData && (totalData.flpAmount || totalData.flpAmount==0)) ? toThousands(totalData.flpAmount) : '--' }}</a-col>
-                <a-col span="4">车仆:{{ (totalData && (totalData.cpAmount || totalData.cpAmount==0)) ? toThousands(totalData.cpAmount) : '--' }}</a-col>
-                <a-col span="4">瓦尔塔:{{ (totalData && (totalData.wetAmount || totalData.wetAmount==0)) ? toThousands(totalData.wetAmount) : '--' }}</a-col>
-                <a-col span="4">雷贝斯托:{{ (totalData && (totalData.lbstAmount || totalData.lbstAmount==0)) ? toThousands(totalData.lbstAmount) : '--' }}</a-col>
-                <a-col span="4">德尔福:{{ (totalData && (totalData.defAmount || totalData.defAmount==0)) ? toThousands(totalData.defAmount) : '--' }}</a-col>
-                <a-col span="4">巴诺德:{{ (totalData && (totalData.bndAmount || totalData.bndAmount==0)) ? toThousands(totalData.bndAmount) : '--' }}</a-col>
-                <!-- v-if="$hasPermissions('B_isShowPrice')" -->
-                <a-col span="6">开单销售单合计金额:{{ (totalData && (totalData.totalAmount || totalData.totalAmount==0)) ? toThousands(totalData.totalAmount) : '--' }}</a-col>
+                <a-col span="4" v-for="item in countLabel" :key="item.key">
+                  {{ item.title }}:{{ totalData?(totalData[item.dataIndex]||totalData[item.dataIndex]==0)?toThousands(totalData[item.dataIndex]):'--':'--' }}
+                </a-col>
               </a-row>
             </a-col>
           </a-row>
@@ -131,7 +109,7 @@ import subarea from '@/views/common/subarea.js'
 import AreaList from '@/views/common/areaList.js'
 import reportModal from '@/views/common/reportModal.vue'
 import { hdExportExcel } from '@/libs/exportExcel'
-import { reportSalesReturnThjdReportList, reportSalesReturnThjdReportCount, reportSalesReturnThjdReportExport } from '@/api/reportData'
+import { returnDocReportTitle, reportSalesReturnThjdReportList, reportSalesReturnThjdReportCount, reportSalesReturnThjdReportExport } from '@/api/reportData'
 export default {
   name: 'ReturnGoodsPresentationList',
   mixins: [commonMixin],
@@ -155,6 +133,8 @@ export default {
           'dealerLevel': undefined
         }
       },
+      columns: [],
+      countLabel: [],
       rules: {
         'time': [{ required: true, message: '请选择调拨日期', trigger: 'change' }]
       },
@@ -183,225 +163,6 @@ export default {
       totalData: null
     }
   },
-  computed: {
-    columns () {
-      const _this = this
-      const arr = [
-        { title: '区域', dataIndex: 'dealer.subareaNameSet', width: 120, align: 'center', customRender: function (text) { return (text && text.length > 0) ? text.join('/') : '--' } },
-        { title: '退货单号', dataIndex: 'salesReturnBillNo', width: 160, align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '省份', dataIndex: 'dealer.provinceName', width: 90, align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '客户名称', dataIndex: 'dealer.dealerName', width: 120, align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
-        { title: '客户级别', dataIndex: 'dealer.dealerLevelDictValue', width: 120, align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '品牌',
-          align: 'center',
-          children: [
-            {
-              title: '箭牌',
-              align: 'right',
-              children: [
-                {
-                  title: '滤清器',
-                  dataIndex: 'jpLqqAmount',
-                  align: 'right',
-                  width: 80,
-                  customRender: function (text) { return (text || text == 0) ? _this.toThousands(text) : '--' }
-                },
-                {
-                  title: '变速箱滤清器',
-                  dataIndex: 'jpBsxLqqAmount',
-                  align: 'right',
-                  width: 80,
-                  customRender: function (text) { return (text || text == 0) ? _this.toThousands(text) : '--' }
-                },
-                {
-                  title: '雨刮片',
-                  dataIndex: 'jpYgpAmount',
-                  align: 'right',
-                  width: 80,
-                  customRender: function (text) { return (text || text == 0) ? _this.toThousands(text) : '--' }
-                },
-                {
-                  title: '喇叭',
-                  dataIndex: 'jpLbAmount',
-                  align: 'right',
-                  width: 80,
-                  customRender: function (text) { return (text || text == 0) ? _this.toThousands(text) : '--' }
-                },
-                {
-                  title: '刹车片',
-                  dataIndex: 'jpScpAmount',
-                  align: 'right',
-                  width: 80,
-                  customRender: function (text) { return (text || text == 0) ? _this.toThousands(text) : '--' }
-                },
-                {
-                  title: '感应线',
-                  dataIndex: 'jpGyxAmount',
-                  align: 'right',
-                  width: 80,
-                  customRender: function (text) { return (text || text == 0) ? _this.toThousands(text) : '--' }
-                }
-              ]
-            },
-            {
-              title: '冠牌',
-              align: 'right',
-              children: [
-                {
-                  title: '滤清器',
-                  dataIndex: 'gpLqqAmount',
-                  align: 'right',
-                  width: 80,
-                  customRender: function (text) { return (text || text == 0) ? _this.toThousands(text) : '--' }
-                },
-                {
-                  title: '雨刮片',
-                  dataIndex: 'gpYgpAmount',
-                  align: 'right',
-                  width: 80,
-                  customRender: function (text) { return (text || text == 0) ? _this.toThousands(text) : '--' }
-                },
-                {
-                  title: '刹车片',
-                  dataIndex: 'gpScpAmount',
-                  align: 'right',
-                  width: 80,
-                  customRender: function (text) { return (text || text == 0) ? _this.toThousands(text) : '--' }
-                }
-              ]
-            },
-            {
-              title: '稳升',
-              align: 'right',
-              children: [
-                {
-                  title: '点火线圈',
-                  dataIndex: 'wsDhxqAmount',
-                  align: 'right',
-                  width: 80,
-                  customRender: function (text) { return (text || text == 0) ? _this.toThousands(text) : '--' }
-                },
-                {
-                  title: '灯泡',
-                  dataIndex: 'wsDpAmount',
-                  align: 'right',
-                  width: 80,
-                  customRender: function (text) { return (text || text == 0) ? _this.toThousands(text) : '--' }
-                }
-              ]
-            },
-            {
-              title: '汇箭',
-              dataIndex: 'hjAmount',
-              align: 'right',
-              width: 80,
-              customRender: function (text) { return (text || text == 0) ? _this.toThousands(text) : '--' }
-            },
-            {
-              title: '德路斯',
-              dataIndex: 'dlsAmount',
-              align: 'right',
-              width: 80,
-              customRender: function (text) { return (text || text == 0) ? _this.toThousands(text) : '--' }
-            },
-            {
-              title: 'TBU',
-              align: 'right',
-              children: [
-                {
-                  title: '刹车片',
-                  dataIndex: 'tbuScpAmount',
-                  align: 'right',
-                  width: 80,
-                  customRender: function (text) { return (text || text == 0) ? _this.toThousands(text) : '--' }
-                },
-                {
-                  title: '刹车油',
-                  dataIndex: 'tbuScyAmount',
-                  align: 'right',
-                  width: 80,
-                  customRender: function (text) { return (text || text == 0) ? _this.toThousands(text) : '--' }
-                }
-              ]
-            },
-            {
-              title: 'TBU-P',
-              dataIndex: 'tbupAmount',
-              align: 'right',
-              width: 80,
-              customRender: function (text) { return (text || text == 0) ? _this.toThousands(text) : '--' }
-            },
-            {
-              title: '布瑞斯',
-              dataIndex: 'brsAmount',
-              align: 'right',
-              width: 80,
-              customRender: function (text) { return (text || text == 0) ? _this.toThousands(text) : '--' }
-            }
-          ]
-        },
-        { title: '代理品牌',
-          align: 'center',
-          children: [
-            {
-              title: 'NGK',
-              dataIndex: 'ngkAmount',
-              align: 'right',
-              width: 80,
-              customRender: function (text) { return (text || text == 0) ? _this.toThousands(text) : '--' }
-            },
-            {
-              title: '飞利浦',
-              dataIndex: 'flpAmount',
-              align: 'right',
-              width: 80,
-              customRender: function (text) { return (text || text == 0) ? _this.toThousands(text) : '--' }
-            },
-            {
-              title: '车仆',
-              dataIndex: 'cpAmount',
-              align: 'right',
-              width: 80,
-              customRender: function (text) { return (text || text == 0) ? _this.toThousands(text) : '--' }
-            },
-            {
-              title: '瓦尔塔',
-              dataIndex: 'wetAmount',
-              align: 'right',
-              width: 80,
-              customRender: function (text) { return (text || text == 0) ? _this.toThousands(text) : '--' }
-            },
-            {
-              title: '雷贝斯托',
-              dataIndex: 'lbstAmount',
-              align: 'right',
-              width: 80,
-              customRender: function (text) { return (text || text == 0) ? _this.toThousands(text) : '--' }
-            },
-            {
-              title: '德尔福',
-              dataIndex: 'defAmount',
-              align: 'right',
-              width: 80,
-              customRender: function (text) { return (text || text == 0) ? _this.toThousands(text) : '--' }
-            },
-            {
-              title: '巴诺德',
-              dataIndex: 'bndAmount',
-              align: 'right',
-              width: 80,
-              customRender: function (text) { return (text || text == 0) ? _this.toThousands(text) : '--' }
-            }
-          ]
-        }
-        // { title: '开单退货单合计金额', width: 90, dataIndex: 'totalAmount', align: 'center', customRender: function (text) { return (text || text == 0) ?  _this.toThousands(text) : '--' } }
-      ]
-      // if (this.$hasPermissions('B_isShowPrice')) { //  售价权限
-      arr.splice(arr.length, 0, { title: '开单退货单合计金额', width: 90, dataIndex: 'totalAmount', align: 'right', customRender: function (text) { return (text || text == 0) ? _this.toThousands(text) : '--' } })
-      // }
-      return arr
-    }
-  },
   methods: {
     //  导出
     handleExport () {
@@ -440,7 +201,7 @@ export default {
         if (valid) {
           _this.$refs.table.refresh(true)
         } else {
-          _this.$message.error("请选择调拨日期")
+          _this.$message.error('请选择调拨日期')
           return false
         }
       })
@@ -477,13 +238,32 @@ export default {
       this.$refs.ruleForm.resetFields()
       this.$refs.table.clearTable()
     },
-    areaChange(val){
+    areaChange (val) {
       this.queryParam.dealer.provinceSn = val[0] ? val[0] : ''
       this.queryParam.dealer.citySn = val[1] ? val[1] : ''
       this.queryParam.dealer.districtSn = val[2] ? val[2] : ''
-    },  
-    pageInit () {
+    },
+    // 获取表头
+    async getTableTitle () {
+      const _this = this
+      const tableTitle = await returnDocReportTitle().then(res => res.data)
+      this.columns = tableTitle.list
+      this.countLabel = tableTitle.count
+      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.getTableTitle()
     }
   },
   mounted () {

+ 34 - 217
src/views/reportData/salesAmountReport/list.vue

@@ -41,7 +41,7 @@
             <template v-if="advanced">
               <a-col :md="6" :sm="24">
                 <a-form-model-item label="地区">
-                    <AreaList id="salesAmountReportList-areaList" changeOnSelect ref="areaList" @change="areaChange" defValKey="id"></AreaList>
+                  <AreaList id="salesAmountReportList-areaList" changeOnSelect ref="areaList" @change="areaChange" defValKey="id"></AreaList>
                 </a-form-model-item>
               </a-col>
             </template>
@@ -71,39 +71,20 @@
         ref="table"
         size="small"
         :defaultLoadData="false"
-        :rowKey="(record) => record.id"
+        :rowKey="(record) => record.no"
+        :rowKeyName="no"
         :columns="columns"
         :data="loadData"
         :scroll="{ x: 2250 }"
         bordered>
-        <template slot="footer">
+        <template slot="footer" v-if="countLabel.length>0">
           <a-row>
             <a-col span="2">合计:</a-col>
             <a-col span="22">
               <a-row>
-                <a-col span="4">箭牌滤清器:{{ (totalData && (totalData.jpLqqAmount || totalData.jpLqqAmount==0)) ? toThousands(totalData.jpLqqAmount) : '--' }}</a-col>
-                <a-col span="4">箭牌雨刮片:{{ (totalData && (totalData.jpYgpAmount || totalData.jpYgpAmount==0)) ? toThousands(totalData.jpYgpAmount) : '--' }}</a-col>
-                <a-col span="4">箭牌喇叭:{{ (totalData && (totalData.jpLbAmount || totalData.jpLbAmount==0)) ? toThousands(totalData.jpLbAmount) : '--' }}</a-col>
-                <a-col span="4">箭牌刹车片:{{ (totalData && (totalData.jpScpAmount || totalData.jpScpAmount==0)) ? toThousands(totalData.jpScpAmount) : '--' }}</a-col>
-                <a-col span="4">箭牌感应线:{{ (totalData && (totalData.jpGyxAmount || totalData.jpGyxAmount==0)) ? toThousands(totalData.jpGyxAmount) : '--' }}</a-col>
-                <a-col span="4">冠牌滤清器:{{ (totalData && (totalData.gpLqqAmount || totalData.gpLqqAmount==0)) ? toThousands(totalData.gpLqqAmount) : '--' }}</a-col>
-                <a-col span="4">冠牌雨刮片:{{ (totalData && (totalData.gpYgpAmount || totalData.gpYgpAmount==0)) ? toThousands(totalData.gpYgpAmount) : '--' }}</a-col>
-                <a-col span="4">冠牌刹车片:{{ (totalData && (totalData.gpScpAmount || totalData.gpScpAmount==0)) ? toThousands(totalData.gpScpAmount) : '--' }}</a-col>
-                <a-col span="4">汇箭:{{ (totalData && (totalData.hjAmount || totalData.hjAmount==0)) ? toThousands(totalData.hjAmount) : '--' }}</a-col>
-                <a-col span="4">德路斯:{{ (totalData && (totalData.dlsAmount || totalData.dlsAmount==0)) ? toThousands(totalData.dlsAmount) : '--' }}</a-col>
-                <a-col span="4">稳升:{{ (totalData && (totalData.wsAmount || totalData.wsAmount==0)) ? toThousands(totalData.wsAmount) : '--' }}</a-col>
-                <a-col span="4">TBU:{{ (totalData && (totalData.tbuAmount || totalData.tbuAmount==0)) ? toThousands(totalData.tbuAmount) : '--' }}</a-col>
-                <a-col span="4">TBU-P:{{ (totalData && (totalData.tbupAmount || totalData.tbupAmount==0)) ? toThousands(totalData.tbupAmount) : '--' }}</a-col>
-                <a-col span="4">布瑞斯:{{ (totalData && (totalData.brsAmount || totalData.brsAmount==0)) ? toThousands(totalData.brsAmount) : '--' }}</a-col>
-                <a-col span="4">NGK:{{ (totalData && (totalData.ngkAmount || totalData.ngkAmount==0)) ? toThousands(totalData.ngkAmount) : '--' }}</a-col>
-                <a-col span="4">飞利浦:{{ (totalData && (totalData.flpAmount || totalData.flpAmount==0)) ? toThousands(totalData.flpAmount) : '--' }}</a-col>
-                <a-col span="4">车仆:{{ (totalData && (totalData.cpAmount || totalData.cpAmount==0)) ? toThousands(totalData.cpAmount) : '--' }}</a-col>
-                <a-col span="4">瓦尔塔:{{ (totalData && (totalData.wetAmount || totalData.wetAmount==0)) ? toThousands(totalData.wetAmount) : '--' }}</a-col>
-                <a-col span="4">雷贝斯托:{{ (totalData && (totalData.lbstAmount || totalData.lbstAmount==0)) ? toThousands(totalData.lbstAmount) : '--' }}</a-col>
-                <a-col span="4">德尔福:{{ (totalData && (totalData.defAmount || totalData.defAmount==0)) ? toThousands(totalData.defAmount) : '--' }}</a-col>
-                <a-col span="4">巴诺德:{{ (totalData && (totalData.bndAmount || totalData.bndAmount==0)) ? toThousands(totalData.bndAmount) : '--' }}</a-col>
-                <!-- v-if="$hasPermissions('B_isShowPrice')" -->
-                <a-col span="6">开单销售合计金额:{{ (totalData && (totalData.totalAmount || totalData.totalAmount==0)) ? toThousands(totalData.totalAmount) : '--' }}</a-col>
+                <a-col span="4" v-for="item in countLabel" :key="item.key">
+                  {{ item.title }}:{{ totalData?(totalData[item.dataIndex]||totalData[item.dataIndex]==0)?toThousands(totalData[item.dataIndex]):'--':'--' }}
+                </a-col>
               </a-row>
             </a-col>
           </a-row>
@@ -125,7 +106,7 @@ import subarea from '@/views/common/subarea.js'
 import reportModal from '@/views/common/reportModal.vue'
 import AreaList from '@/views/common/areaList.js'
 import { hdExportExcel } from '@/libs/exportExcel'
-import { salesBillReportGroupByBuyerList, salesBillReportCountByBuyer } from '@/api/salesBillReport'
+import { salesKdxxReportTitle, salesBillReportGroupByBuyerList, salesBillReportCountByBuyer } from '@/api/salesBillReport'
 import { salesAmountExport } from '@/api/reportData'
 export default {
   name: 'SalesAmountReportList',
@@ -153,6 +134,8 @@ export default {
           'dealerLevel': undefined
         }
       },
+      columns: [],
+      countLabel: [],
       rules: {
         'time': [{ required: true, message: '请选择销售日期', trigger: 'change' }]
       },
@@ -184,191 +167,6 @@ export default {
       totalData: null
     }
   },
-  computed: {
-    columns () {
-      const _this = this
-      const arr = [
-        { title: '区域', dataIndex: 'dealer.subareaNameSet', width: 120, align: 'center', customRender: function (text) { return (text && text.length > 0) ? text.join('/') : '--' } },
-        { title: '省份', dataIndex: 'dealer.provinceName', width: 90, align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '客户名称', dataIndex: 'dealer.dealerName', width: 120, align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
-        { title: '客户级别', dataIndex: 'dealer.dealerLevelDictValue', width: 120, align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '品牌',
-          align: 'center',
-          children: [
-            {
-              title: '箭牌',
-              align: 'center',
-              children: [
-                {
-                  title: '滤清器',
-                  dataIndex: 'jpLqqAmount',
-                  align: 'right',
-                  width: 80,
-                  customRender: function (text) { return (text || text == 0) ? _this.toThousands(text) : '--' }
-                },
-                {
-                  title: '雨刮片',
-                  dataIndex: 'jpYgpAmount',
-                  align: 'right',
-                  width: 80,
-                  customRender: function (text) { return (text || text == 0) ? _this.toThousands(text) : '--' }
-                },
-                {
-                  title: '喇叭',
-                  dataIndex: 'jpLbAmount',
-                  align: 'right',
-                  width: 80,
-                  customRender: function (text) { return (text || text == 0) ? _this.toThousands(text) : '--' }
-                },
-                {
-                  title: '刹车片',
-                  dataIndex: 'jpScpAmount',
-                  align: 'right',
-                  width: 80,
-                  customRender: function (text) { return (text || text == 0) ? _this.toThousands(text) : '--' }
-                },
-                {
-                  title: '感应线',
-                  dataIndex: 'jpGyxAmount',
-                  align: 'right',
-                  width: 80,
-                  customRender: function (text) { return (text || text == 0) ? _this.toThousands(text) : '--' }
-                }
-              ]
-            },
-            {
-              title: '冠牌',
-              align: 'center',
-              children: [
-                {
-                  title: '滤清器',
-                  dataIndex: 'gpLqqAmount',
-                  align: 'right',
-                  width: 80,
-                  customRender: function (text) { return (text || text == 0) ? _this.toThousands(text) : '--' }
-                },
-                {
-                  title: '雨刮片',
-                  dataIndex: 'gpYgpAmount',
-                  align: 'right',
-                  width: 80,
-                  customRender: function (text) { return (text || text == 0) ? _this.toThousands(text) : '--' }
-                },
-                {
-                  title: '刹车片',
-                  dataIndex: 'gpScpAmount',
-                  align: 'right',
-                  width: 80,
-                  customRender: function (text) { return (text || text == 0) ? _this.toThousands(text) : '--' }
-                }
-              ]
-            },
-            {
-              title: '汇箭',
-              dataIndex: 'hjAmount',
-              align: 'right',
-              width: 80,
-              customRender: function (text) { return (text || text == 0) ? _this.toThousands(text) : '--' }
-            },
-            {
-              title: '德路斯',
-              dataIndex: 'dlsAmount',
-              align: 'right',
-              width: 80,
-              customRender: function (text) { return (text || text == 0) ? _this.toThousands(text) : '--' }
-            },
-            {
-              title: '稳升',
-              dataIndex: 'wsAmount',
-              align: 'right',
-              width: 80,
-              customRender: function (text) { return (text || text == 0) ? _this.toThousands(text) : '--' }
-            },
-            {
-              title: 'TBU',
-              dataIndex: 'tbuAmount',
-              align: 'right',
-              width: 80,
-              customRender: function (text) { return (text || text == 0) ? _this.toThousands(text) : '--' }
-            },
-            {
-              title: 'TBU-P',
-              dataIndex: 'tbupAmount',
-              align: 'right',
-              width: 80,
-              customRender: function (text) { return (text || text == 0) ? _this.toThousands(text) : '--' }
-            },
-            {
-              title: '布瑞斯',
-              dataIndex: 'brsAmount',
-              align: 'right',
-              width: 80,
-              customRender: function (text) { return (text || text == 0) ? _this.toThousands(text) : '--' }
-            }
-          ]
-        },
-        { title: '代理品牌',
-          align: 'center',
-          children: [
-            {
-              title: 'NGK',
-              dataIndex: 'ngkAmount',
-              align: 'right',
-              width: 80,
-              customRender: function (text) { return (text || text == 0) ? _this.toThousands(text) : '--' }
-            },
-            {
-              title: '飞利浦',
-              dataIndex: 'flpAmount',
-              align: 'right',
-              width: 80,
-              customRender: function (text) { return (text || text == 0) ? _this.toThousands(text) : '--' }
-            },
-            {
-              title: '车仆',
-              dataIndex: 'cpAmount',
-              align: 'right',
-              width: 80,
-              customRender: function (text) { return (text || text == 0) ? _this.toThousands(text) : '--' }
-            },
-            {
-              title: '瓦尔塔',
-              dataIndex: 'wetAmount',
-              align: 'right',
-              width: 80,
-              customRender: function (text) { return (text || text == 0) ? _this.toThousands(text) : '--' }
-            },
-            {
-              title: '雷贝斯托',
-              dataIndex: 'lbstAmount',
-              align: 'right',
-              width: 80,
-              customRender: function (text) { return (text || text == 0) ? _this.toThousands(text) : '--' }
-            },
-            {
-              title: '德尔福',
-              dataIndex: 'defAmount',
-              align: 'right',
-              width: 80,
-              customRender: function (text) { return (text || text == 0) ? _this.toThousands(text) : '--' }
-            },
-            {
-              title: '巴诺德',
-              dataIndex: 'bndAmount',
-              align: 'right',
-              width: 80,
-              customRender: function (text) { return (text || text == 0) ? _this.toThousands(text) : '--' }
-            }
-          ]
-        }
-        // { title: '开单销售合计金额', width: 90, dataIndex: 'totalAmount', align: 'center', customRender: function (text) { return (text || text == 0) ? ('¥' + text) : '--' } }
-      ]
-      // if (this.$hasPermissions('B_isShowPrice')) { //  售价权限
-      arr.splice(arr.length, 0, { title: '开单销售合计金额', width: 90, dataIndex: 'totalAmount', align: 'right', customRender: function (text) { return (text || text == 0) ? _this.toThousands(text) : '--' } })
-      // }
-      return arr
-    }
-  },
   methods: {
     //  导出
     handleExport () {
@@ -406,7 +204,7 @@ export default {
         if (valid) {
           _this.$refs.table.refresh(true)
         } else {
-          _this.$message.error("请选择销售日期")
+          _this.$message.error('请选择销售日期')
           return false
         }
       })
@@ -442,28 +240,47 @@ export default {
         'dealerLevel': undefined
       }
       this.totalData = null
-      if(this.advanced){
+      if (this.advanced) {
         this.$refs.areaList.clearData()
       }
       this.$refs.custList.resetForm()
       this.$refs.ruleForm.resetFields()
       this.$refs.table.clearTable()
     },
-    areaChange(val){
+    areaChange (val) {
       this.queryParam.dealer.provinceSn = val[0] ? val[0] : ''
       this.queryParam.dealer.citySn = val[1] ? val[1] : ''
       this.queryParam.dealer.districtSn = val[2] ? val[2] : ''
+    },
+    // 获取表头
+    async getTableTitle () {
+      const _this = this
+      const tableTitle = await salesKdxxReportTitle().then(res => res.data)
+      this.columns = tableTitle.list
+      this.countLabel = tableTitle.count
+      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()
     }
   },
   mounted () {
     if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
-      this.resetSearchForm()
+      this.getTableTitle()
     }
   },
   activated () {
     // 如果是新页签打开,则重置当前页面
     if (this.$store.state.app.isNewTab) {
-      this.resetSearchForm()
+      this.getTableTitle()
     }
   },
   beforeRouteEnter (to, from, next) {

+ 34 - 252
src/views/reportData/salesSlipReport/list.vue

@@ -46,7 +46,7 @@
               </a-col>
               <a-col :md="6" :sm="24">
                 <a-form-model-item label="地区">
-                    <AreaList id="salesSlipReportList-areaList" changeOnSelect ref="areaList" @change="areaChange" defValKey="id"></AreaList>
+                  <AreaList id="salesSlipReportList-areaList" changeOnSelect ref="areaList" @change="areaChange" defValKey="id"></AreaList>
                 </a-form-model-item>
               </a-col>
             </template>
@@ -76,42 +76,20 @@
         ref="table"
         size="small"
         :defaultLoadData="false"
-        :rowKey="(record) => record.id"
+        :rowKey="(record) => record.no"
+        :rowKeyName="no"
         :columns="columns"
         :data="loadData"
         :scroll="{ x: 2410 }"
         bordered>
-        <template slot="footer">
+        <template slot="footer" v-if="countLabel.length>0">
           <a-row>
             <a-col span="2">合计:</a-col>
             <a-col span="22">
               <a-row>
-                <a-col span="4">箭牌滤清器:{{ (totalData && (totalData.jpLqqAmount || totalData.jpLqqAmount==0)) ? toThousands(totalData.jpLqqAmount) : '--' }}</a-col>
-                <a-col span="4">箭牌变速箱滤清器:{{ (totalData && (totalData.jpBsxLqqAmount || totalData.jpBsxLqqAmount==0)) ? toThousands(totalData.jpBsxLqqAmount) : '--' }}</a-col>
-                <a-col span="4">箭牌雨刮片:{{ (totalData && (totalData.jpYgpAmount || totalData.jpYgpAmount==0)) ? toThousands(totalData.jpYgpAmount) : '--' }}</a-col>
-                <a-col span="4">箭牌喇叭:{{ (totalData && (totalData.jpLbAmount || totalData.jpLbAmount==0)) ? toThousands(totalData.jpLbAmount) : '--' }}</a-col>
-                <a-col span="4">箭牌刹车片:{{ (totalData && (totalData.jpScpAmount || totalData.jpScpAmount==0)) ? toThousands(totalData.jpScpAmount) : '--' }}</a-col>
-                <a-col span="4">箭牌感应线:{{ (totalData && (totalData.jpGyxAmount || totalData.jpGyxAmount==0)) ? toThousands(totalData.jpGyxAmount) : '--' }}</a-col>
-                <a-col span="4">冠牌滤清器:{{ (totalData && (totalData.gpLqqAmount || totalData.gpLqqAmount==0)) ? toThousands(totalData.gpLqqAmount) : '--' }}</a-col>
-                <a-col span="4">冠牌雨刮片:{{ (totalData && (totalData.gpYgpAmount || totalData.gpYgpAmount==0)) ? toThousands(totalData.gpYgpAmount) : '--' }}</a-col>
-                <a-col span="4">冠牌刹车片:{{ (totalData && (totalData.gpScpAmount || totalData.gpScpAmount==0)) ? toThousands(totalData.gpScpAmount) : '--' }}</a-col>
-                <a-col span="4">稳升点火线圈:{{ (totalData && (totalData.wsDhxqAmount || totalData.wsDhxqAmount==0)) ? toThousands(totalData.wsDhxqAmount) : '--' }}</a-col>
-                <a-col span="4">稳升灯泡:{{ (totalData && (totalData.wsDpAmount || totalData.wsDpAmount==0)) ? toThousands(totalData.wsDpAmount) : '--' }}</a-col>
-                <a-col span="4">汇箭:{{ (totalData && (totalData.hjAmount || totalData.hjAmount==0)) ? toThousands(totalData.hjAmount) : '--' }}</a-col>
-                <a-col span="4">德路斯:{{ (totalData && (totalData.dlsAmount || totalData.dlsAmount==0)) ? toThousands(totalData.dlsAmount) : '--' }}</a-col>
-                <a-col span="4">TBU刹车片:{{ (totalData && (totalData.tbuScpAmount || totalData.tbuScpAmount==0)) ? toThousands(totalData.tbuScpAmount) : '--' }}</a-col>
-                <a-col span="4">TBU刹车油:{{ (totalData && (totalData.tbuScyAmount || totalData.tbuScyAmount==0)) ? toThousands(totalData.tbuScyAmount) : '--' }}</a-col>
-                <a-col span="4">TBU-P:{{ (totalData && (totalData.tbupAmount || totalData.tbupAmount==0)) ? toThousands(totalData.tbupAmount) : '--' }}</a-col>
-                <a-col span="4">布瑞斯:{{ (totalData && (totalData.brsAmount || totalData.brsAmount==0)) ? toThousands(totalData.brsAmount) : '--' }}</a-col>
-                <a-col span="4">NGK:{{ (totalData && (totalData.ngkAmount || totalData.ngkAmount==0)) ? toThousands(totalData.ngkAmount) : '--' }}</a-col>
-                <a-col span="4">飞利浦:{{ (totalData && (totalData.flpAmount || totalData.flpAmount==0)) ? toThousands(totalData.flpAmount) : '--' }}</a-col>
-                <a-col span="4">车仆:{{ (totalData && (totalData.cpAmount || totalData.cpAmount==0)) ? toThousands(totalData.cpAmount) : '--' }}</a-col>
-                <a-col span="4">瓦尔塔:{{ (totalData && (totalData.wetAmount || totalData.wetAmount==0)) ? toThousands(totalData.wetAmount) : '--' }}</a-col>
-                <a-col span="4">雷贝斯托:{{ (totalData && (totalData.lbstAmount || totalData.lbstAmount==0)) ? toThousands(totalData.lbstAmount) : '--' }}</a-col>
-                <a-col span="4">德尔福:{{ (totalData && (totalData.defAmount || totalData.defAmount==0)) ? toThousands(totalData.defAmount) : '--' }}</a-col>
-                <a-col span="4">巴诺德:{{ (totalData && (totalData.bndAmount || totalData.bndAmount==0)) ? toThousands(totalData.bndAmount) : '--' }}</a-col>
-                <!-- v-if="$hasPermissions('B_isShowPrice')" -->
-                <a-col span="6">开单销售单合计金额:{{ (totalData && (totalData.totalAmount || totalData.totalAmount==0)) ? toThousands(totalData.totalAmount) : '--' }}</a-col>
+                <a-col span="4" v-for="item in countLabel" :key="item.key">
+                  {{ item.title }}:{{ totalData?(totalData[item.dataIndex]||totalData[item.dataIndex]==0)?toThousands(totalData[item.dataIndex]):'--':'--' }}
+                </a-col>
               </a-row>
             </a-col>
           </a-row>
@@ -133,7 +111,7 @@ import subarea from '@/views/common/subarea.js'
 import reportModal from '@/views/common/reportModal.vue'
 import AreaList from '@/views/common/areaList.js'
 import { hdExportExcel } from '@/libs/exportExcel'
-import { salesBillReportList, salesBillReportCount } from '@/api/salesBillReport'
+import { salesKdxxdReportTitle, salesBillReportList, salesBillReportCount } from '@/api/salesBillReport'
 import { salesSlipExport } from '@/api/reportData'
 export default {
   name: 'SalesSlipReportList',
@@ -162,6 +140,8 @@ export default {
           'dealerLevel': undefined
         }
       },
+      columns: [],
+      countLabel: [],
       rules: {
         'time': [{ required: true, message: '请选择销售日期', trigger: 'change' }]
       },
@@ -193,223 +173,6 @@ export default {
       totalData: null
     }
   },
-  computed: {
-    columns () {
-      const _this = this
-      const arr = [
-        { title: '区域', dataIndex: 'dealer.subareaNameSet', width: 120, align: 'center', customRender: function (text) { return (text && text.length > 0) ? text.join('/') : '--' } },
-        { title: '销售单号', dataIndex: 'salesBillNo', width: 160, align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '省份', dataIndex: 'dealer.provinceName', width: 90, align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
-        { title: '客户名称', dataIndex: 'dealer.dealerName', width: 120, align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
-        { title: '客户级别', dataIndex: 'dealer.dealerLevelDictValue', width: 120, align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '品牌',
-          align: 'center',
-          children: [
-            {
-              title: '箭牌',
-              align: 'center',
-              children: [
-                {
-                  title: '滤清器',
-                  dataIndex: 'jpLqqAmount',
-                  align: 'center',
-                  width: 80,
-                  customRender: function (text) { return (text || text == 0) ? _this.toThousands(text) : '--' }
-                },
-                {
-                  title: '变速箱滤清器',
-                  dataIndex: 'jpBsxLqqAmount',
-                  align: 'center',
-                  width: 80,
-                  customRender: function (text) { return (text || text == 0) ? _this.toThousands(text) : '--' }
-                },
-                {
-                  title: '雨刮片',
-                  dataIndex: 'jpYgpAmount',
-                  align: 'center',
-                  width: 80,
-                  customRender: function (text) { return (text || text == 0) ? _this.toThousands(text) : '--' }
-                },
-                {
-                  title: '喇叭',
-                  dataIndex: 'jpLbAmount',
-                  align: 'center',
-                  width: 80,
-                  customRender: function (text) { return (text || text == 0) ? _this.toThousands(text) : '--' }
-                },
-                {
-                  title: '刹车片',
-                  dataIndex: 'jpScpAmount',
-                  align: 'center',
-                  width: 80,
-                  customRender: function (text) { return (text || text == 0) ? _this.toThousands(text) : '--' }
-                },
-                {
-                  title: '感应线',
-                  dataIndex: 'jpGyxAmount',
-                  align: 'center',
-                  width: 80,
-                  customRender: function (text) { return (text || text == 0) ? _this.toThousands(text) : '--' }
-                }
-              ]
-            },
-            {
-              title: '冠牌',
-              align: 'center',
-              children: [
-                {
-                  title: '滤清器',
-                  dataIndex: 'gpLqqAmount',
-                  align: 'center',
-                  width: 80,
-                  customRender: function (text) { return (text || text == 0) ? _this.toThousands(text) : '--' }
-                },
-                {
-                  title: '雨刮片',
-                  dataIndex: 'gpYgpAmount',
-                  align: 'center',
-                  width: 80,
-                  customRender: function (text) { return (text || text == 0) ? _this.toThousands(text) : '--' }
-                },
-                {
-                  title: '刹车片',
-                  dataIndex: 'gpScpAmount',
-                  align: 'center',
-                  width: 80,
-                  customRender: function (text) { return (text || text == 0) ? _this.toThousands(text) : '--' }
-                }
-              ]
-            },
-            {
-              title: '稳升',
-              align: 'center',
-              children: [
-                {
-                  title: '点火线圈',
-                  dataIndex: 'wsDhxqAmount',
-                  align: 'center',
-                  width: 80,
-                  customRender: function (text) { return (text || text == 0) ? _this.toThousands(text) : '--' }
-                },
-                {
-                  title: '灯泡',
-                  dataIndex: 'wsDpAmount',
-                  align: 'center',
-                  width: 80,
-                  customRender: function (text) { return (text || text == 0) ? _this.toThousands(text) : '--' }
-                }
-              ]
-            },
-            {
-              title: '汇箭',
-              dataIndex: 'hjAmount',
-              align: 'center',
-              width: 80,
-              customRender: function (text) { return (text || text == 0) ? _this.toThousands(text) : '--' }
-            },
-            {
-              title: '德路斯',
-              dataIndex: 'dlsAmount',
-              align: 'center',
-              width: 80,
-              customRender: function (text) { return (text || text == 0) ? _this.toThousands(text) : '--' }
-            },
-            {
-              title: 'TBU',
-              align: 'center',
-              children: [
-                {
-                  title: '刹车片',
-                  dataIndex: 'tbuScpAmount',
-                  align: 'center',
-                  width: 80,
-                  customRender: function (text) { return (text || text == 0) ? _this.toThousands(text) : '--' }
-                },
-                {
-                  title: '刹车油',
-                  dataIndex: 'tbuScyAmount',
-                  align: 'center',
-                  width: 80,
-                  customRender: function (text) { return (text || text == 0) ? _this.toThousands(text) : '--' }
-                }
-              ]
-            },
-            {
-              title: 'TBU-P',
-              dataIndex: 'tbupAmount',
-              align: 'center',
-              width: 80,
-              customRender: function (text) { return (text || text == 0) ? _this.toThousands(text) : '--' }
-            },
-            {
-              title: '布瑞斯',
-              dataIndex: 'brsAmount',
-              align: 'center',
-              width: 80,
-              customRender: function (text) { return (text || text == 0) ? _this.toThousands(text) : '--' }
-            }
-          ] },
-        { title: '代理品牌',
-          align: 'center',
-          children: [
-            {
-              title: 'NGK',
-              dataIndex: 'ngkAmount',
-              align: 'center',
-              width: 80,
-              customRender: function (text) { return (text || text == 0) ? _this.toThousands(text) : '--' }
-            },
-            {
-              title: '飞利浦',
-              dataIndex: 'flpAmount',
-              align: 'center',
-              width: 80,
-              customRender: function (text) { return (text || text == 0) ? _this.toThousands(text) : '--' }
-            },
-            {
-              title: '车仆',
-              dataIndex: 'cpAmount',
-              align: 'center',
-              width: 80,
-              customRender: function (text) { return (text || text == 0) ? _this.toThousands(text) : '--' }
-            },
-            {
-              title: '瓦尔塔',
-              dataIndex: 'wetAmount',
-              align: 'center',
-              width: 80,
-              customRender: function (text) { return (text || text == 0) ? _this.toThousands(text) : '--' }
-            },
-            {
-              title: '雷贝斯托',
-              dataIndex: 'lbstAmount',
-              align: 'center',
-              width: 80,
-              customRender: function (text) { return (text || text == 0) ? _this.toThousands(text) : '--' }
-            },
-            {
-              title: '德尔福',
-              dataIndex: 'defAmount',
-              align: 'center',
-              width: 80,
-              customRender: function (text) { return (text || text == 0) ? _this.toThousands(text) : '--' }
-            },
-            {
-              title: '巴诺德',
-              dataIndex: 'bndAmount',
-              align: 'center',
-              width: 80,
-              customRender: function (text) { return (text || text == 0) ? _this.toThousands(text) : '--' }
-            }
-          ] }
-        // { title: '开单销售单合计金额', width: 90, dataIndex: 'totalAmount', align: 'center', customRender: function (text) { return (text || text == 0) ?  _this.toThousands(text) : '--' } }
-      ]
-      // if (this.$hasPermissions('B_isShowPrice')) { //  售价权限
-      arr.splice(7, 0, { title: '开单销售单合计金额', width: 90, dataIndex: 'totalAmount', align: 'center', customRender: function (text) { return (text || text == 0) ? _this.toThousands(text) : '--' } })
-      // }
-      return arr
-    }
-  },
   methods: {
     //  导出
     handleExport () {
@@ -447,7 +210,7 @@ export default {
         if (valid) {
           _this.$refs.table.refresh(true)
         } else {
-          _this.$message.error("请选择销售日期")
+          _this.$message.error('请选择销售日期')
           return false
         }
       })
@@ -484,28 +247,47 @@ export default {
         'dealerLevel': undefined
       }
       this.totalData = null
-      if(this.advanced){
+      if (this.advanced) {
         this.$refs.areaList.clearData()
       }
       this.$refs.custList.resetForm()
       this.$refs.ruleForm.resetFields()
       this.$refs.table.clearTable()
     },
-    areaChange(val){
+    areaChange (val) {
       this.queryParam.dealer.provinceSn = val[0] ? val[0] : ''
       this.queryParam.dealer.citySn = val[1] ? val[1] : ''
       this.queryParam.dealer.districtSn = val[2] ? val[2] : ''
     },
+    // 获取表头
+    async getTableTitle () {
+      const _this = this
+      const tableTitle = await salesKdxxdReportTitle().then(res => res.data)
+      this.columns = tableTitle.list
+      this.countLabel = tableTitle.count
+      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()
+    }
   },
   mounted () {
     if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
-      this.resetSearchForm()
+      this.getTableTitle()
     }
   },
   activated () {
     // 如果是新页签打开,则重置当前页面
     if (this.$store.state.app.isNewTab) {
-      this.resetSearchForm()
+      this.getTableTitle()
     }
   },
   beforeRouteEnter (to, from, next) {

+ 2 - 2
vue.config.js

@@ -107,7 +107,7 @@ const vueConfig = {
     // If you want to turn on the proxy, please remove the mockjs /src/main.jsL11
     proxy: {
       '/api': {
-        target: 'http://192.168.16.104:8660/ocs-admin',
+        target: 'http://192.168.0.216:80/ocs-admin',
         // target: 'https://t.ocs.360arrow.com/ocs-admin', //  练习
         // target: 'http://p.ocs.360arrow.com/ocs-admin', //  预发布
         ws: false,
@@ -134,4 +134,4 @@ if (process.env.VUE_APP_PREVIEW === 'true') {
   vueConfig.configureWebpack.plugins.push(createThemeColorReplacerPlugin())
 }
 
-module.exports = vueConfig
+module.exports = vueConfig