doubleCarbonOverview.vue 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233
  1. <script>
  2. import Card from "@/components/common/card.vue";
  3. import CoreData from "@/components/common/coreData.vue";
  4. import Query from "@/components/common/query.vue";
  5. import CarbonEmissionCharts from "@/components/doubleCarbon/overview/charts/carbonEmissionChart.vue";
  6. import CarbonQuotaChart from "@/components/doubleCarbon/overview/charts/carbonQuotaChart.vue";
  7. import DoubleCarbonNews from "@/components/doubleCarbon/overview/charts/doubleCarbonNews.vue";
  8. import CarbonOverviewPercent from "@/components/doubleCarbon/overview/charts/carbonOverviewPercent.vue";
  9. import apiCarbonOverview from "@/api/carbon/apiCarbonOverview";
  10. export default {
  11. components: {
  12. Card,
  13. CoreData,
  14. Query,
  15. CarbonEmissionCharts,
  16. CarbonQuotaChart,
  17. DoubleCarbonNews,
  18. CarbonOverviewPercent,
  19. },
  20. data() {
  21. return {
  22. queryData: {
  23. companyId: "0",
  24. timeRange: this.$util.dateUtil.getNearlyMonthRange(),
  25. },
  26. companyOptions: [],
  27. coreData: [
  28. {
  29. title: "碳配额存量",
  30. num: 0,
  31. unit: '%',
  32. historyDesc: "同比",
  33. historyNum: 0,
  34. },
  35. {
  36. title: "碳排放总量(tco2e)",
  37. num: 0,
  38. historyDesc: "同比",
  39. historyNum: 0,
  40. },
  41. {
  42. title: "单位面积碳排放(tco2e/m²)",
  43. num: 0,
  44. historyDesc: "同比",
  45. historyNum: 0,
  46. },
  47. {
  48. title: "人均碳排放(tco2e/人)",
  49. num: 0,
  50. historyDesc: "同比",
  51. historyNum: 0,
  52. },
  53. {
  54. title: "光伏减排(tco2e)",
  55. num: 0,
  56. historyDesc: "同比",
  57. historyNum: 0,
  58. },
  59. {
  60. type: 1,
  61. title: "值得关注",
  62. showStar: true,
  63. content: "",
  64. },
  65. ],
  66. newsData: [],
  67. };
  68. },
  69. mounted() {
  70. this.init();
  71. },
  72. methods: {
  73. init() {
  74. this.$util.asyncPromise(this.getCoreData(), this.getNewsData());
  75. },
  76. reset() {},
  77. search(data) {
  78. this.$util.asyncPromise(
  79. this.getCoreData(),
  80. this.getNewsData(),
  81. this.$refs.CarbonEmissionCharts.getData(),
  82. this.$refs.CarbonQuotaChart.getData(),
  83. this.$refs.CarbonOverviewPercent.getData()
  84. );
  85. },
  86. getCoreData() {
  87. return apiCarbonOverview.getCoreData(this.queryData).then((res) => {
  88. this.coreData[0].num = res.list[0].value;
  89. //this.coreData[0].historyNum = res.list[0].compare;
  90. this.coreData[1].num = res.list[1].value;
  91. this.coreData[1].historyNum = res.list[1].compare;
  92. this.coreData[2].num = res.list[2].value;
  93. this.coreData[2].historyNum = res.list[2].compare;
  94. this.coreData[3].num = res.list[3].value;
  95. this.coreData[3].historyNum = res.list[3].compare;
  96. this.coreData[4].num = res.list[4].value;
  97. this.coreData[4].historyNum = res.list[4].compare;
  98. this.coreData[5].content = res.worthAttention;
  99. });
  100. },
  101. getNewsData() {
  102. let params = {
  103. timeRange: {
  104. startDate: '2022/04/25',
  105. endDate: '2022/06/07'
  106. }
  107. }
  108. return apiCarbonOverview.getCarbonNews(params).then((res) => {
  109. this.newsData = res;
  110. });
  111. },
  112. },
  113. };
  114. </script>
  115. <template>
  116. <div class="doubleCarbon-overview">
  117. <div class="page-query-core">
  118. <a-row>
  119. <a-col
  120. style="
  121. background: #fff;
  122. height: 60px;
  123. padding: 10px;
  124. border-radius: 5px;
  125. margin-bottom: 10px;
  126. "
  127. >
  128. <div style="width: 100%">
  129. <Query
  130. :show="['company', 'time']"
  131. :query-data.sync="queryData"
  132. :reset="reset"
  133. :search="search"
  134. :company-options="companyOptions"
  135. ></Query>
  136. </div>
  137. </a-col>
  138. <a-col>
  139. <div style="width: 100%">
  140. <Card title="核心指标">
  141. <CoreData :data-list="coreData"></CoreData>
  142. </Card>
  143. </div>
  144. </a-col>
  145. </a-row>
  146. </div>
  147. <div style="margin-top: 12px">
  148. <a-row :gutter="[12, 12]">
  149. <a-col :span="18">
  150. <div class="ioc-card-content">
  151. <Card title="碳排放分析">
  152. <div class="doubleCarbon-overview-analyse">
  153. <CarbonEmissionCharts
  154. ref="CarbonEmissionCharts"
  155. :query-data="queryData"
  156. :height="450"
  157. />
  158. </div>
  159. </Card>
  160. </div>
  161. </a-col>
  162. <a-col :span="6">
  163. <div class="ioc-card-content">
  164. <Card title="碳配额构成">
  165. <div class="doubleCarbon-overview-quota">
  166. <CarbonQuotaChart
  167. ref="CarbonQuotaChart"
  168. :query-data="queryData"
  169. :height="450"
  170. />
  171. </div>
  172. </Card>
  173. </div>
  174. </a-col>
  175. <a-col :span="18">
  176. <div class="ioc-card-content">
  177. <Card title="双碳新闻">
  178. <div style="width: 97%; margin: 0 auto">
  179. <a-divider style="margin: 0; padding: 0"></a-divider>
  180. </div>
  181. <div class="doubleCarbon-overview-news">
  182. <div style="height: 280px;overflow-y: auto">
  183. <DoubleCarbonNews :data="newsData" />
  184. </div>
  185. </div>
  186. </Card>
  187. </div>
  188. </a-col>
  189. <a-col :span="6">
  190. <div class="ioc-card-content">
  191. <Card title="碳排放占比">
  192. <div class="doubleCarbon-overview-percent">
  193. <CarbonOverviewPercent
  194. ref="CarbonOverviewPercent"
  195. :query-data="queryData"
  196. :height="300"
  197. />
  198. </div>
  199. </Card>
  200. </div>
  201. </a-col>
  202. </a-row>
  203. </div>
  204. </div>
  205. </template>
  206. <style lang="less" scoped>
  207. .doubleCarbon-overview {
  208. width: 100%;
  209. height: auto;
  210. padding-bottom: 15px;
  211. vertical-align: top;
  212. .doubleCarbon-overview-analyse {
  213. padding: 12px;
  214. }
  215. .doubleCarbon-overview-quota {
  216. padding: 12px;
  217. }
  218. .doubleCarbon-overview-news {
  219. padding: 0 12px;
  220. height: 300px;
  221. }
  222. .doubleCarbon-overview-percent {
  223. padding: 0 12px;
  224. height: 300px;
  225. }
  226. }
  227. </style>