index.vue 4.0 KB

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