1
0
mirror of https://github.com/PanJiaChen/vue-element-admin.git synced 2025-08-10 20:39:48 +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: { methods: {
sendMain(dashboard) { sendMain(dashboard) {
this.$store.commit('setMainDashboard', dashboard) this.$store.dispatch('mainDashboard', dashboard)
this.$forceUpdate() this.$forceUpdate()
} }
} }

View File

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

View File

@ -1,7 +1,7 @@
<template> <template>
<div class="dashboard-editor-container"> <div class="dashboard-editor-container">
<el-row :gutter="8"> <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 <dashboard
:metadata="mainashboard" :metadata="mainashboard"
:title="mainashboard.name" :title="mainashboard.name"
@ -41,7 +41,7 @@ export default {
return this.$store.getters.getRoleUuid return this.$store.getters.getRoleUuid
}, },
mainashboard() { mainashboard() {
return this.$store.state.dashboard.mainashboard return this.$store.getters.getMainDashboard
} }
}, },
watch: { watch: {
@ -63,7 +63,7 @@ export default {
}) })
.then(response => { .then(response => {
if (this.isEmptyValue(this.mainashboard)) { if (this.isEmptyValue(this.mainashboard)) {
this.$store.commit('setMainDashboard', response.dashboardsList[1]) this.$store.dispatch('mainDashboard', response.dashboardsList[1])
} }
this.dashboardList = response.dashboardsList this.dashboardList = response.dashboardsList
this.$forceUpdate() this.$forceUpdate()