|
@@ -82,15 +82,34 @@
|
|
>
|
|
>
|
|
<template #name-column-value="{ scope }">
|
|
<template #name-column-value="{ scope }">
|
|
<div class="flex justify-center">
|
|
<div class="flex justify-center">
|
|
- <CzrButton
|
|
|
|
- type="table"
|
|
|
|
- :title="scope.row.name"
|
|
|
|
- @click="onStage(scope.row)"
|
|
|
|
- />
|
|
|
|
|
|
+ <template v-if="scope.row.indexingStatus === 'completed'">
|
|
|
|
+ <CzrButton
|
|
|
|
+ type="table"
|
|
|
|
+ :title="scope.row.name"
|
|
|
|
+ @click="onStage(scope.row)"
|
|
|
|
+ />
|
|
|
|
+ </template>
|
|
|
|
+ <template v-else>
|
|
|
|
+ {{ scope.row.name }}
|
|
|
|
+ </template>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
</template>
|
|
<template #caozuo-column-value="{ scope }">
|
|
<template #caozuo-column-value="{ scope }">
|
|
<div class="__czr-table-operations">
|
|
<div class="__czr-table-operations">
|
|
|
|
+ <template v-if="scope.row.indexingStatus === 'archived'">
|
|
|
|
+ <CzrButton
|
|
|
|
+ type="table"
|
|
|
|
+ title="撤销归档"
|
|
|
|
+ @click="onUnArchive(scope.row)"
|
|
|
|
+ />
|
|
|
|
+ </template>
|
|
|
|
+ <template v-if="scope.row.indexingStatus === 'completed'">
|
|
|
|
+ <CzrButton
|
|
|
|
+ type="table"
|
|
|
|
+ title="归档"
|
|
|
|
+ @click="onArchive(scope.row)"
|
|
|
|
+ />
|
|
|
|
+ </template>
|
|
<CzrButton
|
|
<CzrButton
|
|
type="table"
|
|
type="table"
|
|
title="重命名"
|
|
title="重命名"
|
|
@@ -101,7 +120,6 @@
|
|
title="迁移"
|
|
title="迁移"
|
|
@click="onKnowledge(scope.row)"
|
|
@click="onKnowledge(scope.row)"
|
|
/>
|
|
/>
|
|
- <CzrButton type="table" title="归档" />
|
|
|
|
<CzrButton type="table-del" @click="onDel(scope.row)" />
|
|
<CzrButton type="table-del" @click="onDel(scope.row)" />
|
|
</div>
|
|
</div>
|
|
</template>
|
|
</template>
|
|
@@ -151,7 +169,12 @@ import detailCom from './detail.vue'
|
|
import renameCom from './rename.vue'
|
|
import renameCom from './rename.vue'
|
|
import knowledgeSelectCom from './knowledge-select.vue'
|
|
import knowledgeSelectCom from './knowledge-select.vue'
|
|
import stageIndexCom from './stage-index.vue'
|
|
import stageIndexCom from './stage-index.vue'
|
|
-import { documentGetDocumentsByPage } from '@/api/modules/knowledge/document'
|
|
|
|
|
|
+import {
|
|
|
|
+ documentArchive,
|
|
|
|
+ documentDocsDelete,
|
|
|
|
+ documentGetDocumentsByPage,
|
|
|
|
+ documentNoArchive,
|
|
|
|
+} from '@/api/modules/knowledge/document'
|
|
|
|
|
|
const DialogStore = useDialogStore()
|
|
const DialogStore = useDialogStore()
|
|
const DictionaryStore = useDictionaryStore()
|
|
const DictionaryStore = useDictionaryStore()
|
|
@@ -305,10 +328,16 @@ const onDel = (row: any = null) => {
|
|
if (row) {
|
|
if (row) {
|
|
DialogStore.confirm({
|
|
DialogStore.confirm({
|
|
title: '删除确认',
|
|
title: '删除确认',
|
|
- content: `是否删除文档:${row.p1}?<br/>此文档下的29个分段都会被删除,请谨慎操作。`,
|
|
|
|
|
|
+ content: `是否删除文档:${row.name}?<br/>此文档下的${row.p1 ? row.p1 + '个' : ''}分段都会被删除,请谨慎操作。`,
|
|
onSubmit: () => {
|
|
onSubmit: () => {
|
|
- ElMessage.success('删除成功!')
|
|
|
|
- onSearch()
|
|
|
|
|
|
+ documentDocsDelete([row.id])
|
|
|
|
+ .then(() => {
|
|
|
|
+ ElMessage.success('删除成功!')
|
|
|
|
+ })
|
|
|
|
+ .catch(() => {})
|
|
|
|
+ .finally(() => {
|
|
|
|
+ onSearch()
|
|
|
|
+ })
|
|
},
|
|
},
|
|
})
|
|
})
|
|
} else {
|
|
} else {
|
|
@@ -320,12 +349,71 @@ const onDel = (row: any = null) => {
|
|
title: '删除确认',
|
|
title: '删除确认',
|
|
content: `是否批量删除${state.query.selected.length}个文档?<br/>所选文档中的分段会跟随删除,请谨慎操作。`,
|
|
content: `是否批量删除${state.query.selected.length}个文档?<br/>所选文档中的分段会跟随删除,请谨慎操作。`,
|
|
onSubmit: () => {
|
|
onSubmit: () => {
|
|
- ElMessage.success('删除成功!')
|
|
|
|
- onSearch()
|
|
|
|
|
|
+ documentDocsDelete(state.query.selected.map((v) => v.id))
|
|
|
|
+ .then(() => {
|
|
|
|
+ ElMessage.success('删除成功!')
|
|
|
|
+ })
|
|
|
|
+ .catch(() => {})
|
|
|
|
+ .finally(() => {
|
|
|
|
+ onSearch()
|
|
|
|
+ })
|
|
|
|
+ },
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+const onArchive = (row: any = null) => {
|
|
|
|
+ if (row) {
|
|
|
|
+ DialogStore.confirm({
|
|
|
|
+ title: '归档确认',
|
|
|
|
+ content: `是否归档文档:${row.name}?<br/>归档后的数据就只能查看或删除,无法重新编辑,请谨慎操作。`,
|
|
|
|
+ onSubmit: () => {
|
|
|
|
+ documentArchive([row.id])
|
|
|
|
+ .then(() => {
|
|
|
|
+ ElMessage.success('归档成功!')
|
|
|
|
+ })
|
|
|
|
+ .catch(() => {})
|
|
|
|
+ .finally(() => {
|
|
|
|
+ onSearch()
|
|
|
|
+ })
|
|
|
|
+ },
|
|
|
|
+ })
|
|
|
|
+ } else {
|
|
|
|
+ if (state.query.selected.length === 0) {
|
|
|
|
+ ElMessage.warning('请至少选择一条记录!')
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ DialogStore.confirm({
|
|
|
|
+ title: '归档确认',
|
|
|
|
+ content: `是否批量删除${state.query.selected.length}个文档?<br/>归档后的数据就只能查看或删除,无法重新编辑,请谨慎操作。`,
|
|
|
|
+ onSubmit: () => {
|
|
|
|
+ documentArchive(state.query.selected.map((v) => v.id))
|
|
|
|
+ .then(() => {
|
|
|
|
+ ElMessage.success('归档成功!')
|
|
|
|
+ })
|
|
|
|
+ .catch(() => {})
|
|
|
|
+ .finally(() => {
|
|
|
|
+ onSearch()
|
|
|
|
+ })
|
|
},
|
|
},
|
|
})
|
|
})
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+const onUnArchive = (row: any = null) => {
|
|
|
|
+ DialogStore.confirm({
|
|
|
|
+ title: '撤销归档确认',
|
|
|
|
+ content: `是否撤销归档:${row.name}?<br/>撤销归档后的数据,可重新编辑,请谨慎操作。`,
|
|
|
|
+ onSubmit: () => {
|
|
|
|
+ documentNoArchive([row.id])
|
|
|
|
+ .then(() => {
|
|
|
|
+ ElMessage.success('撤销归档成功!')
|
|
|
|
+ })
|
|
|
|
+ .catch(() => {})
|
|
|
|
+ .finally(() => {
|
|
|
|
+ onSearch()
|
|
|
|
+ })
|
|
|
|
+ },
|
|
|
|
+ })
|
|
|
|
+}
|
|
const onRename = (row) => {
|
|
const onRename = (row) => {
|
|
state.rename.transfer = {
|
|
state.rename.transfer = {
|
|
id: row.id,
|
|
id: row.id,
|