From cd78171106d95f0a45d1d8bfa110729414ed5fe4 Mon Sep 17 00:00:00 2001 From: puhui999 Date: Fri, 6 Jun 2025 23:20:14 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20=E4=BC=98=E5=8C=96=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E7=94=9F=E6=88=90=20demo01,=20=E5=A2=9E=E5=8A=A0=E6=89=B9?= =?UTF-8?q?=E9=87=8F=E5=88=A0=E9=99=A4=E7=A4=BA=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/infra/demo/demo01/index.ts | 70 +++++++++++-------- .../infra/demo/demo01/Demo01ContactForm.vue | 15 ++-- src/views/infra/demo/demo01/index.vue | 60 +++++++++++++--- 3 files changed, 98 insertions(+), 47 deletions(-) diff --git a/src/api/infra/demo/demo01/index.ts b/src/api/infra/demo/demo01/index.ts index e34a05d1..982049c5 100644 --- a/src/api/infra/demo/demo01/index.ts +++ b/src/api/infra/demo/demo01/index.ts @@ -1,40 +1,50 @@ import request from '@/config/axios' +import type { Dayjs } from 'dayjs' -export interface Demo01ContactVO { - id: number - name: string - sex: number - birthday: Date - description: string - avatar: string +/** 示例联系人信息 */ +export interface Demo01Contact { + id: number // 编号 + name?: string // 名字 + sex?: number // 性别 + birthday?: string | Dayjs // 出生年 + description?: string // 简介 + avatar: string // 头像 } -// 查询示例联系人分页 -export const getDemo01ContactPage = async (params) => { - return await request.get({ url: `/infra/demo01-contact/page`, params }) -} +// 示例联系人 API +export const Demo01ContactApi = { + // 查询示例联系人分页 + getDemo01ContactPage: async (params: any) => { + return await request.get({ url: `/infra/demo01-contact/page`, params }) + }, -// 查询示例联系人详情 -export const getDemo01Contact = async (id: number) => { - return await request.get({ url: `/infra/demo01-contact/get?id=` + id }) -} + // 查询示例联系人详情 + getDemo01Contact: async (id: number) => { + return await request.get({ url: `/infra/demo01-contact/get?id=` + id }) + }, -// 新增示例联系人 -export const createDemo01Contact = async (data: Demo01ContactVO) => { - return await request.post({ url: `/infra/demo01-contact/create`, data }) -} + // 新增示例联系人 + createDemo01Contact: async (data: Demo01Contact) => { + return await request.post({ url: `/infra/demo01-contact/create`, data }) + }, -// 修改示例联系人 -export const updateDemo01Contact = async (data: Demo01ContactVO) => { - return await request.put({ url: `/infra/demo01-contact/update`, data }) -} + // 修改示例联系人 + updateDemo01Contact: async (data: Demo01Contact) => { + return await request.put({ url: `/infra/demo01-contact/update`, data }) + }, -// 删除示例联系人 -export const deleteDemo01Contact = async (id: number) => { - return await request.delete({ url: `/infra/demo01-contact/delete?id=` + id }) -} + // 删除示例联系人 + deleteDemo01Contact: async (id: number) => { + return await request.delete({ url: `/infra/demo01-contact/delete?id=` + id }) + }, -// 导出示例联系人 Excel -export const exportDemo01Contact = async (params) => { - return await request.download({ url: `/infra/demo01-contact/export-excel`, params }) + /** 批量删除示例联系人 */ + deleteDemo01ContactList: async (ids: number[]) => { + return await request.delete({ url: `/infra/demo01-contact/delete-list?ids=${ids.join(',')}` }) + }, + + // 导出示例联系人 Excel + exportDemo01Contact: async (params) => { + return await request.download({ url: `/infra/demo01-contact/export-excel`, params }) + } } diff --git a/src/views/infra/demo/demo01/Demo01ContactForm.vue b/src/views/infra/demo/demo01/Demo01ContactForm.vue index f317fe76..d32a702a 100644 --- a/src/views/infra/demo/demo01/Demo01ContactForm.vue +++ b/src/views/infra/demo/demo01/Demo01ContactForm.vue @@ -15,7 +15,7 @@ {{ dict.label }} @@ -44,7 +44,10 @@