gx
chenyc
2025-06-09 81ced3885266779c3a3813a0e4687962375b1d62
src/views/home/components/editDietary2.vue
@@ -1,8 +1,8 @@
<template>
    <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='printFrom2'>
            <div style="width: 100%; height: 100%;overflow: auto;">
                <div id='printMe'>
                    <div>
                        <el-form size="small">
                            <div style="width: 100%">
@@ -680,9 +680,9 @@
                    <el-button type="primary" @click="onSubmit">
                        保存
                    </el-button>
                    <el-button v-if="state.viewInfo.id" type="primary" v-print="'#printFrom2'">
                    <el-button v-if="state.viewInfo.id" type="primary" v-print="'#printMe'">
                        <el-icon><Printer /></el-icon>
                        打印
                        打印ddd
                    </el-button>
                    <el-button type="primary" v-if="state.viewInfo.id" @click="generatePDF">
                        <el-icon><Position /></el-icon>
@@ -880,7 +880,7 @@
        surveryTime: formatDate(new Date(), 'YYYY-mm-dd HH:MM:SS'),
        surveryPerson: userInfos.value.code,
        surveryJsonBody: '',
        suveryFormName: '营养膳食调查表',
        suveryFormName: '膳食调查表',
        updateTime: ''
    }
@@ -890,7 +890,7 @@
    state.dialogTableVisible = false
}
const generatePDF=()=> {
      const element = document.getElementById('printFrom2');
      const element = document.getElementById('printMe');
      const opt = {
        margin: 10,
        filename: `${state.tableData.表名}.pdf`,
@@ -912,7 +912,7 @@
        surveryTime: formatDate(new Date(), 'YYYY-mm-dd HH:MM:SS'),
        surveryPerson: userInfos.value.code,
        surveryJsonBody: JSON.stringify(state.tableData),
        suveryFormName: '营养膳食调查表',
        suveryFormName: '膳食调查表',
        surveryFormType: 0,
        updateTime: formatDate(new Date(), 'YYYY-mm-dd HH:MM:SS'),
    }
@@ -1120,7 +1120,7 @@
        surveryTime: formatDate(new Date(), 'YYYY-mm-dd HH:MM:SS'),
        surveryPerson: userInfos.value.code,
        surveryJsonBody: '',
        suveryFormName: '营养膳食调查表',
        suveryFormName: '膳食调查表',
        updateTime: ''
    }
}
@@ -1131,6 +1131,26 @@
<style scoped lang="scss">
@media print {
  body * {
    visibility: hidden;
  }
  #printMe, #printMe * {
    visibility: visible;
  }
  #printMe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: auto;
  }
  /* 控制分页 */
  .page-break {
    page-break-before: always;
  }
}
.gridtable {
    font-family: verdana, arial, sans-serif;
    font-size: 11px;