printBOM.vue 6.7 KB

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