资料档案库添加删除文件功能
This commit is contained in:
@@ -66,6 +66,14 @@ export function docHistoryListApi(doc_id:number) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 删除资料
|
||||||
|
export function deleteDocApi(id: number) {
|
||||||
|
return request({
|
||||||
|
url: `/api/knowledge/${id}`,
|
||||||
|
method: 'delete',
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// 归档目录树
|
// 归档目录树
|
||||||
export function docArchiveTreeListApi(params: {from:string | number | null,to:string | number | null,org_id: number,type: number | string,change_no?:string}) {
|
export function docArchiveTreeListApi(params: {from:string | number | null,to:string | number | null,org_id: number,type: number | string,change_no?:string}) {
|
||||||
return request({
|
return request({
|
||||||
|
|||||||
@@ -13,7 +13,8 @@ import {
|
|||||||
docListApi,
|
docListApi,
|
||||||
uploadDocApi,
|
uploadDocApi,
|
||||||
updateDocApi,
|
updateDocApi,
|
||||||
docHistoryListApi
|
docHistoryListApi,
|
||||||
|
deleteDocApi
|
||||||
} from '@/service/api/doc';
|
} from '@/service/api/doc';
|
||||||
|
|
||||||
const themeStore = useThemeStore();
|
const themeStore = useThemeStore();
|
||||||
@@ -315,6 +316,7 @@ const searchHandle = () => {
|
|||||||
if(!keyword.value) {
|
if(!keyword.value) {
|
||||||
// 搜索框为空时,显示树状列表
|
// 搜索框为空时,显示树状列表
|
||||||
showTree.value = true;
|
showTree.value = true;
|
||||||
|
getFileList(currentNode.value.id);
|
||||||
}else{
|
}else{
|
||||||
// 搜索框不为空时,显示搜索结果
|
// 搜索框不为空时,显示搜索结果
|
||||||
showTree.value = false;
|
showTree.value = false;
|
||||||
@@ -464,6 +466,20 @@ const viewHistory = async (d:any) => {
|
|||||||
}
|
}
|
||||||
historyLoading.value = false;
|
historyLoading.value = false;
|
||||||
}
|
}
|
||||||
|
// 删除资料
|
||||||
|
const deleteFile = async (d:any) => {
|
||||||
|
loading.value = true;
|
||||||
|
const {error} = await deleteDocApi(d.id);
|
||||||
|
if(!error){
|
||||||
|
window.$message?.success('删除成功');
|
||||||
|
if(showTree.value){
|
||||||
|
getFileList(currentNode.value.id);
|
||||||
|
}else{
|
||||||
|
getFileList(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
loading.value = false;
|
||||||
|
}
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
getDocList();
|
getDocList();
|
||||||
@@ -519,6 +535,17 @@ onMounted(() => {
|
|||||||
<NButton type="primary" text class="hover:underline text-xs" @click="updateFile(d)">更新</NButton>
|
<NButton type="primary" text class="hover:underline text-xs" @click="updateFile(d)">更新</NButton>
|
||||||
<NButton type="primary" text class="hover:underline text-xs" @click="preview(d)">预览</NButton>
|
<NButton type="primary" text class="hover:underline text-xs" @click="preview(d)">预览</NButton>
|
||||||
<NButton type="primary" text class="hover:underline text-xs" @click="download(d)">下载</NButton>
|
<NButton type="primary" text class="hover:underline text-xs" @click="download(d)">下载</NButton>
|
||||||
|
<NPopconfirm
|
||||||
|
positive-text="确定"
|
||||||
|
:positive-button-props="{ size: 'tiny' }"
|
||||||
|
:negative-button-props="{ size: 'tiny' }"
|
||||||
|
@positive-click="deleteFile(d)"
|
||||||
|
>
|
||||||
|
<template #trigger>
|
||||||
|
<NButton type="error" text class="hover:underline text-xs">删除</NButton>
|
||||||
|
</template>
|
||||||
|
确定删除吗?
|
||||||
|
</NPopconfirm>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div v-if="queryList.length === 0" class="h-100% flex items-center justify-center">
|
<div v-if="queryList.length === 0" class="h-100% flex items-center justify-center">
|
||||||
@@ -598,6 +625,17 @@ onMounted(() => {
|
|||||||
<NButton type="primary" text class="hover:underline text-xs" @click="updateFile(d)">更新</NButton>
|
<NButton type="primary" text class="hover:underline text-xs" @click="updateFile(d)">更新</NButton>
|
||||||
<NButton type="primary" text class="hover:underline text-xs" @click="preview(d)">预览</NButton>
|
<NButton type="primary" text class="hover:underline text-xs" @click="preview(d)">预览</NButton>
|
||||||
<NButton type="primary" text class="hover:underline text-xs" @click="download(d)">下载</NButton>
|
<NButton type="primary" text class="hover:underline text-xs" @click="download(d)">下载</NButton>
|
||||||
|
<NPopconfirm
|
||||||
|
positive-text="确定"
|
||||||
|
:positive-button-props="{ size: 'tiny' }"
|
||||||
|
:negative-button-props="{ size: 'tiny' }"
|
||||||
|
@positive-click="deleteFile(d)"
|
||||||
|
>
|
||||||
|
<template #trigger>
|
||||||
|
<NButton type="error" text class="hover:underline text-xs">删除</NButton>
|
||||||
|
</template>
|
||||||
|
确定删除吗?
|
||||||
|
</NPopconfirm>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div v-if="fileList.length===0" class="h-100% flex items-center justify-center">
|
<div v-if="fileList.length===0" class="h-100% flex items-center justify-center">
|
||||||
@@ -681,7 +719,7 @@ onMounted(() => {
|
|||||||
<span>上传时间:{{ previewFile?.created_at?.slice(0, 16) }}</span>
|
<span>上传时间:{{ previewFile?.created_at?.slice(0, 16) }}</span>
|
||||||
<span v-if="previewFile?.version">{{ `版本:${previewFile?.version}(受控)` }}</span>
|
<span v-if="previewFile?.version">{{ `版本:${previewFile?.version}(受控)` }}</span>
|
||||||
</div>
|
</div>
|
||||||
<previewComponent v-if="previewFile" :previewFile="previewFile" />
|
<PreviewComponent v-if="previewFile" :preview-file="previewFile" />
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</NModal>
|
</NModal>
|
||||||
@@ -692,6 +730,7 @@ onMounted(() => {
|
|||||||
<style scoped>
|
<style scoped>
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
.scroll-left {
|
.scroll-left {
|
||||||
height: calc(100vh - 276px);
|
height: calc(100vh - 276px);
|
||||||
|
|||||||
Reference in New Issue
Block a user