index.vue 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396
  1. <script setup>
  2. import {
  3. ref
  4. } from 'vue'
  5. import {
  6. onLoad,
  7. onUnload,
  8. onPullDownRefresh,
  9. onReachBottom,
  10. onPageScroll
  11. } from "@dcloudio/uni-app"
  12. import {
  13. getProjectInfoList,
  14. } from "@/api/work/projectInfo.js"
  15. function backToBefore() {
  16. uni.reLaunch({
  17. url: "/pages/index"
  18. })
  19. };
  20. function searchClick() {
  21. goToPage('/pages/cbProject/search/index')
  22. }
  23. let scrollTop = ref(0)
  24. let loading = ref(true)
  25. // 参数
  26. let searchInfo = ref({
  27. pageNo: 1,
  28. pageSize: 10,
  29. queryType: 3,
  30. orderBy: "amtTotal",
  31. })
  32. // 获取列表
  33. function getList() {
  34. if (searchInfo.value.pageNo == 1) {
  35. loading.value = true
  36. }
  37. let params = Object.assign({
  38. orderType: orderByStatus.value
  39. }, searchInfo.value)
  40. getProjectInfoList(params).then(res => {
  41. loading.value = false
  42. projectList.value = projectList.value.concat(res.data.list);
  43. listTotal.value = res.data.total;
  44. if (res.data.total == searchInfo.value.pageNo * searchInfo.value.pageSize - (10 - res.data.list.length))
  45. moreListFlag = false;
  46. }).catch(() => {
  47. loading.value = false
  48. })
  49. }
  50. // 按金额排序
  51. let orderByStatus = ref(null)
  52. const changeOrderByStatus = () => {
  53. if (orderByStatus.value === "desc") {
  54. orderByStatus.value = "asc"
  55. } else if (orderByStatus.value === "asc") {
  56. orderByStatus.value = null
  57. } else {
  58. orderByStatus.value = "desc"
  59. }
  60. searchInfo.value.pageNo = 1;
  61. projectList.value = [];
  62. moreListFlag = true;
  63. getList();
  64. }
  65. // 触底加载flag
  66. let moreListFlag = true
  67. let projectList = ref([])
  68. let listTotal = ref(0)
  69. function goToDetail(id, subName) {
  70. uni.navigateTo({
  71. url: `/pages/projectInfo/detail/index?id=${id}&subName=${subName}`
  72. })
  73. }
  74. function goToPage(url) {
  75. uni.navigateTo({
  76. url
  77. })
  78. }
  79. function goToReport(type, subId, subName) {
  80. uni.navigateTo({
  81. url: `/pages/projectInfo/report/index?type=${type}&subId=${subId}&subName=${subName}`
  82. })
  83. }
  84. // 折叠/展开
  85. const changeFoldItem = (status, id) => {
  86. let item = projectList.value.find(item => item.id === id);
  87. item.unfold = status;
  88. }
  89. onLoad(() => {
  90. uni.$on('cbProjectSearch', resolve => {
  91. searchInfo.value = Object.assign(searchInfo.value, resolve);
  92. searchInfo.value.pageNo = 1;
  93. projectList.value = [];
  94. listTotal.value = 0;
  95. moreListFlag = true;
  96. getList();
  97. })
  98. getList();
  99. })
  100. onUnload(() => {
  101. uni.$off('cbProjectSearch');
  102. })
  103. onPageScroll((e) => {
  104. scrollTop.value = e.scrollTop
  105. })
  106. onPullDownRefresh(() => {
  107. searchInfo.value.pageNo = 1;
  108. projectList.value = [];
  109. moreListFlag = true;
  110. try {
  111. getList();
  112. } finally {
  113. uni.stopPullDownRefresh()
  114. }
  115. })
  116. onReachBottom(() => {
  117. if (!moreListFlag) {
  118. return uni.showToast({
  119. title: "已经到底了。",
  120. icon: "none",
  121. duration: 2000
  122. })
  123. }
  124. searchInfo.value.pageNo++;
  125. getList();
  126. })
  127. </script>
  128. <template>
  129. <view class="container">
  130. <page-title @searchClick='searchClick' :showSearch='true'>储备项目</page-title>
  131. <view class="cards-list">
  132. <view class="order-by">
  133. <view class=" order-by-item">
  134. 金额
  135. <view class="order-by-icon" :class="orderByStatus" @click="changeOrderByStatus()"></view>
  136. </view>
  137. </view>
  138. <view v-for="(item,index) in projectList" :key="index">
  139. <!-- 未折叠卡片 -->
  140. <view class="card" v-if="item.unfold">
  141. <!-- 项目名称 -->
  142. <view class="card-item">
  143. <view class="card-item-name">项目名称</view>
  144. <view class="card-item-content">{{item.subName ?? "--"}}</view>
  145. </view>
  146. <!-- 总投资(万元) -->
  147. <view class="card-item">
  148. <view class="card-item-name">总投资(万元)</view>
  149. <view class="card-item-content">{{item.amtTotal ?? "--"}}</view>
  150. </view>
  151. <!-- 年度计划投资-申报单位(万元) -->
  152. <view class="card-item">
  153. <view class="card-item-name">年度计划投资-申报单位(万元)</view>
  154. <view class="card-item-content">{{item.yearAmt ?? "--"}}</view>
  155. </view>
  156. <!-- 已完成投资(万元)-->
  157. <view class="card-item">
  158. <view class="card-item-name">已完成投资(万元)</view>
  159. <view class="card-item-content">{{item.yearAmtSj ?? "--"}}</view>
  160. </view>
  161. <!-- 当前状态 -->
  162. <view class="card-item">
  163. <view class="card-item-name">当前状态</view>
  164. <view class="card-item-content">{{item.status || "--"}}</view>
  165. </view>
  166. <!-- 功能按钮 -->
  167. <view class="card-item">
  168. <view class="card-btn fat-btn" @click="goToDetail(item.id,item.subName)">项目查看</view>
  169. </view>
  170. <!-- 周月年报按钮 -->
  171. <view class="card-item bottom-item">
  172. <view class="card-btn thin-btn report-btn" @click="goToReport('weekly',item.id,item.subName)">周报</view>
  173. <view class="card-btn thin-btn report-btn" @click="goToReport('monthly',item.id,item.subName)">月报</view>
  174. <view class="card-btn thin-btn report-btn" @click="goToReport('yearly',item.id,item.subName)">年度计划</view>
  175. </view>
  176. <!-- 编号 -->
  177. <view class="card-fold-option"
  178. :class="item.status_fgw === '2' ? 'card-fold-red' :item.status_fgw === '1' ?'card-fold-yellow':''">
  179. <view class="card-fold-count">{{index + 1}} / {{listTotal}}</view>
  180. <view class="card-fold-center" @click.stop="changeFoldItem(false,item.id)">
  181. <view class="card-fold-btn card-unfold-btn"></view>
  182. </view>
  183. <view class="card-fold-chaos"></view>
  184. </view>
  185. </view>
  186. <!-- 折叠卡片 -->
  187. <view class="card-fold" v-else>
  188. {{item.subName ?? "--"}}
  189. <view class="card-fold-option"
  190. :class="item.status_fgw === '2' ? 'card-fold-red' :item.status_fgw === '1' ?'card-fold-yellow':''">
  191. <view class="card-fold-count">{{index + 1}} / {{listTotal}}</view>
  192. <view class="card-fold-center" @click.stop="changeFoldItem(true, item.id)">
  193. <view class="card-fold-btn"></view>
  194. </view>
  195. <view class="card-fold-chaos"></view>
  196. </view>
  197. </view>
  198. </view>
  199. </view>
  200. <u-back-top :scroll-top="scrollTop"></u-back-top>
  201. <u-loading-page :loading="loading"></u-loading-page>
  202. </view>
  203. </template>
  204. <style lang="scss" scoped>
  205. .card-light {
  206. display: flex;
  207. align-items: center;
  208. justify-content: center;
  209. }
  210. .card-light-bottom {
  211. justify-content: center;
  212. width: 282rpx;
  213. height: 76rpx;
  214. background-size: 100% 100%;
  215. }
  216. .light-red {
  217. background-image: url('@/static/icon-light-red.png');
  218. }
  219. .light-yellow {
  220. background-image: url('@/static/icon-light-yellow.png');
  221. }
  222. .light-green {
  223. background-image: url('@/static/icon-light-green.png');
  224. }
  225. .card-fold {
  226. position: relative;
  227. width: 100%;
  228. min-height: 152rpx;
  229. margin-bottom: 20rpx;
  230. padding: 24rpx 30rpx 52rpx;
  231. box-sizing: border-box;
  232. background: #FFFFFF;
  233. border-radius: 40rpx;
  234. overflow: hidden;
  235. }
  236. .card-fold-option {
  237. position: absolute;
  238. display: flex;
  239. justify-content: space-between;
  240. align-items: center;
  241. left: 0;
  242. bottom: 0;
  243. width: 100%;
  244. height: 38rpx;
  245. padding: 0 40rpx;
  246. box-sizing: border-box;
  247. background: linear-gradient(270deg, #CADDFF 4%, rgba(219, 232, 255, 0) 100%);
  248. z-index: 999;
  249. .card-fold-count {
  250. flex: 1;
  251. font-size: 28rpx;
  252. color: #1869F6;
  253. }
  254. .card-fold-center {
  255. flex: 1;
  256. .card-fold-btn {
  257. width: 32rpx;
  258. height: 20rpx;
  259. margin: 0 auto;
  260. background-image: url("@/static/icon-fold.png");
  261. background-size: 100% 100%;
  262. }
  263. .card-unfold-btn {
  264. transform: rotate(180deg);
  265. }
  266. }
  267. .card-fold-chaos {
  268. flex: 1;
  269. }
  270. }
  271. .card-fold-red {
  272. background: linear-gradient(270deg, #FF8080 0%, rgba(219, 232, 255, 0) 100%);
  273. .card-fold-count {
  274. color: #FF0000;
  275. }
  276. .card-fold-center {
  277. .card-fold-btn {
  278. background-image: url("@/static/icon-fold-red.png");
  279. }
  280. }
  281. }
  282. .card-fold-yellow {
  283. background: linear-gradient(270deg, #FFAA00 4%, rgba(219, 232, 255, 0) 100%);
  284. .card-fold-count {
  285. color: #E19703;
  286. }
  287. .card-fold-center {
  288. .card-fold-btn {
  289. background-image: url("@/static/icon-fold-yellow.png");
  290. }
  291. }
  292. }
  293. .card {
  294. padding: 16rpx 40rpx 60rpx;
  295. overflow: hidden;
  296. }
  297. .order-by {
  298. display: flex;
  299. align-items: center;
  300. justify-content: space-between;
  301. width: 100%;
  302. height: 106rpx;
  303. margin-bottom: 34rpx;
  304. padding: 0 40rpx;
  305. border-radius: 40rpx;
  306. background: #FFF;
  307. .order-by-item {
  308. flex: 1;
  309. display: flex;
  310. justify-content: center;
  311. align-items: center;
  312. font-size: 32rpx;
  313. color: #343437;
  314. .order-by-icon {
  315. width: 22rpx;
  316. height: 46rpx;
  317. margin-left: 24rpx;
  318. background-image: url("@/static/orderBy-none.png");
  319. background-size: 100% 100%;
  320. }
  321. .desc {
  322. background-image: url("@/static/orderBy-desc.png");
  323. }
  324. .asc {
  325. background-image: url("@/static/orderBy-asc.png");
  326. }
  327. }
  328. }
  329. </style>