From a5d06bcaaf7761b594ee7425206e2732b05c5e16 Mon Sep 17 00:00:00 2001
From: chenyc <501753378@qq.com>
Date: 星期四, 16 一月 2025 15:02:07 +0800
Subject: [PATCH] gx生化显示

---
 src/views/home/components/pingubiao/editDietary4.vue |   65 ++++++++++++++++++++++----------
 1 files changed, 45 insertions(+), 20 deletions(-)

diff --git a/src/views/home/components/pingubiao/editDietary4.vue b/src/views/home/components/pingubiao/editDietary4.vue
index 3f83533..8c3fe23 100644
--- a/src/views/home/components/pingubiao/editDietary4.vue
+++ b/src/views/home/components/pingubiao/editDietary4.vue
@@ -1,8 +1,8 @@
 <template>
     <div class="dietarySurvey-item">
-        <el-dialog  v-model="state.dialogTableVisible" title="PEW(蛋白质能量消耗评估)" :fullscreen="true" width="100%">
+        <el-dialog  v-model="state.dialogTableVisible" title="PEW" :fullscreen="true" width="100%">
             <div class="container" style="width: 100%; height: 100%;overflow: auto;">
-                <div>
+                <div id="pinggu4">
                     <div>
                         <el-form size="small" >
                             <div style="width: 100%">
@@ -11,14 +11,14 @@
                                     <tr>
                                         <th colspan="2">
                                             <el-form-item label="初次调查日期">
-                                                <el-date-picker v-model="state.tableData.初次调查日期" type="date" style="width: 100px;"
+                                                <el-date-picker v-model="state.tableData.初次调查日期" type="date" readonly style="width: 100px;"
                                                     placeholder="" format="YYYY/MM/DD" value-format="YYYY-MM-DD" />
                                             </el-form-item>
 
                                         </th>
                                         <th colspan="2">
                                             <el-form-item label="更新日期">
-                                                <el-date-picker v-model="state.tableData.更新日期" type="date" style="width: 100px;"
+                                                <el-date-picker v-model="state.tableData.更新日期" type="date" readonly style="width: 100px;"
                                                     placeholder="" format="YYYY/MM/DD" value-format="YYYY-MM-DD" />
                                             </el-form-item>
 
@@ -26,7 +26,7 @@
                                         </th>
                                         <th colspan="2">
                                             <el-form-item label="记录者">
-                                                <el-input v-model="state.tableData.记录者" style="width: 100px;"   placeholder="" />
+                                                <el-input v-model="state.tableData.记录者" style="width: 100px;"  readonly  placeholder="" />
                                             </el-form-item>
                                         </th>
 
@@ -42,17 +42,7 @@
                                         <th colspan="2">性别:{{patientsInfo.patientGenderText}}</th>
 
                                     </tr>
-                                    <tr>
-                                        
-                                        <td colspan="" class="tdInput" style="text-align: center;">
-                                           血清白蛋白浓度(g/L)
-
-                                        </td>
-                                        <td colspan="1" style="text-align: center;" > 
-                                            打分
-                                        </td>
-
-                                    </tr>
+                                   
                                     <tr>
                                    
                                         <td colspan="5" style="background-color: antiquewhite;">
@@ -142,6 +132,14 @@
                     <el-button type="primary" @click="onSubmit">
                         保存
                     </el-button>
+                    <el-button v-if="state.viewInfo.id" type="primary" v-print="'#pinggu4'">
+                        <el-icon><Printer /></el-icon>
+                        打印
+                    </el-button>
+                    <el-button type="primary" v-if="state.viewInfo.id" @click="generatePDF">
+                        <el-icon><Position /></el-icon>
+                        导出
+                    </el-button>
                 </div>
             </template>
         </el-dialog>
@@ -152,6 +150,7 @@
 </template>
 
 <script setup lang="ts" name="visualizingLinkDemo2">
+import html2pdf from 'html2pdf.js';
 import { reactive, onMounted, onUnmounted, ref, computed } from 'vue';
 import { formatDate } from '/@/utils/formatTime';
 import { NextLoading } from '/@/utils/loading';
@@ -171,7 +170,7 @@
     options:[0,1],
     dialogTableVisible:false,
     tableData: {
-        表名: 'PEW(蛋白质能量消耗评估)',
+        表名: 'PEW',
         初次调查日期:"",
         填表日期: '',
         更新日期: '',
@@ -202,7 +201,7 @@
         surveryTime: formatDate(new Date(), 'YYYY-mm-dd HH:MM:SS'),
         surveryPerson: userInfos.value.code,
         surveryJsonBody: '',
-        suveryFormName:'PEW(蛋白质能量消耗评估)',
+        suveryFormName:'PEW',
         surveryFormType:1,
         updateTime: ''
     }
@@ -233,7 +232,7 @@
     surveryTime: formatDate(new Date(), 'YYYY-mm-dd HH:MM:SS'),
     surveryPerson: userInfos.value.code,
     surveryJsonBody: JSON.stringify(state.tableData),
-    suveryFormName:'PEW(蛋白质能量消耗评估)',
+    suveryFormName:'PEW',
     updateTime: ''
   }
   console.log(info)
@@ -274,6 +273,8 @@
         console.log(mode)
         state.viewInfo=mode
         state.tableData=JSON.parse(mode.surveryJsonBody)
+        state.tableData.初次调查日期=mode.surveryTime
+        state.tableData.更新日期=mode.updateTime
         state.dialogTableVisible = true
 
 
@@ -282,7 +283,7 @@
 }
 const getPageInfo=()=>{
     state.tableData={
-        表名: 'PEW(蛋白质能量消耗评估)',
+        表名: 'PEW',
         初次调查日期:formatDate(new Date(),'YYYY-mm-dd'),
         填表日期: '',
         更新日期: formatDate(new Date(),'YYYY-mm-dd'),
@@ -304,6 +305,30 @@
             input1: '肌肉量丢失(3个月内>5%或半年内>10%),上臂肌围减少(减少>10%参照群体第50个百分位数)',
         }
     }
+    state.viewInfo={
+        id: 0,
+        code: '',
+        clientCode: userInfos.value.clientCode,
+        patientCode: patientsInfo.value.code,
+        surveryTime: formatDate(new Date(), 'YYYY-mm-dd HH:MM:SS'),
+        surveryPerson: userInfos.value.code,
+        surveryJsonBody: '',
+        suveryFormName:'PEW',
+        surveryFormType:1,
+        updateTime: ''
+    }
+}
+const generatePDF=()=> {
+      const element = document.getElementById('pinggu4');
+      const opt = {
+        margin: 10,
+        filename: `${state.tableData.表名}.pdf`,
+        image: { type: 'jpeg', quality: 0.98 },
+        html2canvas: { scale: 2 },
+        jsPDF: { unit: 'mm', format: 'a4', orientation: 'portrait' }
+      };
+      html2pdf().set(opt).from(element).save();
+
 }
 
 // 第二步:暴露方法

--
Gitblit v1.8.0