From 982c97ab82f3beb1b4febcf014562eda34b9fc05 Mon Sep 17 00:00:00 2001
From: liu <2021943741@qq.com>
Date: 星期二, 29 九月 2026 17:59:41 +0800
Subject: [PATCH] feat(ui): 江苏商贸品牌视觉与首页/登录页改版
---
src/views/archive/document/index.vue | 163 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 163 insertions(+), 0 deletions(-)
diff --git a/src/views/archive/document/index.vue b/src/views/archive/document/index.vue
new file mode 100644
index 0000000..4f3fd7c
--- /dev/null
+++ b/src/views/archive/document/index.vue
@@ -0,0 +1,163 @@
+<script lang="ts" setup>
+import type { VxeTableGridOptions } from '#/adapter/vxe-table';
+import type { ArchiveDocumentApi } from '#/api/archive/document';
+
+import { Page, useVbenModal } from '@vben/common-ui';
+import { downloadFileFromBlobPart } from '@vben/utils';
+
+import { message, Tag } from 'ant-design-vue';
+
+import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table';
+import {
+ deleteDocument,
+ exportDocument,
+ getDocumentPage,
+} from '#/api/archive/document';
+import { $t } from '#/locales';
+
+import { useGridColumns, useGridFormSchema } from './data';
+import Form from './modules/form.vue';
+
+/** 妗f绠$悊 */
+defineOptions({ name: 'ArchiveDocument' });
+
+const [FormModal, formModalApi] = useVbenModal({
+ connectedComponent: Form,
+ destroyOnClose: true,
+});
+
+/** 鍒锋柊琛ㄦ牸 */
+function handleRefresh() {
+ gridApi.query();
+}
+
+/** 鏂板妗f */
+function handleCreate() {
+ formModalApi.setData({ formType: 'create' }).open();
+}
+
+/** 缂栬緫妗f */
+function handleEdit(row: ArchiveDocumentApi.Document) {
+ formModalApi.setData({ formType: 'edit', id: row.id }).open();
+}
+
+/** 鏌ョ湅妗f璇︽儏 */
+function handleDetail(row: ArchiveDocumentApi.Document) {
+ formModalApi.setData({ formType: 'detail', id: row.id }).open();
+}
+
+/** 鍒犻櫎妗f */
+async function handleDelete(row: ArchiveDocumentApi.Document) {
+ const hideLoading = message.loading({
+ content: $t('ui.actionMessage.deleting', [row.title]),
+ duration: 0,
+ });
+ try {
+ await deleteDocument(row.id!);
+ message.success($t('ui.actionMessage.deleteSuccess', [row.title]));
+ handleRefresh();
+ } finally {
+ hideLoading();
+ }
+}
+
+/** 瀵煎嚭 Excel */
+async function handleExport() {
+ const data = await exportDocument(await gridApi.formApi.getValues());
+ downloadFileFromBlobPart({ fileName: '妗f.xls', source: data });
+}
+
+const [Grid, gridApi] = useVbenVxeGrid({
+ formOptions: {
+ schema: useGridFormSchema(),
+ },
+ gridOptions: {
+ columns: useGridColumns(),
+ height: 'auto',
+ keepSource: true,
+ proxyConfig: {
+ ajax: {
+ query: async ({ page }, formValues) => {
+ return await getDocumentPage({
+ pageNo: page.currentPage,
+ pageSize: page.pageSize,
+ ...formValues,
+ });
+ },
+ },
+ },
+ rowConfig: {
+ keyField: 'id',
+ isHover: true,
+ },
+ toolbarConfig: {
+ refresh: true,
+ search: true,
+ },
+ } as VxeTableGridOptions<ArchiveDocumentApi.Document>,
+});
+</script>
+
+<template>
+ <Page auto-content-height>
+ <FormModal @success="handleRefresh" />
+ <Grid table-title="妗f绠$悊">
+ <template #toolbar-tools>
+ <TableAction
+ :actions="[
+ {
+ label: $t('ui.actionTitle.create', ['妗f']),
+ type: 'primary',
+ icon: ACTION_ICON.ADD,
+ auth: ['archive:document:create'],
+ onClick: handleCreate,
+ },
+ {
+ label: '瀵煎嚭',
+ type: 'primary',
+ icon: ACTION_ICON.DOWNLOAD,
+ auth: ['archive:document:export'],
+ onClick: handleExport,
+ },
+ ]"
+ />
+ </template>
+ <template #hasAttachment="{ row }">
+ <Tag :color="row.hasAttachment ? 'success' : 'default'">
+ {{ row.hasAttachment ? '鏈�' : '鏃�' }}
+ </Tag>
+ </template>
+ <template #actions="{ row }">
+ <TableAction
+ :actions="[
+ {
+ label: $t('common.detail'),
+ type: 'link',
+ icon: ACTION_ICON.VIEW,
+ auth: ['archive:document:query'],
+ onClick: handleDetail.bind(null, row),
+ },
+ {
+ label: $t('common.edit'),
+ type: 'link',
+ icon: ACTION_ICON.EDIT,
+ auth: ['archive:document:update'],
+ onClick: handleEdit.bind(null, row),
+ },
+ {
+ label: $t('common.delete'),
+ type: 'link',
+ danger: true,
+ icon: ACTION_ICON.DELETE,
+ auth: ['archive:document:delete'],
+ popConfirm: {
+ title: $t('ui.actionMessage.deleteConfirm', [row.no]),
+ confirm: handleDelete.bind(null, row),
+ },
+ },
+ ]"
+ />
+ </template>
+ </Grid>
+ </Page>
+</template>
--
Gitblit v1.9.3