增加 新建资料库

This commit is contained in:
ivamp 2023-12-12 19:59:58 +08:00
parent 7ad7251b53
commit 56aff9312d

View File

@ -4,10 +4,6 @@
<div v-else>
<h1>资料库</h1>
<!-- <div>
{{ selected_ids }}
</div> -->
<v-btn
@click="selectAll"
:color="selected_ids.length > 0 ? 'primary' : ''"
@ -37,6 +33,37 @@
</v-card>
</v-dialog>
</v-btn>
<v-btn :loading="creatingLibrary" class="ml-2"
>新建资料库
<v-dialog
v-model="showCreateLibraryDialog"
activator="parent"
width="auto"
>
<v-card>
<v-text-field
v-model="newLibraryName"
label="资料库名称"
required
hide-details
></v-text-field>
<v-card-actions>
<v-btn @click="showCreateLibraryDialog = false">取消</v-btn>
<v-btn
color="primary"
@click="newLibrary"
:loading="creatingLibrary"
>新建</v-btn
>
</v-card-actions>
</v-card>
</v-dialog>
</v-btn>
<v-card class="mt-3">
<v-list>
<v-list-item
@ -195,11 +222,27 @@ function deleteSelected() {
}
}
const creatingLibrary = ref(false)
const showCreateLibraryDialog = ref(false);
const creatingLibrary = ref(false);
const newLibraryName = ref("");
// function newLibrary(name) {
// creatingLibrary.value = true
function newLibrary() {
if (newLibraryName.value == "") {
return;
}
// library.librariesPost(name).then
// }
creatingLibrary.value = true;
library
.librariesPost(newLibraryName.value)
.then(() => {})
.finally(() => {
showCreateLibraryDialog.value = false;
creatingLibrary.value = false;
setTimeout(() => {
load();
}, 250);
});
}
</script>