index.vue 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  1. <script setup>
  2. import {
  3. ref
  4. } from "vue";
  5. import {
  6. onLoad,
  7. onPullDownRefresh,
  8. onReachBottom,
  9. onPageScroll
  10. } from "@dcloudio/uni-app";
  11. import {
  12. getPreFlowDetail,
  13. getProjectPreFlow
  14. } from "@/api/work/preFlow.js"
  15. let cardList = ref([]);
  16. let listTotal = ref(0);
  17. // 触底加载flag
  18. let moreListFlag = true
  19. let scrollTop = ref(0)
  20. let loading = ref(true)
  21. let searchInfo = ref({
  22. pageNo: 1,
  23. pageSize: 10,
  24. type: null,
  25. beginDate: null,
  26. endDate: null
  27. });
  28. let getList = function() {
  29. if (searchInfo.value.pageNo == 1) {
  30. loading.value = true
  31. };
  32. if (searchInfo.value.type === 'qqsxblqk') {
  33. getProjectPreFlow(searchInfo.value).then(res => {
  34. loading.value = false;
  35. let obj = {
  36. "0": "未开始办理",
  37. "1": "开始办理",
  38. "2": "办理完成",
  39. "3": "退回"
  40. }
  41. res.data.list.forEach(item => {
  42. item.numStage = obj[item.numStage];
  43. item.status = item.status === "1" ? "需办理" : item.status === "2" ? "无需办理" : "--";
  44. })
  45. cardList.value = cardList.value.concat(res.data.list);
  46. listTotal.value = res.data.total;
  47. if (res.data.total == searchInfo.value.pageNo * searchInfo.value.pageSize - (10 - res.data.list.length))
  48. moreListFlag = false;
  49. }).catch(() => {
  50. loading.value = false;
  51. })
  52. } else {
  53. getPreFlowDetail(searchInfo.value).then(res => {
  54. loading.value = false;
  55. let obj = {
  56. "0": "未开始办理",
  57. "1": "开始办理",
  58. "2": "办理完成",
  59. "3": "退回"
  60. }
  61. res.data.list.forEach(item => {
  62. item.numStage = obj[item.numStage];
  63. item.status = item.status === "1" ? "需办理" : item.status === "2" ? "无需办理" : "--";
  64. })
  65. cardList.value = cardList.value.concat(res.data.list);
  66. listTotal.value = res.data.total;
  67. if (res.data.total == searchInfo.value.pageNo * searchInfo.value.pageSize - (10 - res.data.list.length))
  68. moreListFlag = false;
  69. }).catch(() => {
  70. loading.value = false;
  71. })
  72. }
  73. };
  74. onLoad(options => {
  75. searchInfo.value.type = options.type;
  76. if (searchInfo.value.type == 'qqsxblqk') {
  77. searchInfo.value = Object.assign(searchInfo.value, options)
  78. } else {
  79. if (options.beginDate) {
  80. let beginDate = options.beginDate;
  81. beginDate = beginDate.replace('/', '-');
  82. searchInfo.value.beginDate = beginDate.replace('/', '-');
  83. }
  84. if (options.endDate) {
  85. let endDate = options.endDate;
  86. endDate = endDate.replace('/', '-');
  87. searchInfo.value.endDate = endDate.replace('/', '-');
  88. }
  89. }
  90. getList();
  91. })
  92. onPullDownRefresh(() => {
  93. searchInfo.value.pageNo = 1;
  94. cardList.value = [];
  95. moreListFlag = true;
  96. try {
  97. getList();
  98. } finally {
  99. uni.stopPullDownRefresh()
  100. }
  101. })
  102. onReachBottom(() => {
  103. if (!moreListFlag) {
  104. return uni.showToast({
  105. title: "已经到底了。",
  106. icon: "none",
  107. duration: 2000
  108. })
  109. }
  110. searchInfo.value.pageNo++;
  111. getList();
  112. })
  113. onPageScroll((e) => {
  114. scrollTop.value = e.scrollTop
  115. })
  116. </script>
  117. <template>
  118. <view class="container">
  119. <page-title>办理详情</page-title>
  120. <view class="cards-list">
  121. <view class="card" v-for="(item,index) in cardList" :key="index">
  122. <card-title :numerator="index+1" :denominator="listTotal"></card-title>
  123. <view class="card-item">
  124. <view class="card-item-name">项目名称</view>
  125. <view class="card-item-content">{{item.subName ?? "--"}}</view>
  126. </view>
  127. <view class="card-item">
  128. <view class="card-item-name">办理内容</view>
  129. </view>
  130. <view class="card-item">
  131. <u--textarea class="card-item-textarea" v-model="item.preFlowTitle" disabled></u--textarea>
  132. </view>
  133. <view class="card-item">
  134. <view class="card-item-name">手续阶段</view>
  135. <view class="card-item-content">{{item.numStage ?? "--"}}</view>
  136. </view>
  137. <view class="card-item">
  138. <view class="card-item-name">是否办理</view>
  139. <view class="card-item-content">{{item.status ?? "--"}}</view>
  140. </view>
  141. <view class="card-item">
  142. <view class="card-item-name">延期日期</view>
  143. <view class="card-item-content">{{item.delay ?? "--"}}</view>
  144. </view>
  145. <view class="card-item">
  146. <view class="card-item-name">办理单位</view>
  147. <view class="card-item-content">{{item.unitName ?? "--"}}</view>
  148. </view>
  149. </view>
  150. <empty-show v-if="cardList.length===0"></empty-show>
  151. </view>
  152. <u-back-top :scroll-top="scrollTop"></u-back-top>
  153. <u-loading-page :loading="loading"></u-loading-page>
  154. </view>
  155. </template>
  156. <style lang="scss" scoped>
  157. </style>