From a219bc2526137283ea2da50ebec18864c8052e8b Mon Sep 17 00:00:00 2001
From: zhouwx <1175765986@qq.com>
Date: 星期二, 14 十月 2025 09:50:51 +0800
Subject: [PATCH] 修改

---
 src/views/build/conpanyFunctionConsult/digitalFileDep/project/projectFile/index.vue |   60 ++++++++++++++++++++++++++++++++++++++++++++++--------------
 1 files changed, 46 insertions(+), 14 deletions(-)

diff --git a/src/views/build/conpanyFunctionConsult/digitalFileDep/project/projectFile/index.vue b/src/views/build/conpanyFunctionConsult/digitalFileDep/project/projectFile/index.vue
index e0f0bf2..ff1e8b4 100644
--- a/src/views/build/conpanyFunctionConsult/digitalFileDep/project/projectFile/index.vue
+++ b/src/views/build/conpanyFunctionConsult/digitalFileDep/project/projectFile/index.vue
@@ -104,6 +104,17 @@
             </el-table-column>
           </el-table>
         </el-form>
+        <div class="pag-container">
+          <el-pagination
+              v-model:current-page="data.queryParams.pageNum"
+              v-model:page-size="data.queryParams.pageSize"
+              :page-sizes="[10,15,20,25]"
+              layout="total, sizes, prev, pager, next, jumper"
+              :total="total"
+              @size-change="handleSizeChange"
+              @current-change="handleCurrentChange"
+          />
+        </div>
 <!--        <div style="display: flex;align-items: center;justify-content: right;margin-top: 10px">-->
 <!--          <el-button v-if="state.form.id && data.isAdmin" type="danger"  @click="deleteData">删除</el-button>-->
 <!--          <el-button v-if="data.isAdmin" type="primary"  @click="addData()">保存</el-button>-->
@@ -150,6 +161,8 @@
     type: 3,
     companyId: null,
     itemId: null,
+    pageNum: 1,
+    pageSize: 10,
   },
   companyList: [],
   projectList: [],
@@ -494,7 +507,9 @@
     companyId: state.form.companyId,
     catalogueId: state.form.catalogueId,
     type: 2,
-    itemId: data.queryParams.itemId
+    itemId: data.queryParams.itemId,
+    pageSize: data.queryParams.pageSize,
+    pageNum: data.queryParams.pageNum
   }
   const res = await getProductFilePage(queryParams)
   if (res.code == 200) {
@@ -504,9 +519,18 @@
         fileNameSimple: item.fileName.split('.')[0]
       }
     })
+    total.value = res.data.total
   } else {
     ElMessage.warning(res.message)
   }
+}
+const handleSizeChange = (val) => {
+  data.queryParams.pageSize = val
+   getFileList()
+}
+const handleCurrentChange = (val) => {
+  data.queryParams.pageNum = val
+  getFileList()
 }
 const openFile = async(path)=>{
   const ext = path.split('.').pop().toLowerCase();
@@ -517,14 +541,16 @@
       console.log('取消预览')
     });
     return
-  }
-  try {
-    // 1. 获取文件
-    const response = await fetch(import.meta.env.VITE_APP_BASE_API + '/' + path);
-    const arrayBuffer = await response.arrayBuffer();
-    // 2. 创建新窗口
-    const win = window.open('', '_blank')
-    win.document.write(`
+  }else if(ext === 'pdf' || ext === 'png' || ext === 'jpg'|| ext === 'jpeg'){
+    window.open(`${import.meta.env.VITE_APP_BASE_API}/${path}`, '_blank');
+  }else {
+    try {
+      // 1. 获取文件
+      const response = await fetch(import.meta.env.VITE_APP_BASE_API + '/' + path);
+      const arrayBuffer = await response.arrayBuffer();
+      // 2. 创建新窗口
+      const win = window.open('', '_blank')
+      win.document.write(`
       <!DOCTYPE html>
       <html>
         <head>
@@ -539,13 +565,15 @@
         </body>
       </html>
     `);
-    // 3. 渲染 DOCX
-    await renderAsync(arrayBuffer, win.document.getElementById('container'));
+      // 3. 渲染 DOCX
+      await renderAsync(arrayBuffer, win.document.getElementById('container'));
 
-  } catch (error) {
-    console.error('预览失败:', error);
-    alert(`预览失败: ${error.message}`);
+    } catch (error) {
+      console.error('预览失败:', error);
+      alert(`预览失败: ${error.message}`);
+    }
   }
+
 }
 const downloadFile = (e)=>{
   axios.get(import.meta.env.VITE_APP_BASE_API + '/' +e.filePath,{headers:{'Content-Type': 'application/json','Authorization': `${getToken()}`},responseType: 'blob'}).then(res=>{
@@ -658,6 +686,10 @@
 
 <style scoped lang="scss">
 .app-container{
+  .pag-container{
+    float: right;
+    margin-top: 10px;
+  }
   .bottom{
     display: flex;
     width: auto;

--
Gitblit v1.9.2