fix bug
This commit is contained in:
@@ -62,7 +62,7 @@
|
|||||||
</q-th>
|
</q-th>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template v-slot:body-cell-actions="p">
|
<template v-if="selected && selected.id > 0" v-slot:body-cell-actions="p">
|
||||||
<q-td auto-width :props="p">
|
<q-td auto-width :props="p">
|
||||||
<table-action-menu :row="p.row" minWidth="180px" max-width="200px" :actions="actionList" />
|
<table-action-menu :row="p.row" minWidth="180px" max-width="200px" :actions="actionList" />
|
||||||
</q-td>
|
</q-td>
|
||||||
|
|||||||
@@ -80,17 +80,17 @@ export const useUserStore = defineStore('user', {
|
|||||||
},
|
},
|
||||||
|
|
||||||
async addRole(user: IUserRolesDisplay, role: IRolesDisplay) {
|
async addRole(user: IUserRolesDisplay, role: IRolesDisplay) {
|
||||||
return await this.updateUserRole(user, user.roleIds.concat(role.id));
|
return await this.updateUserRole(user, user.roleIds ? user.roleIds.concat(role.id) : [role.id]);
|
||||||
},
|
},
|
||||||
|
|
||||||
async removeRole(user: IUserRolesDisplay, role: IRolesDisplay) {
|
async removeRole(user: IUserRolesDisplay, role: IRolesDisplay) {
|
||||||
return await this.updateUserRole(user, user.roleIds.filter(e => e !== role.id));
|
return await this.updateUserRole(user, user.roleIds ? user.roleIds.filter(e => e !== role.id) : []);
|
||||||
},
|
},
|
||||||
|
|
||||||
async updateUserRole(user: IUserRolesDisplay, roleIds: number[]) {
|
async updateUserRole(user: IUserRolesDisplay, roleids: number[]) {
|
||||||
return await api.post('api/v1/userrole', {
|
return await api.post('api/v1/userrole', {
|
||||||
userid: user.id,
|
userid: user.id,
|
||||||
roleIds
|
roleids
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user