实时更新租户树
This commit is contained in:
@@ -431,6 +431,8 @@ function fnModalVisibleByEdit(userId?: string | number) {
|
||||
(role: any) => role.roleKey === 'tenant'
|
||||
);
|
||||
|
||||
if(modalState.showTenant) fnGetDeptTree();
|
||||
|
||||
modalState.title =
|
||||
t('common.editText') + t('views.system.user.userInfo');
|
||||
modalState.visibleByEdit = true;
|
||||
@@ -497,7 +499,7 @@ function fnModalCancel() {
|
||||
modalStateFrom.resetFields();
|
||||
modalState.options.roles = [];
|
||||
modalState.options.posts = [];
|
||||
modalState.showTenant=false;
|
||||
modalState.showTenant = false;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -777,8 +779,8 @@ let deptTreeData = ref<DataNode[]>([]);
|
||||
|
||||
/**查询部门下拉树结构 */
|
||||
function fnGetDeptTree() {
|
||||
if (deptTreeData.value.length > 0) return;
|
||||
listTenant({ parentId: 0 }).then(res => {
|
||||
deptTreeData.value=[]; //reSet
|
||||
listTenant({ parentId: 0 }).then(res => {
|
||||
if (res.code === RESULT_CODE_SUCCESS && Array.isArray(res.data)) {
|
||||
res.data.forEach((item: any) => {
|
||||
if (item.parentId === '0') {
|
||||
@@ -797,6 +799,8 @@ function fnGetDeptTree() {
|
||||
function handleChange(value: any, options: any) {
|
||||
modalState.from.roleIds = [value];
|
||||
modalState.showTenant = options.roleKey === 'tenant';
|
||||
// 获取租户树结构数据
|
||||
if (modalState.showTenant) fnGetDeptTree();
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
@@ -814,8 +818,6 @@ onMounted(() => {
|
||||
});
|
||||
// 获取列表数据
|
||||
fnGetList();
|
||||
// 获取部门树结构数据
|
||||
fnGetDeptTree();
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user