|
|
@ -20,18 +20,18 @@ |
|
|
|
</el-tree> |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
|
<el-col :span="12"> |
|
|
|
<el-form-item size="mini" :label="$t('role.deptList')"> |
|
|
|
<el-tree |
|
|
|
:data="deptList" |
|
|
|
:props="{ label: 'name', children: 'children' }" |
|
|
|
node-key="id" |
|
|
|
ref="deptListTree" |
|
|
|
accordion |
|
|
|
show-checkbox> |
|
|
|
</el-tree> |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
|
<!-- <el-col :span="12">--> |
|
|
|
<!-- <el-form-item size="mini" :label="$t('role.deptList')">--> |
|
|
|
<!-- <el-tree--> |
|
|
|
<!-- :data="deptList"--> |
|
|
|
<!-- :props="{ label: 'name', children: 'children' }"--> |
|
|
|
<!-- node-key="id"--> |
|
|
|
<!-- ref="deptListTree"--> |
|
|
|
<!-- accordion--> |
|
|
|
<!-- show-checkbox>--> |
|
|
|
<!-- </el-tree>--> |
|
|
|
<!-- </el-form-item>--> |
|
|
|
<!-- </el-col>--> |
|
|
|
</el-row> |
|
|
|
</el-form> |
|
|
|
<template slot="footer"> |
|
|
@ -48,12 +48,12 @@ export default { |
|
|
|
return { |
|
|
|
visible: false, |
|
|
|
menuList: [], |
|
|
|
deptList: [], |
|
|
|
// deptList: [], |
|
|
|
dataForm: { |
|
|
|
id: '', |
|
|
|
name: '', |
|
|
|
menuIdList: [], |
|
|
|
deptIdList: [], |
|
|
|
// deptIdList: [], |
|
|
|
remark: '' |
|
|
|
} |
|
|
|
} |
|
|
@ -73,10 +73,10 @@ export default { |
|
|
|
this.$nextTick(() => { |
|
|
|
this.$refs['dataForm'].resetFields() |
|
|
|
this.$refs.menuListTree.setCheckedKeys([]) |
|
|
|
this.$refs.deptListTree.setCheckedKeys([]) |
|
|
|
// this.$refs.deptListTree.setCheckedKeys([]) |
|
|
|
Promise.all([ |
|
|
|
this.getMenuList(), |
|
|
|
this.getDeptList() |
|
|
|
this.getMenuList() |
|
|
|
// this.getDeptList() |
|
|
|
]).then(() => { |
|
|
|
if (this.dataForm.id) { |
|
|
|
this.getInfo() |
|
|
@ -86,7 +86,7 @@ export default { |
|
|
|
}, |
|
|
|
// 获取菜单列表 |
|
|
|
getMenuList () { |
|
|
|
return this.$http.get('/sys/menu/select').then(({ data: res }) => { |
|
|
|
return this.$http.get('/oper/access/menu/select').then(({ data: res }) => { |
|
|
|
if (res.code !== 0) { |
|
|
|
return this.$message.error(res.msg) |
|
|
|
} |
|
|
@ -94,17 +94,17 @@ export default { |
|
|
|
}).catch(() => {}) |
|
|
|
}, |
|
|
|
// 获取部门列表 |
|
|
|
getDeptList () { |
|
|
|
return this.$http.get('/sys/dept/list').then(({ data: res }) => { |
|
|
|
if (res.code !== 0) { |
|
|
|
return this.$message.error(res.msg) |
|
|
|
} |
|
|
|
this.deptList = res.data |
|
|
|
}).catch(() => {}) |
|
|
|
}, |
|
|
|
// getDeptList () { |
|
|
|
// return this.$http.get('/sys/dept/list').then(({ data: res }) => { |
|
|
|
// if (res.code !== 0) { |
|
|
|
// return this.$message.error(res.msg) |
|
|
|
// } |
|
|
|
// this.deptList = res.data |
|
|
|
// }).catch(() => {}) |
|
|
|
// }, |
|
|
|
// 获取信息 |
|
|
|
getInfo () { |
|
|
|
this.$http.get(`/sys/role/${this.dataForm.id}`).then(({ data: res }) => { |
|
|
|
this.$http.get(`/oper/access/operrole/${this.dataForm.id}`).then(({ data: res }) => { |
|
|
|
if (res.code !== 0) { |
|
|
|
return this.$message.error(res.msg) |
|
|
|
} |
|
|
@ -113,7 +113,7 @@ export default { |
|
|
|
...res.data |
|
|
|
} |
|
|
|
this.dataForm.menuIdList.forEach(item => this.$refs.menuListTree.setChecked(item, true)) |
|
|
|
this.$refs.deptListTree.setCheckedKeys(this.dataForm.deptIdList) |
|
|
|
// this.$refs.deptListTree.setCheckedKeys(this.dataForm.deptIdList) |
|
|
|
}).catch(() => {}) |
|
|
|
}, |
|
|
|
// 表单提交 |
|
|
@ -126,8 +126,8 @@ export default { |
|
|
|
...this.$refs.menuListTree.getCheckedKeys(), |
|
|
|
...this.$refs.menuListTree.getHalfCheckedKeys() |
|
|
|
] |
|
|
|
this.dataForm.deptIdList = this.$refs.deptListTree.getCheckedKeys() |
|
|
|
this.$http[!this.dataForm.id ? 'post' : 'put']('/sys/role', this.dataForm).then(({ data: res }) => { |
|
|
|
// this.dataForm.deptIdList = this.$refs.deptListTree.getCheckedKeys() |
|
|
|
this.$http[!this.dataForm.id ? 'post' : 'put']('/oper/access/operrole', this.dataForm).then(({ data: res }) => { |
|
|
|
if (res.code !== 0) { |
|
|
|
return this.$message.error(res.msg) |
|
|
|
} |
|
|
|