避免缓存导致

This commit is contained in:
lai
2024-09-27 19:18:28 +08:00
parent a77b968a17
commit a889f97bd6

View File

@@ -396,17 +396,6 @@ function fnModalVisibleByEdit(userId?: string | number) {
modalState.from = Object.assign(modalState.from, user); modalState.from = Object.assign(modalState.from, user);
modalState.from.roleIds = roleIds; modalState.from.roleIds = roleIds;
modalState.from.postIds = postIds; modalState.from.postIds = postIds;
//deptTreeData.value=[];
//若长度为0 删除租户选项
if (deptTreeData.value.length === 0) {
const index = modalState.options.roles.findIndex(
(role: any) => role.roleKey === 'tenant'
);
if (index !== -1) {
modalState.options.roles.splice(index, 1);
}
}
modalState.title = modalState.title =
t('common.addText') + t('views.system.user.userInfo'); t('common.addText') + t('views.system.user.userInfo');
modalState.visibleByEdit = true; modalState.visibleByEdit = true;
@@ -792,7 +781,8 @@ let deptTreeData = ref<DataNode[]>([]);
/**查询部门下拉树结构 */ /**查询部门下拉树结构 */
function fnGetDeptTree() { function fnGetDeptTree() {
deptTreeData.value = []; //reSet deptTreeData.value = []; //reSet
listTenant({ parentId: 0 }).then(res => { listTenant({ parentId: 0 })
.then(res => {
if (res.code === RESULT_CODE_SUCCESS && Array.isArray(res.data)) { if (res.code === RESULT_CODE_SUCCESS && Array.isArray(res.data)) {
res.data.forEach((item: any) => { res.data.forEach((item: any) => {
if (item.parentId === '0') { if (item.parentId === '0') {
@@ -805,6 +795,18 @@ function fnGetDeptTree() {
} }
}); });
} }
})
.finally(() => {
//若长度为0 删除租户选项
if (deptTreeData.value.length === 0) {
const index = modalState.options.roles.findIndex(
(role: any) => role.roleKey === 'tenant'
);
if (index !== -1) {
modalState.options.roles.splice(index, 1);
}
}
}); });
} }