瀏覽代碼

优化病案首页打印。

lighter 3 年之前
父節點
當前提交
b0c67d8954

+ 1 - 1
src/components/inpatient/frontsheet-printpage/HeadPage.vue

@@ -44,7 +44,7 @@
       出生地:
       <div style="margin-right: 8px; padding: 0 4px; border-bottom: 1px solid black; width: 230px">{{ patient.birthPlaceName }}</div>
       籍贯:
-      <div style="margin-right: 8px; padding: 0 4px; border-bottom: 1px solid black; width: 180px">{{ patient.nativePlaceName }}</div>
+      <div style="margin-right: 8px; padding: 0 4px; border-bottom: 1px solid black; width: 230px">{{ patient.nativePlaceName }}</div>
       民族:
       <div style="margin-right: 8px; padding: 0 4px; border-bottom: 1px solid black">{{ filterNameInDic(patient.nation, 'getNation') }}</div>
     </div>

+ 19 - 35
src/views/hospitalization/case-front-sheet/AllCaseFrontSheet.vue

@@ -668,6 +668,12 @@
             </div>
           </div>
         </div>
+        <div id="headpage" style="opacity: 0; position: fixed">
+          <HeadPage :patient="sheet" :dics="dics" />
+        </div>
+        <div id="tailpage" style="opacity: 0; position: fixed">
+          <TailPage :patient="sheet" :dics="dics" />
+        </div>
       </el-main>
     </el-container>
 
@@ -764,7 +770,13 @@ import router from '@/router'
 import { initLodop, getLodop } from '@/utils/c-lodop'
 import { formatMonth } from '@/utils/date'
 import { createWorkSheet, writeExcelFile } from '@/utils/excel'
+import HeadPage from '../../../components/inpatient/frontsheet-printpage/HeadPage.vue'
+import TailPage from '../../../components/inpatient/frontsheet-printpage/TailPage.vue'
 export default {
+  components: {
+    HeadPage,
+    TailPage,
+  },
   setup() {
     const isCollapse = computed(() => store.state.app.isCollapse)
     const cdStyle = computed(() => {
@@ -1276,42 +1288,10 @@ export default {
         })
     }
     const execPrint = (flag) => {
-      if (!beforePrintSet.value) {
-        const allInput = document.body.getElementsByTagName('input')
-        const allTextArea = document.body.getElementsByTagName('textarea')
-        const allSelect = document.body.getElementsByTagName('select')
-        for (let i = 0; i < allInput.length; i++) allInput[i].setAttribute('value', allInput[i].value)
-        for (let i = 0; i < allTextArea.length; i++) allTextArea[i].innerText = allTextArea[i].value
-        for (let i = 0; i < allSelect.length; i++) {
-          let select = allSelect[i]
-          if (select.value === '') {
-            if (select.options[select.options.length - 1].value !== '') select.options[select.options.length] = new Option('', '')
-            select.options[select.options.length - 1].setAttribute('selected', true)
-          } else {
-            for (let j = 0; j < select.options.length; j++) {
-              if (select.options[j].value === select.value) {
-                select.options[j].setAttribute('selected', true)
-              } else {
-                select.options[j].removeAttribute('selected')
-              }
-            }
-          }
-        }
-        beforePrintSet.value = true
-      }
-
-      const prntStyle =
-        "<style>select,input {outline: none;border: none;height: 20px;line-height: 20px;border-radius: 0;background: transparent;border-bottom: 1px solid #333333;-webkit-appearance: none!important;-moz-appearance: none!important;appearance: none!important;} select::-ms-expand {display: none!important;}textarea {outline: none;border: none;background-color: transparent;overflow-y:hidden}input[type='number'] {-moz-appearance: textfield;}table th {border: 1px solid black;text-align: center;}table td {border: 1px solid black;}</style>"
-      let pagePrint
-      if (flag === 1) {
-        const page0 = '<div>' + document.getElementById('page0').innerHTML + '</div>'
-        const page1 = '<div>' + document.getElementById('page1').innerHTML + '</div>'
-        pagePrint = prntStyle + '<body>' + page0 + page1 + '</body>'
-      } else {
-        const page2 = '<div>' + document.getElementById('page2').innerHTML + '</div>'
-        pagePrint = prntStyle + '<body>' + page2 + '</body>'
-      }
       LODOP = getLodop()
+      const prntStyle = `<style>*{font-size:10pt} table,th,td {border: 1px solid black;border-collapse: collapse;} td,th {height: 24px;padding-left: 4px;}</style>`
+      const prntContent = flag === 1 ? document.getElementById('headpage').innerHTML : document.getElementById('tailpage').innerHTML
+      let pagePrint = prntStyle + '<body>' + prntContent + '</body>'
       LODOP.PRINT_INIT('casefrontsheet')
       LODOP.SET_PRINT_PAGESIZE(1, '210mm', '297mm', '')
       LODOP.SET_PRINT_MODE('FULL_WIDTH_FOR_OVERFLOW', true) // 整宽不变形
@@ -1465,6 +1445,10 @@ export default {
     onMounted(() => {
       document.addEventListener('keydown', handleEvent)
       getAllDictionary().then((res) => {
+        res.getOperations = operations
+        res.getYesOrNo = yesOrNo
+        res.getHaveOrNot = haveOrNot
+        res.getAutopsies = autopsies
         dics.value = res
         getAllWards().then((res1) => {
           userWards.value = res1

+ 3 - 4
src/views/hospitalization/case-front-sheet/FillCaseFrontSheet.vue

@@ -643,10 +643,10 @@
             </div>
           </div>
         </div>
-        <div id="headpage" v-show="false">
+        <div id="headpage" style="opacity: 0; position: fixed">
           <HeadPage :patient="patient" :dics="dics" />
         </div>
-        <div id="tailpage" v-show="false">
+        <div id="tailpage" style="opacity: 0; position: fixed">
           <TailPage :patient="patient" :dics="dics" />
         </div>
       </el-main>
@@ -772,11 +772,10 @@ import {
   getUserWards,
   getYbDiags,
   sheetSearch,
-  queryDept,
 } from '@/api/case-front-sheet'
 import maleIcon from '@/assets/male-icon.png'
 import femaleIcon from '@/assets/female-icon.png'
-import { ElMessage, ElMessageBox } from 'element-plus'
+import { ElMessage } from 'element-plus'
 import { shortcuts } from '@/data/shortcuts'
 import { formatDate, formatDatetime, getDatetime, getOneMonthOffset } from '@/utils/date'
 import { cptSex } from '@/utils/computed'