Files
aiot-platform-ui/apps/web-antd/src/views/mp/account/data.ts

144 lines
3.3 KiB
TypeScript
Raw Normal View History

2025-05-30 20:51:13 +08:00
import type { VbenFormSchema } from '#/adapter/form';
import type { VxeGridPropTypes } from '#/adapter/vxe-table';
/** 新增/修改的表单 */
export function useFormSchema(): VbenFormSchema[] {
return [
{
component: 'Input',
fieldName: 'id',
dependencies: {
triggerFields: [''],
show: () => false,
},
},
{
fieldName: 'name',
label: '名称',
component: 'Input',
rules: 'required',
componentProps: {
placeholder: '请输入名称',
},
},
{
fieldName: 'account',
label: '微信号',
component: 'Input',
help: '在微信公众平台mp.weixin.qq.com的菜单 [设置与开发 - 公众号设置 - 账号详情] 中能找到「微信号」',
rules: 'required',
componentProps: {
placeholder: '请输入微信号',
},
},
{
fieldName: 'appId',
label: 'appId',
component: 'Input',
help: '在微信公众平台mp.weixin.qq.com的菜单 [设置与开发 - 公众号设置 - 基本设置] 中能找到「开发者ID(AppID)」',
rules: 'required',
componentProps: {
placeholder: '请输入公众号 appId',
2025-05-30 20:51:13 +08:00
},
},
{
fieldName: 'appSecret',
label: 'appSecret',
component: 'Input',
help: '在微信公众平台mp.weixin.qq.com的菜单 [设置与开发 - 公众号设置 - 基本设置] 中能找到「开发者密码(AppSecret)」',
rules: 'required',
componentProps: {
placeholder: '请输入公众号 appSecret',
2025-05-30 20:51:13 +08:00
},
},
{
fieldName: 'token',
label: 'token',
component: 'Input',
rules: 'required',
componentProps: {
placeholder: '请输入公众号 token',
2025-05-30 20:51:13 +08:00
},
},
{
fieldName: 'aesKey',
label: '消息加解密密钥',
component: 'Input',
componentProps: {
placeholder: '请输入消息加解密密钥',
2025-05-30 20:51:13 +08:00
},
},
{
fieldName: 'remark',
label: '备注',
component: 'Textarea',
componentProps: {
placeholder: '请输入备注',
},
},
];
}
/** 搜索表单配置 */
export function useGridFormSchema(): VbenFormSchema[] {
return [
{
fieldName: 'name',
label: '名称',
component: 'Input',
2025-09-05 14:11:35 +08:00
componentProps: {
placeholder: '请输入名称',
allowClear: true,
2025-09-05 14:11:35 +08:00
},
2025-05-30 20:51:13 +08:00
},
];
}
/** 表格列配置 */
export function useGridColumns(): VxeGridPropTypes.Columns {
return [
{
title: '名称',
field: 'name',
minWidth: 150,
2025-05-30 20:51:13 +08:00
},
{
title: '微信号',
field: 'account',
minWidth: 180,
2025-05-30 20:51:13 +08:00
},
{
title: 'appId',
field: 'appId',
minWidth: 180,
2025-05-30 20:51:13 +08:00
},
{
title: '服务器地址(URL)',
field: 'utl',
minWidth: 360,
2025-05-30 20:51:13 +08:00
slots: {
default: ({ row }) => {
return `http://服务端地址/admin-api/mp/open/${row.appId}`;
},
},
},
{
title: '二维码',
field: 'qrCodeUrl',
minWidth: 120,
cellRender: { name: 'CellImage' },
2025-05-30 20:51:13 +08:00
},
{
title: '备注',
field: 'remark',
minWidth: 150,
2025-05-30 20:51:13 +08:00
},
{
title: '操作',
width: 200,
2025-05-30 20:51:13 +08:00
fixed: 'right',
slots: { default: 'actions' },
},
];
}