doubleCarbonOverview.vue 8.0 KB

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