scorpio 2 anos atrás
pai
commit
f4b0e4889d

+ 11 - 0
src/api/resource/index.js

@@ -165,5 +165,16 @@ export default {
    */
   shareFiles(params) {
     return fetch('/blade-project-manage-v2/file-share/v2/save', params, 'post')
+  },
+  /**
+   * 当前文件夹 文件数量 大小 包括页码
+   * @param params
+   * @returns {Promise | Promise<unknown>}
+   */
+  fileStatistics(params) {
+    return fetch(
+      '/blade-project-manage-v2/folder/v2/getFileAmountByFolderId',
+      params
+    )
   }
 }

+ 32 - 3
src/views/resource/component/xtable.vue

@@ -98,7 +98,16 @@
             </div>
           </div>
         </div>
-        <div class="full-width flex flex-center flex-justify-end">
+        <div class="full-width flex flex-center flex-justify-between">
+          <div class="mt-10">
+            <div class="ml-20" v-if="topFolder === false">
+              共 {{ filesInfo.folderAmount }} 个文件夹,
+              {{ filesInfo.amount }} 个文件,文件总大小:{{
+                filesInfo.volume
+              }}
+              ,预估共计 {{ filesInfo.totalPage }}页
+            </div>
+          </div>
           <el-pagination
             layout="total, prev, pager, next"
             class="mt-10"
@@ -123,6 +132,7 @@ import archives from '@/views/resource/component/archives.vue'
 import preview from '@/views/resource/component/preview.vue'
 import defile from '@/views/resource/component/defile.vue'
 import apply from '@/views/resource/component/apply.vue'
+import { bytesToSize } from '@/utils/tools.js'
 export default {
   components: {
     row1,
@@ -211,7 +221,13 @@ export default {
       folderChecked: false,
       showCheckAll: true,
       headers: [],
-      selectedList: []
+      selectedList: [],
+      filesInfo: {
+        amount: 0,
+        folderAmount: 0,
+        totalPage: 0,
+        volume: 0
+      }
     }
   },
   methods: {
@@ -232,7 +248,6 @@ export default {
         return
       }
       // 点击的内容为文件
-      console.log(this.showCheckBox)
       if (row.type === 1 && this.showCheckBox === false) {
         return
       }
@@ -259,6 +274,20 @@ export default {
       })
       this.selectedList = this.data.filter(ele => ele.checked)
       this.$emit('selection', res)
+    },
+    /**
+     * 文件大小
+     * @param row
+     */
+    fileStatistics(row) {
+      this.$api.resource.fileStatistics({ id: row.id }).then(res => {
+        if (res.code === 200) {
+          this.filesInfo = res.data
+          if (this.filesInfo.volume > 0) {
+            this.filesInfo.volume = bytesToSize(this.filesInfo.volume)
+          }
+        }
+      })
     }
   }
 }

+ 2 - 0
src/views/resource/index.vue

@@ -72,6 +72,7 @@
           class="mt-20"
         />
         <xtable
+          ref="curd"
           :data="data"
           :option="option"
           :loading="loading"
@@ -282,6 +283,7 @@ export default {
           this.$message.error(res.msg)
         }
       })
+      this.$refs.curd.fileStatistics(row)
     },
     /**
      * 获取项目阶段