create.config.ts
1.11 KB
import { ScopeEnum, ScopeNameEnum } from '../../../enum/form';
import {
SaveAttributesFieldsEnum,
SaveAttributesFieldsNameEnum,
} from '../../../enum/formField/action';
import { FormSchema } from '/@/components/Form';
import { useI18n } from '/@/hooks/web/useI18n';
const { t } = useI18n();
export const formSchemas: FormSchema[] = [
{
field: SaveAttributesFieldsEnum.SCOPE,
component: 'Select',
label: t(SaveAttributesFieldsNameEnum.SCOPE),
required: true,
componentProps: {
options: Object.keys(ScopeEnum).map((value) => ({ label: ScopeNameEnum[value], value })),
getPopupContainer: () => document.body,
placeholder: `请选择${t(SaveAttributesFieldsNameEnum.SCOPE)}`,
},
},
{
field: SaveAttributesFieldsEnum.NOTIFY_DEVICE,
component: 'Checkbox',
label: t(SaveAttributesFieldsNameEnum.NOTIFY_DEVICE),
ifShow: ({ model }) => model[SaveAttributesFieldsEnum.SCOPE] === ScopeEnum.SHARED_SCOPE,
renderComponentContent: () => ({
default: () =>
'If the message arrives from the device, we will push it back to the device by default.',
}),
},
];