From 6ca22ff15550d897cae6a68c8de6aff48096c349 Mon Sep 17 00:00:00 2001 From: puhui999 Date: Tue, 22 Apr 2025 14:57:11 +0800 Subject: [PATCH 1/3] =?UTF-8?q?refactor:=20=E9=87=8D=E6=96=B0=E7=94=9F?= =?UTF-8?q?=E6=88=90=E5=8D=95=E8=A1=A8=E4=BB=A3=E7=A0=81=E7=94=9F=E6=88=90?= =?UTF-8?q?=E9=A2=84=E8=A7=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/api/infra/demo/demo03/inner/index.ts | 6 +++-- .../src/views/infra/demo/demo01/data.ts | 11 +++------ .../src/views/infra/demo/demo01/index.vue | 23 +++++++++---------- .../views/infra/demo/demo01/modules/form.vue | 3 +-- 4 files changed, 19 insertions(+), 24 deletions(-) diff --git a/apps/web-antd/src/api/infra/demo/demo03/inner/index.ts b/apps/web-antd/src/api/infra/demo/demo03/inner/index.ts index bda93c5cb..08dae5165 100644 --- a/apps/web-antd/src/api/infra/demo/demo03/inner/index.ts +++ b/apps/web-antd/src/api/infra/demo/demo03/inner/index.ts @@ -10,7 +10,7 @@ export namespace Demo03StudentApi { name?: string; // 名字 score?: number; // 分数 } - // TODO @puhui999:要不要每个 interface 之间,有个空行 + /** 学生班级信息 */ export interface Demo03Grade { id: number; // 编号 @@ -18,6 +18,7 @@ export namespace Demo03StudentApi { name?: string; // 名字 teacher?: string; // 班主任 } + /** 学生信息 */ export interface Demo03Student { id: number; // 编号 @@ -61,7 +62,7 @@ export function exportDemo03Student(params: any) { } // ==================== 子表(学生课程) ==================== -// TODO @puhui999:==================== 后面,加个空行,会更清晰一点 + /** 获得学生课程列表 */ export function getDemo03CourseListByStudentId(studentId: number) { return requestClient.get( @@ -70,6 +71,7 @@ export function getDemo03CourseListByStudentId(studentId: number) { } // ==================== 子表(学生班级) ==================== + /** 获得学生班级 */ export function getDemo03GradeByStudentId(studentId: number) { return requestClient.get( diff --git a/apps/web-antd/src/views/infra/demo/demo01/data.ts b/apps/web-antd/src/views/infra/demo/demo01/data.ts index 95dd37fde..860bc859b 100644 --- a/apps/web-antd/src/views/infra/demo/demo01/data.ts +++ b/apps/web-antd/src/views/infra/demo/demo01/data.ts @@ -52,22 +52,16 @@ export function useFormSchema(): VbenFormSchema[] { valueFormat: 'x', }, }, - // TODO 【富文本】@puhui999:@芋艿:后续要封装下;单独 pr { fieldName: 'description', label: '简介', rules: 'required', - component: 'Editor', + component: 'RichTextarea', }, - // TODO 【文件上传】@puhui999:@芋艿:后续要封装下;单独 pr { fieldName: 'avatar', label: '头像', - component: 'FileUpload', - componentProps: { - fileType: 'image', - maxCount: 1, - }, + component: 'ImageUpload', }, ]; } @@ -91,6 +85,7 @@ export function useGridFormSchema(): VbenFormSchema[] { componentProps: { allowClear: true, options: getDictOptions(DICT_TYPE.SYSTEM_USER_SEX, 'number'), + placeholder: '请选择性别', }, }, { diff --git a/apps/web-antd/src/views/infra/demo/demo01/index.vue b/apps/web-antd/src/views/infra/demo/demo01/index.vue index 068de7db7..ac3b59e27 100644 --- a/apps/web-antd/src/views/infra/demo/demo01/index.vue +++ b/apps/web-antd/src/views/infra/demo/demo01/index.vue @@ -25,15 +25,9 @@ function onRefresh() { gridApi.query(); } -/** 导出表格 */ -async function onExport() { - const data = await exportDemo01Contact(await gridApi.formApi.getValues()); - downloadByData(data, '示例联系人.xls'); -} - /** 创建示例联系人 */ function onCreate() { - formModalApi.setData(null).open(); + formModalApi.setData({}).open(); } /** 编辑示例联系人 */ @@ -60,18 +54,23 @@ async function onDelete(row: Demo01ContactApi.Demo01Contact) { } } +/** 导出表格 */ +async function onExport() { + const data = await exportDemo01Contact(await gridApi.formApi.getValues()); + downloadByData(data, '示例联系人.xls'); +} + /** 表格操作按钮的回调函数 */ function onActionClick({ code, row }: OnActionClickParams) { switch (code) { - case 'delete': { - onDelete(row); - break; - } - // TODO @puhui999:edit 放在 delete 前面哈。好理解一点,修改 => 删除 case 'edit': { onEdit(row); break; } + case 'delete': { + onDelete(row); + break; + } } } diff --git a/apps/web-antd/src/views/infra/demo/demo01/modules/form.vue b/apps/web-antd/src/views/infra/demo/demo01/modules/form.vue index 3d3804e73..677992dd8 100644 --- a/apps/web-antd/src/views/infra/demo/demo01/modules/form.vue +++ b/apps/web-antd/src/views/infra/demo/demo01/modules/form.vue @@ -47,6 +47,7 @@ const [Modal, modalApi] = useVbenModal({ }, async onOpenChange(isOpen: boolean) { if (!isOpen) { + formData.value = undefined; return; } @@ -55,9 +56,7 @@ const [Modal, modalApi] = useVbenModal({ if (!data) { return; } - if (data.id) { - // 编辑 TODO @puhui999:1)这里注释,“编辑”去掉;2)data.id 上面的空行去掉; modalApi.lock(); try { data = await getDemo01Contact(data.id); From 86fe4ff96a6be65c483ba21bfa1c749c0051ede6 Mon Sep 17 00:00:00 2001 From: puhui999 Date: Tue, 22 Apr 2025 15:22:39 +0800 Subject: [PATCH 2/3] =?UTF-8?q?refactor:=20=E7=AB=99=E5=86=85=E4=BF=A1?= =?UTF-8?q?=E4=BB=A3=E7=A0=81=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/views/system/notify/my/index.vue | 24 ++------ .../src/views/system/notify/template/data.ts | 59 ++++++++++++++----- .../views/system/notify/template/index.vue | 36 +++-------- .../system/notify/template/modules/form.vue | 25 +++----- .../notify/template/modules/send-form.vue | 9 +-- 5 files changed, 68 insertions(+), 85 deletions(-) diff --git a/apps/web-antd/src/views/system/notify/my/index.vue b/apps/web-antd/src/views/system/notify/my/index.vue index 6cf4698a3..0c5690ef6 100644 --- a/apps/web-antd/src/views/system/notify/my/index.vue +++ b/apps/web-antd/src/views/system/notify/my/index.vue @@ -1,14 +1,11 @@