mirror of
https://github.com/1Panel-dev/MaxKB.git
synced 2025-12-26 01:33:05 +00:00
fix: Fixed the issue where resource authorization modifications would automatically fold subfolders
This commit is contained in:
parent
cb6835c3fe
commit
c34c37f869
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
Loading…
Reference in New Issue