Dashboard.vue 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. <template>
  2. <div class="flexcr dashboard">
  3. <div class="dashboard-item" v-for="(item, index) in dashboard" :key="index">
  4. <div class="item-value">{{info[item.key] || "0"}}</div>
  5. <div class="item-title">{{item.title}}</div>
  6. <el-button
  7. type="primary"
  8. class="item-button"
  9. :disabled="!enable"
  10. @click="item.onClick">
  11. {{item.button}}
  12. </el-button>
  13. </div>
  14. </div>
  15. </template>
  16. <script>
  17. export default {
  18. name: "Dashboard",
  19. props: {
  20. siteId: String|Number,
  21. info: {
  22. type: Object,
  23. default: {}
  24. },
  25. enable: {
  26. type: Boolean,
  27. default: false
  28. },
  29. v2: {
  30. type: Boolean,
  31. default: false
  32. }
  33. },
  34. data() {
  35. return {
  36. siteInfo: {},
  37. dashboard: [{
  38. key: "stations",
  39. title: "Stations",
  40. button: "Configure Station",
  41. onClick: () => this.toStations()
  42. },{
  43. key: "connectors",
  44. title: "Connectors",
  45. button: "View Connectors",
  46. onClick: () => this.toConnectors()
  47. },{
  48. key: "activeTransaction",
  49. title: "Active Transaction",
  50. button: "View Transactions",
  51. onClick: () => this.toTransactions()
  52. },{
  53. key: "reservationsMade",
  54. title: "Reservations Made",
  55. button: "View Reservations",
  56. onClick: () => this.toReservations()
  57. }]
  58. };
  59. },
  60. mounted() {
  61. },
  62. methods: {
  63. toStations() {
  64. if (this.v2) {
  65. this.$router.push({
  66. path: "/site-management/stations/" + this.siteId
  67. })
  68. } else {
  69. this.$router.push({
  70. path: "/charge-station-management/registered-charge-stations"
  71. })
  72. }
  73. },
  74. toConnectors() {
  75. if (this.v2) {
  76. this.$router.push({
  77. path: "/site-management/connectors/" + this.siteId
  78. })
  79. } else {
  80. this.$router.push({
  81. path: "/charge-station-management/connectors"
  82. })
  83. }
  84. },
  85. toTransactions() {
  86. this.$router.push({
  87. path: "/station-activities/transactions"
  88. })
  89. },
  90. toReservations() {
  91. this.$router.push({
  92. path: "/station-activities/reservations"
  93. })
  94. }
  95. }
  96. }
  97. </script>
  98. <style scoped>
  99. .dashboard {
  100. zoom: 0.88;
  101. }
  102. .dashboard-item {
  103. flex: 1;
  104. display: flex;
  105. margin: 5px 8px;
  106. align-items: center;
  107. flex-direction: column;
  108. }
  109. .item-value {
  110. color: #333;
  111. font-size: 22px;
  112. font-weight: bold;
  113. line-height: 30px;
  114. }
  115. .item-title {
  116. color: #333;
  117. font-size: 14px;
  118. line-height: 20px;
  119. white-space: nowrap;
  120. text-transform: uppercase;
  121. }
  122. .item-button {
  123. width: 100%;
  124. max-width: 200px;
  125. font-size: 13px;
  126. margin-top: 10px;
  127. padding: 12px 10px;
  128. text-transform: uppercase;
  129. }
  130. </style>