/*
 * @Author: renxin renxin0828@163.com
 * @Date: 2023-06-15 20:53:53
 * @LastEditors: renxin renxin0828@163.com
 * @LastEditTime: 2023-06-16 14:41:18
 * @FilePath: \yx-admin\src\views\visual\board\config\panelDetail.ts
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import { getOrganizationList } from '/@/api/system/system';
import { FormSchema } from '/@/components/Form';
import { copyTransFun } from '/@/utils/fnUtils';
export enum ViewType {
  PRIVATE_VIEW = 'PRIVATE_VIEW',
  PUBLIC_VIEW = 'PUBLIC_VIEW',
}

export const formSchema: FormSchema[] = [
  {
    field: 'name',
    label: '名称',
    component: 'Input',
    rules: [{ required: true, message: '请输入看板名称' }],
    componentProps: {
      placeholder: '请输入看板名称',
      maxLength: 32,
    },
  },
  {
    field: 'organizationId',
    component: 'ApiTreeSelect',
    label: '组织',
    rules: [{ required: true, message: '组织为必填项' }],
    componentProps() {
      return {
        placeholder: '请选择组织',
        api: async () => {
          const data = await getOrganizationList();
          copyTransFun(data as any as any[]);
          return data;
        },
        getPopupContainer: () => document.body,
      };
    },
  },
  {
    field: 'viewType',
    label: '公开性',
    component: 'RadioGroup',
    defaultValue: ViewType.PRIVATE_VIEW,
    helpMessage: [
      '私有视图只有项目成员可以浏览。公开视图拥有一个公开的 URL,任何人无需登录即可浏览。    ',
    ],
    componentProps: {
      placeholder: '请选择公开性',
      options: [
        { label: '私有看板', value: ViewType.PRIVATE_VIEW },
        { label: '公开看板', value: ViewType.PUBLIC_VIEW, disabled: true },
      ],
    },
  },
  {
    field: 'remark',
    label: '备注',
    component: 'InputTextArea',
    componentProps: {
            rows: 4,
      allowClear:false,
      placeholder: '请输入看板备注',
      maxLength: 255,
    },
  },
];
