浏览代码

产品、调拨 导出

chenrui 4 年之前
父节点
当前提交
7743aede56

+ 8 - 0
src/api/allocateBill.js

@@ -51,6 +51,14 @@ export const allocateBillSubmit = params => {
     method: 'get'
   })
 }
+//  调拨管理 导出
+export const allocateBillExport = (params) => {
+  return axios({
+    url: '/allocateBill/exportExcel',
+    data: params,
+    method: 'post'
+  })
+}
 //  调拨管理  明细 列表  分页
 export const allocateBillDetailList = (params) => {
   const url = `/allocateBill/detail/queryPage/${params.pageNo}/${params.pageSize}`

+ 8 - 0
src/api/product.js

@@ -37,6 +37,14 @@ export const productDel = (params) => {
     method: 'get'
   })
 }
+//  产品 导出
+export const productExport = (params) => {
+  return axios({
+    url: '/product/exportExcel',
+    data: params,
+    method: 'post'
+  })
+}
 //  产品 详情  根据sn查询
 export const productSnDetail = (params) => {
   return axios({

+ 37 - 1
src/views/allocationManagement/transferOut/list.vue

@@ -50,6 +50,13 @@
           <a-col :md="6" :sm="24" style="margin-bottom: 24px;">
             <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="allocateBillList-refresh">查询</a-button>
             <a-button style="margin-left: 8px" @click="resetSearchForm" :disabled="disabled" id="allocateBillList-reset">重置</a-button>
+            <a-button
+              style="margin: 0 0 18px 8px"
+              type="danger"
+              @click="handleExport"
+              :disabled="disabled"
+              :loading="exportLoading"
+              id="allocateBillList-export">导出</a-button>
             <a @click="advanced=!advanced" style="margin-left: 8px">
               {{ advanced ? '收起' : '展开' }}
               <a-icon :type="advanced ? 'up' : 'down'"/>
@@ -115,7 +122,7 @@
 import moment from 'moment'
 import { STable, VSelect } from '@/components'
 import basicInfoModal from './basicInfoModal.vue'
-import { allocateBillList, allocateBillDel, allocateBillAudit } from '@/api/allocateBill'
+import { allocateBillList, allocateBillDel, allocateBillAudit, allocateBillExport } from '@/api/allocateBill'
 import { allocateTypeAllList } from '@/api/allocateType'
 export default {
   components: { STable, VSelect, basicInfoModal },
@@ -131,6 +138,7 @@ export default {
         allocateNo: '' //  调拨单号
       },
       disabled: false, //  查询、重置按钮是否可操作
+      exportLoading: false,
       dateFormat: 'YYYY-MM-DD',
       columns: [
         { title: '序号', dataIndex: 'no', width: 80, align: 'center' },
@@ -250,6 +258,34 @@ export default {
     handleEdit (row) {
       this.$router.push({ path: `/allocationManagement/transferOut/edit/${row.id}/${row.allocateSn}/${row.targetName}` })
     },
+    //  导出
+    handleExport () {
+      const params = this.queryParam
+      if (this.createDate && this.createDate.length) {
+        params.beginDate = moment(this.createDate[0]).format('YYYY-MM-DD')
+        params.endDate = moment(this.createDate[1]).format('YYYY-MM-DD')
+      } else {
+        params.beginDate = ''
+        params.endDate = ''
+      }
+      this.exportLoading = true
+      allocateBillExport(params).then(res => {
+        this.exportLoading = false
+        this.download(res)
+      })
+    },
+    download (data) {
+      if (!data) { return }
+      const url = window.URL.createObjectURL(new Blob([data]))
+      const link = document.createElement('a')
+      link.style.display = 'none'
+      link.href = url
+      const a = moment().format('YYYYMMDDHHmmss')
+      const fname = '调拨列表' + a
+      link.setAttribute('download', fname + '.xlsx')
+      document.body.appendChild(link)
+      link.click()
+    },
     //  调拨类型
     getAllocateTypeAllList () {
       allocateTypeAllList().then(res => {

+ 31 - 1
src/views/productManagement/productInfo/list.vue

@@ -57,6 +57,13 @@
           <a-col :md="6" :sm="24">
             <a-button style="margin-bottom: 18px;" type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="productInfoList-refresh">查询</a-button>
             <a-button style="margin: 0 0 18px 8px" @click="resetSearchForm" :disabled="disabled" id="productInfoList-reset">重置</a-button>
+            <a-button
+              style="margin: 0 0 18px 8px"
+              type="danger"
+              @click="handleExport"
+              :disabled="disabled"
+              :loading="exportLoading"
+              id="productInfoList-export">导出</a-button>
             <a @click="advanced=!advanced" style="margin-left: 8px">
               {{ advanced ? '收起' : '展开' }}
               <a-icon :type="advanced ? 'up' : 'down'"/>
@@ -168,12 +175,13 @@
 </template>
 
 <script>
+import moment from 'moment'
 import { STable, VSelect } from '@/components'
 import productInfoDetailModal from './detailModal.vue'
 import productInfoOfflineModal from './offlineModal.vue'
 import { productBrandQuery } from '@/api/productBrand'
 import { productTypeQuery } from '@/api/productType'
-import { productList, productAudit, productBatchAudit, productDel, productOnline, productBatchOnline } from '@/api/product'
+import { productList, productAudit, productBatchAudit, productDel, productOnline, productBatchOnline, productExport } from '@/api/product'
 export default {
   components: { STable, VSelect, productInfoDetailModal, productInfoOfflineModal },
   data () {
@@ -192,6 +200,7 @@ export default {
       },
       productType: [],
       disabled: false, //  查询、重置按钮是否可操作
+      exportLoading: false,
       columns: [
         { title: '序号', dataIndex: 'no', width: 80, align: 'center' },
         { title: '创建时间', dataIndex: 'createDate', width: 160, align: 'center', customRender: function (text) { return text || '--' } },
@@ -465,6 +474,27 @@ export default {
       this.offlineProductList = []
       this.openOfflineModal = false
     },
+    //  导出
+    handleExport () {
+      const params = this.queryParam
+      this.exportLoading = true
+      productExport(params).then(res => {
+        this.exportLoading = false
+        this.download(res)
+      })
+    },
+    download (data) {
+      if (!data) { return }
+      const url = window.URL.createObjectURL(new Blob([data]))
+      const link = document.createElement('a')
+      link.style.display = 'none'
+      link.href = url
+      const a = moment().format('YYYYMMDDHHmmss')
+      const fname = '产品列表' + a
+      link.setAttribute('download', fname + '.xlsx')
+      document.body.appendChild(link)
+      link.click()
+    },
     //  产品分类  change
     changeProductType (val, opt) {
       this.queryParam.productTypeSn1 = val[0] ? val[0] : ''