index.vue 8.6 KB

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