print-template-bs.vue 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224
  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. </div>
  81. <table
  82. cellspacing="0"
  83. border
  84. style="
  85. width: 100%;
  86. table-layout: fixed;
  87. word-break: break-all;
  88. word-wrap: break-word;
  89. font-size: 12px;
  90. "
  91. >
  92. <tbody>
  93. <tr align="center">
  94. <td style="padding: 5px"> 序号 </td>
  95. <td style="padding: 5px"> 型号 </td>
  96. <td style="padding: 5px"> 零件名 </td>
  97. <td style="padding: 5px"> 单位</td>
  98. <td style="padding: 5px"> 送货数量</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. </tr>
  104. <tr align="center" v-for="(item, index) in formData.productList">
  105. <td style="padding: 5px"> {{ index + 1 }} </td>
  106. <td style="padding: 5px">
  107. {{ item.modelType }}
  108. </td>
  109. <td style="padding: 5px"> {{ item.productName }} </td>
  110. <td style="padding: 5px"> {{ item.measuringUnit }}</td>
  111. <td style="padding: 5px"> {{ item.totalCount }}</td>
  112. <td style="padding: 5px"> {{ item.totalCount }}</td>
  113. <td style="padding: 5px"> </td>
  114. <td style="padding: 5px">{{ item.orderNo }} </td>
  115. <td style="padding: 5px"> </td>
  116. </tr>
  117. </tbody>
  118. </table>
  119. <div
  120. style="
  121. width: 100%;
  122. font-size: 12px;
  123. display: flex;
  124. justify-content: space-between;
  125. margin-top: 10px;
  126. "
  127. >
  128. <div style="flex: 1">
  129. <div>发货人:</div>
  130. </div>
  131. <div style="flex: 1">
  132. <div>送货人:</div>
  133. </div>
  134. <div style="flex: 1"> 收货人: </div>
  135. </div>
  136. </div>
  137. <div slot="footer">
  138. <el-button @click="print">打印预览</el-button>
  139. <el-button @click="close">关闭</el-button>
  140. </div>
  141. </ele-modal>
  142. </template>
  143. <script>
  144. import { getSendSaleOrderrecordDetailSplit } from '@/api/saleManage/saleordersendrecord';
  145. import { getInfoBySourceBizNoAll } from '@/api/wms';
  146. import { mapGetters } from 'vuex';
  147. export default {
  148. name: 'print',
  149. computed: {
  150. ...mapGetters(['user'])
  151. },
  152. props: {
  153. groupName: ''
  154. },
  155. data() {
  156. return {
  157. checked: '',
  158. QRvisible: false,
  159. isPrintPrice: false,
  160. formData: {},
  161. outBound: {}
  162. };
  163. },
  164. methods: {
  165. async open(id) {
  166. this.formData = await getSendSaleOrderrecordDetailSplit(id);
  167. this.QRvisible = true;
  168. // let dataArray = await getInfoBySourceBizNoAll(this.formData.docNo);
  169. // this.outBound = JSON.parse(JSON.stringify(dataArray[0]));
  170. // this.outBound['outInDetailRecordRequestList'] = [];
  171. // dataArray.forEach((item) => {
  172. // item.outInDetailList.forEach((val) => {
  173. // val['orderNo'] = item.orderNo;
  174. // if (val.outInDetailRecordRequestList.length) {
  175. // val.outInDetailRecordRequestList.forEach((j) => {
  176. // j['categoryName'] = val.categoryName;
  177. // j['categoryModel'] = val.categoryModel;
  178. // j['specification'] = val.specification;
  179. // j['categoryCode'] = val.categoryCode;
  180. // j['orderNo'] = item.orderNo;
  181. // });
  182. // this.outBound['outInDetailRecordRequestList'].push(
  183. // ...val.outInDetailRecordRequestList
  184. // );
  185. // } else {
  186. // this.outBound['outInDetailRecordRequestList'].push(val);
  187. // }
  188. // });
  189. // });
  190. //包装维度
  191. },
  192. close() {
  193. this.QRvisible = false;
  194. },
  195. print() {
  196. const printSection = document.getElementById('printSection');
  197. // 创建打印任务
  198. const printWindow = window.open('', '_blank');
  199. printWindow.document.open();
  200. printWindow.document.write('<html><head><title>打印预览</title>');
  201. printWindow.document.write(
  202. '<link rel="stylesheet" href="your-stylesheet-url.css" type="text/css" />'
  203. );
  204. printWindow.document.write('</head><body>');
  205. printWindow.document.write(printSection.innerHTML);
  206. printWindow.document.write('</body></html>');
  207. printWindow.document.close();
  208. printWindow.onload = function () {
  209. printWindow.print();
  210. };
  211. }
  212. }
  213. };
  214. </script>
  215. <style lang="scss"></style>