This commit is contained in:
pycook 2020-02-16 17:36:03 +08:00
parent a188218818
commit d975aceaab
20 changed files with 298 additions and 189 deletions

View File

@ -1,7 +1,7 @@
import { axios } from '@/utils/request'
/**
* 获取 ci_type 的属性
* Get CI Type attributes
* @param CITypeName
* @param parameter
* @returns {AxiosPromise}
@ -16,7 +16,7 @@ export function getCITypeAttributesByName (CITypeName, parameter) {
}
/**
* 获取 ci_type 的属性
* Get CI Type attributes
* @param CITypeId
* @param parameter
* @returns {AxiosPromise}
@ -30,7 +30,7 @@ export function getCITypeAttributesById (CITypeId, parameter) {
}
/**
* 更新属性
* update attribute
* @param attrId
* @param data
* @returns {AxiosPromise}
@ -44,7 +44,7 @@ export function updateAttributeById (attrId, data) {
}
/**
* 添加属性
* add attribute
* @param data
* @returns {AxiosPromise}
*/
@ -57,7 +57,7 @@ export function createAttribute (data) {
}
/**
* 搜索属性/ 获取所有的属性
* search attributes or get all attributes
* @param data
* @returns {AxiosPromise}
*/
@ -70,7 +70,7 @@ export function searchAttributes (params) {
}
/**
* 删除属性
* delete attribute
* @param attrId
* @returns {AxiosPromise}
*/
@ -82,7 +82,7 @@ export function deleteAttributesById (attrId) {
}
/**
* 绑定ci_type 属性
* bind attribute
* @param CITypeId
* @param data
* @returns {AxiosPromise}
@ -96,7 +96,7 @@ export function createCITypeAttributes (CITypeId, data) {
}
/**
* 更新ci_type 属性
* update CI Type attribute
* @param CITypeId
* @param data
* @returns {AxiosPromise}
@ -110,7 +110,7 @@ export function updateCITypeAttributesById (CITypeId, data) {
}
/**
* 删除ci_type 属性
* delete CI Type attribute
* @param CITypeId
* @param data
* @returns {AxiosPromise}

View File

@ -27,9 +27,11 @@ export default {
data () {
return {}
},
inject: ['reload'],
methods: {
SwitchLang (row) {
this.setLang(row.key)
this.reload()
}
}
}

View File

@ -34,7 +34,7 @@
<a-menu-item key="3">
<a href="javascript:;" @click="handleLogout">
<a-icon type="logout"/>
<span>退出登录</span>
<span>{{ $t('login.logout') }}</span>
</a>
</a-menu-item>
</a-menu>
@ -67,8 +67,8 @@ export default {
const that = this
this.$confirm({
title: '提示',
content: '真的要注销登录吗 ?',
title: this.$t('tip.warning'),
content: this.$t('login.confirmLogout'),
onOk () {
return that.Logout()
},

View File

@ -8,7 +8,7 @@
</a>
</div>
<div class="desc">
运维资产数据管理
{{ $t('login.subTitle') }}
</div>
</div>

View File

@ -47,6 +47,7 @@ export default {
delete: 'Delete',
edit: 'Edit',
operate: 'Operation',
close: 'Close',
create: 'Create',
clear: 'Clear',
modify: 'Modify',
@ -62,9 +63,11 @@ export default {
deleting: 'Deleting ...',
confirmDelete: 'Confirm deleting ?',
warning: 'Warning',
error: 'Error',
other: 'Other',
requestFailed: 'Request error, please try again later',
pleaseSelect: 'please select'
pleaseSelect: 'please select',
selectAll: 'Select all'
},
ci: {
batchOperate: 'Batch Operation',
@ -160,5 +163,66 @@ export default {
newRelationType: 'New Relation Type',
relationTypeNameRequired: 'Please enter a type name',
uniqueFlag: 'unique flag'
},
acl: {
roleList: 'Roles',
permList: 'Permissions',
selectOtherRole: 'Please select another role',
associatedParentRole: 'Associated parent role',
associatedChildRole: 'Associated child role',
associatedSuccess: 'Associated with success',
name: 'Name',
roleName: 'Role Name',
description: 'Desciption',
resourceNameRequired: 'Please enter the resource name',
descriptionTip: 'Please enter description...',
permission: 'Permission',
resourceType: 'Resource Type',
newResource: 'New Resource',
newRole: 'New Role',
newResourceType: 'New Resource Type',
addPermTip: 'Add authorization: ',
add: 'Add',
selectRoleTip: 'Please select the role name. Multiple choices are available!',
selectPermTip: 'Please select permissions. Multiple options are available!',
resourceTypeNameRequired: 'Please enter a type name',
permissionNameRequired: 'Please enter a permission name',
roleNameRequired: 'Please enter a role name',
usernameRequired: 'Please enter a user name',
inheritedFrom: 'Inherited from ',
selectInheritedRoles: 'Select inherited roles',
isAppAdmin: 'Is Application Admin',
username: 'Username',
nickname: 'NickName',
password: 'Password',
department: 'Department',
catalog: 'Team',
email: 'Email',
emailValidate: 'Please enter the correct email address!',
emailRequired: 'Please enter email address',
mobile: 'Mobile phone number',
mobileValidate: 'Please enter the correct mobile phone number',
block: 'Is lock',
newUser: 'New User',
typeName: 'Type name',
viewAuthorization: 'View Authorization',
authorization: 'Authorization',
resourceName: 'Resource Name',
createdAt: 'Creation time',
updatedAt: 'Last modified time',
joinedAt: 'Join time'
},
login: {
subTitle: 'Operation and maintenance resource data management',
loginHeader: 'Account password login',
loginName: 'User name or email address',
loginNameRequired: 'Please enter your account name or email address',
password: 'Password',
passwordRequired: 'Please enter your password',
autoLogin: 'Automatic login',
welcome: 'Welocom',
welcomeBack: 'Welcome back',
confirmLogout: 'Do you really want to logout?',
logout: 'Logout',
}
}

View File

@ -47,6 +47,7 @@ export default {
delete: '删除',
edit: '编辑',
operate: '操作',
close: '关闭',
create: '创建',
clear: '清空',
modify: '修改',
@ -62,9 +63,11 @@ export default {
deleting: '正在删除 ...',
confirmDelete: '真的要删除吗 ?',
warning: '警告',
error: '错误',
other: '其他',
requestFailed: '请求出现错误,请稍后再试',
pleaseSelect: '请选择'
pleaseSelect: '请选择',
selectAll: '全选'
},
ci: {
batchOperate: '批量操作',
@ -160,5 +163,66 @@ export default {
newRelationType: '新增关系类型',
relationTypeNameRequired: '请输入类型名',
uniqueFlag: '唯一标识'
},
acl: {
roleList: '角色列表',
permList: '权限列表',
selectOtherRole: '请选择另一个角色',
associatedParentRole: '关联父角色',
associatedChildRole: '关联子角色',
associatedSuccess: '关联成功',
name: '名称',
roleName: '角色名称',
description: '描述',
resourceNameRequired: '请输入资源名',
descriptionTip: '请输入描述信息...',
permission: '权限',
resourceType: '资源类型',
newResource: '新增资源',
newRole: '新增角色',
newResourceType: '新增资源类型',
addPermTip: '添加授权:',
add: '添加',
selectRoleTip: '请选择角色名称,可多选!',
selectPermTip: '请选择权限,可多选!',
resourceTypeNameRequired: '请输入类型名',
permissionNameRequired: '请输入权限名',
roleNameRequired: '请输入角色名',
usernameRequired: '请输入用户名',
inheritedFrom: '继承自',
selectInheritedRoles: '选择继承角色',
isAppAdmin: '是否应用管理员',
username: '用户名',
nickname: '昵称',
password: '密码',
department: '部门',
catalog: '小组',
email: '邮箱',
emailValidate: '请输入正确的邮箱!',
emailRequired: '请输入邮箱',
mobile: '手机号码',
mobileValidate: '请输入正确的手机号码',
block: '是否锁定',
newUser: '新增用户',
typeName: '类型名',
viewAuthorization: '查看授权',
authorization: '授权',
resourceName: '资源名',
createdAt: '创建时间',
updatedAt: '最后修改时间',
joinedAt: '加入时间'
},
login: {
subTitle: '运维资源数据管理',
loginHeader: '账号密码登录',
loginName: '用户名或者邮箱',
loginNameRequired: '请输入帐户名或邮箱地址',
password: '密码',
passwordRequired: '请输入密码',
autoLogin: '自动登录',
welcome: '欢迎',
welcomeBack: '欢迎回来',
confirmLogout: '真的要注销登录吗 ?',
logout: '退出登录',
}
}

View File

@ -13,9 +13,9 @@
<a-form-item
:label-col="formItemLayout.labelCol"
:wrapper-col="formItemLayout.wrapperCol"
label="角色列表"
:label="$t('acl.roleList')"
>
<a-select name="otherID" :filterOption="filterOption" v-decorator="['otherID', {rules: [{ required: true, message: '请选择另一个角色'}]} ]">
<a-select name="otherID" :filterOption="filterOption" v-decorator="['otherID', {rules: [{ required: true, message: $t('acl.selectOtherRole')}]} ]">
<template v-for="role in allRoles">
<a-select-option v-if="role.id != current_record.id" :key="role.id">{{ role.name }}</a-select-option>
</template>
@ -42,8 +42,8 @@
}"
>
<a-button @click="handleAddParent" type="primary" style="margin-right: 1rem">关联父角色</a-button>
<a-button @click="handleAddChild" type="primary" style="margin-right: 1rem">关联子角色</a-button>
<a-button @click="handleAddParent" type="primary" style="margin-right: 1rem">{{ $t('acl.associatedParentRole') }}</a-button>
<a-button @click="handleAddChild" type="primary" style="margin-right: 1rem">{{ $t('acl.associatedChildRole') }}</a-button>
<a-button @click="onClose">{{ $t('button.cancel') }}</a-button>
</div>
@ -64,7 +64,7 @@ export default {
},
data () {
return {
drawerTitle: '角色关联',
drawerTitle: this.$t('acl.associatedRole'),
drawerVisible: false,
formLayout: 'vertical',
allRoles: [],
@ -144,7 +144,7 @@ export default {
addParent (id, otherID) {
addParentRole(id, otherID)
.then(res => {
this.$message.success(`关联父角色成功`)
this.$message.success(this.$t('acl.associatedSuccess'))
this.handleOk()
this.onClose()
}).catch(err => this.requestFailed(err))
@ -153,7 +153,7 @@ export default {
addChild (id, otherID) {
addChildRole(id, otherID)
.then(res => {
this.$message.success(`关联子角色成功`)
this.$message.success(this.$t('acl.associatedSuccess'))
this.handleOk()
this.onClose()
})
@ -161,7 +161,7 @@ export default {
},
requestFailed (err) {
const msg = ((err.response || {}).data || {}).message || '请求出现错误,请稍后再试'
const msg = ((err.response || {}).data || {}).message || this.$t('tip.requestFailed')
this.$message.error(`${msg}`)
}

View File

@ -13,31 +13,31 @@
<a-form-item
:label-col="formItemLayout.labelCol"
:wrapper-col="formItemLayout.wrapperCol"
label="类型名"
:label="$t('acl.name')"
>
<a-input
name="name"
placeholder=""
v-decorator="['name', {rules: [{ required: true, message: '请输入资源名'}]} ]"
v-decorator="['name', {rules: [{ required: true, message: $t('acl.resourceNameRequired') }]} ]"
/>
</a-form-item>
<a-form-item
:label-col="formItemLayout.labelCol"
:wrapper-col="formItemLayout.wrapperCol"
label="描述"
:label="$t('acl.description')"
>
<a-textarea placeholder="请输入描述信息..." name="description" :rows="4" />
<a-textarea :placeholder="$t('acl.descriptionTip')" name="description" :rows="4" />
</a-form-item>
<a-form-item
:label-col="formItemLayout.labelCol"
:wrapper-col="formItemLayout.wrapperCol"
label="权限"
:label="$t('acl.permission')"
>
<div :style="{ borderBottom: '1px solid #E9E9E9' }">
<a-checkbox :indeterminate="indeterminate" @change="onCheckAllChange" :checked="checkAll">
全选
{{ $t('tip.selectAll') }}
</a-checkbox>
</div>
<br />
@ -86,7 +86,7 @@ export default {
},
data () {
return {
drawerTitle: '新增资源类型',
drawerTitle: this.$t('acl.newResourceType'),
drawerVisible: false,
formLayout: 'vertical',
perms: ['1'],
@ -177,7 +177,7 @@ export default {
updateResourceType (id, data) {
updateResourceTypeById(id, data)
.then(res => {
this.$message.success(`更新成功`)
this.$message.success(this.$t('tip.updateSuccess'))
this.handleOk()
this.onClose()
}).catch(err => this.requestFailed(err))
@ -186,7 +186,7 @@ export default {
createResourceType (data) {
addResourceType(data)
.then(res => {
this.$message.success(`添加成功`)
this.$message.success(this.$t('tip.addSuccess'))
this.handleOk()
this.onClose()
})
@ -194,7 +194,7 @@ export default {
},
requestFailed (err) {
const msg = ((err.response || {}).data || {}).message || '请求出现错误,请稍后再试'
const msg = ((err.response || {}).data || {}).message || this.$t('tip.requestFailed')
this.$message.error(`${msg}`)
}

View File

@ -13,19 +13,19 @@
<a-form-item
:label-col="formItemLayout.labelCol"
:wrapper-col="formItemLayout.wrapperCol"
label="资源名"
:label="$t('acl.name')"
>
<a-input
name="name"
placeholder=""
v-decorator="['name', {rules: [{ required: true, message: '请输入资源名'}]} ]"
v-decorator="['name', {rules: [{ required: true, message: $t('acl.resourceNameRequired')}]} ]"
/>
</a-form-item>
<a-form-item
:label-col="formItemLayout.labelCol"
:wrapper-col="formItemLayout.wrapperCol"
label="资源类型"
:label="$t('acl.resourceType')"
>
<a-select name="type_id" v-decorator="['type_id', {rules: []} ]">
<a-select-option v-for="type in allTypes" :key="type.id">{{ type.name }}</a-select-option>
@ -73,7 +73,7 @@ export default {
},
data () {
return {
drawerTitle: '新增资源',
drawerTitle: this.$t('acl.newResource'),
drawerVisible: false,
formLayout: 'vertical',
allTypes: []
@ -150,14 +150,14 @@ export default {
createResource (data) {
addResource(data)
.then(res => {
this.$message.success(`添加成功`)
this.$message.success(this.$t('tip.addSuccess'))
this.onClose()
})
.catch(err => this.requestFailed(err))
},
requestFailed (err) {
const msg = ((err.response || {}).data || {}).message || '请求出现错误,请稍后再试'
const msg = ((err.response || {}).data || {}).message || this.$t('tip.requestFailed')
this.$message.error(`${msg}`)
}

View File

@ -5,7 +5,7 @@
width="50%"
>
<template slot="footer">
<a-button key="back" @click="handleCancel">关闭</a-button>
<a-button key="back" @click="handleCancel">{{ $t('tip.close') }}</a-button>
</template>
<template>
@ -40,7 +40,7 @@ export default {
},
data () {
return {
drawerTitle: '权限列表',
drawerTitle: this.$t('acl.permList'),
drawerVisible: false,
record: null,
allPerms: [],
@ -80,7 +80,7 @@ export default {
},
deletePerm (roleID, permName) {
deleteRoleResourcePerm(roleID, this.record.id, { perms: [permName] }).then(res => {
this.$message.success(`删除成功`)
this.$message.success(this.$t('tip.deleteSuccess'))
}).catch(err => this.requestFailed(err))
},
handleCancel (e) {
@ -88,7 +88,7 @@ export default {
},
requestFailed (err) {
console.log(err)
const msg = ((err.response || {}).data || {}).message || '请求出现错误,请稍后再试'
const msg = ((err.response || {}).data || {}).message || this.$t('tip.requestFailed')
this.$message.error(`${msg}`)
}

View File

@ -1,6 +1,6 @@
<template>
<a-drawer
:title="'添加授权:'+instance.name"
:title="$t('acl.addPermTip')+instance.name"
width="30%"
:closable="true"
:visible="visible"
@ -8,28 +8,28 @@
>
<a-form :form="form">
<a-form-item
label="角色列表"
:label="$t('acl.roleList')"
>
<a-select
showSearch
name="roleIdList"
v-decorator="['roleIdList', {rules: []} ]"
mode="multiple"
placeholder="请选择角色名称,可多选!"
:placeholder="$t('acl.selectRoleTip')"
:filterOption="filterOption">
<a-select-option v-for="role in allRoles" :key="role.id">{{ role.name }}</a-select-option>
</a-select>
</a-form-item>
<a-form-item
label="权限列表"
:label="$t('acl.permList')"
>
<a-select name="permName" v-decorator="['permName', {rules: []} ]" mode="multiple" placeholder="请选择权限,可多选!">
<a-select name="permName" v-decorator="['permName', {rules: []} ]" mode="multiple" :placeholder="$t('acl.selectPermTip')">
<a-select-option v-for="perm in allPerms" :key="perm.name">{{ perm.name }}</a-select-option>
</a-select>
</a-form-item>
<div class="btn-group">
<a-button @click="handleSubmit" type="primary" style="margin-right: 1rem">添加</a-button>
<a-button @click="handleSubmit" type="primary" style="margin-right: 1rem">{{ $t('acl.add') }}</a-button>
<a-button @click="closeForm">{{ $t('button.cancel') }}</a-button>
</div>
@ -47,7 +47,7 @@ export default {
allRoles: [],
allPerms: [],
visible: false,
instance: {} // 当前对象
instance: {}
}
},
props: {
@ -84,7 +84,7 @@ export default {
this.loadPerm(record['resource_type_id'])
},
requestFailed (err) {
const msg = ((err.response || {}).data || {}).message || '请求出现错误,请稍后再试'
const msg = ((err.response || {}).data || {}).message || this.$t('tip.requestFailed')
this.$message.error(`${msg}`)
},
filterOption (input, option) {
@ -98,7 +98,7 @@ export default {
if (!err) {
values.roleIdList.forEach(roleId => {
setRoleResourcePerm(roleId, this.instance.id, { perms: values.permName }).then(
res => { this.$message.info('添加授权成功') }).catch(
res => { this.$message.info(this.$t('tip.addSuccess')) }).catch(
err => this.requestFailed(err))
})
}

View File

@ -13,29 +13,29 @@
<a-form-item
:label-col="formItemLayout.labelCol"
:wrapper-col="formItemLayout.wrapperCol"
label="类型名"
:label="$t('acl.name')"
>
<a-input
name="name"
placeholder="类型名称"
v-decorator="['name', {rules: [{ required: true, message: '请输入类型名'}]} ]"
:placeholder="$t('acl.name')"
v-decorator="['name', {rules: [{ required: true, message: $t('acl.resourceTypeNameRequired')}]} ]"
/>
</a-form-item>
<a-form-item
:label-col="formItemLayout.labelCol"
:wrapper-col="formItemLayout.wrapperCol"
label="描述"
:label="$t('acl.description')"
>
<a-textarea placeholder="请输入描述信息..." name="description" :rows="4" v-decorator="['description', {rules: []} ]"/>
<a-textarea :placeholder="$t('acl.descriptionTip')" name="description" :rows="4" v-decorator="['description', {rules: []} ]"/>
</a-form-item>
<a-form-item
:label-col="formItemLayout.labelCol"
:wrapper-col="formItemLayout.wrapperCol"
label="权限"
:label="$t('acl.permission')"
>
<a-select mode="tags" v-model="perms" style="width: 100%" placeholder="请输入权限名...">
<a-select mode="tags" v-model="perms" style="width: 100%" :placeholder="$t('acl.permissionNameRequired')">
</a-select>
</a-form-item>
@ -81,7 +81,7 @@ export default {
},
data () {
return {
drawerTitle: '新增资源类型',
drawerTitle: this.$t('acl.newResourceType'),
drawerVisible: false,
formLayout: 'vertical',
perms: []
@ -159,7 +159,7 @@ export default {
updateResourceType (id, data) {
updateResourceTypeById(id, data)
.then(res => {
this.$message.success(`更新成功`)
this.$message.success(this.$t('tip.updateSuccess'))
this.handleOk()
this.onClose()
}).catch(err => this.requestFailed(err))
@ -168,7 +168,7 @@ export default {
createResourceType (data) {
addResourceType(data)
.then(res => {
this.$message.success(`添加成功`)
this.$message.success(this.$t('tip.addSuccess'))
this.handleOk()
this.onClose()
})
@ -176,7 +176,7 @@ export default {
},
requestFailed (err) {
const msg = ((err.response || {}).data || {}).message || '请求出现错误,请稍后再试'
const msg = ((err.response || {}).data || {}).message || this.$t('tip.requestFailed')
this.$message.error(`${msg}`)
}

View File

@ -13,22 +13,22 @@
<a-form-item
:label-col="{span:6}"
:wrapper-col="{span:12}"
label="角色名"
:label="$t('acl.roleName')"
>
<a-input
name="name"
placeholder=""
v-decorator="['name', {rules: [{ required: true, message: '请输入角色名'}]} ]"
v-decorator="['name', {rules: [{ required: true, message: $t('acl.roleNameRequired')}]} ]"
/>
</a-form-item>
<a-form-item
:label-col="{span:6}"
:wrapper-col="{span:12}"
label="继承自"
:label="$t('acl.inheritedFrom')"
>
<a-select
v-model="selectedParents"
placeholder="可选择继承角色"
:placeholder="$t('acl.selectInheritedRoles')"
mode="multiple"
:filterOption="filterOption">
<template v-for="role in allRoles">
@ -39,7 +39,7 @@
<a-form-item
:label-col="{span:8}"
:wrapper-col="{span:10}"
label="是否应用管理员"
:label="$t('acl.isAppAdmin')"
>
<a-switch
@change="onChange"
@ -86,7 +86,7 @@ export default {
},
data () {
return {
drawerTitle: '新增角色',
drawerTitle: this.$t('acl.newRole'),
current_id: 0,
drawerVisible: false,
formLayout: 'vertical',
@ -130,7 +130,7 @@ export default {
)
},
handleCreate () {
this.drawerTitle = '新增'
this.drawerTitle = this.$t('button.add')
this.drawerVisible = true
},
onClose () {
@ -144,7 +144,7 @@ export default {
},
handleEdit (record) {
this.drawerTitle = '编辑'
this.drawerTitle = this.$t('button.update')
this.drawerVisible = true
this.current_id = record.id
const _parents = this.id2parents[record.id]
@ -180,7 +180,7 @@ export default {
this.updateParents(id)
updateRoleById(id, data)
.then(res => {
this.$message.success(`更新成功`)
this.$message.success(this.$t('tip.updateSuccess'))
this.handleOk()
this.onClose()
}).catch(err => this.requestFailed(err))
@ -189,7 +189,7 @@ export default {
createRole (data) {
addRole(data)
.then(res => {
this.$message.success(`添加成功`)
this.$message.success(this.$t('tip.addSuccess'))
this.updateParents(res.id)
this.handleOk()
this.onClose()
@ -209,7 +209,7 @@ export default {
})
},
requestFailed (err) {
const msg = ((err.response || {}).data || {}).message || '请求出现错误,请稍后再试'
const msg = ((err.response || {}).data || {}).message || this.$t('tip.requestFailed')
this.$message.error(`${msg}`)
}

View File

@ -13,18 +13,18 @@
<a-form-item
:label-col="formItemLayout.labelCol"
:wrapper-col="formItemLayout.wrapperCol"
label="用户名(英文)"
:label="$t('acl.username')"
>
<a-input
name="username"
placeholder="英文名"
v-decorator="['username', {rules: [{ required: true, message: '请输入用户名'}]} ]"
:placeholder="$t('acl.username')"
v-decorator="['username', {rules: [{ required: true, message: $t('acl.usernameRequired')}]} ]"
/>
</a-form-item>
<a-form-item
:label-col="formItemLayout.labelCol"
:wrapper-col="formItemLayout.wrapperCol"
label="中文名"
:label="$t('acl.nickname')"
>
<a-input
name="nickname"
@ -34,7 +34,7 @@
<a-form-item
:label-col="formItemLayout.labelCol"
:wrapper-col="formItemLayout.wrapperCol"
label="密码"
:label="$t('acl.password')"
>
<a-input
type="password"
@ -46,7 +46,7 @@
<a-form-item
:label-col="formItemLayout.labelCol"
:wrapper-col="formItemLayout.wrapperCol"
label="部门"
:label="$t('acl.department')"
>
<a-input
name="department"
@ -57,7 +57,7 @@
<a-form-item
:label-col="formItemLayout.labelCol"
:wrapper-col="formItemLayout.wrapperCol"
label="小组"
:label="$t('acl.catalog')"
>
<a-input
name="catalog"
@ -68,7 +68,7 @@
<a-form-item
:label-col="formItemLayout.labelCol"
:wrapper-col="formItemLayout.wrapperCol"
label="邮箱"
:label="$t('acl.email')"
>
<a-input
name="email"
@ -78,11 +78,11 @@
rules: [
{
type: 'email',
message: '请输入正确的邮箱!',
message: $t('acl.emailValidate'),
},
{
required: true,
message: '请输入邮箱',
message: $t('acl.emailRequired'),
},
],
},
@ -93,18 +93,18 @@
<a-form-item
:label-col="formItemLayout.labelCol"
:wrapper-col="formItemLayout.wrapperCol"
label="手机号码"
:label="$t('acl.mobile')"
>
<a-input
name="mobile"
v-decorator="['mobile', {rules: [{message: '请输入正确的手机号码', pattern: /^1\d{10}$/ }]} ]"
v-decorator="['mobile', {rules: [{message: $t('acl.mobileValidate'), pattern: /^1\d{10}$/ }]} ]"
/>
</a-form-item>
<a-form-item
:label-col="horizontalFormItemLayout.labelCol"
:wrapper-col="horizontalFormItemLayout.wrapperCol"
label="是否锁定"
:label="$t('acl.block')"
>
<a-switch
@change="onChange"
@ -154,7 +154,7 @@ export default {
},
data () {
return {
drawerTitle: '新增用户',
drawerTitle: this.$t('acl.newUser'),
drawerVisible: false,
formLayout: 'vertical'
}
@ -235,7 +235,7 @@ export default {
updateUser (attrId, data) {
updateUserById(attrId, data)
.then(res => {
this.$message.success(`更新成功`)
this.$message.success(this.$t('tip.updateSuccess'))
this.handleOk()
this.onClose()
}).catch(err => this.requestFailed(err))
@ -244,7 +244,7 @@ export default {
createUser (data) {
addUser(data)
.then(res => {
this.$message.success(`添加成功`)
this.$message.success(this.$t('tip.addSuccess'))
this.handleOk()
this.onClose()
})
@ -252,7 +252,7 @@ export default {
},
requestFailed (err) {
const msg = ((err.response || {}).data || {}).message || '请求出现错误,请稍后再试'
const msg = ((err.response || {}).data || {}).message || this.$t('tip.requestFailed')
this.$message.error(`${msg}`)
}

View File

@ -2,7 +2,7 @@
<a-card :bordered="false">
<div class="action-btn">
<a-button @click="handleCreate" type="primary" style="margin-right: 0.3rem;">{{ btnName }}</a-button>
<a-button @click="handleCreate" type="primary" style="margin-right: 0.3rem;">{{ $t('acl.newResourceType') }}</a-button>
</div>
<s-table
@ -34,7 +34,7 @@
icon="search"
size="small"
style="width: 90px; margin-right: 8px"
>搜索</a-button>
>{{ $t('button.query') }}</a-button>
<a-button
@click="() => handleReset(clearFilters, column)"
size="small"
@ -65,11 +65,11 @@
<a-divider type="vertical"/>
<a-popconfirm
title="确认删除?"
:title="$t('tip.confirmDelete')"
@confirm="handleDelete(record)"
@cancel="cancel"
okText=""
cancelText=""
:okText="$t('button.yes')"
:cancelText="$t('button.no')"
>
<a>{{ $t('tip.delete') }}</a>
</a-popconfirm>
@ -97,7 +97,6 @@ export default {
return {
id2perms: {},
scroll: { x: 1000, y: 500 },
btnName: '新增资源类型',
formLayout: 'vertical',
@ -109,7 +108,7 @@ export default {
},
columns: [
{
title: '类型名',
title: this.$t('acl.typeName'),
dataIndex: 'name',
sorter: false,
width: 50,
@ -128,20 +127,20 @@ export default {
}
},
{
title: '描述',
title: this.$t('acl.description'),
dataIndex: 'description',
width: 250,
sorter: false,
scopedSlots: { customRender: 'description' }
},
{
title: '权限',
title: this.$t('acl.permission'),
dataIndex: 'id',
sorter: false,
scopedSlots: { customRender: 'id' }
},
{
title: '操作',
title: this.$t('tip.operate'),
dataIndex: 'action',
width: 150,
fixed: 'right',
@ -169,11 +168,8 @@ export default {
},
mdl: {},
// 高级搜索 展开/关闭
advanced: false,
// 查询参数
queryParam: {},
// 表头
selectedRowKeys: [],
selectedRows: [],
@ -255,13 +251,13 @@ export default {
deleteResourceType (id) {
deleteResourceTypeById(id)
.then(res => {
this.$message.success(`删除成功`)
this.$message.success(this.$t('tip.deleteSuccess'))
this.handleOk()
})
.catch(err => this.requestFailed(err))
},
requestFailed (err) {
const msg = ((err.response || {}).data || {}).message || '请求出现错误,请稍后再试'
const msg = ((err.response || {}).data || {}).message || this.$t('tip.requestFailed')
this.$message.error(`${msg}`)
},
cancel () {

View File

@ -2,7 +2,7 @@
<a-card :bordered="false">
<div class="action-btn">
<a-button @click="handleCreate" type="primary" style="margin-right: 0.3rem;">{{ btnName }}</a-button>
<a-button @click="handleCreate" type="primary" style="margin-right: 0.3rem;">{{ $t('acl.newResourceType') }}</a-button>
</div>
<s-table
@ -12,7 +12,7 @@
:rowKey="record=>record.id"
:rowSelection="options.rowSelection"
:scroll="scroll"
:pagination="{ showTotal: (total, range) => `${range[0]}-${range[1]} 共 ${total} 条记录`, pageSizeOptions: pageSizeOptions}"
:pagination="{ showTotal: (total, range) => `${range[0]}-${range[1]} ${total} records in total`, pageSizeOptions: pageSizeOptions}"
showPagination="auto"
:pageSize="25"
ref="table"
@ -34,7 +34,7 @@
icon="search"
size="small"
style="width: 90px; margin-right: 8px"
>搜索</a-button>
>{{ $t('button.query') }}</a-button>
<a-button
@click="() => handleReset(clearFilters, column)"
size="small"
@ -65,11 +65,11 @@
<a-divider type="vertical"/>
<a-popconfirm
title="确认删除?"
:title="$t('tip.confirmDelete')"
@confirm="handleDelete(record)"
@cancel="cancel"
okText=""
cancelText=""
:okText="$t('button.yes')"
:cancelText="$t('button.no')"
>
<a>{{ $t('tip.delete') }}</a>
</a-popconfirm>
@ -97,7 +97,6 @@ export default {
return {
id2perms: {},
scroll: { x: 1000, y: 500 },
btnName: '新增资源类型',
formLayout: 'vertical',
@ -109,7 +108,7 @@ export default {
},
columns: [
{
title: '类型名',
title: this.$t('acl.typeName'),
dataIndex: 'name',
sorter: false,
width: 150,
@ -128,21 +127,21 @@ export default {
}
},
{
title: '描述',
title: this.$t('acl.description'),
dataIndex: 'description',
width: 200,
sorter: false,
scopedSlots: { customRender: 'description' }
},
{
title: '权限',
title: this.$t('acl.permission'),
dataIndex: 'id',
width: 300,
sorter: false,
scopedSlots: { customRender: 'id' }
},
{
title: '操作',
title: this.$t('tip.operate'),
dataIndex: 'action',
width: 150,
scopedSlots: { customRender: 'action' }
@ -169,11 +168,8 @@ export default {
},
mdl: {},
// 高级搜索 展开/关闭
advanced: false,
// 查询参数
queryParam: {},
// 表头
selectedRowKeys: [],
selectedRows: [],
@ -263,13 +259,13 @@ export default {
deleteResourceType (id) {
deleteResourceTypeById(id)
.then(res => {
this.$message.success(`删除成功`)
this.$message.success(this.$t('tip.deleteSuccess'))
this.handleOk()
})
.catch(err => this.requestFailed(err))
},
requestFailed (err) {
const msg = ((err.response || {}).data || {}).message || '请求出现错误,请稍后再试'
const msg = ((err.response || {}).data || {}).message || this.$t('tip.requestFailed')
this.$message.error(`${msg}`)
},
cancel () {

View File

@ -18,7 +18,7 @@
</div>
<a-divider style="margin-top: -16px" />
<div class="action-btn">
<a-button @click="handleCreate" type="primary" style="margin-right: 0.3rem;">{{ btnName }}</a-button>
<a-button @click="handleCreate" type="primary" style="margin-right: 0.3rem;">{{ $t('acl.newResource') }}</a-button>
</div>
<s-table
@ -28,7 +28,7 @@
:rowKey="record=>record.id"
:rowSelection="options.rowSelection"
:scroll="scroll"
:pagination="{ showTotal: (total, range) => `${range[0]}-${range[1]} 共 ${total} 条记录`, pageSizeOptions: pageSizeOptions}"
:pagination="{ showTotal: (total, range) => `${range[0]}-${range[1]} ${total} records in total`, pageSizeOptions: pageSizeOptions}"
showPagination="auto"
:pageSize="25"
ref="table"
@ -50,7 +50,7 @@
icon="search"
size="small"
style="width: 90px; margin-right: 8px"
>搜索</a-button>
>{{ $t('button.query') }}</a-button>
<a-button
@click="() => handleReset(clearFilters, column)"
size="small"
@ -70,16 +70,16 @@
</template>
<span slot="action" slot-scope="text, record">
<template>
<a @click="handlePerm(record)">查看授权</a>
<a @click="handlePerm(record)">{{ $t('acl.viewAuthorization') }}</a>
<a-divider type="vertical"/>
<a @click="handlePermManage(record)">授权</a>
<a @click="handlePermManage(record)">{{ $t('acl.authorization') }}</a>
<a-divider type="vertical"/>
<a-popconfirm
title="确认删除?"
:title="$t('tip.confirmDelete')"
@confirm="handleDelete(record)"
@cancel="cancel"
okText=""
cancelText=""
:okText="$t('button.yes')"
:cancelText="$t('button.no')"
>
<a>{{ $t('tip.delete') }}</a>
</a-popconfirm>
@ -111,7 +111,6 @@ export default {
data () {
return {
scroll: { x: 1000, y: 500 },
btnName: '新增资源',
allResourceTypes: [],
currentType: { id: 0 },
formLayout: 'vertical',
@ -125,7 +124,7 @@ export default {
},
columns: [
{
title: '资源名',
title: this.$t('acl.resourceName'),
dataIndex: 'name',
sorter: false,
width: 250,
@ -144,17 +143,17 @@ export default {
}
},
{
title: '创建时间',
title: this.$t('acl.createdAt'),
width: 200,
dataIndex: 'created_at'
},
{
title: '最后修改时间',
title: this.$t('acl.updatedAt'),
width: 200,
dataIndex: 'updated_at'
},
{
title: '操作',
title: this.$t('tip.operate'),
dataIndex: 'action',
width: 150,
scopedSlots: { customRender: 'action' }
@ -181,11 +180,8 @@ export default {
},
mdl: {},
// 高级搜索 展开/关闭
advanced: false,
// 查询参数
queryParam: {},
// 表头
selectedRowKeys: [],
selectedRows: [],
@ -281,13 +277,13 @@ export default {
deleteResource (id) {
deleteResourceById(id)
.then(res => {
this.$message.success(`删除成功`)
this.$message.success(this.$t('tip.deleteSuccess'))
this.handleOk()
})
.catch(err => this.requestFailed(err))
},
requestFailed (err) {
const msg = ((err.response || {}).data || {}).message || '请求出现错误,请稍后再试'
const msg = ((err.response || {}).data || {}).message || this.$t('tip.requestFailed')
this.$message.error(`${msg}`)
},
cancel () {

View File

@ -2,7 +2,7 @@
<a-card :bordered="false">
<div class="action-btn">
<a-button @click="handleCreate" type="primary" style="margin-right: 0.3rem;">{{ btnName }}</a-button>
<a-button @click="handleCreate" type="primary" style="margin-right: 0.3rem;">{{ $t('acl.newRole') }}</a-button>
</div>
<s-table
@ -11,7 +11,7 @@
:data="loadData"
:rowKey="record=>record.id"
:rowSelection="options.rowSelection"
:pagination="{ showTotal: (total, range) => `${range[0]}-${range[1]} 共 ${total} 条记录`, pageSizeOptions: pageSizeOptions}"
:pagination="{ showTotal: (total, range) => `${range[0]}-${range[1]} ${total} records in total`, pageSizeOptions: pageSizeOptions}"
showPagination="auto"
:pageSize="25"
ref="table"
@ -32,7 +32,7 @@
icon="search"
size="small"
style="width: 90px; margin-right: 8px"
>搜索</a-button>
>{{ $t('button.query') }}</a-button>
<a-button
@click="() => handleReset(clearFilters, column)"
size="small"
@ -61,14 +61,14 @@
<span slot="action" slot-scope="text, record">
<template>
<a @click="handleEdit(record)">修改</a>
<a @click="handleEdit(record)">{{ $t('button.update') }}</a>
<a-divider type="vertical"/>
<a-popconfirm
title="确认删除?"
:title="$t('tip.confirmDelete')"
@confirm="handleDelete(record)"
@cancel="cancel"
okText=""
cancelText=""
:okText="$t('button.yes')"
:cancelText="$t('button.no')"
>
<a>{{ $t('tip.delete') }}</a>
</a-popconfirm>
@ -93,7 +93,6 @@ export default {
data () {
return {
scroll: { x: 1000, y: 500 },
btnName: '新增角色',
formLayout: 'vertical',
@ -107,7 +106,7 @@ export default {
},
columns: [
{
title: '角色名',
title: this.$t('acl.roleName'),
dataIndex: 'name',
sorter: false,
width: 150,
@ -126,7 +125,7 @@ export default {
}
},
{
title: '是否管理员',
title: this.$t('acl.isAppAdmin'),
dataIndex: 'is_app_admin',
width: 100,
sorter: false,
@ -134,7 +133,7 @@ export default {
},
{
title: '继承自',
title: this.$t('acl.inheritedFrom'),
dataIndex: 'id',
sorter: false,
width: 250,
@ -142,7 +141,7 @@ export default {
},
{
title: '操作',
title: this.$t('tip.operate'),
dataIndex: 'action',
width: 150,
scopedSlots: { customRender: 'action' }
@ -171,11 +170,8 @@ export default {
},
mdl: {},
// 高级搜索 展开/关闭
advanced: false,
// 查询参数
queryParam: {},
// 表头
selectedRowKeys: [],
selectedRows: [],
@ -256,13 +252,13 @@ export default {
deleteRole (id) {
deleteRoleById(id)
.then(res => {
this.$message.success(`删除成功`)
this.$message.success(this.$t('tip.deleteSuccess'))
this.handleOk()
})
.catch(err => this.requestFailed(err))
},
requestFailed (err) {
const msg = ((err.response || {}).data || {}).message || '请求出现错误,请稍后再试'
const msg = ((err.response || {}).data || {}).message || this.$t('tip.requestFailed')
this.$message.error(`${msg}`)
},
cancel (e) {

View File

@ -2,7 +2,7 @@
<a-card :bordered="false">
<div class="action-btn">
<a-button @click="handleCreate" type="primary" style="margin-right: 0.3rem;">{{ btnName }}</a-button>
<a-button @click="handleCreate" type="primary" style="margin-right: 0.3rem;">{{ $t('acl.newUser') }}</a-button>
</div>
<s-table
@ -12,7 +12,7 @@
:rowKey="record=>record.uid"
:rowSelection="options.rowSelection"
:scroll="scroll"
:pagination="{ showTotal: (total, range) => `${range[0]}-${range[1]} 共 ${total} 条记录`, pageSizeOptions: pageSizeOptions}"
:pagination="{ showTotal: (total, range) => `${range[0]}-${range[1]} ${total} records in total`, pageSizeOptions: pageSizeOptions}"
showPagination="auto"
:pageSize="25"
ref="table"
@ -33,7 +33,7 @@
icon="search"
size="small"
style="width: 90px; margin-right: 8px"
>搜索</a-button>
>{{ $t('button.query') }}</a-button>
<a-button
@click="() => handleReset(clearFilters, column)"
size="small"
@ -75,11 +75,11 @@
<a-divider type="vertical"/>
<a-popconfirm
title="确认删除?"
:title="$t('tip.confirmDelete')"
@confirm="handleDelete(record)"
@cancel="cancel"
okText=""
cancelText=""
:okText="$t('button.yes')"
:cancelText="$t('button.no')"
>
<a>{{ $t('tip.delete') }}</a>
</a-popconfirm>
@ -106,7 +106,6 @@ export default {
data () {
return {
scroll: { x: 1300, y: 500 },
btnName: '新增用户',
CITypeName: this.$route.params.CITypeName,
CITypeId: this.$route.params.CITypeId,
@ -122,7 +121,7 @@ export default {
},
columns: [
{
title: '用户名',
title: this.$t('acl.username'),
dataIndex: 'username',
sorter: false,
width: 150,
@ -141,7 +140,7 @@ export default {
}
},
{
title: '中文名',
title: this.$t('acl.nickname'),
dataIndex: 'nickname',
sorter: false,
width: 150,
@ -160,7 +159,7 @@ export default {
}
},
{
title: '部门',
title: this.$t('acl.department'),
dataIndex: 'department',
width: 100,
sorter: false,
@ -168,7 +167,7 @@ export default {
},
{
title: '小组',
title: this.$t('acl.catalog'),
dataIndex: 'catalog',
sorter: false,
width: 100,
@ -176,7 +175,7 @@ export default {
},
{
title: '邮箱',
title: this.$t('acl.email'),
dataIndex: 'email',
sorter: false,
width: 200,
@ -184,7 +183,7 @@ export default {
},
{
title: '手机',
title: this.$t('acl.mobile'),
dataIndex: 'mobile',
sorter: false,
width: 150,
@ -192,7 +191,7 @@ export default {
},
{
title: '加入时间',
title: this.$t('acl.joinedAt'),
dataIndex: 'date_joined',
sorter: false,
width: 200,
@ -200,13 +199,13 @@ export default {
},
{
title: '锁定',
title: this.$t('acl.block'),
dataIndex: 'block',
width: 100,
scopedSlots: { customRender: 'block' }
},
{
title: '操作',
title: this.$t('tip.operate'),
dataIndex: 'action',
width: 150,
scopedSlots: { customRender: 'action' }
@ -232,11 +231,8 @@ export default {
})
},
mdl: {},
// 高级搜索 展开/关闭
advanced: false,
// 查询参数
queryParam: {},
// 表头
selectedRowKeys: [],
selectedRows: [],
// custom table alert & rowSelection
@ -316,13 +312,13 @@ export default {
deleteUser (attrId) {
deleteUserById(attrId)
.then(res => {
this.$message.success(`删除成功`)
this.$message.success(this.$t('tip.deleteSuccess'))
this.handleOk()
})
.catch(err => this.requestFailed(err))
},
requestFailed (err) {
const msg = ((err.response || {}).data || {}).message || '请求出现错误,请稍后再试'
const msg = ((err.response || {}).data || {}).message || this.$t('tip.requestFailed')
this.$message.error(`${msg}`)
}

View File

@ -12,15 +12,15 @@
:tabBarStyle="{ textAlign: 'center', borderBottom: 'unset' }"
@change="handleTabClick"
>
<a-tab-pane key="tab1" tab="账号密码登录">
<a-tab-pane key="tab1" :tab="$t('login.loginHeader')">
<a-form-item>
<a-input
size="large"
type="text"
placeholder="用户名或者邮箱"
:placeholder="$t('login.loginName')"
v-decorator="[
'username',
{rules: [{ required: true, message: '请输入帐户名或邮箱地址' }, { validator: handleUsernameOrEmail }], validateTrigger: 'change'}
{rules: [{ required: true, message: $t('login.loginNameRequired') }, { validator: handleUsernameOrEmail }], validateTrigger: 'change'}
]"
>
<a-icon slot="prefix" type="user" :style="{ color: 'rgba(0,0,0,.25)' }"/>
@ -32,10 +32,10 @@
size="large"
type="password"
autocomplete="false"
placeholder="密码"
:placeholder="$t('login.password')"
v-decorator="[
'password',
{rules: [{ required: true, message: '请输入密码' }], validateTrigger: 'blur'}
{rules: [{ required: true, message: $t('login.passwordRequired') }], validateTrigger: 'blur'}
]"
>
<a-icon slot="prefix" type="lock" :style="{ color: 'rgba(0,0,0,.25)' }"/>
@ -45,7 +45,7 @@
</a-tabs>
<a-form-item>
<a-checkbox v-decorator="['rememberMe']">自动登录</a-checkbox>
<a-checkbox v-decorator="['rememberMe']">{{ $t('login.autoLogin') }}</a-checkbox>
</a-form-item>
<a-form-item style="margin-top:24px">
@ -142,18 +142,17 @@ export default {
loginSuccess (res) {
this.$router.push({ path: this.$route.query.redirect })
// 延迟 1 秒显示欢迎信息
setTimeout(() => {
this.$notification.success({
message: '欢迎',
description: `${timeFix()}欢迎回来`
message: this.$t('login.welcome'),
description: `${timeFix()}` + this.$t('login.welcomeBack')
})
}, 1000)
},
requestFailed (err) {
this.$notification['error']({
message: '错误',
description: ((err.response || {}).data || {}).message || '请求出现错误,请稍后再试',
message: this.$t('tip.error'),
description: ((err.response || {}).data || {}).message || this.$t('tip.requestFailed'),
duration: 4
})
}