coldPortrait.vue 2.2 KB

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