From 9c2d854d62aa70e4753f43fbede7960381b9804b Mon Sep 17 00:00:00 2001
From: zhouwx <1175765986@qq.com>
Date: 星期四, 06 十一月 2025 14:01:41 +0800
Subject: [PATCH] 修改

---
 src/views/build/conpanyFunctionConsult/digitalFileDep/project/projectReview/index.vue |  106 ++++++++++++++++++++++++++++++++++++++++++----------
 1 files changed, 85 insertions(+), 21 deletions(-)

diff --git a/src/views/build/conpanyFunctionConsult/digitalFileDep/project/projectReview/index.vue b/src/views/build/conpanyFunctionConsult/digitalFileDep/project/projectReview/index.vue
index 5b3361a..f3355a6 100644
--- a/src/views/build/conpanyFunctionConsult/digitalFileDep/project/projectReview/index.vue
+++ b/src/views/build/conpanyFunctionConsult/digitalFileDep/project/projectReview/index.vue
@@ -38,6 +38,17 @@
 <!--          </el-select>-->
 
         </el-form-item>
+        <el-form-item label="类型:">
+          <el-select v-model="data.queryParams.type" filterable placeholder="请选择"
+          >
+            <el-option
+                v-for="item in data.typeList"
+                :key="item.id"
+                :label="item.name"
+                :value="item.id">
+            </el-option>
+          </el-select>
+        </el-form-item>
         <el-form-item >
           <el-button  type="primary" @click="getList">查询</el-button>
           <el-button  type="primary" plain @click="reset">重置</el-button>
@@ -109,7 +120,9 @@
 import {delReview, getReviewPage, sendReview} from "@/api/selfProblems/projectReview";
 import axios from "axios";
 import {getToken} from "@/utils/auth";
+// import {generateWordDocument} from "@/views/build/conpanyFunctionConsult/digitalFileDep/manageType/qualityManual/components/exportDoc";
 import {generateWordDocument} from "@/utils/exportWord";
+import {imageUrlToBase64} from "@/utils/imageToBase";
 const userStore = useUserStore()
 const { proxy } = getCurrentInstance();
 const loading = ref(false);
@@ -120,14 +133,24 @@
     pageNum: 1,
     pageSize: 10,
     companyId: null,
-    itemName: null
+    itemName: null,
+    type:null
   },
   total: 0,
   dataList: [],
   companyList: [],
   industryList: [],
   isAdmin: false,
-  typeList: [],
+  typeList: [
+    {
+      id: 1,
+      name: '会签评审'
+    },
+    {
+      id: 2,
+      name: '会议评审'
+    },
+  ],
   exportDialog: false,
   projectList: [],
 
@@ -201,7 +224,8 @@
       pageNum: 1,
       pageSize: 10,
       companyId: null,
-      itemId: null
+      itemId: null,
+      type:null
     }
     await getCompanyList()
   }else {
@@ -209,7 +233,8 @@
       pageNum: 1,
       pageSize: 10,
       companyId: data.queryParams.companyId,
-      itemId: null
+      itemId: null,
+      type:null
     }
   }
   choosedData.value = []
@@ -330,34 +355,73 @@
 const templatePath = ref('/projectReviewExample.docx')
 const startGeneration = async () => {
   const data = JSON.parse(JSON.stringify(choosedData.value))
-  data.forEach(item => {
-    item.leaderList = item.reviewUsers.filter(item => item.reviewType == '评审组长').map((x,index) => {
-      return {
-        ...x,
-        first: index === 0
 
-      }
-    })
-    item.peopleList = item.reviewUsers.filter(item => item.reviewType == '评审组员').map((x,index) => {
-      return {
-        ...x,
-        first: index === 0
+  for(const item of data){
+    item.leaderList = await Promise.all(
+        item.reviewUsers
+            .filter(user => user.reviewType === '评审组长')
+            .map(async (x, index) => {
+              let signBase64 = '';
+              if (x.sign != '') {
+                try {
+                  const url = import.meta.env.VITE_APP_BASE_API + '/' + x.sign;
+                  signBase64 = await imageUrlToBase64(url, {
+                    format: 'png',
+                    quality: 0.8
+                  });
+                } catch (err) {
+                  signBase64 = '';
+                }
+              }
+              return {
+                ...x,
+                first: index === 0,
+                sign: signBase64 || ''
+              };
+            })
+    );
 
-      }
-    })
-    item.leaderTime = item.leaderTime?.substring(0,10)
-    item.groupTime = item.groupTime?.substring(0,10)
+    // 2. 处理 peopleList:同样用 Promise.all 等待异步完成
+    item.peopleList = await Promise.all(
+        item.reviewUsers
+            .filter(user => user.reviewType === '评审组员')
+            .map(async (x, index) => {
+              let signBase64 = '';
+              if (x.sign != '') {
+                try {
+                  const url = import.meta.env.VITE_APP_BASE_API + '/' + x.sign;
+                  signBase64 = await imageUrlToBase64(url, {
+                    format: 'png',
+                    quality: 0.8
+                  });
+                } catch (err) {
+                  signBase64 = '';
+                }
+              }
+              return {
+                ...x,
+                first: index === 0,
+                sign: signBase64 || ''
+              };
+            })
+    );
+    item.leaderTime = item.leaderTime?.substring(0, 10)
+    item.groupTime = item.groupTime?.substring(0, 10)
     console.log(' item.tableList', item.tableList)
     try {
       generateWordDocument(templatePath.value, item, item.itemName + `_项目审批表.docx`);
-    } catch (error){
+    } catch (error) {
       ElMessage({
         type: 'warning',
         message: '导出失败'
       });
     }
-  })
+
+
+  }
 }
+
+
 const changeCom = () => {
   getProjectList()
 }

--
Gitblit v1.9.2