doubleCarbonPrint.vue 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195
  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 CarbonPrintEmissionChart from "@/components/doubleCarbon/print/charts/carbonPrintEmissionChart.vue";
  6. import CarbonPrintQuotaChart from "@/components/doubleCarbon/print/charts/carbonPrintQuotaChart.vue";
  7. import apiCarbonPrint from "@/api/carbon/apiCarbonPrint";
  8. export default {
  9. components: {
  10. Card,
  11. CoreData,
  12. Query,
  13. CarbonPrintEmissionChart,
  14. CarbonPrintQuotaChart,
  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: "文印累计排放(tCO₂e)",
  31. num: 0,
  32. historyDesc: "同比",
  33. historyNum: 0,
  34. },
  35. {
  36. title: "文印人均排放(tCO₂e/天)",
  37. num: 0,
  38. historyDesc: "同比",
  39. historyNum: 0,
  40. },
  41. {
  42. title: "纸张累计排放(tCO₂e)",
  43. num: 0,
  44. historyDesc: "同比",
  45. historyNum: 0,
  46. },
  47. {
  48. title: "墨盒累计排放(tCO₂e)",
  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. },
  79. search(data) {
  80. this.$util.asyncPromise(
  81. this.getCoreData(),
  82. this.$refs.CarbonPrintEmissionChart.getData(),
  83. this.$refs.CarbonPrintQuotaChart.getData()
  84. );
  85. },
  86. getCoreData() {
  87. return apiCarbonPrint.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].content = res.worthAttention;
  97. });
  98. },
  99. callBackCompanyOption(options) {
  100. this.companyOptions = [
  101. {
  102. label: '全部',
  103. value: '0'
  104. }
  105. ]
  106. if (options) {
  107. options.forEach(item => {
  108. this.companyOptions.push(item);
  109. })
  110. }
  111. this.$forceUpdate()
  112. },
  113. },
  114. };
  115. </script>
  116. <template>
  117. <div class="doubleCarbon-print">
  118. <div class="page-query-core">
  119. <Query
  120. :show="['company', 'time']"
  121. :query-data.sync="queryData"
  122. :company-options="companyOptions"
  123. :reset="reset"
  124. :search="search"
  125. ></Query>
  126. </div>
  127. <div class="page-query-core">
  128. <Card title="核心指标">
  129. <CoreData :data-list="coreData"></CoreData>
  130. </Card>
  131. </div>
  132. <div style="margin-top: 12px">
  133. <a-row :gutter="[12, 12]">
  134. <a-col :span="18">
  135. <div class="ioc-card-content">
  136. <Card title="文印排放分析">
  137. <div class="doubleCarbon-print-analyse">
  138. <CarbonPrintEmissionChart
  139. ref="CarbonPrintEmissionChart"
  140. :query-data="queryData"
  141. :callBackCompanyOption="callBackCompanyOption"
  142. :height="450"
  143. />
  144. </div>
  145. </Card>
  146. </div>
  147. </a-col>
  148. <a-col :span="6">
  149. <div class="ioc-card-content">
  150. <Card title="文印排放排名">
  151. <div class="doubleCarbon-print-quota">
  152. <CarbonPrintQuotaChart
  153. ref="CarbonPrintQuotaChart"
  154. :query-data="queryData"
  155. :height="450"
  156. />
  157. </div>
  158. </Card>
  159. </div>
  160. </a-col>
  161. </a-row>
  162. </div>
  163. </div>
  164. </template>
  165. <style lang="less" scoped>
  166. .doubleCarbon-print {
  167. width: 100%;
  168. height: auto;
  169. padding-bottom: 15px;
  170. vertical-align: top;
  171. .doubleCarbon-print-analyse {
  172. padding: 12px;
  173. }
  174. .doubleCarbon-print-quota {
  175. padding: 12px;
  176. }
  177. .doubleCarbon-print-news {
  178. padding: 0 12px;
  179. height: 300px;
  180. }
  181. .doubleCarbon-print-percent {
  182. padding: 0 12px;
  183. height: 300px;
  184. }
  185. }
  186. </style>