Browse Source

预装箱单导出功能

jbb 2 years ago
parent
commit
9eebd29b61
1 changed files with 43 additions and 25 deletions
  1. 43 25
      src/views/advance-packingList/adPaList-clothes.vue

+ 43 - 25
src/views/advance-packingList/adPaList-clothes.vue

@@ -124,7 +124,7 @@
 
         <!-- 操作 默认按钮  未提交未推送-->
         <span slot="operationSlot" slot-scope="text, record">
-          <a href="javascript:void(0);" @click="itemXls('')" style="color:green">导出</a>
+          <a href="javascript:void(0);" @click="itemXls(record)" style="color:green">导出</a>
 
           <a-divider type="vertical" />
 
@@ -227,10 +227,11 @@
 import { JeecgListMixin } from '@/mixins/JeecgListMixin'
 import JEllipsis from '@/components/jeecg/JEllipsis'
 import moment from 'moment'
+import { downFile } from '@/api/manage'
 import addAdpackingDrawer from '@views/advance-packingList/addAdpackingDrawer.vue'
 import detailsAdpackingDrawer from '@views/advance-packingList/detailsAdpackingDrawer.vue'
 
-import { getadPaList, itemByMainId, submit, cancelSubmit, deleteAdPaList,batchSubmit,batchPush,push,batchCanelSubmit} from '@api/document/advance-packingList.js'
+import { getadPaList, itemByMainId, submit, cancelSubmit, deleteAdPaList,batchSubmit,batchPush,push,batchCanelSubmit,exportList} from '@api/document/advance-packingList.js'
 
 export default {
   productName: 'AdPaListClothes', // 预装箱单-成衣
@@ -566,28 +567,25 @@ export default {
 
     // 列表导出
     handleExportXls(fileName) {
-      console.log('需导出的fileName:', fileName)
-      const params = this.dyeLossRateData
-      console.log('导出参数', params)
-      // downFile('/scas/dyeLoss/excel', params).then(data => {
-      //   if (!data) {
-      //     this.$message.warning('文件下载失败')
-      //     return
-      //   }
-      //   if (typeof window.navigator.msSaveBlob !== 'undefined') {
-      //     window.navigator.msSaveBlob(new Blob([data], { type: 'application/vnd.ms-excel' }), fileName + '.xls')
-      //   } else {
-      //     let url = window.URL.createObjectURL(new Blob([data], { type: 'application/vnd.ms-excel' }))
-      //     let link = document.createElement('a')
-      //     link.style.display = 'none'
-      //     link.href = url
-      //     link.setAttribute('download', fileName + '.xls')
-      //     document.body.appendChild(link)
-      //     link.click()
-      //     document.body.removeChild(link) // 下载完成移除元素
-      //     window.URL.revokeObjectURL(url) // 释放掉blob对象
-      //   }
-      // })
+      downFile('/scas/dyeLoss/excel').then(data => {
+        if (!data) {
+          this.$message.warning('文件下载失败')
+          return
+        }
+        if (typeof window.navigator.msSaveBlob !== 'undefined') {
+          window.navigator.msSaveBlob(new Blob([data], { type: 'application/vnd.ms-excel' }), fileName + '.xls')
+        } else {
+          let url = window.URL.createObjectURL(new Blob([data], { type: 'application/vnd.ms-excel' }))
+          let link = document.createElement('a')
+          link.style.display = 'none'
+          link.href = url
+          link.setAttribute('download', fileName + '.xls')
+          document.body.appendChild(link)
+          link.click()
+          document.body.removeChild(link) // 下载完成移除元素
+          window.URL.revokeObjectURL(url) // 释放掉blob对象
+        }
+      })
     },
 
     //  删除
@@ -625,7 +623,27 @@ export default {
     },
 
     // 操作 单条数据导出
-    itemXls() {},
+    itemXls(record) {
+       downFile('/spapl/syPreAssembledPackingList/exportXls',{id:record.id}).then(data => {
+         if (!data) {
+          this.$message.warning('文件下载失败')
+          return
+        }
+         if (typeof window.navigator.msSaveBlob !== 'undefined') {
+          window.navigator.msSaveBlob(new Blob([data], { type: 'application/vnd.ms-excel' }), item + '.xlsx')
+        }else {
+          let url = window.URL.createObjectURL(new Blob([data], { type: 'application/vnd.ms-excel' }))
+          let link = document.createElement('a')
+          link.style.display = 'none'
+          link.href = url
+          link.setAttribute('download', '预装箱单' + '.xlsx')
+          document.body.appendChild(link)
+          link.click()
+          document.body.removeChild(link) // 下载完成移除元素
+          window.URL.revokeObjectURL(url) // 释放掉blob对象
+        }
+       })
+    },
     //  提交
     submit(record) {
       var that = this;