index.vue 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199
  1. <template>
  2. <div class="tenant">
  3. <div class="content">
  4. <byTable
  5. :source="sourceList.data"
  6. :pagination="sourceList.pagination"
  7. :config="config"
  8. :loading="loading"
  9. :selectConfig="selectConfig"
  10. highlight-current-row
  11. :action-list="[
  12. {
  13. text: '导出Excel',
  14. action: () => deriveExcel(),
  15. },
  16. ]"
  17. @get-list="getList">
  18. </byTable>
  19. </div>
  20. </div>
  21. </template>
  22. <script setup>
  23. import { computed, ref } from "vue";
  24. import byTable from "@/components/byTable/index";
  25. const { proxy } = getCurrentInstance();
  26. const route = useRoute();
  27. const typeList = ref([
  28. {
  29. label: "手动入库",
  30. value: "1",
  31. },
  32. {
  33. label: "手动出库",
  34. value: "2",
  35. },
  36. {
  37. label: "调仓",
  38. value: "3",
  39. },
  40. {
  41. label: "待入库入库",
  42. value: "4",
  43. },
  44. {
  45. label: "待出库出库",
  46. value: "5",
  47. },
  48. ]);
  49. const warehouseList = ref([]);
  50. const sourceList = ref({
  51. data: [],
  52. pagination: {
  53. total: 0,
  54. pageNum: 1,
  55. pageSize: 10,
  56. keyword: "",
  57. type: "",
  58. productId: "",
  59. },
  60. });
  61. const loading = ref(false);
  62. const selectConfig = computed(() => {
  63. return [
  64. {
  65. label: "操作类型",
  66. prop: "type",
  67. data: typeList.value,
  68. },
  69. ];
  70. });
  71. const config = computed(() => {
  72. return [
  73. {
  74. attrs: {
  75. label: "操作类型",
  76. prop: "type",
  77. width: 140,
  78. },
  79. render(type) {
  80. return proxy.dictValueLabel(type, typeList.value);
  81. },
  82. },
  83. {
  84. attrs: {
  85. label: "出入库类型",
  86. prop: "type",
  87. width: 140,
  88. },
  89. render(type) {
  90. return proxy.dictValueLabel(type, typeList.value);
  91. },
  92. },
  93. {
  94. attrs: {
  95. label: "仓库名称",
  96. prop: "warehouseId",
  97. width: 220,
  98. },
  99. render(type) {
  100. return proxy.dictValueLabel(type, warehouseList.value);
  101. },
  102. },
  103. {
  104. attrs: {
  105. label: "物品编码",
  106. prop: "productCode",
  107. width: 160,
  108. },
  109. },
  110. {
  111. attrs: {
  112. label: "物品名称",
  113. slot: "productName",
  114. "min-width": 220,
  115. },
  116. },
  117. {
  118. attrs: {
  119. label: "规格型号",
  120. prop: "productModel",
  121. width: 160,
  122. },
  123. },
  124. {
  125. attrs: {
  126. label: "单位",
  127. prop: "unit",
  128. width: 120,
  129. },
  130. },
  131. {
  132. attrs: {
  133. label: "操作数量",
  134. prop: "quantity",
  135. width: 120,
  136. },
  137. },
  138. {
  139. attrs: {
  140. label: "操作人",
  141. prop: "userName",
  142. width: 120,
  143. },
  144. },
  145. {
  146. attrs: {
  147. label: "操作时间",
  148. prop: "createTime",
  149. width: 160,
  150. },
  151. },
  152. ];
  153. });
  154. const getDict = () => {
  155. proxy.post("/warehouse/page", { pageNum: 1, pageSize: 999 }).then((res) => {
  156. if (res.rows && res.rows.length > 0) {
  157. warehouseList.value = res.rows.map((item) => {
  158. return {
  159. label: item.name,
  160. value: item.id,
  161. };
  162. });
  163. }
  164. });
  165. };
  166. const getList = async (req) => {
  167. sourceList.value.pagination = { ...sourceList.value.pagination, ...req };
  168. loading.value = true;
  169. proxy.post("/stockJournalDetails/page", sourceList.value.pagination).then((res) => {
  170. sourceList.value.data = res.rows;
  171. sourceList.value.pagination.total = res.total;
  172. setTimeout(() => {
  173. loading.value = false;
  174. }, 200);
  175. });
  176. };
  177. getDict();
  178. onMounted(() => {
  179. if (route.query.productId) {
  180. sourceList.value.pagination.productId = route.query.productId;
  181. }
  182. getList();
  183. });
  184. const deriveExcel = () => {
  185. console.log("deriveExcel");
  186. };
  187. </script>
  188. <style lang="scss" scoped>
  189. .tenant {
  190. padding: 20px;
  191. }
  192. ::v-deep(.el-input-number .el-input__inner) {
  193. text-align: left;
  194. }
  195. </style>