From 6a76844bde6f6b14bd08459324cdaca25d5a6b73 Mon Sep 17 00:00:00 2001 From: YunaiV Date: Mon, 7 Apr 2025 19:27:50 +0800 Subject: [PATCH] =?UTF-8?q?feat=EF=BC=9A=E5=AE=8C=E5=96=84=20file=20?= =?UTF-8?q?=E4=B8=8A=E4=BC=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/web-antd/src/views/infra/file/data.ts | 17 +++- apps/web-antd/src/views/infra/file/index.vue | 6 +- .../src/views/infra/file/modules/form.vue | 81 ++++++------------- .../src/views/infra/fileConfig/data.ts | 2 +- 4 files changed, 45 insertions(+), 61 deletions(-) diff --git a/apps/web-antd/src/views/infra/file/data.ts b/apps/web-antd/src/views/infra/file/data.ts index cff72978..1f78d606 100644 --- a/apps/web-antd/src/views/infra/file/data.ts +++ b/apps/web-antd/src/views/infra/file/data.ts @@ -1,4 +1,4 @@ -import { type VbenFormSchema, z } from '#/adapter/form'; +import { type VbenFormSchema } from '#/adapter/form'; import type { OnActionClickFn, VxeTableGridOptions } from '#/adapter/vxe-table'; import type { InfraFileApi } from '#/api/infra/file'; @@ -7,6 +7,21 @@ import { getRangePickerDefaultProps } from '#/utils/date'; const { hasAccessByCodes } = useAccess(); +/** 表单的字段 */ +export function useFormSchema(): VbenFormSchema[] { + return [ + { + fieldName: 'file', + label: '文件上传', + component: 'Upload', + rules: 'required', + componentProps: { + placeholder: '请选择要上传的文件', + }, + } + ]; +} + /** 列表的搜索表单 */ export function useGridFormSchema(): VbenFormSchema[] { return [ diff --git a/apps/web-antd/src/views/infra/file/index.vue b/apps/web-antd/src/views/infra/file/index.vue index 8491ce70..aef029f5 100644 --- a/apps/web-antd/src/views/infra/file/index.vue +++ b/apps/web-antd/src/views/infra/file/index.vue @@ -4,7 +4,7 @@ import type { InfraFileApi } from '#/api/infra/file'; import { Page, useVbenModal } from '@vben/common-ui'; import { Button, message, Image } from 'ant-design-vue'; -import { Plus } from '@vben/icons'; +import { Upload } from '@vben/icons'; import Form from './modules/form.vue'; import { $t } from '#/locales'; @@ -123,8 +123,8 @@ const [Grid, gridApi] = useVbenVxeGrid({