Pārlūkot izejas kodu

装箱单成衣导出

jbb 2 gadi atpakaļ
vecāks
revīzija
f0cc5c5f6b
1 mainītis faili ar 52 papildinājumiem un 0 dzēšanām
  1. 52 0
      src/views/packing-list/clothes-list.vue

+ 52 - 0
src/views/packing-list/clothes-list.vue

@@ -91,6 +91,7 @@
         <a-button type="primary" @click="push" icon="export">推送</a-button>
         <a-button type="primary" @click="bitchSubmit" icon="check">批量提交</a-button>
         <a-button type="primary" @click="bitchCanelSubmit" icon="close">批量取消提交</a-button>
+        <a-button type="primary" icon="download" @click="handleExportXls('装箱单-成衣')">导出</a-button>
         <a-upload  name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl"  @change="handleImportExcel" >
           <a-button type="primary" icon="import">导入</a-button>
         </a-upload>
@@ -168,6 +169,7 @@
               <!-- <a-menu-item><a @click="submit(record)">提交</a></a-menu-item> -->
               <a-menu-item><a @click="details(record)">详情</a></a-menu-item>
               <a-menu-item><a @click="edit(record)">编辑</a></a-menu-item>
+              <a-menu-item><a @click="itemXls(record)">导出</a></a-menu-item>
               <a-menu-item>
                 <a-popconfirm title="确定删除吗?" ok-text="是" cancel-text="否" @confirm="handleDelete(record.id)">
                   <a href="javascript:void(0);" style="color:red;">删除</a>
@@ -180,6 +182,8 @@
               <a-menu-item>
                 <a @click="details(record)">详情</a>
               </a-menu-item>
+              <a-menu-item><a @click="itemXls(record)">导出</a></a-menu-item>
+
 
               <!-- <a-menu-item>
                 <a-popconfirm title="确定取消提交吗?" ok-text="是" cancel-text="否" @confirm="cancelSubmit(record)">
@@ -210,6 +214,7 @@
 
 <script>
 import { JeecgListMixin } from '@/mixins/JeecgListMixin'
+import { downFile } from '@/api/manage'
 import JEllipsis from '@/components/jeecg/JEllipsis'
 import clothesAddDrawer from '@views/packing-list/packinglist-clothes/clothesAddDrawer.vue'
 import detailsClothesDrawer from '@views/packing-list/packinglist-clothes/detailsClothesDrawer.vue'
@@ -581,6 +586,53 @@ export default {
     // --------------------------------------
     // 操作 附件上传
     accessoryUpload() {},
+
+    // 列表导出
+    handleExportXls(fileName) {
+      downFile('/splt/syPackingListTailoring/exportXls').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对象
+        }
+      })
+    },
+
+     // 操作 单条数据导出
+    itemXls(record) {
+       downFile('/splt/syPackingListTailoring/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) {
      SubmitList({id:record.id}).then(res =>{