print-template-bs-car.vue 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239
  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. display: flex;
  22. flex-direction: column;
  23. align-items: center;
  24. margin-bottom: 20px;
  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: 18px;
  36. font-weight: 800;
  37. text-align: center;
  38. width: 100%;
  39. "
  40. >{{ groupName || '长沙宝盛汽车配件有限公司' }}送货单</div
  41. >
  42. </div>
  43. <div
  44. style="
  45. width: 100%;
  46. display: flex;
  47. justify-content: space-between;
  48. margin-bottom: 10px;
  49. "
  50. >
  51. <span style="width: 40%">客户名称:</span>
  52. <span style="width: 40%"
  53. >发货单号:{{ infoData.allotCode }}</span
  54. >
  55. </div>
  56. <div
  57. style="
  58. width: 100%;
  59. display: flex;
  60. justify-content: space-between;
  61. margin-bottom: 10px;
  62. "
  63. >
  64. <span style="width: 40%">发货日期:{{ infoData.createTime }}</span>
  65. <span style="width: 40%"
  66. >收货联系人:
  67. </span>
  68. </div>
  69. <table
  70. cellspacing="0"
  71. border
  72. style="
  73. width: 100%;
  74. table-layout: fixed;
  75. word-break: break-all;
  76. word-wrap: break-word;
  77. font-size: 12px;
  78. "
  79. >
  80. <tbody>
  81. <tr align="center">
  82. <td style="padding: 5px; width: 35px"> 序号 </td>
  83. <td style="padding: 5px; width: 10%;"> 车型 </td>
  84. <td style="padding: 5px; width: 12%;"> 料号 </td>
  85. <td style="padding: 5px; width: 20%;"> 零件名 </td>
  86. <td style="padding: 5px; width: 8%;"> 单位</td>
  87. <td style="padding: 5px; width: 8%;"> 交货数</td>
  88. <td style="padding: 5px; width: 8%;"> 实收数量</td>
  89. <td style="padding: 5px; width: 15%"> 客户订单号</td>
  90. <td style="padding: 5px; width: 8%;"> 重量</td>
  91. <td style="padding: 5px; width: 10%;"> 工艺</td>
  92. <td style="padding: 5px; width: 10%;"> 备注</td>
  93. </tr>
  94. <tr align="center" v-for="(item, index) in detailList">
  95. <td style="padding: 5px"> {{ index + 1 }} </td>
  96. <td style="padding: 5px"> </td>
  97. <td style="padding: 5px"> {{ item.categoryCode }} </td>
  98. <td style="padding: 5px">
  99. {{ item.categoryName }}
  100. </td>
  101. <td style="padding: 5px"> {{ item.measureUnit }} </td>
  102. <td style="padding: 5px"> {{ item.quantity }}</td>
  103. <td style="padding: 5px"> {{ item.quantity }}</td>
  104. <td style="padding: 5px"> {{ item.saleOrderNo }}</td>
  105. <td style="padding: 5px"> {{ item.weight }}</td>
  106. <td style="padding: 5px">{{ item.produceRoutingName }} </td>
  107. <td style="padding: 5px"> {{ item.remark }} </td>
  108. </tr>
  109. <tr style="height: 40px;">
  110. <td style="border: 1px solid #000; padding: 8px; text-align: center;"></td>
  111. <td colspan="2" style="border: 1px solid #000; padding: 8px; text-align: center;">合计</td>
  112. <!-- <td style="border: 1px solid #000; padding: 8px; text-align: center;"></td> -->
  113. <td style="border: 1px solid #000; padding: 8px; text-align: center;"></td>
  114. <td style="border: 1px solid #000; padding: 8px; text-align: center;"></td>
  115. <td style="border: 1px solid #000; padding: 8px; text-align: center;">{{ detailList.reduce((total, item) => total + Number(item.quantity || 0), 0) || ''}}</td>
  116. <td style="border: 1px solid #000; padding: 8px; text-align: center;">{{ detailList.reduce((total, item) => total + Number(item.quantity || 0), 0) || ''}}</td>
  117. <td style="border: 1px solid #000; padding: 8px; text-align: center;" colspan="4">
  118. <div style="display: flex; align-items: center;">
  119. <div style="flex: 1;">铁框:</div>
  120. <div style="flex: 1;">托盘:</div>
  121. <div style="flex: 1;">工装:</div>
  122. <div style="flex: 1;">胶框:</div>
  123. </div>
  124. </td>
  125. </tr>
  126. </tbody>
  127. </table>
  128. <div
  129. style="
  130. width: 100%;
  131. display: flex;
  132. justify-content: space-between;
  133. margin-top: 10px;
  134. "
  135. >
  136. <div style="flex: 1">
  137. <div>发货人:{{ infoData.allotName }}</div>
  138. </div>
  139. <div style="flex: 1">
  140. <div>承运人:</div>
  141. </div>
  142. <div style="flex: 1"> 收货人: </div>
  143. <!-- <div style="flex: 1"> 托盘:{{ infoData.trayNum }} </div> -->
  144. </div>
  145. </div>
  146. <div slot="footer">
  147. <el-button @click="print">打印预览</el-button>
  148. <el-button @click="close">关闭</el-button>
  149. </div>
  150. </ele-modal>
  151. </template>
  152. <script>
  153. import storageApi from '@/api/warehouseManagement/index.js';
  154. import { mapGetters } from 'vuex';
  155. export default {
  156. name: 'print',
  157. computed: {
  158. ...mapGetters(['user'])
  159. },
  160. props: {
  161. groupName: {
  162. type: String,
  163. default: ''
  164. }
  165. },
  166. data() {
  167. return {
  168. checked: '',
  169. QRvisible: false,
  170. isPrintPrice: false,
  171. infoData: {},
  172. outBound: {},
  173. detailList: []
  174. };
  175. },
  176. methods: {
  177. async open(row) {
  178. this.row = row;
  179. this.getData();
  180. this.QRvisible = true;
  181. },
  182. async getData() {
  183. const res = await storageApi.getAllotDetailList({
  184. applyId: this.row.id
  185. });
  186. const data = await storageApi.getAllotDetail(this.row.id);
  187. this.infoData = data;
  188. if (this.infoData.type == 1) {
  189. // 库内调拨
  190. /* this.infoData.auditStatus = 2; */
  191. this.infoData.auditStatus = data.status;
  192. } else {
  193. // 库外调拨
  194. this.infoData.auditStatus = data.status;
  195. }
  196. this.detailList = res.map((item) => {
  197. return {
  198. ...item,
  199. // categoryCode: this.infoData.categoryCode,
  200. // categoryName: this.infoData.categoryName,
  201. // brandNum: this.infoData.brandNum,
  202. // categoryModel: this.infoData.model,
  203. // specification: this.infoData.specification
  204. };
  205. });
  206. console.log('infoData', this.infoData)
  207. console.log('detailList', this.detailList)
  208. },
  209. close() {
  210. this.QRvisible = false;
  211. },
  212. print() {
  213. const printSection = document.getElementById('printSection');
  214. // 创建打印任务
  215. const printWindow = window.open('', '_blank');
  216. printWindow.document.open();
  217. printWindow.document.write('<html><head><title>打印预览</title>');
  218. printWindow.document.write(
  219. '<link rel="stylesheet" href="your-stylesheet-url.css" type="text/css" />'
  220. );
  221. printWindow.document.write('</head><body>');
  222. printWindow.document.write(printSection.innerHTML);
  223. printWindow.document.write('</body></html>');
  224. printWindow.document.close();
  225. printWindow.onload = function () {
  226. printWindow.print();
  227. };
  228. }
  229. }
  230. };
  231. </script>
  232. <style lang="scss"></style>