38
38
<el-checkbox-group v-model =" checkedWorkspace" @change =" handleCheckedWorkspaceChange" >
39
39
<el-checkbox
40
40
v-for =" space in workspaceWithKeywords"
41
- :key =" space"
42
- :label =" space"
41
+ :key =" space.id "
42
+ :label =" space.name "
43
43
:value =" space"
44
44
>
45
45
<el-icon size =" 20" >
46
46
<momentsCategories ></momentsCategories >
47
47
</el-icon >
48
- {{ space }}
48
+ {{ space.name }}
49
49
</el-checkbox >
50
50
</el-checkbox-group >
51
51
</div >
58
58
<el-icon size =" 20" >
59
59
<momentsCategories ></momentsCategories >
60
60
</el-icon >
61
- <div class =" label" >{{ ele }}</div >
61
+ <div class =" label" >{{ ele.name }}</div >
62
62
<el-icon @click =" clearWorkspace(ele)" class =" close" size =" 16" >
63
63
<closeIcon ></closeIcon >
64
64
</el-icon >
@@ -98,7 +98,7 @@ const closeIcon = iconMap['close-outlined'].iconReader()
98
98
const momentsCategories = iconMap [' moments-categories' ].iconReader ()
99
99
100
100
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 ))
102
102
})
103
103
const handleCheckAllChange = (val : CheckboxValueType ) => {
104
104
checkedWorkspace .value = val ? workspace .value : []
@@ -117,7 +117,7 @@ const handleCheckedWorkspaceChange = (value: CheckboxValueType[]) => {
117
117
checkAll .value = checkedCount === workspace .value .length
118
118
isIndeterminate .value = checkedCount > 0 && checkedCount < workspace .value .length
119
119
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 })),
121
121
... auth_list .filter ((ele ) => ele .authentication_type !== listType .value ),
122
122
]
123
123
}
@@ -133,7 +133,10 @@ const open = ({ id }: any, type = 'Knowledge') => {
133
133
.then ((res : any ) => {
134
134
auth_list = (res .data || {}).auth_list || []
135
135
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
137
140
handleListTypeChange (listType .value )
138
141
})
139
142
.finally (() => {
@@ -144,16 +147,16 @@ const open = ({ id }: any, type = 'Knowledge') => {
144
147
145
148
const handleConfirm = () => {
146
149
authorizationApi [` postSharedAuthorization${currentType } ` ](knowledge_id , {
147
- workspace_id_list: checkedWorkspace .value ,
150
+ workspace_id_list: checkedWorkspace .value . map ( ele => ele . id ) ,
148
151
authentication_type: listType .value ,
149
152
}).then (() => {
150
153
centerDialogVisible .value = false
151
154
})
152
155
}
153
156
154
157
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 )
157
160
}
158
161
159
162
const clearWorkspaceAll = () => {
@@ -165,7 +168,7 @@ const clearWorkspaceAll = () => {
165
168
const handleListTypeChange = (val : any ) => {
166
169
checkedWorkspace .value = auth_list
167
170
.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
169
172
handleCheckedWorkspaceChange (checkedWorkspace .value )
170
173
}
171
174
defineExpose ({
0 commit comments