From 5fa6ca78e293d106d65b6267e963abb387d3c37e Mon Sep 17 00:00:00 2001 From: xingyu4j Date: Fri, 30 May 2025 21:24:24 +0800 Subject: [PATCH] feat: tag --- apps/web-antd/src/api/mp/account/index.ts | 7 + apps/web-antd/src/api/mp/tag/index.ts | 3 +- apps/web-antd/src/views/mp/tag/data.ts | 82 +++++++++ apps/web-antd/src/views/mp/tag/index.vue | 172 +++++++++++++++--- .../src/views/mp/tag/modules/form.vue | 88 +++++++++ 5 files changed, 328 insertions(+), 24 deletions(-) create mode 100644 apps/web-antd/src/views/mp/tag/data.ts create mode 100644 apps/web-antd/src/views/mp/tag/modules/form.vue diff --git a/apps/web-antd/src/api/mp/account/index.ts b/apps/web-antd/src/api/mp/account/index.ts index 918c80202..9e7d27712 100644 --- a/apps/web-antd/src/api/mp/account/index.ts +++ b/apps/web-antd/src/api/mp/account/index.ts @@ -33,6 +33,13 @@ export function getAccount(id: number) { return requestClient.get(`/mp/account/get?id=${id}`); } +/** 查询公众号账号列表 */ +export function getSimpleAccountList() { + return requestClient.get( + '/mp/account/list-all-simple', + ); +} + /** 新增公众号账号 */ export function createAccount(data: MpAccountApi.Account) { return requestClient.post('/mp/account/create', data); diff --git a/apps/web-antd/src/api/mp/tag/index.ts b/apps/web-antd/src/api/mp/tag/index.ts index 3cf677e7d..b1acd0130 100644 --- a/apps/web-antd/src/api/mp/tag/index.ts +++ b/apps/web-antd/src/api/mp/tag/index.ts @@ -6,8 +6,9 @@ export namespace MpTagApi { /** 标签信息 */ export interface Tag { id?: number; - name: string; accountId: number; + name: string; + count?: number; createTime?: Date; } diff --git a/apps/web-antd/src/views/mp/tag/data.ts b/apps/web-antd/src/views/mp/tag/data.ts new file mode 100644 index 000000000..ce0a4f9aa --- /dev/null +++ b/apps/web-antd/src/views/mp/tag/data.ts @@ -0,0 +1,82 @@ +import type { VbenFormSchema } from '#/adapter/form'; +import type { VxeGridPropTypes } from '#/adapter/vxe-table'; + +import { getSimpleAccountList } from '#/api/mp/account'; + +/** 新增/修改的表单 */ +export function useFormSchema(): VbenFormSchema[] { + return [ + { + component: 'Input', + fieldName: 'id', + dependencies: { + triggerFields: [''], + show: () => false, + }, + }, + { + fieldName: 'accountId', + label: '公众号', + component: 'Input', + dependencies: { + triggerFields: [''], + show: () => false, + }, + }, + { + fieldName: 'name', + label: '标签名称', + component: 'Input', + rules: 'required', + componentProps: { + placeholder: '请输入名称', + }, + }, + ]; +} + +/** 搜索表单配置 */ +export function useGridFormSchema(): VbenFormSchema[] { + return [ + { + fieldName: 'accountId', + label: '公众号', + component: 'ApiSelect', + componentProps: { + api: getSimpleAccountList, + labelField: 'name', + valueField: 'id', + allowClear: true, + }, + }, + ]; +} + +/** 表格列配置 */ +export function useGridColumns(): VxeGridPropTypes.Columns { + return [ + { + title: '编号', + field: 'id', + }, + { + title: '标签名称', + field: 'name', + }, + { + title: '粉丝数', + field: 'count', + }, + { + title: '创建时间', + field: 'createTime', + formatter: 'formatDateTime', + }, + { + title: '操作', + width: 140, + fixed: 'right', + slots: { default: 'actions' }, + }, + ]; +} diff --git a/apps/web-antd/src/views/mp/tag/index.vue b/apps/web-antd/src/views/mp/tag/index.vue index a54db51e9..e5ccef0c7 100644 --- a/apps/web-antd/src/views/mp/tag/index.vue +++ b/apps/web-antd/src/views/mp/tag/index.vue @@ -1,31 +1,157 @@ diff --git a/apps/web-antd/src/views/mp/tag/modules/form.vue b/apps/web-antd/src/views/mp/tag/modules/form.vue new file mode 100644 index 000000000..1c70f95a6 --- /dev/null +++ b/apps/web-antd/src/views/mp/tag/modules/form.vue @@ -0,0 +1,88 @@ + + +