import { isEmpty } from 'src/common/utils';

export const defaultColDef = {
  flex: 1,
  minWidth: 100,
  suppressMenu: true, // 是否禁用标题行菜单
};

export const testData = [
  { name: '张三', age: 22 },
  { name: '孙火旺', age: 18 },
];

export const form_config = [
  {
    fild: 'username',
    label: '用户名',
    col: 'col-4',
    type: 'text',
    required: true,
    bind: {
      filled: true,
      lazyRules: true,
      rules: [(val: any) => !isEmpty(val) || '必填'],
    },
  },
  {
    fild: 'account',
    label: '账号',
    col: 'col-4',
    type: 'text',
    required: true,
    bind: {
      filled: true,
      lazyRules: true,
      rules: [(val: any) => !isEmpty(val) || '必填'],
    },
  },
  {
    fild: 'age',
    label: '年龄',
    col: 'col-4',
    type: 'number',
    required: true,
    bind: {
      filled: true,
      lazyRules: true,
      rules: [
        (val: any) => !isEmpty(val) || '必填',
        (val: any) => (val > 0 && val < 100) || '请输入真实年龄',
      ],
    },
  },
  {
    solt: 'sex',
    col: 'col-4',
  },
  {
    fild: 'dateRange',
    label: '开始日期~结束日期',
    col: 'col-4',
    type: 'dateRange',
    required: true,
    bind: {
      filled: true,
      clearable: true,
      dateMask: 'YYYY-MM-DD',
      rules: [(val: any) => !isEmpty(val) || '必填'],
    },
  },
  {
    solt: 'days',
    col: 'col-4',
  },
  {
    solt: 'social',
    col: 'col-12',
  },
  {
    fild: 'remark',
    label: '备注',
    col: 'col-12',
    type: 'textarea',
    bind: {
      filled: true,
    },
  },
];
