chenyc
2025-03-04 3a4602d8286f09ce2f7812dea697995e2a9487cf
src/views/home/components/pingubiao/editDietary.vue
@@ -1,471 +1,423 @@
<template>
    <div class="dietarySurvey-item">
        <el-dialog  v-model="state.dialogTableVisible" title="营养风险筛查表(NRS2002)" :fullscreen="true" width="100%">
            <div class="container" style="width: 100%; height: 100%;overflow: auto;">
                <div>
                    <div>
                        <el-form size="small">
                            <div style="width: 100%">
                                <table id="tabledome" class="gridtable">
   <div class="dietarySurvey-item">
      <el-dialog v-model="state.dialogTableVisible" title="NRS-2002" :fullscreen="true" width="100%">
         <div style="width: 100%; height: 100%; overflow: auto">
            <div id="pinggu1">
               <div>
                  <el-form size="small">
                     <div style="width: 100%">
                        <table id="tabledome" class="gridtable">
                           <tr>
                              <th colspan="2">
                                 <el-form-item label="初次调查日期">
                                    <el-date-picker
                                    readonly
                                       v-model="state.tableData.初次调查日期"
                                       type="date"
                                       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
                                    readonly
                                       v-model="state.tableData.更新日期"
                                       type="date"
                                       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-input v-model="state.tableData.记录者" style="width: 100px" readonly placeholder="" />
                                 </el-form-item>
                              </th>
                           </tr>
                           <tr>
                              <th colspan="2">患者姓名:{{ patientsInfo.patientName }}</th>
                              <th colspan="2">年龄:{{ patientsInfo.age }}</th>
                              <th colspan="2">性别:{{ patientsInfo.patientGenderText }}</th>
                           </tr>
                                    <tr>
                                        <th colspan="2">
                                            <el-form-item label="初次调查日期">
                                                <el-date-picker v-model="state.tableData.初次调查日期" type="date" 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;"
                                                    placeholder="" format="YYYY/MM/DD" value-format="YYYY-MM-DD" />
                                            </el-form-item>
                                        </th>
                                        <th colspan="2">
                                            <el-form-item label="记录者">
                                                <el-input v-model="state.tableData.记录者" style="width: 100px;"   placeholder="" />
                                            </el-form-item>
                                        </th>
                                    </tr>
                                    <tr>
                                        <th colspan="2">
                                           患者姓名:{{patientsInfo.patientName}}
                                        </th>
                                        <th colspan="2">
                                            年龄:{{patientsInfo.age}}
                                        </th>
                                        <th colspan="2">性别:{{patientsInfo.patientGenderText}}</th>
                                    </tr>
                                    <tr>
                                        <td colspan="4" style="text-align: center;background-color: antiquewhite;">
                                            A、疾病状态(选最大分值)
                                        </td>
                                        <td colspan="1" style="text-align: center;background-color: antiquewhite;">
                                            分数
                                        </td>
                                        <td colspan="1" style="text-align: center;background-color: antiquewhite;">
                                            打分
                                            <!-- <el-radio-group class="elradiozdi"
                           <tr>
                              <td colspan="4" style="text-align: center; background-color: antiquewhite">A、疾病状态(选最大分值)</td>
                              <td colspan="1" style="text-align: center; background-color: antiquewhite">分数</td>
                              <td colspan="1" style="text-align: center; background-color: antiquewhite">
                                 打分
                                 <!-- <el-radio-group class="elradiozdi"
                                                v-model="state.tableData.烹饪主要操作者.type">
                                                <el-radio value="1">打分</el-radio>
                                            </el-radio-group> -->
                                        </td>
                                    </tr>
                                    <tr>
                                        <td colspan="4">
                                            1:需要量轻度增加:一般恶性肿瘤、髋部骨折、长期血液透、糖尿病、慢性疾病有急性并发症(肝硬化、慢性阻塞性肺病)
                                        </td>
                                        <td colspan="1">
                                            1分
                                        </td>
                                        <td colspan="1">
                                            <el-radio-group class="elradiozdi"
                                                v-model="state.tableData.疾病状态.type">
                                                <!-- <el-radio value="1">打分</el-radio> -->
                                                <el-radio value="1">✔</el-radio>
                                            </el-radio-group>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td colspan="4">
                                            2:需要量中度增加:腹部大手术,卒中,重度肺炎,血液恶性肿瘤
                                        </td>
                                        <td colspan="1">
                                            2分
                                        </td>
                                        <td colspan="1">
                                            <el-radio-group class="elradiozdi"
                                                v-model="state.tableData.疾病状态.type">
                                                <!-- <el-radio value="2">打分</el-radio> -->
                                                <el-radio value="2">✔</el-radio>
                                            </el-radio-group>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td colspan="4">
                                            3:需要量明显增加;颅脑损伤、骨髓移植、重症监护
                                        </td>
                                        <td colspan="1">
                                            3分
                                        </td>
                                        <td colspan="1">
                                            <el-radio-group class="elradiozdi"
                                                v-model="state.tableData.疾病状态.type">
                                                <!-- <el-radio value="3">打分</el-radio> -->
                                                <el-radio value="3">✔</el-radio>
                                            </el-radio-group>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td colspan="4" style="text-align: center;background-color: antiquewhite;">
                                            B、营养状态指标(选最大分值)
                                        </td>
                                        <td colspan="1" style="text-align: center;background-color: antiquewhite;">
                                            分数
                                        </td>
                                        <td colspan="1" style="text-align: center;background-color: antiquewhite;">
                                            打分
                                            <!-- <el-radio-group class="elradiozdi"
                              </td>
                           </tr>
                           <tr>
                              <td colspan="4">1:需要量轻度增加:一般恶性肿瘤、髋部骨折、长期血液透、糖尿病、慢性疾病有急性并发症(肝硬化、慢性阻塞性肺病)</td>
                              <td colspan="1">1分</td>
                              <td colspan="1">
                                 <el-radio-group class="elradiozdi" v-model="state.tableData.疾病状态.type">
                                    <!-- <el-radio value="1">打分</el-radio> -->
                                    <el-radio value="1">✔</el-radio>
                                 </el-radio-group>
                              </td>
                           </tr>
                           <tr>
                              <td colspan="4">2:需要量中度增加:腹部大手术,卒中,重度肺炎,血液恶性肿瘤</td>
                              <td colspan="1">2分</td>
                              <td colspan="1">
                                 <el-radio-group class="elradiozdi" v-model="state.tableData.疾病状态.type">
                                    <!-- <el-radio value="2">打分</el-radio> -->
                                    <el-radio value="2">✔</el-radio>
                                 </el-radio-group>
                              </td>
                           </tr>
                           <tr>
                              <td colspan="4">3:需要量明显增加;颅脑损伤、骨髓移植、重症监护</td>
                              <td colspan="1">3分</td>
                              <td colspan="1">
                                 <el-radio-group class="elradiozdi" v-model="state.tableData.疾病状态.type">
                                    <!-- <el-radio value="3">打分</el-radio> -->
                                    <el-radio value="3">✔</el-radio>
                                 </el-radio-group>
                              </td>
                           </tr>
                           <tr>
                              <td colspan="4" style="text-align: center; background-color: antiquewhite">B、营养状态指标(选最大分值)</td>
                              <td colspan="1" style="text-align: center; background-color: antiquewhite">分数</td>
                              <td colspan="1" style="text-align: center; background-color: antiquewhite">
                                 打分
                                 <!-- <el-radio-group class="elradiozdi"
                                                v-model="state.tableData.烹饪主要操作者.type">
                                                <el-radio value="1">打分</el-radio>
                                            </el-radio-group> -->
                                        </td>
                                    </tr>
                                    <tr>
                                        <td colspan="4">
                                            1:正常营养状态
                                        </td>
                                        <td colspan="1">
                                            0分
                                        </td>
                                        <td colspan="1">
                                            <el-radio-group class="elradiozdi"
                                                v-model="state.tableData.营养状态.type">
                                                <el-radio value="0">✔</el-radio>
                                            </el-radio-group>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td colspan="4">
                                            2:3个月内体重丢失>5%或者食物摄入比正常需要量低25%~50%
                                        </td>
                                        <td colspan="1">
                                            1分
                                        </td>
                                        <td colspan="1">
                                            <el-radio-group class="elradiozdi"
                                                v-model="state.tableData.营养状态.type">
                                                <el-radio value="1">✔</el-radio>
                                            </el-radio-group>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td colspan="4">
                                            3:一般情况差或2个月内体重丢失>5%或者食物摄入比正常需要量低
                                        </td>
                                        <td colspan="1">
                                            2分
                                        </td>
                                        <td colspan="1">
                                            <el-radio-group class="elradiozdi"
                                                v-model="state.tableData.营养状态.type">
                                                <el-radio value="2">✔</el-radio>
                                            </el-radio-group>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td colspan="4">
                                            4:BMI<18.5kg/m2,且一般情况差或1个月内体重丢失>5%(或3个
                                        </td>
                                        <td colspan="1">
                                            3分
                                        </td>
                                        <td colspan="1">
                                            <el-radio-group class="elradiozdi"
                                                v-model="state.tableData.营养状态.type">
                                                <el-radio value="3">✔</el-radio>
                                            </el-radio-group>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td colspan="4" style="text-align: center;background-color: antiquewhite;">
                                            C、年龄评分
                                        </td>
                                        <td colspan="1" style="text-align: center;background-color: antiquewhite;">
                                            分数
                                        </td>
                                        <td colspan="1" style="text-align: center;background-color: antiquewhite;">
                                            打分
                                            <!-- <el-radio-group class="elradiozdi"
                              </td>
                           </tr>
                           <tr>
                              <td colspan="4">1:正常营养状态</td>
                              <td colspan="1">0分</td>
                              <td colspan="1">
                                 <el-radio-group class="elradiozdi" v-model="state.tableData.营养状态.type">
                                    <el-radio value="0">✔</el-radio>
                                 </el-radio-group>
                              </td>
                           </tr>
                           <tr>
                              <td colspan="4">2:3个月内体重丢失>5%或者食物摄入比正常需要量低25%~50%</td>
                              <td colspan="1">1分</td>
                              <td colspan="1">
                                 <el-radio-group class="elradiozdi" v-model="state.tableData.营养状态.type">
                                    <el-radio value="1">✔</el-radio>
                                 </el-radio-group>
                              </td>
                           </tr>
                           <tr>
                              <td colspan="4">3:一般情况差或2个月内体重丢失>5%或者食物摄入比正常需要量低</td>
                              <td colspan="1">2分</td>
                              <td colspan="1">
                                 <el-radio-group class="elradiozdi" v-model="state.tableData.营养状态.type">
                                    <el-radio value="2">✔</el-radio>
                                 </el-radio-group>
                              </td>
                           </tr>
                           <tr>
                              <td colspan="4">4:BMI<18.5kg/m2,且一般情况差或1个月内体重丢失>5%</td>
                              <td colspan="1">3分</td>
                              <td colspan="1">
                                 <el-radio-group class="elradiozdi" v-model="state.tableData.营养状态.type">
                                    <el-radio value="3">✔</el-radio>
                                 </el-radio-group>
                              </td>
                           </tr>
                           <tr>
                              <td colspan="4" style="text-align: center; background-color: antiquewhite">C、年龄评分</td>
                              <td colspan="1" style="text-align: center; background-color: antiquewhite">分数</td>
                              <td colspan="1" style="text-align: center; background-color: antiquewhite">
                                 打分
                                 <!-- <el-radio-group class="elradiozdi"
                                                v-model="state.tableData.烹饪主要操作者.type">
                                                <el-radio value="1">打分</el-radio>
                                            </el-radio-group> -->
                                        </td>
                              </td>
                           </tr>
                           <tr>
                              <td colspan="4">< 70 岁</td>
                              <td colspan="1">0分</td>
                              <td colspan="1">
                                 <el-radio-group class="elradiozdi" v-model="state.tableData.年龄评分.type">
                                    <el-radio value="0">✔</el-radio>
                                 </el-radio-group>
                              </td>
                           </tr>
                           <tr>
                              <td colspan="4">>=70 岁</td>
                              <td colspan="1">1分</td>
                              <td colspan="1">
                                 <el-radio-group class="elradiozdi" v-model="state.tableData.年龄评分.type">
                                    <el-radio value="1">✔</el-radio>
                                 </el-radio-group>
                              </td>
                           </tr>
                           <tr>
                              <td colspan="6">营养风险筛查总分</td>
                           </tr>
                           <tr>
                              <td colspan="6" style="font-weight: 600">
                                 注:NRS-2002评分=A+B+C。如患者NRS-2002评分>=3分,则提示患者存在营养风险,应进行营养评定,并制定和实施营养支持治疗计划。
                                 <br />
                                 <br />
                                 <br />
                                 <div style="color: blue" v-if="sum.value" :style="{color:sum.color}">
                                    最后得分:{{ sum.value }}, {{ sum.label }}
                                 </div>
                                    </tr>
                                    <tr>
                                        <td colspan="4">
                                            小于70 岁
                                        </td>
                                        <td colspan="1">
                                            0分
                                        </td>
                                        <td colspan="1">
                                            <el-radio-group class="elradiozdi"
                                                v-model="state.tableData.年龄评分.type">
                                                <el-radio value="0">✔</el-radio>
                                            </el-radio-group>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td colspan="4">
                                            大于、等于70 岁
                                        </td>
                                        <td colspan="1">
                                            1分
                                        </td>
                                        <td colspan="1">
                                            <el-radio-group class="elradiozdi"
                                                v-model="state.tableData.年龄评分.type">
                                                <el-radio value="1">✔</el-radio>
                                            </el-radio-group>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td colspan="6">
                                            营养风险筛查总分
                                        </td>
                                    </tr>
                                    <tr>
                                        <td colspan="6" style="font-weight: 600;">
                                            注:NRS-2002评分=A+B+C。如患者NRS-2002评分>=3分,则提示患者存在营养风险,应进行营养评定,并制定和实施营养支持治疗计划。
                                            <br>
                                            <br>
                                            <br>
                                            <div style="color: blue;">
                                                最后得分:{{sum}},  {{sum>=3?'患者存在营养风险,应进行营养评定,并制定和实施营养支持治疗计划。':'无营养风险'}}
                                            </div>
                                            <br>
                                            <span></span>
                                        </td>
                                    </tr>
                                </table>
                            </div>
                        </el-form>
                    </div>
                </div>
            </div>
            <template #footer>
                <div class="dialog-footer" style="text-align: center">
                    <el-button @click="funhui">取消</el-button>
                    <el-button type="primary" @click="onSubmit">
                        保存
                                 <br />
                                 <span></span>
                              </td>
                           </tr>
                        </table>
                     </div>
                  </el-form>
               </div>
            </div>
         </div>
         <template #footer>
            <div class="dialog-footer" style="text-align: center">
               <el-button @click="funhui">取消</el-button>
               <el-button type="primary" @click="onSubmit"> 保存 </el-button>
               <el-button v-if="state.viewInfo.id" type="primary" v-print="'#pinggu1'">
                        <el-icon><Printer /></el-icon>
                        打印
                    </el-button>
                </div>
            </template>
        </el-dialog>
    </div>
                    <el-button type="primary" v-if="state.viewInfo.id" @click="generatePDF">
                        <el-icon><Position /></el-icon>
                        导出
                    </el-button>
            </div>
         </template>
      </el-dialog>
   </div>
</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';
import { useUserInfo } from '/@/stores/userInfo';
import { usePatientsInfo } from '/@/stores/patientsInfo';
const storesPat = usePatientsInfo();
import {Add,update,deleteId,tiaochabiaoInfo} from '/@/api/tiaochabiao/index'
import { Add, update, deleteId, tiaochabiaoInfo } from '/@/api/tiaochabiao/index';
import { storeToRefs } from 'pinia';
import { useRoute,useRouter } from 'vue-router';
import { useRoute, useRouter } from 'vue-router';
import { ElMessage } from 'element-plus';
const stores = useUserInfo();
const { patientsInfo } = storeToRefs(storesPat);
const { userInfos } = storeToRefs(stores);
const router = useRouter()
const emit = defineEmits([ "shuaxin" ]);
const router = useRouter();
const emit = defineEmits(['shuaxin']);
const state = reactive({
    dialogTableVisible:false,
    tableData: {
        表名: '营养风险筛查表(NRS2002)',
        初次调查日期:"",
        填表日期: '',
        更新日期: '',
        记录者: '陈银成',
        疾病状态: {
            type: '',
            input1: '',
        },
        营养状态: {
            type: '',
            input1: '',
        },
        年龄评分:{
            type: '',
            input1: '',
        }
    },
    loading: false,
    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:'营养风险筛查表(NRS2002)',
        surveryFormType:1,
        updateTime: ''
    }
   dialogTableVisible: false,
   tableData: {
      表名: 'NRS-2002',
      初次调查日期: '',
      填表日期: '',
      更新日期: '',
      记录者: '陈银成',
      疾病状态: {
         type: '',
         input1: '',
      },
      营养状态: {
         type: '',
         input1: '',
      },
})
      年龄评分: {
         type: '',
         input1: '',
      },
      结果: '',
   },
   loading: false,
   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: 'NRS-2002',
      surveryFormType: 1,
      updateTime: '',
   },
});
const sum = computed(() => {
    let x=0
    for(let key in state.tableData){
        console.log(key+'key=='+state.tableData[key]?.type)
        if(Number(state.tableData[key]?.type)){
            x+=Number(state.tableData[key]?.type)
        }
   const res={
        value:'',
        label:'',
        color:''
    }
    return x
})
const funhui=()=>{
    state.dialogTableVisible=false
}
   let x = 0;
   for (let key in state.tableData) {
      console.log(key + 'key==' + state.tableData[key]?.type);
      if (Number(state.tableData[key]?.type)) {
         x += Number(state.tableData[key]?.type);
      }
   }
   res.value=x
   if(x>=3){
      res.label='存在营养风险'
      res.color='#F56C6C'
   }else{
      res.label='无营养风险'
      res.color='#303133'
   }
   return res;
});
const funhui = () => {
   state.dialogTableVisible = false;
};
const onSubmit = () => {
  console.log('submit!')
  console.log(state.tableData)
  const info:tiaochabiaoInfo={
    id: state.viewInfo.id,
    surveryFormType:1,
    code: state.viewInfo.code,
    clientCode: userInfos.value.clientCode,
    patientCode: patientsInfo.value.code,
    surveryTime: formatDate(new Date(), 'YYYY-mm-dd HH:MM:SS'),
    surveryPerson: userInfos.value.code,
    surveryJsonBody: JSON.stringify(state.tableData),
    suveryFormName:'营养风险筛查表(NRS2002)',
    updateTime: ''
  }
  console.log(info)
  if(info.id===0){
    Add(info).then(re=>{
        console.log(re.data)
        state.dialogTableVisible=false
        emit('shuaxin')
    })
  }else if(info.id>0){
    info.surveryTime=state.viewInfo.surveryTime
    update(info).then(re=>{
        console.log(re.data)
        state.dialogTableVisible=false
        emit('shuaxin')
    })
  }
}
   console.log('submit!');
   console.log(state.tableData);
    state.tableData.结果=sum.value
   const info: tiaochabiaoInfo = {
      id: state.viewInfo.id,
      surveryFormType: 1,
      code: state.viewInfo.code,
      clientCode: userInfos.value.clientCode,
      patientCode: patientsInfo.value.code,
      surveryTime: formatDate(new Date(), 'YYYY-mm-dd HH:MM:SS'),
      surveryPerson: userInfos.value.code,
      surveryJsonBody: JSON.stringify(state.tableData),
      suveryFormName: 'NRS-2002',
      updateTime: '',
   };
   console.log(info);
   if (info.id === 0) {
      Add(info).then((re) => {
         console.log(re.data);
         state.dialogTableVisible = false;
         emit('shuaxin');
      });
   } else if (info.id > 0) {
      info.surveryTime = state.viewInfo.surveryTime;
      update(info).then((re) => {
         console.log(re.data);
         state.dialogTableVisible = false;
         emit('shuaxin');
      });
   }
};
// 第一步:定义子组件里面的方法
const getData = (str: string) => {
    console.log("子组件获取显示数据!" + str);
    state.loading = true
}
   console.log('子组件获取显示数据!' + str);
   state.loading = true;
};
// 打开查看或者编辑明细
const openShow = (type: string,mode:tiaochabiaoInfo) => {
    console.log(type)
    if(type==='add'){
        state.tableData.初次调查日期=formatDate(new Date(),'YYYY-mm-dd')
        state.tableData.更新日期=formatDate(new Date(),'YYYY-mm-dd')
        state.tableData.记录者=userInfos.value.userName
        getPageInfo()
        state.dialogTableVisible = true
    }
    else if(type==='update'){
        console.log('------------------------3333333333333333')
        console.log(mode)
        state.viewInfo=mode
        state.tableData=JSON.parse(mode.surveryJsonBody)
        state.dialogTableVisible = true
const openShow = (type: string, mode: tiaochabiaoInfo) => {
   console.log(type);
   if (type === 'add') {
      state.tableData.初次调查日期 = formatDate(new Date(), 'YYYY-mm-dd');
      state.tableData.更新日期 = formatDate(new Date(), 'YYYY-mm-dd');
      state.tableData.记录者 = userInfos.value.userName;
      getPageInfo();
      console.log(state.tableData);
      state.dialogTableVisible = true;
   } else if (type === 'update') {
      console.log('------------------------3333333333333333');
      console.log(mode);
      state.viewInfo = mode;
      state.tableData = JSON.parse(mode.surveryJsonBody);
      state.tableData.初次调查日期=mode.surveryTime
        state.tableData.更新日期=mode.updateTime
      state.dialogTableVisible = true;
   }
};
const getPageInfo = () => {
   state.tableData = {
      表名: 'NRS-2002',
      初次调查日期: formatDate(new Date(), 'YYYY-mm-dd'),
      填表日期: '',
      更新日期: formatDate(new Date(), 'YYYY-mm-dd'),
      记录者: userInfos.value.userName,
      疾病状态: {
         type: '',
         input1: '',
      },
      营养状态: {
         type: '',
         input1: '',
      },
      年龄评分: {
         type: patientsInfo.value.age < 70 ? '0' : '1',
         input1: '',
      },
      结果: '',
   };
   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: 'NRS-2002',
      surveryFormType: 1,
      updateTime: '',
   };
};
const generatePDF=()=> {
      const element = document.getElementById('pinggu1');
      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();
    }
}
const getPageInfo=()=>{
    state.tableData={
        表名: '营养风险筛查表(NRS2002)',
        初次调查日期:formatDate(new Date(),'YYYY-mm-dd'),
        填表日期: '',
        更新日期: formatDate(new Date(),'YYYY-mm-dd'),
        记录者: userInfos.value.userName,
        疾病状态: {
            type: '',
            input1: '',
        },
        营养状态: {
            type: '',
            input1: '',
        },
        年龄评分:{
            type: patientsInfo.value.age<70?'0':'1',
            input1: '',
        }
    }
}
// 第二步:暴露方法
defineExpose({ getData, openShow })
defineExpose({ getData, openShow });
</script>
<style scoped lang="scss">
.gridtable {
    font-family: verdana, arial, sans-serif;
    font-size: 11px;
    color: #333333;
    border-width: 1px;
    border-color: #666666;
    border-collapse: collapse;
   font-family: verdana, arial, sans-serif;
   font-size: 11px;
   color: #333333;
   border-width: 1px;
   border-color: #666666;
   border-collapse: collapse;
}
.gridtable th {
    border-width: 1px;
    padding: 8px;
    border-style: solid;
    text-align: left;
    border-color: #666666;
    background-color: #a4b0e2;
   border-width: 1px;
   padding: 8px;
   border-style: solid;
   text-align: left;
   border-color: #666666;
   background-color: #a4b0e2;
}
.gridtable td {
    border-width: 1px;
    padding: 8px;
    border-style: solid;
    border-color: #666666;
    background-color: #ffffff;
   border-width: 1px;
   padding: 8px;
   border-style: solid;
   border-color: #666666;
   background-color: #ffffff;
}
</style>
</style>