index.vue 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264
  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. >
  19. <template #warehouseName="{ item }">
  20. <div>
  21. <span v-if="item.opType == 1">{{ item.toWarehouseName }}</span>
  22. <span v-else>{{ item.warehouseName }}</span>
  23. </div>
  24. </template>
  25. </byTable>
  26. </div>
  27. </div>
  28. </template>
  29. <script setup>
  30. import { computed, ref } from "vue";
  31. import byTable from "@/components/byTable/index";
  32. const { proxy } = getCurrentInstance();
  33. const route = useRoute();
  34. const opTypeList = ref([
  35. {
  36. label: "入库",
  37. value: "1",
  38. },
  39. {
  40. label: "出库",
  41. value: "2",
  42. },
  43. ]);
  44. const typeList = ref([
  45. {
  46. label: "手动入库",
  47. value: "1",
  48. },
  49. {
  50. label: "手动出库",
  51. value: "2",
  52. },
  53. {
  54. label: "调仓入库",
  55. value: "3",
  56. },
  57. {
  58. label: "待入库入库",
  59. value: "4",
  60. },
  61. {
  62. label: "待出库出库",
  63. value: "5",
  64. },
  65. {
  66. label: "组合入库",
  67. value: "6",
  68. },
  69. {
  70. label: "组合出库",
  71. value: "7",
  72. },
  73. {
  74. label: "组合拆分入库",
  75. value: "8",
  76. },
  77. {
  78. label: "组合拆分出库",
  79. value: "9",
  80. },
  81. {
  82. label: "京东销售出库",
  83. value: "10",
  84. },
  85. {
  86. label: "调仓出库",
  87. value: "11",
  88. },
  89. {
  90. label: "销售订单出库",
  91. value: "12",
  92. },
  93. {
  94. label: "退货出库",
  95. value: "13",
  96. },
  97. {
  98. label: "到货入库",
  99. value: "14",
  100. },
  101. {
  102. label: "京东退货入库",
  103. value: "15",
  104. },
  105. {
  106. label: "生产任务出库",
  107. value: "20",
  108. },
  109. ]);
  110. const warehouseList = ref([]);
  111. const sourceList = ref({
  112. data: [],
  113. pagination: {
  114. total: 0,
  115. pageNum: 1,
  116. pageSize: 10,
  117. keyword: "",
  118. opType: "",
  119. productId: "",
  120. },
  121. });
  122. const loading = ref(false);
  123. const selectConfig = computed(() => {
  124. return [
  125. {
  126. label: "操作类型",
  127. prop: "opType",
  128. data: opTypeList.value,
  129. },
  130. {
  131. label: "出入库类型",
  132. prop: "type",
  133. data: typeList.value,
  134. },
  135. ];
  136. });
  137. const config = computed(() => {
  138. return [
  139. {
  140. attrs: {
  141. label: "操作类型",
  142. prop: "opType",
  143. width: 140,
  144. },
  145. render(type) {
  146. return proxy.dictValueLabel(type, opTypeList.value);
  147. },
  148. },
  149. {
  150. attrs: {
  151. label: "出入库类型",
  152. prop: "type",
  153. width: 140,
  154. },
  155. render(type) {
  156. return proxy.dictValueLabel(type, typeList.value);
  157. },
  158. },
  159. {
  160. attrs: {
  161. label: "仓库名称",
  162. slot: "warehouseName",
  163. width: 200,
  164. },
  165. },
  166. {
  167. attrs: {
  168. label: "物品编码",
  169. prop: "productCode",
  170. width: 160,
  171. },
  172. },
  173. {
  174. attrs: {
  175. label: "物品名称",
  176. prop: "productName",
  177. "min-width": 220,
  178. },
  179. },
  180. {
  181. attrs: {
  182. label: "规格型号",
  183. prop: "productSpec",
  184. width: 160,
  185. },
  186. },
  187. {
  188. attrs: {
  189. label: "单位",
  190. prop: "productUnit",
  191. width: 120,
  192. },
  193. },
  194. {
  195. attrs: {
  196. label: "操作数量",
  197. prop: "quantity",
  198. width: 120,
  199. },
  200. },
  201. {
  202. attrs: {
  203. label: "操作人",
  204. prop: "opUserName",
  205. width: 120,
  206. },
  207. },
  208. {
  209. attrs: {
  210. label: "操作时间",
  211. prop: "createTime",
  212. width: 160,
  213. },
  214. },
  215. ];
  216. });
  217. const getDict = () => {
  218. proxy.post("/warehouse/page", { pageNum: 1, pageSize: 999 }).then((res) => {
  219. if (res.rows && res.rows.length > 0) {
  220. warehouseList.value = res.rows.map((item) => {
  221. return {
  222. label: item.name,
  223. value: item.id,
  224. };
  225. });
  226. }
  227. });
  228. };
  229. const getList = async (req) => {
  230. sourceList.value.pagination = { ...sourceList.value.pagination, ...req };
  231. loading.value = true;
  232. proxy
  233. .post("/stockJournalDetails/page", sourceList.value.pagination)
  234. .then((res) => {
  235. sourceList.value.data = res.rows;
  236. sourceList.value.pagination.total = res.total;
  237. setTimeout(() => {
  238. loading.value = false;
  239. }, 200);
  240. });
  241. };
  242. getDict();
  243. onMounted(() => {
  244. if (route.query.productId) {
  245. sourceList.value.pagination.productId = route.query.productId;
  246. }
  247. getList();
  248. });
  249. const deriveExcel = () => {
  250. console.log("deriveExcel");
  251. };
  252. </script>
  253. <style lang="scss" scoped>
  254. .tenant {
  255. padding: 20px;
  256. }
  257. ::v-deep(.el-input-number .el-input__inner) {
  258. text-align: left;
  259. }
  260. </style>