index.vue 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  1. <template>
  2. <div>
  3. <el-card class="box-card">
  4. <byTable
  5. :source="sourceList.data"
  6. :pagination="sourceList.pagination"
  7. :config="config"
  8. :loading="loading"
  9. :searchConfig="searchConfig"
  10. highlight-current-row
  11. :action-list="[
  12. {
  13. text: '导出Excel',
  14. action: () => deriveExcel(),
  15. },
  16. ]"
  17. @get-list="getList"
  18. @clickReset="clickReset"
  19. :cellClassName="cellClassName">
  20. <template #purchaseCode="{ item }">
  21. <div>
  22. <a style="color: #409eff; cursor: pointer; word-break: break-all" @click="clickPurchaseCode(item)">{{ item.purchaseCode }}</a>
  23. </div>
  24. </template>
  25. </byTable>
  26. </el-card>
  27. </div>
  28. </template>
  29. <script setup>
  30. import byTable from "/src/components/byTable/index";
  31. import moment from "moment";
  32. const { proxy } = getCurrentInstance();
  33. const sourceList = ref({
  34. data: [],
  35. pagination: {
  36. total: 0,
  37. pageNum: 1,
  38. pageSize: 10,
  39. purchaseCode: "",
  40. bomSpecCode: "",
  41. bomSpecName: "",
  42. },
  43. });
  44. const loading = ref(false);
  45. const searchConfig = computed(() => {
  46. return [
  47. {
  48. type: "input",
  49. prop: "purchaseCode",
  50. label: "采购单号",
  51. },
  52. {
  53. type: "input",
  54. prop: "bomSpecCode",
  55. label: "品号",
  56. },
  57. {
  58. type: "input",
  59. prop: "bomSpecName",
  60. label: "品名",
  61. },
  62. ];
  63. });
  64. const config = computed(() => {
  65. return [
  66. {
  67. attrs: {
  68. label: "品号",
  69. prop: "bomSpecCode",
  70. width: 160,
  71. },
  72. },
  73. {
  74. attrs: {
  75. label: "品名",
  76. prop: "bomSpecName",
  77. "min-width": 220,
  78. },
  79. },
  80. {
  81. attrs: {
  82. label: "采购单号",
  83. slot: "purchaseCode",
  84. width: 160,
  85. },
  86. },
  87. {
  88. attrs: {
  89. label: "供应商",
  90. prop: "supplierName",
  91. width: 220,
  92. },
  93. },
  94. {
  95. attrs: {
  96. label: "采购数量",
  97. prop: "purchaseQuantity",
  98. width: 120,
  99. },
  100. },
  101. {
  102. attrs: {
  103. label: "在途数量",
  104. prop: "inTransitQuantity",
  105. width: 120,
  106. },
  107. },
  108. {
  109. attrs: {
  110. label: "交期",
  111. prop: "deliveryDate",
  112. width: 160,
  113. align: "center",
  114. },
  115. },
  116. ];
  117. });
  118. const getList = async (req, status) => {
  119. if (status) {
  120. sourceList.value.pagination = {
  121. pageNum: sourceList.value.pagination.pageNum,
  122. pageSize: sourceList.value.pagination.pageSize,
  123. };
  124. } else {
  125. sourceList.value.pagination = { ...sourceList.value.pagination, ...req };
  126. }
  127. loading.value = true;
  128. proxy.post("/purchaseInTransitBom/page", sourceList.value.pagination).then((res) => {
  129. sourceList.value.data = res.rows;
  130. sourceList.value.pagination.total = res.total;
  131. setTimeout(() => {
  132. loading.value = false;
  133. }, 200);
  134. });
  135. };
  136. getList();
  137. const clickReset = () => {
  138. getList("", true);
  139. };
  140. const deriveExcel = () => {
  141. proxy.postFile("/purchaseInTransitBom/export", sourceList.value.pagination).then((res) => {
  142. proxy.downloadFile(res, "在途物料.xlsx");
  143. });
  144. };
  145. const cellClassName = (val) => {
  146. if (val.row.deliveryDate < moment().format("yyyy-MM-DD HH:mm:ss")) {
  147. return "colorDim";
  148. }
  149. };
  150. const clickPurchaseCode = (item) => {
  151. proxy.$router.replace({
  152. path: "/platform_manage/process/processApproval",
  153. query: {
  154. flowKey: "purchase",
  155. flowName: "采购流程",
  156. processType: "20",
  157. id: item.purchaseId,
  158. flowId: item.flowId,
  159. random: proxy.random(),
  160. },
  161. });
  162. };
  163. </script>
  164. <style lang="scss" scoped>
  165. ::v-deep(.colorDim) {
  166. color: red;
  167. }
  168. </style>