瀏覽代碼

轮胎销售统计报表

chenrui 1 年之前
父節點
當前提交
991697d3ac

+ 37 - 1
src/api/reportData.js

@@ -980,7 +980,43 @@ export const traceCodeList = (params) => {
 
 // 产品追溯列表   统计
 export const traceCodeQueryCount = (params) => {
-  const url = `/report/tracecode/queryCount `
+  const url = '/report/tracecode/queryCount'
+  return axios({
+    url: url,
+    data: params,
+    method: 'post'
+  })
+}
+
+// 产品追溯列表 导出
+export const excelOnlineList = (params) => {
+  return axios({
+    url: '/report/tracecode/excelOnlineList',
+    data: params,
+    method: 'post',
+    responseType: 'blob'
+  })
+}
+
+/*
+*   轮胎销售统计报表
+*/
+
+// 轮胎销售报表(经销商)   列表
+export const querybyDealerList = (params) => {
+  const url = `/report/tracecode/querySaleDealerPage/${params.pageNo}/${params.pageSize}`
+  delete params.pageNo
+  delete params.pageSize
+  return axios({
+    url: url,
+    data: params,
+    method: 'post'
+  })
+}
+
+// 轮胎销售报表(经销商)  统计
+export const querySaleDealercount = (params) => {
+  const url = '/report/tracecode/querySaleDealercount'
   return axios({
     url: url,
     data: params,

+ 10 - 7
src/views/productManagement/productSourcePath/chooseImportModal.vue

@@ -15,11 +15,10 @@
         <p>
           <a-tooltip placement="right">
             <template slot="title">
-              <div><strong>业务单号</strong>Y6508N(17/18);Y6509N(15/18)</div>
-            </template>
-            <div class="text-overflows2">
-              产品款数与产品数量不符:<strong>业务单号</strong>(CSDGFD125458458)(<span class="red">17</span>/18);Y6509N(<span class="red">15</span>/18)
-              产品款数与产品数量不符:<strong>业务单号</strong>(CSDGFD125458458)(<span class="red">17</span>/18);Y6509N(<span class="red">15</span>/18)
+              <span v-for="(con,i) in countData" :key="i"><strong>业务单号</strong>({{ con.bizCode }}){{ con.productCode }} (<span class="red">{{ con.productNum }}</span>/{{ con.bizProductNum }});
+              </span></template>
+            <div class="text-overflows2" v-if="countData && countData.length>0">
+              可导入产品数量与实际销售数量有差异:<span v-for="(con,i) in countData" :key="i"><strong>业务单号</strong>({{ con.bizCode }}){{ con.productCode }} (<span class="red">{{ con.productNum }}</span>/{{ con.bizProductNum }});</span>
             </div>
           </a-tooltip>
         </p>
@@ -117,15 +116,18 @@ export default {
         { title: '备注', dataIndex: 'errorDesc', width: '27%', align: 'center', customRender: function (text) { return text || '--' } }
       ],
       unLoadData: [],
-      loading: false
+      loading: false,
+      countData: []
     }
   },
   methods: {
+    // 获取导入列表
     getData () {
       const _this = this
       const paramsData = JSON.parse(JSON.stringify(_this.paramsData))
       this.loadData = paramsData.rightList || []
       this.unLoadData = paramsData.errorList || []
+      this.countData = paramsData.billList || []
       this.loadData.map((item, index) => {
         item.no = index + 1
       })
@@ -142,7 +144,7 @@ export default {
         this.isShow = false
       }
     },
-    // 导出
+    // 导出 错误项
     handleError () {
       const _this = this
       if (_this.unLoadData.length < 1) {
@@ -166,6 +168,7 @@ export default {
         this.$emit('close')
         this.loadData = []
         this.unLoadData = []
+        this.countData = []
       } else {
         this.getData()
       }

+ 228 - 334
src/views/productManagement/productSourcePath/list.vue

@@ -3,8 +3,14 @@
     <a-card size="small" :bordered="false" class="tireSalesReportList-wrap searchBox">
       <!-- 搜索条件 -->
       <div class="table-page-search-wrapper" ref="tableSearch">
-        <a-form-model id="tireSalesReportList-form" ref="ruleForm" class="form-model-con" layout="inline"
-          :model="queryParam" :rules="rules" @keyup.enter.native="handleSearch">
+        <a-form-model
+          id="tireSalesReportList-form"
+          ref="ruleForm"
+          class="form-model-con"
+          layout="inline"
+          :model="queryParam"
+          :rules="rules"
+          @keyup.enter.native="handleSearch">
           <a-row :gutter="15">
             <a-col :md="6" :sm="24">
               <a-form-model-item label="审核时间">
@@ -13,19 +19,28 @@
             </a-col>
             <a-col :md="6" :sm="24">
               <a-form-item label="业务单号">
-                <a-input id="productSourceList-bizCode" v-model.trim="queryParam.bizCode" allowClear
+                <a-input
+                  id="productSourceList-bizCode"
+                  v-model.trim="queryParam.bizCode"
+                  allowClear
                   placeholder="请输入业务单号" />
               </a-form-item>
             </a-col>
             <a-col :md="6" :sm="24">
               <a-form-item label="产品编码">
-                <a-input id="productSourceList-productCode" v-model.trim="queryParam.productCode" allowClear
+                <a-input
+                  id="productSourceList-productCode"
+                  v-model.trim="queryParam.productCode"
+                  allowClear
                   placeholder="请输入产品编码" />
               </a-form-item>
             </a-col>
             <a-col :md="6" :sm="24">
               <a-form-item label="唯一码">
-                <a-input id="productSourceList-traceCode" v-model.trim="queryParam.traceCode" allowClear
+                <a-input
+                  id="productSourceList-traceCode"
+                  v-model.trim="queryParam.traceCode"
+                  allowClear
                   placeholder="请输入唯一码" />
               </a-form-item>
             </a-col>
@@ -44,30 +59,54 @@
               </a-col>
               <a-col :md="6" :sm="24">
                 <a-form-item label="产品名称">
-                  <a-input id="productSourceList-productName" v-model.trim="queryParam.productName" allowClear
+                  <a-input
+                    id="productSourceList-productName"
+                    v-model.trim="queryParam.productName"
+                    allowClear
                     placeholder="请输入产品名称" />
                 </a-form-item>
               </a-col>
               <a-col :md="6" :sm="24">
                 <a-form-model-item label="客户名称">
-                  <a-input id="productSourceList-buyerName" v-model.trim="queryParam.buyerName" allowClear
+                  <a-input
+                    id="productSourceList-buyerName"
+                    v-model.trim="queryParam.buyerName"
+                    allowClear
                     placeholder="请输入客户名称" />
                 </a-form-model-item>
               </a-col>
               <a-col :md="6" :sm="24">
                 <a-form-model-item label="质保状态">
-                  <v-select v-model="queryParam.dealerLevel" ref="dealerLevel" id="productSourceList-dealerLevel"
-                    code="DEALER_LEVEL" placeholder="请选择业务状态" allowClear></v-select>
+                  <v-select
+                    v-model="queryParam.dealerLevel"
+                    ref="dealerLevel"
+                    id="productSourceList-dealerLevel"
+                    code="DEALER_LEVEL"
+                    placeholder="请选择业务状态"
+                    allowClear></v-select>
                 </a-form-model-item>
               </a-col>
             </template>
             <a-col :md="24" :sm="24" style="text-align: center;">
-              <a-button style="margin-left: 5px" type="primary" @click="handleSearch" :disabled="disabled"
+              <a-button
+                style="margin-left: 5px"
+                type="primary"
+                @click="$refs.table.refresh(true)"
+                :disabled="disabled"
                 id="productSourceList-refresh">查询</a-button>
-              <a-button style="margin-left: 8px" @click="resetSearchForm" :disabled="disabled"
+              <a-button
+                style="margin-left: 8px"
+                @click="resetSearchForm"
+                :disabled="disabled"
                 id="productSourceList-reset">重置</a-button>
-              <a-button style="margin-left: 10px" type="primary" class="button-warning" @click="handleExport"
-                :disabled="disabled" :loading="exportLoading" v-if="$hasPermissions('B_salesOrderTotalExport')"
+              <a-button
+                style="margin-left: 10px"
+                type="primary"
+                class="button-warning"
+                @click="handleExport"
+                :disabled="disabled"
+                :loading="exportLoading"
+                v-if="$hasPermissions('B_salesOrderTotalExport')"
                 id="productSourceList-export">导出</a-button>
               <a @click="advanced=!advanced" style="margin-left: 5px">
                 {{ advanced ? '收起' : '展开' }}
@@ -82,7 +121,10 @@
       <a-spin :spinning="spinning" tip="Loading...">
         <!-- 统计 -->
         <div style="display:flex;align-items:center;margin-bottom:10px;">
-          <a-button type="primary" id="outboundOrder-export" :loading="loading"
+          <a-button
+            type="primary"
+            id="outboundOrder-export"
+            :loading="loading"
             @click="openGuideModal = true">导入</a-button>
           <div class="tongji-bar" style="margin-left:10px;">
             产品总款数:<strong>{{ totalData&&(totalData.productTypeNum || totalData.productTypeNum==0) ? totalData.productTypeNum : '0' }}</strong>;
@@ -90,9 +132,18 @@
           </div>
         </div>
         <!-- 列表 -->
-        <s-table class="sTable fixPagination" ref="table" size="small" :rowKey="(record) => record.salesBillNo"
-          :style="{ height: tableHeight+70+'px' }" rowKeyName="salesBillNo" :columns="columns" :data="loadData"
-          :scroll="{ y: tableHeight-10 }" :defaultLoadData="false" bordered>
+        <s-table
+          class="sTable fixPagination"
+          ref="table"
+          size="small"
+          :rowKey="(record) => record.salesBillNo"
+          :style="{ height: tableHeight+70+'px' }"
+          rowKeyName="salesBillNo"
+          :columns="columns"
+          :data="loadData"
+          :scroll="{ y: tableHeight-10 }"
+          :defaultLoadData="false"
+          bordered>
           <!-- 操作 -->
           <template slot="action" slot-scope="text, record">
             <a-button size="small" type="link" class="button-warning" @click="openInfoModal = true">质保信息</a-button>
@@ -108,333 +159,176 @@
 </template>
 
 <script>
-  import {
-    commonMixin
-  } from '@/utils/mixin'
-  import getDate from '@/libs/getDate.js'
-  import {
-    STable,
-    VSelect
-  } from '@/components'
-  import rangeDate from '@/views/common/rangeDate.vue'
-  import custList from '@/views/common/custList.vue'
-  import reportModal from '@/views/common/reportModal.vue'
-  import AreaList from '@/views/common/areaList.js'
-  import warrantyInfoModal from './warrantyInfoModal.vue'
-  import importGuideModal from './importGuideModal.vue'
-  import {
-    hdExportExcel
-  } from '@/libs/exportExcel'
-  import {
-    userQueryList
-  } from '@/api/power-user'
-  import {
-    traceCodeInsertBatch,
-    traceCodeQueryCount,
-    reportSalesBillExport,
-    traceCodeList
-  } from '@/api/reportData'
-  export default {
-    name: 'ProductSourceList',
-    mixins: [commonMixin],
-    components: {
-      STable,
-      VSelect,
-      rangeDate,
-      custList,
-      reportModal,
-      AreaList,
-      warrantyInfoModal,
-      importGuideModal
-    },
-    data() {
-      return {
-        loading: false,
-        spinning: false,
-        advanced: true, // 高级搜索 展开/关闭
-        tableHeight: 0,
-        showExport: false,
-        isReturnedTires: false,
-        time: [
-          getDate.getCurrMonthDays().starttime,
-          getDate.getCurrMonthDays().endtime
-        ],
-        queryParam: { //  查询条件
-          beginDate: getDate.getCurrMonthDays().starttime,
-          endDate: getDate.getCurrMonthDays().endtime,
-          productCode: '',
-          productName: '',
-          bizCode: undefined,
-          traceCode: undefined,
-          buyerName: undefined,
-          bizStatus: undefined
-        },
-        openInfoModal: false, // 质保信息弹窗
-        openRecordModal: false, // 流转记录弹窗
-        columns: [{
-            title: '序号',
-            dataIndex: 'no',
-            width: '5%',
-            align: 'center'
-          },
-          {
-            title: '业务单号',
-            dataIndex: 'bizCode',
-            width: '10%',
-            align: 'center',
-            customRender: function(text) {
-              return text || '--'
-            }
-          },
-          {
-            title: '审核时间',
-            dataIndex: 'auditDate',
-            width: '10%',
-            align: 'center',
-            customRender: function(text) {
-              return text || '--'
-            }
-          },
-          {
-            title: '导入时间',
-            dataIndex: 'importDate',
-            width: '10%',
-            align: 'center',
-            customRender: function(text) {
-              return text || '--'
-            }
-          },
-          {
-            title: '产品编码',
-            dataIndex: 'productCode',
-            width: '10%',
-            align: 'center',
-            customRender: function(text) {
-              return text || '--'
-            }
-          },
-          {
-            title: '唯一码',
-            dataIndex: 'traceCode',
-            width: '10%',
-            align: 'center',
-            customRender: function(text) {
-              return text || '--'
-            }
-          },
-          {
-            title: '产品名称',
-            dataIndex: 'productName',
-            width: '15%',
-            align: 'center',
-            customRender: function(text) {
-              return text || '--'
-            }
-          },
-          {
-            title: '客户名称',
-            dataIndex: 'buyerName',
-            width: '15%',
-            align: 'center',
-            customRender: function(text) {
-              return text || '--'
-            },
-            ellipsis: true
-          },
-          {
-            title: '质保状态',
-            dataIndex: 'giftQty4',
-            width: '10%',
-            align: 'center',
-            customRender: function(text) {
-              return text || '--'
-            }
-          },
-          {
-            title: '质保时间',
-            dataIndex: 'giftQty3',
-            width: '10%',
-            align: 'center',
-            customRender: function(text) {
-              return text || '--'
+import { commonMixin } from '@/utils/mixin'
+import getDate from '@/libs/getDate.js'
+import { STable, VSelect } from '@/components'
+import rangeDate from '@/views/common/rangeDate.vue'
+import warrantyInfoModal from './warrantyInfoModal.vue'
+import importGuideModal from './importGuideModal.vue'
+import { hdExportExcel } from '@/libs/exportExcel'
+import { traceCodeInsertBatch, traceCodeQueryCount, traceCodeList, excelOnlineList } from '@/api/reportData'
+export default {
+  name: 'ProductSourceList',
+  mixins: [commonMixin],
+  components: { STable, VSelect, rangeDate, warrantyInfoModal, importGuideModal },
+  data () {
+    return {
+      loading: false,
+      spinning: false,
+      advanced: true, // 高级搜索 展开/关闭
+      tableHeight: 0,
+      time: [
+        getDate.getCurrMonthDays().starttime,
+        getDate.getCurrMonthDays().endtime
+      ],
+      queryParam: { //  查询条件
+        beginDate: getDate.getCurrMonthDays().starttime,
+        endDate: getDate.getCurrMonthDays().endtime,
+        productCode: '',
+        productName: '',
+        bizCode: undefined,
+        traceCode: undefined,
+        buyerName: undefined,
+        bizStatus: undefined
+      },
+      openInfoModal: false, // 质保信息弹窗
+      columns: [{ title: '序号', dataIndex: 'no', width: '5%', align: 'center' },
+        { title: '业务单号', dataIndex: 'bizCode', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '审核时间', dataIndex: 'auditDate', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '导入时间', dataIndex: 'importDate', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '产品编码', dataIndex: 'productCode', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '唯一码', dataIndex: 'traceCode', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '产品名称', dataIndex: 'productName', width: '15%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '客户名称', dataIndex: 'buyerName', width: '15%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
+        { title: '质保状态', dataIndex: 'giftQty4', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '质保时间', dataIndex: 'giftQty3', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '操作', scopedSlots: { customRender: 'action' }, width: '12%', align: 'center' }
+      ],
+      disabled: false, //  查询、重置按钮是否可操作
+      exportLoading: false,
+      // 加载数据方法 必须为 Promise 对象
+      loadData: parameter => {
+        this.disabled = true
+        this.spinning = true
+        const params = Object.assign(parameter, this.queryParam)
+        return traceCodeList(params).then(res => {
+          let data
+          if (res.status == 200) {
+            data = res.data
+            this.getCount(params)
+            const no = (data.pageNo - 1) * data.pageSize
+            for (var i = 0; i < data.list.length; i++) {
+              data.list[i].no = no + i + 1
             }
-          },
-          {
-            title: '操作',
-            scopedSlots: {
-              customRender: 'action'
-            },
-            width: '12%',
-            align: 'center'
+            this.disabled = false
           }
-        ],
-
-        disabled: false, //  查询、重置按钮是否可操作
-        exportLoading: false,
-        // 加载数据方法 必须为 Promise 对象
-        loadData: parameter => {
-          this.disabled = true
-          this.spinning = true
-          const params = Object.assign(parameter, this.queryParam)
-          return traceCodeList(params).then(res => {
-            let data
-            if (res.status == 200) {
-              data = res.data
-              this.getCount(params)
-              const no = (data.pageNo - 1) * data.pageSize
-              for (var i = 0; i < data.list.length; i++) {
-                data.list[i].no = no + i + 1
-              }
-              this.disabled = false
-            }
-            this.spinning = false
-            return data
-          })
-        },
-        totalData: null,
-        operatorList: [], //  操作员下拉数据
-        addrProvinceList: [], //  省下拉
-        openGuideModal: false
-      }
-    },
-    watch: {
-      advanced(newValue, oldValue) {
-        const _this = this
-        this.$nextTick(() => { // 页面渲染完成后的回调
-          _this.setTableH()
+          this.spinning = false
+          return data
         })
       },
-      '$store.state.app.winHeight'(newValue, oldValue) { //  窗口变更时,需同时更改表格高度
-        this.setTableH()
-      }
+      totalData: null,
+      openGuideModal: false // 导入弹窗
+    }
+  },
+  watch: {
+    advanced (newValue, oldValue) {
+      const _this = this
+      this.$nextTick(() => { // 页面渲染完成后的回调
+        _this.setTableH()
+      })
     },
-    methods: {
-      handleBizStatus(val){
-        this.queryParam.bizStatus= val
-      },
-      handleGuideOk(resData) {
-        traceCodeInsertBatch(resData).then(res => {
-          if (res.status == 200 && res.data) {
-            this.resetSearchForm()
-          }
-        })
-      },
-      onTiresChange(e) {
-        console.log(`checked = ${e.target.checked}`)
-      },
-      // 盘点库存日期
-      handleStock() {
-        this.$message.info('无盘点区间的起始/终止时间,请自行选择日期区间查询!')
-      },
-      // 总计
-      getCount(params) {
-        traceCodeQueryCount(params).then(res => {
-          if (res.status == 200 && res.data) {
-            this.totalData = res.data
-          } else {
-            this.totalData = null
-          }
-        })
-      },
-      handleSearch() {
-        const _this = this
-        this.$refs.ruleForm.validate(valid => {
-          if (valid) {
-            _this.$refs.table.refresh(true)
-          } else {
-            _this.$message.error('请选择审核时间')
-            return false
-          }
-        })
-      },
-      //  创建时间  change
-      dateChange(date) {
-        if (date[0] && date[1]) {
-          this.queryParam.time = date
+    '$store.state.app.winHeight' (newValue, oldValue) { //  窗口变更时,需同时更改表格高度
+      this.setTableH()
+    }
+  },
+  methods: {
+    // 单据类型操作
+    handleBizStatus (val) {
+      this.queryParam.bizStatus = val
+    },
+    // 导入成功
+    handleGuideOk (resData) {
+      traceCodeInsertBatch(resData).then(res => {
+        if (res.status == 200 && res.data) {
+          this.resetSearchForm()
+        }
+      })
+    },
+    // 统计
+    getCount (params) {
+      traceCodeQueryCount(params).then(res => {
+        if (res.status == 200 && res.data) {
+          this.totalData = res.data
         } else {
-          this.queryParam.time = []
+          this.totalData = null
         }
-        this.queryParam.beginDate = date[0] || ''
-        this.queryParam.endDate = date[1] || ''
-      },
-      custChange(val) {
-        this.queryParam.dealerSn = val.key
-      },
-      //  重置
-      resetSearchForm() {
-        this.time = [
-          getDate.getCurrMonthDays().starttime,
-          getDate.getCurrMonthDays().endtime
-        ]
-        this.$refs.rangeDate.resetDate(this.time)
-        this.queryParam.beginDate = getDate.getCurrMonthDays().starttime
-        this.queryParam.endDate = getDate.getCurrMonthDays().endtime
-        this.totalData = null
-        this.queryParam.bizStatus = undefined
-        this.$refs.table.refresh(true)
-      },
-      //  导出
-      handleExport() {
-        const _this = this
-        this.$refs.ruleForm.validate(valid => {
-          if (valid) {
-            const params = _this.queryParam
-            _this.$store.state.app.curActionPermission = 'B_salesOrderTotalExport'
-            _this.showExport = true
-            _this.exportLoading = true
-            _this.spinning = true
-            hdExportExcel(reportSalesBillExport, params, '销售(开单统计)报表', function() {
-              _this.exportLoading = false
-              _this.spinning = false
-              _this.$store.state.app.curActionPermission = ''
-            })
-          } else {
-            return false
-          }
-        })
-      },
-      filterOption(input, option) {
-        return (
-          option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
-        )
-      },
-      // 操作员
-      getUserList() {
-        userQueryList({}).then(res => {
-          if (res.status == 200) {
-            this.operatorList = res.data
-          } else {
-            this.operatorList = []
-          }
-        })
-      },
-      pageInit() {
-        const _this = this
-        _this.getUserList()
-        this.$nextTick(() => { // 页面渲染完成后的回调
-          _this.setTableH()
-        })
-      },
-      setTableH() {
-        const tableSearchH = this.$refs.tableSearch.offsetHeight
-        this.tableHeight = window.innerHeight - tableSearchH - 252
-      }
+      })
     },
-    mounted() {
-      if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
-        this.pageInit()
-        this.resetSearchForm()
+    //  创建时间  change
+    dateChange (date) {
+      if (date[0] && date[1]) {
+        this.queryParam.time = date
+      } else {
+        this.queryParam.time = []
       }
+      this.queryParam.beginDate = date[0] || ''
+      this.queryParam.endDate = date[1] || ''
     },
-    activated() {
-      // 如果是新页签打开,则重置当前页面
-      if (this.$store.state.app.isNewTab) {
-        this.pageInit()
-        this.resetSearchForm()
-      }
+    //  重置
+    resetSearchForm () {
+      this.time = [
+        getDate.getCurrMonthDays().starttime,
+        getDate.getCurrMonthDays().endtime
+      ]
+      this.$refs.rangeDate.resetDate(this.time)
+      this.queryParam.beginDate = getDate.getCurrMonthDays().starttime
+      this.queryParam.endDate = getDate.getCurrMonthDays().endtime
+      this.totalData = null
+      this.queryParam.productCode = ''
+      this.queryParam.productName = ''
+      this.queryParam.bizCode = undefined
+      this.queryParam.traceCode = undefined
+      this.queryParam.buyerName = undefined
+      this.queryParam.bizStatus = undefined
+      this.$refs.table.refresh(true)
+    },
+    //  导出
+    handleExport () {
+      const _this = this
+      const params = _this.queryParam
+      _this.exportLoading = true
+      _this.spinning = true
+      hdExportExcel(excelOnlineList, params, '轮胎追溯列表', function () {
+        _this.exportLoading = false
+        _this.spinning = false
+      })
     },
-    beforeRouteEnter(to, from, next) {
-      next(vm => {})
+    pageInit () {
+      const _this = this
+      this.$nextTick(() => { // 页面渲染完成后的回调
+        _this.setTableH()
+      })
+    },
+    setTableH () {
+      const tableSearchH = this.$refs.tableSearch.offsetHeight
+      this.tableHeight = window.innerHeight - tableSearchH - 252
+    }
+  },
+  mounted () {
+    if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
+      this.pageInit()
+      this.resetSearchForm()
+    }
+  },
+  activated () {
+    // 如果是新页签打开,则重置当前页面
+    if (this.$store.state.app.isNewTab) {
+      this.pageInit()
+      this.resetSearchForm()
     }
+  },
+  beforeRouteEnter (to, from, next) {
+    next(vm => {})
   }
-</script>
+}
+</script>

+ 66 - 122
src/views/reportData/tireSalesReport/dealerList.vue

@@ -1,38 +1,36 @@
 <template>
   <div>
-    <a-card size="small" :bordered="false" class="tireSalesReportList-wrap searchBoxNormal">
+    <a-card size="small" :bordered="false" class="tireSalesDealerList-wrap searchBoxNormal">
       <!-- 搜索条件 -->
       <div class="table-page-search-wrapper" ref="tableSearch">
         <a-form-model
-          id="tireSalesReportList-form"
+          id="tireSalesDealerList-form"
           ref="ruleForm"
           class="form-model-con"
           layout="inline"
-          :model="queryParam"
-          :rules="rules"
-          @keyup.enter.native="handleSearch">
+          :model="queryParam">
           <a-row :gutter="15">
             <a-col :md="6" :sm="24">
-              <a-form-model-item label="下推时间" prop="time">
-                <rangeDate ref="rangeDate" :value="queryParam.time" @change="dateChange" />
+              <a-form-model-item label="下推时间">
+                <rangeDate ref="rangeDate" :value="time" @change="dateChange" />
               </a-form-model-item>
             </a-col>
             <a-col :md="6" :sm="24">
               <a-form-model-item label="地区">
-                <AreaList id="chooseCustomer-areaList" changeOnSelect ref="areaList" @change="areaChange" defValKey="id"></AreaList>
+                <AreaList id="tireSalesDealerList-areaList" changeOnSelect ref="areaList" @change="areaChange" defValKey="id"></AreaList>
               </a-form-model-item>
             </a-col>
             <a-col :md="6" :sm="24">
               <a-form-item label="区域/分区">
-                <subarea id="allocateBillList-subarea" ref="subarea" @change="subareaChange"></subarea>
+                <subarea id="tireSalesDealerList-subarea" ref="subarea" @change="subareaChange"></subarea>
               </a-form-item>
             </a-col>
             <template v-if="advanced">
               <a-col :md="6" :sm="24">
                 <a-form-model-item label="客户名称">
                   <a-input
-                    id="salesOrderTotalList-dealerName"
-                    v-model.trim="queryParam.dealerName"
+                    id="tireSalesDealerList-buyerName"
+                    v-model.trim="queryParam.buyerName"
                     allowClear
                     placeholder="请输入客户名称" />
                 </a-form-model-item>
@@ -47,14 +45,14 @@
               <a-button
                 style="margin-left: 5px"
                 type="primary"
-                @click="handleSearch"
+                @click="$refs.table.refresh(true)"
                 :disabled="disabled"
-                id="salesOrderTotalList-refresh">查询</a-button>
+                id="tireSalesDealerList-refresh">查询</a-button>
               <a-button
                 style="margin-left: 8px"
                 @click="resetSearchForm"
                 :disabled="disabled"
-                id="salesOrderTotalList-reset">重置</a-button>
+                id="tireSalesDealerList-reset">重置</a-button>
               <a-button
                 style="margin-left: 10px"
                 type="primary"
@@ -63,7 +61,7 @@
                 :disabled="disabled"
                 :loading="exportLoading"
                 v-if="$hasPermissions('B_salesOrderTotalExport')"
-                id="salesOrderTotalList-export">导出</a-button>
+                id="tireSalesDealerList-export">导出</a-button>
               <a @click="advanced=!advanced" style="margin-left: 5px">
                 {{ advanced ? '收起' : '展开' }}
                 <a-icon :type="advanced ? 'up' : 'down'" />
@@ -88,89 +86,57 @@
           :scroll="{ y: tableHeight-30 }"
           :defaultLoadData="false"
           bordered>
+          <template slot="addressInfo" slot-scope="text, record">
+            {{ record.provinceName }}{{ '/'+record.cityName }}{{ '/'+record.districtName }}
+          </template>
           <template slot="footer">
             <a-row :gutter="15">
-              <a-col :md="4" :sm="24">采购数量:{{ (totalData && (totalData.totalQty || totalData.totalQty==0)) ? totalData.totalQty : '--' }}</a-col>
-              <a-col :md="4" :sm="24">库存数量:{{ (totalData && (totalData.totalRealAmount || totalData.totalRealAmount==0)) ? totalData.totalRealAmount: '--' }}</a-col>
-              <a-col :md="4" :sm="24">已售出数量:{{ (totalData && (totalData.totalAmount || totalData.totalAmount==0)) ?totalData.totalAmount: '--' }}</a-col>
+              <a-col :md="4" :sm="24">采购数量:{{ (totalData && (totalData.totalbuyAmount || totalData.totalbuyAmount==0)) ? totalData.totalbuyAmount : '--' }}</a-col>
+              <a-col :md="4" :sm="24">库存数量:{{ (totalData && (totalData.totalstoreAmount || totalData.totalstoreAmount==0)) ? totalData.totalstoreAmount: '--' }}</a-col>
+              <a-col :md="4" :sm="24">已售出数量:{{ (totalData && (totalData.sellAmount || totalData.sellAmount==0)) ?totalData.sellAmount: '--' }}</a-col>
             </a-row>
           </template>
         </s-table>
       </a-spin>
-      <!-- 导出提示框 -->
-      <reportModal :visible="showExport" @close="showExport=false"></reportModal>
     </a-card>
   </div>
 </template>
 
 <script>
-import {
-  commonMixin
-} from '@/utils/mixin'
+import { commonMixin } from '@/utils/mixin'
 import getDate from '@/libs/getDate.js'
-import {
-  STable,
-  VSelect
-} from '@/components'
+import { STable, VSelect } from '@/components'
 import rangeDate from '@/views/common/rangeDate.vue'
 import subarea from '@/views/common/subarea.js'
-import custList from '@/views/common/custList.vue'
-import reportModal from '@/views/common/reportModal.vue'
 import AreaList from '@/views/common/areaList.js'
 import BizUser from '@/views/common/bizUser.js'
-import {
-  hdExportExcel
-} from '@/libs/exportExcel'
-import {
-  userQueryList
-} from '@/api/power-user'
-import {
-  reportSalesBillList,
-  reportSalesBillCount,
-  reportSalesBillExport
-} from '@/api/reportData'
+import { hdExportExcel } from '@/libs/exportExcel'
+import { querySaleDealercount, reportSalesBillExport, querybyDealerList } from '@/api/reportData'
 export default {
-  name: 'SalesOrderTotalList',
+  name: 'TireSalesDealerList',
   mixins: [commonMixin],
-  components: {
-    STable,
-    VSelect,
-    rangeDate,
-    custList,
-    subarea,
-    reportModal,
-    AreaList,
-    BizUser
-  },
+  components: { STable, VSelect, rangeDate, subarea, AreaList, BizUser },
   data () {
     return {
       spinning: false,
       advanced: true, // 高级搜索 展开/关闭
       tableHeight: 0,
-      showExport: false,
+      time: [
+        getDate.getThreeMonthDays().starttime,
+        getDate.getCurrMonthDays().endtime
+      ],
       queryParam: { //  查询条件
-        time: [
-          getDate.getCurrMonthDays().starttime,
-          getDate.getCurrMonthDays().endtime
-        ],
         beginDate: getDate.getCurrMonthDays().starttime,
         endDate: getDate.getCurrMonthDays().endtime,
-        salesBillNo: '',
-        dealerName: '',
-        dealerLevel: undefined,
-        operatorSn: undefined,
+        provinceSn: undefined,
+        citySn: undefined,
+        districtSn: undefined,
+        buyerName: '',
         subareaArea: {
           subareaSn: undefined,
           subareaAreaSn: undefined
         },
-        dealerProvinceSn: undefined
-      },
-      rules: {
-        'time': [{
-          required: true,
-          message: '请选择销售日期',
-          trigger: 'change'
-        }]
+        bizUserSn: undefined
       },
       disabled: false, //  查询、重置按钮是否可操作
       exportLoading: false,
@@ -179,35 +145,34 @@ export default {
         this.disabled = true
         this.spinning = true
         const params = Object.assign(parameter, this.queryParam)
-        return reportSalesBillList(params).then(res => {
+        return querybyDealerList(params).then(res => {
           let data
           if (res.status == 200) {
             data = res.data
-            this.getCount(params)
             const no = (data.pageNo - 1) * data.pageSize
             for (var i = 0; i < data.list.length; i++) {
               data.list[i].no = no + i + 1
             }
             this.disabled = false
+            this.getCount(params)
           }
           this.spinning = false
           return data
         })
       },
       totalData: null,
-      operatorList: [], //  操作员下拉数据
-      addrProvinceList: [], //  省下拉,
       columns: [
         { title: '序号', dataIndex: 'no', width: '5%', align: 'center' },
-        { title: '地区', dataIndex: 'salesBillNo', width: '12%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '区域', dataIndex: 'createDate', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '分区', dataIndex: 'auditDate', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '客户名称', dataIndex: 'dealerName', width: '16%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
-        { title: '商户类型', dataIndex: 'dealerLevelDictValue', width: '12%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '商户级别', dataIndex: 'directDealerName', width: '12%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '采购数量', dataIndex: 'salesBillNo', width: '8%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-        { title: '库存数量', dataIndex: 'dealerName', width: '8%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') }, ellipsis: true },
-        { title: '已售出数量', dataIndex: 'dealerLevelDictValue', width: '8%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } }
+        { title: '地区', scopedSlots: { customRender: 'addressInfo' }, width: '12%', align: 'center' },
+        { title: '区域', dataIndex: 'subareaAreaName', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '分区', dataIndex: 'subareaName', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '客户名称', dataIndex: 'buyerName', width: '16%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
+        { title: '区域负责人', dataIndex: 'userNameQyfzrs', width: '12%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
+        { title: '商户类型', dataIndex: 'dealerTypeDictValue', width: '12%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '商户级别', dataIndex: 'dealerLevelDictValue ', width: '12%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '采购数量', dataIndex: 'buyAmount', width: '8%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '库存数量', dataIndex: 'storeAmount', width: '8%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') }, ellipsis: true },
+        { title: '已售出数量', dataIndex: 'sellAmount', width: '8%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } }
       ]
     }
   },
@@ -223,13 +188,9 @@ export default {
     }
   },
   methods: {
-    // 盘点库存日期
-    handleStock () {
-      this.$message.info('无盘点区间的起始/终止时间,请自行选择日期区间查询!')
-    },
-    // 总计
+    // 统计
     getCount (params) {
-      reportSalesBillCount(params).then(res => {
+      querySaleDealercount(params).then(res => {
         if (res.status == 200 && res.data) {
           this.totalData = res.data
         } else {
@@ -237,23 +198,18 @@ export default {
         }
       })
     },
-    handleSearch () {
-      const _this = this
-      this.$refs.ruleForm.validate(valid => {
-        if (valid) {
-          _this.$refs.table.refresh(true)
-        } else {
-          _this.$message.error('请选择销售日期')
-          return false
-        }
-      })
+    // 地区
+    areaChange (val) {
+      this.queryParam.provinceSn = val[0] ? val[0] : ''
+      this.queryParam.citySn = val[1] ? val[1] : ''
+      this.queryParam.districtSn = val[2] ? val[2] : ''
     },
     //  创建时间  change
     dateChange (date) {
       if (date[0] && date[1]) {
-        this.queryParam.time = date
+        this.time = date
       } else {
-        this.queryParam.time = []
+        this.time = []
       }
       this.queryParam.beginDate = date[0] || ''
       this.queryParam.endDate = date[1] || ''
@@ -267,25 +223,25 @@ export default {
     },
     //  重置
     resetSearchForm () {
-      this.queryParam.time = [
-        getDate.getCurrMonthDays().starttime,
+      this.time = [
+        getDate.getThreeMonthDays().starttime,
         getDate.getCurrMonthDays().endtime
       ]
-      this.$refs.rangeDate.resetDate(this.queryParam.time)
-      this.queryParam.beginDate = getDate.getCurrMonthDays().starttime
+      this.$refs.rangeDate.resetDate(this.time)
+      this.queryParam.beginDate = getDate.getThreeMonthDays().starttime
       this.queryParam.endDate = getDate.getCurrMonthDays().endtime
-      this.queryParam.salesBillNo = ''
-      this.queryParam.dealerName = ''
-      this.queryParam.dealerLevel = undefined
-      this.queryParam.operatorSn = undefined
+      this.queryParam.provinceSn = undefined
+      this.queryParam.citySn = undefined
+      this.queryParam.districtSn = undefined
+      this.queryParam.buyerName = ''
       this.queryParam.subareaArea.subareaSn = undefined
       this.queryParam.subareaArea.subareaAreaSn = undefined
-      this.queryParam.dealerProvinceSn = undefined
+      this.queryParam.bizUserSn = undefined
       this.totalData = null
       if (this.advanced) {
         this.$refs.subarea.clearData()
+        this.$refs.areaList.clearData()
       }
-      this.$refs.ruleForm.resetFields()
       this.$refs.table.clearTable()
     },
     //  导出
@@ -313,22 +269,12 @@ export default {
         option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
       )
     },
-    // 操作员
-    getUserList () {
-      userQueryList({}).then(res => {
-        if (res.status == 200) {
-          this.operatorList = res.data
-        } else {
-          this.operatorList = []
-        }
-      })
-    },
     pageInit () {
       const _this = this
-      _this.getUserList()
       this.$nextTick(() => { // 页面渲染完成后的回调
         _this.setTableH()
       })
+      this.resetSearchForm()
     },
     setTableH () {
       const tableSearchH = this.$refs.tableSearch.offsetHeight
@@ -338,14 +284,12 @@ export default {
   mounted () {
     if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
       this.pageInit()
-      this.resetSearchForm()
     }
   },
   activated () {
     // 如果是新页签打开,则重置当前页面
     if (this.$store.state.app.isNewTab) {
       this.pageInit()
-      this.resetSearchForm()
     }
   },
   beforeRouteEnter (to, from, next) {