Jelajahi Sumber

出入库明细 导出

chenrui 3 tahun lalu
induk
melakukan
e5aaf917b4

+ 9 - 0
src/api/stock.js

@@ -109,3 +109,12 @@ export const stockByProductSn = (params) => {
     method: 'post'
   })
 }
+//  库存 出入库明细 导出
+export const stockFlowExport = (params) => {
+  return axios({
+    url: '/stock/exportStockFlow',
+    data: params,
+    method: 'post',
+    responseType: 'blob'
+  })
+}

+ 25 - 3
src/views/inventoryManagement/inventoryQuery/warehouseDetail.vue

@@ -66,8 +66,17 @@
               </template>
               <a-col :md="6" :sm="24">
                 <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="inventoryQueryWarehouseDetail-refresh">查询</a-button>
-                <a-button style="margin-left: 8px" @click="resetSearchForm" :disabled="disabled" id="inventoryQueryWarehouseDetail-reset">重置</a-button>
-                <a @click="advanced=!advanced" style="margin-left: 8px">
+                <a-button style="margin-left: 5px" @click="resetSearchForm" :disabled="disabled" id="inventoryQueryWarehouseDetail-reset">重置</a-button>
+                <a-button
+                  type="primary"
+                  style="margin-left: 5px"
+                  class="button-warning"
+                  v-if="$hasPermissions('B_inventoryQuery_rkDetail_export')"
+                  @click="handleExcel"
+                  :disabled="disabled"
+                  :loading="exportLoading"
+                  id="inventoryQueryList-export">导出</a-button>
+                <a @click="advanced=!advanced" style="margin-left: 5px">
                   {{ advanced ? '收起' : '展开' }}
                   <a-icon :type="advanced ? 'up' : 'down'"/>
                 </a>
@@ -110,7 +119,8 @@
 <script>
 import { STable, VSelect } from '@/components'
 import rangeDate from '@/views/common/rangeDate.vue'
-import { stockFlowCount, stockFlowList } from '@/api/stock'
+import { hdExportExcel } from '@/libs/exportExcel'
+import { stockFlowCount, stockFlowList, stockFlowExport } from '@/api/stock'
 import { warehouseAllList } from '@/api/warehouse'
 export default {
   components: { STable, VSelect, rangeDate },
@@ -151,6 +161,7 @@ export default {
           return data
         })
       },
+      exportLoading: false,
       warehouseList: [], //  仓库  下拉数据
       productTotal: null //  合计
     }
@@ -209,6 +220,17 @@ export default {
       this.queryParam.state = undefined
       this.$refs.table.refresh(true)
     },
+    // 导出
+    handleExcel () {
+      const _this = this
+      const params = Object.assign(this.queryParam, { productSn: this.$route.params.sn })
+      this.exportLoading = true
+      this.spinning = true
+      hdExportExcel(stockFlowExport, params, '出入库明细', function () {
+        _this.exportLoading = false
+        _this.spinning = false
+      })
+    },
     //  返回列表
     handleBack () {
       this.$router.push({ path: '/inventoryManagement/inventoryQuery/list', query: { closeLastOldTab: true } })