diff --git a/src/i18n/zh-CN.js b/src/i18n/zh-CN.js
index c82e7535..ef5f5320 100644
--- a/src/i18n/zh-CN.js
+++ b/src/i18n/zh-CN.js
@@ -359,6 +359,7 @@ t.role.remark = '备注'
t.role.createDate = '创建时间'
t.role.menuList = '菜单授权'
t.role.deptList = '数据授权'
+t.role.appMenuList = 'App菜单授权'
t.user = {}
t.user.username = '用户名'
diff --git a/src/views/modules/sys/role-add-or-update.vue b/src/views/modules/sys/role-add-or-update.vue
index 670bc469..ac6b035d 100644
--- a/src/views/modules/sys/role-add-or-update.vue
+++ b/src/views/modules/sys/role-add-or-update.vue
@@ -29,7 +29,7 @@
:placeholder="$t('role.remark')">
-
+
-
+
+
+
+
+
+
+
@@ -71,12 +83,14 @@ export default {
visible: false,
menuList: [],
deptList: [],
+ appMenuList: [],
roleTypeList: [],
dataForm: {
id: '',
name: '',
menuIdList: [],
deptIdList: [],
+ appMenuIdList: [],
remark: '',
typeKey: ''
}
@@ -101,9 +115,11 @@ export default {
this.$refs['dataForm'].resetFields()
this.$refs.menuListTree.setCheckedKeys([])
this.$refs.deptListTree.setCheckedKeys([])
+ this.$refs.appMenuListTree.setCheckedKeys([])
Promise.all([
this.getMenuList(),
- this.getDeptList()
+ this.getDeptList(),
+ this.getAppMenuList()
]).then(() => {
if (this.dataForm.id) {
this.getInfo()
@@ -129,6 +145,15 @@ export default {
this.deptList = res.data
}).catch(() => { })
},
+ // 获取App菜单列表
+ getAppMenuList () {
+ return this.$http.get('/sys/appmenu/select').then(({ data: res }) => {
+ if (res.code !== 0) {
+ return this.$message.error(res.msg)
+ }
+ this.appMenuList = res.data
+ }).catch(() => { })
+ },
// 获取信息
getInfo () {
this.$http.get(`/sys/role/${this.dataForm.id}`).then(({ data: res }) => {
@@ -141,6 +166,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))
}).catch(() => { })
},
// 表单提交
@@ -154,6 +180,10 @@ export default {
...this.$refs.menuListTree.getHalfCheckedKeys()
]
this.dataForm.deptIdList = this.$refs.deptListTree.getCheckedKeys()
+ this.dataForm.appMenuIdList = [
+ ...this.$refs.appMenuListTree.getCheckedKeys(),
+ ...this.$refs.appMenuListTree.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)