|
@@ -3,14 +3,16 @@
|
|
<div class="header">
|
|
<div class="header">
|
|
<home-header @login="emits('login')" sub-title="知识库管理" />
|
|
<home-header @login="emits('login')" sub-title="知识库管理" />
|
|
</div>
|
|
</div>
|
|
|
|
+ <FileDetail
|
|
|
|
+ v-if="fileViewerVisabled"
|
|
|
|
+ :fileDetail="currentFile"
|
|
|
|
+ :fileType="fileType"
|
|
|
|
+ :changeFile="showFileDetail"
|
|
|
|
+ @close="closeViewerHandle"
|
|
|
|
+ />
|
|
<div class="my-doc-container">
|
|
<div class="my-doc-container">
|
|
<TitleHeader :items="menuList" @tabClick="tabClickHandle" />
|
|
<TitleHeader :items="menuList" @tabClick="tabClickHandle" />
|
|
- <FileDetail
|
|
|
|
- v-if="clickFileDetail && clickFileDetail.sign == 'file'"
|
|
|
|
- :fileDetail="clickFileDetail"
|
|
|
|
- :changeFile="showFileDetail"
|
|
|
|
- />
|
|
|
|
- <div class="page-content" v-else>
|
|
|
|
|
|
+ <div class="page-content">
|
|
<div class="content-top">
|
|
<div class="content-top">
|
|
<div class="left">
|
|
<div class="left">
|
|
<a-button
|
|
<a-button
|
|
@@ -33,7 +35,7 @@
|
|
>下载</a-button
|
|
>下载</a-button
|
|
>
|
|
>
|
|
<a-button
|
|
<a-button
|
|
- v-if="clickFileDetail"
|
|
|
|
|
|
+ v-if="false"
|
|
:icon="h(DeliveredProcedureOutlined)"
|
|
:icon="h(DeliveredProcedureOutlined)"
|
|
@click="moveFiles(state.selectedRowKeys)"
|
|
@click="moveFiles(state.selectedRowKeys)"
|
|
style="margin-left: 15px; height: 36px"
|
|
style="margin-left: 15px; height: 36px"
|
|
@@ -59,12 +61,14 @@
|
|
</div>
|
|
</div>
|
|
<div class="content-table">
|
|
<div class="content-table">
|
|
<a-table
|
|
<a-table
|
|
- :rowSelection="{
|
|
|
|
|
|
+ :row-selection="{
|
|
selectedRowKeys: state.selectedRowKeys,
|
|
selectedRowKeys: state.selectedRowKeys,
|
|
onChange: onSelectChange,
|
|
onChange: onSelectChange,
|
|
}"
|
|
}"
|
|
|
|
+ rowKey="id"
|
|
|
|
+ :loading="loading"
|
|
:columns="columns"
|
|
:columns="columns"
|
|
- :dataSource="dataSource"
|
|
|
|
|
|
+ :data-source="dataSource"
|
|
:pagination="false"
|
|
:pagination="false"
|
|
>
|
|
>
|
|
<template #bodyCell="{ column, record }">
|
|
<template #bodyCell="{ column, record }">
|
|
@@ -99,6 +103,7 @@
|
|
type="text"
|
|
type="text"
|
|
:icon="h(DownloadOutlined)"
|
|
:icon="h(DownloadOutlined)"
|
|
style="margin-right: 15px"
|
|
style="margin-right: 15px"
|
|
|
|
+ v-if="record.type"
|
|
@click="
|
|
@click="
|
|
record.type
|
|
record.type
|
|
? downloadFile(record)
|
|
? downloadFile(record)
|
|
@@ -125,6 +130,7 @@
|
|
<a-menu-item>
|
|
<a-menu-item>
|
|
<a-button
|
|
<a-button
|
|
type="link"
|
|
type="link"
|
|
|
|
+ v-if="false"
|
|
:icon="h(DeliveredProcedureOutlined)"
|
|
:icon="h(DeliveredProcedureOutlined)"
|
|
style="color: #000"
|
|
style="color: #000"
|
|
@click="moveFiles([record.id])"
|
|
@click="moveFiles([record.id])"
|
|
@@ -194,9 +200,6 @@ import {
|
|
import HomeHeader from '@/views/home/components/HomeHeader.vue';
|
|
import HomeHeader from '@/views/home/components/HomeHeader.vue';
|
|
import { message } from "ant-design-vue";
|
|
import { message } from "ant-design-vue";
|
|
import MyIcon from "@/components/myIcon/index.vue";
|
|
import MyIcon from "@/components/myIcon/index.vue";
|
|
-import {
|
|
|
|
- downloadDocs,
|
|
|
|
-} from "./http";
|
|
|
|
import MoveFileModel from "./MoveFiles.vue";
|
|
import MoveFileModel from "./MoveFiles.vue";
|
|
import FileUpload from "./FileUpload.vue";
|
|
import FileUpload from "./FileUpload.vue";
|
|
import FileDetail from "./FileDetail.vue";
|
|
import FileDetail from "./FileDetail.vue";
|
|
@@ -293,18 +296,23 @@ const columns = [
|
|
];
|
|
];
|
|
const searchValue = ref("");
|
|
const searchValue = ref("");
|
|
const dataSource = ref<any[]>([]);
|
|
const dataSource = ref<any[]>([]);
|
|
|
|
+const loading = ref(false)
|
|
const getDataSource = () => {
|
|
const getDataSource = () => {
|
|
// 重置选中的文件
|
|
// 重置选中的文件
|
|
state.selectedRowKeys = [];
|
|
state.selectedRowKeys = [];
|
|
const urlStr = `/ai/knowledge/file/list`
|
|
const urlStr = `/ai/knowledge/file/list`
|
|
|
|
+ loading.value = true;
|
|
// 获取文档列表
|
|
// 获取文档列表
|
|
http.get(urlStr, {
|
|
http.get(urlStr, {
|
|
name: searchValue.value,
|
|
name: searchValue.value,
|
|
parentId: currentTabId.value
|
|
parentId: currentTabId.value
|
|
}).then((result) => {
|
|
}).then((result) => {
|
|
|
|
+ loading.value = false;
|
|
if (result.data) {
|
|
if (result.data) {
|
|
dataSource.value = result.data;
|
|
dataSource.value = result.data;
|
|
}
|
|
}
|
|
|
|
+ }).catch((err) => {
|
|
|
|
+ loading.value = false;
|
|
});
|
|
});
|
|
};
|
|
};
|
|
|
|
|
|
@@ -316,8 +324,8 @@ const state = reactive<{
|
|
loading: false,
|
|
loading: false,
|
|
});
|
|
});
|
|
|
|
|
|
-const onSelectChange = (selectedRowKeys: any[]) => {
|
|
|
|
- state.selectedRowKeys = selectedRowKeys;
|
|
|
|
|
|
+const onSelectChange = (selectedRowKeys1) => {
|
|
|
|
+ state.selectedRowKeys = selectedRowKeys1;
|
|
};
|
|
};
|
|
const searchHandle = () => {
|
|
const searchHandle = () => {
|
|
getDataSource()
|
|
getDataSource()
|
|
@@ -354,16 +362,13 @@ const createFolder = async () => {
|
|
|
|
|
|
// 下载(单文件下载)
|
|
// 下载(单文件下载)
|
|
const downloadFile = async (data: any) => {
|
|
const downloadFile = async (data: any) => {
|
|
- if (!data.fileStorepath) {
|
|
|
|
- message.error("下载失败,未找到文件下载地址!");
|
|
|
|
- return;
|
|
|
|
- }
|
|
|
|
- return;
|
|
|
|
|
|
+ const downloadUrl = `${window.AppGlobalConfig.knowledgeDocUrlProxy}${data.name}`
|
|
|
|
+ const response = await fetch(downloadUrl);
|
|
const blob = await response.blob();
|
|
const blob = await response.blob();
|
|
const url = window.URL.createObjectURL(blob);
|
|
const url = window.URL.createObjectURL(blob);
|
|
const a = document.createElement("a");
|
|
const a = document.createElement("a");
|
|
a.href = url;
|
|
a.href = url;
|
|
- a.download = data.fileName ?? "download.pdf"; // 强制下载并指定文件名
|
|
|
|
|
|
+ a.download = data.name ?? "download.pdf"; // 强制下载并指定文件名
|
|
document.body.appendChild(a);
|
|
document.body.appendChild(a);
|
|
a.click();
|
|
a.click();
|
|
document.body.removeChild(a);
|
|
document.body.removeChild(a);
|
|
@@ -380,11 +385,12 @@ const closeHandle = () => {
|
|
// 多文件打包下载
|
|
// 多文件打包下载
|
|
const downloadFiles = async (ids: any[] = []) => {
|
|
const downloadFiles = async (ids: any[] = []) => {
|
|
message.success("正在为你下载文件,请稍等 ...");
|
|
message.success("正在为你下载文件,请稍等 ...");
|
|
- try {
|
|
|
|
- await downloadDocs(ids);
|
|
|
|
- } catch {
|
|
|
|
- message.error("下载失败,请稍后重试!");
|
|
|
|
- }
|
|
|
|
|
|
+ const selectedArrs = dataSource.value.filter((item) => {
|
|
|
|
+ return ids.includes(item['id']);
|
|
|
|
+ })
|
|
|
|
+ selectedArrs.forEach((item) => {
|
|
|
|
+ downloadFile(item['name'])
|
|
|
|
+ })
|
|
};
|
|
};
|
|
//文件夹编辑
|
|
//文件夹编辑
|
|
const editableData = reactive({});
|
|
const editableData = reactive({});
|
|
@@ -460,16 +466,21 @@ const refreshList = () => {
|
|
changeMenu();
|
|
changeMenu();
|
|
}
|
|
}
|
|
};
|
|
};
|
|
-
|
|
|
|
// 跳到文件详情页面
|
|
// 跳到文件详情页面
|
|
|
|
+const fileViewerVisabled = ref(false)
|
|
|
|
+const fileType = ref('')
|
|
|
|
+const currentFile = ref()
|
|
const showFileDetail = (data: any) => {
|
|
const showFileDetail = (data: any) => {
|
|
- clickFileDetail.value = {
|
|
|
|
- ...data,
|
|
|
|
- id: data.fileId,
|
|
|
|
- };
|
|
|
|
- // 触发目录切换的回调
|
|
|
|
- changeMenu(data.fileName);
|
|
|
|
|
|
+ console.log(data)
|
|
|
|
+ fileViewerVisabled.value = true;
|
|
|
|
+ data['viewerUrl'] = `${window.AppGlobalConfig.knowledgeDocUrlProxy}${data.name}`
|
|
|
|
+ currentFile.value = data;
|
|
|
|
+ const name = data.name;
|
|
|
|
+ fileType.value = name.slice(name.indexOf(".") + 1)
|
|
};
|
|
};
|
|
|
|
+const closeViewerHandle = () => {
|
|
|
|
+ fileViewerVisabled.value = false;
|
|
|
|
+}
|
|
</script>
|
|
</script>
|
|
<style scoped lang="scss">
|
|
<style scoped lang="scss">
|
|
@import "./index.scss";
|
|
@import "./index.scss";
|