fix: Fixed the issue where resource authorization modifications would automatically fold subfolders
parent
1d749a4a92
commit
d7a6de1515
|
|
@ -4,7 +4,7 @@
|
||||||
<el-avatar :size="30">
|
<el-avatar :size="30">
|
||||||
<img src="@/assets/user-icon.svg" style="width: 54%" alt=""/>
|
<img src="@/assets/user-icon.svg" style="width: 54%" alt=""/>
|
||||||
</el-avatar>
|
</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">
|
<el-icon class="el-icon--right">
|
||||||
<CaretBottom/>
|
<CaretBottom/>
|
||||||
</el-icon>
|
</el-icon>
|
||||||
|
|
@ -19,7 +19,7 @@
|
||||||
</el-avatar>
|
</el-avatar>
|
||||||
</div>
|
</div>
|
||||||
<div style="width: 90%">
|
<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">
|
<template v-if="user.userInfo?.role_name && user.userInfo.role_name.length > 0">
|
||||||
<TagGroup
|
<TagGroup
|
||||||
size="small"
|
size="small"
|
||||||
|
|
|
||||||
|
|
@ -60,7 +60,8 @@
|
||||||
:maxTableHeight="260"
|
:maxTableHeight="260"
|
||||||
:row-key="(row: any) => row.id"
|
:row-key="(row: any) => row.id"
|
||||||
style="min-width: 600px"
|
style="min-width: 600px"
|
||||||
|
:expand-row-keys="defaultExpandKeys"
|
||||||
|
:default-expand-all="searchForm.name || searchForm.permission?.length > 0"
|
||||||
show-overflow-tooltip
|
show-overflow-tooltip
|
||||||
>
|
>
|
||||||
<el-table-column type="selection" width="55" :reserve-selection="true"> </el-table-column>
|
<el-table-column type="selection" width="55" :reserve-selection="true"> </el-table-column>
|
||||||
|
|
@ -138,7 +139,7 @@
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref, onMounted, computed, nextTick } from 'vue'
|
import { ref, onMounted, computed, watch } from 'vue'
|
||||||
import { useRoute } from 'vue-router'
|
import { useRoute } from 'vue-router'
|
||||||
import type { Provider } from '@/api/type/model'
|
import type { Provider } from '@/api/type/model'
|
||||||
import { SourceTypeEnum } from '@/enums/common'
|
import { SourceTypeEnum } from '@/enums/common'
|
||||||
|
|
@ -159,25 +160,40 @@ const props = defineProps<{
|
||||||
}>()
|
}>()
|
||||||
const emit = defineEmits(['submitPermissions'])
|
const emit = defineEmits(['submitPermissions'])
|
||||||
|
|
||||||
const defaultExpandKeys = computed(() => {
|
const defaultExpandKeys = ref<Array<string>>([])
|
||||||
const searchName = searchForm.value.name || ''
|
const isComputedFirst = ref(true) // 仅第一次获得数据的时候需要计算一次展开属性
|
||||||
const searchPermissions = searchForm.value.permission ?? []
|
|
||||||
if (!searchName && (!searchPermissions || searchPermissions.length === 0)) {
|
watch(
|
||||||
return props.data?.length > 0 ? [props.data[0]?.id] : []
|
() => props.data,
|
||||||
|
(newData) => {
|
||||||
|
if (newData && newData.length > 0 && isComputedFirst.value) {
|
||||||
|
defaultExpandKeys.value = props.data?.length > 0 ? [props.data[0]?.id] : []
|
||||||
|
isComputedFirst.value = false
|
||||||
}
|
}
|
||||||
const expandIds: string[] = []
|
},
|
||||||
// 传入过滤后的数据
|
{ immediate: true },
|
||||||
const collectExpandIds = (nodes: any[]) => {
|
)
|
||||||
nodes.forEach((node) => {
|
|
||||||
if (node.children && node.children.length > 0) {
|
// const defaultExpandKeys = computed(() => {
|
||||||
expandIds.push(node.id)
|
// const searchName = searchForm.value.name || ''
|
||||||
collectExpandIds(node.children)
|
// const searchPermissions = searchForm.value.permission ?? []
|
||||||
}
|
// if (!searchName && (!searchPermissions || searchPermissions.length === 0)) {
|
||||||
})
|
// return props.data?.length > 0 ? [props.data[0]?.id] : []
|
||||||
}
|
|
||||||
collectExpandIds(filteredData.value)
|
// }
|
||||||
return expandIds
|
// 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(() => {
|
const permissionOptionMap = computed(() => {
|
||||||
return {
|
return {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue