import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { rules} from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
//列表数据
export const columns: BasicColumn[] = [
  {
    title: '错误词',
    align: "center",
    dataIndex: 'errorWords'
  },
  {
    title: '正确词',
    align: "center",
    dataIndex: 'rightWords'
  },
  {
    title: '错误类型',
    align: "center",
    dataIndex: 'errorType'
  },
];

//查询数据
export const searchFormSchema: FormSchema[] = [
  {
    label: "错误词",
    field: 'errorWords',
    component: 'Input',
    colProps: {span: 6},
  },
  {
    label: "正确词",
    field: 'rightWords',
    component: 'Input',
    colProps: {span: 6},
  },
  {
    label: "错误类型",
    field: 'errorType',
    component: 'Input',
    colProps: {span: 6},
  },
];

//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '错误词',
    field: 'errorWords',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入错误词!'},
             ];
    },
  },
  {
    label: '正确词',
    field: 'rightWords',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入正确词!'},
             ];
    },
  },
  {
    label: '错误类型',
    field: 'errorType',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入错误类型!'},
             ];
    },
  },
	// TODO 主键隐藏字段，目前写死为ID
  {
    label: '',
    field: 'id',
    component: 'Input',
    show: false,
  },
];
