ZaiZai 1 рік тому
батько
коміт
b6925fcf7f
1 змінених файлів з 27 додано та 1 видалено
  1. 27 1
      src/views/file/collection.vue

+ 27 - 1
src/views/file/collection.vue

@@ -86,7 +86,15 @@
                 </template>
             </HcTable>
             <template #action>
-                <HcPages :pages="searchForm" @change="pageChange" />
+                <div class="lr-dialog-footer h-full">
+                    <div class="left hc-flex h-full text-14px">
+                        <span class="text">当前页的文件总页数:</span>
+                        <span>{{ fileTotalPage || 0 }}</span>
+                    </div>
+                    <div class="right">
+                        <HcPages :pages="searchForm" @change="pageChange" />
+                    </div>
+                </div>
             </template>
         </hc-new-card>
 
@@ -695,6 +703,7 @@ const tableData = ref([])
 const tableLoading = ref(false)
 const getTableData = async () => {
     tableLoading.value = true
+    fileTotalPage.value = 0
     const { error, code, data } = await archiveFileApi.getarchiveFilePage({
         ...searchForm.value,
         projectId: projectId.value,
@@ -708,6 +717,23 @@ const getTableData = async () => {
         tableData.value = []
         searchForm.value.total = 0
     }
+    getFileTotalPage()
+}
+
+//获取当前页的总页数
+const fileTotalPage = ref(0)
+const getFileTotalPage = () => {
+    const arr = tableData.value
+    if (arr.length <= 0) {
+        fileTotalPage.value = 0
+        return
+    }
+    //遍历数据
+    let newPage = 0
+    for (let i = 0; i < arr.length; i++) {
+        newPage = newPage + Number(arr[i].filePage || 0)
+    }
+    fileTotalPage.value = newPage
 }
 
 //多选