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