data.ts 1.54 KB
import { FormSchema as BFormSchema } from '../../../../components/Form';
import { useI18n } from '/@/hooks/web/useI18n';
const { t } = useI18n();
const statusOptions = [
  { label: t('common.enableText'), value: 'ENABLE' },
  { label: t('common.stop'), value: 'STOP' },
];
const typeOptions = [
  { label: t('common.maintenance'), value: '1' },
  { label: t('basicConfiguration.unit.typeMaintenance'), value: '2' },
  { label: t('basicConfiguration.unit.typeInspection'), value: '3' },
  { label: t('basicConfiguration.unit.typeCheck'), value: '4' },
];

export const formSchema: BFormSchema[] = [
  {
    field: 'code',
    label: t('basicConfiguration.unit.unitCode'),
    component: 'Input',
    colProps: { span: 24 },
    required: true,
    componentProps: {
      maxLength: 20,
    },
  },
  {
    field: 'name',
    label: t('basicConfiguration.unit.unitName'),
    component: 'Input',
    colProps: { span: 24 },
    required: true,
    componentProps: {
      maxLength: 20,
    },
  },
  {
    field: 'type',
    component: 'Select',
    label: t('basicConfiguration.unit.unitType'),
    required: true,
    colProps: { span: 24 },
    componentProps: {
      options: typeOptions,
    },
  },
  {
    field: 'status',
    component: 'Select',
    label: t('common.status'),
    required: true,
    colProps: { span: 24 },
    componentProps: {
      options: statusOptions,
    },
  },
  {
    field: 'notes',
    label: t('common.remarkText'),
    component: 'InputTextArea',
    colProps: { span: 24 },
    componentProps: {
      maxLength: 200,
    },
  },
];