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: '外链表主键id',
    align: "center",
    dataIndex: 'outerChainDetectionId'
  },
  {
    title: '主站点id',
    align: "center",
    dataIndex: 'mainSiteId'
  },
  {
    title: '主站点名称',
    align: "center",
    dataIndex: 'mainSiteName'
  },
  {
    title: '主站点URL',
    align: "center",
    dataIndex: 'mainSiteUrl'
  },
  {
    title: '外链地址',
    align: "center",
    dataIndex: 'outerUrl'
  },
  {
    title: '外链地址类型',
    align: "center",
    dataIndex: 'outerUrlType'
  },
  {
    title: '外链地址状态',
    align: "center",
    dataIndex: 'outerUrlState'
  },
  {
    title: '引用页面数',
    align: "center",
    dataIndex: 'numberApplicationPages'
  },
  {
    title: '扫描次数',
    align: "center",
    dataIndex: 'numberScans'
  },
  {
    title: '是否修改',
    align: "center",
    dataIndex: 'isRevise_dictText'
  },
  {
    title: '是否忽略',
    align: "center",
    dataIndex: 'isIgnore_dictText'
  },
  {
    title: '复核时间',
    align: "center",
    dataIndex: 'checkTime',
    customRender:({text}) =>{
      return !text?"":(text.length>10?text.substr(0,10):text);
    },
  },
  {
    title: '复核状态',
    align: "center",
    dataIndex: 'checkState_dictText'
  },
  {
    title: '复核引用页面数',
    align: "center",
    dataIndex: 'checkNumberApplicationPagesv'
  },
  {
    title: '复核信息',
    align: "center",
    dataIndex: 'checkMessage'
  },
];

//查询数据
export const searchFormSchema: FormSchema[] = [
  {
    label: "创建日期",
    field: "createTime",
    component: 'RangePicker',
    colProps: {span: 6},
  },
  {
    label: "更新日期",
    field: "updateTime",
    component: 'RangePicker',
    colProps: {span: 6},
  },
  {
    label: "主站点id",
    field: 'mainSiteId',
    component: 'Input',
    colProps: {span: 6},
  },
  {
    label: "主站点名称",
    field: 'mainSiteName',
    component: 'Input',
    colProps: {span: 6},
  },
  {
    label: "主站点URL",
    field: 'mainSiteUrl',
    component: 'Input',
    colProps: {span: 6},
  },
  {
    label: "外链地址",
    field: 'outerUrl',
    component: 'Input',
    colProps: {span: 6},
  },
  {
    label: "外链地址类型",
    field: 'outerUrlType',
    component: 'Input',
    colProps: {span: 6},
  },
  {
    label: "外链地址状态",
    field: 'outerUrlState',
    component: 'Input',
    colProps: {span: 6},
  },
  {
    label: "引用页面数",
    field: 'numberApplicationPages',
    component: 'Input',
    colProps: {span: 6},
  },
  {
    label: "扫描次数",
    field: 'numberScans',
    component: 'Input',
    colProps: {span: 6},
  },
  {
    label: "是否修改",
    field: 'isRevise',
    component: 'JDictSelectTag',
    componentProps:{
      dictCode: "verify_status"
    },
    colProps: {span: 6},
  },
  {
    label: "是否忽略",
    field: 'isIgnore',
    component: 'JDictSelectTag',
    componentProps:{
      dictCode: "verify_status"
    },
    colProps: {span: 6},
  },
  {
    label: "复核时间",
    field: "checkTime",
    component: 'RangePicker',
    colProps: {span: 6},
  },
  {
    label: "复核状态",
    field: 'checkState',
    component: 'JDictSelectTag',
    componentProps:{
      dictCode: "review_status"
    },
    colProps: {span: 6},
  },
  {
    label: "复核引用页面数",
    field: 'checkNumberApplicationPagesv',
    component: 'Input',
    colProps: {span: 6},
  },
  {
    label: "复核信息",
    field: 'checkMessage',
    component: 'Input',
    colProps: {span: 6},
  },
];

//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '外链表主键id',
    field: 'outerChainDetectionId',
    component: 'Input',
  },
  {
    label: '主站点id',
    field: 'mainSiteId',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入主站点id!'},
             ];
    },
  },
  {
    label: '主站点名称',
    field: 'mainSiteName',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入主站点名称!'},
             ];
    },
  },
  {
    label: '主站点URL',
    field: 'mainSiteUrl',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入主站点URL!'},
             ];
    },
  },
  {
    label: '外链地址',
    field: 'outerUrl',
    component: 'InputTextArea',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入外链地址!'},
             ];
    },
  },
  {
    label: '外链地址类型',
    field: 'outerUrlType',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入外链地址类型!'},
             ];
    },
  },
  {
    label: '外链地址状态',
    field: 'outerUrlState',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入外链地址状态!'},
             ];
    },
  },
  {
    label: '引用页面数',
    field: 'numberApplicationPages',
    component: 'InputNumber',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入引用页面数!'},
             ];
    },
  },
  {
    label: '扫描次数',
    field: 'numberScans',
    component: 'InputNumber',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入扫描次数!'},
             ];
    },
  },
  {
    label: '是否修改',
    field: 'isRevise',
    component: 'JDictSelectTag',
    componentProps:{
      dictCode: "verify_status"
    },
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入是否修改!'},
             ];
    },
  },
  {
    label: '是否忽略',
    field: 'isIgnore',
    component: 'JDictSelectTag',
    componentProps:{
      dictCode: "verify_status"
    },
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入是否忽略!'},
             ];
    },
  },
  {
    label: '复核时间',
    field: 'checkTime',
    component: 'DatePicker',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入复核时间!'},
             ];
    },
  },
  {
    label: '复核状态',
    field: 'checkState',
    component: 'JDictSelectTag',
    componentProps:{
      dictCode: "review_status"
    },
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入复核状态!'},
             ];
    },
  },
  {
    label: '复核引用页面数',
    field: 'checkNumberApplicationPagesv',
    component: 'InputNumber',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入复核引用页面数!'},
             ];
    },
  },
  {
    label: '复核信息',
    field: 'checkMessage',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入复核信息!'},
             ];
    },
  },
	// TODO 主键隐藏字段，目前写死为ID
  {
    label: '',
    field: 'id',
    component: 'Input',
    show: false,
  },
];
