Procházet zdrojové kódy

项目报告导出功能

user5 před 2 roky
rodič
revize
007b91d0a4

+ 9 - 0
src/api/cw/reportManagement/ProjectReportService.js

@@ -85,4 +85,13 @@ export default class ProjectReportService {
       data: inputForm
     })
   }
+
+  exportExcel (params) {
+    return request({
+      url: '/cwProjectReport/export',
+      method: 'get',
+      params: params,
+      responseType: 'blob'
+    })
+  }
 }

+ 1 - 1
src/views/modules/cw/projectReportArchive/ProjectReportArchiveDetailList.vue

@@ -327,7 +327,7 @@
         }
         return this.projectReportArchiveDetailService.exportExcel(params).then((res) => {
           // 将二进制流文件写入excel表,以下为重要步骤
-          this.$utils.downloadExcel(res.data, options.filename)
+          this.$utils.downloadExcel(res.data, options.filename + '.xls')
         }).catch(function (err) {
           if (err.response) {
             console.log(err.response)

+ 37 - 4
src/views/modules/cw/reportManagement/ReportManagementList.vue

@@ -44,7 +44,7 @@
       </el-form-item>
     </el-form>
     <div class="bg-white top" style="">
-      <vxe-toolbar :refresh="{query: refreshList}" custom>
+      <vxe-toolbar :refresh="{query: refreshList}" export print custom>
         <template #buttons>
           <el-button v-if="hasPermission('cw_work_client:info:add')" type="primary" size="small" icon="el-icon-plus" @click="start()">新建</el-button>
           <!--          <el-button v-if="hasPermission('klg:question:del')" type="danger"   size="small" icon="el-icon-delete" @click="del()" :disabled="$refs.questionsTable && $refs.questionsTable.getCheckboxRecords().length === 0" plain>删除</el-button>-->
@@ -52,7 +52,6 @@
       </vxe-toolbar>
       <div style="height: calc(100% - 90px)">
         <vxe-table
-          :key="tableKey"
           border="inner"
           auto-resize
           resizable
@@ -63,6 +62,15 @@
           show-header-overflow
           show-overflow
           highlight-hover-row
+          :print-config="{}"
+          :export-config="{
+                    remote: true,
+                    filename: `报告信息${moment(new Date()).format('YYYY-MM-DD')}`,
+                    sheetName: '报告信息',
+                    exportMethod: exportMethod,
+                    types: ['xlsx'],
+                    modes: ['current', 'selected', 'all']
+                  }"
           :menu-config="{}"
           @sort-change="sortChangeHandle"
           :sort-config="{remote:true}"
@@ -433,12 +441,12 @@
       },
       // 归档
       // filed (id) {
-      //   this.processService.getByName('财务-合同登记归档').then(({data}) => {
+      //   this.processService.getByName('合同登记归档').then(({data}) => {
       //     if (!this.commonJS.isEmpty(data.id)) {
       //       // console.log('data', data)
       //       // 读取流程表单
       //       let tabTitle = `发起流程【财务-报告管理-盖公章】`
-      //       let processTitle = `${this.userName} 在 ${this.moment(new Date()).format('YYYY-MM-DD HH:mm')} 发起了 [财务-合同登记归档]`
+      //       let processTitle = `${this.userName} 在 ${this.moment(new Date()).format('YYYY-MM-DD HH:mm')} 发起了 [合同登记归档]`
       //       this.taskService.getTaskDef({ procDefId: data.id,
       //         businessId: id,
       //         businessTable: 'cw_work_contract_file',
@@ -614,6 +622,31 @@
             }
           })
         })
+      },
+      // 自定义服务端导出
+      exportMethod ({ options }) {
+        // 传给服务端的参数
+        const params = {
+          'current': this.tablePage.currentPage,
+          'size': this.tablePage.pageSize,
+          'orders': this.tablePage.orders,
+          ...this.searchForm,
+          filename: options.filename,
+          sheetName: options.sheetName,
+          isHeader: options.isHeader,
+          original: options.original,
+          mode: options.mode,
+          selectIds: options.mode === 'selected' ? options.data.map(item => item.id) : [],
+          exportFields: options.columns.map(column => column.property)
+        }
+        return this.projectReportService.exportExcel(params).then((res) => {
+          // 将二进制流文件写入excel表,以下为重要步骤
+          this.$utils.downloadExcel(res.data, options.filename + '.xls')
+        }).catch(function (err) {
+          if (err.response) {
+            console.log(err.response)
+          }
+        })
       }
     }
   }

+ 12 - 12
src/views/modules/cw/workContract/ContractRegistration.vue

@@ -369,8 +369,8 @@
       },
       start () {
         // 读取流程表单
-        let tabTitle = `发起流程【财务-合同登记】`
-        let processTitle = `${this.userName} 在 ${this.moment(new Date()).format('YYYY-MM-DD HH:mm')} 发起了 [财务-合同登记]`
+        let tabTitle = `发起流程【合同登记】`
+        let processTitle = `${this.userName} 在 ${this.moment(new Date()).format('YYYY-MM-DD HH:mm')} 发起了 [合同登记]`
         this.taskService.getTaskDef({ procDefId: this.processDefinitionId,
           status: 'startAndHold'}).then((data) => {
             this.$router.push({
@@ -392,8 +392,8 @@
       },
       editWithHold (row) {
         // 读取流程表单
-        let tabTitle = `发起流程【财务-合同登记】`
-        let processTitle = `${this.userName} 在 ${this.moment(new Date()).format('YYYY-MM-DD HH:mm')} 发起了 [财务-合同登记]`
+        let tabTitle = `发起流程【合同登记】`
+        let processTitle = `${this.userName} 在 ${this.moment(new Date()).format('YYYY-MM-DD HH:mm')} 发起了 [合同登记]`
         this.taskService.getTaskDef({ procDefId: this.processDefinitionId,
           businessId: row.id,
           businessTable: 'cw_work_contract_info',
@@ -418,8 +418,8 @@
       },
       editWithClose (row) {
         // 读取流程表单
-        let tabTitle = `发起流程【财务-合同登记】`
-        let processTitle = `${this.userName} 在 ${this.moment(new Date()).format('YYYY-MM-DD HH:mm')} 发起了 [财务-合同登记]`
+        let tabTitle = `发起流程【合同登记】`
+        let processTitle = `${this.userName} 在 ${this.moment(new Date()).format('YYYY-MM-DD HH:mm')} 发起了 [合同登记]`
         this.taskService.getTaskDef({ procDefId: this.processDefinitionId,
           businessId: row.id,
           businessTable: 'work_contract_info',
@@ -530,12 +530,12 @@
       },
       // 归档
       filed (id) {
-        this.processService.getByName('财务-合同登记归档').then(({data}) => {
+        this.processService.getByName('合同登记归档').then(({data}) => {
           if (!this.commonJS.isEmpty(data.id)) {
             // console.log('data', data)
             // 读取流程表单
-            let tabTitle = `发起流程【财务-合同登记归档】`
-            let processTitle = `${this.userName} 在 ${this.moment(new Date()).format('YYYY-MM-DD HH:mm')} 发起了 [财务-合同登记归档]`
+            let tabTitle = `发起流程【合同登记归档】`
+            let processTitle = `${this.userName} 在 ${this.moment(new Date()).format('YYYY-MM-DD HH:mm')} 发起了 [合同登记归档]`
             this.taskService.getTaskDef({ procDefId: data.id,
               businessId: id,
               businessTable: 'cw_work_contract_file',
@@ -562,12 +562,12 @@
       },
       // 归档
       filedAndClose (id) {
-        this.processService.getByName('财务-合同登记归档').then(({data}) => {
+        this.processService.getByName('合同登记归档').then(({data}) => {
           if (!this.commonJS.isEmpty(data.id)) {
             // console.log('data', data)
             // 读取流程表单
-            let tabTitle = `发起流程【财务-合同登记归档】`
-            let processTitle = `${this.userName} 在 ${this.moment(new Date()).format('YYYY-MM-DD HH:mm')} 发起了 [财务-合同登记归档]`
+            let tabTitle = `发起流程【合同登记归档】`
+            let processTitle = `${this.userName} 在 ${this.moment(new Date()).format('YYYY-MM-DD HH:mm')} 发起了 [合同登记归档]`
             this.taskService.getTaskDef({ procDefId: data.id,
               businessId: id,
               businessTable: 'cw_work_contract_file',