diff --git a/src/components/settings/LibrarySettings.vue b/src/components/settings/LibrarySettings.vue
index 313a5aa..7a15d55 100644
--- a/src/components/settings/LibrarySettings.vue
+++ b/src/components/settings/LibrarySettings.vue
@@ -152,6 +152,40 @@
上传文档
+
+
+
+
+
+
+
+ {{ c.name }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 删除后,文档将无法被检索
+
+
+
+
+
+
+
@@ -169,6 +203,8 @@ import {
TrashBinOutline,
SettingsOutline,
DocumentOutline,
+ Reload,
+ Checkmark
} from "@vicons/ionicons5";
import { AxiosError } from "axios";
import { useMessage } from "naive-ui";
@@ -192,11 +228,23 @@ const createDocument: Ref = ref({
name: "",
content: "",
});
-const libraryDocuments: Ref = ref([]);
-const showEditDialog = (library: EntityLibrary) => {
+const documents: Ref = ref([]);
+
+const showEditDialog = async (library: EntityLibrary) => {
currentLibrary.value = library;
showEditLibraryDialog.value = true;
+
+ getDocuments(library.id ?? 0);
};
+
+const getDocuments = async (libraryId: number) => {
+ await getApi()
+ .Library.apiV1LibrariesIdDocumentsGet(libraryId)
+ .then((r) => {
+ documents.value = r.data.data ?? [];
+ });
+};
+
const updateLibrary = async () => {
if (currentLibrary.value.id) {
await getApi().Library.apiV1LibrariesIdPut(currentLibrary.value.id, {
@@ -238,9 +286,20 @@ const newDocument = async () => {
currentLibrary.value.id,
createDocument.value
);
+
+ getDocuments(currentLibrary.value.id);
}
};
+const deleteDocument = async (documentId: number) => {
+ await getApi().Library.apiV1LibrariesIdDocumentsDocumentIdDelete(
+ documentId,
+ currentLibrary.value.id ?? 0
+ );
+
+ getDocuments(currentLibrary.value.id ?? 0);
+};
+
onMounted(() => {
libraryStore.updateLibraries();
});