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: 'code'
  },
  {
    title: '简编码',
    align: "center",
    dataIndex: 'codePram'
  },
  {
    title: '交易平台编码',
    align: "center",
    dataIndex: 'platformCode'
  },
  {
    title: '排序',
    align: "center",
    sorter: true,
    dataIndex: 'orderNum'
  },
];

//查询数据
export const searchFormSchema: FormSchema[] = [
  {
    label: "地区名称",
    field: 'name',
    component: 'Input',
    //colProps: {span: 6},
  },
  {
    label: "全编码",
    field: 'code',
    component: 'Input',
    //colProps: {span: 6},
  },
  {
    label: "简编码",
    field: 'codePram',
    component: 'Input',
    //colProps: {span: 6},
  },
  {
    label: "交易平台编码",
    field: 'platformCode',
    component: 'Input',
    //colProps: {span: 6},
  },
  {
    label: "排序",
    field: 'orderNum',
    component: 'Input',
    //colProps: {span: 6},
  },
];

//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '地区名称',
    field: 'name',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入地区名称!'},
             ];
    },
  },
  {
    label: '全编码',
    field: 'code',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入全编码!'},
             ];
    },
  },
  {
    label: '简编码',
    field: 'codePram',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入简编码!'},
             ];
    },
  },
  {
    label: '交易平台编码',
    field: 'platformCode',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入交易平台编码!'},
             ];
    },
  },
  {
    label: '排序',
    field: 'orderNum',
    component: 'InputNumber',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入排序!'},
             ];
    },
  },
	// TODO 主键隐藏字段，目前写死为ID
  {
    label: '',
    field: 'id',
    component: 'Input',
    show: false,
  },
];

// 高级查询数据
export const superQuerySchema = {
  name: {title: '地区名称',order: 0,view: 'text', type: 'string',},
  code: {title: '全编码',order: 1,view: 'text', type: 'string',},
  codePram: {title: '简编码',order: 2,view: 'text', type: 'string',},
  platformCode: {title: '交易平台编码',order: 3,view: 'text', type: 'string',},
  orderNum: {title: '排序',order: 4,view: 'number', type: 'number',},
};
