| | |
| | | <div class="dietarySurvey-item"> |
| | | <el-dialog v-model="state.dialogTableVisible" title="营养饮食指导方案" :fullscreen="true" width="100%"> |
| | | <div class="container" style="width: 100%; height: 100%;overflow: auto;" > |
| | | <div id="fanganprintFrom1" class="print-section"> |
| | | <div ref="printRef" id="fanganprintFrom1" class="print-section"> |
| | | <div> |
| | | <el-form size="small"> |
| | | <div style="width: 100%"> |
| | |
| | | <el-button type="primary" @click="onSubmit"> |
| | | 保存 |
| | | </el-button> |
| | | <el-button v-if="state.viewInfo.id" type="primary" v-print="'#fanganprintFrom1'"> |
| | | <el-button v-if="state.viewInfo.id" type="primary" @click="onPrint"> |
| | | <el-icon> |
| | | <Printer /> |
| | | </el-icon> |
| | | 打印 |
| | | </el-button> |
| | | <el-button type="primary" v-if="state.viewInfo.id" @click="generatePDF"> |
| | | <!-- <el-button type="primary" v-if="state.viewInfo.id" @click="generatePDF"> |
| | | <el-icon> |
| | | <Position /> |
| | | </el-icon> |
| | | 导出22 |
| | | </el-button> |
| | | 导出 |
| | | </el-button> --> |
| | | |
| | | </div> |
| | | </template> |
| | |
| | | import html2pdf from 'html2pdf.js'; |
| | | import html2canvas from 'html2canvas'; |
| | | import { jsPDF } from 'jspdf'; |
| | | import printJs from 'print-js'; |
| | | import { reactive, onMounted, onUnmounted, ref,computed} from 'vue'; |
| | | import { formatDate } from '/@/utils/formatTime'; |
| | | import { NextLoading } from '/@/utils/loading'; |
| | |
| | | const { patientsInfo } = storeToRefs(storesPat); |
| | | const { userInfos } = storeToRefs(stores); |
| | | const router = useRouter() |
| | | // 定义变量内容 |
| | | const printRef = ref(); |
| | | const emit = defineEmits(["shuaxin"]); |
| | | const state = reactive({ |
| | | centerDialogVisibleYZDBZ:false, |
| | |
| | | } |
| | | |
| | | }) |
| | | // 打印 |
| | | const onPrint=()=>{ |
| | | printJs({ |
| | | printable: printRef.value, |
| | | type: 'html', |
| | | css: ['@/assets/css/printcss.css','//at.alicdn.com/t/c/font_2298093_rnp72ifj3ba.css', '//unpkg.com/element-plus/dist/index.css'], |
| | | scanStyles: false, |
| | | style: `@media print{}}`, |
| | | }); |
| | | } |
| | | const numberPart=(str:any)=>{ |
| | | if(str){ |
| | | // 使用正则表达式匹配数字 |
| | |
| | | } |
| | | const funhui = () => { |
| | | state.dialogTableVisible = false |
| | | } |
| | | // 打印 |
| | | const onPrint = () => { |
| | | |
| | | } |
| | | const generatePDF = () => { |
| | | const element = document.getElementById('fanganprintFrom1'); |