chenrui %!s(int64=2) %!d(string=hai) anos
pai
achega
ddba80a97b
Modificáronse 2 ficheiros con 43 adicións e 255 borrados
  1. 11 3
      src/api/reportData.js
  2. 32 252
      src/views/reportData/salesPresentation/list.vue

+ 11 - 3
src/api/reportData.js

@@ -361,9 +361,17 @@ export const reportStockPutDetailExport = (params) => {
     responseType: 'blob'
   })
 }
+// 获取销售交单报表 表头
+export const salesXsjdReportTitle = (params) => {
+  return axios({
+    url: '/report/salesXsjd/reportTitle',
+    data: params,
+    method: 'get'
+  })
+}
 //  销售交单报表
 export const reportDispatchReportList = (params) => {
-  const url = `/report/dispatchReport/xsjd/queryPage/${params.pageNo}/${params.pageSize}`
+  const url = `/report/salesXsjd/reportPage/${params.pageNo}/${params.pageSize}`
   delete params.pageNo
   delete params.pageSize
   return axios({
@@ -375,7 +383,7 @@ export const reportDispatchReportList = (params) => {
 //  销售交单报表  合计
 export const reportDispatchReportCount = (params) => {
   return axios({
-    url: '/report/dispatchReport/xsjd/total',
+    url: '/report/salesXsjd/reportCount',
     data: params,
     method: 'post'
   })
@@ -383,7 +391,7 @@ export const reportDispatchReportCount = (params) => {
 // 销售交单报表 导出
 export const reportDispatchReportExport = (params) => {
   return axios({
-    url: '/report/dispatchReport/xsjd/export',
+    url: '/report/salesXsjd/reportExport',
     data: params,
     method: 'post',
     responseType: 'blob'

+ 32 - 252
src/views/reportData/salesPresentation/list.vue

@@ -46,7 +46,7 @@
               </a-col>
               <a-col :md="6" :sm="24">
                 <a-form-model-item label="地区">
-                    <AreaList id="salesPresentationList-areaList" changeOnSelect ref="areaList" @change="areaChange" defValKey="id"></AreaList>
+                  <AreaList id="salesPresentationList-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>
@@ -132,7 +110,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 { reportDispatchReportList, reportDispatchReportCount, reportDispatchReportExport } from '@/api/reportData'
+import { salesXsjdReportTitle, reportDispatchReportList, reportDispatchReportCount, reportDispatchReportExport } from '@/api/reportData'
 export default {
   name: 'SalesPresentationList',
   mixins: [commonMixin],
@@ -156,6 +134,8 @@ export default {
           'dealerLevel': undefined
         }
       },
+      columns: [],
+      countLabel: [],
       rules: {
         'time': [{ required: true, message: '请选择备货销售日期', trigger: 'change' }]
       },
@@ -184,225 +164,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: 120, 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: 'center',
-              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: '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: '稳升',
-              align: 'center',
-              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: 'center',
-              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 () {
@@ -482,21 +243,40 @@ 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] : ''
+    },
+    // 获取表头
+    async getTableTitle () {
+      const _this = this
+      const tableTitle = await salesXsjdReportTitle().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) {