index.vue 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. <template>
  2. <van-nav-bar title="待入库" left-text="" left-arrow @click-left="onClickLeft">
  3. <!-- <template #right> 添加 </template> -->
  4. </van-nav-bar>
  5. <van-search
  6. v-model="req.keyword"
  7. placeholder="请输入搜索关键词"
  8. @search="onRefresh"
  9. />
  10. <van-pull-refresh v-model="loading" @refresh="onRefresh">
  11. <div class="list">
  12. <van-list
  13. v-model:loading="loading"
  14. :finished="finished"
  15. finished-text="没有更多了"
  16. @load="onLoad"
  17. style="margin-bottom: 60px"
  18. >
  19. <commonList
  20. :data="listData"
  21. @onClick="toDtl"
  22. :config="listConfig"
  23. ></commonList>
  24. <div></div>
  25. </van-list>
  26. </div>
  27. </van-pull-refresh>
  28. </template>
  29. <script setup>
  30. import { ref, getCurrentInstance, onMounted } from "vue";
  31. import commonList from "@/components/common-list.vue";
  32. import { useRoute } from "vue-router";
  33. const loading = ref(false);
  34. const router = useRoute();
  35. const req = ref({
  36. pageNum: 1,
  37. type: "1",
  38. keyword: null,
  39. });
  40. const finished = ref(false);
  41. const proxy = getCurrentInstance().proxy;
  42. const listData = ref([]);
  43. const listConfig = ref([
  44. {
  45. label: "数据来源",
  46. prop: "businessType",
  47. },
  48. {
  49. label: "物品名称",
  50. prop: "productName",
  51. },
  52. {
  53. label: "待办数量",
  54. prop: "quantity",
  55. },
  56. ]);
  57. const onRefresh = () => {
  58. req.value.pageNum = 1;
  59. finished.value = false;
  60. getList("refresh");
  61. };
  62. const onLoad = () => {
  63. getList();
  64. };
  65. const onClickLeft = () => proxy.$router.push("/main/working");
  66. const onClickRight = () => {
  67. proxy.$router.push("/main/manualInboundAdd");
  68. };
  69. const toDtl = (row) => {
  70. proxy.$router.push({
  71. path: "waitInboundAdd",
  72. query: {
  73. id: row.id,
  74. },
  75. });
  76. };
  77. const getList = (type) => {
  78. loading.value = true;
  79. proxy
  80. .post("/stockWait/page", req.value)
  81. .then((res) => {
  82. console.log(req.value);
  83. listData.value =
  84. type === "refresh"
  85. ? res.data.rows
  86. : listData.value.concat(res.data.rows);
  87. if (req.value.pageNum * 10 >= res.data.total) {
  88. finished.value = true;
  89. }
  90. req.value.pageNum++;
  91. loading.value = false;
  92. })
  93. .catch((err) => {
  94. loading.value = false;
  95. });
  96. };
  97. getList();
  98. </script>
  99. <style lang="scss" scoped>
  100. .list {
  101. min-height: 70vh;
  102. }
  103. </style>