| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133 |
- <template>
- <div class="flexcr dashboard">
- <div class="dashboard-item" v-for="(item, index) in dashboard" :key="index">
- <div class="item-value">{{info[item.key] || "0"}}</div>
- <div class="item-title">{{item.title}}</div>
- <el-button
- type="primary"
- class="item-button"
- :disabled="!enable"
- @click="item.onClick">
- {{item.button}}
- </el-button>
- </div>
- </div>
- </template>
- <script>
- export default {
- name: "Dashboard",
- props: {
- siteId: String|Number,
- info: {
- type: Object,
- default: {}
- },
- enable: {
- type: Boolean,
- default: false
- },
- v2: {
- type: Boolean,
- default: false
- }
- },
- data() {
- return {
- siteInfo: {},
- dashboard: [{
- key: "stations",
- title: "Stations",
- button: "Configure Station",
- onClick: () => this.toStations()
- },{
- key: "connectors",
- title: "Connectors",
- button: "View Connectors",
- onClick: () => this.toConnectors()
- },{
- key: "activeTransaction",
- title: "Active Transaction",
- button: "View Transactions",
- onClick: () => this.toTransactions()
- },{
- key: "reservationsMade",
- title: "Reservations Made",
- button: "View Reservations",
- onClick: () => this.toReservations()
- }]
- };
- },
- mounted() {
-
- },
- methods: {
- toStations() {
- if (this.v2) {
- this.$router.push({
- path: "/site-management/stations/" + this.siteId
- })
- } else {
- this.$router.push({
- path: "/charge-station-management/registered-charge-stations"
- })
- }
- },
- toConnectors() {
- if (this.v2) {
- this.$router.push({
- path: "/site-management/connectors/" + this.siteId
- })
- } else {
- this.$router.push({
- path: "/charge-station-management/connectors"
- })
- }
- },
- toTransactions() {
- this.$router.push({
- path: "/station-activities/transactions"
- })
- },
- toReservations() {
- this.$router.push({
- path: "/station-activities/reservations"
- })
- }
- }
- }
- </script>
- <style scoped>
- .dashboard {
- zoom: 0.88;
- }
- .dashboard-item {
- flex: 1;
- display: flex;
- margin: 5px 8px;
- align-items: center;
- flex-direction: column;
- }
- .item-value {
- color: #333;
- font-size: 22px;
- font-weight: bold;
- line-height: 30px;
- }
- .item-title {
- color: #333;
- font-size: 14px;
- line-height: 20px;
- white-space: nowrap;
- text-transform: uppercase;
- }
- .item-button {
- width: 100%;
- max-width: 200px;
- font-size: 13px;
- margin-top: 10px;
- padding: 12px 10px;
- text-transform: uppercase;
- }
- </style>
|