DataBorad.vue 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224
  1. <script setup>
  2. import { ref, computed } from 'vue';
  3. const props = defineProps({
  4. data: {
  5. type: Object,
  6. required: {}
  7. }
  8. })
  9. const avgEnum = {
  10. "-1" : "低于",
  11. "0" : "持平",
  12. "1" : "高于"
  13. }
  14. const boardList = ref([
  15. {
  16. label: '总碳排放量',
  17. key: 'ztTotalCo2',
  18. hbKey: 'ztTotalCo2Hb',
  19. desc: '环比上月',
  20. unit: 't CO₂-eq',
  21. value: ''
  22. },
  23. {
  24. label: '污水厂行业碳排放强度',
  25. key: 'wschytpfqd',
  26. hbKey: 'wschytpfqdHb',
  27. strong: true,
  28. desc: '同行业平均水平',
  29. unit: 'Kg CO₂-eq/m³',
  30. value: ''
  31. },
  32. {
  33. label: '替碳、碳汇',
  34. key: 'ttthTotalCo2',
  35. hbKey: 'ttthTotalCo2Hb',
  36. desc: '环比上月',
  37. unit: 't CO₂-eq',
  38. value: ''
  39. },
  40. {
  41. label: '污水 - 生化反应',
  42. key: 'wsclTotalCo2',
  43. hbKey: 'wsclTotalCo2Hb',
  44. desc: '环比上月',
  45. unit: 't CO₂-eq',
  46. value: ''
  47. },
  48. {
  49. label: '能源、药剂',
  50. key: 'nyyjTotalCo2',
  51. hbKey: 'nyyjTotalCo2Hb',
  52. desc: '环比上月',
  53. unit: 't CO₂-eq',
  54. value: ''
  55. },
  56. {
  57. label: '污泥 - 生化反应',
  58. key: 'wnclTotalCo2',
  59. hbKey: 'wnclTotalCo2Hb',
  60. desc: '环比上月',
  61. unit: 't CO₂-eq',
  62. value: ''
  63. },
  64. ]);
  65. </script>
  66. <template>
  67. <div class="data-board-view">
  68. <div class="board-item" v-for="item, index in boardList" :key="item.key">
  69. <p class="title">{{ item.label }}</p>
  70. <p class="statement">
  71. <span class="num">{{ data[item.key] }} </span>
  72. <span class="unit"> {{ item.unit }}</span>
  73. </p>
  74. <div class="info-wrapper">
  75. <p class="desc">
  76. <span v-if="item.strong">
  77. <strong class="text-[#e5773f]">{{ avgEnum[data.exceedAvgHY] }}</strong>
  78. <span>{{ item.desc }}</span>
  79. </span>
  80. <span v-else>{{ item.desc }}</span>
  81. </p>
  82. <p :class="['info', 'space-x-[5px]', { down: data[item.hbKey] < 0 }]" v-if="index !== 1">
  83. <span class="num">{{ data[item.hbKey] ?? '-'}} %</span>
  84. <span class="icon" v-if="data[item.hbKey]"></span>
  85. </p>
  86. </div>
  87. </div>
  88. </div>
  89. </template>
  90. <style lang="scss" scoped>
  91. @mixin bg-img ($url) {
  92. background: url($url) 80% 10% no-repeat,
  93. url("@/assets/images/carbon/bg-board-bottom.png") center bottom no-repeat,
  94. url("@/assets/images/carbon/bg-board-right.png") right bottom no-repeat,
  95. linear-gradient(180deg, #0C1E3C 0%, #132B51 100%);
  96. }
  97. .data-board-view {
  98. display: grid;
  99. grid-template-columns: repeat(3, 1fr);
  100. grid-template-rows: repeat(2, 1fr);
  101. grid-gap: 20px;
  102. .board-item {
  103. position: relative;
  104. @include flex(y, start, between);
  105. padding: 40px 0 10px 20px;
  106. border-radius: 8px;
  107. &:nth-child(1) {
  108. @include bg-img("@/assets/images/carbon/svg/icon-borad-one.svg");
  109. background-size: auto, 100%;
  110. }
  111. &:nth-child(2) {
  112. @include bg-img("@/assets/images/carbon/svg/icon-borad-two.svg");
  113. background-size: auto, 100%;
  114. }
  115. &:nth-child(3) {
  116. @include bg-img("@/assets/images/carbon/svg/icon-borad-three.svg");
  117. background-size: auto, 100%;
  118. }
  119. &:nth-child(4) {
  120. @include bg-img("@/assets/images/carbon/svg/icon-borad-four.svg");
  121. background-size: auto, 100%;
  122. }
  123. &:nth-child(5) {
  124. @include bg-img("@/assets/images/carbon/svg/icon-borad-five.svg");
  125. background-size: auto, 100%;
  126. }
  127. &:nth-child(6) {
  128. @include bg-img("@/assets/images/carbon/svg/icon-borad-six.svg");
  129. background-size: auto, 100%;
  130. }
  131. &::after, &::before {
  132. content: ' ';
  133. position: absolute;
  134. left: -2px;
  135. display: block;
  136. width: calc(100% + 4px);
  137. height: 18px;
  138. }
  139. &::before {
  140. top: 0px;
  141. background: url("@/assets/images/carbon/svg/icon-top-left.svg") left center no-repeat,
  142. url("@/assets/images/carbon/svg/icon-top-right.svg") right center no-repeat;
  143. }
  144. &::after {
  145. bottom: 0px;
  146. background: url("@/assets/images/carbon/svg/icon-bottom-left.svg") left center no-repeat,
  147. url("@/assets/images/carbon/svg/icon-bottom-right.svg") right center no-repeat;
  148. }
  149. .title {
  150. height: 40px;
  151. font-size: 14px;
  152. line-height: 20px;
  153. color: #fff;
  154. }
  155. &:nth-child(2) {
  156. .title {
  157. width: 80px;
  158. }
  159. }
  160. .statement {
  161. color: #FFF;
  162. text-shadow: 0px 0px 6.3px #C9FDF3;
  163. .num {
  164. line-height: 20px;
  165. font-family: 'D-DIN-PRO-700-Bold';
  166. font-size: 32px;
  167. font-weight: bold;
  168. }
  169. .unit {
  170. font-size: 12px;
  171. }
  172. }
  173. .info-wrapper {
  174. height: 38px;
  175. line-height: 16px;
  176. .desc {
  177. line-height: 22px;
  178. color: rgba(255, 255, 255, 0.5);
  179. }
  180. }
  181. .info {
  182. @include flex(x, center, start);
  183. .num {
  184. font-family: 'D-DIN-PRO-700-Bold';
  185. font-size: 18px;
  186. font-weight: bold;
  187. color: rgba(0, 255, 0, 1);
  188. }
  189. .icon {
  190. width: 14px;
  191. height: 8px;
  192. background: url('@/assets/images/carbon/svg/icon-up.svg') no-repeat;
  193. }
  194. }
  195. .down {
  196. .num {
  197. color: #e9672c;
  198. }
  199. .icon {
  200. background: url('@/assets/images/carbon/svg/icon-down.svg') no-repeat;
  201. transform: rotate(60deg);
  202. }
  203. }
  204. }
  205. }
  206. </style>