Browse Source

代码提交:
0901项目管理-文件上传比例代码提交

sunruiqi 2 years ago
parent
commit
0456ba7887

+ 10 - 2
src/api/sys/ProjectService.js

@@ -51,11 +51,19 @@ export default class PostService {
       responseType: 'blob'
     })
   }
-  proportion (itemType) {
+  proportion (params) {
     return request({
       url: '/sys/project/proportion',
       method: 'get',
-      params: {itemType: itemType}
+      params: params
+    })
+  }
+  fileUploadList (params) {
+    return request({
+      url: '/sys/project/exportFileUploadList',
+      method: 'get',
+      params: params,
+      responseType: 'blob'
     })
   }
 }

+ 2 - 1
src/views/modules/sys/project/AssessForm.vue

@@ -679,10 +679,11 @@
           }
         })
       },
-      async close () {
+      close () {
         this.$refs.inputForm.resetFields()
         this.showVi = true
         this.visible = false
+        this.$emit('refreshDataList')
       },
       async httpRequest (file) {
         await httpRequest(file, fileName(file), 'projectRecords')

+ 22 - 1
src/views/modules/sys/project/AssessList.vue

@@ -40,6 +40,7 @@
 <!--            <el-button v-if="hasPermission('sys:post:edit')" type="warning" size="small" icon="el-icon-edit-outline" @click="edit()" :disabled="$refs.projectTable && $refs.projectTable.getCheckboxRecords().length !== 1" plain>修改</el-button>-->
             <el-button v-if="hasPermission('sys:project:del')" type="danger"   size="small" icon="el-icon-delete" @click="del()" :disabled="$refs.projectTable && $refs.projectTable.getCheckboxRecords().length === 0" plain>删除</el-button>
             <el-button v-if="hasPermission('sys:project:import')"  type="default" @click="downloadTpl()" size="small">下载模板</el-button>
+            <el-button v-if="hasPermission('sys:project:exportFile')"  type="default" @click="downloadFile()" size="small">下载</el-button>
             <span style="margin-left:20px">文件上传比例 {{proport}}</span>
           </template>
         </vxe-toolbar>
@@ -190,7 +191,10 @@
       // 获取数据列表
       refreshList () {
         this.loading = true
-        this.projectService.proportion('1').then(({data}) => {
+        this.projectService.proportion({
+          'itemType': '1',
+          ...this.searchForm
+        }).then(({data}) => {
           this.proport = data
         })
         this.projectService.list({
@@ -284,6 +288,23 @@
           }
         })
       },
+      // 下载文档
+      downloadFile () {
+        this.loading = true
+        this.projectService.fileUploadList({
+          'itemType': '1',
+          ...this.searchForm
+        }).then((res) => {
+          // 将二进制流文件写入excel表,以下为重要步骤
+          this.$utils.downloadExcel(res.data, '评估项目上传比例报告')
+          this.loading = false
+        }).catch(function (err) {
+          this.loading = false
+          if (err.response) {
+            console.log(err.response)
+          }
+        })
+      },
       // 自定义服务端导出
       exportMethod ({ options }) {
         // 传给服务端的参数

+ 1 - 0
src/views/modules/sys/project/ConsultationForm.vue

@@ -666,6 +666,7 @@
         this.$refs.inputForm.resetFields()
         this.visible = false
         this.showVi = true
+        this.$emit('refreshDataList')
       },
       async httpRequest (file) {
         await httpRequest(file, fileName(file), 'projectRecords')

+ 32 - 3
src/views/modules/sys/project/ConsultationList.vue

@@ -41,7 +41,8 @@
 <!--            <el-button v-if="hasPermission('sys:post:edit')" type="warning" size="small" icon="el-icon-edit-outline" @click="edit()" :disabled="$refs.projectTable && $refs.projectTable.getCheckboxRecords().length !== 1" plain>修改</el-button>-->
             <el-button v-if="hasPermission('sys:project:del')" type="danger"   size="small" icon="el-icon-delete" @click="del()" :disabled="$refs.projectTable && $refs.projectTable.getCheckboxRecords().length === 0" plain>删除</el-button>
             <el-button v-if="hasPermission('sys:project:import')"  type="default" @click="downloadTpl()" size="small">下载模板</el-button>
-
+            <el-button v-if="hasPermission('sys:project:exportFile')"  type="default" @click="downloadFile()" size="small">下载</el-button>
+            <span style="margin-left:20px">文件上传比例 {{proport}}</span>
           </template>
         </vxe-toolbar>
         <div style="height: calc(100% - 80px);">
@@ -110,7 +111,11 @@
                   {{ $dictUtils.getDictLabel("project_status", scope.row.status, '-') }}
                 </template>
               </vxe-column>
-
+              <vxe-column width="80px"   title="上传状态" field="fileUploadType" >
+                <template slot-scope="scope">
+                  {{ $dictUtils.getDictLabel("file_upload_type", scope.row.fileUploadType, '-') }}
+                </template>
+              </vxe-column>
 
 
                 <!--<vxe-column  title="是否可用" field="status" sortable>
@@ -167,7 +172,8 @@
           pageSize: 10,
           orders: []
         },
-        loading: false
+        loading: false,
+        proport: ''
       }
     },
     projectService: null,
@@ -186,6 +192,12 @@
       // 获取数据列表
       refreshList () {
         this.loading = true
+        this.projectService.proportion({
+          'itemType': '2',
+          ...this.searchForm
+        }).then(({data}) => {
+          this.proport = data
+        })
         this.projectService.list({
           'current': this.tablePage.currentPage,
           'size': this.tablePage.pageSize,
@@ -277,6 +289,23 @@
           }
         })
       },
+      // 下载文档
+      downloadFile () {
+        this.loading = true
+        this.projectService.fileUploadList({
+          'itemType': '2',
+          ...this.searchForm
+        }).then((res) => {
+          // 将二进制流文件写入excel表,以下为重要步骤
+          this.$utils.downloadExcel(res.data, '咨询项目上传比例报告')
+          this.loading = false
+        }).catch(function (err) {
+          this.loading = false
+          if (err.response) {
+            console.log(err.response)
+          }
+        })
+      },
       // 自定义服务端导出
       exportMethod ({ options }) {
         // 传给服务端的参数