Bläddra i källkod

销售报表、销售明细报表 导出

chenrui 3 år sedan
förälder
incheckning
d4942baee1

+ 18 - 0
src/api/reportData.js

@@ -167,3 +167,21 @@ export const linkageGroupList = (params) => {
     method: 'post'
   })
 }
+// 销售报表  导出
+export const reportSalesBillExport = params => {
+  return axios.request({
+    url: `/report/reportSalesBill/export`,
+    data: params,
+    method: 'post',
+    responseType: 'blob'
+  })
+}
+// 销售明细报表  导出
+export const reportSalesBillDetailExport = params => {
+  return axios.request({
+    url: `/report/reportSalesBill/detailExport`,
+    data: params,
+    method: 'post',
+    responseType: 'blob'
+  })
+}

+ 41 - 15
src/views/reportData/salesDetailReport/list.vue

@@ -1,11 +1,11 @@
 <template>
-  <a-card size="small" :bordered="false" class="chainSalesDetailReportList-wrap">
+  <a-card size="small" :bordered="false" class="salesDetailReportList-wrap">
     <a-spin :spinning="spinning" tip="Loading...">
       <a-alert :show-icon="false" type="error" message="注:销售单报表包含急件销售数量、售价,销售明细报表不包含急件销售数量、成本、售价" banner style="margin-bottom: 10px;" />
       <!-- 搜索条件 -->
       <div class="table-page-search-wrapper">
         <a-form-model
-          id="chainSalesDetailReportList-form"
+          id="salesDetailReportList-form"
           ref="ruleForm"
           class="form-model-con"
           layout="inline"
@@ -22,12 +22,12 @@
             </a-col>
             <a-col :md="6" :sm="24">
               <a-form-model-item label="客户名称">
-                <a-input id="chainSalesDetailReportList-salesTargetName" v-model.trim="queryParam.salesTargetName" allowClear placeholder="请输入客户名称"/>
+                <a-input id="salesDetailReportList-salesTargetName" v-model.trim="queryParam.salesTargetName" allowClear placeholder="请输入客户名称"/>
               </a-form-model-item>
             </a-col>
             <a-col :md="6" :sm="24">
               <a-form-model-item label="客户类型">
-                <a-select id="chainSalesDetailReportList-customerType" v-model="queryParam.salesTargetType" allowClear placeholder="请选择客户类型">
+                <a-select id="salesDetailReportList-customerType" v-model="queryParam.salesTargetType" allowClear placeholder="请选择客户类型">
                   <a-select-option v-for="item in custTypeList" :value="item.customerTypeSn" :key="item.customerTypeSn">{{ item.name }}</a-select-option>
                 </a-select>
               </a-form-model-item>
@@ -35,7 +35,7 @@
             <template v-if="advanced">
               <a-col :md="6" :sm="24">
                 <a-form-model-item label="收款方式">
-                  <a-select id="chainSalesDetailReportList-settleStyleSn" v-model="queryParam.settleStyleSn" allowClear placeholder="请选择收款方式">
+                  <a-select id="salesDetailReportList-settleStyleSn" v-model="queryParam.settleStyleSn" allowClear placeholder="请选择收款方式">
                     <a-select-option v-for="item in settleStyleList" :value="item.settleStyleSn" :key="item.settleStyleSn">{{ item.name }}</a-select-option>
                   </a-select>
                 </a-form-model-item>
@@ -44,7 +44,7 @@
                 <a-form-item label="产品品牌">
                   <a-select
                     placeholder="请选择产品品牌"
-                    id="chainSalesDetailReportList-productBrandSn"
+                    id="salesDetailReportList-productBrandSn"
                     allowClear
                     v-model="queryParam.productEntity.productBrandSn"
                     :showSearch="true"
@@ -63,19 +63,19 @@
                     expand-trigger="hover"
                     :options="productTypeList"
                     :fieldNames="{ label: 'productTypeName', value: 'productTypeSn', children: 'children' }"
-                    id="chainSalesDetailReportList-productType"
+                    id="salesDetailReportList-productType"
                     placeholder="请选择产品分类"
                     allowClear />
                 </a-form-model-item>
               </a-col>
               <a-col :md="6" :sm="24">
                 <a-form-model-item label="产品编码">
-                  <a-input id="chainSalesDetailReportList-code" v-model.trim="queryParam.productEntity.code" allowClear placeholder="请输入产品编码"/>
+                  <a-input id="salesDetailReportList-code" v-model.trim="queryParam.productEntity.code" allowClear placeholder="请输入产品编码"/>
                 </a-form-model-item>
               </a-col>
               <a-col :md="6" :sm="24">
                 <a-form-model-item label="产品名称">
-                  <a-input id="chainSalesDetailReportList-name" v-model.trim="queryParam.productEntity.name" allowClear placeholder="请输入产品名称"/>
+                  <a-input id="salesDetailReportList-name" v-model.trim="queryParam.productEntity.name" allowClear placeholder="请输入产品名称"/>
                 </a-form-model-item>
               </a-col>
               <a-col :md="6" :sm="24">
@@ -85,7 +85,7 @@
                     expand-trigger="hover"
                     :options="warehouseCascadeData"
                     :fieldNames="{ label: 'name', value: 'sn', children: 'warehouseLocationList' }"
-                    id="chainSalesDetailReportList-warehouseCascade"
+                    id="salesDetailReportList-warehouseCascade"
                     placeholder="请选择仓库仓位"
                     @change="warehouseCascadeChange"
                     allowClear
@@ -94,12 +94,12 @@
               </a-col>
               <a-col :md="6" :sm="24">
                 <a-form-model-item label="单号">
-                  <a-input id="chainSalesDetailReportList-salesBillNo" v-model.trim="queryParam.salesBillNo" allowClear placeholder="请输入单号"/>
+                  <a-input id="salesDetailReportList-salesBillNo" v-model.trim="queryParam.salesBillNo" allowClear placeholder="请输入单号"/>
                 </a-form-model-item>
               </a-col>
               <a-col :md="6" :sm="24">
                 <a-form-model-item label="业务员">
-                  <a-input id="chainSalesDetailReportList-salesManName" v-model.trim="queryParam.salesManName" allowClear placeholder="请输入业务员"/>
+                  <a-input id="salesDetailReportList-salesManName" v-model.trim="queryParam.salesManName" allowClear placeholder="请输入业务员"/>
                 </a-form-model-item>
               </a-col>
               <a-col :md="12" :sm="24">
@@ -131,8 +131,16 @@
               </a-col>
             </template>
             <a-col :md="6" :sm="24">
-              <a-button type="primary" @click="handleSearch" :disabled="disabled" id="chainSalesDetailReportList-refresh">查询</a-button>
-              <a-button style="margin-left: 5px" @click="resetSearchForm" :disabled="disabled" id="chainSalesDetailReportList-reset">重置</a-button>
+              <a-button type="primary" @click="handleSearch" :disabled="disabled" id="salesDetailReportList-refresh">查询</a-button>
+              <a-button style="margin-left: 5px" @click="resetSearchForm" :disabled="disabled" id="salesDetailReportList-reset">重置</a-button>
+              <a-button
+                type="primary"
+                style="margin-left: 5px"
+                @click="handleExport"
+                :disabled="disabled"
+                :loading="exportLoading"
+                class="button-warning"
+                id="salesDetailReportList-export-btn">导出</a-button>
               <a @click="advanced=!advanced" style="margin-left: 8px">
                 {{ advanced ? '收起' : '展开' }}
                 <a-icon :type="advanced ? 'up' : 'down'"/>
@@ -168,13 +176,14 @@
 <script>
 import { STable, VSelect } from '@/components'
 import rangeDate from '@/views/common/rangeDate.vue'
+import { hdPrint } from '@/libs/JGPrint'
 import { getArea } from '@/api/data'
 import { custTypeFindAllList } from '@/api/custType'
 import { settleStyleFindAllList } from '@/api/customer'
 import { dealerProductBrandQuery } from '@/api/dealerProductBrand'
 import { dealerProductTypeList } from '@/api/dealerProductType'
 import { warehouseCascadeList } from '@/api/warehouse'
-import { reportSalesBillDetailList, reportSalesBillDetailCount } from '@/api/reportData'
+import { reportSalesBillDetailList, reportSalesBillDetailCount, reportSalesBillDetailExport } from '@/api/reportData'
 export default {
   components: { STable, VSelect, rangeDate },
   data () {
@@ -317,6 +326,23 @@ export default {
       this.totalData = null
       this.$refs.table.clearTable()
     },
+    // 导出
+    handleExport () {
+      const _this = this
+      this.$refs.ruleForm.validate(valid => {
+        if (valid) {
+          _this.spinning = true
+          _this.exportLoading = true
+          hdPrint('', 'export', reportSalesBillDetailExport, this.queryParam, '销售明细报表', function () {
+            _this.spinning = false
+            _this.exportLoading = false
+          })
+        } else {
+          console.log('error submit!!')
+          return false
+        }
+      })
+    },
     filterOption (input, option) {
       return (
         option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0

+ 28 - 2
src/views/reportData/salesReport/list.vue

@@ -81,7 +81,15 @@
             <a-col :md="6" :sm="24">
               <a-button type="primary" @click="handleSearch" :disabled="disabled" id="salesReportList-refresh">查询</a-button>
               <a-button style="margin-left: 5px" @click="resetSearchForm" :disabled="disabled" id="salesReportList-reset">重置</a-button>
-              <a @click="advanced=!advanced" style="margin-left: 8px">
+              <a-button
+                type="primary"
+                style="margin-left: 5px"
+                @click="handleExport"
+                :disabled="disabled"
+                :loading="exportLoading"
+                class="button-warning"
+                id="salesReportList-export-btn">导出</a-button>
+              <a @click="advanced=!advanced" style="margin-left: 5px">
                 {{ advanced ? '收起' : '展开' }}
                 <a-icon :type="advanced ? 'up' : 'down'"/>
               </a>
@@ -117,10 +125,11 @@
 <script>
 import { STable, VSelect } from '@/components'
 import rangeDate from '@/views/common/rangeDate.vue'
+import { hdPrint } from '@/libs/JGPrint'
 import { getArea } from '@/api/data'
 import { custTypeFindAllList } from '@/api/custType'
 import { settleStyleFindAllList } from '@/api/customer'
-import { reportSalesBillList, reportSalesBillCount } from '@/api/reportData'
+import { reportSalesBillList, reportSalesBillCount, reportSalesBillExport } from '@/api/reportData'
 export default {
   components: { STable, VSelect, rangeDate },
   data () {
@@ -236,6 +245,23 @@ export default {
       this.totalData = null
       this.$refs.table.clearTable()
     },
+    // 导出
+    handleExport () {
+      const _this = this
+      this.$refs.ruleForm.validate(valid => {
+        if (valid) {
+          _this.spinning = true
+          _this.exportLoading = true
+          hdPrint('', 'export', reportSalesBillExport, this.queryParam, '销售报表', function () {
+            _this.spinning = false
+            _this.exportLoading = false
+          })
+        } else {
+          console.log('error submit!!')
+          return false
+        }
+      })
+    },
     filterOption (input, option) {
       return (
         option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0