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: 'name'
  },
  {
    title: '国家或地区',
    align: "center",
    dataIndex: 'country'
  },
  {
    title: '职务全称',
    align: "center",
    dataIndex: 'fullTitle'
  },
  {
    title: '职务简称',
    align: "center",
    dataIndex: 'fullTitleAbbreviation'
  },
  {
    title: '顺序',
    align: "center",
    sorter: true,
    dataIndex: 'sort'
  },
];

//查询数据
export const searchFormSchema: FormSchema[] = [
  {
    label: "创建日期",
    field: "createTime",
    component: 'RangePicker',
    componentProps: {
      showTime: true,
    },
    colProps: {span: 6},
  },
  {
    label: "更新日期",
    field: "updateTime",
    component: 'RangePicker',
    componentProps: {
      showTime: true,
    },
    colProps: {span: 6},
  },
  {
    label: "人名",
    field: 'name',
    component: 'Input',
    colProps: {span: 6},
  },
  {
    label: "国家或地区",
    field: 'country',
    component: 'Input',
    colProps: {span: 6},
  },
  {
    label: "职务全称",
    field: 'fullTitle',
    component: 'Input',
    colProps: {span: 6},
  },
  {
    label: "职务简称",
    field: 'fullTitleAbbreviation',
    component: 'Input',
    colProps: {span: 6},
  },
];

//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '人名',
    field: 'name',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入人名!'},
             ];
    },
  },
  {
    label: '国家或地区',
    field: 'country',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入国家或地区!'},
             ];
    },
  },
  {
    label: '职务全称',
    field: 'fullTitle',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入职务全称!'},
             ];
    },
  },
  {
    label: '职务简称',
    field: 'fullTitleAbbreviation',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入职务简称!'},
             ];
    },
  },
  {
    label: '顺序',
    field: 'sort',
    component: 'InputNumber',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入顺序!'},
             ];
    },
  },
	// TODO 主键隐藏字段，目前写死为ID
  {
    label: '',
    field: 'id',
    component: 'Input',
    show: false,
  },
];
