index.vue 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360
  1. <template>
  2. <div>
  3. <el-card class="box-card">
  4. <el-tabs v-model="activeName" type="card" @tab-change="changeActiveName">
  5. <el-tab-pane label="入库单" name="first">
  6. <byTable
  7. :source="sourceList.data"
  8. :pagination="sourceList.pagination"
  9. :config="config"
  10. :loading="loading"
  11. :searchConfig="searchConfig"
  12. highlight-current-row
  13. @get-list="getList"
  14. @clickReset="clickReset">
  15. <template #code="{ item }">
  16. <div>
  17. <a style="color: #409eff; cursor: pointer; word-break: break-all" @click="clickCode(item)">{{ item.code }}</a>
  18. </div>
  19. </template>
  20. </byTable>
  21. </el-tab-pane>
  22. <el-tab-pane label="入库明细" name="second">
  23. <byTable
  24. :source="sourceListTwo.data"
  25. :pagination="sourceListTwo.pagination"
  26. :config="configTwo"
  27. :loading="loading"
  28. :searchConfig="searchConfigTwo"
  29. highlight-current-row
  30. @get-list="getListTwo"
  31. @clickReset="clickResetTwo">
  32. </byTable>
  33. </el-tab-pane>
  34. </el-tabs>
  35. </el-card>
  36. </div>
  37. </template>
  38. <script setup>
  39. import byTable from "/src/components/byTable/index";
  40. const { proxy } = getCurrentInstance();
  41. const activeName = ref("first");
  42. const sourceList = ref({
  43. data: [],
  44. pagination: {
  45. total: 0,
  46. pageNum: 1,
  47. pageSize: 10,
  48. type: "1",
  49. code: "",
  50. departmentId: proxy.useUserStore().user.deptId === "100" ? "" : proxy.useUserStore().user.deptId,
  51. warehouseName: "",
  52. detailType: "",
  53. beginTime: "",
  54. endTime: "",
  55. },
  56. });
  57. const sourceListTwo = ref({
  58. data: [],
  59. pagination: {
  60. total: 0,
  61. pageNum: 1,
  62. pageSize: 10,
  63. type: "1",
  64. code: "",
  65. purchaseCode: "",
  66. bomSpecCode: "",
  67. bomSpecName: "",
  68. departmentId: proxy.useUserStore().user.deptId === "100" ? "" : proxy.useUserStore().user.deptId,
  69. warehouseName: "",
  70. detailType: "",
  71. beginTime: "",
  72. endTime: "",
  73. },
  74. });
  75. const loading = ref(false);
  76. const searchConfig = computed(() => {
  77. return [
  78. {
  79. type: "input",
  80. prop: "code",
  81. label: "入库单号",
  82. },
  83. {
  84. type: "input",
  85. prop: "warehouseName",
  86. label: "仓库名称",
  87. },
  88. {
  89. type: "select",
  90. prop: "detailType",
  91. dictKey: "put_stock_type",
  92. label: "入库类型",
  93. },
  94. {
  95. type: "date",
  96. propList: ["beginTime", "endTime"],
  97. label: "日期",
  98. },
  99. ];
  100. });
  101. const searchConfigTwo = computed(() => {
  102. return [
  103. {
  104. type: "input",
  105. prop: "purchaseCode",
  106. label: "采购",
  107. },
  108. {
  109. type: "input",
  110. prop: "code",
  111. label: "入库单号",
  112. },
  113. {
  114. type: "input",
  115. prop: "bomSpecCode",
  116. label: "品号",
  117. },
  118. {
  119. type: "input",
  120. prop: "bomSpecName",
  121. label: "品名",
  122. },
  123. {
  124. type: "input",
  125. prop: "warehouseName",
  126. label: "仓库名称",
  127. },
  128. {
  129. type: "select",
  130. prop: "detailType",
  131. dictKey: "put_stock_type",
  132. label: "入库类型",
  133. },
  134. {
  135. type: "date",
  136. propList: ["beginTime", "endTime"],
  137. label: "日期",
  138. },
  139. ];
  140. });
  141. const config = computed(() => {
  142. return [
  143. {
  144. attrs: {
  145. label: "入库单号",
  146. slot: "code",
  147. "min-width": 160,
  148. },
  149. },
  150. {
  151. attrs: {
  152. label: "采购单号",
  153. prop: "purchaseCode",
  154. "min-width": 160,
  155. },
  156. },
  157. {
  158. attrs: {
  159. label: "归属事业部",
  160. prop: "departmentName",
  161. "min-width": 160,
  162. },
  163. },
  164. {
  165. attrs: {
  166. label: "仓库类型",
  167. prop: "warehouseType",
  168. width: 140,
  169. },
  170. render(val) {
  171. return proxy.dictKeyValue(val, proxy.useUserStore().allDict["warehouse_type"]);
  172. },
  173. },
  174. {
  175. attrs: {
  176. label: "仓库名称",
  177. prop: "warehouseName",
  178. "min-width": 160,
  179. },
  180. },
  181. {
  182. attrs: {
  183. label: "入库类型",
  184. prop: "detailType",
  185. width: 140,
  186. },
  187. render(val) {
  188. return proxy.dictKeyValue(val, proxy.useUserStore().allDict["put_stock_type"]);
  189. },
  190. },
  191. {
  192. attrs: {
  193. label: "入库时间",
  194. prop: "createTime",
  195. width: 160,
  196. align: "center",
  197. },
  198. },
  199. {
  200. attrs: {
  201. label: "入库申请人",
  202. prop: "applicant",
  203. width: 160,
  204. align: "center",
  205. },
  206. },
  207. ];
  208. });
  209. const configTwo = computed(() => {
  210. return [
  211. {
  212. attrs: {
  213. label: "入库单号",
  214. prop: "code",
  215. width: 160,
  216. },
  217. },
  218. {
  219. attrs: {
  220. label: "采购单号",
  221. prop: "purchaseCode",
  222. width: 160,
  223. },
  224. },
  225. {
  226. attrs: {
  227. label: "归属事业部",
  228. prop: "departmentName",
  229. width: 160,
  230. },
  231. },
  232. {
  233. attrs: {
  234. label: "仓库类型",
  235. prop: "warehouseType",
  236. width: 140,
  237. },
  238. render(val) {
  239. return proxy.dictKeyValue(val, proxy.useUserStore().allDict["warehouse_type"]);
  240. },
  241. },
  242. {
  243. attrs: {
  244. label: "仓库名称",
  245. prop: "warehouseName",
  246. width: 160,
  247. },
  248. },
  249. {
  250. attrs: {
  251. label: "入库类型",
  252. prop: "detailType",
  253. width: 140,
  254. },
  255. render(val) {
  256. return proxy.dictKeyValue(val, proxy.useUserStore().allDict["put_stock_type"]);
  257. },
  258. },
  259. {
  260. attrs: {
  261. label: "品号",
  262. prop: "bomSpecCode",
  263. width: 160,
  264. },
  265. },
  266. {
  267. attrs: {
  268. label: "品品名",
  269. prop: "bomSpecName",
  270. "min-width": 240,
  271. },
  272. },
  273. {
  274. attrs: {
  275. label: "数量",
  276. prop: "quantity",
  277. width: 120,
  278. },
  279. },
  280. {
  281. attrs: {
  282. label: "入库时间",
  283. prop: "createTime",
  284. width: 160,
  285. align: "center",
  286. },
  287. },
  288. {
  289. attrs: {
  290. label: "入库申请人",
  291. prop: "applicant",
  292. width: 160,
  293. align: "center",
  294. },
  295. },
  296. ];
  297. });
  298. const getList = async (req, status) => {
  299. if (status) {
  300. sourceList.value.pagination = {
  301. pageNum: sourceList.value.pagination.pageNum,
  302. pageSize: sourceList.value.pagination.pageSize,
  303. };
  304. } else {
  305. sourceList.value.pagination = { ...sourceList.value.pagination, ...req };
  306. }
  307. loading.value = true;
  308. proxy.post("/inOutStorage/page", sourceList.value.pagination).then((res) => {
  309. sourceList.value.data = res.rows;
  310. sourceList.value.pagination.total = res.total;
  311. setTimeout(() => {
  312. loading.value = false;
  313. }, 200);
  314. });
  315. };
  316. getList();
  317. const clickReset = () => {
  318. getList("", true);
  319. };
  320. const getListTwo = async (req, status) => {
  321. if (status) {
  322. sourceListTwo.value.pagination = {
  323. pageNum: sourceListTwo.value.pagination.pageNum,
  324. pageSize: sourceListTwo.value.pagination.pageSize,
  325. };
  326. } else {
  327. sourceListTwo.value.pagination = { ...sourceListTwo.value.pagination, ...req };
  328. }
  329. loading.value = true;
  330. proxy.post("/inOutStorageBom/page", sourceListTwo.value.pagination).then((res) => {
  331. sourceListTwo.value.data = res.rows;
  332. sourceListTwo.value.pagination.total = res.total;
  333. setTimeout(() => {
  334. loading.value = false;
  335. }, 200);
  336. });
  337. };
  338. const clickResetTwo = () => {
  339. getListTwo("", true);
  340. };
  341. const changeActiveName = (val) => {
  342. if (val === "first") {
  343. getList();
  344. } else {
  345. getListTwo();
  346. }
  347. };
  348. const clickCode = (row) => {
  349. sourceListTwo.value.pagination.code = row.code;
  350. activeName.value = "second";
  351. };
  352. </script>
  353. <style lang="scss" scoped>
  354. ::v-deep(.el-input-number .el-input__inner) {
  355. text-align: left;
  356. }
  357. </style>