index.vue 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. <template>
  2. <div style="padding-bottom: 60px">
  3. <van-nav-bar
  4. :title="$t('receive.name')"
  5. left-text=""
  6. left-arrow
  7. @click-left="onClickLeft"
  8. >
  9. <!-- <template #right> 添加 </template> -->
  10. </van-nav-bar>
  11. <van-search
  12. v-model="req.keyword"
  13. :placeholder="$t('common.pleaseEnterKeywords')"
  14. @search="onRefresh"
  15. />
  16. <van-pull-refresh v-model="loading" @refresh="onRefresh">
  17. <div class="list">
  18. <van-list
  19. v-model:loading="loading"
  20. :finished="finished"
  21. :finished-text="$t('common.noMore')"
  22. @load="onLoad"
  23. style="margin-bottom: 60px"
  24. >
  25. <commonList
  26. :data="listData"
  27. :config="listConfig"
  28. :showMore="true"
  29. @onClick="toDtl"
  30. ></commonList>
  31. </van-list>
  32. </div>
  33. </van-pull-refresh>
  34. </div>
  35. </template>
  36. <script setup>
  37. import { ref, getCurrentInstance, onMounted } from "vue";
  38. import commonList from "@/components/common-list.vue";
  39. import { useRoute } from "vue-router";
  40. const loading = ref(false);
  41. const router = useRoute();
  42. const req = ref({
  43. pageNum: 1,
  44. keyword: null,
  45. });
  46. const finished = ref(false);
  47. const proxy = getCurrentInstance().proxy;
  48. const listData = ref([]);
  49. const listConfig = ref([
  50. {
  51. label: proxy.t("receive.productName"),
  52. prop: "productName",
  53. },
  54. {
  55. label: proxy.t("receive.productSN"),
  56. prop: "productSn",
  57. },
  58. {
  59. label: "当前工序",
  60. prop: "productionProcessesName",
  61. },
  62. {
  63. label: proxy.t("receive.previousProcess"),
  64. prop: "previousProcessesName",
  65. },
  66. ]);
  67. const onRefresh = () => {
  68. req.value.pageNum = 1;
  69. finished.value = false;
  70. getList("refresh");
  71. };
  72. const onLoad = () => {
  73. getList();
  74. };
  75. const onClickLeft = () => proxy.$router.push("/main/working");
  76. // const onClickRight = () => {
  77. // proxy.$router.push("/main/jxskTaskAdd");
  78. // };
  79. const toDtl = (row) => {
  80. proxy.$router.push({
  81. path: "jxskReceiveAdd",
  82. query: {
  83. ...row,
  84. },
  85. });
  86. };
  87. const getList = (type) => {
  88. loading.value = true;
  89. proxy
  90. .post("/productionTaskDetail/receivePage", req.value)
  91. .then((res) => {
  92. listData.value =
  93. type === "refresh"
  94. ? res.data.rows
  95. : listData.value.concat(res.data.rows);
  96. if (req.value.pageNum * 10 >= res.data.total) {
  97. finished.value = true;
  98. }
  99. req.value.pageNum++;
  100. loading.value = false;
  101. })
  102. .catch((err) => {
  103. loading.value = false;
  104. });
  105. };
  106. getList();
  107. </script>
  108. <style lang="scss" scoped>
  109. .list {
  110. min-height: 70vh;
  111. }
  112. </style>