panelDetail.ts 1.65 KB
import { FormSchema, useComponentRegister } from '/@/components/Form';
import { OrgTreeSelect } from '/@/views/common/OrgTreeSelect';
export enum ViewType {
  PRIVATE_VIEW = 'PRIVATE_VIEW',
  PUBLIC_VIEW = 'PUBLIC_VIEW',
}
import { Platform } from '../../palette/components/PagerHeader/config';
import { useI18n } from '/@/hooks/web/useI18n';

useComponentRegister('OrgTreeSelect', OrgTreeSelect);
export enum PlatformType {
  PHONE = 'phone',
  PC = 'pc',
}

const { t } = useI18n();

export const formSchema: FormSchema[] = [
  {
    field: 'name',
    label: t('visual.board.createName'),
    component: 'Input',
    rules: [{ required: true }],
    componentProps: {
      maxLength: 32,
    },
  },
  {
    field: 'organizationId',
    component: 'OrgTreeSelect',
    label: t('business.organizationText'),
    rules: [{ required: true }],
  },
  {
    field: 'platform',
    label: t('common.platformText'),
    required: true,
    component: 'RadioGroup',
    defaultValue: PlatformType.PC,
    componentProps({ formModel }) {
      return {
        defaultValue: PlatformType.PC,
        options: [
          { label: t('common.pcText'), value: PlatformType.PC },
          { label: t('common.phoneText'), value: PlatformType.PHONE },
        ],
        onChange(e) {
          formModel.phoneModel =
            e?.target?.value === PlatformType.PHONE ? JSON.stringify(Platform[1]) : [];
        },
      };
    },
  },
  {
    field: 'phoneModel',
    label: '手机端尺寸',
    component: 'Input',
    ifShow: false,
  },
  {
    field: 'remark',
    label: t('common.remarkText'),
    component: 'InputTextArea',
    componentProps: {
      maxLength: 255,
    },
  },
];