提交 bd424e21 authored 作者: 王鹏飞's avatar 王鹏飞

bug fixes

上级 943faa89
......@@ -14,11 +14,12 @@
ref="tree"
:props="defaultProps"
:filter-node-method="filterNode"
v-loading="submitLoading"
>
</el-tree>
<template #footer>
<el-button type="text" @click="onCancel">取消</el-button>&nbsp;&nbsp;
<el-button type="primary" size="medium" @click="onPrimary">保存</el-button>
<el-button type="primary" size="medium" @click="onPrimary" :loading="submitLoading">保存</el-button>
</template>
</el-dialog>
</template>
......@@ -34,7 +35,8 @@ export default {
activeName: '2',
permissions: [], // 所有权限
currentPermissions: [], // 当前角色权限
defaultProps: { children: 'children', label: 'name' }
defaultProps: { children: 'children', label: 'name' },
submitLoading: false
}
},
computed: {
......@@ -64,7 +66,7 @@ export default {
},
// 获取所有权限
getPermissions() {
getPermissionList({ app_id: this.appid, limit: 500 }).then(res => {
return getPermissionList({ app_id: this.appid, limit: 500 }).then(res => {
this.permissions = res.data.data
this.$nextTick(() => {
this.$refs.tree.filter(this.activeName)
......@@ -76,7 +78,11 @@ export default {
getRolePermissions({ app_id: this.appid, role_id: this.data.id }).then(res => {
if (res.data.length) {
this.currentPermissions = res.data.map(item => item.id)
this.$refs.tree.setCheckedKeys(this.currentPermissions)
// 有bug,暂时不用
// this.$refs.tree.setCheckedKeys(this.currentPermissions)
this.currentPermissions.forEach(id => {
this.$refs.tree.setChecked(id, true)
})
}
})
},
......@@ -91,11 +97,16 @@ export default {
role_id: this.data.id,
permission_ids: JSON.stringify(this.$refs.tree.getCheckedKeys())
}
updateRolePermissions(params).then(res => {
this.submitLoading = true
updateRolePermissions(params)
.then(res => {
this.$message.success('配置成功')
this.$emit('update:visible', false)
this.$emit('success', res.data)
})
.finally(() => {
this.submitLoading = false
})
}
}
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论