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: 'linkPageId'
  },
  {
    title: '资源链接',
    align: "center",
    dataIndex: 'source'
  },
  {
    title: '资源标题',
    align: "center",
    dataIndex: 'title'
  },
  {
    title: '父地址类型',
    align: "center",
    dataIndex: 'typeSource'
  },
  {
    title: '父地址状态',
    align: "center",
    dataIndex: 'stateSource'
  },
  {
    title: '主站点链接',
    align: "center",
    dataIndex: 'mainUrl'
  },
  {
    title: '错敏词列表',
    align: "center",
    dataIndex: 'sensitiveList'
  },
  {
    title: '校对敏感词个数',
    align: "center",
    dataIndex: 'sensitiveCount'
  },
  {
    title: '成功标记',
    align: "center",
    dataIndex: 'retCode'
  },
  {
    title: '校对错误个数',
    align: "center",
    dataIndex: 'errorCount'
  },
  {
    title: '校对重点关注词个数',
    align: "center",
    dataIndex: 'heavyCount'
  },
  {
    title: '修改状态',
    align: "center",
    dataIndex: 'modifyState_dictText'
  },
  {
    title: '文章发布时间',
    align: "center",
    dataIndex: 'articleReleaseTime',
    customRender:({text}) =>{
      return !text?"":(text.length>10?text.substr(0,10):text);
    },
  },
  {
    title: '扫描次数',
    align: "center",
    dataIndex: 'numberScans'
  },
  {
    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: 'checkErrorCount'
  },
];

//查询数据
export const searchFormSchema: FormSchema[] = [
  {
    label: "创建日期",
    field: "createTime",
    component: 'RangePicker',
    colProps: {span: 6},
  },
  {
    label: "更新日期",
    field: "updateTime",
    component: 'RangePicker',
    colProps: {span: 6},
  },
  {
    label: "页面抓取id
",
    field: 'linkPageId',
    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: 'mainUrl',
    component: 'Input',
    colProps: {span: 6},
  },
  {
    label: "错敏词列表",
    field: 'sensitiveList',
    component: 'Input',
    colProps: {span: 6},
  },
  {
    label: "校对敏感词个数",
    field: 'sensitiveCount',
    component: 'Input',
    colProps: {span: 6},
  },
  {
    label: "成功标记",
    field: 'retCode',
    component: 'Input',
    colProps: {span: 6},
  },
  {
    label: "校对错误个数",
    field: 'errorCount',
    component: 'Input',
    colProps: {span: 6},
  },
  {
    label: "校对重点关注词个数",
    field: 'heavyCount',
    component: 'Input',
    colProps: {span: 6},
  },
  {
    label: "修改状态",
    field: 'modifyState',
    component: 'JDictSelectTag',
    componentProps:{
      dictCode: "modify_state"
    },
    colProps: {span: 6},
  },
  {
    label: "文章发布时间",
    field: "articleReleaseTime",
    component: 'RangePicker',
    colProps: {span: 6},
  },
  {
    label: "扫描次数",
    field: 'numberScans',
    component: 'Input',
    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: "verify_status"
    },
    colProps: {span: 6},
  },
  {
    label: "复核校对错误个数",
    field: 'checkErrorCount',
    component: 'Input',
    colProps: {span: 6},
  },
];

//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '页面抓取id
',
    field: 'linkPageId',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入页面抓取id
!'},
             ];
    },
  },
  {
    label: '资源链接',
    field: 'source',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入资源链接!'},
             ];
    },
  },
  {
    label: '资源标题',
    field: 'title',
    component: 'Input',
  },
  {
    label: '父地址类型',
    field: 'typeSource',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入父地址类型!'},
             ];
    },
  },
  {
    label: '父地址状态',
    field: 'stateSource',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入父地址状态!'},
             ];
    },
  },
  {
    label: '主站点链接',
    field: 'mainUrl',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入主站点链接!'},
             ];
    },
  },
  {
    label: '错敏词列表',
    field: 'sensitiveList',
    component: 'InputTextArea',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入错敏词列表!'},
             ];
    },
  },
  {
    label: '校对敏感词个数',
    field: 'sensitiveCount',
    component: 'InputNumber',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入校对敏感词个数!'},
             ];
    },
  },
  {
    label: '成功标记',
    field: 'retCode',
    component: 'InputNumber',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入成功标记!'},
             ];
    },
  },
  {
    label: '校对错误个数',
    field: 'errorCount',
    component: 'InputNumber',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入校对错误个数!'},
             ];
    },
  },
  {
    label: '校对重点关注词个数',
    field: 'heavyCount',
    component: 'InputNumber',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入校对重点关注词个数!'},
             ];
    },
  },
  {
    label: '修改状态',
    field: 'modifyState',
    component: 'JDictSelectTag',
    componentProps:{
      dictCode: "modify_state"
    },
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入修改状态!'},
             ];
    },
  },
  {
    label: '文章发布时间',
    field: 'articleReleaseTime',
    component: 'DatePicker',
  },
  {
    label: '扫描次数',
    field: 'numberScans',
    component: 'InputNumber',
  },
  {
    label: '是否忽略',
    field: 'isIgnore',
    component: 'JDictSelectTag',
    componentProps:{
      dictCode: "verify_status"
    },
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入是否忽略!'},
             ];
    },
  },
  {
    label: '复核时间',
    field: 'checkTime',
    component: 'DatePicker',
  },
  {
    label: '复核状态',
    field: 'checkState',
    component: 'JDictSelectTag',
    componentProps:{
      dictCode: "verify_status"
    },
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入复核状态!'},
             ];
    },
  },
  {
    label: '复核校对错误个数',
    field: 'checkErrorCount',
    component: 'InputNumber',
  },
	// TODO 主键隐藏字段，目前写死为ID
  {
    label: '',
    field: 'id',
    component: 'Input',
    show: false,
  },
];
