From d7b6c87e33cce1ea1e22fdbfd9c541cc17e2e600 Mon Sep 17 00:00:00 2001 From: YunaiV Date: Wed, 19 Nov 2025 21:58:25 +0800 Subject: [PATCH] =?UTF-8?q?feat=EF=BC=9A=E3=80=90antd/ele=E3=80=91?= =?UTF-8?q?=E3=80=90mp=E3=80=91=E4=BC=98=E5=8C=96=20mp=20=E8=B4=A6?= =?UTF-8?q?=E5=8F=B7=E7=9A=84=E9=80=89=E6=8B=A9=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/web-antd/src/views/mp/autoReply/data.ts | 17 +---------- .../web-antd/src/views/mp/autoReply/index.vue | 12 +++++++- apps/web-antd/src/views/mp/autoReply/types.ts | 1 + .../wx-account-select/account-select.vue | 2 +- apps/web-antd/src/views/mp/draft/data.ts | 17 +---------- apps/web-antd/src/views/mp/draft/index.vue | 12 +++++++- apps/web-antd/src/views/mp/statistics/data.ts | 19 ++----------- .../src/views/mp/statistics/index.vue | 20 ++++++++----- apps/web-antd/src/views/mp/tag/data.ts | 18 +----------- apps/web-antd/src/views/mp/tag/index.vue | 11 ++++++++ apps/web-antd/src/views/mp/user/data.ts | 16 +---------- apps/web-antd/src/views/mp/user/index.vue | 11 ++++++++ apps/web-ele/src/api/mp/statistics/index.ts | 28 ++++++++++--------- apps/web-ele/src/api/mp/tag/index.ts | 8 +----- .../account-select/account-select.vue | 2 +- apps/web-ele/src/views/mp/components/index.ts | 2 ++ .../src/views/mp/statistics/chart-options.ts | 8 +++--- apps/web-ele/src/views/mp/statistics/data.ts | 19 ++----------- .../web-ele/src/views/mp/statistics/index.vue | 20 ++++++++----- apps/web-ele/src/views/mp/tag/data.ts | 17 +---------- apps/web-ele/src/views/mp/tag/index.vue | 11 ++++++++ apps/web-ele/src/views/mp/user/data.ts | 16 +---------- apps/web-ele/src/views/mp/user/index.vue | 11 ++++++++ 23 files changed, 127 insertions(+), 171 deletions(-) diff --git a/apps/web-antd/src/views/mp/autoReply/data.ts b/apps/web-antd/src/views/mp/autoReply/data.ts index 9d8736ee7..c3fdb981e 100644 --- a/apps/web-antd/src/views/mp/autoReply/data.ts +++ b/apps/web-antd/src/views/mp/autoReply/data.ts @@ -1,21 +1,15 @@ import type { VbenFormSchema } from '#/adapter/form'; import type { VxeGridPropTypes } from '#/adapter/vxe-table'; -import type { MpAccountApi } from '#/api/mp/account'; import { markRaw } from 'vue'; import { DICT_TYPE } from '@vben/constants'; import { getDictOptions } from '@vben/hooks'; -import { getSimpleAccountList } from '#/api/mp/account'; import { WxReply } from '#/views/mp/components'; import { MsgType } from './types'; -/** 关联数据 */ -let accountList: MpAccountApi.AccountSimple[] = []; -getSimpleAccountList().then((data) => (accountList = data)); - // TODO @芋艿:要不要使用统一枚举? const RequestMessageTypes = new Set([ 'image', @@ -159,21 +153,12 @@ export function useFormSchema(msgType: MsgType): VbenFormSchema[] { } /** 列表的搜索表单 */ -// TODO @芋艿:貌似可能微信号拿不到。 export function useGridFormSchema(): VbenFormSchema[] { return [ { fieldName: 'accountId', label: '公众号', - component: 'ApiSelect', - componentProps: { - options: accountList.map((item) => ({ - label: item.name, - value: item.id, - })), - placeholder: '请选择公众号', - }, - defaultValue: accountList[0]?.id, + component: 'Input', }, ]; } diff --git a/apps/web-antd/src/views/mp/autoReply/index.vue b/apps/web-antd/src/views/mp/autoReply/index.vue index 22cb3bea9..bc75396c7 100644 --- a/apps/web-antd/src/views/mp/autoReply/index.vue +++ b/apps/web-antd/src/views/mp/autoReply/index.vue @@ -16,6 +16,7 @@ import { getAutoReplyPage, } from '#/api/mp/autoReply'; import { $t } from '#/locales'; +import { WxAccountSelect } from '#/views/mp/components'; import { useGridColumns, useGridFormSchema } from './data'; import ReplyContentCell from './modules/content.vue'; @@ -43,6 +44,12 @@ function handleRefresh() { gridApi.query(); } +/** 公众号变化时查询数据 */ +function handleAccountChange(accountId: number) { + gridApi.formApi.setValues({ accountId }); + gridApi.formApi.submitForm(); +} + /** 切换回复类型 */ async function onTabChange(tabName: any) { msgType.value = tabName; @@ -106,7 +113,6 @@ const [FormModal, formModalApi] = useVbenModal({ const [Grid, gridApi] = useVbenVxeGrid({ formOptions: { schema: useGridFormSchema(), - submitOnChange: true, // 表单值变化时自动提交,这样 accountId 会被正确传递到查询函数 }, gridOptions: { columns: useGridColumns(Number(msgType.value) as MsgType), @@ -123,6 +129,7 @@ const [Grid, gridApi] = useVbenVxeGrid({ }); }, }, + autoLoad: false, }, rowConfig: { keyField: 'id', @@ -144,6 +151,9 @@ const [Grid, gridApi] = useVbenVxeGrid({ +