print-template-bs.vue 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227
  1. <template>
  2. <ele-modal
  3. title="出库单"
  4. :visible.sync="QRvisible"
  5. v-if="QRvisible"
  6. width="90%"
  7. >
  8. <div
  9. id="printSection"
  10. style="
  11. display: flex;
  12. align-items: center;
  13. justify-content: center;
  14. flex-direction: column;
  15. "
  16. >
  17. <div
  18. style="
  19. position: relative;
  20. width: 100%;
  21. height: 100px;
  22. display: flex;
  23. flex-direction: column;
  24. align-items: center;
  25. "
  26. >
  27. <img
  28. v-if="groupName.includes('宝盛')"
  29. style="width: 80px; height: 80px; position: absolute; left: 20px"
  30. src="@/assets/bslogo.png"
  31. alt=""
  32. />
  33. <div
  34. style="
  35. font-size: 20px;
  36. font-weight: 800;
  37. text-align: center;
  38. width: 100%;
  39. "
  40. >{{ groupName || '长沙宝盛汽车配件有限公司' }}</div
  41. >
  42. <div
  43. style="
  44. font-size: 18px;
  45. font-weight: 800;
  46. text-align: center;
  47. width: 100%;
  48. "
  49. >送货单</div
  50. >
  51. </div>
  52. <div
  53. style="
  54. width: 100%;
  55. font-size: 12px;
  56. display: flex;
  57. justify-content: space-between;
  58. margin-bottom: 10px;
  59. "
  60. >
  61. <span style="width: 40%">客户名称:{{ formData.contactName }}</span>
  62. <span style="width: 40%"
  63. >发货单号:{{ formData.printNo || formData.docNo }}</span
  64. >
  65. </div>
  66. <div
  67. style="
  68. width: 100%;
  69. font-size: 12px;
  70. display: flex;
  71. justify-content: space-between;
  72. margin-bottom: 10px;
  73. "
  74. >
  75. <span style="width: 40%">发货日期:{{ formData.createTime }}</span>
  76. <span style="width: 40%"
  77. >联系人:{{ formData.linkName }}
  78. 联系电话:{{ formData.linkPhone }}
  79. </span>
  80. <span> 车牌号:{{ formData.carNo }} </span>
  81. </div>
  82. <table
  83. cellspacing="0"
  84. border
  85. style="
  86. width: 100%;
  87. table-layout: fixed;
  88. word-break: break-all;
  89. word-wrap: break-word;
  90. font-size: 12px;
  91. "
  92. >
  93. <tbody>
  94. <tr align="center">
  95. <td style="padding: 5px; width: 35px"> 序号 </td>
  96. <td style="padding: 5px"> 编码 </td>
  97. <td style="padding: 5px"> 零件名 </td>
  98. <td style="padding: 5px; width: 50px"> 单位</td>
  99. <td style="padding: 5px"> 送货数量</td>
  100. <td style="padding: 5px"> 验收数量</td>
  101. <td style="padding: 5px"> 备注</td>
  102. <td style="padding: 5px"> 订单号</td>
  103. <td style="padding: 5px"> 加工工艺</td>
  104. </tr>
  105. <tr align="center" v-for="(item, index) in formData.productList">
  106. <td style="padding: 5px"> {{ index + 1 }} </td>
  107. <td style="padding: 5px">
  108. {{ item.productCode }}
  109. </td>
  110. <td style="padding: 5px"> {{ item.productName }} </td>
  111. <td style="padding: 5px"> {{ item.measuringUnit }}</td>
  112. <td style="padding: 5px"> {{ item.totalCount }}</td>
  113. <td style="padding: 5px"> {{ item.totalCount }}</td>
  114. <td style="padding: 5px"> </td>
  115. <td style="padding: 5px">{{ item.orderNo }} </td>
  116. <td style="padding: 5px"> </td>
  117. </tr>
  118. </tbody>
  119. </table>
  120. <div
  121. style="
  122. width: 100%;
  123. font-size: 12px;
  124. display: flex;
  125. justify-content: space-between;
  126. margin-top: 10px;
  127. "
  128. >
  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"> 收货人: </div>
  136. <div style="flex: 1"> 托盘:{{ formData.trayNum }} </div>
  137. </div>
  138. </div>
  139. <div slot="footer">
  140. <el-button @click="print">打印预览</el-button>
  141. <el-button @click="close">关闭</el-button>
  142. </div>
  143. </ele-modal>
  144. </template>
  145. <script>
  146. import { getSendSaleOrderrecordDetailSplit } from '@/api/saleManage/saleordersendrecord';
  147. import { getInfoBySourceBizNoAll } from '@/api/wms';
  148. import { mapGetters } from 'vuex';
  149. export default {
  150. name: 'print',
  151. computed: {
  152. ...mapGetters(['user'])
  153. },
  154. props: {
  155. groupName: ''
  156. },
  157. data() {
  158. return {
  159. checked: '',
  160. QRvisible: false,
  161. isPrintPrice: false,
  162. formData: {},
  163. outBound: {}
  164. };
  165. },
  166. methods: {
  167. async open(id) {
  168. this.formData = await getSendSaleOrderrecordDetailSplit(id);
  169. this.QRvisible = true;
  170. // let dataArray = await getInfoBySourceBizNoAll(this.formData.docNo);
  171. // this.outBound = JSON.parse(JSON.stringify(dataArray[0]));
  172. // this.outBound['outInDetailRecordRequestList'] = [];
  173. // dataArray.forEach((item) => {
  174. // item.outInDetailList.forEach((val) => {
  175. // val['orderNo'] = item.orderNo;
  176. // if (val.outInDetailRecordRequestList.length) {
  177. // val.outInDetailRecordRequestList.forEach((j) => {
  178. // j['categoryName'] = val.categoryName;
  179. // j['categoryModel'] = val.categoryModel;
  180. // j['specification'] = val.specification;
  181. // j['categoryCode'] = val.categoryCode;
  182. // j['orderNo'] = item.orderNo;
  183. // });
  184. // this.outBound['outInDetailRecordRequestList'].push(
  185. // ...val.outInDetailRecordRequestList
  186. // );
  187. // } else {
  188. // this.outBound['outInDetailRecordRequestList'].push(val);
  189. // }
  190. // });
  191. // });
  192. //包装维度
  193. },
  194. close() {
  195. this.QRvisible = false;
  196. },
  197. print() {
  198. const printSection = document.getElementById('printSection');
  199. // 创建打印任务
  200. const printWindow = window.open('', '_blank');
  201. printWindow.document.open();
  202. printWindow.document.write('<html><head><title>打印预览</title>');
  203. printWindow.document.write(
  204. '<link rel="stylesheet" href="your-stylesheet-url.css" type="text/css" />'
  205. );
  206. printWindow.document.write('</head><body>');
  207. printWindow.document.write(printSection.innerHTML);
  208. printWindow.document.write('</body></html>');
  209. printWindow.document.close();
  210. printWindow.onload = function () {
  211. printWindow.print();
  212. };
  213. }
  214. }
  215. };
  216. </script>
  217. <style lang="scss"></style>