print-template-jr.vue 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250
  1. <template>
  2. <ele-modal title="出库单" :visible.sync="QRvisible" width="90%">
  3. <div id="printSection">
  4. <div
  5. class="print"
  6. style="
  7. display: flex;
  8. align-items: center;
  9. justify-content: center;
  10. flex-direction: column;
  11. "
  12. >
  13. <div
  14. style="
  15. width: 100%;
  16. font-size: 12px;
  17. display: flex;
  18. margin-bottom: 10px;
  19. "
  20. >
  21. <span style="width: 48%">
  22. <span style="width: 60px; display: inline-block">购货单位:</span>
  23. {{ formData.contactName }}
  24. </span>
  25. <span>
  26. <span style="width: 60px; display: inline-block">单据编码:</span>
  27. {{ formData.docNo }}
  28. </span>
  29. </div>
  30. <div
  31. style="
  32. width: 100%;
  33. font-size: 12px;
  34. display: flex;
  35. margin-bottom: 10px;
  36. "
  37. >
  38. <span style="width: 48%">
  39. <span style="width: 170px; display: inline-block"
  40. >生产厂家/上市许可持有人:</span
  41. >
  42. 湖南聚仁中药饮片有限公司
  43. </span>
  44. <span style="width: 17%">
  45. <span style="width: 60px; display: inline-block">发货仓库</span>
  46. 成品仓
  47. </span>
  48. <span style="width: 17%">
  49. <span style="width: 60px; display: inline-block">发货日期</span>
  50. 2025-01-01
  51. </span>
  52. <span style="width: 17%">
  53. <span style="width: 60px; display: inline-block">总计金额</span>
  54. ¥{{ formData.totalPrice }}
  55. </span>
  56. </div>
  57. <table
  58. cellspacing="0"
  59. border
  60. style="
  61. width: 100%;
  62. height: 190px;
  63. table-layout: fixed;
  64. word-break: break-all;
  65. word-wrap: break-word;
  66. font-size: 12px;
  67. "
  68. >
  69. <tbody>
  70. <tr align="center" style="height: 30px">
  71. <td style="width: 6%"> 商品编号 </td>
  72. <td style="width: 6%"> 品名 </td>
  73. <td style="width: 6%"> 规格 </td>
  74. <td style="width: 6%"> 产地</td>
  75. <td style="width: 3%"> 单位</td>
  76. <td style="width: 6%"> 数量</td>
  77. <td style="width: 7%"> 单价</td>
  78. <td style="width: 7%"> 金额</td>
  79. <td style="width: 8%"> 批号</td>
  80. <td style="width: 8%"> 生产日期</td>
  81. <td style="width: 8%"> 保质期至</td>
  82. <td> 贮藏</td>
  83. <td> 备注</td>
  84. </tr>
  85. <tr
  86. align="center"
  87. style="height: 22px"
  88. v-for="(item, index) in [{}, {}, {}, {}, {}, {}]"
  89. >
  90. <td> {{ item.productCode }} </td>
  91. <td> {{ item.productName }} </td>
  92. <td> {{ item.totalWeight }}</td>
  93. <td> {{ item.totalCount }}</td>
  94. <td> {{ item.remark }}</td>
  95. <td> {{ item.remark }}</td>
  96. <td> {{ item.remark }}</td>
  97. <td> {{ item.remark }}</td>
  98. <td> {{ item.remark }}</td>
  99. <td> {{ item.remark }}</td>
  100. <td> {{ item.remark }}</td>
  101. <td> {{ item.remark }}</td>
  102. <td> {{ item.remark }}</td>
  103. </tr>
  104. <tr align="center" style="height: 30px">
  105. <td :colspan="5">
  106. <div style="margin-left: 35px"></div>
  107. </td>
  108. <td :colspan="3">
  109. <div style="margin-left: 65px"></div>
  110. </td>
  111. <td :colspan="5">
  112. <div style="margin-left: 65px"></div>
  113. </td>
  114. </tr>
  115. </tbody>
  116. </table>
  117. <div
  118. style="
  119. width: 100%;
  120. font-size: 12px;
  121. display: flex;
  122. justify-content: space-between;
  123. margin-top: 10px;
  124. "
  125. >
  126. <div style="flex: 1">
  127. <div>开票员:</div>
  128. </div>
  129. <div style="flex: 1">
  130. <div>业务员:</div>
  131. </div>
  132. <div style="flex: 1">
  133. <div>发货员:</div>
  134. </div>
  135. <div style="flex: 1">
  136. <div>收货方:</div>
  137. </div>
  138. <div style="flex: 1">
  139. <div>质量状况:</div>
  140. </div>
  141. <div style="flex: 1">
  142. <div>提货方式:</div>
  143. </div>
  144. </div>
  145. </div>
  146. </div>
  147. <div slot="footer">
  148. <el-button @click="print">打印预览</el-button>
  149. <el-button @click="close">关闭</el-button>
  150. </div>
  151. </ele-modal>
  152. </template>
  153. <script>
  154. import { getSendSaleOrderrecordDetailSplit } from '@/api/saleManage/saleordersendrecord';
  155. import { getInfoBySourceBizNoAll } from '@/api/wms';
  156. import { mapGetters } from 'vuex';
  157. export default {
  158. name: 'print',
  159. computed: {
  160. ...mapGetters(['user'])
  161. },
  162. props: {
  163. groupName: ''
  164. },
  165. data() {
  166. return {
  167. checked: '',
  168. QRvisible: false,
  169. isPrintPrice: false,
  170. formData: {},
  171. outBound: {}
  172. };
  173. },
  174. methods: {
  175. async open(id) {
  176. this.formData = await getSendSaleOrderrecordDetailSplit(id);
  177. this.QRvisible = true;
  178. let dataArray = await getInfoBySourceBizNoAll(this.formData.docNo);
  179. this.outBound = JSON.parse(JSON.stringify(dataArray[0]));
  180. this.outBound['outInDetailRecordRequestList'] = [];
  181. dataArray.forEach((item) => {
  182. item.outInDetailList.forEach((val) => {
  183. if (val.outInDetailRecordRequestList.length) {
  184. val.outInDetailRecordRequestList.forEach((j) => {
  185. j['categoryName'] = val.categoryName;
  186. j['categoryModel'] = val.categoryModel;
  187. j['specification'] = val.specification;
  188. j['categoryCode'] = val.categoryCode;
  189. });
  190. this.outBound['outInDetailRecordRequestList'].push(
  191. ...val.outInDetailRecordRequestList
  192. );
  193. } else {
  194. this.outBound['outInDetailRecordRequestList'].push(val);
  195. }
  196. });
  197. });
  198. //包装维度
  199. },
  200. close() {
  201. this.QRvisible = false;
  202. },
  203. print() {
  204. const printSection = document.getElementById('printSection');
  205. // 创建打印任务
  206. const printWindow = window.open('', '_blank');
  207. printWindow.document.open();
  208. printWindow.document.write('<html><head><title>打印预览</title>');
  209. printWindow.document.write(`<style>
  210. @media print {
  211. .print{
  212. page-break-before: always !important;
  213. page-break-inside: avoid !important;
  214. };
  215. @page {
  216. size: 200cm 11cm;
  217. }
  218. }
  219. </style>`);
  220. printWindow.document.write('</head><body>');
  221. printWindow.document.write(printSection.innerHTML);
  222. printWindow.document.write('</body></html>');
  223. printWindow.document.close();
  224. printWindow.onload = function () {
  225. printWindow.print();
  226. };
  227. }
  228. }
  229. };
  230. </script>
  231. <style>
  232. @media print {
  233. .print {
  234. page-break-before: always !important;
  235. page-break-inside: avoid !important;
  236. }
  237. @page {
  238. size: 30cm 11cm;
  239. margin: 0;
  240. }
  241. }
  242. </style>