electricityPortrait.vue 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. <script>
  2. import CoreData from "@/components/common/coreData.vue";
  3. import ElectricityUseChart from "@/components/dashboard/portrait/electricity/electricityUseChart.vue";
  4. import ElectricityDistributionChart from "@/components/dashboard/portrait/electricity/electricityDistributionChart.vue";
  5. import api from "@/api/dashboard/apiDashboard";
  6. export default {
  7. data() {
  8. return {
  9. coreData: [
  10. {
  11. type: 0,
  12. title: '月总用电量(kWh)',
  13. num: 0,
  14. historyDesc: '同比',
  15. historyNum: 0
  16. },
  17. {
  18. type: 0,
  19. title: '今日用电量(kWh)',
  20. num: 0,
  21. historyDesc: '同比',
  22. historyNum: 0
  23. },
  24. {
  25. type: 0,
  26. title: '今日用电趋势',
  27. num: 0,
  28. showTrendIcon: true,
  29. historyDesc: '同比',
  30. },
  31. {
  32. type: 0,
  33. title: '人均用电成本(元/天)',
  34. num: 0,
  35. historyDesc: '同比',
  36. historyNum: 0
  37. },
  38. {
  39. type: 1,
  40. showStar: true,
  41. title: '值得关注',
  42. content: ''
  43. },
  44. ]
  45. }
  46. },
  47. props: {
  48. chartHeight: Number
  49. },
  50. components: {
  51. CoreData,
  52. ElectricityUseChart,
  53. ElectricityDistributionChart,
  54. },
  55. mounted() {
  56. this.init();
  57. },
  58. methods: {
  59. init() {
  60. this.getCoreData()
  61. },
  62. getCoreData() {
  63. api.getElectricityCoreData().then(res=>{
  64. this.coreData[0].num = res.list[0].value
  65. this.coreData[0].historyNum = res.list[0].compare
  66. this.coreData[1].num = res.list[1].value
  67. this.coreData[1].historyNum = res.list[1].compare
  68. this.coreData[2].num = res.list[2].value
  69. this.coreData[2].historyNum = res.list[2].compare
  70. this.coreData[3].num = res.list[3].value
  71. this.coreData[3].historyNum = res.list[3].compare
  72. this.coreData[4].content = res.worthAttention
  73. })
  74. },
  75. }
  76. }
  77. </script>
  78. <template>
  79. <div class="supermarketPortrait">
  80. <div class="portrait-coreData">
  81. <CoreData :data-list="coreData"></CoreData>
  82. </div>
  83. <div style="padding: 15px">
  84. <a-row>
  85. <a-col :span="16">
  86. <ElectricityUseChart :height="chartHeight"></ElectricityUseChart>
  87. </a-col>
  88. <a-col :span="8">
  89. <ElectricityDistributionChart :height="chartHeight"></ElectricityDistributionChart>
  90. </a-col>
  91. </a-row>
  92. </div>
  93. </div>
  94. </template>
  95. <style lang="less" scoped>
  96. .supermarketPortrait {
  97. }
  98. </style>