Browse Source

角色管理新增吹哨部门授权

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

1
src/i18n/zh-CN.js

@ -362,6 +362,7 @@ t.role.menuList = '菜单授权'
t.role.deptList = '数据授权'
t.role.appMenuList = '工作端菜单授权'
t.role.categoryList = '项目处理类型授权'
t.role.whistleDeptList = '吹哨部门授权'
t.user = {}
t.user.username = '用户名'

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

@ -1,5 +1,5 @@
<template>
<el-dialog :visible.sync="visible" width="1400px"
<el-dialog :visible.sync="visible" width="1500px"
:title="!dataForm.id ? $t('add') : $t('update')"
:close-on-click-modal="false"
:close-on-press-escape="false">
@ -29,7 +29,7 @@
:placeholder="$t('role.remark')"></el-input>
</el-form-item>
<el-row>
<el-col :span="8">
<el-col :span="5">
<el-form-item size="mini"
:label="$t('role.menuList')">
<el-tree :data="menuList"
@ -41,7 +41,7 @@
</el-tree>
</el-form-item>
</el-col>
<el-col :span="6">
<el-col :span="5">
<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="5">
<el-col :span="4">
<el-form-item size="mini"
:label="$t('role.appMenuList')">
<el-tree :data="appMenuList"
@ -65,7 +65,7 @@
</el-tree>
</el-form-item>
</el-col>
<el-col :span="5">
<el-col :span="4">
<el-form-item size="mini"
:label="$t('role.categoryList')">
<el-tree :data="categoryList"
@ -77,6 +77,18 @@
</el-tree>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item size="mini"
:label="$t('role.whistleDeptList')">
<el-tree :data="whistleDeptList"
:props="{ label: 'name', children: 'children' }"
node-key="id"
ref="whistleDeptListTree"
accordion
show-checkbox>
</el-tree>
</el-form-item>
</el-col>
</el-row>
</el-form>
<template slot="footer">
@ -95,6 +107,7 @@ export default {
visible: false,
menuList: [],
deptList: [],
whistleDeptList: [],
appMenuList: [],
categoryList: [],
roleTypeList: [],
@ -105,6 +118,7 @@ export default {
deptIdList: [],
appMenuIdList: [],
categoryIdList: [],
whistleDeptIdList: [],
remark: '',
typeKey: ''
}
@ -131,11 +145,13 @@ export default {
this.$refs.deptListTree.setCheckedKeys([])
this.$refs.appMenuListTree.setCheckedKeys([])
this.$refs.categoryListTree.setCheckedKeys([])
this.$refs.whistleDeptListTree.setCheckedKeys([])
Promise.all([
this.getMenuList(),
this.getDeptList(),
this.getAppMenuList(),
this.getCategoryList()
this.getCategoryList(),
this.getWhistleDeptList()
]).then(() => {
if (this.dataForm.id) {
this.getInfo()
@ -161,6 +177,15 @@ export default {
this.deptList = res.data
}).catch(() => { })
},
//
getWhistleDeptList () {
return this.$http.get('/sys/dept/list').then(({ data: res }) => {
if (res.code !== 0) {
return this.$message.error(res.msg)
}
this.whistleDeptList = res.data
}).catch(() => { })
},
// App
getAppMenuList () {
return this.$http.get('/sys/appmenu/select').then(({ data: res }) => {
@ -193,6 +218,7 @@ export default {
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))
this.$refs.whistleDeptListTree.setCheckedKeys(this.dataForm.whistleDeptIdList)
}).catch(() => { })
},
//
@ -214,6 +240,7 @@ export default {
...this.$refs.categoryListTree.getCheckedKeys(),
...this.$refs.categoryListTree.getHalfCheckedKeys()
]
this.dataForm.whistleDeptIdList = this.$refs.whistleDeptListTree.getCheckedKeys()
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