feat: add attachment group editing component

Signed-off-by: Ryan Wang <i@ryanc.cc>
pull/603/head
Ryan Wang 2 years ago
parent 417843807f
commit 714f61dfc2

@ -21,6 +21,7 @@ import AttachmentDetailModal from "./components/AttachmentDetailModal.vue";
import AttachmentUploadModal from "./components/AttachmentUploadModal.vue";
import AttachmentSelectModal from "./components/AttachmentSelectModal.vue";
import AttachmentStrategiesModal from "./components/AttachmentStrategiesModal.vue";
import AttachmentGroupEditingModal from "./components/AttachmentGroupEditingModal.vue";
import { ref } from "vue";
import { useUserFetch } from "@/modules/system/users/composables/use-user";
@ -41,6 +42,7 @@ const strategyVisible = ref(false);
const selectVisible = ref(false);
const uploadVisible = ref(false);
const detailVisible = ref(false);
const groupEditingModal = ref(false);
const checkAll = ref(false);
const { users } = useUserFetch();
@ -87,6 +89,7 @@ const folders = [
<AttachmentUploadModal v-model:visible="uploadVisible" />
<AttachmentSelectModal v-model:visible="selectVisible" />
<AttachmentStrategiesModal v-model:visible="strategyVisible" />
<AttachmentGroupEditingModal v-model:visible="groupEditingModal" />
<VPageHeader title="附件库">
<template #icon>
<IconPalette class="mr-2 self-center" />
@ -360,10 +363,30 @@ const folders = [
{{ folder.name }}{{ index * 20 }}
</span>
</div>
<FloatingDropdown>
<IconMore />
<template #popper>
<div class="w-48 p-2">
<VSpace class="w-full" direction="column">
<VButton
v-close-popper
block
type="secondary"
@click="groupEditingModal = true"
>
重命名
</VButton>
<VButton v-close-popper block type="danger">
删除
</VButton>
</VSpace>
</div>
</template>
</FloatingDropdown>
</div>
<div
class="flex cursor-pointer items-center rounded-base bg-gray-100 p-2 text-gray-500 transition-all hover:bg-gray-200 hover:text-gray-900 hover:shadow-sm"
@click="groupEditingModal = true"
>
<div class="flex flex-1 items-center">
<span class="text-sm">添加分组</span>

@ -0,0 +1,49 @@
<script lang="ts" setup>
import { VButton, VModal, VSpace } from "@halo-dev/components";
withDefaults(
defineProps<{
visible: boolean;
group: object | null;
}>(),
{
visible: false,
group: null,
}
);
const emit = defineEmits<{
(event: "update:visible", visible: boolean): void;
(event: "close"): void;
}>();
const onVisibleChange = (visible: boolean) => {
emit("update:visible", visible);
if (!visible) {
emit("close");
}
};
</script>
<template>
<VModal
:visible="visible"
:width="500"
title="附件分组"
@update:visible="onVisibleChange"
>
<FormKit id="attachment-group-form" type="form">
<FormKit label="名称" type="text" validation="required"></FormKit>
</FormKit>
<template #footer>
<VSpace>
<VButton
type="secondary"
@click="$formkit.submit('attachment-group-form')"
>
保存 +
</VButton>
<VButton @click="onVisibleChange(false)"> Esc</VButton>
</VSpace>
</template>
</VModal>
</template>
Loading…
Cancel
Save