index.vue 5.1 KB

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