Parcourir la source

成本分配-辅料余下-导出

jbb il y a 1 an
Parent
commit
8c1015f915
1 fichiers modifiés avec 28 ajouts et 24 suppressions
  1. 28 24
      src/views/cost-allocation-total/modal/ingRemQuaModal.vue

+ 28 - 24
src/views/cost-allocation-total/modal/ingRemQuaModal.vue

@@ -15,8 +15,8 @@
       <a-row style="marginTop:20px;">
         <a-col :md="24" :sm="12">
           <span style="float: right;" class="table-operator">
-            <a-button type="primary" icon="download" @click="handleExportXls('成本分配-辅料-转入数量')">导出</a-button>
-            <a-button type="primary" @click="print" icon="printer" style="margin:0 10px;">打印</a-button>
+            <a-button type="primary" icon="download" @click="handleExportXls('辅料转入')">导出</a-button>
+            <!-- <a-button type="primary" @click="print" icon="printer" style="margin:0 10px;">打印</a-button> -->
             <a-button type="primary" @click="cancel" icon="rollback">取消</a-button>
           </span>
         </a-col>
@@ -30,7 +30,7 @@ import { JeecgListMixin } from '@/mixins/JeecgListMixin'
 import JEllipsis from '@/components/jeecg/JEllipsis'
 import moment from 'moment'
 
-import { downFile } from '@/api/manage'
+import { downFile,downFile1 } from '@/api/manage'
 
 export default {
   name: 'IngRemQuaModal', // 辅料 余下数量 弹框
@@ -94,28 +94,32 @@ export default {
     // 导出
     handleExportXls(fileName) {
       console.log('需导出的fileName:', fileName)
-      const params = this.dyeLossRateData
+      const params = {
+        planNum:this.planNum,
+        sytransferIngreDeent :this.data,
+        sheetName:'辅料余下'
+      }
       console.log('导出参数', params)
-      // downFile('/scas/dyeLoss/excel', params).then(data => {
-      //   console.log('888')
-      //   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对象
-      //   }
-      // })
+      downFile1('/cost/syCostAllocation/exportXlsSyCostAllocation', params).then(data => {
+        console.log('888')
+        if (!data) {
+          this.$message.warning('文件下载失败')
+          return
+        }
+        if (typeof window.navigator.msSaveBlob !== 'undefined') {
+          window.navigator.msSaveBlob(new Blob([data], { type: 'application/vnd.ms-excel' }), this.planNum+'-'+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 + '.xlsx')
+          document.body.appendChild(link)
+          link.click()
+          document.body.removeChild(link) // 下载完成移除元素
+          window.URL.revokeObjectURL(url) // 释放掉blob对象
+        }
+      })
     },
     // 打印
     print() {},