index.vue 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  1. <template>
  2. <view class="container">
  3. <page-title>问题清单</page-title>
  4. <view class="cards-list">
  5. <view class="card" v-for="(item,index) in itemList" :key="index">
  6. <card-title :numerator="index+1" :denominator="listTotal"></card-title>
  7. <view class="card-name">
  8. <view class="card-name-title">
  9. <text class="card-name-description">申报单位</text>
  10. </view>
  11. <text class="card-name-text">{{item.unitTitle || "--"}}</text>
  12. </view>
  13. <view class="card-item">
  14. <view class="card-item-name">项目名称</view>
  15. <view class="card-item-content">{{item.sub_name || "--"}}</view>
  16. </view>
  17. <view class="card-item">
  18. <view class="card-item-name">当前状态</view>
  19. <view class="card-item-content">{{item.status || "--"}}</view>
  20. </view>
  21. <view class="card-item">
  22. <view class="card-item-name">问题描述</view>
  23. <view class="card-item-content">{{item.title || "--"}}</view>
  24. </view>
  25. <view class="card-item">
  26. <view class="card-item-name">要求解决日期</view>
  27. <view class="card-item-content">{{item.date_conf || "--"}}</view>
  28. </view>
  29. <view class="card-item">
  30. <view class="card-btn" @click="gotoDetail('project',item.sub_id,item.subName)">项目查看</view>
  31. <view class="card-btn empty-btn" @click="gotoDetail('problem',item.id)">问题查看</view>
  32. </view>
  33. </view>
  34. <empty-show v-if="itemList.length===0"></empty-show>
  35. </view>
  36. <u-back-top :scroll-top="scrollTop"></u-back-top>
  37. <u-loading-page :loading="loading"></u-loading-page>
  38. </view>
  39. </template>
  40. <script setup>
  41. import {
  42. ref
  43. } from 'vue'
  44. import {
  45. onLoad,
  46. onPullDownRefresh,
  47. onReachBottom,
  48. onPageScroll
  49. } from "@dcloudio/uni-app"
  50. import {
  51. getOverseeListBySubId,
  52. getOverseeListBySubIdNo
  53. } from "@/api/work/oversee.js"
  54. function backToBefore() {
  55. uni.navigateBack({})
  56. };
  57. let scrollTop = ref(0);
  58. let loading = ref(true);
  59. // 参数
  60. let searchInfo = ref({
  61. pageNo: 1,
  62. pageSize: 10,
  63. })
  64. let pageType = null
  65. function getList() {
  66. if(searchInfo.value.pageNo == 1){
  67. loading.value = true
  68. };
  69. if (pageType === 'notDeal') {
  70. getOverseeListBySubIdNo(searchInfo.value).then(res => {
  71. loading.value = false;
  72. itemList.value = itemList.value.concat(res.data.list);
  73. listTotal = res.data.total;
  74. if (res.data.total == searchInfo.value.pageNo*searchInfo.value.pageSize-(10 - res.data.list.length)) moreListFlag = false;
  75. }).catch(() => {
  76. loading.value = false
  77. })
  78. } else {
  79. getOverseeListBySubId(searchInfo.value).then(res => {
  80. loading.value = false;
  81. itemList.value = itemList.value.concat(res.data.list);
  82. listTotal = res.data.total;
  83. if (res.data.total == searchInfo.value.pageNo*searchInfo.value.pageSize-(10 - res.data.list.length)) moreListFlag = false;
  84. }).catch(() => {
  85. loading.value = false
  86. })
  87. }
  88. }
  89. let itemList = ref([])
  90. let listTotal = ref(0)
  91. // 触底加载flag
  92. let moreListFlag = true
  93. function gotoDetail(type, id, subName) {
  94. if (type === "project") {
  95. uni.navigateTo({
  96. url: `/pages/projectInfo/detail/index?id=${id}&subName=${subName}`
  97. })
  98. } else {
  99. uni.navigateTo({
  100. url: `/pages/oversee/detail/index?id=${id}`
  101. })
  102. }
  103. }
  104. function goToPage(url) {
  105. uni.navigateTo({
  106. url
  107. })
  108. }
  109. onLoad((options) => {
  110. pageType = options.type
  111. searchInfo.value = Object.assign(searchInfo.value, options);
  112. let filterArr = ["null", "undefined", ""]
  113. for (let i in searchInfo.value) {
  114. if (filterArr.includes(searchInfo.value[i])) {
  115. searchInfo.value[i] = null
  116. }
  117. }
  118. getList()
  119. })
  120. onPageScroll((e) => {
  121. scrollTop.value = e.scrollTop
  122. })
  123. onPullDownRefresh(() => {
  124. searchInfo.value.pageNo = 1;
  125. itemList.value = [];
  126. moreListFlag = true;
  127. try {
  128. getList();
  129. } finally {
  130. uni.stopPullDownRefresh()
  131. }
  132. })
  133. onReachBottom(() => {
  134. if (!moreListFlag) {
  135. return uni.showToast({
  136. title: "已经到底了。",
  137. icon: "none",
  138. duration: 2000
  139. })
  140. }
  141. searchInfo.value.pageNo++;
  142. getList();
  143. })
  144. </script>
  145. <style lang="scss" scoped>
  146. </style>