|
|
@ -6,11 +6,12 @@ |
|
|
|
<el-form :model="dataForm" |
|
|
|
:rules="dataRule" |
|
|
|
ref="dataForm" |
|
|
|
@keyup.enter.native="dataFormSubmitHandle()" |
|
|
|
label-width="120px"> |
|
|
|
<el-form-item prop="name" |
|
|
|
:label="$t('role.name')"> |
|
|
|
<el-input v-model="dataForm.name" |
|
|
|
maxlength="30" |
|
|
|
show-word-limit |
|
|
|
:placeholder="$t('role.name')"></el-input> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item label="角色类型"> |
|
|
@ -26,10 +27,12 @@ |
|
|
|
<el-form-item prop="remark" |
|
|
|
:label="$t('role.remark')"> |
|
|
|
<el-input v-model="dataForm.remark" |
|
|
|
maxlength="100" |
|
|
|
show-word-limit |
|
|
|
:placeholder="$t('role.remark')"></el-input> |
|
|
|
</el-form-item> |
|
|
|
<el-row> |
|
|
|
<el-col :span="5"> |
|
|
|
<el-col :span="8"> |
|
|
|
<el-form-item size="mini" |
|
|
|
:label="$t('role.menuList')"> |
|
|
|
<el-tree :data="menuList" |
|
|
@ -41,7 +44,7 @@ |
|
|
|
</el-tree> |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
|
<el-col :span="5"> |
|
|
|
<el-col :span="8"> |
|
|
|
<el-form-item size="mini" |
|
|
|
:label="$t('role.deptList')"> |
|
|
|
<el-tree :data="deptList" |
|
|
@ -53,7 +56,7 @@ |
|
|
|
</el-tree> |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
|
<el-col :span="4"> |
|
|
|
<el-col :span="8"> |
|
|
|
<el-form-item size="mini" |
|
|
|
:label="$t('role.appMenuList')"> |
|
|
|
<el-tree :data="appMenuList" |
|
|
@ -65,32 +68,7 @@ |
|
|
|
</el-tree> |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
|
<el-col :span="4"> |
|
|
|
<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-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 |
|
|
|
check-strictly=true> |
|
|
|
</el-tree> |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
|
<el-col :span="5"> |
|
|
|
<el-col :span="10"> |
|
|
|
<el-form-item size="mini" |
|
|
|
:label="$t('role.analysisMenuList')"> |
|
|
|
<el-tree :data="analysisMenuList" |
|
|
@ -120,19 +98,15 @@ export default { |
|
|
|
visible: false, |
|
|
|
menuList: [], |
|
|
|
deptList: [], |
|
|
|
whistleDeptList: [], |
|
|
|
appMenuList: [], |
|
|
|
categoryList: [], |
|
|
|
analysisMenuList:[], |
|
|
|
roleTypeList: [], |
|
|
|
analysisMenuList: [], |
|
|
|
dataForm: { |
|
|
|
id: '', |
|
|
|
name: '', |
|
|
|
menuIdList: [], |
|
|
|
deptIdList: [], |
|
|
|
appMenuIdList: [], |
|
|
|
categoryIdList: [], |
|
|
|
whistleDeptIdList: [], |
|
|
|
analysisMenuIdList: [], |
|
|
|
remark: '', |
|
|
|
typeKey: '' |
|
|
@ -159,15 +133,11 @@ export default { |
|
|
|
this.$refs.menuListTree.setCheckedKeys([]) |
|
|
|
this.$refs.deptListTree.setCheckedKeys([]) |
|
|
|
this.$refs.appMenuListTree.setCheckedKeys([]) |
|
|
|
this.$refs.categoryListTree.setCheckedKeys([]) |
|
|
|
this.$refs.whistleDeptListTree.setCheckedKeys([]) |
|
|
|
this.$refs.analysisMenuListTree.setCheckedKeys([]) |
|
|
|
Promise.all([ |
|
|
|
this.getMenuList(), |
|
|
|
this.getDeptList(), |
|
|
|
this.getAppMenuList(), |
|
|
|
this.getCategoryList(), |
|
|
|
this.getWhistleDeptList(), |
|
|
|
this.getAnalysisMenuList() |
|
|
|
]).then(() => { |
|
|
|
if (this.dataForm.id) { |
|
|
@ -194,15 +164,6 @@ 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 }) => { |
|
|
@ -212,15 +173,6 @@ 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(() => { }) |
|
|
|
}, |
|
|
|
getAnalysisMenuList () { |
|
|
|
return this.$http.get('/sys/analysismenu/select').then(({ data: res }) => { |
|
|
|
if (res.code !== 0) { |
|
|
@ -242,9 +194,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)) |
|
|
|
this.dataForm.analysisMenuIdList.forEach(item => this.$refs.analysisMenuListTree.setChecked(item, true)) |
|
|
|
this.$refs.whistleDeptListTree.setCheckedKeys(this.dataForm.whistleDeptIdList) |
|
|
|
}).catch(() => { }) |
|
|
|
}, |
|
|
|
// 表单提交 |
|
|
@ -262,15 +212,10 @@ export default { |
|
|
|
...this.$refs.appMenuListTree.getCheckedKeys(), |
|
|
|
...this.$refs.appMenuListTree.getHalfCheckedKeys() |
|
|
|
] |
|
|
|
this.dataForm.categoryIdList = [ |
|
|
|
...this.$refs.categoryListTree.getCheckedKeys(), |
|
|
|
...this.$refs.categoryListTree.getHalfCheckedKeys() |
|
|
|
] |
|
|
|
this.dataForm.analysisMenuIdList = [ |
|
|
|
...this.$refs.analysisMenuListTree.getCheckedKeys(), |
|
|
|
...this.$refs.analysisMenuListTree.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) |
|
|
@ -298,15 +243,8 @@ export default { |
|
|
|
} |
|
|
|
} |
|
|
|
</script> |
|
|
|
// 添加树样式 |
|
|
|
<style lang="scss"> |
|
|
|
.el-tree { |
|
|
|
width: 100%; |
|
|
|
overflow-x: auto; |
|
|
|
overflow-y: hidden; |
|
|
|
} |
|
|
|
.el-tree>.el-tree-node { |
|
|
|
display: inline-block; |
|
|
|
min-width: 100%; |
|
|
|
<style scoped> |
|
|
|
.el-dialog__wrapper /deep/ .el-dialog__footer { |
|
|
|
text-align: center!important; |
|
|
|
} |
|
|
|
</style> |
|
|
|