Skip to content

Commit

Permalink
add: Permison config page.
Browse files Browse the repository at this point in the history
  • Loading branch information
Winme committed Jan 31, 2020
1 parent 488ff49 commit 2af833b
Show file tree
Hide file tree
Showing 30 changed files with 247 additions and 562 deletions.
10 changes: 0 additions & 10 deletions src/api/application/complex.api.ts

This file was deleted.

5 changes: 5 additions & 0 deletions src/api/permission/role.api.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { request } from '../request'
import { GetRoleResult } from '~/interface/permission/role.interface'

/** get role list api */
export const apiGetRoleList = () => request<GetRoleResult>('get', '/permission/role')
71 changes: 71 additions & 0 deletions src/hooks/useProTableLocale.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
import { Language } from '~/interface'

const en_US = {
tableFrom: {
search: 'Query',
reset: 'Reset',
collapsed: 'Expand',
expand: 'Collapse',
inputPlaceholder: 'Please enter',
selectPlaceholder: 'Please select'
},
alert: {
clear: 'Clear'
},
tableToolBar: {
leftPin: 'Pin to left',
rightPin: 'Pin to right',
noPin: 'Unpinned',
leftFixedTitle: 'Fixed the left',
rightFixedTitle: 'Fixed the right',
noFixedTitle: 'Not Fixed',
reset: 'Reset',
columnDisplay: 'Column Display',
columnSetting: 'Settings',
fullScreen: 'Full Screen',
exitFullScreen: 'Exit Full Screen',
reload: 'Refresh',
density: 'Density',
densityLarger: 'Default',
densityMiddle: 'Middle',
densitySmall: 'Compact'
}
}

const zh_CN = {
tableFrom: {
search: '查询',
reset: '重置',
collapsed: '展开',
expand: '收起',
inputPlaceholder: '请输入',
selectPlaceholder: '请选择'
},
alert: {
clear: '清空'
},
tableToolBar: {
leftPin: '固定到左边',
rightPin: '固定到右边',
noPin: '取消固定',
leftFixedTitle: '固定在左侧',
rightFixedTitle: '固定在右侧',
noFixedTitle: '不固定',
reset: '重置',
columnDisplay: '列展示',
columnSetting: '列设置',
fullScreen: '全屏',
exitFullScreen: '退出全屏',
reload: '刷新',
density: '密度',
densityLarger: '正常',
densityMiddle: '中等',
densitySmall: '紧凑'
}
}

export default function useProTableLocale(lang: Language) {
if (lang === 'zh_CN') return zh_CN
if (lang === 'en_US') return en_US
return zh_CN
}
64 changes: 0 additions & 64 deletions src/interface/application/complex.interface.ts

This file was deleted.

8 changes: 8 additions & 0 deletions src/interface/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
export interface Locales<T = any> {
/** Chinese */
zh_CN: T
/** English */
en_US: T
}

export type Language = keyof Locales
13 changes: 13 additions & 0 deletions src/interface/permission/role.interface.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
export type RoleStatus = 'enabled' | 'disabled' | 'all'

export interface Role {
name: {
zh_CN: string
en_US: string
}
code: string
id: number
status: RoleStatus
}

export type GetRoleResult = Role[]
7 changes: 6 additions & 1 deletion src/locales/en-US/global/tips.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,10 @@ export const enUS_globalTips = {
'gloabal.tips.username': 'Username',
'gloabal.tips.password': 'Password',
'gloabal.tips.login': 'Login',
'gloabal.tips.backHome': 'Back Home'
'gloabal.tips.backHome': 'Back Home',
'gloabal.tips.operation': 'Operation',
'gloabal.tips.authorize': 'Authorize',
'gloabal.tips.delete': 'Delete',
'gloabal.tips.create': 'Create',
'gloabal.tips.modify': 'Modify'
}
4 changes: 3 additions & 1 deletion src/locales/en-US/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@ import { enUS_avatorDropMenu } from './user/avatorDropMenu'
import { enUS_tagsViewDropMenu } from './user/tagsViewDropMenu'
import { enUS_title } from './user/title'
import { enUS_globalTips } from './global/tips'
import { enUS_permissionRole } from './permission/role'

const en_US = {
...enUS_account,
...enUS_avatorDropMenu,
...enUS_tagsViewDropMenu,
...enUS_title,
...enUS_globalTips
...enUS_globalTips,
...enUS_permissionRole
}

export default en_US
8 changes: 8 additions & 0 deletions src/locales/en-US/permission/role.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
export const enUS_permissionRole = {
'app.permission.role.name': 'Role Name',
'app.permission.role.code': 'Role Code',
'app.permission.role.status': 'Status',
'app.permission.role.status.all': 'All',
'app.permission.role.status.enabled': 'Enabled',
'app.permission.role.status.disabled': 'Disabled'
}
4 changes: 0 additions & 4 deletions src/locales/en-US/user/title.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@ export const enUS_title = {
'title.permission.route': 'Route Permission',
'title.permission.button': 'Button Permission',
'title.permission.config': 'Permission Config',
'title.application.form': 'Form',
'title.application.table': 'Table',
'title.application.dialog': 'Dialog',
'title.application.complex': 'Complex',
'title.account': 'Account',
'title.notFount': '404'
}
7 changes: 6 additions & 1 deletion src/locales/zh-CN/global/tips.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,10 @@ export const zhCN_globalTips = {
'gloabal.tips.username': '用户名',
'gloabal.tips.password': '密码',
'gloabal.tips.rememberUser': '记住用户',
'gloabal.tips.backHome': '返回首页'
'gloabal.tips.backHome': '返回首页',
'gloabal.tips.operation': '操作',
'gloabal.tips.authorize': '授权',
'gloabal.tips.delete': '删除',
'gloabal.tips.create': '新建',
'gloabal.tips.modify': '修改'
}
4 changes: 3 additions & 1 deletion src/locales/zh-CN/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@ import { zhCN_avatorDropMenu } from './user/avatorDropMenu'
import { zhCN_tagsViewDropMenu } from './user/tagsViewDropMenu'
import { zhCN_title } from './user/title'
import { zhCN_globalTips } from './global/tips'
import { zhCN_permissionRole } from './permission/role'

const zh_CN = {
...zhCN_account,
...zhCN_avatorDropMenu,
...zhCN_tagsViewDropMenu,
...zhCN_title,
...zhCN_globalTips
...zhCN_globalTips,
...zhCN_permissionRole
}

export default zh_CN
8 changes: 8 additions & 0 deletions src/locales/zh-CN/permission/role.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
export const zhCN_permissionRole = {
'app.permission.role.name': '角色名称',
'app.permission.role.code': '角色编码',
'app.permission.role.status': '状态',
'app.permission.role.status.all': '全部',
'app.permission.role.status.enabled': '启用',
'app.permission.role.status.disabled': '禁用'
}
4 changes: 0 additions & 4 deletions src/locales/zh-CN/user/title.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@ export const zhCN_title = {
'title.permission.page': '页面权限',
'title.permission.button': '按钮权限',
'title.permission.config': '数据权限',
'title.application.form': '表单',
'title.application.table': '表格',
'title.application.dialog': '对话框',
'title.application.complex': '综合应用',
'title.account': '个人设置',
'title.notFount': '404'
}
1 change: 1 addition & 0 deletions src/mock/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
import './user'
import './permission'
1 change: 1 addition & 0 deletions src/mock/permission/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import './role.mock'
25 changes: 25 additions & 0 deletions src/mock/permission/role.mock.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { mock, intercepter } from '../config'
import { Role } from '~/interface/permission/role.interface'

const roles: Role[] = [
{
name: {
zh_CN: '访客',
en_US: 'Guest'
},
code: 'role_guest',
id: 0,
status: 'enabled'
},
{
name: {
zh_CN: '管理员',
en_US: 'Admin'
},
code: 'role_admin',
id: 1,
status: 'enabled'
}
]

mock.mock('/permission/role', 'get', intercepter(roles))
48 changes: 0 additions & 48 deletions src/mock/user/menu.mock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,54 +70,6 @@ const mockMenuList: MenuList = [
}
]
},
{
name: 'application',
label: {
zh_CN: '应用',
en_US: 'Application'
},
icon: 'application',
key: '3',
path: '/application',
children: [
{
name: 'form',
label: {
zh_CN: '表单',
en_US: 'Form'
},
key: '3-0',
path: '/application/form'
},
{
name: 'table',
label: {
zh_CN: '表格',
en_US: 'Table'
},
key: '3-1',
path: '/application/table'
},
{
name: 'dialog',
label: {
zh_CN: '对话框',
en_US: 'Dialog'
},
key: '3-2',
path: '/application/dialog'
},
{
name: 'complex',
label: {
zh_CN: '综合',
en_US: 'Complex'
},
key: '3-3',
path: '/application/complex'
}
]
},
{
name: 'account',
label: {
Expand Down
3 changes: 0 additions & 3 deletions src/pages/application/complex/index.less

This file was deleted.

Loading

0 comments on commit 2af833b

Please sign in to comment.