fix: Resource authorization: "Select All" is ineffective (#4274)

v3.2
shaohuzhang1 2025-10-28 11:29:17 +08:00 committed by GitHub
parent c3acbeff63
commit 871e810918
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 6 additions and 2 deletions

View File

@ -56,13 +56,14 @@
class="mt-16" class="mt-16"
:data="filteredData" :data="filteredData"
@select="select" @select="select"
@select-all="selectAll"
: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" :expand-row-keys="defaultExpandKeys"
show-overflow-tooltip show-overflow-tooltip
> >
<el-table-column type="selection" width="55" :reserve-selection="true" /> <el-table-column type="selection" width="55" :reserve-selection="true"> </el-table-column>
<el-table-column prop="name" :label="$t('common.name')"> <el-table-column prop="name" :label="$t('common.name')">
<template #default="{ row }"> <template #default="{ row }">
<span style="vertical-align: sub"> <span style="vertical-align: sub">
@ -137,7 +138,7 @@
</div> </div>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { ref, onMounted, watch, computed, reactive } from 'vue' import { ref, onMounted, computed, nextTick } 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'
@ -312,6 +313,9 @@ const filteredData = computed(() => {
const multipleSelection = ref<any[]>([]) const multipleSelection = ref<any[]>([])
const selectObj: any = {} const selectObj: any = {}
const selectAll = (selection: any[]) => {
multipleSelection.value = selection
}
const select = (val: any[], active: any) => { const select = (val: any[], active: any) => {
if (active.resource_type === 'folder') { if (active.resource_type === 'folder') {
if (!val.some((item) => item.id == active.id)) { if (!val.some((item) => item.id == active.id)) {