Skip to content

Commit 9aba8ae

Browse files
committed
fix(Workspace): The workspace page freezes when adding users.
1 parent 53bedcc commit 9aba8ae

1 file changed

Lines changed: 101 additions & 47 deletions

File tree

frontend/src/views/system/workspace/AuthorizedWorkspaceDialog.vue

Lines changed: 101 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<el-dialog
33
v-model="centerDialogVisible"
44
:title="$t('workspace.add_member')"
5-
modal-class="authorized-workspace"
5+
modal-class="authorized-workspace_dialog"
66
width="840"
77
>
88
<p class="mb-8 lighter">{{ $t('workspace.member_type') }}</p>
@@ -42,25 +42,44 @@
4242
class="checkbox-group-block"
4343
@change="handleCheckedWorkspaceChange"
4444
>
45-
<el-checkbox
46-
v-for="space in workspaceWithKeywords"
47-
:key="space.id"
48-
:label="space.name"
49-
:value="space"
50-
class="hover-bg"
45+
<FixedSizeList
46+
:item-size="44"
47+
:data="workspaceWithKeywords"
48+
:total="workspaceWithKeywords.length"
49+
:height="330"
50+
scrollbar-always-on
51+
layout="vertical"
5152
>
52-
<div class="flex">
53-
<el-icon size="28">
54-
<avatar_personal></avatar_personal>
55-
</el-icon>
56-
<span class="ml-4 ellipsis" style="max-width: 40%" :title="space.name">
57-
{{ space.name }}</span
58-
>
59-
<span class="account ellipsis" style="max-width: 40%" :title="space.account"
60-
>({{ space.account }})</span
61-
>
62-
</div>
63-
</el-checkbox>
53+
<template #default="{ index, style }">
54+
<div class="fixed-size_list" :style="style">
55+
<el-checkbox
56+
:key="workspaceWithKeywords[index].id"
57+
:label="workspaceWithKeywords[index].name"
58+
:value="workspaceWithKeywords[index]"
59+
class="hover-bg"
60+
>
61+
<div class="flex">
62+
<el-icon size="28">
63+
<avatar_personal></avatar_personal>
64+
</el-icon>
65+
<span
66+
class="ml-4 ellipsis"
67+
style="max-width: 40%"
68+
:title="workspaceWithKeywords[index].name"
69+
>
70+
{{ workspaceWithKeywords[index].name }}</span
71+
>
72+
<span
73+
class="account ellipsis"
74+
style="max-width: 40%"
75+
:title="workspaceWithKeywords[index].account"
76+
>({{ workspaceWithKeywords[index].account }})</span
77+
>
78+
</div>
79+
</el-checkbox>
80+
</div>
81+
</template>
82+
</FixedSizeList>
6483
</el-checkbox-group>
6584
</div>
6685
</div>
@@ -74,30 +93,46 @@
7493
{{ $t('workspace.clear') }}
7594
</el-button>
7695
</div>
77-
<div
78-
v-for="ele in checkTableList"
79-
:key="ele.name"
80-
style="margin: 0 16px; position: relative"
81-
class="flex-between align-center hover-bg_select"
82-
>
83-
<div
84-
:title="`${ele.name}(${ele.account})`"
85-
class="flex align-center ellipsis"
86-
style="width: 100%"
96+
<div class="select-right_member">
97+
<FixedSizeList
98+
:item-size="44"
99+
:data="checkTableList"
100+
:total="checkTableList.length"
101+
:height="358"
102+
scrollbar-always-on
103+
layout="vertical"
87104
>
88-
<el-icon size="28">
89-
<avatar_personal></avatar_personal>
90-
</el-icon>
91-
<span class="ml-4 lighter ellipsis" style="max-width: 40%" :title="ele.name">{{
92-
ele.name
93-
}}</span>
94-
<span class="account ellipsis" style="max-width: 40%" :title="ele.account"
95-
>({{ ele.account }})</span
96-
>
97-
</div>
98-
<el-button class="close-btn" text>
99-
<el-icon size="16" @click="clearWorkspace(ele)"><Close /></el-icon>
100-
</el-button>
105+
<template #default="{ index, style }">
106+
<div :key="checkTableList[index].name" :style="style" class="hover-bg_select">
107+
<div
108+
:title="`${checkTableList[index].name}(${checkTableList[index].account})`"
109+
class="flex align-center ellipsis"
110+
style="width: 100%"
111+
>
112+
<el-icon size="28">
113+
<avatar_personal></avatar_personal>
114+
</el-icon>
115+
<span
116+
class="ml-4 lighter ellipsis"
117+
style="max-width: 40%"
118+
:title="checkTableList[index].name"
119+
>{{ checkTableList[index].name }}</span
120+
>
121+
<span
122+
class="account ellipsis"
123+
style="max-width: 40%"
124+
:title="checkTableList[index].account"
125+
>({{ checkTableList[index].account }})</span
126+
>
127+
</div>
128+
<el-button class="close-btn" text>
129+
<el-icon size="16" @click="clearWorkspace(checkTableList[index])"
130+
><Close
131+
/></el-icon>
132+
</el-button>
133+
</div>
134+
</template>
135+
</FixedSizeList>
101136
</div>
102137
</div>
103138
</div>
@@ -116,6 +151,7 @@
116151

117152
<script lang="ts" setup>
118153
import { ref, computed, watch } from 'vue'
154+
import FixedSizeList from 'element-plus-secondary/es/components/virtual-list/src/components/fixed-size-list.mjs'
119155
import { workspaceOptionUserList, workspaceUwsCreate } from '@/api/workspace'
120156
import avatar_personal from '@/assets/svg/avatar_personal.svg'
121157
import Close from '@/assets/svg/icon_close_outlined_w.svg'
@@ -222,7 +258,7 @@ defineExpose({
222258
})
223259
</script>
224260
<style lang="less">
225-
.authorized-workspace {
261+
.authorized-workspace_dialog {
226262
.mb-8 {
227263
margin-bottom: 8px;
228264
}
@@ -238,7 +274,7 @@ defineExpose({
238274
&::after {
239275
content: '';
240276
height: 44px;
241-
width: calc(100% + 34px);
277+
width: calc(100% + 16px);
242278
background: #1f23291a;
243279
position: absolute;
244280
border-radius: 6px;
@@ -251,9 +287,13 @@ defineExpose({
251287
}
252288
253289
.hover-bg_select {
290+
display: flex;
291+
align-items: center;
292+
padding: 0 8px;
254293
&:hover {
255294
&::after {
256-
width: calc(100% + 16px);
295+
width: 100%;
296+
left: 0;
257297
}
258298
}
259299
}
@@ -273,7 +313,13 @@ defineExpose({
273313
}
274314
275315
.checkbox-group-block {
276-
margin: 0 16px;
316+
position: relative;
317+
.ed-vl__window {
318+
overflow-y: hidden !important;
319+
}
320+
.fixed-size_list {
321+
padding-left: 16px;
322+
}
277323
}
278324
279325
.checkbox-group-block {
@@ -311,7 +357,15 @@ defineExpose({
311357
.w-full {
312358
height: 100%;
313359
width: 50%;
314-
overflow-y: auto;
360+
361+
.select-right_member {
362+
height: 358px;
363+
padding: 0 8px 0 8px;
364+
position: relative;
365+
.ed-vl__window {
366+
overflow-y: hidden !important;
367+
}
368+
}
315369
316370
.flex-between {
317371
height: 44px;

0 commit comments

Comments
 (0)