treatPrint.vue 4.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189
  1. <template>
  2. <div>
  3. <template>
  4. <el-button
  5. style="position:fixed;right:25px;z-index:999"
  6. :loading="loading"
  7. size="small"
  8. icon="el-icon-printer"
  9. @click="printThisPage"
  10. type="primary"
  11. >打印</el-button
  12. >
  13. </template>
  14. <div class="app-container" style="padding-top:40px;">
  15. <div class='dialysisPage'>
  16. <printOne v-if="org_id != 4" v-bind:childResponse="childResponse" :paramsObj="paramsObj"></printOne>
  17. <printTwo v-else v-bind:childResponse="childResponse" :paramsObj="paramsObj"></printTwo>
  18. </div>
  19. </div>
  20. </div>
  21. </template>
  22. <script>
  23. import {
  24. getDialysisRecordInitData,
  25. getDialysisSchedules
  26. } from "@/api/dialysis_record";
  27. import { parseTime } from "@/utils";
  28. import { getDialysisRecord } from "@/api/dialysis";
  29. import { getDataConfig } from "@/utils/data";
  30. import { jsGetAge, uParseTime } from "@/utils/tools";
  31. // import LabelBox from "./printItem/LabelBox";
  32. import BreadCrumb from "@/xt_pages/components/bread-crumb";
  33. import print from "print-js";
  34. import printOne from "./treatTemplate/printOne"
  35. import printTwo from "./treatTemplate/printTwo"
  36. export default {
  37. name: "dialysisPrintOrder",
  38. components: {
  39. BreadCrumb,
  40. printOne,
  41. printTwo
  42. },
  43. props:{
  44. paramsObj:Object
  45. },
  46. data() {
  47. return {
  48. crumbs: [
  49. { path: false, name: "透析管理" },
  50. { path: false, name: "打印单" }
  51. ],
  52. childResponse: {},
  53. paramsObj:{},
  54. org_id:''
  55. };
  56. },
  57. methods: {
  58. getAdminUser(id) {
  59. if (id == 0) {
  60. return "";
  61. }
  62. if (id == undefined) {
  63. return "";
  64. }
  65. for (let i = 0; i < this.adminUser.length; i++) {
  66. if (this.adminUser[i].id == id) {
  67. return this.adminUser[i].name;
  68. }
  69. }
  70. },
  71. getTime(value, temp) {
  72. if (value == 0) {
  73. return "";
  74. }
  75. if (value != undefined) {
  76. return uParseTime(value, temp);
  77. }
  78. return "";
  79. },
  80. printThisPage() {
  81. var ptime = Math.round(new Date().getTime() / 1000);
  82. this.print_time = uParseTime(ptime, "{y}-{m}-{d} {h}:{i}");
  83. if(this.org_id == 4){
  84. const style =
  85. '@media print {#prescription-print{font-size:12px;}.printTitle{font-size: 22px;text-align: center;font-weight: bold;}}';
  86. printJS({
  87. printable: "prescription-print",
  88. type: "html",
  89. style: style,
  90. scanStyles: false
  91. });
  92. }else{
  93. const style =
  94. '@media print {.printTitle{font-size: 22px;text-align: center;font-weight: bold;}.infoMain{display: flex;flex-wrap: wrap;padding:0 10px;margin-top:10px;}.infoMain .infoP{width: 33%;}.chargeBox{border: 1px solid #000;}.chargeUl{display:flex;justify-content: space-between;text-align: center;}.chargeUl p{line-height: 1px;}.chargeP{line-height: 1px;padding-bottom:16px;}.moneyBox{display: flex;justify-content: space-between;padding: 0 10px;background: #eeeeee;-webkit-print-color-adjust:exact;-moz-print-color-adjust:exact;-ms-print-color-adjust:exact;print-color-adjust:exact;height: 40px;align-items: center;border:1px solid #000; border-top:none}.actionBar{display: flex;justify-content: space-between; line-height: 24px;padding:0 10px;}.actionBar div{width:150px;}}';
  95. printJS({
  96. printable: "prescription-print",
  97. type: "html",
  98. style: style,
  99. scanStyles: false
  100. });
  101. }
  102. // if (this.org_template_info.template_id == 1) {
  103. // printJS({
  104. // printable: "dialysis-print-box",
  105. // type: "html",
  106. // style: style,
  107. // scanStyles: false
  108. // });
  109. // }
  110. },
  111. },
  112. created() {
  113. this.org_id = this.$store.getters.xt_user.org_id
  114. },
  115. watch:{
  116. paramsObj:{//深度监听,可监听到对象、数组的变化
  117. handler(val, oldVal){
  118. this.paramsObj = val
  119. },
  120. deep:true
  121. }
  122. }
  123. };
  124. </script>
  125. <style lang="scss" scoped>
  126. .printTitle{
  127. font-size: 22px;
  128. text-align: center;
  129. font-weight: bold;
  130. }
  131. .infoMain{
  132. display: flex;
  133. flex-wrap: wrap;
  134. border-bottom: 2px solid #000;
  135. padding:0 10px;
  136. }
  137. .infoMain .infoP{
  138. width: 33%;
  139. line-height: 24px;
  140. }
  141. .prescriptionBox{
  142. padding:0 10px;
  143. height:600px;
  144. }
  145. .Rp{
  146. font-size: 22px;
  147. font-weight: bold;
  148. }
  149. .drugsBox{
  150. padding-left: 40px;
  151. margin-bottom: 10px;
  152. }
  153. .drugsBox p{
  154. line-height: 30px;
  155. }
  156. .drugsOne{
  157. line-height: 24px;
  158. }
  159. .drugsOne span{
  160. margin-right: 20px;
  161. }
  162. .doctorBox{
  163. display: flex;
  164. justify-content: space-between;
  165. padding:0 10px;
  166. line-height: 24px;
  167. border-bottom: 2px solid #000;
  168. }
  169. .actionBar{
  170. display: flex;
  171. justify-content: space-between;
  172. line-height: 24px;
  173. padding:0 10px;
  174. }
  175. .actionBar p{
  176. width:150px;
  177. }
  178. </style>