Browse Source

下载功能开发

user5 2 years ago
parent
commit
66c3bd1eb7

+ 8 - 0
src/api/cw/invoice/CwFinanceInvoiceService.js

@@ -106,4 +106,12 @@ export default class CwFinanceInvoiceService {
       params: {clientId: clientId, ...invoiceForm}
     })
   }
+  exportFile (params) {
+    return request({
+      url: '/cw_finance/invoice/export',
+      method: 'get',
+      params: params,
+      responseType: 'blob'
+    })
+  }
 }

+ 34 - 1
src/views/modules/cw/invoice/InvoiceList.vue

@@ -155,7 +155,7 @@
       </el-row>
     </el-form>
     <div class="bg-white top" style="">
-      <vxe-toolbar :refresh="{query: refreshList}" custom>
+      <vxe-toolbar :refresh="{query: refreshList}" export custom>
         <template #buttons>
           <el-button v-if="hasPermission('cw_finance:invoice:add')" type="primary" size="small" icon="el-icon-plus" @click="start()">新建</el-button>
 <!--          <el-button v-if="hasPermission('cw_finance:invoice:del')" type="danger"   size="small" icon="el-icon-delete" @click="del()" :disabled="$refs.invoiceTable && $refs.invoiceTable.getCheckboxRecords().length === 0" plain>删除</el-button>-->
@@ -175,6 +175,14 @@
           highlight-hover-row
           :menu-config="{}"
           @sort-change="sortChangeHandle"
+          :export-config="{
+                    remote: true,
+                    filename: `兴光会计发票数据${moment(new Date()).format('YYYY-MM-DD')}`,
+                    sheetName: `兴光会计发票数据${moment(new Date()).format('YYYY-MM-DD')}`,
+                    exportMethod: exportMethod,
+                    types: ['xlsx'],
+                    modes: ['current', 'selected', 'all']
+                  }"
           :sort-config="{remote:true}"
           :data="dataList"
           :checkbox-config="{}">
@@ -713,6 +721,31 @@
       clearProgram () {
         this.searchForm.programName = ''
         this.searchForm.programId = ''
+      },
+      // 自定义服务端导出
+      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.financeInvoiceService.exportFile(params).then((res) => {
+          // 将二进制流文件写入excel表,以下为重要步骤
+          this.$utils.downloadExcel(res.data, options.filename)
+        }).catch(function (err) {
+          if (err.response) {
+            console.log(err.response)
+          }
+        })
       }
     }
   }

+ 44 - 12
src/views/modules/cw/reimbursementApproval/info/InfoList.vue

@@ -89,11 +89,10 @@
     </el-form>
 
     <div class="bg-white top" style="">
-      <vxe-toolbar :refresh="{query: refreshList}" custom>
+      <vxe-toolbar :refresh="{query: refreshList}" export custom>
         <template #buttons>
-          <el-button v-if="hasPermission('reimbursement:info:add')" type="primary" size="small" icon="el-icon-plus" @click="add()">新建</el-button>
-          <el-button v-if="hasPermission('reimbursement:info:del')" type="danger" size="small" icon="el-icon-delete" @click="del()" :disabled="$refs.infoTable && $refs.infoTable.getCheckboxRecords().length === 0" plain>删除</el-button>
-          <el-button v-if="hasPermission('sys:project:exportFile')"  type="warning" plain @click="exportFile()" size="small">导出</el-button>
+          <el-button v-if="hasPermission('cw:reimbursement:info:add')" type="primary" size="small" icon="el-icon-plus" @click="add()">新建</el-button>
+          <el-button v-if="hasPermission('cw:reimbursement:info:del')" type="danger" size="small" icon="el-icon-delete" @click="del()" :disabled="$refs.infoTable && $refs.infoTable.getCheckboxRecords().length === 0" plain>删除</el-button>
         </template>
       </vxe-toolbar>
       <div style="height: calc(100% - 80px)">
@@ -110,14 +109,22 @@
           highlight-hover-row
           :menu-config="{}"
           :sort-config="{remote:true}"
+          :export-config="{
+                    remote: true,
+                    filename: `会计报销数据${moment(new Date()).format('YYYY-MM-DD')}`,
+                    sheetName: `会计报销数据${moment(new Date()).format('YYYY-MM-DD')}`,
+                    exportMethod: exportMethod,
+                    types: ['xlsx'],
+                    modes: ['current', 'selected', 'all']
+                  }"
           :data="dataList"
           :checkbox-config="{}">
           <vxe-column type="seq" width="60" title="序号"></vxe-column>
           <vxe-column type="checkbox" width="40" ></vxe-column>
           <vxe-column width="130" title="报销编号" field="no" align="center">
             <template slot-scope="scope">
-              <el-link  type="primary" :underline="false" v-if="hasPermission('reimbursement:info:view')" @click="view(scope.row.id)">{{scope.row.no}}</el-link>
-              <el-link  type="primary" :underline="false" v-else-if="hasPermission('reimbursement:info:view')" @click="view(scope.row.id)">{{scope.row.no}}</el-link>
+              <el-link  type="primary" :underline="false" v-if="hasPermission('cw:reimbursement:info:view')" @click="view(scope.row.id)">{{scope.row.no}}</el-link>
+              <el-link  type="primary" :underline="false" v-else-if="hasPermission('cw:reimbursement:info:view')" @click="view(scope.row.id)">{{scope.row.no}}</el-link>
               <span v-else>{{scope.row.no}}</span>
             </template>
           </vxe-column>
@@ -129,14 +136,14 @@
           <vxe-column width="130" title="报销类别" field="typeName"align="center"></vxe-column>
           <vxe-column width="180" title="报销项目" field="projectName"align="center">
             <template slot-scope="scope">
-              <el-link  type="primary" :underline="false" v-if="hasPermission('reimbursement:info:view') && scope.row.projectId != undefined" @click="viewProject(scope.row.projectId)">{{scope.row.sourceType === '2' ? '' : scope.row.projectName}}</el-link>
-              <el-link  type="primary" :underline="false" v-else-if="hasPermission('reimbursement:info:view') && scope.row.projectId != undefined" @click="viewProject(scope.row.projectId)">{{scope.row.sourceType === '2' ? '' : scope.row.projectName}}</el-link>
+              <el-link  type="primary" :underline="false" v-if="hasPermission('cw:reimbursement:info:view') && scope.row.projectId != undefined" @click="viewProject(scope.row.projectId)">{{scope.row.sourceType === '2' ? '' : scope.row.projectName}}</el-link>
+              <el-link  type="primary" :underline="false" v-else-if="hasPermission('cw:reimbursement:info:view') && scope.row.projectId != undefined" @click="viewProject(scope.row.projectId)">{{scope.row.sourceType === '2' ? '' : scope.row.projectName}}</el-link>
               <span v-else>{{scope.row.sourceType === '2' ? '' : scope.row.projectName}}</span>
             </template>
           </vxe-column>
           <vxe-column width="180" title="报销合同" field="projectName"align="center">
             <template slot-scope="scope">
-              <el-link  type="primary" :underline="false" v-if="hasPermission('reimbursement:info:view') && scope.row.projectId != undefined" @click="viewContract(scope.row.projectId)">{{scope.row.sourceType === '2' ? scope.row.projectName : ''}}</el-link>
+              <el-link  type="primary" :underline="false" v-if="hasPermission('cw:reimbursement:info:view') && scope.row.projectId != undefined" @click="viewContract(scope.row.projectId)">{{scope.row.sourceType === '2' ? scope.row.projectName : ''}}</el-link>
               <span v-else>{{scope.row.sourceType === '2' ? scope.row.projectName : ''}}</span>
             </template>
           </vxe-column>
@@ -154,9 +161,9 @@
 
           <vxe-column title="操作" width="130px" fixed="right" align="center">
             <template  slot-scope="scope">
-              <el-button v-if="hasPermission('reimbursement:info:edit') && scope.row.createId === $store.state.user.id && (scope.row.type === '1' || scope.row.type === '3' )" type="text"  size="small" @click="edit(scope.row)">修改</el-button>
-              <el-button v-if="hasPermission('reimbursement:info:edit') && scope.row.createId === $store.state.user.id && (scope.row.type === '2')" type="text"  size="small" @click="reback(scope.row)">撤回</el-button>
-              <el-button v-if="hasPermission('reimbursement:info:del') && scope.row.createId === $store.state.user.id && (scope.row.type === '1')" type="text"  size="small" @click="del(scope.row.id)">删除</el-button>
+              <el-button v-if="hasPermission('cw:reimbursement:info:edit') && scope.row.createId === $store.state.user.id && (scope.row.type === '1' || scope.row.type === '3' )" type="text"  size="small" @click="edit(scope.row)">修改</el-button>
+              <el-button v-if="hasPermission('cw:reimbursement:info:edit') && scope.row.createId === $store.state.user.id && (scope.row.type === '2')" type="text"  size="small" @click="reback(scope.row)">撤回</el-button>
+              <el-button v-if="hasPermission('cw:reimbursement:info:del') && scope.row.createId === $store.state.user.id && (scope.row.type === '1')" type="text"  size="small" @click="del(scope.row.id)">删除</el-button>
             </template>
           </vxe-column>
         </vxe-table>
@@ -500,6 +507,31 @@
         this.tablePage.currentPage = currentPage
         this.tablePage.pageSize = pageSize
         this.refreshList()
+      },
+      // 自定义服务端导出
+      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.reimbursementApprovalService.exportFile(params).then((res) => {
+          // 将二进制流文件写入excel表,以下为重要步骤
+          this.$utils.downloadExcel(res.data, options.filename)
+        }).catch(function (err) {
+          if (err.response) {
+            console.log(err.response)
+          }
+        })
       }
     }
   }

+ 4 - 1
src/views/modules/cw/reportManagement/ReportManagementAddForm.vue

@@ -98,6 +98,7 @@
           <el-col v-if="inputForm.signatureType === '1' || inputForm.signatureType === '3' || commonJS.isEmpty(inputForm.signatureType)" :span="12">
             <el-form-item label="签字注师1" prop="signatureAnnotator1"
                           :rules="[
+                            {required: true, message:'签字注师1不能为空', trigger:'change'}
                    ]">
               <!--                <el-input v-model="inputForm.signatureAnnotator1" placeholder="请填写签字注师1" clearable></el-input>-->
               <UserSelect size="medium" ref="userSelect1" :disabled="status === 'audit' || status === 'taskFormDetail'" :readonly="true" :limit='1' :value="inputForm.signatureAnnotator1" @getValue='(value) => {changeSignatory1(value)}'></UserSelect>
@@ -107,6 +108,7 @@
           <el-col v-if="inputForm.signatureType === '1' || inputForm.signatureType === '3' || commonJS.isEmpty(inputForm.signatureType)" :span="12">
             <el-form-item label="签字注师2" prop="signatureAnnotator2"
                           :rules="[
+                            {required: true, message:'签字注师2不能为空', trigger:'change'}
                    ]">
               <!--                <el-input v-model="inputForm.signatureAnnotator2" placeholder="请填写签字注师2" clearable></el-input>-->
               <UserSelect size="medium" ref="userSelect2" :disabled="status === 'audit' || status === 'taskFormDetail'" :readonly="true" :limit='1' :value="inputForm.signatureAnnotator2" @getValue='(value) => {changeSignatory2(value)}'></UserSelect>
@@ -837,6 +839,7 @@
       // 表单提交
       doSubmit (status, callback) {
         if (status === 'save') {
+          console.log('save111111')
           // 暂存
           this.inputForm.status = '5'
           this.loading = true
@@ -858,7 +861,7 @@
                   if (_this.commonJS.isNotEmpty(_this.inputForm.signatureAnnotator2) &&
                     _this.commonJS.isEmpty(_this.inputForm.signatureAnnotator1) &&
                     _this.inputForm.signatureAnnotator2 !== _this.inputForm.projectMasterId1 &&
-                    _this.inputForm.signatureAnnotator1 !== _this.inputForm.projectMasterId2) {
+                    _this.inputForm.signatureAnnotator2 !== _this.inputForm.projectMasterId2) {
                     _this.$message.error('签字注师1和签字注师2至少有一个与项目经理相同')
                     _num = 1
                     _this.loading = false

+ 34 - 2
src/views/modules/reimbursement/info/InfoList.vue

@@ -78,11 +78,10 @@
     </el-form>
 
     <div class="bg-white top" style="">
-      <vxe-toolbar :refresh="{query: refreshList}" custom>
+      <vxe-toolbar :refresh="{query: refreshList}" export custom>
         <template #buttons>
           <el-button v-if="hasPermission('reimbursement:info:add')" type="primary" size="small" icon="el-icon-plus" @click="add()">新建</el-button>
           <el-button v-if="hasPermission('reimbursement:info:del')" type="danger" size="small" icon="el-icon-delete" @click="del()" :disabled="$refs.infoTable && $refs.infoTable.getCheckboxRecords().length === 0" plain>删除</el-button>
-          <el-button v-if="hasPermission('sys:project:exportFile')"  type="warning" plain @click="exportFile()" size="small">导出</el-button>
         </template>
       </vxe-toolbar>
       <div style="height: calc(100% - 80px)">
@@ -99,6 +98,14 @@
           highlight-hover-row
           :menu-config="{}"
           :sort-config="{remote:true}"
+          :export-config="{
+                    remote: true,
+                    filename: `评估报销数据${moment(new Date()).format('YYYY-MM-DD')}`,
+                    sheetName: `评估报销数据${moment(new Date()).format('YYYY-MM-DD')}`,
+                    exportMethod: exportMethod,
+                    types: ['xlsx'],
+                    modes: ['current', 'selected', 'all']
+                  }"
           :data="dataList"
           :checkbox-config="{}">
           <vxe-column type="seq" width="60" title="序号"></vxe-column>
@@ -448,6 +455,31 @@
         this.tablePage.currentPage = currentPage
         this.tablePage.pageSize = pageSize
         this.refreshList()
+      },
+      // 自定义服务端导出
+      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.reimbursementService.exportFile(params).then((res) => {
+          // 将二进制流文件写入excel表,以下为重要步骤
+          this.$utils.downloadExcel(res.data, options.filename)
+        }).catch(function (err) {
+          if (err.response) {
+            console.log(err.response)
+          }
+        })
       }
     }
   }

+ 35 - 2
src/views/modules/zs/reimbursement/info/InfoList.vue

@@ -89,11 +89,10 @@
     </el-form>
 
     <div class="bg-white top" style="">
-      <vxe-toolbar :refresh="{query: refreshList}" custom>
+      <vxe-toolbar :refresh="{query: refreshList}" export custom>
         <template #buttons>
           <el-button v-if="hasPermission('zsReimbursement:info:add')" type="primary" size="small" icon="el-icon-plus" @click="add()">新建</el-button>
           <el-button v-if="hasPermission('zsReimbursement:info:del')" type="danger" size="small" icon="el-icon-delete" @click="del()" :disabled="$refs.infoTable && $refs.infoTable.getCheckboxRecords().length === 0" plain>删除</el-button>
-          <el-button v-if="hasPermission('sys:project:exportFile')"  type="warning" plain @click="exportFile()" size="small">导出</el-button>
         </template>
       </vxe-toolbar>
       <div style="height: calc(100% - 80px)">
@@ -110,6 +109,14 @@
           highlight-hover-row
           :menu-config="{}"
           :sort-config="{remote:true}"
+          :export-config="{
+                    remote: true,
+                    filename: `中审报销数据${moment(new Date()).format('YYYY-MM-DD')}`,
+                    sheetName: `中审报销数据${moment(new Date()).format('YYYY-MM-DD')}`,
+                    exportMethod: exportMethod,
+                    types: ['xlsx'],
+                    modes: ['current', 'selected', 'all']
+                  }"
           :data="dataList"
           :checkbox-config="{}">
           <vxe-column type="seq" width="60" title="序号"></vxe-column>
@@ -498,6 +505,32 @@
         this.tablePage.currentPage = currentPage
         this.tablePage.pageSize = pageSize
         this.refreshList()
+      },
+
+      // 自定义服务端导出
+      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.reimbursementService.exportFile(params).then((res) => {
+          // 将二进制流文件写入excel表,以下为重要步骤
+          this.$utils.downloadExcel(res.data, options.filename)
+        }).catch(function (err) {
+          if (err.response) {
+            console.log(err.response)
+          }
+        })
       }
     }
   }