index.vue 14 KB

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