import type { FormSchemaGetter } from '#/adapter/form'; import type { VxeGridProps } from '#/adapter/vxe-table'; import { z } from '#/adapter/form'; export const querySchema: FormSchemaGetter = () => [ { component: 'Input', fieldName: 'applicationCode', label: '平台代码', }, { component: 'Input', fieldName: 'applicationName', label: '平台名称', }, { component: 'Input', fieldName: 'applicationAdmin', label: '平台账号', }, { component: 'Input', fieldName: 'contactPhone', label: '手机号', }, ]; // 需要使用i18n注意这里要改成getter形式 否则切换语言不会刷新 // export const columns: () => VxeGridProps['columns'] = () => [ export const columns: VxeGridProps['columns'] = [ { type: 'checkbox', width: 60 }, // { // title: '编号', // field: 'id', // }, { title: '平台代码', field: 'applicationCode', }, { title: '平台名称', field: 'applicationName', }, { title: '联系人', field: 'contactUser', }, { title: '手机号', field: 'contactPhone', }, { title: '平台账号', field: 'applicationAdmin', }, { title: '备注', field: 'remark', }, { field: 'action', fixed: 'right', slots: { default: 'action' }, title: '操作', width: 240, }, ]; export const drawerSchema: FormSchemaGetter = () => [ { label: '编号', fieldName: 'id', component: 'Input', dependencies: { show: () => false, triggerFields: [''], }, }, { component: 'Divider', componentProps: { orientation: 'center', }, fieldName: 'divider1', hideLabel: true, renderComponentContent: () => ({ default: () => '平台信息', }), }, { label: '平台代码', fieldName: 'applicationCode', component: 'Input', rules: z .string() .regex(/^[a-z]\w*$/i, '平台代码需字母开头,且仅包含字母、数字、下划线'), }, { label: '平台名称', fieldName: 'applicationName', component: 'Input', rules: 'required', }, { label: '平台账号', fieldName: 'applicationAdmin', component: 'Input', rules: 'required', }, { label: '平台密码', fieldName: 'applicationPassword', component: 'InputPassword', rules: 'required', }, { component: 'Divider', componentProps: { orientation: 'center', }, fieldName: 'divider2', hideLabel: true, renderComponentContent: () => ({ default: () => '平台联系人', }), }, { label: '联系人', fieldName: 'contactUser', component: 'Input', rules: 'required', }, { label: '手机号', fieldName: 'contactPhone', component: 'Input', rules: z.string().regex(/^1[3-9]\d{9}$/, '请输入正确的手机号码'), }, { label: '备注', fieldName: 'remark', component: 'Textarea', }, ];