避免缓存导致

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.roleIds = roleIds;
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 =
t('common.addText') + t('views.system.user.userInfo');
modalState.visibleByEdit = true;
@@ -792,20 +781,33 @@ let deptTreeData = ref<DataNode[]>([]);
/**查询部门下拉树结构 */
function fnGetDeptTree() {
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') {
deptTreeData.value.push({
childern: undefined,
title: item.tenantName,
key: item.tenantId,
...item,
});
listTenant({ parentId: 0 })
.then(res => {
if (res.code === RESULT_CODE_SUCCESS && Array.isArray(res.data)) {
res.data.forEach((item: any) => {
if (item.parentId === '0') {
deptTreeData.value.push({
childern: undefined,
title: item.tenantName,
key: item.tenantId,
...item,
});
}
});
}
})
.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);
}
});
}
});
}
});
}
function handleChange(value: any, options: any) {