角色信息更新后, 实时更新管理员页面和店铺管理员页面的角色列表
This commit is contained in:
parent
fab2137eb4
commit
76eb1bb388
@ -37,3 +37,8 @@ export const EVENT_PUZZLE_UPDATE = 'event_puzzle_update'
|
|||||||
* @type {string}
|
* @type {string}
|
||||||
*/
|
*/
|
||||||
export const EVENT_SHOP_UPDATE = 'event_shop_update'
|
export const EVENT_SHOP_UPDATE = 'event_shop_update'
|
||||||
|
/**
|
||||||
|
* 角色信息更新
|
||||||
|
* @type {string}
|
||||||
|
*/
|
||||||
|
export const EVENT_ROLE_UPDATE = 'event_role_update'
|
||||||
|
@ -295,7 +295,7 @@ import { IRole } from '@/views/system/role.vue'
|
|||||||
import { IShopData } from '@/api/types'
|
import { IShopData } from '@/api/types'
|
||||||
import { UserModule } from '@/store/modules/user'
|
import { UserModule } from '@/store/modules/user'
|
||||||
import { getShops } from '@/api/shop'
|
import { getShops } from '@/api/shop'
|
||||||
import { EVENT_SHOP_UPDATE, EventBus } from '@/utils/event-bus'
|
import { EVENT_ROLE_UPDATE, EVENT_SHOP_UPDATE, EventBus } from '@/utils/event-bus'
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
name: 'ShopAdmin',
|
name: 'ShopAdmin',
|
||||||
@ -360,10 +360,14 @@ export default class extends Vue {
|
|||||||
EventBus.$on(EVENT_SHOP_UPDATE, () => {
|
EventBus.$on(EVENT_SHOP_UPDATE, () => {
|
||||||
this.getRemoteDeptList()
|
this.getRemoteDeptList()
|
||||||
})
|
})
|
||||||
|
EventBus.$on(EVENT_ROLE_UPDATE, () => {
|
||||||
|
this.getAllRole()
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
beforeDestory() {
|
beforeDestory() {
|
||||||
EventBus.$off(EVENT_SHOP_UPDATE)
|
EventBus.$off(EVENT_SHOP_UPDATE)
|
||||||
|
EventBus.$off(EVENT_ROLE_UPDATE)
|
||||||
}
|
}
|
||||||
|
|
||||||
private search() {
|
private search() {
|
||||||
|
@ -293,7 +293,7 @@ import {
|
|||||||
import { IRole } from '@/views/system/role.vue'
|
import { IRole } from '@/views/system/role.vue'
|
||||||
import { getShops } from '@/api/shop'
|
import { getShops } from '@/api/shop'
|
||||||
import { IShopData } from '@/api/types'
|
import { IShopData } from '@/api/types'
|
||||||
import { EVENT_SHOP_UPDATE, EventBus } from '@/utils/event-bus'
|
import { EVENT_ROLE_UPDATE, EVENT_SHOP_UPDATE, EventBus } from '@/utils/event-bus'
|
||||||
import { UserModule } from '@/store/modules/user'
|
import { UserModule } from '@/store/modules/user'
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
@ -355,10 +355,14 @@ export default class extends Vue {
|
|||||||
EventBus.$on(EVENT_SHOP_UPDATE, () => {
|
EventBus.$on(EVENT_SHOP_UPDATE, () => {
|
||||||
this.getRemoteDeptList()
|
this.getRemoteDeptList()
|
||||||
})
|
})
|
||||||
|
EventBus.$on(EVENT_ROLE_UPDATE, () => {
|
||||||
|
this.getAllRole()
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
beforeDestory() {
|
beforeDestory() {
|
||||||
EventBus.$off(EVENT_SHOP_UPDATE)
|
EventBus.$off(EVENT_SHOP_UPDATE)
|
||||||
|
EventBus.$off(EVENT_ROLE_UPDATE)
|
||||||
}
|
}
|
||||||
|
|
||||||
private search() {
|
private search() {
|
||||||
|
@ -156,6 +156,7 @@ import { Component, Vue } from 'vue-property-decorator'
|
|||||||
import { deleteRole, getRoles, saveRole } from '@/api/roles'
|
import { deleteRole, getRoles, saveRole } from '@/api/roles'
|
||||||
import TagInput from '@/components/TagInput/index.vue'
|
import TagInput from '@/components/TagInput/index.vue'
|
||||||
import { getPermissions } from '@/api/permissions'
|
import { getPermissions } from '@/api/permissions'
|
||||||
|
import { EVENT_ROLE_UPDATE, EVENT_SHOP_UPDATE, EventBus } from '@/utils/event-bus'
|
||||||
|
|
||||||
export interface IRole {
|
export interface IRole {
|
||||||
key: string
|
key: string
|
||||||
@ -292,6 +293,7 @@ export default class extends Vue {
|
|||||||
`,
|
`,
|
||||||
type: 'success'
|
type: 'success'
|
||||||
})
|
})
|
||||||
|
EventBus.$emit(EVENT_ROLE_UPDATE, {})
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.log(err)
|
console.log(err)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user