55 </template >
66 <div class =" flex-between mb-16" >
77 <div >
8- <el-button type =" primary" @click =" openCreateTagDialog()"
8+ <el-button
9+ type =" primary"
10+ @click =" openCreateTagDialog()"
911 v-if =" permissionPrecise.tag_create(id)"
10- >{{ $t('views.document.tag.create') }}
12+ >{{ $t('views.document.tag.create') }}
1113 </el-button >
12- <el-button :disabled =" multipleSelection.length === 0" @click =" batchDelete"
14+ <el-button
15+ :disabled =" multipleSelection.length === 0"
16+ @click =" batchDelete"
1317 v-if =" permissionPrecise.tag_delete(id)"
1418 >
1519 {{ $t('common.delete') }}
3236 @cell-mouse-enter =" cellMouseEnter"
3337 @cell-mouse-leave =" cellMouseLeave"
3438 >
35- <el-table-column type =" selection" width =" 55" />
39+ <el-table-column type =" selection" width =" 55" />
3640 <el-table-column :label =" $t('views.document.tag.key')" >
3741 <template #default =" { row } " >
3842 <div class =" flex-between" >
3943 {{ row.key }}
4044 <div v-if =" currentMouseId === row.id" >
4145 <span class =" mr-4" >
4246 <el-tooltip effect =" dark" :content =" $t('views.document.tag.addValue')" >
43- <el-button type =" primary" text @click.stop =" openCreateTagDialog(row)"
47+ <el-button
48+ type =" primary"
49+ text
50+ @click.stop =" openCreateTagDialog(row)"
4451 v-if =" permissionPrecise.tag_create(id)"
4552 >
4653 <AppIcon iconName =" app-add-outlined" />
4956 </span >
5057 <span class =" mr-4" >
5158 <el-tooltip effect =" dark" :content =" $t('views.document.tag.edit')" >
52- <el-button type =" primary" text @click.stop =" editTagKey(row)"
59+ <el-button
60+ type =" primary"
61+ text
62+ @click.stop =" editTagKey(row)"
5363 v-if =" permissionPrecise.tag_edit(id)"
5464 >
5565 <AppIcon iconName =" app-edit" />
5666 </el-button >
5767 </el-tooltip >
5868 </span >
5969 <el-tooltip effect =" dark" :content =" $t('common.delete')" >
60- <el-button type =" primary" text @click.stop =" delTag(row)"
70+ <el-button
71+ type =" primary"
72+ text
73+ @click.stop =" delTag(row)"
6174 v-if =" permissionPrecise.tag_delete(id)"
6275 >
6376 <AppIcon iconName =" app-delete" />
7891 <template #default =" { row } " >
7992 <span class =" mr-4" >
8093 <el-tooltip effect =" dark" :content =" $t('views.document.tag.editValue')" >
81- <el-button type =" primary" text @click.stop =" editTagValue(row)"
94+ <el-button
95+ type =" primary"
96+ text
97+ @click.stop =" editTagValue(row)"
8298 v-if =" permissionPrecise.tag_edit(id)"
8399 >
84100 <AppIcon iconName =" app-edit" />
85101 </el-button >
86102 </el-tooltip >
87103 </span >
88104 <el-tooltip effect =" dark" :content =" $t('common.delete')" >
89- <el-button type =" primary" text @click.stop =" delTagValue(row)"
105+ <el-button
106+ type =" primary"
107+ text
108+ @click.stop =" delTagValue(row)"
90109 v-if =" permissionPrecise.tag_delete(id)"
91110 >
92111 <AppIcon iconName =" app-delete" />
96115 </el-table-column >
97116 </el-table >
98117 </el-drawer >
99- <CreateTagDialog ref =" createTagDialogRef" @refresh =" getList" />
100- <EditTagDialog ref =" editTagDialogRef" @refresh =" getList" />
118+ <CreateTagDialog ref =" createTagDialogRef" @refresh =" getList" />
119+ <EditTagDialog ref =" editTagDialogRef" @refresh =" getList" />
101120</template >
102121
103122<script setup lang="ts">
@@ -110,12 +129,11 @@ import { t } from '@/locales'
110129import EditTagDialog from ' @/views/document/tag/EditTagDialog.vue'
111130import permissionMap from ' @/permission'
112131
113-
114132const emit = defineEmits ([' refresh' ])
115133
116134const route = useRoute ()
117135const {
118- params : {id, folderId}, // id为knowledgeID
136+ params : { id, folderId }, // id为knowledgeID
119137} = route as any
120138
121139const isShared = computed (() => {
@@ -169,7 +187,7 @@ const tableData = computed(() => {
169187})
170188
171189// 合并单元格方法
172- const spanMethod = ({row , column , rowIndex , columnIndex }: any ) => {
190+ const spanMethod = ({ row , column , rowIndex , columnIndex }: any ) => {
173191 if (columnIndex === 0 || columnIndex === 1 ) {
174192 // key列 (由于添加了选择列,索引变为1)
175193 if (row .keyIndex === 0 ) {
@@ -200,19 +218,12 @@ function openCreateTagDialog(row?: any) {
200218}
201219
202220function batchDelete() {
203- MsgConfirm (t (' views.document.tag.deleteConfirm' ), t (' views.document.tag.deleteTip' ), {
204- confirmButtonText: t (' common.delete' ),
205- confirmButtonClass: ' danger' ,
206- })
221+ const tagsToDelete = multipleSelection .value .map ((item ) => item .id )
222+ loadSharedApi ({ type: ' knowledge' , systemType: apiType .value })
223+ .delMulTag (id , tagsToDelete )
207224 .then (() => {
208- const tagsToDelete = multipleSelection .value .map ((item ) => item .id )
209- loadSharedApi ({ type: ' knowledge' , systemType: apiType .value })
210- .delMulTag (id , tagsToDelete )
211- .then (() => {
212- getList ()
213- })
225+ getList ()
214226 })
215- .catch (() => {})
216227}
217228
218229const editTagDialogRef = ref ()
@@ -241,29 +252,18 @@ function editTagValue(row: any) {
241252}
242253
243254function delTagValue(row : any ) {
244- MsgConfirm (
245- t (' views.document.tag.deleteConfirm' ) + row .key + ' -' + row .value ,
246- t (' views.document.tag.deleteTip' ),
247- {
248- confirmButtonText: t (' common.delete' ),
249- confirmButtonClass: ' danger' ,
250- },
251- )
255+ loadSharedApi ({ type: ' knowledge' , systemType: apiType .value })
256+ .delTag (id , row .id , ' one' )
252257 .then (() => {
253- loadSharedApi ({ type: ' knowledge' , systemType: apiType .value })
254- .delTag (id , row .id , ' one' )
255- .then (() => {
256- getList ()
257- })
258+ getList ()
258259 })
259- .catch (() => {})
260260}
261261
262262function getList() {
263263 const params = {
264- ... (filterText .value && {name: filterText .value }),
264+ ... (filterText .value && { name: filterText .value }),
265265 }
266- loadSharedApi ({type: ' knowledge' , systemType: apiType .value , isShared: isShared .value })
266+ loadSharedApi ({ type: ' knowledge' , systemType: apiType .value , isShared: isShared .value })
267267 .getTags (id , params , loading )
268268 .then ((res : any ) => {
269269 tags .value = res .data
0 commit comments