forked from github/dataease
fix: 取消收藏后主页不显示当前仪表板
This commit is contained in:
parent
04abe0c182
commit
27109824f2
@ -36,8 +36,13 @@ export default {
|
|||||||
starDatas: []
|
starDatas: []
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
computed: {
|
||||||
|
panelInfo() {
|
||||||
|
return this.$store.state.panel.panelInfo
|
||||||
|
}
|
||||||
|
},
|
||||||
created() {
|
created() {
|
||||||
bus.$on('panle_start_list_refresh', this.initData)
|
bus.$on('panle_start_list_refresh', this.refreshStarts)
|
||||||
this.initData()
|
this.initData()
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
@ -64,12 +69,20 @@ export default {
|
|||||||
remove(row) {
|
remove(row) {
|
||||||
deleteEnshrine(row.storeId).then(res => {
|
deleteEnshrine(row.storeId).then(res => {
|
||||||
this.initData()
|
this.initData()
|
||||||
|
this.panelInfo && this.panelInfo.id && row.panelGroupId === this.panelInfo.id && this.setMainNull()
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
initData() {
|
initData() {
|
||||||
enshrineList({}).then(res => {
|
enshrineList({}).then(res => {
|
||||||
this.starDatas = res.data
|
this.starDatas = res.data
|
||||||
})
|
})
|
||||||
|
},
|
||||||
|
setMainNull() {
|
||||||
|
this.$store.dispatch('panel/setPanelInfo', { id: null, name: '', preStyle: null })
|
||||||
|
},
|
||||||
|
refreshStarts(isStar) {
|
||||||
|
this.initData()
|
||||||
|
!isStar && this.setMainNull()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -162,13 +162,13 @@ export default {
|
|||||||
star() {
|
star() {
|
||||||
this.panelInfo && saveEnshrine(this.panelInfo.id).then(res => {
|
this.panelInfo && saveEnshrine(this.panelInfo.id).then(res => {
|
||||||
this.hasStar = true
|
this.hasStar = true
|
||||||
this.refreshStarList()
|
this.refreshStarList(true)
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
unstar() {
|
unstar() {
|
||||||
this.panelInfo && deleteEnshrine(this.panelInfo.id).then(res => {
|
this.panelInfo && deleteEnshrine(this.panelInfo.id).then(res => {
|
||||||
this.hasStar = false
|
this.hasStar = false
|
||||||
this.refreshStarList()
|
this.refreshStarList(false)
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
initHasStar() {
|
initHasStar() {
|
||||||
@ -177,8 +177,8 @@ export default {
|
|||||||
this.hasStar = res.data && res.data.some(item => item.panelGroupId === this.panelInfo.id)
|
this.hasStar = res.data && res.data.some(item => item.panelGroupId === this.panelInfo.id)
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
refreshStarList() {
|
refreshStarList(isStar) {
|
||||||
bus.$emit('panle_start_list_refresh')
|
bus.$emit('panle_start_list_refresh', isStar)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user