Przeglądaj źródła

成本分配表-面料-转入数量导出

jbb 2 lat temu
rodzic
commit
6e78b42aaa

+ 9 - 0
src/api/manage.js

@@ -129,6 +129,15 @@ export function downFile(url,parameter){
   })
 }
 
+export function downFile1(url,parameter){
+  return axios({
+    url: url,
+    data: parameter,
+    method:'post' ,
+    responseType: 'blob'
+  })
+}
+
 /**
  * 下载文件
  * @param url 文件路径

+ 34 - 23
src/views/cost-allocation-total/modal/fabInQuaModal.vue

@@ -20,7 +20,7 @@
         <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" @click="print" icon="printer" style="margin:0 10px;">打印</a-button> -->
             <a-button type="primary" @click="cancel" icon="rollback">取消</a-button>
           </span>
         </a-col>
@@ -34,7 +34,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: 'FabInQuaModal', // 面料 转入数量 弹框
@@ -97,6 +97,7 @@ export default {
       data: [],
       loading: false,
       confirmLoading: false,
+      planNum:'',
       fabInQuaModVis: false
     }
   },
@@ -105,35 +106,45 @@ export default {
     father: {
       type: Function,
       default: null
+    },
+    planNum:{
+      type: String,
+      default: null
     }
+
   },
 
   methods: {
     // 导出
     handleExportXls(fileName) {
       console.log('需导出的fileName:', fileName)
-      const params = this.dyeLossRateData
+      const params = {
+        planNum:this.planNum,
+        syTransfer :this.data
+      }
       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对象
-      //   }
-      // })
+      // var json = JSON.stringify(params)
+      // debugger
+      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' }), 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对象
+        }
+      })
     },
     changeUnitCost(record){
       record.cost = record.unitCost*record.number

+ 1 - 2
src/views/reportForms/cost-allocation-table.vue

@@ -299,7 +299,7 @@
 
     <!--tabs 组件引入  -->
     <a-card :bordered="false" style=" marginTop:10px;">
-      <div><tabs ref="unitTabs" :showSelect='showSelect'  @number="number" /></div>
+      <div><tabs ref="unitTabs" :showSelect='showSelect'  @number="number" :planNum="this.detailsPlanNum.planNum"/></div>
     </a-card>
 
     <!-- 事故单 -->
@@ -568,7 +568,6 @@ export default {
             })
             // tabs 名称集合
             this.$refs.unitTabs.tabNameList = res.result.processUnit.split(',')
-
             //所有tabs数据
             this.$refs.unitTabs.tabsAllData = res.result.processUnitList
 

+ 7 - 2
src/views/reportForms/cost-allocation-table/tabs.vue

@@ -178,7 +178,7 @@
     <!-- tabs内弹框 -->
     <div>
       <!-- 面料 转入数量 -->
-      <fabInQua-modal ref="fabInQuaModal" :father="aa"></fabInQua-modal>
+      <fabInQua-modal ref="fabInQuaModal" :father="aa"  :planNum="this.planNum"></fabInQua-modal>
 
       <!-- 余下数量 -->
       <fabRemQua-modal ref="fabRemQuaModal" :father="bb"></fabRemQua-modal>
@@ -638,6 +638,10 @@ export default {
     showAll: {
       type: String,
       default: null
+    },
+    planNum:{
+      type: String,
+      default: null
     }
   },
 
@@ -656,7 +660,7 @@ export default {
     Refresh(){
       setTimeout(()=> {
       this.$forceUpdate();
-      this.$refs.table.doLayout()
+      // this.$refs.table.doLayout()
     },200)
     },
     tabsCallback(key) {
@@ -727,6 +731,7 @@ export default {
           click: event => {
             console.log('辅料 - 转入数量')
             this.$refs.ingInQuaModal.ingInQuaModVis = true
+            this.$refs.ingInQuaModal.planNum = this.planNum
             record.syTransfers.map(item=>{
               if(item.unitCost){
                item.unitCost =  (item.unitCost).toFixed(3)