Skip to content

Commit 34448a2

Browse files
dataeaseShuliuruibin
authored andcommitted
feat(workspace): bug fix
1 parent fdedcc1 commit 34448a2

File tree

1 file changed

+14
-11
lines changed

1 file changed

+14
-11
lines changed

ui/src/views/shared/AuthorizedWorkspaceDialog.vue

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,14 @@
3838
<el-checkbox-group v-model="checkedWorkspace" @change="handleCheckedWorkspaceChange">
3939
<el-checkbox
4040
v-for="space in workspaceWithKeywords"
41-
:key="space"
42-
:label="space"
41+
:key="space.id"
42+
:label="space.name"
4343
:value="space"
4444
>
4545
<el-icon size="20">
4646
<momentsCategories></momentsCategories>
4747
</el-icon>
48-
{{ space }}
48+
{{ space.name }}
4949
</el-checkbox>
5050
</el-checkbox-group>
5151
</div>
@@ -58,7 +58,7 @@
5858
<el-icon size="20">
5959
<momentsCategories></momentsCategories>
6060
</el-icon>
61-
<div class="label">{{ ele }}</div>
61+
<div class="label">{{ ele.name }}</div>
6262
<el-icon @click="clearWorkspace(ele)" class="close" size="16">
6363
<closeIcon></closeIcon>
6464
</el-icon>
@@ -98,7 +98,7 @@ const closeIcon = iconMap['close-outlined'].iconReader()
9898
const momentsCategories = iconMap['moments-categories'].iconReader()
9999
100100
const workspaceWithKeywords = computed(() => {
101-
return workspace.value.filter((ele) => (ele as string).includes(search.value))
101+
return workspace.value.filter((ele) => (ele.name as string).includes(search.value))
102102
})
103103
const handleCheckAllChange = (val: CheckboxValueType) => {
104104
checkedWorkspace.value = val ? workspace.value : []
@@ -117,7 +117,7 @@ const handleCheckedWorkspaceChange = (value: CheckboxValueType[]) => {
117117
checkAll.value = checkedCount === workspace.value.length
118118
isIndeterminate.value = checkedCount > 0 && checkedCount < workspace.value.length
119119
auth_list = [
120-
...value.map((ele) => ({ authentication_type: listType.value, workspace_id: ele })),
120+
...value.map((ele) => ({ authentication_type: listType.value, workspace_id: ele.id, name: ele.name })),
121121
...auth_list.filter((ele) => ele.authentication_type !== listType.value),
122122
]
123123
}
@@ -133,7 +133,10 @@ const open = ({ id }: any, type = 'Knowledge') => {
133133
.then((res: any) => {
134134
auth_list = (res.data || {}).auth_list || []
135135
un_auth_list = (res.data || {}).un_auth_list || []
136-
workspace.value = [...un_auth_list, ...auth_list.map((ele) => ele.workspace_id)] as any
136+
workspace.value = [
137+
...un_auth_list,
138+
...auth_list.map((ele) => ({ id: ele.workspace_id, name: ele.name })),
139+
] as any
137140
handleListTypeChange(listType.value)
138141
})
139142
.finally(() => {
@@ -144,16 +147,16 @@ const open = ({ id }: any, type = 'Knowledge') => {
144147
145148
const handleConfirm = () => {
146149
authorizationApi[`postSharedAuthorization${currentType}`](knowledge_id, {
147-
workspace_id_list: checkedWorkspace.value,
150+
workspace_id_list: checkedWorkspace.value.map(ele => ele.id),
148151
authentication_type: listType.value,
149152
}).then(() => {
150153
centerDialogVisible.value = false
151154
})
152155
}
153156
154157
const clearWorkspace = (val: any) => {
155-
checkedWorkspace.value = checkedWorkspace.value.filter((ele) => ele !== val)
156-
auth_list = auth_list.filter((ele) => ele.workspace_id !== val)
158+
checkedWorkspace.value = checkedWorkspace.value.filter((ele) => ele.id !== val.id)
159+
auth_list = auth_list.filter((ele) => ele.workspace_id !== val.id)
157160
}
158161
159162
const clearWorkspaceAll = () => {
@@ -165,7 +168,7 @@ const clearWorkspaceAll = () => {
165168
const handleListTypeChange = (val: any) => {
166169
checkedWorkspace.value = auth_list
167170
.filter((ele) => ele.authentication_type === val)
168-
.map((ele) => ele.workspace_id) as any
171+
.map((ele) => ({ id: ele.workspace_id, name: ele.name })) as any
169172
handleCheckedWorkspaceChange(checkedWorkspace.value)
170173
}
171174
defineExpose({

0 commit comments

Comments
 (0)