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: 'mainSiteId'
  },
  {
    title: '主站点名称',
    align: "center",
    dataIndex: 'mainSiteName'
  },
  {
    title: '主站点URL',
    align: "center",
    dataIndex: 'mainSiteUrl'
  },
  {
    title: '标注后网页内容',
    align: "center",
    dataIndex: 'retMsg'
  },
  {
    title: '错误个数',
    align: "center",
    dataIndex: 'errorCount'
  },
  {
    title: '标注信息',
    align: "center",
    dataIndex: 'htmlList'
  },
  {
    title: '标签原文本内容',
    align: "center",
    dataIndex: 'strList'
  },
  {
    title: '定位标注信息',
    align: "center",
    dataIndex: 'ahtmlList'
  },
  {
    title: '扫描次数',
    align: "center",
    dataIndex: 'numberScans'
  },
  {
    title: '是否修改',
    align: "center",
    dataIndex: 'isRevise_dictText'
  },
  {
    title: '是否忽略',
    align: "center",
    dataIndex: 'isIgnore_dictText'
  },
  {
    title: '复核时间',
    align: "center",
    dataIndex: 'checkTime'
  },
  {
    title: '复核状态',
    align: "center",
    dataIndex: 'checkState_dictText'
  },
  {
    title: '复核校对个数',
    align: "center",
    dataIndex: 'checkErrorCount'
  },
  {
    title: '复核信息',
    align: "center",
    dataIndex: 'checkMessage'
  },
  {
    title: '是否是失效',
    align: "center",
    dataIndex: 'isInvalid_dictText'
  },
];

//查询数据
export const searchFormSchema: FormSchema[] = [
  {
    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: 'retMsg',
    component: 'Input',
    colProps: {span: 6},
  },
  {
    label: "错误个数",
    field: 'errorCount',
    component: 'Input',
    colProps: {span: 6},
  },
  {
    label: "标注信息",
    field: 'htmlList',
    component: 'Input',
    colProps: {span: 6},
  },
  {
    label: "标签原文本内容",
    field: 'strList',
    component: 'Input',
    colProps: {span: 6},
  },
  {
    label: "扫描次数",
    field: 'numberScans',
    component: 'Input',
    colProps: {span: 6},
  },
  {
    label: "是否修改",
    field: 'isRevise',
    component: 'JDictSelectTag',
    componentProps:{
      dictCode: "modify_state"
    },
    colProps: {span: 6},
  },
  {
    label: "是否忽略",
    field: 'isIgnore',
    component: 'JDictSelectTag',
    componentProps:{
      dictCode: "verify_status"
    },
    colProps: {span: 6},
  },
  {
    label: "复核时间",
    field: "checkTime",
    component: 'RangePicker',
    componentProps: {
      showTime: true,
    },
    colProps: {span: 6},
  },
  {
    label: "复核状态",
    field: "checkState",
    component: 'Input', //TODO 范围查询
    colProps: {span: 6},
  },
  {
    label: "复核校对个数",
    field: 'checkErrorCount',
    component: 'Input',
    colProps: {span: 6},
  },
  {
    label: "复核信息",
    field: 'checkMessage',
    component: 'Input',
    colProps: {span: 6},
  },
  {
    label: "是否是失效",
    field: 'isInvalid',
    component: 'JDictSelectTag',
    componentProps:{
      dictCode: "verify_status"
    },
    colProps: {span: 6},
  },
];

//表单数据
export const formSchema: FormSchema[] = [
  {
    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: 'retMsg',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入标注后网页内容!'},
             ];
    },
  },
  {
    label: '错误个数',
    field: 'errorCount',
    component: 'InputNumber',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入错误个数!'},
             ];
    },
  },
  {
    label: '标注信息',
    field: 'htmlList',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入标注信息!'},
             ];
    },
  },
  {
    label: '标签原文本内容',
    field: 'strList',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入标签原文本内容!'},
             ];
    },
  },
  {
    label: '定位标注信息',
    field: 'ahtmlList',
    component: 'Input',
  },
  {
    label: '扫描次数',
    field: 'numberScans',
    component: 'InputNumber',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入扫描次数!'},
             ];
    },
  },
  {
    label: '是否修改',
    field: 'isRevise',
    component: 'JDictSelectTag',
    componentProps:{
      dictCode: "modify_state"
    },
    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',
    componentProps: {
      showTime: true,
      valueFormat: 'YYYY-MM-DD HH:mm:ss'
    },
    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: 'checkErrorCount',
    component: 'InputNumber',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入复核校对个数!'},
             ];
    },
  },
  {
    label: '复核信息',
    field: 'checkMessage',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入复核信息!'},
             ];
    },
  },
  {
    label: '是否是失效',
    field: 'isInvalid',
    component: 'JDictSelectTag',
    componentProps:{
      dictCode: "verify_status"
    },
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入是否是失效!'},
             ];
    },
  },
	// TODO 主键隐藏字段，目前写死为ID
  {
    label: '',
    field: 'id',
    component: 'Input',
    show: false,
  },
];
