改进
This commit is contained in:
parent
20f9024a47
commit
56cb3c5197
@ -1,9 +1,10 @@
|
|||||||
<template>
|
<template>
|
||||||
<div>{{ documents }}</div>
|
|
||||||
<div v-if="loading">
|
<div v-if="loading">
|
||||||
<v-row justify="center">
|
<v-row justify="center">
|
||||||
<v-col cols="12" md="4" xl="2" v-for="n in 3" :key="n">
|
<v-col cols="12" md="4" xl="2" v-for="n in 3" :key="n">
|
||||||
<v-skeleton-loader v-for="n in 2" :key="n"
|
<v-skeleton-loader
|
||||||
|
v-for="n in 2"
|
||||||
|
:key="n"
|
||||||
class="mx-auto border mt-3"
|
class="mx-auto border mt-3"
|
||||||
max-width="300"
|
max-width="300"
|
||||||
type="image, article"
|
type="image, article"
|
||||||
@ -11,12 +12,50 @@
|
|||||||
</v-col>
|
</v-col>
|
||||||
</v-row>
|
</v-row>
|
||||||
</div>
|
</div>
|
||||||
|
<div v-else>
|
||||||
|
<v-row>
|
||||||
|
<v-col cols="12" md="4" xl="2" v-for="document in documents.Data" :key="document.id">
|
||||||
|
<v-card class="mt-3">
|
||||||
|
<v-card-title>{{ document.Title }}</v-card-title>
|
||||||
|
<v-card-subtitle>{{
|
||||||
|
document.Chunked ? "分块的文档" : "还没有处理"
|
||||||
|
}}</v-card-subtitle>
|
||||||
|
<v-card-subtitle>
|
||||||
|
{{ new Date(document.CreatedAt).toLocaleString() }}
|
||||||
|
</v-card-subtitle>
|
||||||
|
<v-card-text>{{ document.content }}</v-card-text>
|
||||||
|
<v-card-actions>
|
||||||
|
<v-btn text color="primary">详情</v-btn>
|
||||||
|
<v-btn text color="secondary">编辑</v-btn>
|
||||||
|
</v-card-actions>
|
||||||
|
</v-card>
|
||||||
|
</v-col>
|
||||||
|
</v-row>
|
||||||
|
|
||||||
|
</div>
|
||||||
<div v-if="documents.Total == 0">
|
<div v-if="documents.Total == 0">
|
||||||
<v-alert text="看样子你还没有创建任何文档。"></v-alert>
|
<v-alert text="看样子你还没有创建任何文档。"></v-alert>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<v-btn class="mt-3" @click="goto_create_document">创建</v-btn>
|
<div class="text-center">
|
||||||
|
<v-container>
|
||||||
|
<v-row justify="center">
|
||||||
|
<v-col cols="8">
|
||||||
|
<v-container class="max-width">
|
||||||
|
<v-pagination
|
||||||
|
v-model="page"
|
||||||
|
class="my-4"
|
||||||
|
:length="documents.Total"
|
||||||
|
:disabled="loading"
|
||||||
|
@update:model-value="load"
|
||||||
|
></v-pagination>
|
||||||
|
</v-container>
|
||||||
|
</v-col>
|
||||||
|
</v-row>
|
||||||
|
</v-container>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<v-btn class="mt-3" @click="goto_create_document">创建</v-btn>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
@ -45,14 +84,12 @@ function load() {
|
|||||||
load();
|
load();
|
||||||
console.log(libraryId);
|
console.log(libraryId);
|
||||||
|
|
||||||
|
|
||||||
function goto_create_document() {
|
function goto_create_document() {
|
||||||
router.push({
|
router.push({
|
||||||
name: "library.documents.create",
|
name: "library.documents.create",
|
||||||
params: {
|
params: {
|
||||||
LibraryId: libraryId
|
LibraryId: libraryId,
|
||||||
}
|
},
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
@ -1,85 +1,89 @@
|
|||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
<LoadingComponent v-if="loading"> </LoadingComponent>
|
<LoadingComponent v-if="loading"> </LoadingComponent>
|
||||||
<div v-else>
|
<div v-else>
|
||||||
<h1>资料库</h1>
|
<h1>资料库</h1>
|
||||||
|
|
||||||
<!-- <div>
|
<!-- <div>
|
||||||
{{ selected_ids }}
|
{{ selected_ids }}
|
||||||
</div> -->
|
</div> -->
|
||||||
|
|
||||||
<v-btn @click="selectAll" :color="selected_ids.length > 0 ? 'primary' : ''"
|
<v-btn
|
||||||
>全选</v-btn
|
@click="selectAll"
|
||||||
>
|
:color="selected_ids.length > 0 ? 'primary' : ''"
|
||||||
|
>全选</v-btn
|
||||||
|
>
|
||||||
|
|
||||||
<v-btn
|
<v-btn
|
||||||
class="ml-2"
|
class="ml-2"
|
||||||
:disabled="selected_ids.length === 0"
|
:disabled="selected_ids.length === 0"
|
||||||
:loading="is_deleting"
|
:loading="is_deleting"
|
||||||
>删除所选
|
>删除所选
|
||||||
|
|
||||||
<v-dialog v-model="show_dialog" activator="parent" width="auto">
|
<v-dialog v-model="show_dialog" activator="parent" width="auto">
|
||||||
<v-card>
|
<v-card>
|
||||||
<v-card-text v-text="is_deleting ? '正在为你准备新项目。' : '确认删除所选项?'"></v-card-text>
|
<v-card-text
|
||||||
<v-card-actions>
|
v-text="is_deleting ? '正在为你准备新项目。' : '确认删除所选项?'"
|
||||||
<v-btn
|
></v-card-text>
|
||||||
color="primary"
|
<v-card-actions>
|
||||||
@click="deleteSelected"
|
<v-btn
|
||||||
:loading="is_deleting"
|
color="primary"
|
||||||
>确认删除</v-btn
|
@click="deleteSelected"
|
||||||
>
|
:loading="is_deleting"
|
||||||
<v-btn @click="show_dialog = false">取消</v-btn>
|
>确认删除</v-btn
|
||||||
</v-card-actions>
|
>
|
||||||
</v-card>
|
<v-btn @click="show_dialog = false">取消</v-btn>
|
||||||
</v-dialog>
|
</v-card-actions>
|
||||||
</v-btn>
|
</v-card>
|
||||||
<v-card class="mt-3">
|
</v-dialog>
|
||||||
<v-list>
|
</v-btn>
|
||||||
<v-list-item
|
<v-card class="mt-3">
|
||||||
v-for="item in libraries.Data"
|
<v-list>
|
||||||
:key="item.ID"
|
<v-list-item
|
||||||
@click.stop="goto(item.ID)"
|
v-for="item in libraries.Data"
|
||||||
>
|
:key="item.ID"
|
||||||
<template v-slot:prepend="{ isActive }">
|
@click.stop="goto(item.ID)"
|
||||||
<v-list-item-action start>
|
>
|
||||||
<v-checkbox-btn
|
<template v-slot:prepend="{ isActive }">
|
||||||
:model-value="isSelected(item.ID)"
|
<v-list-item-action start>
|
||||||
@click.stop="toggleSelection(item.ID)"
|
<v-checkbox-btn
|
||||||
></v-checkbox-btn>
|
:model-value="isSelected(item.ID)"
|
||||||
</v-list-item-action>
|
@click.stop="toggleSelection(item.ID)"
|
||||||
</template>
|
></v-checkbox-btn>
|
||||||
|
</v-list-item-action>
|
||||||
|
</template>
|
||||||
|
|
||||||
<template v-slot:append="{ isActive }">
|
<template v-slot:append="{ isActive }">
|
||||||
<v-list-item-action end>
|
<v-list-item-action end>
|
||||||
<v-btn rounded="xl" @click.stop="console.log(isActive)">
|
<v-btn rounded="xl" @click.stop="console.log(isActive)">
|
||||||
<v-icon>mdi-check</v-icon>
|
<v-icon>mdi-check</v-icon>
|
||||||
</v-btn>
|
</v-btn>
|
||||||
</v-list-item-action>
|
</v-list-item-action>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<v-list-item-title>{{ item.Name }}</v-list-item-title>
|
<v-list-item-title>{{ item.Name }}</v-list-item-title>
|
||||||
</v-list-item>
|
</v-list-item>
|
||||||
</v-list>
|
</v-list>
|
||||||
</v-card>
|
</v-card>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="text-center">
|
<div class="text-center">
|
||||||
<v-container>
|
<v-container>
|
||||||
<v-row justify="center">
|
<v-row justify="center">
|
||||||
<v-col cols="8">
|
<v-col cols="8">
|
||||||
<v-container class="max-width">
|
<v-container class="max-width">
|
||||||
<v-pagination
|
<v-pagination
|
||||||
v-model="page"
|
v-model="page"
|
||||||
class="my-4"
|
class="my-4"
|
||||||
:length="libraries.Total"
|
:length="libraries.Total"
|
||||||
:disabled="loading"
|
:disabled="loading"
|
||||||
@update:model-value="load"
|
@update:model-value="load"
|
||||||
></v-pagination>
|
></v-pagination>
|
||||||
</v-container>
|
</v-container>
|
||||||
</v-col>
|
</v-col>
|
||||||
</v-row>
|
</v-row>
|
||||||
</v-container>
|
</v-container>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@ -123,9 +127,9 @@ const goto = (libraryId) => {
|
|||||||
router.push({
|
router.push({
|
||||||
name: "library.documents",
|
name: "library.documents",
|
||||||
params: {
|
params: {
|
||||||
LibraryId: libraryId
|
LibraryId: libraryId,
|
||||||
}
|
},
|
||||||
})
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
function isSelected(id) {
|
function isSelected(id) {
|
||||||
@ -179,7 +183,7 @@ function deleteSelected() {
|
|||||||
page.value = page.value - 1;
|
page.value = page.value - 1;
|
||||||
}
|
}
|
||||||
if (page.value == 0) {
|
if (page.value == 0) {
|
||||||
page.value = 1
|
page.value = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
load(false);
|
load(false);
|
||||||
|
Loading…
Reference in New Issue
Block a user