Browse Source

收发存报表

chenrui 2 years ago
parent
commit
4e78467b04

+ 68 - 57
src/views/reportData/receivedSendStorageReport/index.vue

@@ -50,13 +50,13 @@
             </a-form-model-item>
           </a-col>
           <a-col :md="24" :sm="24" style="margin-bottom: 10px;display:flex;align-item:center;justify-content:center;">
-            <a-button type="primary" @click="handleSearch" :disabled="disabled" id="receivedSendStorageReport-refresh">查询</a-button>
+            <a-button type="primary" @click="testForm('search')" :disabled="disabled" id="receivedSendStorageReport-refresh">查询</a-button>
             <a-button style="margin-left: 5px" @click="resetSearchForm" :disabled="disabled" id="receivedSendStorageReport-reset">重置</a-button>
             <a-button
               style="margin-left: 5px"
               type="primary"
               class="button-warning"
-              @click="handleExport"
+              @click="testForm('export')"
               :disabled="disabled"
               v-if="$hasPermissions('B_ProductPriceExoprt')"
               id="productInfoList-export">导出</a-button>
@@ -66,46 +66,46 @@
     </div>
     <a-tabs default-active-key="1" @change="handleChange" :style="{ height: tableHeight+84.5+'px' }">
       <a-tab-pane key="1" tab="明细">
-        <div class="detailCon">
-          <!-- 列表 -->
-          <s-table
-            class="sTable"
-            ref="table"
-            size="small"
-            :rowKey="(record) => record.id"
-            :columns="columns"
-            :data="loadData"
-            :scroll="{ y: 149 }"
-            :defaultLoadData="false"
-            bordered>
-            <template slot="footer">
-              <a-row>
-                <a-col span="2">合计:</a-col>
-                <a-col span="22">
-                  <a-row>
-                    <a-col span="4">期初结存数量:{{ (totalData && (totalData.beginQty || totalData.beginQty==0)) ? totalData.beginQty : '--' }}</a-col>
-                    <a-col span="4">期初结存单价:{{ (totalData && (totalData.beginPrice || totalData.beginPrice==0)) ? toThousands(totalData.beginPrice) : '--' }}</a-col>
-                    <a-col span="4">期初结存金额:{{ (totalData && (totalData.beginAmount || totalData.beginAmount==0)) ? toThousands(totalData.beginAmount) : '--' }}</a-col>
-                    <a-col span="4">本期收入数量:{{ (totalData && (totalData.putQty || totalData.putQty==0)) ?totalData.putQty : '--' }}</a-col>
-                    <a-col span="4">本期收入单价:{{ (totalData && (totalData.putPrice || totalData.putPrice==0)) ? toThousands(totalData.putPrice) : '--' }}</a-col>
-                    <a-col span="4">本期收入金额:{{ (totalData && (totalData.putAmount || totalData.putAmount==0)) ? toThousands(totalData.putAmount) : '--' }}</a-col>
-                    <a-col span="4">本期发出数量:{{ (totalData && (totalData.outQty || totalData.outQty==0)) ? totalData.outQty : '--' }}</a-col>
-                    <a-col span="4">本期发出单价:{{ (totalData && (totalData.outPrice || totalData.outPrice==0)) ? toThousands(totalData.outPrice) : '--' }}</a-col>
-                    <a-col span="4">本期发出金额:{{ (totalData && (totalData.outAmount || totalData.outAmount==0)) ? toThousands(totalData.outAmount) : '--' }}</a-col>
-                    <a-col span="4">本期结存数量:{{ (totalData && (totalData.endQty || totalData.endQty==0)) ? totalData.endQty : '--' }}</a-col>
-                    <a-col span="4">本期结存单价:{{ (totalData && (totalData.endPrice || totalData.endPrice==0)) ? toThousands(totalData.endPrice) : '--' }}</a-col>
-                    <a-col span="4">本期结存金额:{{ (totalData && (totalData.endAmount || totalData.endAmount==0)) ? toThousands(totalData.endAmount) : '--' }}</a-col>
-                  </a-row>
-                </a-col>
-              </a-row>
-            </template>
-          </s-table>
-        </div>
+        <!-- 列表 -->
+        <s-table
+          class="sTable"
+          ref="table"
+          size="small"
+          :rowKey="(record) => record.id"
+          :columns="columns"
+          :data="loadData"
+          :scroll="{ y: tableHeight-120 }"
+          :defaultLoadData="false"
+          bordered>
+          <template slot="footer">
+            <a-row>
+              <a-col span="2">合计:</a-col>
+              <a-col span="22">
+                <a-row>
+                  <a-col span="4">期初结存数量:{{ (totalData && (totalData.beginQty || totalData.beginQty==0)) ? totalData.beginQty : '--' }}</a-col>
+                  <a-col span="4">期初结存单价:{{ (totalData && (totalData.beginPrice || totalData.beginPrice==0)) ? toThousands(totalData.beginPrice) : '--' }}</a-col>
+                  <a-col span="4">期初结存金额:{{ (totalData && (totalData.beginAmount || totalData.beginAmount==0)) ? toThousands(totalData.beginAmount) : '--' }}</a-col>
+                  <a-col span="4">本期收入数量:{{ (totalData && (totalData.putQty || totalData.putQty==0)) ?totalData.putQty : '--' }}</a-col>
+                  <a-col span="4">本期收入单价:{{ (totalData && (totalData.putPrice || totalData.putPrice==0)) ? toThousands(totalData.putPrice) : '--' }}</a-col>
+                  <a-col span="4">本期收入金额:{{ (totalData && (totalData.putAmount || totalData.putAmount==0)) ? toThousands(totalData.putAmount) : '--' }}</a-col>
+                  <a-col span="4">本期发出数量:{{ (totalData && (totalData.outQty || totalData.outQty==0)) ? totalData.outQty : '--' }}</a-col>
+                  <a-col span="4">本期发出单价:{{ (totalData && (totalData.outPrice || totalData.outPrice==0)) ? toThousands(totalData.outPrice) : '--' }}</a-col>
+                  <a-col span="4">本期发出金额:{{ (totalData && (totalData.outAmount || totalData.outAmount==0)) ? toThousands(totalData.outAmount) : '--' }}</a-col>
+                  <a-col span="4">本期结存数量:{{ (totalData && (totalData.endQty || totalData.endQty==0)) ? totalData.endQty : '--' }}</a-col>
+                  <a-col span="4">本期结存单价:{{ (totalData && (totalData.endPrice || totalData.endPrice==0)) ? toThousands(totalData.endPrice) : '--' }}</a-col>
+                  <a-col span="4">本期结存金额:{{ (totalData && (totalData.endAmount || totalData.endAmount==0)) ? toThousands(totalData.endAmount) : '--' }}</a-col>
+                </a-row>
+              </a-col>
+            </a-row>
+          </template>
+        </s-table>
       </a-tab-pane>
       <a-tab-pane key="2" tab="汇总" force-render>
-        <gatherList ref="gatherBox" :queryParam="queryParam"></gatherList>
+        <gatherList ref="gatherBox" :tableHeight="tableHeight" :queryParam="queryParam"></gatherList>
       </a-tab-pane>
     </a-tabs>
+    <!-- 导出提示框 -->
+    <reportModal :visible="showExport" @close="showExport=false"></reportModal>
   </a-card>
 </template>
 
@@ -114,6 +114,7 @@ import { commonMixin } from '@/utils/mixin'
 import ProductBrand from '@/views/common/productBrand.js'
 import productTypeAll from '@/views/common/productTypeAll.js'
 import { STable, VSelect } from '@/components'
+import reportModal from '@/views/common/reportModal.vue'
 import { queryDetailReportPage, exportDetailReport, exportGroupByProductTypeReport, queryReportCount } from '@/api/reportData'
 import { hdExportExcel } from '@/libs/exportExcel'
 import gatherList from './list'
@@ -121,7 +122,7 @@ import moment from 'moment'
 export default {
   name: 'PriceDifferenceDetailReportList',
   mixins: [commonMixin],
-  components: { STable, VSelect, ProductBrand, gatherList, productTypeAll },
+  components: { STable, VSelect, ProductBrand, gatherList, productTypeAll, reportModal },
   data () {
     return {
       moment,
@@ -147,24 +148,25 @@ export default {
       disabled: false,
       tableHeight: 0,
       endOpen: false,
+      showExport: false,
       columns: [
-        { title: '产品编码', dataIndex: 'productCode', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '产品名称', dataIndex: 'productName', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '原厂编码', dataIndex: 'productOrigCode', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '品牌', dataIndex: 'productBrandName', width: '20%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
-        { title: '二级分类', dataIndex: 'productTypeName2', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '三级分类', dataIndex: 'productTypeName3', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '产品编码', dataIndex: 'productCode', width: '15%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '产品名称', dataIndex: 'productName', width: '30%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
+        { title: '原厂编码', dataIndex: 'productOrigCode', width: '20%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '品牌', dataIndex: 'productBrandName', width: '15%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
+        { title: '二级分类', dataIndex: 'productTypeName2', width: '20%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '三级分类', dataIndex: 'productTypeName3', width: '20%', align: 'center', customRender: function (text) { return text || '--' } },
         { title: '单位', dataIndex: 'productUnit', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
         { title: '期初结存数量', dataIndex: 'beginQty', width: '12%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-        { title: '期初结存单价', dataIndex: 'beginPrice', width: '12%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-        { title: '期初结存金额', dataIndex: 'beginAmount', width: '12%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-        { title: '本期收入数量', dataIndex: 'putQty', width: '12%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '期初结存单价', dataIndex: 'beginPrice', width: '12%', align: 'center', customRender: text => ((text || text == 0) ? this.toThousands(text) : '--') },
+        { title: '期初结存金额', dataIndex: 'beginAmount', width: '12%', align: 'center', customRender: text => ((text || text == 0) ? this.toThousands(text) : '--') },
+        { title: '本期收入数量', dataIndex: 'putQty', width: '12%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
         { title: '本期收入单价', dataIndex: 'putPrice', width: '12%', align: 'right', customRender: text => ((text || text == 0) ? this.toThousands(text) : '--') },
         { title: '本期收入金额', dataIndex: 'putAmount', width: '12%', align: 'right', customRender: text => ((text || text == 0) ? this.toThousands(text) : '--') },
         { title: '本期发出数量', dataIndex: 'outQty', width: '12%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
         { title: '本期发出单价', dataIndex: 'outPrice', width: '12%', align: 'right', customRender: text => ((text || text == 0) ? this.toThousands(text) : '--') },
         { title: '本期发出金额', dataIndex: 'outAmount', width: '12%', align: 'right', customRender: text => ((text || text == 0) ? this.toThousands(text) : '--') },
-        { title: '期末结存数量', dataIndex: 'endQty', scopedSlots: { customRender: 'nums' }, width: '12%', align: 'center' },
+        { title: '期末结存数量', dataIndex: 'endQty', width: '12%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
         { title: '期末结存单价', dataIndex: 'endPrice', width: '12%', align: 'right', customRender: text => ((text || text == 0) ? this.toThousands(text) : '--') },
         { title: '期末结存金额', dataIndex: 'endAmount', width: '12%', align: 'right', customRender: text => ((text || text == 0) ? this.toThousands(text) : '--') }
       ],
@@ -248,8 +250,9 @@ export default {
     handleExport () {
       const _this = this
       const params = this.queryParam
-      this.exportLoading = true
-      this.spinning = true
+      _this.exportLoading = true
+      _this.spinning = true
+      _this.showExport = true
       if (this.tabVal == 1) {
         hdExportExcel(exportDetailReport, params, '进销存明细报表', function () {
           _this.exportLoading = false
@@ -262,8 +265,8 @@ export default {
         })
       }
     },
-    // 查询
-    handleSearch () {
+    // 验证表单 type值  search查询 export导出
+    testForm (type) {
       const _this = this
       if (_this.form.time.length != 2) {
         _this.$message.error('请选择月份')
@@ -271,11 +274,10 @@ export default {
       }
       _this.$refs.ruleForm.validate(valid => {
         if (valid) {
-          if (_this.tabVal == 1) {
-            _this.$refs.table.refresh(true)
+          if (type == 'search') {
+            _this.handleSearch()
           } else {
-            console.log('22222222222222')
-            _this.$refs.gatherBox.resetCurForm()
+            _this.handleExport()
           }
         } else {
           _this.$message.error('请选择月份')
@@ -283,6 +285,15 @@ export default {
         }
       })
     },
+    // 查询
+    handleSearch () {
+      const _this = this
+      if (_this.tabVal == 1) {
+        _this.$refs.table.refresh(true)
+      } else {
+        _this.$refs.gatherBox.resetCurForm()
+      }
+    },
     // 重置
     resetSearchForm () {
       this.$refs.ruleForm.resetFields()

+ 25 - 10
src/views/reportData/receivedSendStorageReport/list.vue

@@ -8,7 +8,7 @@
       :rowKey="(record) => record.id"
       :columns="columns"
       :data="loadData"
-      :scroll="{ y: 149 }"
+      :scroll="{ y: tableHeight-120 }"
       :defaultLoadData="false"
       bordered>
       <template slot="footer">
@@ -38,7 +38,7 @@
 
 <script>
 import { commonMixin } from '@/utils/mixin'
-import { queryGroupByprodTypeReportPage } from '@/api/reportData'
+import { queryGroupByprodTypeReportPage, queryReportCount } from '@/api/reportData'
 import { STable, VSelect } from '@/components'
 export default {
   name: 'QueryPart',
@@ -51,24 +51,28 @@ export default {
       default: function () {
         return {}
       }
+    },
+    tableHeight: {
+      type: Number,
+      default: 0
     }
   },
   data () {
     return {
       columns: [
-        { title: '二级分类', dataIndex: 'productTypeName2', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '三级分类', dataIndex: 'productTypeName3', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '品牌', dataIndex: 'productBrandName', width: '20%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
+        { title: '二级分类', dataIndex: 'productTypeName2', width: '15%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '三级分类', dataIndex: 'productTypeName3', width: '15%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '品牌', dataIndex: 'productBrandName', width: '15%', align: 'center', customRender: function (text) { return text || '--' } },
         { title: '期初结存数量', dataIndex: 'beginQty', width: '12%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-        { title: '期初结存单价', dataIndex: 'beginPrice', width: '12%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-        { title: '期初结存金额', dataIndex: 'beginAmount', width: '12%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-        { title: '本期收入数量', dataIndex: 'putQty', width: '12%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '期初结存单价', dataIndex: 'beginPrice', width: '12%', align: 'center', customRender: text => ((text || text == 0) ? this.toThousands(text) : '--') },
+        { title: '期初结存金额', dataIndex: 'beginAmount', width: '12%', align: 'center', customRender: text => ((text || text == 0) ? this.toThousands(text) : '--') },
+        { title: '本期收入数量', dataIndex: 'putQty', width: '12%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
         { title: '本期收入单价', dataIndex: 'putPrice', width: '12%', align: 'right', customRender: text => ((text || text == 0) ? this.toThousands(text) : '--') },
         { title: '本期收入金额', dataIndex: 'putAmount', width: '12%', align: 'right', customRender: text => ((text || text == 0) ? this.toThousands(text) : '--') },
         { title: '本期发出数量', dataIndex: 'outQty', width: '12%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
         { title: '本期发出单价', dataIndex: 'outPrice', width: '12%', align: 'right', customRender: text => ((text || text == 0) ? this.toThousands(text) : '--') },
         { title: '本期发出金额', dataIndex: 'outAmount', width: '12%', align: 'right', customRender: text => ((text || text == 0) ? this.toThousands(text) : '--') },
-        { title: '期末结存数量', dataIndex: 'endQty', scopedSlots: { customRender: 'nums' }, width: '12%', align: 'center' },
+        { title: '期末结存数量', dataIndex: 'endQty', width: '12%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
         { title: '期末结存单价', dataIndex: 'endPrice', width: '12%', align: 'right', customRender: text => ((text || text == 0) ? this.toThousands(text) : '--') },
         { title: '期末结存金额', dataIndex: 'endAmount', width: '12%', align: 'right', customRender: text => ((text || text == 0) ? this.toThousands(text) : '--') }
       ],
@@ -77,7 +81,8 @@ export default {
       // 加载数据方法 必须为 Promise 对象
       loadData: parameter => {
         this.disabled = true
-        return queryGroupByprodTypeReportPage(Object.assign(parameter, this.queryParam)).then(res => {
+        const params = Object.assign(parameter, this.queryParam)
+        return queryGroupByprodTypeReportPage(params).then(res => {
           let data
           if (res.status == 200) {
             data = res.data
@@ -86,6 +91,7 @@ export default {
               data.list[i].no = no + i + 1
             }
             this.disabled = false
+            this.getCount(params)
           }
           this.spinning = false
           return data
@@ -94,6 +100,15 @@ export default {
     }
   },
   methods: {
+    getCount (params) {
+      queryReportCount(params).then(res => {
+        if (res.status == 200) {
+          this.totalData = res.data
+        } else {
+          this.totalData = null
+        }
+      })
+    },
     pageInit (buyerSn) {
       this.resetCurForm()
     },