index.vue 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253
  1. <template>
  2. <HcCard ui="hc-count-card-ui" body-ui="hc-count-card">
  3. <div id="hc-count-tree" class="hc-count-tree">
  4. <el-scrollbar>
  5. <HcTreeData :is-menu="false" @nodeTap="treeNodeTap" />
  6. </el-scrollbar>
  7. </div>
  8. <div id="hc-count-body" class="hc-count-body">
  9. <el-scrollbar>
  10. <div class="hc-count-echarts-1">
  11. <el-row :gutter="14">
  12. <el-col :span="10">
  13. <HcCardItem title="面积进度柱状图统计" style="height: 440px">
  14. <BarLabelEcharts :lables="planLables" :color="planColors" :datas="planDatas" />
  15. </HcCardItem>
  16. </el-col>
  17. <el-col :span="14">
  18. <HcCardItem title="面积进度" style="height: 160px">
  19. <el-row :gutter="20" class="h-full">
  20. <el-col :span="6">
  21. <div class="hc-count-area-progress">
  22. <div class="num">
  23. {{ progress[0] || 0 }}
  24. </div>
  25. <div class="text">
  26. 已签协议面积(亩)
  27. </div>
  28. </div>
  29. </el-col>
  30. <el-col :span="6">
  31. <div class="hc-count-area-progress">
  32. <div class="num">
  33. {{ progress[1] || 0 }}
  34. </div>
  35. <div class="text">
  36. 已签协议比例
  37. </div>
  38. </div>
  39. </el-col>
  40. <el-col :span="6">
  41. <div class="hc-count-area-progress">
  42. <div class="num">
  43. {{ progress[2] || 0 }}
  44. </div>
  45. <div class="text">
  46. 已结算面积(亩)
  47. </div>
  48. </div>
  49. </el-col>
  50. <el-col :span="6">
  51. <div class="hc-count-area-progress">
  52. <div class="num">
  53. {{ progress[3] || 0 }}
  54. </div>
  55. <div class="text">
  56. 已结算比例
  57. </div>
  58. </div>
  59. </el-col>
  60. </el-row>
  61. </HcCardItem>
  62. <HcCardItem title="金额进度" style="height: 266px; margin-top: 14px">
  63. <BarLabelEcharts :lables="planLables1" :color="planColors1" :datas="planDatas1" />
  64. </HcCardItem>
  65. </el-col>
  66. </el-row>
  67. </div>
  68. <HcCardItem title="结算统计图(单位:元)" style="height: 440px; margin-top: 14px">
  69. <stackEcharts />
  70. </HcCardItem>
  71. </el-scrollbar>
  72. </div>
  73. </HcCard>
  74. </template>
  75. <script setup>
  76. import { onMounted, onUnmounted, ref } from 'vue'
  77. import BarLabelEcharts from '~com/echarts/BarLabel.vue'
  78. import stackEcharts from '~com/echarts/stackEcharts.vue'
  79. import split from 'split.js'
  80. import countApi from '~api/count/index.js'
  81. import { getArrValue } from 'js-fast-way'
  82. import { useAppStore } from '~src/store'
  83. const useAppState = useAppStore()
  84. const projectId = ref(useAppState.getProjectId)
  85. //树节点被点击
  86. const treeNodeTap = ({ node, data }) => {
  87. areaId.value = data.id
  88. getAreProgress()
  89. getPlanDatas()
  90. getPlanDatas1()
  91. }
  92. //渲染完成
  93. onMounted(() => {
  94. setSplitDom()
  95. })
  96. //获取面积进度
  97. const areaId = ref('')
  98. const progress = ref([])
  99. const getAreProgress = async () => {
  100. const { error, code, data } = await countApi.getStatArea({
  101. projectId: projectId.value,
  102. areaId:areaId.value,
  103. })
  104. if (!error && code === 200) {
  105. progress.value = getArrValue(data)
  106. } else {
  107. progress.value = []
  108. }
  109. }
  110. // 初始化设置拖动分割线
  111. const splitvar = ref(null)
  112. const setSplitDom = () => {
  113. try {
  114. //配置参考: https://split.js.org/#/?direction=vertical&snapOffset=0
  115. splitvar.value = split([
  116. '#hc-count-tree',
  117. '#hc-count-body',
  118. ], {
  119. sizes: [20, 80],
  120. minSize: [200, 900],
  121. })
  122. } catch (e) {
  123. setTimeout(() => {
  124. setSplitDom()
  125. }, 500)
  126. }
  127. }
  128. //面积进度柱状图统计
  129. const planColors = ['#D97558', '#E4C476']
  130. const planLables = ref(['农用地', '建设用地', '未利用地'])
  131. const planDatas = ref([
  132. // {
  133. // name: '已签面积',
  134. // value: [1200, 132, 501],
  135. // },
  136. // {
  137. // name: '设计面积',
  138. // value: [120, 432, 1001],
  139. // },
  140. ])
  141. //获取面积柱状图统计
  142. const getPlanDatas = async () => {
  143. const { error, code, data } = await countApi.getstatAreaPicture({
  144. projectId: projectId.value,
  145. areaId:areaId.value,
  146. })
  147. if (!error && code === 200) {
  148. planDatas.value = getArrValue(data)
  149. } else {
  150. planDatas.value = []
  151. }
  152. }
  153. //金额进度
  154. const planColors1 = ['#7F83F6', '#81B336', '#E99D43']
  155. const planLables1 = ref(['征地补偿', '专项设施', '青苗', '坟地补偿', '地上附着物'])
  156. const planDatas1 = ref([
  157. // {
  158. // name: '实际补助总金额',
  159. // value: [1200, 132, 501, 323, 654],
  160. // },
  161. // {
  162. // name: '设计补助总金额',
  163. // value: [120, 432, 1001, 111, 987],
  164. // },
  165. // {
  166. // name: '已结算总金额',
  167. // value: [120, 432, 1001, 323, 654],
  168. // },
  169. ])
  170. //获取金额进度
  171. const getPlanDatas1 = async () => {
  172. const { error, code, data } = await countApi.getStatMoney({
  173. projectId: projectId.value,
  174. areaId:areaId.value,
  175. })
  176. if (!error && code === 200) {
  177. planDatas1.value = getArrValue(data)
  178. } else {
  179. planDatas1.value = []
  180. }
  181. }
  182. //销毁
  183. onUnmounted(() => {
  184. if (splitvar.value) {
  185. splitvar.value.destroy()
  186. }
  187. })
  188. </script>
  189. <style lang="scss" scoped>
  190. .hc-count-body .hc-count-echarts-1 {
  191. position: relative;
  192. overflow: hidden;
  193. }
  194. </style>
  195. <style lang="scss">
  196. .hc-count-card-ui {
  197. background: white;
  198. .el-card__body {
  199. padding: 10px;
  200. }
  201. }
  202. .hc-count-card {
  203. display: flex;
  204. .hc-count-tree {
  205. position: relative;
  206. margin-right: 5px;
  207. height: 100%;
  208. }
  209. .hc-count-body {
  210. position: relative;
  211. margin-left: 5px;
  212. height: 100%;
  213. .hc-card-item-box {
  214. background: #f5f5f5;
  215. .hc-card-item-header {
  216. color: #101010;
  217. }
  218. }
  219. }
  220. .hc-count-area-progress {
  221. position: relative;
  222. height: 100%;
  223. background: #ffffff;
  224. border-radius: 5px;
  225. display: flex;
  226. align-items: center;
  227. justify-content: center;
  228. .num {
  229. margin-bottom: 18px;
  230. font-size: 20px;
  231. }
  232. .text {
  233. position: absolute;
  234. bottom: 10px;
  235. font-size: 14px;
  236. }
  237. }
  238. }
  239. </style>