details.vue 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. <template>
  2. <van-nav-bar :title="'快照明细'" left-text="" left-arrow @click-left="onClickLeft" @click-right="onClickRight">
  3. <!-- <template #right> {{ $t("common.add") }} </template> -->
  4. </van-nav-bar>
  5. <van-search v-model="req.keyword" :placeholder="$t('common.pleaseEnterKeywords')" @search="onRefresh" />
  6. <van-pull-refresh v-model="loading" @refresh="onRefresh">
  7. <div class="list">
  8. <van-list v-model:loading="loading" :finished="finished" :finished-text="$t('common.noMore')" style="margin-bottom: 60px">
  9. <commonList :data="listData" :showMore="false" :config="listConfig">
  10. <template #productDefinition="{ row }">
  11. <div>
  12. <span v-if="row.productDefinition == 1">产品</span>
  13. <span v-if="row.productDefinition == 2">物料</span>
  14. </div>
  15. </template>
  16. <template #size="{ row }">
  17. <div v-if="row.productLength && row.productWidth && row.productHeight">
  18. <span>{{ row.productLength }}</span>*
  19. <span>{{ row.productWidth }}</span>*
  20. <span>{{ row.productHeight }}</span>
  21. </div>
  22. <div v-else></div>
  23. </template>
  24. </commonList>
  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 { showSuccessToast, showFailToast } from "vant";
  33. import { useRoute } from "vue-router";
  34. const proxy = getCurrentInstance().proxy;
  35. const route = useRoute();
  36. const onClickLeft = () => proxy.$router.push("/main/working");
  37. const req = ref({
  38. pageNum: 1,
  39. keyword: null,
  40. });
  41. const finished = ref(false);
  42. const onRefresh = () => {
  43. req.value.pageNum = 1;
  44. finished.value = false;
  45. getList("refresh");
  46. };
  47. const loading = ref(false);
  48. const listData = ref([]);
  49. const getList = (type) => {
  50. loading.value = true;
  51. proxy
  52. .post("/stockSnapshotDetails/page", req.value)
  53. .then((res) => {
  54. listData.value =
  55. type === "refresh"
  56. ? res.data.rows
  57. : listData.value.concat(res.data.rows);
  58. if (req.value.pageNum * 10 >= res.data.total) {
  59. finished.value = true;
  60. }
  61. req.value.pageNum++;
  62. loading.value = false;
  63. })
  64. .catch(() => {
  65. loading.value = false;
  66. });
  67. };
  68. const toDtl = (row) => {
  69. proxy.$router.push({
  70. path: "/main/inventoryCountAdd",
  71. query: {
  72. id: row.id,
  73. },
  74. });
  75. };
  76. const onClickRight = () => {
  77. return;
  78. proxy.$router.push({
  79. path: "/main/inventoryCountAdd",
  80. query: {},
  81. });
  82. };
  83. const listConfig = ref([
  84. {
  85. label: "业务公司",
  86. prop: "companyName",
  87. },
  88. {
  89. label: "仓库名称",
  90. prop: "warehouseName",
  91. },
  92. {
  93. type: "slot",
  94. label: "物品类型",
  95. slotName: "productDefinition",
  96. },
  97. {
  98. label: "所属分类",
  99. prop: "productClassifyName",
  100. },
  101. {
  102. label: "物品编码",
  103. prop: "productCustomCode",
  104. },
  105. {
  106. label: "物品名称",
  107. prop: "productName",
  108. },
  109. {
  110. type: "slot",
  111. label: "尺寸 (cm)",
  112. slotName: "size",
  113. },
  114. {
  115. label: "颜色",
  116. prop: "productColor",
  117. },
  118. {
  119. label: "库存数量",
  120. prop: "quantity",
  121. },
  122. ]);
  123. onMounted(() => {
  124. if (route.query) {
  125. req.value.snapshotId = route.query.id;
  126. getList();
  127. }
  128. });
  129. </script>
  130. <style lang="scss" scoped>
  131. .list {
  132. min-height: 70vh;
  133. }
  134. </style>