invoicePrint.vue 3.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  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 != 10106" :paramsObj="invoiceParams"></printOne>
  17. <printTwo v-if="org_id == 10106" :paramsObj="invoiceParams"></printTwo>
  18. </div>
  19. </div>
  20. </div>
  21. </template>
  22. <script>
  23. import printOne from './invoiceTemplate/printOne'
  24. import printTwo from './invoiceTemplate/printTwo'
  25. export default {
  26. name: "invoicePrint",
  27. components: {
  28. printOne,
  29. printTwo
  30. },
  31. props:{
  32. invoiceParams:Object
  33. },
  34. data() {
  35. return {
  36. childResponse: {},
  37. // invoiceParams:{},
  38. org_id:''
  39. };
  40. },
  41. methods: {
  42. getAdminUser(id) {
  43. if (id == 0) {
  44. return "";
  45. }
  46. if (id == undefined) {
  47. return "";
  48. }
  49. for (let i = 0; i < this.adminUser.length; i++) {
  50. if (this.adminUser[i].id == id) {
  51. return this.adminUser[i].name;
  52. }
  53. }
  54. },
  55. getTime(value, temp) {
  56. if (value == 0) {
  57. return "";
  58. }
  59. if (value != undefined) {
  60. return uParseTime(value, temp);
  61. }
  62. return "";
  63. },
  64. printThisPage() {
  65. const style =
  66. '@media print {#invoice-print{font-size:12px;}.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;}}';
  67. printJS({
  68. printable: "invoice-print",
  69. type: "html",
  70. style: style,
  71. scanStyles: false
  72. });
  73. // if (this.org_template_info.template_id == 1) {
  74. // printJS({
  75. // printable: "dialysis-print-box",
  76. // type: "html",
  77. // style: style,
  78. // scanStyles: false
  79. // });
  80. // }
  81. },
  82. },
  83. created() {
  84. console.log('this.invoiceParams',this.invoiceParams)
  85. this.org_id = this.$store.getters.xt_user.org_id
  86. },
  87. watch:{
  88. paramsObj:{//深度监听,可监听到对象、数组的变化
  89. handler(val, oldVal){
  90. this.invoiceParams = val
  91. },
  92. deep:true
  93. }
  94. }
  95. };
  96. </script>
  97. <style lang="scss" scoped>
  98. .printTitle{
  99. font-size: 22px;
  100. text-align: center;
  101. font-weight: bold;
  102. }
  103. .infoMain{
  104. display: flex;
  105. flex-wrap: wrap;
  106. border-bottom: 2px solid #000;
  107. padding:0 10px;
  108. }
  109. .infoMain .infoP{
  110. width: 33%;
  111. line-height: 24px;
  112. }
  113. .prescriptionBox{
  114. padding:0 10px;
  115. height:600px;
  116. }
  117. .Rp{
  118. font-size: 22px;
  119. font-weight: bold;
  120. }
  121. .drugsBox{
  122. padding-left: 40px;
  123. margin-bottom: 10px;
  124. }
  125. .drugsBox p{
  126. line-height: 30px;
  127. }
  128. .drugsOne{
  129. line-height: 24px;
  130. }
  131. .drugsOne span{
  132. margin-right: 20px;
  133. }
  134. .doctorBox{
  135. display: flex;
  136. justify-content: space-between;
  137. padding:0 10px;
  138. line-height: 24px;
  139. border-bottom: 2px solid #000;
  140. }
  141. .actionBar{
  142. display: flex;
  143. justify-content: space-between;
  144. line-height: 24px;
  145. padding:0 10px;
  146. }
  147. .actionBar p{
  148. width:150px;
  149. }
  150. </style>