list.vue 2.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. <template>
  2. <div class="publicity-page">
  3. <back-button />
  4. <h3>信息公示</h3>
  5. <div class="picker-search">
  6. <van-search v-model="searchValue" placeholder="请输入报销人姓名" @search="onSearch" />
  7. </div>
  8. <van-list
  9. class="publicity-list"
  10. v-model:loading="loading"
  11. :finished="finished"
  12. @load="onLoad"
  13. finished-text="我们是有底线的"
  14. >
  15. <van-cell
  16. class="item"
  17. v-for="item in list"
  18. :key="item.detailId"
  19. :title="item.invoiceOrgName"
  20. is-link
  21. :to="{ name: 'invoice.fill', query: { invoiceId, personId: item.personId,isFinished:true } }"
  22. >
  23. <template #value>
  24. <span class="pname">{{ item.personName }}</span>
  25. </template>
  26. </van-cell>
  27. </van-list>
  28. </div>
  29. </template>
  30. <script setup>
  31. import { computed, onMounted, reactive, ref } from "vue"
  32. import { useRouter, useRoute } from 'vue-router'
  33. import { getList } from "@/services/invoice";
  34. const router = useRouter();
  35. const route = useRoute();
  36. const { invoiceId } = route.query;
  37. const list = ref([])
  38. const searchValue = ref()
  39. const error = ref(false);
  40. const loading = ref(false);
  41. const pagenavi = reactive({ pageNum: 1, pageSize: 10, total: 0 })
  42. const finished = computed(() => pagenavi.pageNum * pagenavi.pageSize > pagenavi.total)
  43. const queryData = (params = {}) => {
  44. getList(invoiceId, { ...params, invoiceId }).then(res => {
  45. const { records, ...pageInfo } = res;
  46. if (pageInfo.current === 1) {
  47. list.value = records || []
  48. } else {
  49. list.value = list.value.concat(records || [])
  50. }
  51. pagenavi.pageNum = pageInfo.current
  52. pagenavi.total = pageInfo.total
  53. error.value = false
  54. loading.value = false
  55. }).catch(() => {
  56. error.value = true
  57. loading.value = false
  58. })
  59. }
  60. const onLoad = () => {
  61. const params = { pageNum: pagenavi.pageNum + 1, pageSize: pagenavi.pageSize }
  62. queryData(params)
  63. }
  64. const onSearch=()=>{
  65. const params = { pageNum: pagenavi.pageNum, pageSize: pagenavi.pageSize,personName:searchValue.value }
  66. queryData(params)
  67. }
  68. onMounted(() => {
  69. //获取提交记录
  70. const params = { pageNum: pagenavi.pageNum, pageSize: pagenavi.pageSize }
  71. queryData(params)
  72. })
  73. </script>
  74. <style lang="less" scoped>
  75. .publicity-page {
  76. height: 100%;
  77. display: flex;
  78. flex-direction: column;
  79. h3 {
  80. flex: none;
  81. text-align: center;
  82. letter-spacing: 2px;
  83. }
  84. .publicity-list {
  85. flex: 1;
  86. }
  87. .pname {
  88. color: #333;
  89. }
  90. // .item + .item {
  91. // margin-top: 16px;
  92. // }
  93. .picker-search {
  94. flex: none;
  95. }
  96. }
  97. </style>