Browse Source

角色管理添加项目处理类型授权

master
尹作梅 6 years ago
parent
commit
19c16be880
  1. 1
      src/i18n/zh-CN.js
  2. 38
      src/views/modules/sys/role-add-or-update.vue

1
src/i18n/zh-CN.js

@ -361,6 +361,7 @@ t.role.createDate = '创建时间'
t.role.menuList = '菜单授权'
t.role.deptList = '数据授权'
t.role.appMenuList = '工作端菜单授权'
t.role.categoryList = '项目处理类型授权'
t.user = {}
t.user.username = '用户名'

38
src/views/modules/sys/role-add-or-update.vue

@ -1,5 +1,5 @@
<template>
<el-dialog :visible.sync="visible"
<el-dialog :visible.sync="visible" width="1400px"
:title="!dataForm.id ? $t('add') : $t('update')"
:close-on-click-modal="false"
:close-on-press-escape="false">
@ -41,7 +41,7 @@
</el-tree>
</el-form-item>
</el-col>
<el-col :span="8">
<el-col :span="6">
<el-form-item size="mini"
:label="$t('role.deptList')">
<el-tree :data="deptList"
@ -53,7 +53,7 @@
</el-tree>
</el-form-item>
</el-col>
<el-col :span="8">
<el-col :span="5">
<el-form-item size="mini"
:label="$t('role.appMenuList')">
<el-tree :data="appMenuList"
@ -65,6 +65,18 @@
</el-tree>
</el-form-item>
</el-col>
<el-col :span="5">
<el-form-item size="mini"
:label="$t('role.categoryList')">
<el-tree :data="categoryList"
:props="{ label: 'name', children: 'children' }"
node-key="id"
ref="categoryListTree"
accordion
show-checkbox>
</el-tree>
</el-form-item>
</el-col>
</el-row>
</el-form>
<template slot="footer">
@ -84,6 +96,7 @@ export default {
menuList: [],
deptList: [],
appMenuList: [],
categoryList: [],
roleTypeList: [],
dataForm: {
id: '',
@ -91,6 +104,7 @@ export default {
menuIdList: [],
deptIdList: [],
appMenuIdList: [],
categoryIdList: [],
remark: '',
typeKey: ''
}
@ -116,10 +130,12 @@ export default {
this.$refs.menuListTree.setCheckedKeys([])
this.$refs.deptListTree.setCheckedKeys([])
this.$refs.appMenuListTree.setCheckedKeys([])
this.$refs.categoryListTree.setCheckedKeys([])
Promise.all([
this.getMenuList(),
this.getDeptList(),
this.getAppMenuList()
this.getAppMenuList(),
this.getCategoryList()
]).then(() => {
if (this.dataForm.id) {
this.getInfo()
@ -154,6 +170,15 @@ export default {
this.appMenuList = res.data
}).catch(() => { })
},
//
getCategoryList () {
return this.$http.get('/events/handlecategory/getCategoryList').then(({ data: res }) => {
if (res.code !== 0) {
return this.$message.error(res.msg)
}
this.categoryList = res.data
}).catch(() => { })
},
//
getInfo () {
this.$http.get(`/sys/role/${this.dataForm.id}`).then(({ data: res }) => {
@ -167,6 +192,7 @@ export default {
this.dataForm.menuIdList.forEach(item => this.$refs.menuListTree.setChecked(item, true))
this.$refs.deptListTree.setCheckedKeys(this.dataForm.deptIdList)
this.dataForm.appMenuIdList.forEach(item => this.$refs.appMenuListTree.setChecked(item, true))
this.dataForm.categoryIdList.forEach(item => this.$refs.categoryListTree.setChecked(item, true))
}).catch(() => { })
},
//
@ -184,6 +210,10 @@ export default {
...this.$refs.appMenuListTree.getCheckedKeys(),
...this.$refs.appMenuListTree.getHalfCheckedKeys()
]
this.dataForm.categoryIdList = [
...this.$refs.categoryListTree.getCheckedKeys(),
...this.$refs.categoryListTree.getHalfCheckedKeys()
]
this.$http[!this.dataForm.id ? 'post' : 'put']('/sys/role', this.dataForm).then(({ data: res }) => {
if (res.code !== 0) {
return this.$message.error(res.msg)

Loading…
Cancel
Save