|
|
|
@ -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) |
|
|
|
|