perf i18n for role permission
This commit is contained in:
parent
4080fba0bf
commit
a8e3a45fb5
|
@ -6,6 +6,7 @@ export default {
|
||||||
guide: 'Guide',
|
guide: 'Guide',
|
||||||
permission: 'Permission',
|
permission: 'Permission',
|
||||||
pagePermission: 'Page Permission',
|
pagePermission: 'Page Permission',
|
||||||
|
rolePermission: 'Role Permission',
|
||||||
directivePermission: 'Directive Permission',
|
directivePermission: 'Directive Permission',
|
||||||
icons: 'Icons',
|
icons: 'Icons',
|
||||||
components: 'Components',
|
components: 'Components',
|
||||||
|
@ -86,9 +87,14 @@ export default {
|
||||||
github: 'Github Repository'
|
github: 'Github Repository'
|
||||||
},
|
},
|
||||||
permission: {
|
permission: {
|
||||||
|
newRole: 'New Role',
|
||||||
|
editPermission: 'Edit Permission',
|
||||||
roles: 'Your roles',
|
roles: 'Your roles',
|
||||||
switchRoles: 'Switch roles',
|
switchRoles: 'Switch roles',
|
||||||
tips: 'In some cases it is not suitable to use v-permission, such as element Tab component or el-table-column and other asynchronous rendering dom cases which can only be achieved by manually setting the v-if.'
|
tips: 'In some cases it is not suitable to use v-permission, such as element Tab component or el-table-column and other asynchronous rendering dom cases which can only be achieved by manually setting the v-if.',
|
||||||
|
delete: 'Delete',
|
||||||
|
confirm: 'Confirm',
|
||||||
|
cancel: 'Cancel'
|
||||||
},
|
},
|
||||||
guide: {
|
guide: {
|
||||||
description: 'The guide page is useful for some people who entered the project for the first time. You can briefly introduce the features of the project. Demo is based on ',
|
description: 'The guide page is useful for some people who entered the project for the first time. You can briefly introduce the features of the project. Demo is based on ',
|
||||||
|
|
|
@ -5,6 +5,7 @@ export default {
|
||||||
documentation: 'Documentación',
|
documentation: 'Documentación',
|
||||||
guide: 'Guía',
|
guide: 'Guía',
|
||||||
permission: 'Permisos',
|
permission: 'Permisos',
|
||||||
|
rolePermission: 'Permisos de rol',
|
||||||
pagePermission: 'Permisos de la página',
|
pagePermission: 'Permisos de la página',
|
||||||
directivePermission: 'Permisos de la directiva',
|
directivePermission: 'Permisos de la directiva',
|
||||||
icons: 'Iconos',
|
icons: 'Iconos',
|
||||||
|
|
|
@ -5,6 +5,7 @@ export default {
|
||||||
documentation: '文档',
|
documentation: '文档',
|
||||||
guide: '引导页',
|
guide: '引导页',
|
||||||
permission: '权限测试页',
|
permission: '权限测试页',
|
||||||
|
rolePermission: '角色权限',
|
||||||
pagePermission: '页面权限',
|
pagePermission: '页面权限',
|
||||||
directivePermission: '指令权限',
|
directivePermission: '指令权限',
|
||||||
icons: '图标',
|
icons: '图标',
|
||||||
|
@ -86,9 +87,14 @@ export default {
|
||||||
github: 'Github 地址'
|
github: 'Github 地址'
|
||||||
},
|
},
|
||||||
permission: {
|
permission: {
|
||||||
|
newRole: '新增角色',
|
||||||
|
editPermission: '编辑权限',
|
||||||
roles: '你的权限',
|
roles: '你的权限',
|
||||||
switchRoles: '切换权限',
|
switchRoles: '切换权限',
|
||||||
tips: '在某些情况下,不适合使用 v-permission。例如:Element-UI 的 Tab 组件或 el-table-column 以及其它动态渲染 dom 的场景。你只能通过手动设置 v-if 来实现。'
|
tips: '在某些情况下,不适合使用 v-permission。例如:Element-UI 的 Tab 组件或 el-table-column 以及其它动态渲染 dom 的场景。你只能通过手动设置 v-if 来实现。',
|
||||||
|
delete: '删除',
|
||||||
|
confirm: '确定',
|
||||||
|
cancel: '取消'
|
||||||
},
|
},
|
||||||
guide: {
|
guide: {
|
||||||
description: '引导页对于一些第一次进入项目的人很有用,你可以简单介绍下项目的功能。本 Demo 是基于',
|
description: '引导页对于一些第一次进入项目的人很有用,你可以简单介绍下项目的功能。本 Demo 是基于',
|
||||||
|
|
|
@ -37,7 +37,7 @@ const asyncRoutesMap = [
|
||||||
component: 'permission/role',
|
component: 'permission/role',
|
||||||
name: 'role',
|
name: 'role',
|
||||||
meta: {
|
meta: {
|
||||||
title: 'roleManagement',
|
title: 'rolePermission',
|
||||||
roles: ['admin']
|
roles: ['admin']
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,47 +1,50 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="app-container wrapper">
|
<div class="app-container wrapper">
|
||||||
<el-button type="primary" @click="handleNewRole">新增角色</el-button>
|
<el-button type="primary" @click="handleNewRole">{{ $t('permission.newRole') }}</el-button>
|
||||||
|
|
||||||
<el-table :data="rolesData" style="width: 100%" class="roles-table">
|
<el-table :data="rolesData" style="width: 100%" class="roles-table">
|
||||||
<el-table-column label="角色名称" width="220">
|
<el-table-column label="Role Id" width="220">
|
||||||
|
<template slot-scope="scope">{{ scope.row.id }}</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="Role Name" width="220">
|
||||||
<template slot-scope="scope">{{ scope.row.name }}</template>
|
<template slot-scope="scope">{{ scope.row.name }}</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="角色描述">
|
<el-table-column label="Description">
|
||||||
<template slot-scope="scope">{{ scope.row.describe }}</template>
|
<template slot-scope="scope">{{ scope.row.describe }}</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="操作">
|
<el-table-column label="Operations">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-button type="primary" size="small" @click="handleEdit(scope)">修改权限</el-button>
|
<el-button type="primary" size="small" @click="handleEdit(scope)">{{ $t('permission.editPermission') }}</el-button>
|
||||||
<el-button type="danger" size="small" @click="handleDelete(scope)">删除</el-button>
|
<el-button type="danger" size="small" @click="handleDelete(scope)">{{ $t('permission.delete') }}</el-button>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
|
|
||||||
<el-dialog :visible.sync="newRoleDialogVisible" title="新增角色">
|
<el-dialog :visible.sync="newRoleDialogVisible" title="New Role">
|
||||||
<el-form :model="newRole" class="new-role-form">
|
<el-form :model="newRole" class="new-role-form">
|
||||||
<el-form-item label="角色名称">
|
<el-form-item label="Role Name">
|
||||||
<el-input v-model="newRole.name" placeholder="角色名称"/>
|
<el-input v-model="newRole.name" placeholder="role name"/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="角色描述">
|
<el-form-item label="Role Description">
|
||||||
<el-input v-model="newRole.describe" placeholder="角色描述"/>
|
<el-input v-model="newRole.describe" placeholder="role Description"/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
|
|
||||||
<el-button type="primary" @click="confirmNewRole">确定</el-button>
|
<el-button type="primary" @click="confirmNewRole">{{ $t('permission.confirm') }}</el-button>
|
||||||
<el-button type="danger" @click="cancleNewRole">取消</el-button>
|
<el-button type="danger" @click="cancleNewRole">{{ $t('permission.cancel') }}</el-button>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
|
|
||||||
<el-dialog :visible.sync="permissionDialogVisible" title="修改权限">
|
<el-dialog :visible.sync="permissionDialogVisible" :title="$t('permission.editPermission')">
|
||||||
<el-form label-width="100px">
|
<el-form label-width="100px">
|
||||||
<el-form-item label="角色名称">
|
<el-form-item label="Role Name">
|
||||||
<span>{{ checkedRole.data.name }}</span>
|
<span>{{ checkedRole.data.name }}</span>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="菜单列表">
|
<el-form-item label="Menus">
|
||||||
<el-tree ref="tree" :check-strictly="checkStrictly" :data="MapRoutesData" :props="defaultProps" :filter-node-method="filterNode" show-checkbox node-key="id" class="permission-tree"/>
|
<el-tree ref="tree" :check-strictly="checkStrictly" :data="MapRoutesData" :props="defaultProps" :filter-node-method="filterNode" show-checkbox node-key="id" class="permission-tree"/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-button type="primary" @click="confirmPermission">确定</el-button>
|
<el-button type="primary" @click="confirmPermission">{{ $t('permission.confirm') }}</el-button>
|
||||||
<el-button type="danger" @click="canclePermission">取消</el-button>
|
<el-button type="danger" @click="canclePermission">{{ $t('permission.cancel') }}</el-button>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
|
@ -92,7 +95,7 @@ export default {
|
||||||
route = this.onlyOneShowingChild(route.children, route)
|
route = this.onlyOneShowingChild(route.children, route)
|
||||||
}
|
}
|
||||||
route.children && (route.children = traverseRoutes(route.children))
|
route.children && (route.children = traverseRoutes(route.children))
|
||||||
route.name = this.generateTitle((route.meta && route.meta.title) || route.name || route.path || Math.random() + '')
|
route.name = this.generateTitle((route.meta && route.meta.title) || route.name)
|
||||||
return route
|
return route
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -110,7 +113,7 @@ export default {
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
generateTitle,
|
generateTitle,
|
||||||
// 过滤掉隐藏的菜单
|
// filter out the hidden route menu
|
||||||
filterNode(value, data) {
|
filterNode(value, data) {
|
||||||
return !data.hidden
|
return !data.hidden
|
||||||
},
|
},
|
||||||
|
@ -159,9 +162,9 @@ export default {
|
||||||
// this.checkStrictly = false
|
// this.checkStrictly = false
|
||||||
},
|
},
|
||||||
handleDelete(scope) {
|
handleDelete(scope) {
|
||||||
this.$confirm('此操作将删除角色, 是否继续?', '提示', {
|
this.$confirm('Confirm to remove the role?', 'Warning', {
|
||||||
confirmButtonText: '确定',
|
confirmButtonText: 'Confirm',
|
||||||
cancelButtonText: '取消',
|
cancelButtonText: 'Cancel',
|
||||||
type: 'warning'
|
type: 'warning'
|
||||||
})
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
|
@ -171,14 +174,14 @@ export default {
|
||||||
this.rolesData.splice(scope.$index, 1)
|
this.rolesData.splice(scope.$index, 1)
|
||||||
this.$message({
|
this.$message({
|
||||||
type: 'success',
|
type: 'success',
|
||||||
message: '删除成功!'
|
message: 'Delete succed!'
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
.catch(err => {
|
.catch(err => {
|
||||||
console.error(err)
|
console.error(err)
|
||||||
this.$message({
|
this.$message({
|
||||||
type: 'info',
|
type: 'info',
|
||||||
message: '已取消删除'
|
message: 'Delete canceled'
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
@ -195,7 +198,7 @@ export default {
|
||||||
}).then(res => {
|
}).then(res => {
|
||||||
this.rolesData[this.checkedRole.index].accessibleRoutes = routeIds
|
this.rolesData[this.checkedRole.index].accessibleRoutes = routeIds
|
||||||
this.$message({
|
this.$message({
|
||||||
message: '编辑成功',
|
message: 'Edit succed',
|
||||||
type: 'success'
|
type: 'success'
|
||||||
})
|
})
|
||||||
this.permissionDialogVisible = false
|
this.permissionDialogVisible = false
|
||||||
|
|
Loading…
Reference in New Issue