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: 'errorDetectionId'
  },
  {
    title: '主站点id',
    align: "center",
    dataIndex: 'mainSiteId'
  },
  {
    title: '主站点名称',
    align: "center",
    dataIndex: 'mainSiteName'
  },
  {
    title: '主站点URL',
    align: "center",
    dataIndex: 'mainSiteUrl'
  },
  {
    title: '错链地址',
    align: "center",
    dataIndex: 'errorUrl'
  },
  {
    title: '错链地址类型',
    align: "center",
    dataIndex: 'errorUrlType'
  },
  {
    title: '错链地址状态',
    align: "center",
    dataIndex: 'errorUrlState'
  },
  {
    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: 'checkMessage'
  },
  {
    title: '复核引用页面数',
    align: "center",
    dataIndex: 'checkNumberApplicationPages'
  },
];

//查询数据
export const searchFormSchema: FormSchema[] = [
  {
    label: "外链表主键id
",
    field: 'errorDetectionId',
    component: 'Input',
    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: 'errorUrl',
    component: 'Input',
    colProps: {span: 6},
  },
  {
    label: "错链地址类型",
    field: 'errorUrlType',
    component: 'Input',
    colProps: {span: 6},
  },
  {
    label: "错链地址状态",
    field: 'errorUrlState',
    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: 'DatePicker',
    colProps: {span: 6},
  },
  {
    label: "复核状态",
    field: 'checkState',
    component: 'JDictSelectTag',
    componentProps:{
      dictCode: "review_status"
    },
    colProps: {span: 6},
  },
  {
    label: "复核信息",
    field: 'checkMessage',
    component: 'Input',
    colProps: {span: 6},
  },
];

//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '外链表主键id
',
    field: 'errorDetectionId',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入外链表主键id
!'},
             ];
    },
  },
  {
    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: 'errorUrl',
    component: 'InputTextArea',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入错链地址!'},
             ];
    },
  },
  {
    label: '错链地址类型',
    field: 'errorUrlType',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入错链地址类型!'},
             ];
    },
  },
  {
    label: '错链地址状态',
    field: 'errorUrlState',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入错链地址状态!'},
             ];
    },
  },
  {
    label: '引用页面数',
    field: 'numberApplicationPages',
    component: 'InputNumber',
  },
  {
    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: 'checkMessage',
    component: 'InputTextArea',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入复核信息!'},
             ];
    },
  },
  {
    label: '复核引用页面数',
    field: 'checkNumberApplicationPages',
    component: 'InputNumber',
  },
	// TODO 主键隐藏字段，目前写死为ID
  {
    label: '',
    field: 'id',
    component: 'Input',
    show: false,
  },
];
