panelDetail.ts 1.63 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';

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

export const formSchema: FormSchema[] = [
  {
    field: 'name',
    label: '名称',
    component: 'Input',
    rules: [{ required: true, message: '请输入看板名称' }],
    componentProps: {
      placeholder: '请输入看板名称',
      maxLength: 32,
    },
  },
  {
    field: 'organizationId',
    component: 'OrgTreeSelect',
    label: '组织',
    rules: [{ required: true, message: '组织为必填项' }],
  },
  {
    field: 'platform',
    label: '平台',
    required: true,
    component: 'RadioGroup',
    defaultValue: PlatformType.PC,
    componentProps({ formModel }) {
      return {
        defaultValue: PlatformType.PC,
        options: [
          { label: 'PC端', value: PlatformType.PC },
          { label: '移动端', 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: '备注',
    component: 'InputTextArea',
    componentProps: {
      placeholder: '请输入看板备注',
      maxLength: 255,
    },
  },
];