index.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681
  1. <script setup>
  2. import {
  3. reactive,
  4. ref
  5. } from 'vue';
  6. import {
  7. onLoad,
  8. onUnload,
  9. onPullDownRefresh,
  10. onReachBottom,
  11. onPageScroll
  12. } from "@dcloudio/uni-app";
  13. import {
  14. getProjectInfoList,
  15. getAmtCount
  16. } from "@/api/work/projectInfo.js";
  17. import {
  18. addFocus,
  19. cancelFocus
  20. } from "@/api/work/focus.js";
  21. function backToBefore() {
  22. uni.reLaunch({
  23. url: "/pages/index"
  24. });
  25. };
  26. let title = ref('项目台账')
  27. let scrollTop = ref(0)
  28. let loading = ref(true)
  29. // 统计
  30. let countShow = ref(false);
  31. let firstGetCount = true;
  32. let countList = ref([{
  33. title: "年度计划投资(万元)",
  34. key: "sumYearAmt",
  35. value: 0,
  36. color: ""
  37. }, {
  38. title: "全年占比",
  39. key: "yearRt",
  40. value: 0,
  41. color: "",
  42. isRate: true,
  43. }, {
  44. title: "当月完成金额(万元)",
  45. key: "sumMonthAmtSj",
  46. value: 0,
  47. color: "count-special-value"
  48. }, {
  49. title: "当月占比",
  50. key: "monthRt",
  51. value: 0,
  52. color: "count-special-value",
  53. isRate: true,
  54. }]);
  55. const getAmtCountValue = paramsOrginal => {
  56. getAmtCount(paramsOrginal).then(res => {
  57. firstGetCount = false;
  58. for (let i in countList.value) {
  59. countList.value[i].value = res.data[countList.value[i].key] ?? 0;
  60. }
  61. })
  62. };
  63. let orderBy = reactive({
  64. text: "amt",
  65. amtTotalStatus: null,
  66. yearAmtStatus: null
  67. })
  68. const changeOrderByStatus = type => {
  69. // 改变状态
  70. if (type === "amt") {
  71. orderBy.yearAmtStatus = null;
  72. orderBy.text = "amt";
  73. if (orderBy.amtTotalStatus === "desc") {
  74. orderBy.amtTotalStatus = "asc"
  75. } else if (orderBy.amtTotalStatus === "asc") {
  76. orderBy.amtTotalStatus = null
  77. } else {
  78. orderBy.amtTotalStatus = "desc"
  79. }
  80. } else {
  81. orderBy.amtTotalStatus = null;
  82. orderBy.text = "yearAmtSj";
  83. if (orderBy.yearAmtStatus === "desc") {
  84. orderBy.yearAmtStatus = "asc"
  85. } else if (orderBy.yearAmtStatus === "asc") {
  86. orderBy.yearAmtStatus = null
  87. } else {
  88. orderBy.yearAmtStatus = "desc"
  89. }
  90. }
  91. searchInfo.value.pageNo = 1;
  92. projectList.value = [];
  93. listTotal.value = 0;
  94. moreListFlag = true;
  95. getList()
  96. }
  97. // 参数
  98. let searchInfo = ref({
  99. pageNo: 1,
  100. pageSize: 10,
  101. beginDateStart: null,
  102. beginDateEnd: null,
  103. })
  104. // 触底加载flag
  105. let moreListFlag = true
  106. // 获取列表
  107. let projectList = ref([]);
  108. let listTotal = ref(0);
  109. function getList() {
  110. if (searchInfo.value.pageNo == 1) {
  111. loading.value = true
  112. }
  113. let params = Object.assign({
  114. orderBy: orderBy.text === "amt" ? "amtTotal" : "yearAmtSj",
  115. orderType: orderBy.text === "amt" ? orderBy.amtTotalStatus : orderBy.yearAmtStatus
  116. }, searchInfo.value)
  117. if (countShow.value && firstGetCount) getAmtCountValue(params);
  118. getProjectInfoList(params).then(res => {
  119. loading.value = false
  120. projectList.value = projectList.value.concat(res.data.list);
  121. listTotal.value = res.data.total;
  122. if (res.data.total == searchInfo.value.pageNo * searchInfo.value.pageSize - (10 - res.data.list
  123. .length)) moreListFlag = false;
  124. }).catch(() => {
  125. loading.value = false
  126. })
  127. }
  128. function goToDetail(id, subName) {
  129. uni.navigateTo({
  130. url: `/pages/projectInfo/detail/index?id=${id}&subName=${subName}`
  131. })
  132. }
  133. function goToPage(url) {
  134. uni.navigateTo({
  135. url
  136. })
  137. }
  138. function goToReport(type, subId, subName) {
  139. if (type === 'wtdb') {
  140. uni.navigateTo({
  141. url: `/pages/problemSupervision/index?type=${type}&subId=${subId}&subName=${subName}`
  142. })
  143. } else if (type === 'qtldjbm') {
  144. uni.navigateTo({
  145. url: `/pages/leadersList/index?type=${type}&subId=${subId}&subName=${subName}`
  146. })
  147. } else if (type === 'xcyx') {
  148. uni.navigateTo({
  149. url: `/pages/projectImageAndVideo/index?type=${type}&subId=${subId}&subName=${subName}`
  150. })
  151. } else if (type === 'more') {
  152. uni.navigateTo({
  153. url: `/pages/projectBtnList/index?type=${type}&subId=${subId}&subName=${subName}`
  154. })
  155. } else {
  156. uni.navigateTo({
  157. url: `/pages/projectInfo/report/index?type=${type}&subId=${subId}&subName=${subName}`
  158. })
  159. }
  160. }
  161. // 折叠/展开
  162. const changeFoldItem = (status, id) => {
  163. let item = projectList.value.find(item => item.id === id);
  164. item.unfold = status;
  165. }
  166. // 收藏/取消
  167. function changeFocus(id, status) {
  168. let item = projectList.value.find(item => item.id === id);
  169. if (status) {
  170. cancelFocus({
  171. subId: id
  172. }).then(res => {
  173. if (res.code === 200) {
  174. item.isAttention = 0;
  175. }
  176. }).catch(() => {
  177. uni.showToast({
  178. title: "更改收藏状态失败。",
  179. icon: "none",
  180. duration: 2000
  181. })
  182. })
  183. } else {
  184. addFocus({
  185. subId: id
  186. }).then(res => {
  187. if (res.code === 200) {
  188. item.isAttention = 1;
  189. }
  190. }).catch(() => {
  191. uni.showToast({
  192. title: "更改收藏状态失败。",
  193. icon: "none",
  194. duration: 2000
  195. })
  196. })
  197. }
  198. }
  199. let seachFalg = ref(true)
  200. function searchClick() {
  201. goToPage('/pages/projectInfo/search/index')
  202. }
  203. onLoad((options) => {
  204. seachFalg.value = false
  205. searchInfo.value = Object.assign(searchInfo.value, options)
  206. searchInfo.value.beginDateStart = `${options?.year}/01/01`;
  207. searchInfo.value.beginDateEnd = `${options?.year}/12/31`;
  208. getList();
  209. });
  210. onUnload(() => {
  211. uni.$off('projectInfoSearch');
  212. })
  213. onPageScroll((e) => {
  214. scrollTop.value = e.scrollTop
  215. })
  216. onPullDownRefresh(() => {
  217. searchInfo.value.pageNo = 1;
  218. projectList.value = [];
  219. moreListFlag = true;
  220. firstGetCount = true;
  221. try {
  222. getList();
  223. } finally {
  224. uni.stopPullDownRefresh()
  225. }
  226. })
  227. onReachBottom(() => {
  228. if (!moreListFlag) {
  229. return uni.showToast({
  230. title: "已经到底了。",
  231. icon: "none",
  232. duration: 2000
  233. })
  234. }
  235. searchInfo.value.pageNo++;
  236. getList();
  237. })
  238. </script>
  239. <template>
  240. <view class="container">
  241. <page-title @searchClick='searchClick' :showSearch='seachFalg'>{{title}}</page-title>
  242. <view class="cards-list">
  243. <view class="count-value" v-if="countShow">
  244. <view class="count-item" v-for="(item,index) in countList" :key="index">
  245. <view class="count-item-value" :class="item.color">{{item.value}}{{item.isRate ? "%" : ""}}</view>
  246. <view class="count-item-description">{{item.title}}</view>
  247. </view>
  248. </view>
  249. <view class="order-by">
  250. <view class="order-by-item">
  251. 金额
  252. <view class="order-by-icon" :class="orderBy.amtTotalStatus" @click="changeOrderByStatus('amt')"></view>
  253. </view>
  254. <view class="order-by-item">
  255. 实际投资
  256. <view class="order-by-icon" :class="orderBy.yearAmtStatus" @click="changeOrderByStatus('year')"></view>
  257. </view>
  258. </view>
  259. <view v-for="(item,index) in projectList" :key="index">
  260. <!-- 未折叠卡片 -->
  261. <view class="card" v-if="item.unfold">
  262. <!-- 项目名称 -->
  263. <view class="card-item">
  264. <view class="card-item-name">项目名称</view>
  265. <view class="card-item-content">{{item.subName ?? "--"}}</view>
  266. </view>
  267. <!-- 总投资(万元) -->
  268. <view class="card-item">
  269. <view class="card-item-name">总投资(万元)</view>
  270. <view class="card-item-content">{{item.amtTotal ?? "--"}}</view>
  271. </view>
  272. <!-- 年度计划投资-申报单位(万元) -->
  273. <view class="card-item">
  274. <view class="card-item-name">年度计划投资-申报单位(万元)</view>
  275. <view class="card-item-content">{{item.yearAmt ?? "--"}}</view>
  276. </view>
  277. <!-- 已完成投资(万元)-->
  278. <view class="card-item">
  279. <view class="card-item-name">已完成投资(万元)</view>
  280. <view class="card-item-content">{{item.yearAmtSj ?? "--"}}</view>
  281. </view>
  282. <!-- 当前状态 -->
  283. <view class="card-item">
  284. <view class="card-item-name">当前状态</view>
  285. <view class="card-item-content">{{item.status || "--"}}</view>
  286. </view>
  287. <!-- 功能按钮 -->
  288. <view class="card-item">
  289. <!-- 项目查看按钮(特殊) -->
  290. <view class="card-btn fat-btn special-btn" @click="goToDetail(item.id,item.subName)"
  291. v-if="item.usersub == 1">
  292. 项目查看</view>
  293. <!-- 项目查看按钮 -->
  294. <view class="card-btn fat-btn project-btn" @click="goToDetail(item.id,item.subName)" v-else>项目查看
  295. </view>
  296. <!-- 关注按钮 -->
  297. <view class="card-btn fat-btn focus-btn" @click="changeFocus(item.id,item.isAttention)"
  298. v-if="!item.isAttention">关注</view>
  299. <view class="card-btn fat-btn focus-btn-no" @click="changeFocus(item.id,item.isAttention)" v-else>
  300. 取消关注</view>
  301. </view>
  302. <!-- 周月年报按钮 -->
  303. <view class="card-item bottom-item">
  304. <view class="card-btn thin-btn report-btn" @click="goToReport('weekly',item.id,item.subName)">周报
  305. </view>
  306. <view class="card-btn thin-btn report-btn" @click="goToReport('monthly',item.id,item.subName)">月报
  307. </view>
  308. <view class="card-btn thin-btn more-btn" @click="goToReport('more',item.id,item.subName)">更多操作
  309. </view>
  310. </view>
  311. <!-- 编号 -->
  312. <view class="card-fold-option"
  313. :class="item.status_fgw === '2' ? 'card-fold-red' :item.status_fgw === '1' ?'card-fold-yellow':''">
  314. <view class="card-fold-count">{{index + 1}} / {{listTotal}}</view>
  315. <view class="card-fold-center" @click.stop="changeFoldItem(false,item.id)">
  316. <view class="card-fold-btn card-unfold-btn"></view>
  317. </view>
  318. <view class="card-fold-chaos"></view>
  319. </view>
  320. </view>
  321. <!-- 折叠卡片 -->
  322. <view class="card-fold" v-else>
  323. {{item.subName ?? "--"}}
  324. <view class="card-fold-option"
  325. :class="item.status_fgw === '2' ? 'card-fold-red' :item.status_fgw === '1' ?'card-fold-yellow':''">
  326. <view class="card-fold-count">{{index + 1}} / {{listTotal}}</view>
  327. <view class="card-fold-center" @click.stop="changeFoldItem(true, item.id)">
  328. <view class="card-fold-btn"></view>
  329. </view>
  330. <view class="card-fold-chaos"></view>
  331. </view>
  332. </view>
  333. </view>
  334. <empty-show v-if="projectList.length===0"></empty-show>
  335. </view>
  336. <u-back-top :scroll-top="scrollTop"></u-back-top>
  337. <u-loading-page :loading="loading"></u-loading-page>
  338. </view>
  339. </template>
  340. <style lang="scss" scoped>
  341. .count-value {
  342. display: flex;
  343. flex-wrap: wrap;
  344. width: 100%;
  345. height: 200rpx;
  346. margin-bottom: 20rpx;
  347. background: linear-gradient(180deg, #FFFFFF 2%, #A5C6FF 100%);
  348. border-radius: 40rpx 40rpx 40rpx 40rpx;
  349. opacity: 1;
  350. border: 4rpx solid #fff;
  351. .count-item {
  352. display: flex;
  353. flex-direction: column;
  354. justify-content: center;
  355. width: 50%;
  356. height: 50%;
  357. text-align: center;
  358. .count-item-value {
  359. margin-bottom: 8rpx;
  360. font-size: 34rpx;
  361. font-weight: 500;
  362. color: #FF4000;
  363. }
  364. .count-special-value {
  365. color: #330DDF;
  366. }
  367. .count-item-description {
  368. font-size: 24rpx;
  369. color: #343437;
  370. }
  371. }
  372. }
  373. .order-by {
  374. display: flex;
  375. align-items: center;
  376. justify-content: space-between;
  377. width: 100%;
  378. height: 106rpx;
  379. margin-bottom: 34rpx;
  380. padding: 0 40rpx;
  381. border-radius: 40rpx;
  382. background: #FFF;
  383. .order-by-item {
  384. flex: 1;
  385. display: flex;
  386. justify-content: center;
  387. align-items: center;
  388. font-size: 32rpx;
  389. color: #343437;
  390. .order-by-icon {
  391. width: 22rpx;
  392. height: 46rpx;
  393. margin-left: 24rpx;
  394. background-image: url("@/static/orderBy-none.png");
  395. background-size: 100% 100%;
  396. }
  397. .desc {
  398. background-image: url("@/static/orderBy-desc.png");
  399. }
  400. .asc {
  401. background-image: url("@/static/orderBy-asc.png");
  402. }
  403. }
  404. }
  405. .card-box {
  406. padding: 0 36rpx 36rpx 36rpx;
  407. border-radius: 28rpx 28rpx 28rpx 28rpx;
  408. border: 2rpx solid #C2C9D4;
  409. }
  410. .project-btn {
  411. width: 48% !important;
  412. background: #1869F6;
  413. }
  414. .focus-btn {
  415. width: 48% !important;
  416. background-color: #fff;
  417. border-radius: 16rpx 16rpx 16rpx 16rpx;
  418. border: 3rpx solid #1869F6;
  419. color: #1869F6;
  420. }
  421. .focus-btn-no {
  422. width: 48% !important;
  423. background-color: #fff;
  424. border-radius: 16rpx 16rpx 16rpx 16rpx;
  425. border: 3rpx solid #FF2D2D;
  426. color: #FF2D2D;
  427. }
  428. .lamp {
  429. display: flex;
  430. justify-content: center;
  431. align-items: center;
  432. image {
  433. width: 72rpx;
  434. height: 72rpx;
  435. margin-right: 20rpx;
  436. }
  437. text {
  438. font-size: 32rpx;
  439. }
  440. }
  441. .card-box2 {
  442. padding: 0 0 36rpx 0;
  443. border-radius: 28rpx 28rpx 28rpx 28rpx;
  444. }
  445. .focusText {
  446. font-size: 12rpx;
  447. margin-right: 12rpx;
  448. }
  449. .card {
  450. padding-top: 16rpx;
  451. overflow: hidden;
  452. }
  453. .light-item {
  454. margin-bottom: 32rpx;
  455. }
  456. .card-light {
  457. display: flex;
  458. align-items: center;
  459. justify-content: center;
  460. }
  461. .card-light-bottom {
  462. width: 122rpx;
  463. height: 44rpx;
  464. margin: auto 0;
  465. background-size: 100% 100%;
  466. }
  467. .light-red {
  468. background-image: url('@/static/icon-light-red.png');
  469. }
  470. .light-yellow {
  471. background-image: url('@/static/icon-light-yellow.png');
  472. }
  473. .light-green {
  474. background-image: url('@/static/icon-light-green.png');
  475. }
  476. .focus {
  477. width: 46rpx;
  478. height: 40rpx;
  479. background-image: url("@/static/focus-off.png");
  480. background-size: 100% 100%;
  481. }
  482. .focus-on {
  483. background-image: url("@/static/focus-on.png");
  484. }
  485. .more-btn {
  486. background-color: #fff;
  487. color: #1869F6;
  488. font-size: 32rpx;
  489. }
  490. .special-btn {
  491. width: 48% !important;
  492. background: linear-gradient(225deg, #2428F1 0%, #12C8C2 94%);
  493. }
  494. .bottom-item {
  495. display: flex;
  496. flex-wrap: wrap;
  497. justify-content: space-between;
  498. align-content: flex-start;
  499. row-gap: 20rpx;
  500. margin-bottom: 64rpx;
  501. }
  502. .card-value {
  503. position: absolute;
  504. bottom: 0;
  505. right: 50%;
  506. transform: translate(50%);
  507. width: 255rpx;
  508. height: 68rpx;
  509. padding-right: 22rpx;
  510. text-align: center;
  511. line-height: 68rpx;
  512. color: #1869F6;
  513. font-size: 32rpx;
  514. background: linear-gradient(90deg, rgba(211, 227, 255, 0) 0%, rgba(178, 206, 255, 0.5548) 54%, rgba(219, 232, 255, 0) 100%);
  515. }
  516. .card-fold {
  517. position: relative;
  518. width: 100%;
  519. min-height: 152rpx;
  520. margin-bottom: 20rpx;
  521. padding: 24rpx 30rpx 52rpx;
  522. box-sizing: border-box;
  523. background: #FFFFFF;
  524. border-radius: 40rpx;
  525. overflow: hidden;
  526. }
  527. .card-fold-option {
  528. position: absolute;
  529. display: flex;
  530. justify-content: space-between;
  531. align-items: center;
  532. left: 0;
  533. bottom: 0;
  534. width: 100%;
  535. height: 38rpx;
  536. padding: 0 40rpx;
  537. box-sizing: border-box;
  538. background: linear-gradient(270deg, #CADDFF 4%, rgba(219, 232, 255, 0) 100%);
  539. z-index: 999;
  540. .card-fold-count {
  541. flex: 1;
  542. font-size: 28rpx;
  543. color: #1869F6;
  544. }
  545. .card-fold-center {
  546. flex: 1;
  547. .card-fold-btn {
  548. width: 32rpx;
  549. height: 20rpx;
  550. margin: 0 auto;
  551. background-image: url("@/static/icon-fold.png");
  552. background-size: 100% 100%;
  553. }
  554. .card-unfold-btn {
  555. transform: rotate(180deg);
  556. }
  557. }
  558. .card-fold-chaos {
  559. flex: 1;
  560. }
  561. }
  562. .card-fold-red {
  563. background: linear-gradient(270deg, #FF8080 0%, rgba(219, 232, 255, 0) 100%);
  564. .card-fold-count {
  565. color: #FF0000;
  566. }
  567. .card-fold-center {
  568. .card-fold-btn {
  569. background-image: url("@/static/icon-fold-red.png");
  570. }
  571. }
  572. }
  573. .card-fold-yellow {
  574. background: linear-gradient(270deg, #FFAA00 4%, rgba(219, 232, 255, 0) 100%);
  575. .card-fold-count {
  576. color: #E19703;
  577. }
  578. .card-fold-center {
  579. .card-fold-btn {
  580. background-image: url("@/static/icon-fold-yellow.png");
  581. }
  582. }
  583. }
  584. </style>