fix: Fixed the issue where resource authorization modifications would automatically fold subfolders

This commit is contained in:
wangdan-fit2cloud 2025-11-05 17:37:19 +08:00
parent 1d749a4a92
commit d7a6de1515
2 changed files with 43 additions and 27 deletions

View File

@ -4,7 +4,7 @@
<el-avatar :size="30">
<img src="@/assets/user-icon.svg" style="width: 54%" alt=""/>
</el-avatar>
<span class="ml-8 color-text-primary">{{ user.userInfo?.username }}</span>
<span class="ml-8 color-text-primary ellipsis" :title="user.userInfo?.nick_name">{{ user.userInfo?.nick_name }}</span>
<el-icon class="el-icon--right">
<CaretBottom/>
</el-icon>
@ -19,7 +19,7 @@
</el-avatar>
</div>
<div style="width: 90%">
<p class="bold mb-4" style="font-size: 14px">{{ user.userInfo?.username }}</p>
<p class="bold mb-4" style="font-size: 14px">{{ user.userInfo?.nick_name }}({{ user.userInfo?.username }})</p>
<template v-if="user.userInfo?.role_name && user.userInfo.role_name.length > 0">
<TagGroup
size="small"
@ -191,13 +191,13 @@ const m:any = {
"工作空间管理员": 'layout.about.inner_wsm',
"普通用户":'layout.about.inner_user'
}
const role_list = computed(() => {
if (!user.userInfo) {
const role_list = computed(() => {
if (!user.userInfo) {
return []
}
return user.userInfo?.role_name?.map(name => {
return user.userInfo?.role_name?.map(name => {
const inner = m[name]
if (inner) {
if (inner) {
return t(inner)
}
return name

View File

@ -60,7 +60,8 @@
:maxTableHeight="260"
:row-key="(row: any) => row.id"
style="min-width: 600px"
:expand-row-keys="defaultExpandKeys"
:default-expand-all="searchForm.name || searchForm.permission?.length > 0"
show-overflow-tooltip
>
<el-table-column type="selection" width="55" :reserve-selection="true"> </el-table-column>
@ -138,7 +139,7 @@
</div>
</template>
<script setup lang="ts">
import { ref, onMounted, computed, nextTick } from 'vue'
import { ref, onMounted, computed, watch } from 'vue'
import { useRoute } from 'vue-router'
import type { Provider } from '@/api/type/model'
import { SourceTypeEnum } from '@/enums/common'
@ -159,25 +160,40 @@ const props = defineProps<{
}>()
const emit = defineEmits(['submitPermissions'])
const defaultExpandKeys = computed(() => {
const searchName = searchForm.value.name || ''
const searchPermissions = searchForm.value.permission ?? []
if (!searchName && (!searchPermissions || searchPermissions.length === 0)) {
return props.data?.length > 0 ? [props.data[0]?.id] : []
}
const expandIds: string[] = []
//
const collectExpandIds = (nodes: any[]) => {
nodes.forEach((node) => {
if (node.children && node.children.length > 0) {
expandIds.push(node.id)
collectExpandIds(node.children)
}
})
}
collectExpandIds(filteredData.value)
return expandIds
})
const defaultExpandKeys = ref<Array<string>>([])
const isComputedFirst = ref(true) //
watch(
() => props.data,
(newData) => {
if (newData && newData.length > 0 && isComputedFirst.value) {
defaultExpandKeys.value = props.data?.length > 0 ? [props.data[0]?.id] : []
isComputedFirst.value = false
}
},
{ immediate: true },
)
// const defaultExpandKeys = computed(() => {
// const searchName = searchForm.value.name || ''
// const searchPermissions = searchForm.value.permission ?? []
// if (!searchName && (!searchPermissions || searchPermissions.length === 0)) {
// return props.data?.length > 0 ? [props.data[0]?.id] : []
// }
// const expandIds: string[] = []
// //
// const collectExpandIds = (nodes: any[]) => {
// nodes.forEach((node) => {
// if (node.children && node.children.length > 0) {
// expandIds.push(node.id)
// collectExpandIds(node.children)
// }
// })
// }
// collectExpandIds(filteredData.value)
// return expandIds
// })
const permissionOptionMap = computed(() => {
return {