import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
//列表数据
export const columns: BasicColumn[] = [
  {
    title: '当前地址',
    align: "center",
    slots: { customRender: 'aurl' },
    dataIndex: 'url'
  },
  {
    title: '当前地址类型',
    align: "center",
    dataIndex: 'typeUrl'
  },
  {
    title: '当前地址状态',
    align: "center",
    dataIndex: 'stateUrl'
  },

  {
    title: '创建时间',
    align: "center",
    dataIndex: 'saveTime',
    customRender:({text}) =>{
      return !text?"":(text.length>10?text.substr(0,10):text);
    },
  },
  {
    title: '更新时间',
    align: "center",
    dataIndex: 'updateTime',
    customRender:({text}) =>{
      return !text?"":(text.length>10?text.substr(0,10):text);
    },
  },
];

//查询数据
export const searchFormSchema: FormSchema[] = [
  {
    label: "当前地址",
    field: 'url',
    component: 'Input',
    colProps: {span: 6},
  },
  {
    label: "当前地址类型",
    field: 'typeUrl',
    component: 'Input',
    colProps: {span: 6},
  },
  {
    label: "当前地址状态",
    field: 'stateUrl',
    component: 'Input',
    colProps: {span: 6},
  },
  {
    label: "父地址",
    field: 'source',
    component: 'Input',
    colProps: {span: 6},
  },
  {
    label: "父地址类型",
    field: 'typeSource',
    component: 'Input',
    colProps: {span: 6},
  },
  {
    label: "父地址状态",
    field: 'stateSource',
    component: 'Input',
    colProps: {span: 6},
  },
  {
    label: "信息",
    field: 'message',
    component: 'Input',
    colProps: {span: 6},
  },
  {
    label: "主站点链接",
    field: 'mainUrl',
    component: 'Input',
    colProps: {span: 6},
  },
  {
    label: "创建时间",
    field: "saveTime",
    component: 'RangePicker',
    colProps: {span: 6},
  },
  {
    label: "更新时间",
    field: "updateTime",
    component: 'RangePicker',
    colProps: {span: 6},
  },
];

//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '当前地址',
    field: 'url',
    component: 'InputTextArea',
    dynamicRules: () => {
      return [
              { required: true, message: '请输入当前地址!'},
             ];
    },
  },
  {
    label: '当前地址类型',
    field: 'typeUrl',
    component: 'Input',
    dynamicRules: () => {
      return [
              { required: true, message: '请输入当前地址类型!'},
             ];
    },
  },
  {
    label: '当前地址状态',
    field: 'stateUrl',
    component: 'Input',
    dynamicRules: () => {
      return [
              { required: true, message: '请输入当前地址状态!'},
             ];
    },
  },
  {
    label: '父地址',
    field: 'source',
    component: 'InputTextArea',
    dynamicRules: () => {
      return [
              { required: true, message: '请输入父地址!'},
             ];
    },
  },
  {
    label: '父地址类型',
    field: 'typeSource',
    component: 'Input',
    dynamicRules: () => {
      return [
              { required: true, message: '请输入父地址类型!'},
             ];
    },
  },
  {
    label: '父地址状态',
    field: 'stateSource',
    component: 'Input',
    dynamicRules: () => {
      return [
              { required: true, message: '请输入父地址状态!'},
             ];
    },
  },
  {
    label: '信息',
    field: 'message',
    component: 'InputTextArea',
    dynamicRules: () => {
      return [
              { required: true, message: '请输入信息!'},
             ];
    },
  },
  {
    label: '主站点链接',
    field: 'mainUrl',
    component: 'InputTextArea',
    dynamicRules: () => {
      return [
              { required: true, message: '请输入主站点链接!'},
             ];
    },
  },
  {
    label: '创建时间',
    field: 'saveTime',
    component: 'DatePicker',
    dynamicRules: () => {
      return [
              { required: true, message: '请输入创建时间!'},
             ];
    },
  },
  {
    label: '更新时间',
    field: 'updateTime',
    component: 'DatePicker',
    dynamicRules: () => {
      return [
              { required: true, message: '请输入更新时间!'},
             ];
    },
  },
	// TODO 主键隐藏字段，目前写死为ID
  {
    label: '',
    field: 'id',
    component: 'Input',
    show: false,
  },
];
