printBOM.vue 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198
  1. <template>
  2. <el-card v-loading="loading">
  3. <div style="height: calc(100vh - 264px); overflow-y: auto; overflow-x: hidden">
  4. <el-table :data="tableData" border :row-style="{ height: '35px' }" header-row-class-name="tableHeader" show-summary :summary-method="getSummaries">
  5. <el-table-column align="center">
  6. <template #header>
  7. <div style="text-align: center; font-size: 30px; padding: 8px">{{ props.rowData.departmentName }}-胜德体育对账单</div>
  8. <div style="text-align: center; font-size: 18px; padding-bottom: 8px">( 对账时间: {{ rowData.timePeriod }} - {{ rowData.timePeriod }} )</div>
  9. </template>
  10. <el-table-column label="E10品号" prop="bomSpecCode" width="140" />
  11. <el-table-column label="SKU品名" prop="bomSpecName" min-width="220" />
  12. <el-table-column label="数量(PCS)" align="center" prop="quantity" width="130" />
  13. <el-table-column label="BOM单价" align="center" prop="unitPrice" width="110" />
  14. <el-table-column label="激光LOGO汇总" align="center" prop="laserLogoSummary" width="130" />
  15. <el-table-column label="激光体位线汇总" align="center" prop="laserMitochondrialSummary" width="130" />
  16. <el-table-column label="代发费汇总" align="center" prop="lssueFeeSummary" width="110" />
  17. <el-table-column label="快递包材费汇总" align="center" prop="deliveryMaterialsFeeSummary" width="130" />
  18. <el-table-column label="包装人工费汇总" align="center" prop="packingLaborSummary" width="130" />
  19. <el-table-column label="管理费汇总" align="center" prop="managementFeeSummary" width="130" />
  20. <el-table-column label="小计" align="center" width="120">
  21. <template #default="{ row }">
  22. {{ moneyFormat(row.subtotal) }}
  23. </template>
  24. </el-table-column>
  25. <el-table-column label="合计" align="center" width="120">
  26. <template #default="{ row }">
  27. {{ moneyFormat(row.total) }}
  28. </template>
  29. </el-table-column>
  30. </el-table-column>
  31. </el-table>
  32. </div>
  33. <div style="padding: 8px; text-align: center">
  34. <el-button @click="clickCancel" size="large">关 闭</el-button>
  35. <el-button type="primary" @click="deriveExcel()" size="large" v-preReClick>导 出</el-button>
  36. </div>
  37. </el-card>
  38. </template>
  39. <script setup>
  40. const { proxy } = getCurrentInstance();
  41. const props = defineProps({
  42. rowData: Object,
  43. });
  44. const loading = ref(false);
  45. const tableData = ref([]);
  46. onMounted(() => {
  47. if (props.rowData && props.rowData.id) {
  48. loading.value = true;
  49. proxy.post("/statementOfAccount/getDocumentByBom", { id: props.rowData.id }).then(
  50. (res) => {
  51. tableData.value = Object.freeze(res);
  52. loading.value = false;
  53. },
  54. (err) => {
  55. console.log(err);
  56. loading.value = false;
  57. }
  58. );
  59. }
  60. });
  61. const labelList = ref({
  62. 2: "quantity",
  63. 4: "laserLogoSummary",
  64. 5: "laserMitochondrialSummary",
  65. 6: "lssueFeeSummary",
  66. 7: "deliveryMaterialsFeeSummary",
  67. 8: "packingLaborSummary",
  68. 9: "managementFeeSummary",
  69. 10: "subtotal",
  70. 11: "total",
  71. });
  72. const textList = ref({
  73. 1: "胜德体育总经理:",
  74. 2: "申请日期:",
  75. });
  76. const getSummaries = ({ columns, data }) => {
  77. const sums = [];
  78. columns.forEach((column, index) => {
  79. if (index === 0) {
  80. sums[index] = h("div", { class: "" }, [
  81. h("div", {
  82. style: { "text-align": "center", "border-style": "solid", "border-width": "0 1px 1px 0", "border-color": "#ebeef5", padding: "0 12px" },
  83. innerHTML: "总计:",
  84. }),
  85. h("div", {
  86. style: { "text-align": "center", "border-style": "solid", "border-width": "0 1px 1px 0", "border-color": "#ebeef5", padding: "0 12px" },
  87. innerHTML: "备注:",
  88. }),
  89. h("div", {
  90. style: { "text-align": "center", "border-style": "solid", "border-width": "0 1px 1px 0", "border-color": "#ebeef5", padding: "0 12px" },
  91. innerHTML: "交货地点:",
  92. }),
  93. h("div", { style: { "font-size": "16px", "font-weight": 700, padding: "0 12px" }, innerHTML: "申请人:" }),
  94. ]);
  95. return;
  96. } else {
  97. sums[index] = h("div", { class: "" }, [
  98. [1, 3].includes(index)
  99. ? h("div", {
  100. style: {
  101. "text-align": "center",
  102. "border-style": "solid",
  103. "border-width": "0 1px 1px 0",
  104. "border-color": "#ebeef5",
  105. color: "#ebeef5",
  106. padding: "0 12px",
  107. height: "35px",
  108. },
  109. innerHTML: ".",
  110. })
  111. : h("div", {
  112. style: {
  113. "text-align": "center",
  114. "border-style": "solid",
  115. "border-width": "0 1px 1px 0",
  116. "border-color": "#ebeef5",
  117. padding: "0 12px",
  118. height: "35px",
  119. },
  120. innerHTML: getTotal(labelList.value[index]),
  121. }),
  122. h("div", {
  123. style: {
  124. "text-align": "center",
  125. "border-style": "solid",
  126. "border-width": "0 0 1px 0",
  127. "border-color": "#ebeef5",
  128. color: "#ebeef5",
  129. padding: "0 12px",
  130. height: "35px",
  131. },
  132. innerHTML: ".",
  133. }),
  134. h("div", {
  135. style: {
  136. "text-align": "center",
  137. "border-style": "solid",
  138. "border-width": "0 0 1px 0",
  139. "border-color": "#ebeef5",
  140. color: "#ebeef5",
  141. padding: "0 12px",
  142. height: "35px",
  143. },
  144. innerHTML: ".",
  145. }),
  146. [1, 2].includes(index)
  147. ? h("div", { style: { "font-size": "16px", "font-weight": 700, padding: "0 12px", "text-align": "left" }, innerHTML: textList.value[index] })
  148. : h("div", {
  149. style: {
  150. "text-align": "center",
  151. "border-style": "solid",
  152. "border-width": "0 0 1px 0",
  153. "border-color": "#ebeef5",
  154. color: "#ebeef5",
  155. padding: "0 12px",
  156. height: "35px",
  157. },
  158. innerHTML: ".",
  159. }),
  160. ]);
  161. return;
  162. }
  163. });
  164. return sums;
  165. };
  166. const getTotal = (label) => {
  167. let list = tableData.value.map((item) => item[label]);
  168. return Number(Math.round(list.reduce((acc, curr) => acc + curr, 0) * 100) / 100);
  169. };
  170. const emit = defineEmits(["clickCancel"]);
  171. const clickCancel = () => {
  172. emit("clickCancel", "");
  173. };
  174. const deriveExcel = () => {
  175. proxy.getFile("/statementOfAccount/exportDocumentByBom", { id: props.rowData.id }).then((res) => {
  176. proxy.downloadFile(res, "BOM对账单.xlsx");
  177. });
  178. };
  179. </script>
  180. <style lang="scss" scoped>
  181. ::v-deep(.el-table thead.is-group th.el-table__cell) {
  182. background-color: white !important;
  183. }
  184. ::v-deep(.el-table__footer-wrapper tbody td.el-table__cell) {
  185. background-color: white !important;
  186. }
  187. ::v-deep(.el-table .el-table__cell) {
  188. padding: 0;
  189. }
  190. ::v-deep(.el-table__footer .cell) {
  191. padding: 0;
  192. }
  193. ::v-deep(.el-table__footer .el-table__cell) {
  194. border-right: 0px;
  195. }
  196. </style>