yuhan 1 yıl önce
ebeveyn
işleme
61f5e4f13e

+ 35 - 4
src/views/module_kzks/projectCostList/ProjectCostList.vue

@@ -117,7 +117,7 @@
       <a-button @click="handleExpand" type="primary" icon="column-height">折叠/展开</a-button>
       <a-button @click="handleAdd" type="primary" icon="plus">导入</a-button>
       <a-button @click="handleComputed" type="primary" icon="reconciliation">计算</a-button>
-      <!-- <a-button type="primary" icon="download" @click="handleExportXls('项目成本')">导出</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> -->
@@ -333,7 +333,7 @@
   import ProjectDetailModal from './modulesDetail/ProjectDetailModal'
   import AllList from '../projectContrastList/allList.vue'
   import WuliaoList from '../projectContrastList/wuliaoList.vue'
-  import { getAction } from '@/api/manage'
+  import { getAction, downFile } from '@/api/manage'
   import ContrastModal from '../projectXushiContrast/contrastModal.vue'
   import ProjectImportListModal from '../projectImportList/modules/ProjectImportListModal.vue'
 import { number } from 'echarts';
@@ -838,7 +838,7 @@ import { number } from 'echarts';
           list: "/projectCostHuiji/projectCostHuiji/list",
           // delete: "/projectCost/projectCost/delete",
           // deleteBatch: "/projectCost/projectCost/deleteBatch",
-          exportXlsUrl: "/projectCostHuiji/projectCostHuiji/exportXls",
+          exportXlsUrl: "/projectCostHuiji/projectCostHuiji/exportXlsProjectCost",
           importExcelUrl: "projectCost/projectCost/importExcel",
 
         },
@@ -1330,7 +1330,38 @@ import { number } from 'echarts';
         //   this.chooseRowType == 'huiji'
         // }
       },
-
+      // 导出
+      handleExportXls(fileName){
+        if(!fileName || typeof fileName != "string"){
+          fileName = "导出文件"
+        }
+        // let param = this.getQueryParams();
+        // if(this.selectedRowKeys && this.selectedRowKeys.length>0){
+        //   param['selections'] = this.selectedRowKeys.join(",")
+        // }
+        // console.log("导出参数",param)
+        var param = {isFolding: 0}
+        downFile(this.url.exportXlsUrl,param).then((data)=>{
+          console.log(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对象
+          }
+        })
+      },
       getSuperFieldList(){
         let fieldList=[];
         fieldList.push({type:'string',value:'taskno',text:'任务号',dictCode:''})