doubleCarbonPv.vue 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210
  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 CarbonPvEmissionChart from "@/components/doubleCarbon/PV/charts/carbonPvEmissionChart.vue";
  6. import CarbonPvQuotaChart from "@/components/doubleCarbon/PV/charts/carbonPvQuotaChart.vue";
  7. import apiCarbonPv from "@/api/carbon/apiCarbonPv";
  8. export default {
  9. components: {
  10. Card,
  11. CoreData,
  12. Query,
  13. CarbonPvEmissionChart,
  14. CarbonPvQuotaChart,
  15. },
  16. data() {
  17. return {
  18. queryData: {
  19. companyId: "0",
  20. timeRange: this.$util.dateUtil.getNearlyMonthRange(),
  21. },
  22. companyOptions: [
  23. {
  24. label: '全部',
  25. value: '0'
  26. }
  27. ],
  28. coreData: [
  29. {
  30. title: "光伏累计减排(tco2e/年内)",
  31. num: 0,
  32. historyDesc: "同比",
  33. historyNum: 0,
  34. },
  35. {
  36. title: "光伏发电量(kWh/天)",
  37. num: 0,
  38. historyDesc: "同比",
  39. historyNum: 0,
  40. },
  41. {
  42. title: "光伏节约金额(元/天)",
  43. num: 0,
  44. historyDesc: "同比",
  45. historyNum: 0,
  46. },
  47. {
  48. title: "光伏补贴金额(元/天)",
  49. num: 0,
  50. historyDesc: "同比",
  51. historyNum: 0,
  52. },
  53. {
  54. type: 1,
  55. title: "值得关注",
  56. showStar: true,
  57. content: "建议扩大光伏 发电面积",
  58. },
  59. ],
  60. newsData: [
  61. {
  62. title: "xxxxxxxxxx",
  63. tag: "双碳小知识",
  64. author: "张峰",
  65. time: "2022-02-02 15:00:00",
  66. },
  67. ],
  68. };
  69. },
  70. mounted() {
  71. this.init();
  72. },
  73. methods: {
  74. init() {
  75. this.$store.loadingStore().loadingWithApi(this.getCoreData(), 2000);
  76. },
  77. reset() {},
  78. search(data) {
  79. this.$util.asyncPromise(
  80. this.getCoreData(),
  81. this.$refs.CarbonPvEmissionChart.getData(),
  82. this.$refs.CarbonPvEmissionChart.getData()
  83. );
  84. },
  85. getCoreData() {
  86. return apiCarbonPv.getCoreData(this.queryData).then((res) => {
  87. this.coreData[0].num = res.list[0].value;
  88. this.coreData[0].historyNum = res.list[0].compare;
  89. this.coreData[1].num = res.list[1].value;
  90. this.coreData[1].historyNum = res.list[1].compare;
  91. this.coreData[2].num = res.list[2].value;
  92. this.coreData[2].historyNum = res.list[2].compare;
  93. this.coreData[3].num = res.list[3].value;
  94. this.coreData[3].historyNum = res.list[3].compare;
  95. this.coreData[4].content = res.worthAttention;
  96. });
  97. },
  98. callBackCompanyOption(options) {
  99. this.companyOptions = [
  100. {
  101. label: '全部',
  102. value: '0'
  103. }
  104. ]
  105. if (options) {
  106. options.forEach(item=>{
  107. this.companyOptions.push(item);
  108. })
  109. }
  110. this.$forceUpdate()
  111. },
  112. },
  113. };
  114. </script>
  115. <template>
  116. <div class="doubleCarbon-pv">
  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-pv-analyse">
  153. <CarbonPvEmissionChart
  154. ref="CarbonPvEmissionChart"
  155. :query-data="queryData"
  156. :callBackCompanyOption="callBackCompanyOption"
  157. :height="450"
  158. />
  159. </div>
  160. </Card>
  161. </div>
  162. </a-col>
  163. <a-col :span="6">
  164. <div class="ioc-card-content">
  165. <Card title="光伏减排排名">
  166. <div class="doubleCarbon-pv-quota">
  167. <CarbonPvQuotaChart
  168. ref="CarbonPvQuotaChart"
  169. :query-data="queryData"
  170. :height="450"
  171. />
  172. </div>
  173. </Card>
  174. </div>
  175. </a-col>
  176. </a-row>
  177. </div>
  178. </div>
  179. </template>
  180. <style lang="less" scoped>
  181. .doubleCarbon-pv {
  182. width: 100%;
  183. height: auto;
  184. padding-bottom: 15px;
  185. vertical-align: top;
  186. .doubleCarbon-pv-analyse {
  187. padding: 12px;
  188. }
  189. .doubleCarbon-pv-quota {
  190. padding: 12px;
  191. }
  192. .doubleCarbon-pv-news {
  193. padding: 0 12px;
  194. height: 300px;
  195. }
  196. .doubleCarbon-pv-percent {
  197. padding: 0 12px;
  198. height: 300px;
  199. }
  200. }
  201. </style>