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({
+
+
+
diff --git a/apps/web-antd/src/views/mp/draft/data.ts b/apps/web-antd/src/views/mp/draft/data.ts
index 2da51d193..7f9344275 100644
--- a/apps/web-antd/src/views/mp/draft/data.ts
+++ b/apps/web-antd/src/views/mp/draft/data.ts
@@ -1,12 +1,5 @@
import type { VbenFormSchema } from '#/adapter/form';
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
-import type { MpAccountApi } from '#/api/mp/account';
-
-import { getSimpleAccountList } from '#/api/mp/account';
-
-/** 关联数据 */
-let accountList: MpAccountApi.AccountSimple[] = [];
-getSimpleAccountList().then((data) => (accountList = data));
/** 获取表格列配置 */
export function useGridColumns(): VxeTableGridOptions['columns'] {
@@ -32,15 +25,7 @@ export function useGridFormSchema(): VbenFormSchema[] {
{
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/draft/index.vue b/apps/web-antd/src/views/mp/draft/index.vue
index 8002bc337..ea50b6f21 100644
--- a/apps/web-antd/src/views/mp/draft/index.vue
+++ b/apps/web-antd/src/views/mp/draft/index.vue
@@ -11,6 +11,7 @@ import { message } from 'ant-design-vue';
import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table';
import { deleteDraft, getDraftPage } from '#/api/mp/draft';
import { submitFreePublish } from '#/api/mp/freePublish';
+import { WxAccountSelect } from '#/views/mp/components';
import { createEmptyNewsItem } from '#/views/mp/draft/modules/types';
import { useGridColumns, useGridFormSchema } from './data';
@@ -24,6 +25,12 @@ function handleRefresh() {
gridApi.query();
}
+/** 公众号变化时查询数据 */
+function handleAccountChange(accountId: number) {
+ gridApi.formApi.setValues({ accountId });
+ gridApi.formApi.submitForm();
+}
+
/** 新增草稿 */
async function handleCreate() {
const formValues = await gridApi.formApi.getValues();
@@ -115,7 +122,6 @@ const [FormModal, formModalApi] = useVbenModal({
const [Grid, gridApi] = useVbenVxeGrid({
formOptions: {
schema: useGridFormSchema(),
- submitOnChange: true,
},
gridOptions: {
columns: useGridColumns(),
@@ -144,6 +150,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
};
},
},
+ autoLoad: false,
},
rowConfig: {
keyField: 'mediaId',
@@ -167,6 +174,9 @@ const [Grid, gridApi] = useVbenVxeGrid({
+
+
+
import type { EchartsUIType } from '@vben/plugins/echarts';
-import { onMounted, ref } from 'vue';
+import { ref } from 'vue';
import { ContentWrap, Page } from '@vben/common-ui';
import { EchartsUI, useEcharts } from '@vben/plugins/echarts';
@@ -16,6 +16,7 @@ import {
getUserCumulate,
getUserSummary,
} from '#/api/mp/statistics';
+import { WxAccountSelect } from '#/views/mp/components';
import {
interfaceSummaryOption,
@@ -95,6 +96,12 @@ async function getSummary(values: Record) {
);
}
+/** 公众号变化时查询数据 */
+function handleAccountChange(accountId: number) {
+ queryFormApi.setValues({ accountId });
+ queryFormApi.submitForm();
+}
+
const [QueryForm, queryFormApi] = useVbenForm({
commonConfig: {
componentProps: {
@@ -106,17 +113,16 @@ const [QueryForm, queryFormApi] = useVbenForm({
wrapperClass: 'grid-cols-1 md:grid-cols-2',
handleSubmit: getSummary,
});
-
-/** 初始化 */
-onMounted(() => {
- queryFormApi.submitForm();
-});
-
+
+
+
+
+
diff --git a/apps/web-antd/src/views/mp/tag/data.ts b/apps/web-antd/src/views/mp/tag/data.ts
index a49cbb330..ffce47fdd 100644
--- a/apps/web-antd/src/views/mp/tag/data.ts
+++ b/apps/web-antd/src/views/mp/tag/data.ts
@@ -1,12 +1,5 @@
import type { VbenFormSchema } from '#/adapter/form';
import type { VxeGridPropTypes } from '#/adapter/vxe-table';
-import type { MpAccountApi } from '#/api/mp/account';
-
-import { getSimpleAccountList } from '#/api/mp/account';
-
-/** 关联数据 */
-let accountList: MpAccountApi.AccountSimple[] = [];
-getSimpleAccountList().then((data) => (accountList = data));
/** 新增/修改的表单 */
export function useFormSchema(): VbenFormSchema[] {
@@ -41,21 +34,12 @@ export function useFormSchema(): VbenFormSchema[] {
}
/** 列表的搜索表单 */
-// TODO @YunaiV 这种方式获取刷新浏览器会导致空白
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/tag/index.vue b/apps/web-antd/src/views/mp/tag/index.vue
index a9a8b2c31..d39305cda 100644
--- a/apps/web-antd/src/views/mp/tag/index.vue
+++ b/apps/web-antd/src/views/mp/tag/index.vue
@@ -9,6 +9,7 @@ import { message } from 'ant-design-vue';
import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table';
import { deleteTag, getTagPage, syncTag } from '#/api/mp/tag';
import { $t } from '#/locales';
+import { WxAccountSelect } from '#/views/mp/components';
import { useGridColumns, useGridFormSchema } from './data';
import Form from './modules/form.vue';
@@ -23,6 +24,12 @@ function handleRefresh() {
gridApi.query();
}
+/** 公众号变化时查询数据 */
+function handleAccountChange(accountId: number) {
+ gridApi.formApi.setValues({ accountId });
+ gridApi.formApi.submitForm();
+}
+
/** 创建标签 */
async function handleCreate() {
const formValues = await gridApi.formApi.getValues();
@@ -101,6 +108,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
});
},
},
+ autoLoad: false,
},
rowConfig: {
keyField: 'id',
@@ -118,6 +126,9 @@ const [Grid, gridApi] = useVbenVxeGrid({
+
+
+
+
+
+
(accountList = data));
-
/** 列表的搜索表单 */
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',
},
{
fieldName: 'dateRange',
@@ -36,7 +21,7 @@ export function useGridFormSchema(): VbenFormSchema[] {
defaultValue: [
formatDateTime(beginOfDay(new Date(Date.now() - 3600 * 1000 * 24 * 7))),
formatDateTime(endOfDay(new Date(Date.now() - 3600 * 1000 * 24))),
- ] as [Date, Date],
+ ],
},
];
}
diff --git a/apps/web-ele/src/views/mp/statistics/index.vue b/apps/web-ele/src/views/mp/statistics/index.vue
index 5cbda917a..180ff6db5 100644
--- a/apps/web-ele/src/views/mp/statistics/index.vue
+++ b/apps/web-ele/src/views/mp/statistics/index.vue
@@ -1,7 +1,7 @@
-
+
+
+
+
+
diff --git a/apps/web-ele/src/views/mp/tag/data.ts b/apps/web-ele/src/views/mp/tag/data.ts
index e8efd6fba..ffce47fdd 100644
--- a/apps/web-ele/src/views/mp/tag/data.ts
+++ b/apps/web-ele/src/views/mp/tag/data.ts
@@ -1,12 +1,5 @@
import type { VbenFormSchema } from '#/adapter/form';
import type { VxeGridPropTypes } from '#/adapter/vxe-table';
-import type { MpAccountApi } from '#/api/mp/account';
-
-import { getSimpleAccountList } from '#/api/mp/account';
-
-/** 关联数据 */
-let accountList: MpAccountApi.AccountSimple[] = [];
-getSimpleAccountList().then((data) => (accountList = data));
/** 新增/修改的表单 */
export function useFormSchema(): VbenFormSchema[] {
@@ -46,15 +39,7 @@ export function useGridFormSchema(): VbenFormSchema[] {
{
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-ele/src/views/mp/tag/index.vue b/apps/web-ele/src/views/mp/tag/index.vue
index ad1490bb8..8ae00b516 100644
--- a/apps/web-ele/src/views/mp/tag/index.vue
+++ b/apps/web-ele/src/views/mp/tag/index.vue
@@ -9,6 +9,7 @@ import { ElLoading, ElMessage } from 'element-plus';
import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table';
import { deleteTag, getTagPage, syncTag } from '#/api/mp/tag';
import { $t } from '#/locales';
+import { WxAccountSelect } from '#/views/mp/components';
import { useGridColumns, useGridFormSchema } from './data';
import Form from './modules/form.vue';
@@ -23,6 +24,12 @@ function handleRefresh() {
gridApi.query();
}
+/** 公众号变化时查询数据 */
+function handleAccountChange(accountId: number) {
+ gridApi.formApi.setValues({ accountId });
+ gridApi.formApi.submitForm();
+}
+
/** 创建标签 */
async function handleCreate() {
const formValues = await gridApi.formApi.getValues();
@@ -99,6 +106,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
});
},
},
+ autoLoad: false,
},
rowConfig: {
keyField: 'id',
@@ -116,6 +124,9 @@ const [Grid, gridApi] = useVbenVxeGrid({
+
+
+
+
+
+