index.vue 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451
  1. <script setup>
  2. import {
  3. ref
  4. } from 'vue'
  5. import {
  6. onLoad,
  7. onUnload
  8. } from "@dcloudio/uni-app"
  9. import {
  10. getfundPlanDetail,
  11. } from "@/api/work/countAnalysis.js"
  12. import {
  13. goToPage
  14. } from "@/utils/common.js"
  15. function backToBefore() {
  16. uni.reLaunch({
  17. url: "/pages/index"
  18. });
  19. };
  20. function searchClick() {
  21. goToPage('/pages/countAnalysis/search/index?page=fundPlanSearch')
  22. }
  23. let dataList = ref([{
  24. name: '项目总数',
  25. key: "projectsNum",
  26. count: "",
  27. throughKey: null,
  28. }, {
  29. name: '项目前期数',
  30. key: 'XMQQ',
  31. count: "",
  32. throughKey: 1,
  33. }, {
  34. name: '待开工项目数',
  35. key: 'DKG',
  36. count: "",
  37. throughKey: 6,
  38. }, {
  39. name: '施工阶段数',
  40. key: 'SGJD',
  41. count: "",
  42. throughKey: 7,
  43. },
  44. {
  45. name: '暂停施工数',
  46. key: 'ZTSG',
  47. count: "",
  48. throughKey: 8,
  49. }, {
  50. name: '已完工项目数',
  51. key: 'YWG',
  52. count: "",
  53. throughKey: "A",
  54. }
  55. ])
  56. // 柱状图
  57. let opts = {
  58. color: ["#1869F6", "#90B5F4"],
  59. touchMoveLimit: 24,
  60. enableScroll: true,
  61. dataLabel: false,
  62. legend: {
  63. show: false
  64. },
  65. xAxis: {
  66. disableGrid: true,
  67. scrollShow: true,
  68. itemCount: 8,
  69. },
  70. yAxis: {
  71. showTitle: true,
  72. data: [{
  73. min: 0,
  74. title: "单位:万元",
  75. }]
  76. },
  77. extra: {
  78. column: {
  79. type: "group",
  80. width: 14,
  81. barBorderRadius: [12, 12, 12, 12],
  82. activeBgColor: "#000000",
  83. activeBgOpacity: 0.08,
  84. }
  85. }
  86. }
  87. let chartData = ref({
  88. categories: [],
  89. series: [{
  90. name: "月统计金额",
  91. data: []
  92. }]
  93. })
  94. let showBar = ref(false)
  95. let fullData = ref({})
  96. function filterData(data) {
  97. // 所有数据
  98. fullData.value = data
  99. // 上面六个数
  100. for (let i in dataList.value) {
  101. if (typeof(data[dataList.value[i].key]) === 'number') {
  102. dataList.value[i].count = data[dataList.value[i].key].toString() ?? "--"
  103. } else {
  104. dataList.value[i].count = data[dataList.value[i].key] ?? "--"
  105. }
  106. }
  107. // ucharts数
  108. let categoriesList = []
  109. let seriesList = []
  110. for (let i in data.listMonthAmt) {
  111. categoriesList.push(data.listMonthAmt[i].month + "月")
  112. seriesList.push(data.listMonthAmt[i].amtYear)
  113. }
  114. chartData.value.categories = categoriesList.length > 0 ? categoriesList : ["无数据"]
  115. chartData.value.series[0].data = seriesList
  116. showBar.value = true
  117. }
  118. let projectYear = ref(null);
  119. let yearShow = ref(false);
  120. let defaultIndex = ref([0]);
  121. let yearColumns = ref([
  122. ["2000", "2001", "2002", "2003", "2004", "2005", "2006", "2007", "2008", "2009", "2010", "2011", "2012",
  123. "2013",
  124. "2014", "2015", "2016", "2017", "2018", "2019", "2020", "2021", "2022", "2023", "2024", "2025", "2026",
  125. "2027", "2028", "2029", "2030", "2031", "2032", "2033"
  126. ]
  127. ])
  128. const yearShowChoose = () => {
  129. yearShow.value = true;
  130. }
  131. const yearClose = e => {
  132. if (e) {
  133. projectYear.value = e.value[0];
  134. getPageDate();
  135. }
  136. yearShow.value = false;
  137. }
  138. let searchData = ref({});
  139. const getPageDate = () => {
  140. let params = Object.assign({}, searchData.value, {
  141. year: projectYear.value
  142. })
  143. getfundPlanDetail(params).then(res => {
  144. filterData(res.data)
  145. });
  146. }
  147. // 穿透--项目
  148. const throughToDetail = clickStatus => {
  149. // 隐藏
  150. let isHideObj = {
  151. isHide: searchData.value.containHide ? null : 0
  152. }
  153. if ((searchData.value.containHide ?? "") === "") isHideObj.isHide = null;
  154. let params = Object.assign(isHideObj, searchData.value, {
  155. year: projectYear.value,
  156. status: clickStatus,
  157. })
  158. // 状态
  159. if (clickStatus !== null) {
  160. // 如果点击的不是总数
  161. if (searchData.value.status && searchData.value.status !== clickStatus) {
  162. // 如果已选且与点击的不一样
  163. params.status = -1;
  164. }
  165. } else {
  166. params.status = searchData.value.status;
  167. }
  168. uni.$u.route({
  169. url: "/pages/countAnalysis/fundPlan/through/index",
  170. params
  171. })
  172. }
  173. // 穿透--问题
  174. const throughWithQuestion = () => {
  175. let searchYear = searchData.value.year ? searchData.value.year : projectYear.value;
  176. let beginDateStart = `${searchYear}/01/01`;
  177. let beginDateEnd = `${searchYear}/12/31`;
  178. uni.$u.route({
  179. url: "/pages/oversee/index",
  180. params: {
  181. beginDate: beginDateStart,
  182. endDate: beginDateEnd,
  183. status: searchData.value.status,
  184. subName: searchData.value.subName,
  185. indusKind: searchData.value.indusKind,
  186. containHide: searchData.value.containHide,
  187. kind: searchData.value.kind,
  188. }
  189. })
  190. }
  191. // 穿透--金额
  192. const throughWithAmt = key => {
  193. let url = "/pages/countAnalysis/through/index?key=" + key + "&";
  194. let params = Object.assign({}, searchData.value);
  195. if (searchData.value.year) {
  196. params = Object.assign(params, {
  197. year: projectYear.value
  198. });
  199. }
  200. // 隐藏
  201. let isHideObj = {
  202. isHide: searchData.value.containHide ? null : 0
  203. }
  204. if ((searchData.value.containHide ?? "") === "") isHideObj.isHide = null;
  205. params = Object.assign(params, isHideObj);
  206. Object.keys(params).forEach((key) => {
  207. let value = params[key];
  208. if ((value ?? "") === "") delete params[key]
  209. })
  210. for (let i in params) {
  211. let item = null
  212. if (!((params[i] ?? "") === "")) {
  213. item = `${i}=${params[i]}&`;
  214. } else {
  215. item = `${i}=&`;
  216. }
  217. url = url += item;
  218. }
  219. if (!searchData.value.year) {
  220. url = `${url}year=${projectYear.value}`
  221. }
  222. uni.navigateTo({
  223. url
  224. })
  225. }
  226. onLoad(() => {
  227. uni.$on('fundPlanSearch', resolve => {
  228. let optionFilter = Object.assign({}, resolve);
  229. let filterArr = ["null", "undefined", ""];
  230. for (let i in optionFilter) {
  231. if (filterArr.includes(optionFilter[i])) {
  232. optionFilter[i] = null;
  233. }
  234. }
  235. if (optionFilter.year) {
  236. projectYear.value = optionFilter.year;
  237. defaultIndex.value = [projectYear.value - 2000];
  238. }
  239. searchData.value = optionFilter;
  240. getfundPlanDetail(optionFilter).then(res => {
  241. filterData(res.data)
  242. });
  243. });
  244. projectYear.value = new Date().getFullYear();
  245. defaultIndex.value = [projectYear.value - 2000];
  246. getPageDate();
  247. });
  248. onUnload(() => {
  249. uni.$off('fundPlanSearch');
  250. })
  251. </script>
  252. <template>
  253. <view class="container">
  254. <page-title @searchClick='searchClick' showSearch>资金计划</page-title>
  255. <view class="main">
  256. <view class="choose-year" @click="yearShowChoose()">
  257. 年度:{{projectYear}}
  258. <u-icon name="arrow-right" color="#000" size="14" customStyle="margin-left:5rpx"></u-icon>
  259. </view>
  260. <view class="count">
  261. <u-grid :border="false" col="3">
  262. <u-grid-item v-for="(item,index) in dataList" :key="index">
  263. <view class="count-item" @click="throughToDetail(item.throughKey)">
  264. <view class="count-item-num">{{item.count}}个</view>
  265. <view class="count-item-name">{{item.name}}</view>
  266. </view>
  267. </u-grid-item>
  268. </u-grid>
  269. </view>
  270. <view class="status">
  271. <view class="status-item question-num" @click="throughWithQuestion()">
  272. <view class="status-item-name">问题项目数</view>
  273. <view class="status-item-num">{{fullData.problemNum}}个</view>
  274. </view>
  275. <view class="status-item year-plan" @click="throughWithAmt('yearAmt')">
  276. <view class="status-item-name">年度计划总金额(万元)</view>
  277. <view class="status-item-num">{{fullData.yearAmt}}</view>
  278. </view>
  279. <view class="status-item real-cost" @click="throughWithAmt('compAmt')">
  280. <view class="status-item-name">实际投入总金额(万元)</view>
  281. <view class="status-item-num">{{fullData.compAmt}}</view>
  282. </view>
  283. </view>
  284. <view class="charts" v-if="showBar">
  285. <qiun-data-charts type="line" :opts="opts" :ontouch="true" :chartData="chartData" />
  286. </view>
  287. <view class="charts-description">月度实际投资情况</view>
  288. </view>
  289. <!-- 年度选择 -->
  290. <u-picker :show="yearShow" :defaultIndex="defaultIndex" :columns="yearColumns" @confirm="yearClose"
  291. @cancel="yearClose" @close="yearClose" closeOnClickOverlay></u-picker>
  292. </view>
  293. </template>
  294. <style lang="scss" scoped>
  295. .container {
  296. background: #fff;
  297. }
  298. .main {
  299. position: absolute;
  300. top: 10%;
  301. left: 0;
  302. width: 100%;
  303. height: 95%;
  304. padding: 40rpx 4%;
  305. background-color: #fff;
  306. }
  307. .choose-year {
  308. display: flex;
  309. align-items: center;
  310. justify-content: flex-end;
  311. font-size: 32rpx;
  312. font-weight: 500;
  313. color: #000;
  314. }
  315. .count {
  316. width: 100%;
  317. height: 300rpx;
  318. margin-top: 34rpx;
  319. .count-item {
  320. display: flex;
  321. flex-direction: column;
  322. justify-content: space-evenly;
  323. width: 100%;
  324. height: 150rpx;
  325. text-align: center;
  326. .count-item-num {
  327. font-size: 40rpx;
  328. font-weight: 500;
  329. color: #343437;
  330. }
  331. .count-item-name {
  332. font-size: 32rpx;
  333. color: #9E9E9E;
  334. }
  335. }
  336. }
  337. .status {
  338. display: flex;
  339. justify-content: space-between;
  340. width: 100%;
  341. height: 192rpx;
  342. margin-top: 68rpx;
  343. .status-item {
  344. display: flex;
  345. flex-direction: column;
  346. justify-content: space-between;
  347. width: 30%;
  348. height: 100%;
  349. padding: 30rpx;
  350. border-radius: 40rpx;
  351. .status-item-name {
  352. font-size: 24rpx;
  353. }
  354. .status-item-num {
  355. // word-break: break-all;
  356. font-size: 26rpx;
  357. text-align: left;
  358. font-weight: 500;
  359. }
  360. }
  361. .question-num {
  362. background: #E3E1FF;
  363. color: #1869F6;
  364. }
  365. .year-plan {
  366. background: #DFFFF9;
  367. color: #00B893
  368. }
  369. .real-cost {
  370. background: #FFECE5;
  371. color: #FF530F;
  372. }
  373. }
  374. .charts {
  375. width: 100%;
  376. height: 508rpx;
  377. margin-top: 100rpx;
  378. }
  379. .charts-description {
  380. width: 100%;
  381. margin-top: 34rpx;
  382. text-align: center;
  383. font-size: 32rpx;
  384. font-weight: 500;
  385. color: #343437;
  386. }
  387. </style>