feat: 批量删除
This commit is contained in:
parent
f74bafd59a
commit
6103e64de8
@ -103,22 +103,24 @@ const putDocument: (dataset_id: string, document_id: string, data: any) => Promi
|
|||||||
* 删除文档
|
* 删除文档
|
||||||
* @param 参数 dataset_id, document_id,
|
* @param 参数 dataset_id, document_id,
|
||||||
*/
|
*/
|
||||||
const delDocument: (dataset_id: string, document_id: string) => Promise<Result<boolean>> = (
|
const delDocument: (
|
||||||
dataset_id,
|
dataset_id: string,
|
||||||
document_id
|
document_id: string,
|
||||||
) => {
|
loading?: Ref<boolean>
|
||||||
return del(`${prefix}/${dataset_id}/document/${document_id}`)
|
) => Promise<Result<boolean>> = (dataset_id, document_id, loading) => {
|
||||||
|
return del(`${prefix}/${dataset_id}/document/${document_id}`, loading)
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 批量删除文档
|
||||||
|
* @param 参数 dataset_id,
|
||||||
|
*/
|
||||||
|
const delMulDocument: (
|
||||||
|
dataset_id: string,
|
||||||
|
data: any,
|
||||||
|
loading?: Ref<boolean>
|
||||||
|
) => Promise<Result<boolean>> = (dataset_id, data, loading) => {
|
||||||
|
return del(`${prefix}/${dataset_id}/document/_bach`, undefined, { id_list: data }, loading)
|
||||||
}
|
}
|
||||||
// /**
|
|
||||||
// * 批量删除文档
|
|
||||||
// * @param 参数 dataset_id, document_id,
|
|
||||||
// */
|
|
||||||
// const delDocument: (dataset_id: string, document_id: string) => Promise<Result<boolean>> = (
|
|
||||||
// dataset_id,
|
|
||||||
// document_id
|
|
||||||
// ) => {
|
|
||||||
// return del(`${prefix}/${dataset_id}/document/${document_id}`)
|
|
||||||
// }
|
|
||||||
/**
|
/**
|
||||||
* 文档详情
|
* 文档详情
|
||||||
* @param 参数 dataset_id
|
* @param 参数 dataset_id
|
||||||
@ -159,6 +161,7 @@ export default {
|
|||||||
postDocument,
|
postDocument,
|
||||||
putDocument,
|
putDocument,
|
||||||
delDocument,
|
delDocument,
|
||||||
|
delMulDocument,
|
||||||
getDocumentDetail,
|
getDocumentDetail,
|
||||||
listSplitPattern,
|
listSplitPattern,
|
||||||
putDocumentRefresh
|
putDocumentRefresh
|
||||||
|
|||||||
@ -12,7 +12,9 @@
|
|||||||
>
|
>
|
||||||
<el-button v-if="datasetDetail.type === '1'" type="primary">导入文档</el-button>
|
<el-button v-if="datasetDetail.type === '1'" type="primary">导入文档</el-button>
|
||||||
<!-- <el-button v-if="datasetDetail.type === '1'">批量同步</el-button> -->
|
<!-- <el-button v-if="datasetDetail.type === '1'">批量同步</el-button> -->
|
||||||
<el-button :disabled="multipleSelection.length === 0">批量删除</el-button>
|
<el-button :disabled="multipleSelection.length === 0" @click="deleteMulDocument"
|
||||||
|
>批量删除</el-button
|
||||||
|
>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<el-input
|
<el-input
|
||||||
@ -119,9 +121,9 @@
|
|||||||
</el-tooltip>
|
</el-tooltip>
|
||||||
<span @click.stop>
|
<span @click.stop>
|
||||||
<el-dropdown trigger="click">
|
<el-dropdown trigger="click">
|
||||||
<span class="el-dropdown-link cursor">
|
<el-button text>
|
||||||
<el-icon><MoreFilled /></el-icon>
|
<el-icon><MoreFilled /></el-icon>
|
||||||
</span>
|
</el-button>
|
||||||
<template #dropdown>
|
<template #dropdown>
|
||||||
<el-dropdown-menu>
|
<el-dropdown-menu>
|
||||||
<el-dropdown-item icon="Setting">设置</el-dropdown-item>
|
<el-dropdown-item icon="Setting">设置</el-dropdown-item>
|
||||||
@ -225,6 +227,19 @@ function creatQuickHandle(val: string) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function deleteMulDocument() {
|
||||||
|
const arr: string[] = []
|
||||||
|
multipleSelection.value.map((v) => {
|
||||||
|
if (v) {
|
||||||
|
arr.push(v.id)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
documentApi.delMulDocument(id, arr, loading).then(() => {
|
||||||
|
MsgSuccess('删除成功')
|
||||||
|
getList()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
function deleteDocument(row: any) {
|
function deleteDocument(row: any) {
|
||||||
MsgConfirm(
|
MsgConfirm(
|
||||||
`是否删除文档:${row.name} ?`,
|
`是否删除文档:${row.name} ?`,
|
||||||
@ -235,16 +250,10 @@ function deleteDocument(row: any) {
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
loading.value = true
|
documentApi.delDocument(id, row.id, loading).then(() => {
|
||||||
documentApi
|
MsgSuccess('删除成功')
|
||||||
.delDocument(id, row.id)
|
getList()
|
||||||
.then(() => {
|
})
|
||||||
MsgSuccess('删除成功')
|
|
||||||
getList()
|
|
||||||
})
|
|
||||||
.catch(() => {
|
|
||||||
loading.value = false
|
|
||||||
})
|
|
||||||
})
|
})
|
||||||
.catch(() => {})
|
.catch(() => {})
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user