import { h } from 'vue' import { Tag } from 'ant-design-vue' import type { BasicColumn, FormSchema } from '@/components/Table' export const columns: BasicColumn[] = [ { title: '租户 ID', dataIndex: 'tenantId', width: 150, }, { title: '租户名称', dataIndex: 'tenantName', width: 150, }, { title: '登录账号', dataIndex: 'adminAccount', width: 150, }, { title: '联系人名称', dataIndex: 'contactName', width: 150, }, { title: '联系人手机', dataIndex: 'contactMobile', width: 150, }, { title: '过期时间', dataIndex: 'expireTime', width: 150, customRender({ value }) { return h(Tag, { color: value ? 'default' : 'blue' }, () => value || '无限制') }, }, ] export const searchFormSchema: FormSchema[] = [ { label: '租户 ID', field: 'tenantId', component: 'Input', colProps: { span: 5 }, }, { label: '租户名称', field: 'tenantName', component: 'Input', colProps: { span: 5 }, }, { label: '联系人名称', field: 'contactName', component: 'Input', colProps: { span: 5 }, }, { label: '联系人手机', field: 'contactMobile', component: 'Input', colProps: { span: 5 }, }, ] export const formSchema: FormSchema[] = [ { field: 'id', show: false, component: 'Input', }, { label: '租户名', field: 'tenantName', required: true, component: 'Input', }, { label: '登录账号', field: 'adminAccount', required: true, component: 'Input', rules: [ { min: 6, max: 30, message: '登陆账号长度为6-30' }, ], // cannot edit show: ({ values }) => !values.id, }, { label: '联系人名称', field: 'contactName', required: true, component: 'Input', }, { label: '联系人手机', field: 'contactMobile', component: 'InputNumber', componentProps: { controls: false, precision: 0, }, }, ]