1
0
mirror of https://github.com/PanJiaChen/vue-element-admin.git synced 2025-08-07 18:25:45 +08:00

Fix dashboard (#961)

* Fix dashboard

* delete line code

Co-authored-by: elsiosanchez <elsiossanches@gmail.com>
This commit is contained in:
Elsio Sanchez 2021-07-06 08:59:28 -04:00 committed by GitHub
parent 273e21861d
commit ef56a8a4f1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 4 deletions

View File

@ -134,7 +134,7 @@ export default {
},
methods: {
sendMain(dashboard) {
this.$store.commit('setMainDashboard', dashboard)
this.$store.dispatch('mainDashboard', dashboard)
this.$forceUpdate()
}
}

View File

@ -73,6 +73,9 @@ const dashboard = {
console.warn(`Error getting List Dashboards: ${error.message}. Code: ${error.code}.`)
})
})
},
mainDashboard({ commit }, dashboard) {
commit('setMainDashboard', dashboard)
}
},
getters: {
@ -85,6 +88,9 @@ const dashboard = {
return state.dashboard.find(
item => item.roleUuid === roleUuid
)
},
getMainDashboard: (state) => {
return state.mainashboard
}
}
}

View File

@ -1,7 +1,7 @@
<template>
<div class="dashboard-editor-container">
<el-row :gutter="8">
<el-col :span="24" style="padding-right:8px;margin-bottom:2px;">
<el-col v-if="!isEmptyValue(mainashboard)" :span="24" style="padding-right:8px;margin-bottom:2px;">
<dashboard
:metadata="mainashboard"
:title="mainashboard.name"
@ -41,7 +41,7 @@ export default {
return this.$store.getters.getRoleUuid
},
mainashboard() {
return this.$store.state.dashboard.mainashboard
return this.$store.getters.getMainDashboard
}
},
watch: {
@ -63,7 +63,7 @@ export default {
})
.then(response => {
if (this.isEmptyValue(this.mainashboard)) {
this.$store.commit('setMainDashboard', response.dashboardsList[1])
this.$store.dispatch('mainDashboard', response.dashboardsList[1])
}
this.dashboardList = response.dashboardsList
this.$forceUpdate()