config.ts 1.85 KB
import { FormSchema } from '/@/components/Form';

export enum FormFieldsEnum {
  NAME = 'name',
  LABEL = 'label',
  ROUTINGKEY = 'routingKey',
  SECRET = 'secret',
  TYPE = 'type',
  DESCRIPTION = 'description',
  TEXTSEARCH = 'textSearch',
}

enum FormFieldsNameEnum {
  NAME = '名称',
  LABEL = '标签',
  ROUTINGKEY = '边缘Key',
  SECRET = '边缘密钥',
  TYPE = '边缘类型',
  DESCRIPTION = '描述',
  TEXTSEARCH = '实例名称',
}

export const formSchema: FormSchema[] = [
  {
    field: FormFieldsEnum.NAME,
    label: FormFieldsNameEnum.NAME,
    component: 'Input',
    required: true,
    componentProps: {
      maxLength: 255,
      placeholder: '请输入实例名称',
    },
  },
  {
    field: FormFieldsEnum.TYPE,
    label: FormFieldsNameEnum.TYPE,
    component: 'Input',
    required: true,
    defaultValue: 'default',
    componentProps: {
      disabled: true,
    },
  },
  {
    field: FormFieldsEnum.ROUTINGKEY,
    label: FormFieldsNameEnum.ROUTINGKEY,
    slot: 'routingKey',
    required: true,
    component: 'Input',
  },
  {
    field: FormFieldsEnum.SECRET,
    label: FormFieldsNameEnum.SECRET,
    slot: 'secret',
    required: true,
    component: 'Input',
  },
  {
    field: FormFieldsEnum.LABEL,
    label: FormFieldsNameEnum.LABEL,
    component: 'Input',
    componentProps: {
      maxLength: 255,
      placeholder: '请输入标签',
    },
  },
  {
    field: FormFieldsEnum.DESCRIPTION,
    label: FormFieldsNameEnum.DESCRIPTION,
    component: 'Input',
    componentProps: {
      maxLength: 255,
      placeholder: '请输入描述',
    },
  },
];

export const searchFormSchema: FormSchema[] = [
  {
    field: FormFieldsEnum.TEXTSEARCH,
    label: FormFieldsNameEnum.TEXTSEARCH,
    component: 'Input',
    colProps: { span: 6 },
    componentProps: {
      maxLength: 255,
      placeholder: '请输入实例名称',
    },
  },
];