invoicePrint.vue 5.5KB

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