patientPrint.vue 5.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222
  1. <template>
  2. <el-dialog
  3. title="打印"
  4. :visible.sync="visibility"
  5. :close-on-click-modal="isClose"
  6. :close-on-press-escape="isClose"
  7. >
  8. <el-button type="primary" @click="print" class="print_style"
  9. >打印</el-button
  10. >
  11. <div id="dialysis-print-box-1" class="dialysis-print-box-1">
  12. <div class="list_title" style="border-bottom:none;"><div style="width:100%;text-align:center;font-size:16px;font-weight:bold;">{{org_name}} 发药单</div></div>
  13. <div class="list_title">
  14. <div>患者名称:{{name}}</div>
  15. <div>发药状态:{{state}}</div>
  16. <div>日期:</div>
  17. </div>
  18. <el-table
  19. style="width: 940px; margin: 0 auto"
  20. :data="tableData"
  21. border
  22. max-height="450"
  23. :header-cell-style="{ backgroundColor: 'rgb(245, 247, 250)' }"
  24. >
  25. <el-table-column type="index" prop="index" label="序号" width="60" align="center">
  26. </el-table-column>
  27. <el-table-column prop="name" label="名称" width="160" align="center">
  28. </el-table-column>
  29. <el-table-column prop="SingleDosage" label="单次用量" width="120" align="center">
  30. </el-table-column>
  31. <el-table-column prop="use" label="用法" width="120" align="center"> </el-table-column>
  32. <el-table-column prop="frequency" label="频率" width="120" align="center">
  33. </el-table-column>
  34. <el-table-column prop="day" label="天数" width="120" align="center"> </el-table-column>
  35. <el-table-column prop="amount" label="总量" width="120" align="center">
  36. </el-table-column>
  37. <el-table-column prop="tips" label="备注" width="120" align="center">
  38. </el-table-column>
  39. </el-table>
  40. </div>
  41. </el-dialog>
  42. </template>
  43. <script>
  44. import Vue from "vue";
  45. import print from "print-js";
  46. import printutils from "./print.js";
  47. export default {
  48. data() {
  49. return {
  50. visibility: false,
  51. tableData: [{}],
  52. isClose:false,
  53. name:"",
  54. state:null,
  55. org_name: this.$store.getters.xt_user.org.org_name,
  56. };
  57. },
  58. props: {
  59. propForm: {
  60. type: Object,
  61. },
  62. },
  63. methods: {
  64. // isClose() {
  65. // this.visibility = false;
  66. // },
  67. hide: function () {
  68. this.visibility = false;
  69. for (let i = 0; i < this.propForm.goods.length; i++) {
  70. for (let key in this.propForm.goods[i]) {
  71. if (key != "index") {
  72. this.propForm.goods[i][key].isSelected = false;
  73. }
  74. }
  75. }
  76. },
  77. show: function () {
  78. this.visibility = true;
  79. },
  80. comfirm: function (formName) {
  81. this.goodInfo = [];
  82. this.goodInfoTableData = [];
  83. this.$emit("dialog-comfirm", this.getValue());
  84. this.$refs.multipleTable.clearSelection();
  85. this.$refs.table.setCurrentRow(null);
  86. },
  87. getValue() {},
  88. // 打印
  89. print() {
  90. Vue.prototype.printJson = printutils.printJson;
  91. // const style =
  92. // '@media print {.list_title{ width: 940px;border-bottom: 1px solid;display: flex;margin: 30px auto}}';
  93. // printJS({
  94. // printable: "dialysis-print-box-1",
  95. // type: "html",
  96. // style: style,
  97. // scanStyles: false,
  98. // });
  99. this.printJson({
  100. title: `
  101. <div>
  102. <div style="width: 940px;text-align:center;font-size:16px;font-weight:bold;">${this.org_name} 发药单</div>
  103. <div style="width: 940px;border-bottom: 1px solid;display: flex;margin: 30px auto;font-size:14px;">
  104. <div style="width: 310px;padding: 10px 0;">患者名称:${this.name}</div>
  105. <div style="width: 320px;padding: 10px 0;">发药状态:${this.state}</div>
  106. <div style="width: 310px;padding: 10px 0;">日期:</div>
  107. </div>`, // 打印出来的标题
  108. data: this.tableData, // 需要打印的数据
  109. serial: true, // 是否需要打印序列号
  110. fields: [
  111. // 需要打印的字段
  112. // "index",
  113. "Name",
  114. "SingleDosage",
  115. "use",
  116. "frequency",
  117. "day",
  118. "amount",
  119. "from",
  120. "tips",
  121. ],
  122. properties: [
  123. // 需要打印的字段对应的表头名
  124. {
  125. field: "name",
  126. displayName: "名称",
  127. },
  128. {
  129. field: "SingleDosage",
  130. displayName: "单词用量",
  131. },
  132. {
  133. field: "use",
  134. displayName: "用法",
  135. },
  136. {
  137. field: "frequency",
  138. displayName: "频率",
  139. },
  140. {
  141. field: "day",
  142. displayName: "天数",
  143. },
  144. {
  145. field: "amount",
  146. displayName: "总量",
  147. },
  148. {
  149. field: "from",
  150. displayName: "数据来源",
  151. },
  152. {
  153. field: "tips",
  154. displayName: "备注",
  155. },
  156. ],
  157. });
  158. },
  159. },
  160. };
  161. </script>
  162. <style rel="stylesheet/css" lang="scss" scoped>
  163. /deep/ .el-dialog{
  164. width: 60%;
  165. }
  166. /deep/ .el-table__body-wrapper::-webkit-scrollbar {
  167. width: 10px;
  168. height: 10px;
  169. }
  170. .print_style {
  171. position: absolute;
  172. right: 65px;
  173. top: 50px;
  174. }
  175. .list_title {
  176. width: 940px;
  177. border-bottom: 1px solid;
  178. display: flex;
  179. margin: 30px auto;
  180. div {
  181. width: 320px;
  182. padding: 10px 0;
  183. }
  184. }
  185. </style>
  186. <style>
  187. .sign-and-weigh-box .sign-and-weigh-box-patients .cell {
  188. font-size: 12px;
  189. }
  190. .sign-and-weigh-box .sign-and-weigh-box-patients .current-row > td {
  191. background: #6fb5fa;
  192. }
  193. .count {
  194. color: #bd2c00;
  195. }
  196. .el-table td,
  197. .el-table th.is-leaf,
  198. .el-table--border,
  199. .el-table--group {
  200. border-color: #d0d3da;
  201. }
  202. .el-table--border::after,
  203. .el-table--group::after,
  204. .el-table::before {
  205. background-color: #d0d3da;
  206. }
  207. </style>