1
0
mirror of https://github.com/PanJiaChen/vue-element-admin.git synced 2025-08-13 23:20:12 +08:00
EdwinBetanc0urt 7f74235073
Refactor code, remove unused methods and optimized application. (#318)
* Refactor code, remove unused methods and optimized application.

* Delete redundant action's, and some deprecated.

* Optimize delete record container to panels in window.

* fix delete tag view when change roles.
2020-02-10 21:13:19 -04:00

75 lines
1.5 KiB
Vue

<template>
<el-form>
<el-select
v-model="value"
:filterable="!isMobile"
value-key="key"
@change="handleChange"
>
<el-option
v-for="(rol, key) in getRolesList"
:key="key"
:label="rol.name"
:value="rol.uuid"
:disabled="isEmptyValue(rol.uuid)"
/>
</el-select>
</el-form>
</template>
<script>
import { showMessage } from '@/utils/ADempiere/notification'
export default {
name: 'RolesNavbar',
data() {
return {
value: '',
options: []
}
},
computed: {
getRol() {
return this.$store.getters['user/getRol']
},
getRolesList() {
return this.$store.getters['user/getRoles']
},
isMobile() {
return this.$store.state.app.device === 'mobile'
},
permissionRoutes() {
return this.$store.getters.permission_routes
}
},
watch: {
'getRol.uuid'(uuidRol) {
this.value = uuidRol
}
},
created() {
this.value = this.getRol.uuid
this.getLanguageData()
},
methods: {
showMessage,
handleChange(valueSelected) {
this.$message({
message: this.$t('notifications.loading'),
iconClass: 'el-icon-loading'
})
this.$store.dispatch('user/changeRoles', {
roleUuid: valueSelected
})
.then(response => {
this.$store.dispatch('listDashboard', response.uuid)
})
this.$router.push({ path: '/' })
},
getLanguageData() {
this.$store.dispatch('getLanguagesFromServer')
}
}
}
</script>